IGUISpinBox.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright (C) 2006-2012 Michael Zeilfelder
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef __I_GUI_SPIN_BOX_H_INCLUDED__
  5. #define __I_GUI_SPIN_BOX_H_INCLUDED__
  6. #include "IGUIElement.h"
  7. namespace irr
  8. {
  9. namespace gui
  10. {
  11. class IGUIEditBox;
  12. //! Single line edit box + spin buttons
  13. /** \par This element can create the following events of type EGUI_EVENT_TYPE:
  14. \li EGET_SPINBOX_CHANGED
  15. */
  16. class IGUISpinBox : public IGUIElement
  17. {
  18. public:
  19. //! constructor
  20. IGUISpinBox(IGUIEnvironment* environment, IGUIElement* parent,
  21. s32 id, core::rect<s32> rectangle)
  22. : IGUIElement(EGUIET_SPIN_BOX, environment, parent, id, rectangle) {}
  23. //! Access the edit box used in the spin control
  24. virtual IGUIEditBox* getEditBox() const = 0;
  25. //! set the current value of the spinbox
  26. /** \param val: value to be set in the spinbox */
  27. virtual void setValue(f32 val) = 0;
  28. //! Get the current value of the spinbox
  29. virtual f32 getValue() const = 0;
  30. //! set the range of values which can be used in the spinbox
  31. /** \param min: minimum value
  32. \param max: maximum value */
  33. virtual void setRange(f32 min, f32 max) = 0;
  34. //! get the minimum value which can be used in the spinbox
  35. virtual f32 getMin() const = 0;
  36. //! get the maximum value which can be used in the spinbox
  37. virtual f32 getMax() const = 0;
  38. //! Step size by which values are changed when pressing the spinbuttons
  39. /** The step size also determines the number of decimal places to display
  40. \param step: stepsize used for value changes when pressing spinbuttons */
  41. virtual void setStepSize(f32 step=1.f) = 0;
  42. //! Sets the number of decimal places to display.
  43. //! Note that this also rounds the range to the same number of decimal places.
  44. /** \param places: The number of decimal places to display, use -1 to reset */
  45. virtual void setDecimalPlaces(s32 places) = 0;
  46. //! get the current step size
  47. virtual f32 getStepSize() const = 0;
  48. };
  49. } // end namespace gui
  50. } // end namespace irr
  51. #endif // __I_GUI_SPIN_BOX_H_INCLUDED__