15 virtual void Create()
override;
17 void GatherInputFieldProperties(std::vector<Property>& props);
18 virtual void Tick(
float deltaTime)
override;
19 virtual void EditorTick(
float deltaTime)
override;
23 void SetText(
const std::string& text);
24 const std::string& GetText()
const;
25 void SetPlaceholder(
const std::string& placeholder);
26 const std::string& GetPlaceholder()
const;
29 void SetCaretPosition(int32_t pos);
30 int32_t GetCaretPosition()
const;
32 void ClearSelection();
33 bool HasSelection()
const;
34 std::string GetSelectedText()
const;
35 void DeleteSelection();
36 void Select(int32_t start, int32_t end);
37 int32_t GetSelectionStart()
const;
38 int32_t GetSelectionEnd()
const;
41 void SetFocused(
bool focused);
42 bool IsFocused()
const;
45 void SetPasswordMode(
bool enabled);
46 bool IsPasswordMode()
const;
47 void SetMaxLength(int32_t maxLen);
48 int32_t GetMaxLength()
const;
49 void SetEditable(
bool editable);
50 bool IsEditable()
const;
53 void SetBackgroundTexture(
Texture* texture);
54 Texture* GetBackgroundTexture();
55 void SetBackgroundColor(glm::vec4 color);
56 glm::vec4 GetBackgroundColor();
57 void SetFocusedBackgroundColor(glm::vec4 color);
58 glm::vec4 GetFocusedBackgroundColor();
59 void SetTextColor(glm::vec4 color);
60 glm::vec4 GetTextColor();
61 void SetPlaceholderColor(glm::vec4 color);
62 glm::vec4 GetPlaceholderColor();
63 void SetCaretColor(glm::vec4 color);
64 glm::vec4 GetCaretColor();
65 void SetSelectionColor(glm::vec4 color);
66 glm::vec4 GetSelectionColor();
67 void SetTextPadding(
float padding);
68 float GetTextPadding()
const;
71 Quad* GetBackground();
72 Text* GetTextWidget();
79 void InsertCharacter(
char c);
80 void InsertText(
const std::string& text);
81 void DeleteCharacter(
bool forward);
82 void MoveCaret(int32_t delta,
bool select);
83 void MoveCaretToWordBoundary(int32_t direction,
bool select);
85 float GetCaretXPosition();
86 int32_t GetCharacterAtPosition(
float x);
87 void UpdateDisplayText();
88 void UpdateCaretVisual();
89 void UpdateSelectionVisual();
90 void EnsureCaretVisible();
91 void ExtendSelection();
92 void EmitTextChanged();
96 std::string mPlaceholderText =
"Enter text...";
99 int32_t mCaretPosition = 0;
100 int32_t mSelectionStart = -1;
101 int32_t mSelectionEnd = -1;
102 int32_t mSelectionAnchor = -1;
103 bool mFocused =
false;
104 bool mEditable =
true;
107 float mCaretBlinkTime = 0.0f;
108 float mCaretBlinkRate = 0.5f;
109 bool mCaretVisible =
true;
112 bool mPasswordMode =
false;
113 int32_t mMaxLength = 0;
114 char mPasswordChar =
'*';
118 glm::vec4 mBackgroundColor = { 0.2f, 0.2f, 0.2f, 1.0f };
119 glm::vec4 mFocusedBackgroundColor = { 0.25f, 0.25f, 0.25f, 1.0f };
120 glm::vec4 mTextColor = { 1.0f, 1.0f, 1.0f, 1.0f };
121 glm::vec4 mPlaceholderColor = { 0.5f, 0.5f, 0.5f, 1.0f };
122 glm::vec4 mCaretColor = { 1.0f, 1.0f, 1.0f, 1.0f };
123 glm::vec4 mSelectionColor = { 0.3f, 0.5f, 0.8f, 0.5f };
124 float mTextPadding = 4.0f;
125 float mScrollOffset = 0.0f;