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 "elements/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 {
00063 class CEGUIEXPORT Spinner : public Window
00064 {
00065 public:
00070 enum TextInputMode
00071 {
00072 FloatingPoint,
00073 Integer,
00074 Hexadecimal,
00075 Octal
00076 };
00077
00078
00079
00080
00081 static const String WidgetTypeName;
00082 static const String EventNamespace;
00083 static const String EventValueChanged;
00084 static const String EventStepChanged;
00085 static const String EventMaximumValueChanged;
00086 static const String EventMinimumValueChanged;
00087 static const String EventTextInputModeChanged;
00088
00089
00090
00091
00092 static const String EditboxNameSuffix;
00093 static const String IncreaseButtonNameSuffix;
00094 static const String DecreaseButtonNameSuffix;
00095
00096
00097
00098
00103 Spinner(const String& type, const String& name);
00104
00109 virtual ~Spinner(void);
00110
00121 void initialiseComponents(void);
00122
00123
00124
00125
00126
00134 float getCurrentValue(void) const;
00135
00144 float getStepSize(void) const;
00145
00153 float getMaximumValue(void) const;
00154
00162 float getMinimumValue(void) const;
00163
00172 TextInputMode getTextInputMode(void) const;
00173
00174
00175
00176
00187 void setCurrentValue(float value);
00188
00200 void setStepSize(float step);
00201
00212 void setMaximumValue(float maxValue);
00213
00224 void setMinimumValue(float minVaue);
00225
00237 void setTextInputMode(TextInputMode mode);
00238
00239 protected:
00240
00241
00242
00243 static const String FloatValidator;
00244 static const String IntegerValidator;
00245 static const String HexValidator;
00246 static const String OctalValidator;
00247
00248
00249
00250
00260 virtual float getValueFromText(void) const;
00261
00269 virtual String getTextFromValue(void) const;
00270
00271
00282 virtual bool testClassName_impl(const String& class_name) const
00283 {
00284 if (class_name=="Spinner") return true;
00285 return Window::testClassName_impl(class_name);
00286 }
00287
00299 PushButton* getIncreaseButton() const;
00300
00312 PushButton* getDecreaseButton() const;
00313
00324 Editbox* getEditbox() const;
00325
00326
00327
00328
00329 virtual void onFontChanged(WindowEventArgs& e);
00330 virtual void onTextChanged(WindowEventArgs& e);
00331 virtual void onActivated(ActivationEventArgs& e);
00332
00333
00334
00335
00346 virtual void onValueChanged(WindowEventArgs& e);
00347
00358 virtual void onStepChanged(WindowEventArgs& e);
00359
00370 virtual void onMaximumValueChanged(WindowEventArgs& e);
00371
00382 virtual void onMinimumValueChanged(WindowEventArgs& e);
00383
00394 virtual void onTextInputModeChanged(WindowEventArgs& e);
00395
00396
00397
00398
00399 bool handleIncreaseButton(const EventArgs& e);
00400 bool handleDecreaseButton(const EventArgs& e);
00401 bool handleEditTextChange(const EventArgs& e);
00402
00403
00404
00405
00406
00407 float d_stepSize;
00408 float d_currentValue;
00409 float d_maxValue;
00410 float d_minValue;
00411 TextInputMode d_inputMode;
00412
00413 private:
00414
00415
00416
00417 static SpinnerProperties::CurrentValue d_currentValueProperty;
00418 static SpinnerProperties::StepSize d_stepSizeProperty;
00419 static SpinnerProperties::MaximumValue d_maxValueProperty;
00420 static SpinnerProperties::MinimumValue d_minValueProperty;
00421 static SpinnerProperties::TextInputMode d_textInputModeProperty;
00422
00423
00424
00425
00433 void addSpinnerProperties(void);
00434 };
00435
00436 }
00437
00438 #if defined(_MSC_VER)
00439 # pragma warning(pop)
00440 #endif
00441
00442 #endif // end of guard _CEGUISpinner_h_