BsGUIIntField.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUIFieldBase.h"
  4. namespace BansheeEngine
  5. {
  6. class BS_ED_EXPORT GUIIntField : public TGUIField<GUIIntField>
  7. {
  8. public:
  9. static const String& getGUITypeName();
  10. static const String& getInputStyleType();
  11. GUIIntField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
  12. const String& style, const GUIDimensions& dimensions, bool withLabel);
  13. INT32 getValue() const { return mValue; }
  14. void setValue(INT32 value);
  15. void setRange(INT32 min, INT32 max);
  16. bool hasInputFocus() const { return mHasInputFocus; }
  17. /**
  18. * @copydoc GUIElement::setTint
  19. */
  20. virtual void setTint(const Color& color);
  21. Event<void(INT32)> onValueChanged;
  22. protected:
  23. virtual ~GUIIntField();
  24. void updateClippedBounds();
  25. bool _hasCustomCursor(const Vector2I position, CursorType& type) const;
  26. virtual bool mouseEvent(const GUIMouseEvent& ev);
  27. void styleUpdated();
  28. void valueChanged(const WString& newValue);
  29. void focusGained();
  30. void focusLost();
  31. static bool intFilter(const WString& str);
  32. static const INT32 DRAG_SPEED;
  33. GUIInputBox* mInputBox;
  34. INT32 mValue;
  35. INT32 mLastDragPos;
  36. INT32 mMinValue;
  37. INT32 mMaxValue;
  38. bool mIsDragging;
  39. bool mIsDragCursorSet;
  40. bool mHasInputFocus;
  41. };
  42. }