]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CGUISpinBox.h
1a84359af7faa07c1598949be0d5d058afb06677
[irrlicht.git] / source / Irrlicht / CGUISpinBox.h
1 // Copyright (C) 2006-2012 Michael Zeilfelder\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __C_GUI_SPIN_BOX_H_INCLUDED__\r
6 #define __C_GUI_SPIN_BOX_H_INCLUDED__\r
7 \r
8 #include "IrrCompileConfig.h"\r
9 #ifdef _IRR_COMPILE_WITH_GUI_\r
10 \r
11 #include "IGUISpinBox.h"\r
12 \r
13 namespace irr\r
14 {\r
15 namespace gui\r
16 {\r
17         class IGUIEditBox;\r
18         class IGUIButton;\r
19 \r
20         class CGUISpinBox : public IGUISpinBox\r
21         {\r
22         public:\r
23 \r
24                 //! constructor\r
25                 CGUISpinBox(const wchar_t* text, bool border, IGUIEnvironment* environment,\r
26                         IGUIElement* parent, s32 id, const core::rect<s32>& rectangle);\r
27 \r
28                 //! destructor\r
29                 virtual ~CGUISpinBox();\r
30 \r
31                 //! Access the edit box used in the spin control\r
32                 /** \param enable: If set to true, the override color, which can be set\r
33                 with IGUIEditBox::setOverrideColor is used, otherwise the\r
34                 EGDC_BUTTON_TEXT color of the skin. */\r
35                 virtual IGUIEditBox* getEditBox() const _IRR_OVERRIDE_;\r
36 \r
37                 //! set the current value of the spinbox\r
38                 /** \param val: value to be set in the spinbox */\r
39                 virtual void setValue(f32 val) _IRR_OVERRIDE_;\r
40 \r
41                 //! Get the current value of the spinbox\r
42                 virtual f32 getValue() const _IRR_OVERRIDE_;\r
43 \r
44                 //! set the range of values which can be used in the spinbox\r
45                 /** \param min: minimum value\r
46                 \param max: maximum value */\r
47                 virtual void setRange(f32 min, f32 max) _IRR_OVERRIDE_;\r
48 \r
49                 //! get the minimum value which can be used in the spinbox\r
50                 virtual f32 getMin() const _IRR_OVERRIDE_;\r
51 \r
52                 //! get the maximum value which can be used in the spinbox\r
53                 virtual f32 getMax() const _IRR_OVERRIDE_;\r
54 \r
55                 //! step size by which values are changed when pressing the spin buttons\r
56                 /** \param step: stepsize used for value changes when pressing spin buttons */\r
57                 virtual void setStepSize(f32 step=1.f) _IRR_OVERRIDE_;\r
58 \r
59                 //! returns the step size\r
60                 virtual f32 getStepSize() const _IRR_OVERRIDE_;\r
61 \r
62                 //! called if an event happened.\r
63                 virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_;\r
64 \r
65                 //! Draws the element and its children.\r
66                 virtual void draw() _IRR_OVERRIDE_;\r
67 \r
68                 //! Sets the new caption of the element\r
69                 virtual void setText(const wchar_t* text) _IRR_OVERRIDE_;\r
70 \r
71                 //! Returns caption of this element.\r
72                 virtual const wchar_t* getText() const _IRR_OVERRIDE_;\r
73 \r
74                 //! Sets the number of decimal places to display.\r
75                 //! Note that this also rounds the range to the same number of decimal places.\r
76                 /** \param places: The number of decimal places to display, use -1 to reset */\r
77                 virtual void setDecimalPlaces(s32 places) _IRR_OVERRIDE_;\r
78 \r
79                 //! Sets when the spinbox has to validate entered text.\r
80                 /** \param validateOn Can be any combination of EGUI_SPINBOX_VALIDATION bit flags */\r
81                 virtual void setValidateOn(u32 validateOn) _IRR_OVERRIDE_;\r
82 \r
83                 //! Gets when the spinbox has to validate entered text.\r
84                 virtual u32 getValidateOn() const _IRR_OVERRIDE_;\r
85 \r
86                 //! Writes attributes of the element.\r
87                 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;\r
88 \r
89                 //! Reads attributes of the element\r
90                 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;\r
91 \r
92         protected:\r
93                 virtual void verifyValueRange();\r
94                 void refreshSprites();\r
95 \r
96                 IGUIEditBox * EditBox;\r
97                 IGUIButton * ButtonSpinUp;\r
98                 IGUIButton * ButtonSpinDown;\r
99                 video::SColor CurrentIconColor;\r
100                 f32 StepSize;\r
101                 f32 RangeMin;\r
102                 f32 RangeMax;\r
103 \r
104                 core::stringw FormatString;\r
105                 s32 DecimalPlaces;\r
106                 u32 ValidateOn; // combination of EGUI_SPINBOX_VALIDATION bit-flags\r
107         };\r
108 \r
109 \r
110 } // end namespace gui\r
111 } // end namespace irr\r
112 \r
113 #endif // _IRR_COMPILE_WITH_GUI_\r
114 \r
115 #endif // __C_GUI_SPIN_BOX_H_INCLUDED__\r
116 \r