Base class for all UI widgets.
More...
#include <widget.h>
|
| bool | visible = true |
| | Whether the widget is visible.
|
| |
| bool | enabled = true |
| | Whether the widget is enabled.
|
| |
| bool | focusable = false |
| | Whether the widget can receive focus.
|
| |
| Widget * | parent = nullptr |
| | Pointer to the parent widget.
|
| |
| std::vector< std::unique_ptr< Widget > > | children |
| | Child widgets.
|
| |
| asw::Quad< float > | transform |
| | The transform (position and size) of the widget.
|
| |
Base class for all UI widgets.
Definition at line 28 of file widget.h.
◆ Widget() [1/3]
| asw::ui::Widget::Widget |
( |
| ) |
|
|
inline |
◆ ~Widget()
| virtual asw::ui::Widget::~Widget |
( |
| ) |
|
|
virtualdefault |
Default virtual destructor.
◆ Widget() [2/3]
| asw::ui::Widget::Widget |
( |
Widget && | | ) |
|
|
default |
◆ Widget() [3/3]
| asw::ui::Widget::Widget |
( |
const Widget & | | ) |
|
|
delete |
◆ add_child()
template<class T , class... Args>
| T & asw::ui::Widget::add_child |
( |
Args &&... | args | ) |
|
|
inline |
Add a child widget.
- Template Parameters
-
| T | The type of widget to add. Must derive from Widget. |
| Args | Constructor argument types. |
- Parameters
-
| args | Constructor arguments forwarded to T. |
- Returns
- A reference to the newly added child widget.
Definition at line 108 of file widget.h.
◆ draw()
| void asw::ui::Widget::draw |
( |
Context & | ctx | ) |
|
|
virtual |
◆ generate_id()
| static int asw::ui::Widget::generate_id |
( |
| ) |
|
|
inlinestaticprivate |
◆ id()
Get the unique identifier for this widget.
- Returns
- The widget's unique identifier.
Definition at line 54 of file widget.h.
◆ layout()
| void asw::ui::Widget::layout |
( |
Context & | ctx | ) |
|
|
virtual |
Lay out this widget and its children.
- Parameters
-
Reimplemented in asw::ui::VBox.
Definition at line 5 of file widget.cpp.
◆ on_event()
◆ on_focus_changed()
| void asw::ui::Widget::on_focus_changed |
( |
Context & | ctx, |
|
|
bool | focused ) |
|
virtual |
◆ operator=() [1/2]
◆ operator=() [2/2]
Move assignment operator.
◆ children
| std::vector<std::unique_ptr<Widget> > asw::ui::Widget::children |
Child widgets.
Definition at line 72 of file widget.h.
◆ enabled
| bool asw::ui::Widget::enabled = true |
Whether the widget is enabled.
Definition at line 63 of file widget.h.
◆ focusable
| bool asw::ui::Widget::focusable = false |
Whether the widget can receive focus.
Definition at line 66 of file widget.h.
◆ id_
◆ id_counter_
| int asw::ui::Widget::id_counter_ { 1 } |
|
inlinestaticprivate |
◆ parent
| Widget* asw::ui::Widget::parent = nullptr |
Pointer to the parent widget.
Definition at line 69 of file widget.h.
◆ transform
The transform (position and size) of the widget.
Definition at line 119 of file widget.h.
◆ visible
| bool asw::ui::Widget::visible = true |
Whether the widget is visible.
Definition at line 60 of file widget.h.
The documentation for this class was generated from the following files: