BsGUIIntField.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUIElementContainer.h"
  4. namespace BansheeEditor
  5. {
  6. class BS_ED_EXPORT GUIIntField : public BS::GUIElementContainer
  7. {
  8. struct PrivatelyConstruct {};
  9. public:
  10. static const CM::String& getGUITypeName();
  11. static GUIIntField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent,
  12. const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
  13. static GUIIntField* create(BS::GUIWidget& parent, const CM::HString& labelText,
  14. const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
  15. static GUIIntField* create(BS::GUIWidget& parent,
  16. const BS::GUIOptions& layoutOptions, BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
  17. static GUIIntField* create(BS::GUIWidget& parent, const BS::GUIContent& labelContent,
  18. BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
  19. static GUIIntField* create(BS::GUIWidget& parent, const CM::HString& labelText,
  20. BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
  21. static GUIIntField* create(BS::GUIWidget& parent,
  22. BS::GUIElementStyle* labelStyle = nullptr, BS::GUIElementStyle* inputBoxStyle = nullptr);
  23. GUIIntField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent, const BS::GUIContent& labelContent,
  24. BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
  25. GUIIntField(const PrivatelyConstruct& dummy, BS::GUIWidget& parent,
  26. BS::GUIElementStyle* labelStyle, BS::GUIElementStyle* inputBoxStyle, const BS::GUILayoutOptions& layoutOptions);
  27. CM::INT32 getValue() const;
  28. void setValue(CM::INT32 value);
  29. void setLabelWidth(CM::UINT32 value);
  30. void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
  31. CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
  32. CM::Vector2I _getOptimalSize() const;
  33. protected:
  34. virtual ~GUIIntField();
  35. void updateClippedBounds();
  36. protected:
  37. static const CM::INT32 DRAG_SPEED;
  38. CM::UINT32 mLabelWidth;
  39. BS::GUILabel* mLabel;
  40. BS::GUIInputBox* mInputBox;
  41. CM::INT32 mLastDragPos;
  42. bool mIsDragging;
  43. bool mIsDragCursorSet;
  44. virtual bool mouseEvent(const BS::GUIMouseEvent& ev);
  45. static bool intFilter(const CM::WString& str);
  46. };
  47. }