libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
button.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <promeki/namespace.h>
11#include <promeki/string.h>
12#include <promeki/tui/widget.h>
13
14PROMEKI_NAMESPACE_BEGIN
15
23class TuiButton : public TuiWidget {
24 PROMEKI_OBJECT(TuiButton, TuiWidget)
25 public:
26 TuiButton(const String &text = String(), ObjectBase *parent = nullptr);
27 ~TuiButton() override;
28
30 void setText(const String &text);
31
33 const String &text() const { return _text; }
34
35 Size2Di32 sizeHint() const override;
36 Size2Di32 minimumSizeHint() const override;
37
39 PROMEKI_SIGNAL(clicked)
40
41 protected:
42 void paintEvent(PaintEvent *e) override;
43 void keyPressEvent(KeyEvent *e) override;
44 void mouseEvent(MouseEvent *e) override;
45 void focusInEvent(Event *e) override;
46 void focusOutEvent(Event *e) override;
47
48 private:
49 String _text;
50 bool _pressed = false;
51};
52
53PROMEKI_NAMESPACE_END
Clickable button with text label.
Definition button.h:23
void paintEvent(PaintEvent *e) override
Emitted when the button is activated.
void setText(const String &text)
Sets the button text.
const String & text() const
Returns the button text.
Definition button.h:33
TUI-specific widget base class.
Definition widget.h:33