BsGUIFloatField.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUIFieldBase.h"
  4. namespace BansheeEngine
  5. {
  6. class BS_ED_EXPORT GUIFloatField : public TGUIField<GUIFloatField>
  7. {
  8. public:
  9. static const String& getGUITypeName();
  10. static const String& getInputStyleType();
  11. GUIFloatField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
  12. const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
  13. float getValue() const { return mValue; }
  14. void setValue(float value);
  15. bool hasInputFocus() const { return mHasInputFocus; }
  16. Event<void(float)> onValueChanged;
  17. protected:
  18. virtual ~GUIFloatField();
  19. void updateClippedBounds();
  20. bool _hasCustomCursor(const Vector2I position, CursorType& type) const;
  21. virtual bool mouseEvent(const GUIMouseEvent& ev);
  22. void styleUpdated();
  23. void valueChanged(const WString& newValue);
  24. void focusGained();
  25. void focusLost();
  26. static bool floatFilter(const WString& str);
  27. static const float DRAG_SPEED;
  28. GUIInputBox* mInputBox;
  29. float mValue;
  30. INT32 mLastDragPos;
  31. bool mIsDragging;
  32. bool mHasInputFocus;
  33. };
  34. }