libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
checkbox.h
Go to the documentation of this file.
1
8#pragma once
9
11#include <promeki/core/string.h>
12#include <promeki/tui/widget.h>
13
15
24class TuiCheckBox : public TuiWidget {
25 PROMEKI_OBJECT(TuiCheckBox, TuiWidget)
26 public:
27 TuiCheckBox(const String &text = String(), ObjectBase *parent = nullptr);
28 ~TuiCheckBox() override;
29
30 void setText(const String &text);
31 const String &text() const { return _text; }
32
33 bool isChecked() const { return _checked; }
34 void setChecked(bool checked);
35
36 void toggle();
37
38 Size2Di32 sizeHint() const override;
39
40 PROMEKI_SIGNAL(toggled, bool)
41
42 protected:
43 void paintEvent(TuiPaintEvent *e) override;
44 void keyEvent(KeyEvent *e) override;
45 void mouseEvent(MouseEvent *e) override;
46 void focusInEvent(Event *e) override;
47 void focusOutEvent(Event *e) override;
48
49 private:
50 String _text;
51 bool _checked = false;
52};
53
Base class for the event system.
Definition event.h:29
Event delivered when a key is pressed or released.
Definition keyevent.h:22
Dynamic array container wrapping std::vector.
Definition list.h:40
Event delivered for mouse input.
Definition mouseevent.h:23
Base object for promeki.
Definition objectbase.h:129
ObjectBase * parent() const
Returns the parent object, if one. nullptr if none.
Definition objectbase.h:258
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
Toggleable checkbox with text label.
Definition checkbox.h:24
Size2Di32 sizeHint() const override
Returns the preferred size. Override in subclasses.
void focusInEvent(Event *e) override
Called when the widget gains focus.
void focusOutEvent(Event *e) override
Called when the widget loses focus.
void paintEvent(TuiPaintEvent *e) override
Called to paint the widget. Override in subclasses.
void mouseEvent(MouseEvent *e) override
Called on mouse input. Override in subclasses.
void keyEvent(KeyEvent *e) override
Called on keyboard input. Override in subclasses.
Event delivered when a TUI widget needs to repaint.
Definition widget.h:28
Base class for all TUI widgets.
Definition widget.h:88
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19