BsGUITextField.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUIElementContainer.h"
  4. namespace BansheeEngine
  5. {
  6. class BS_ED_EXPORT GUITextField : public GUIElementContainer
  7. {
  8. struct PrivatelyConstruct {};
  9. public:
  10. static const String& getLabelStyleType();
  11. static const String& getGUITypeName();
  12. static const String& getInputStyleType();
  13. static GUITextField* create(bool multiline, const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& layoutOptions,
  14. const String& style = StringUtil::BLANK);
  15. static GUITextField* create(bool multiline, const GUIContent& labelContent, const GUIOptions& layoutOptions,
  16. const String& style = StringUtil::BLANK);
  17. static GUITextField* create(bool multiline, const HString& labelText, UINT32 labelWidth, const GUIOptions& layoutOptions,
  18. const String& style = StringUtil::BLANK);
  19. static GUITextField* create(bool multiline, const HString& labelText, const GUIOptions& layoutOptions,
  20. const String& style = StringUtil::BLANK);
  21. static GUITextField* create(bool multiline, const GUIOptions& layoutOptions, const String& style = StringUtil::BLANK);
  22. static GUITextField* create(bool multiline, const GUIContent& labelContent, UINT32 labelWidth,
  23. const String& style = StringUtil::BLANK);
  24. static GUITextField* create(bool multiline, const GUIContent& labelContent,
  25. const String& style = StringUtil::BLANK);
  26. static GUITextField* create(bool multiline, const HString& labelText, UINT32 labelWidth,
  27. const String& style = StringUtil::BLANK);
  28. static GUITextField* create(bool multiline, const HString& labelText,
  29. const String& style = StringUtil::BLANK);
  30. static GUITextField* create(bool multiline, const String& style = StringUtil::BLANK);
  31. GUITextField(const PrivatelyConstruct& dummy, bool multiline, const GUIContent& labelContent, UINT32 labelWidth,
  32. const String& style, const GUILayoutOptions& layoutOptions, bool withLabel);
  33. void _updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
  34. Rect2I clipRect, UINT8 widgetDepth, UINT16 areaDepth);
  35. Vector2I _getOptimalSize() const;
  36. WString getValue() const { return mValue; }
  37. void setValue(const WString& value);
  38. bool hasInputFocus() const { return mHasInputFocus; }
  39. Event<void(const WString&)> onValueChanged;
  40. protected:
  41. static const UINT32 DEFAULT_LABEL_WIDTH;
  42. virtual ~GUITextField();
  43. void styleUpdated();
  44. void valueChanged(const WString& newValue);
  45. void focusGained();
  46. void focusLost();
  47. GUIInputBox* mInputBox;
  48. GUILayout* mLayout;
  49. GUILabel* mLabel;
  50. bool mHasInputFocus;
  51. WString mValue;
  52. };
  53. }