BsGUIIntField.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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) override;
  21. Event<void(INT32)> onValueChanged;
  22. protected:
  23. virtual ~GUIIntField();
  24. void updateClippedBounds() override;
  25. bool _hasCustomCursor(const Vector2I position, CursorType& type) const override;
  26. bool _mouseEvent(const GUIMouseEvent& ev) override;
  27. void styleUpdated() override;
  28. void valueChanged(const WString& newValue);
  29. void valueChanged(INT32 newValue);
  30. void focusGained();
  31. void focusLost();
  32. static bool intFilter(const WString& str);
  33. static const INT32 DRAG_SPEED;
  34. GUIInputBox* mInputBox;
  35. INT32 mValue;
  36. INT32 mLastDragPos;
  37. INT32 mMinValue;
  38. INT32 mMaxValue;
  39. bool mIsDragging;
  40. bool mIsDragCursorSet;
  41. bool mHasInputFocus;
  42. };
  43. }