mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:57:46 +00:00
Start working on a simple TextBox widget.
This commit is contained in:
parent
6f1b384cde
commit
dfb70ed234
7 changed files with 201 additions and 2 deletions
25
Widgets/TextBox.h
Normal file
25
Widgets/TextBox.h
Normal file
|
@ -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 };
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue