summaryrefslogtreecommitdiff
path: root/Widgets/TextBox.h
diff options
context:
space:
mode:
Diffstat (limited to 'Widgets/TextBox.h')
-rw-r--r--Widgets/TextBox.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/Widgets/TextBox.h b/Widgets/TextBox.h
new file mode 100644
index 0000000000..89a748cb25
--- /dev/null
+++ b/Widgets/TextBox.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include "Widget.h"
+
+class TextBox final : public Widget {
+public:
+ explicit TextBox(Widget* parent = nullptr);
+ virtual ~TextBox() override;
+
+ String text() const { return m_text; }
+ void setText(String&&);
+
+private:
+ virtual void onPaint(PaintEvent&) override;
+ virtual void onMouseDown(MouseEvent&) override;
+ virtual void onKeyDown(KeyEvent&) override;
+ virtual void onTimer(TimerEvent&) override;
+
+ void handleBackspace();
+
+ String m_text;
+ unsigned m_cursorPosition { 0 };
+ bool m_cursorBlinkState { false };
+};
+