00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
00041 namespace CEGUI
00042 {
00043
00051 class CEGUIEXPORT Slider : public Window
00052 {
00053 public:
00054 static const String EventNamespace;
00055
00056
00057
00058
00059
00060 static const String EventValueChanged;
00061 static const String EventThumbTrackStarted;
00062 static const String EventThumbTrackEnded;
00063
00064
00065
00066
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
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
00161
00166 Slider(const String& type, const String& name);
00167
00168
00173 virtual ~Slider(void);
00174
00175
00176 protected:
00177
00178
00179
00184 void addSliderEvents(void);
00185
00186
00194 virtual Thumb* createThumb(const String& name) const = 0;
00195
00196
00201 virtual void updateThumb(void) = 0;
00202
00203
00211 virtual float getValueFromThumb(void) const = 0;
00212
00213
00227 virtual float getAdjustDirectionFromPoint(const Point& pt) const = 0;
00228
00229
00234 bool handleThumbMoved(const EventArgs& e);
00235
00236
00241 bool handleThumbTrackStarted(const EventArgs& e);
00242
00243
00248 bool handleThumbTrackEnded(const EventArgs& e);
00249
00250
00261 virtual bool testClassName_impl(const String& class_name) const
00262 {
00263 if (class_name==(const utf8*)"Slider") return true;
00264 return Window::testClassName_impl(class_name);
00265 }
00266
00267
00268
00269
00270
00275 virtual void onValueChanged(WindowEventArgs& e);
00276
00277
00282 virtual void onThumbTrackStarted(WindowEventArgs& e);
00283
00284
00289 virtual void onThumbTrackEnded(WindowEventArgs& e);
00290
00291
00292
00293
00294
00295 virtual void onMouseButtonDown(MouseEventArgs& e);
00296 virtual void onMouseWheel(MouseEventArgs& e);
00297
00298
00299
00300
00301
00302 float d_value;
00303 float d_maxValue;
00304 float d_step;
00305
00306
00307 Thumb* d_thumb;
00308
00309
00310 private:
00311
00312
00313
00314 static SliderProperties::CurrentValue d_currentValueProperty;
00315 static SliderProperties::MaximumValue d_maximumValueProperty;
00316 static SliderProperties::ClickStepSize d_clickStepSizeProperty;
00317
00318
00319
00320
00321
00322 void addSliderProperties(void);
00323 };
00324
00325 }
00326
00327 #if defined(_MSC_VER)
00328 # pragma warning(pop)
00329 #endif
00330
00331 #endif // end of guard _CEGUISlider_h_