Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUISlider.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUISlider.h
00003         created:        13/4/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Interface to base class for Slider widget
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUISlider_h_
00027 #define _CEGUISlider_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIWindow.h"
00031 #include "elements/CEGUISliderProperties.h"
00032 
00033 
00034 #if defined(_MSC_VER)
00035 #       pragma warning(push)
00036 #       pragma warning(disable : 4251)
00037 #endif
00038 
00039 
00040 // Start of CEGUI namespace section
00041 namespace CEGUI
00042 {
00043 
00051 class CEGUIBASE_API Slider : public Window
00052 {
00053 public:
00054         static const String EventNamespace;                             
00055 
00056 
00057         /*************************************************************************
00058                 Event name constants
00059         *************************************************************************/
00060         static const String EventValueChanged;          
00061         static const String EventThumbTrackStarted;     
00062         static const String EventThumbTrackEnded;               
00063 
00064 
00065         /*************************************************************************
00066                 Accessors
00067         *************************************************************************/
00075         float   getCurrentValue(void) const                     {return d_value;}
00076 
00077 
00085         float   getMaxValue(void) const                         {return d_maxValue;}
00086 
00087 
00098         float   getClickStep(void) const                {return d_step;}
00099 
00100 
00101         /*************************************************************************
00102                 Manipulators
00103         *************************************************************************/
00114         virtual void    initialise(void);
00115 
00116 
00127         void    setMaxValue(float maxVal);
00128 
00129 
00140         void    setCurrentValue(float value);
00141 
00142 
00156         void    setClickStep(float step)                {d_step = step;}
00157 
00158 
00159         /*************************************************************************
00160                 Construction / Destruction
00161         *************************************************************************/
00166         Slider(const String& type, const String& name);
00167 
00168 
00173         virtual ~Slider(void);
00174 
00175 
00176 protected:
00177         /*************************************************************************
00178                 Implementation Functions
00179         *************************************************************************/
00184         void    addSliderEvents(void);
00185 
00186 
00191         virtual Thumb*  createThumb(void) const         = 0;
00192 
00193 
00198         virtual void    layoutComponentWidgets(void)    = 0;
00199 
00200 
00205         virtual void    updateThumb(void)       = 0;
00206 
00207 
00215         virtual float   getValueFromThumb(void) const   = 0;
00216 
00217 
00231         virtual float   getAdjustDirectionFromPoint(const Point& pt) const      = 0;
00232 
00233 
00238         bool    handleThumbMoved(const EventArgs& e);
00239 
00240 
00245         bool    handleThumbTrackStarted(const EventArgs& e);
00246 
00247 
00252         bool    handleThumbTrackEnded(const EventArgs& e);
00253 
00254 
00255         /*************************************************************************
00256                 New event handlers for slider widget
00257         *************************************************************************/
00262         virtual void    onValueChanged(WindowEventArgs& e);
00263 
00264 
00269         virtual void    onThumbTrackStarted(WindowEventArgs& e);
00270 
00271 
00276         virtual void    onThumbTrackEnded(WindowEventArgs& e);
00277 
00278 
00279         /*************************************************************************
00280                 Overridden event handlers
00281         *************************************************************************/
00282         virtual void    onMouseButtonDown(MouseEventArgs& e);
00283         virtual void    onSized(WindowEventArgs& e);
00284         virtual void    onMouseWheel(MouseEventArgs& e);
00285 
00286 
00287         /*************************************************************************
00288                 Implementation Data
00289         *************************************************************************/
00290         float   d_value;                
00291         float   d_maxValue;             
00292         float   d_step;                 
00293 
00294         // Pointers to the controls that make up the slider
00295         Thumb*  d_thumb;                
00296 
00297 
00298 private:
00299         /*************************************************************************
00300                 Static Properties for this class
00301         *************************************************************************/
00302         static SliderProperties::CurrentValue   d_currentValueProperty;
00303         static SliderProperties::MaximumValue   d_maximumValueProperty;
00304         static SliderProperties::ClickStepSize  d_clickStepSizeProperty;
00305 
00306 
00307         /*************************************************************************
00308                 Private methods
00309         *************************************************************************/
00310         void    addSliderProperties(void);
00311 };
00312 
00313 } // End of  CEGUI namespace section
00314 
00315 #if defined(_MSC_VER)
00316 #       pragma warning(pop)
00317 #endif
00318 
00319 #endif  // end of guard _CEGUISlider_h_

Generated on Wed Feb 16 12:41:07 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1