PixelLightAPI  .
AbstractSlider.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: AbstractSlider.h                               *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLGUI_ABSTRACTSLIDER_H__
00024 #define __PLGUI_ABSTRACTSLIDER_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLGui/Gui/Resources/Timer.h"
00032 #include "PLGui/Widgets/Widget.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLGui {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    Abstract base class for all kind of sliders, scrollbars etc.
00047 */
00048 class AbstractSlider : public Widget {
00049 
00050 
00051     //[-------------------------------------------------------]
00052     //[ Class definition                                      ]
00053     //[-------------------------------------------------------]
00054     pl_class(PLGUI_RTTI_EXPORT, AbstractSlider, "PLGui", PLGui::Widget, "Abstract base class for all kind of sliders, scrollbars etc.")
00055         // Attributes
00056         pl_attribute(MinValue,      int,    1,      ReadWrite,  GetSet, "Minimum value",        "")
00057         pl_attribute(MaxValue,      int,    100,    ReadWrite,  GetSet, "Maximum value",        "")
00058         pl_attribute(Value,         int,    1,      ReadWrite,  GetSet, "Current value",        "")
00059         pl_attribute(StepSize,      int,    10,     ReadWrite,  GetSet, "Standard step size",   "")
00060         pl_attribute(StepSizeFast,  int,    50,     ReadWrite,  GetSet, "Fast step size",       "")
00061         // Signals
00062         pl_signal_1(SignalChangeValue,  int,    "The current value has been changed",   "")
00063     pl_class_end
00064 
00065 
00066     //[-------------------------------------------------------]
00067     //[ Public functions                                      ]
00068     //[-------------------------------------------------------]
00069     public:
00070         /**
00071         *  @brief
00072         *    Constructor
00073         *
00074         *  @param[in] pParent
00075         *    Pointer to the parent widget
00076         */
00077         PLGUI_API AbstractSlider(Widget *pParent = nullptr);
00078 
00079         /**
00080         *  @brief
00081         *    Destructor
00082         */
00083         PLGUI_API virtual ~AbstractSlider();
00084 
00085         /**
00086         *  @brief
00087         *    Get minimum value
00088         *
00089         *  @return
00090         *    Minimum value
00091         */
00092         PLGUI_API int GetMinValue() const;
00093 
00094         /**
00095         *  @brief
00096         *    Set minimum value
00097         *
00098         *  @param[in] nMinValue
00099         *    Minimum value
00100         */
00101         PLGUI_API void SetMinValue(int nMinValue);
00102 
00103         /**
00104         *  @brief
00105         *    Get maximum value
00106         *
00107         *  @return
00108         *    Maximum value
00109         */
00110         PLGUI_API int GetMaxValue() const;
00111 
00112         /**
00113         *  @brief
00114         *    Set maximum value
00115         *
00116         *  @param[in] nMaxValue
00117         *    Maximum value
00118         */
00119         PLGUI_API void SetMaxValue(int nMaxValue);
00120 
00121         /**
00122         *  @brief
00123         *    Get current value
00124         *
00125         *  @return
00126         *    Value
00127         */
00128         PLGUI_API int GetValue() const;
00129 
00130         /**
00131         *  @brief
00132         *    Set current value
00133         *
00134         *  @param[in] nValue
00135         *    Value
00136         */
00137         PLGUI_API void SetValue(int nValue);
00138 
00139         /**
00140         *  @brief
00141         *    Get step size (single step)
00142         *
00143         *  @return
00144         *    Step size
00145         */
00146         PLGUI_API int GetStepSize() const;
00147 
00148         /**
00149         *  @brief
00150         *    Set step size (single step)
00151         *
00152         *  @param[in] nStepSize
00153         *    Step size
00154         */
00155         PLGUI_API void SetStepSize(int nStepSize);
00156 
00157         /**
00158         *  @brief
00159         *    Get step size (fast step)
00160         *
00161         *  @return
00162         *    Step size
00163         */
00164         PLGUI_API int GetStepSizeFast() const;
00165 
00166         /**
00167         *  @brief
00168         *    Set step size (fast step)
00169         *
00170         *  @param[in] nStepSize
00171         *    Step size
00172         */
00173         PLGUI_API void SetStepSizeFast(int nStepSize);
00174 
00175         /**
00176         *  @brief
00177         *    Increase value (single step)
00178         *
00179         *  @remarks
00180         *    Uses the value set by SetStepSize()
00181         */
00182         PLGUI_API void Increase();
00183 
00184         /**
00185         *  @brief
00186         *    Decrease value (single step)
00187         *
00188         *  @remarks
00189         *    Uses the value set by SetStepSize()
00190         */
00191         PLGUI_API void Decrease();
00192 
00193         /**
00194         *  @brief
00195         *    Increase value (fast step)
00196         *
00197         *  @remarks
00198         *    Uses the value set by SetStepSizeFast()
00199         */
00200         PLGUI_API void IncreaseFast();
00201 
00202         /**
00203         *  @brief
00204         *    Decrease value (fast step)
00205         *
00206         *  @remarks
00207         *    Uses the value set by SetStepSizeFast()
00208         */
00209         PLGUI_API void DecreaseFast();
00210 
00211 
00212     //[-------------------------------------------------------]
00213     //[ Protected virtual AbstractSlider functions            ]
00214     //[-------------------------------------------------------]
00215     protected:
00216         /**
00217         *  @brief
00218         *    Called when a new value has been set
00219         *
00220         *  @param[in] nValue
00221         *    Value
00222         */
00223         PLGUI_API virtual void OnChangeValue(int nValue);
00224 
00225 
00226     //[-------------------------------------------------------]
00227     //[ Protected data                                        ]
00228     //[-------------------------------------------------------]
00229     protected:
00230         // Data
00231         int m_nMinValue;        /**< Minimum value */
00232         int m_nMaxValue;        /**< Maximum value */
00233         int m_nValue;           /**< Current value */
00234         int m_nStepSize;        /**< Step size for single steps */
00235         int m_nStepSizeFast;    /**< Step size for fast steps (e.g. page up/down) */
00236 
00237 
00238 };
00239 
00240 
00241 //[-------------------------------------------------------]
00242 //[ Namespace                                             ]
00243 //[-------------------------------------------------------]
00244 } // PLGui
00245 
00246 
00247 #endif // __PLGUI_ABSTRACTSLIDER_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:51
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported