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
00027
00028 #ifndef _CEGUISpinner_h_
00029 #define _CEGUISpinner_h_
00030
00031 #include "../CEGUIBase.h"
00032 #include "../CEGUIWindow.h"
00033 #include "CEGUISpinnerProperties.h"
00034
00035 #if defined(_MSC_VER)
00036 # pragma warning(push)
00037 # pragma warning(disable : 4251)
00038 #endif
00039
00040
00041
00042 namespace CEGUI
00043 {
00052 class CEGUIEXPORT Spinner : public Window
00053 {
00054 public:
00059 enum TextInputMode
00060 {
00061 FloatingPoint,
00062 Integer,
00063 Hexadecimal,
00064 Octal
00065 };
00066
00067
00068
00069
00070 static const String WidgetTypeName;
00071 static const String EventNamespace;
00072
00077 static const String EventValueChanged;
00083 static const String EventStepChanged;
00089 static const String EventMaximumValueChanged;
00095 static const String EventMinimumValueChanged;
00101 static const String EventTextInputModeChanged;
00102
00103
00104
00105
00106 static const String EditboxNameSuffix;
00107 static const String IncreaseButtonNameSuffix;
00108 static const String DecreaseButtonNameSuffix;
00109
00110
00111
00112
00117 Spinner(const String& type, const String& name);
00118
00123 virtual ~Spinner(void);
00124
00135 void initialiseComponents(void);
00136
00137
00138
00139
00140
00148 double getCurrentValue(void) const;
00149
00158 double getStepSize(void) const;
00159
00167 double getMaximumValue(void) const;
00168
00176 double getMinimumValue(void) const;
00177
00186 TextInputMode getTextInputMode(void) const;
00187
00188
00189
00190
00201 void setCurrentValue(double value);
00202
00214 void setStepSize(double step);
00215
00226 void setMaximumValue(double maxValue);
00227
00238 void setMinimumValue(double minVaue);
00239
00251 void setTextInputMode(TextInputMode mode);
00252
00253 protected:
00254
00255
00256
00257 static const String FloatValidator;
00258 static const String IntegerValidator;
00259 static const String HexValidator;
00260 static const String OctalValidator;
00261
00262
00263
00264
00274 virtual double getValueFromText(void) const;
00275
00283 virtual String getTextFromValue(void) const;
00284
00285
00296 virtual bool testClassName_impl(const String& class_name) const
00297 {
00298 if (class_name=="Spinner") return true;
00299 return Window::testClassName_impl(class_name);
00300 }
00301
00313 PushButton* getIncreaseButton() const;
00314
00326 PushButton* getDecreaseButton() const;
00327
00338 Editbox* getEditbox() const;
00339
00340
00341
00342
00343 virtual void onFontChanged(WindowEventArgs& e);
00344 virtual void onTextChanged(WindowEventArgs& e);
00345 virtual void onActivated(ActivationEventArgs& e);
00346
00347
00348
00349
00360 virtual void onValueChanged(WindowEventArgs& e);
00361
00372 virtual void onStepChanged(WindowEventArgs& e);
00373
00384 virtual void onMaximumValueChanged(WindowEventArgs& e);
00385
00396 virtual void onMinimumValueChanged(WindowEventArgs& e);
00397
00408 virtual void onTextInputModeChanged(WindowEventArgs& e);
00409
00410
00411
00412
00413 bool handleIncreaseButton(const EventArgs& e);
00414 bool handleDecreaseButton(const EventArgs& e);
00415 bool handleEditTextChange(const EventArgs& e);
00416
00417
00418
00419
00420
00421 double d_stepSize;
00422 double d_currentValue;
00423 double d_maxValue;
00424 double d_minValue;
00425 TextInputMode d_inputMode;
00426
00427 private:
00428
00429
00430
00431 static SpinnerProperties::CurrentValue d_currentValueProperty;
00432 static SpinnerProperties::StepSize d_stepSizeProperty;
00433 static SpinnerProperties::MaximumValue d_maxValueProperty;
00434 static SpinnerProperties::MinimumValue d_minValueProperty;
00435 static SpinnerProperties::TextInputMode d_textInputModeProperty;
00436
00437
00438
00439
00447 void addSpinnerProperties(void);
00448 };
00449
00450 }
00451
00452 #if defined(_MSC_VER)
00453 # pragma warning(pop)
00454 #endif
00455
00456 #endif // end of guard _CEGUISpinner_h_