ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
src
modules
ui
widget.cpp
Go to the documentation of this file.
1
#include "
./asw/modules/ui/widget.h
"
2
3
#include "
./asw/modules/ui/context.h
"
4
5
void
asw::ui::Widget::layout
(
Context
& ctx)
6
{
7
(void)ctx;
8
for
(
auto
const
& c :
children
) {
9
c->layout(ctx);
10
}
11
}
12
13
bool
asw::ui::Widget::on_event
(
Context
& ctx,
const
UIEvent
& e)
14
{
15
(void)ctx;
16
(void)e;
17
return
false
;
18
}
19
20
void
asw::ui::Widget::on_focus_changed
(
Context
& ctx,
bool
focused)
21
{
22
(void)ctx;
23
(void)focused;
24
}
25
26
void
asw::ui::Widget::draw
(
Context
& ctx)
27
{
28
for
(
auto
const
& c : children) {
29
if
(c->visible) {
30
c->draw(ctx);
31
}
32
}
33
}
asw::ui::Context
Shared state for the UI system.
Definition
context.h:75
asw::ui::Widget::on_focus_changed
virtual void on_focus_changed(Context &ctx, bool focused)
Called when focus state changes.
Definition
widget.cpp:20
asw::ui::Widget::on_event
virtual bool on_event(Context &ctx, const UIEvent &e)
Handle a UI event.
Definition
widget.cpp:13
asw::ui::Widget::draw
virtual void draw(Context &ctx)
Draw this widget and its children.
Definition
widget.cpp:26
asw::ui::Widget::children
std::vector< std::unique_ptr< Widget > > children
Child widgets.
Definition
widget.h:72
asw::ui::Widget::layout
virtual void layout(Context &ctx)
Lay out this widget and its children.
Definition
widget.cpp:5
context.h
UI context and focus management for the ASW UI module.
asw::ui::UIEvent
Event structure for UI interactions.
Definition
event.h:21
widget.h
Base widget class for the ASW UI module.
Generated by
1.12.0