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
5 #ifndef __C_GUI_SPIN_BOX_H_INCLUDED__
\r
6 #define __C_GUI_SPIN_BOX_H_INCLUDED__
\r
8 #include "IrrCompileConfig.h"
\r
9 #ifdef _IRR_COMPILE_WITH_GUI_
\r
11 #include "IGUISpinBox.h"
\r
20 class CGUISpinBox : public IGUISpinBox
\r
25 CGUISpinBox(const wchar_t* text, bool border, IGUIEnvironment* environment,
\r
26 IGUIElement* parent, s32 id, const core::rect<s32>& rectangle);
\r
29 virtual ~CGUISpinBox();
\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
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
41 //! Get the current value of the spinbox
\r
42 virtual f32 getValue() const _IRR_OVERRIDE_;
\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
49 //! get the minimum value which can be used in the spinbox
\r
50 virtual f32 getMin() const _IRR_OVERRIDE_;
\r
52 //! get the maximum value which can be used in the spinbox
\r
53 virtual f32 getMax() const _IRR_OVERRIDE_;
\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
59 //! returns the step size
\r
60 virtual f32 getStepSize() const _IRR_OVERRIDE_;
\r
62 //! called if an event happened.
\r
63 virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_;
\r
65 //! Draws the element and its children.
\r
66 virtual void draw() _IRR_OVERRIDE_;
\r
68 //! Sets the new caption of the element
\r
69 virtual void setText(const wchar_t* text) _IRR_OVERRIDE_;
\r
71 //! Returns caption of this element.
\r
72 virtual const wchar_t* getText() const _IRR_OVERRIDE_;
\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
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
83 //! Gets when the spinbox has to validate entered text.
\r
84 virtual u32 getValidateOn() const _IRR_OVERRIDE_;
\r
86 //! Writes attributes of the element.
\r
87 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
\r
89 //! Reads attributes of the element
\r
90 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
\r
93 virtual void verifyValueRange();
\r
94 void refreshSprites();
\r
96 IGUIEditBox * EditBox;
\r
97 IGUIButton * ButtonSpinUp;
\r
98 IGUIButton * ButtonSpinDown;
\r
99 video::SColor CurrentIconColor;
\r
104 core::stringw FormatString;
\r
106 u32 ValidateOn; // combination of EGUI_SPINBOX_VALIDATION bit-flags
\r
110 } // end namespace gui
\r
111 } // end namespace irr
\r
113 #endif // _IRR_COMPILE_WITH_GUI_
\r
115 #endif // __C_GUI_SPIN_BOX_H_INCLUDED__
\r