mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:35:09 +00:00
29 lines
734 B
C++
29 lines
734 B
C++
#pragma once
|
|
|
|
#include "GWidget.h"
|
|
#include <AK/Function.h>
|
|
|
|
class GTextBox final : public GWidget {
|
|
public:
|
|
explicit GTextBox(GWidget* parent);
|
|
virtual ~GTextBox() override;
|
|
|
|
String text() const { return m_text; }
|
|
void set_text(String&&);
|
|
|
|
Function<void(GTextBox&)> onReturnPressed;
|
|
|
|
private:
|
|
virtual const char* class_name() const override { return "GTextBox"; }
|
|
virtual void paint_event(GPaintEvent&) override;
|
|
virtual void mousedown_event(GMouseEvent&) override;
|
|
virtual void keydown_event(GKeyEvent&) override;
|
|
virtual void timerEvent(GTimerEvent&) override;
|
|
|
|
void handle_backspace();
|
|
|
|
String m_text;
|
|
unsigned m_cursorPosition { 0 };
|
|
bool m_cursorBlinkState { false };
|
|
};
|
|
|