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 static const String EventValueChanged;
00073 static const String EventStepChanged;
00074 static const String EventMaximumValueChanged;
00075 static const String EventMinimumValueChanged;
00076 static const String EventTextInputModeChanged;
00077
00078
00079
00080
00081 static const String EditboxNameSuffix;
00082 static const String IncreaseButtonNameSuffix;
00083 static const String DecreaseButtonNameSuffix;
00084
00085
00086
00087
00092 Spinner(const String& type, const String& name);
00093
00098 virtual ~Spinner(void);
00099
00110 void initialiseComponents(void);
00111
00112
00113
00114
00115
00123 double getCurrentValue(void) const;
00124
00133 double getStepSize(void) const;
00134
00142 double getMaximumValue(void) const;
00143
00151 double getMinimumValue(void) const;
00152
00161 TextInputMode getTextInputMode(void) const;
00162
00163
00164
00165
00176 void setCurrentValue(double value);
00177
00189 void setStepSize(double step);
00190
00201 void setMaximumValue(double maxValue);
00202
00213 void setMinimumValue(double minVaue);
00214
00226 void setTextInputMode(TextInputMode mode);
00227
00228 protected:
00229
00230
00231
00232 static const String FloatValidator;
00233 static const String IntegerValidator;
00234 static const String HexValidator;
00235 static const String OctalValidator;
00236
00237
00238
00239
00249 virtual double getValueFromText(void) const;
00250
00258 virtual String getTextFromValue(void) const;
00259
00260
00271 virtual bool testClassName_impl(const String& class_name) const
00272 {
00273 if (class_name=="Spinner") return true;
00274 return Window::testClassName_impl(class_name);
00275 }
00276
00288 PushButton* getIncreaseButton() const;
00289
00301 PushButton* getDecreaseButton() const;
00302
00313 Editbox* getEditbox() const;
00314
00315
00316
00317
00318 virtual void onFontChanged(WindowEventArgs& e);
00319 virtual void onTextChanged(WindowEventArgs& e);
00320 virtual void onActivated(ActivationEventArgs& e);
00321
00322
00323
00324
00335 virtual void onValueChanged(WindowEventArgs& e);
00336
00347 virtual void onStepChanged(WindowEventArgs& e);
00348
00359 virtual void onMaximumValueChanged(WindowEventArgs& e);
00360
00371 virtual void onMinimumValueChanged(WindowEventArgs& e);
00372
00383 virtual void onTextInputModeChanged(WindowEventArgs& e);
00384
00385
00386
00387
00388 bool handleIncreaseButton(const EventArgs& e);
00389 bool handleDecreaseButton(const EventArgs& e);
00390 bool handleEditTextChange(const EventArgs& e);
00391
00392
00393
00394
00395
00396 double d_stepSize;
00397 double d_currentValue;
00398 double d_maxValue;
00399 double d_minValue;
00400 TextInputMode d_inputMode;
00401
00402 private:
00403
00404
00405
00406 static SpinnerProperties::CurrentValue d_currentValueProperty;
00407 static SpinnerProperties::StepSize d_stepSizeProperty;
00408 static SpinnerProperties::MaximumValue d_maxValueProperty;
00409 static SpinnerProperties::MinimumValue d_minValueProperty;
00410 static SpinnerProperties::TextInputMode d_textInputModeProperty;
00411
00412
00413
00414
00422 void addSpinnerProperties(void);
00423 };
00424
00425 }
00426
00427 #if defined(_MSC_VER)
00428 # pragma warning(pop)
00429 #endif
00430
00431 #endif // end of guard _CEGUISpinner_h_