blob: 5236749099b4a987958a0abf9c06e51aed44ce74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#pragma once
#include "Widget.h"
#include <AK/Function.h>
class TextBox final : public Widget {
public:
explicit TextBox(Widget* parent = nullptr);
virtual ~TextBox() override;
String text() const { return m_text; }
void setText(String&&);
Function<void(TextBox&)> onReturnPressed;
private:
virtual const char* class_name() const override { return "TextBox"; }
virtual void paintEvent(PaintEvent&) override;
virtual void mouseDownEvent(MouseEvent&) override;
virtual void keyDownEvent(KeyEvent&) override;
virtual void timerEvent(TimerEvent&) override;
void handleBackspace();
String m_text;
unsigned m_cursorPosition { 0 };
bool m_cursorBlinkState { false };
};
|