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 __I_GUI_SPIN_BOX_H_INCLUDED__
\r
6 #define __I_GUI_SPIN_BOX_H_INCLUDED__
\r
8 #include "IGUIElement.h"
\r
16 //! Enumeration bitflag for when to validate the text typed into the spinbox
\r
17 //! Default used by Irrlicht is: (EGUI_SBV_ENTER|EGUI_SBV_LOSE_FOCUS)
\r
18 enum EGUI_SPINBOX_VALIDATION
\r
20 //! Does not validate typed text, probably a bad idea setting this usually.
\r
22 //! Validate on each change. Was default up to Irrlicht 1.8
\r
23 EGUI_SBV_CHANGE = 1,
\r
24 //! Validate when enter was pressed
\r
26 //! Validate when the editbox loses the focus
\r
27 EGUI_SBV_LOSE_FOCUS = 4
\r
31 //! Single line edit box + spin buttons
\r
32 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
\r
33 \li EGET_SPINBOX_CHANGED
\r
35 class IGUISpinBox : public IGUIElement
\r
40 IGUISpinBox(IGUIEnvironment* environment, IGUIElement* parent,
\r
41 s32 id, core::rect<s32> rectangle)
\r
42 : IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
\r
44 //! Access the edit box used in the spin control
\r
45 virtual IGUIEditBox* getEditBox() const = 0;
\r
47 //! set the current value of the spinbox
\r
48 /** \param val: value to be set in the spinbox */
\r
49 virtual void setValue(f32 val) = 0;
\r
51 //! Get the current value of the spinbox
\r
52 virtual f32 getValue() const = 0;
\r
54 //! set the range of values which can be used in the spinbox
\r
55 /** \param min: minimum value
\r
56 \param max: maximum value */
\r
57 virtual void setRange(f32 min, f32 max) = 0;
\r
59 //! get the minimum value which can be used in the spinbox
\r
60 virtual f32 getMin() const = 0;
\r
62 //! get the maximum value which can be used in the spinbox
\r
63 virtual f32 getMax() const = 0;
\r
65 //! Step size by which values are changed when pressing the spinbuttons
\r
66 /** The step size also determines the number of decimal places to display
\r
67 \param step: stepsize used for value changes when pressing spinbuttons */
\r
68 virtual void setStepSize(f32 step=1.f) = 0;
\r
70 //! Sets the number of decimal places to display.
\r
71 //! Note that this also rounds the range to the same number of decimal places.
\r
72 /** \param places: The number of decimal places to display, use -1 to reset */
\r
73 virtual void setDecimalPlaces(s32 places) = 0;
\r
75 //! get the current step size
\r
76 virtual f32 getStepSize() const = 0;
\r
78 //! Sets when the spinbox has to validate entered text.
\r
79 /** \param validateOn Can be any combination of EGUI_SPINBOX_VALIDATION bit flags */
\r
80 virtual void setValidateOn(u32 validateOn) = 0;
\r
82 //! Gets when the spinbox has to validate entered text.
\r
83 /** \return A combination of EGUI_SPINBOX_VALIDATION bit flags */
\r
84 virtual u32 getValidateOn() const = 0;
\r
88 } // end namespace gui
\r
89 } // end namespace irr
\r
91 #endif // __I_GUI_SPIN_BOX_H_INCLUDED__
\r