BsGUIIntField.h 1.2 KB

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