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
root.h
Go to the documentation of this file.
1
8
9#ifndef ASW_UI_ROOT_H
10#define ASW_UI_ROOT_H
11
12#include "context.h"
13#include "panel.h"
14
15namespace asw::ui {
16
19class Root {
20public:
23 Root();
24
27
30
36 void set_size(float w, float h);
37
41
48 Widget* hit_test(Widget& w, const asw::Vec2<float>& pointer_pos);
49
55 bool dispatch_pointer(const UIEvent& e);
56
62 bool dispatch_to_focused(const UIEvent& e);
63
66 void update();
67
70 void draw();
71};
72
73} // namespace asw::ui
74
75#endif // ASW_UI_ROOT_H
A 2D vector in space.
Definition geometry.h:21
Shared state for the UI system.
Definition context.h:75
A container widget with a background color or image.
Definition panel.h:20
Root container that manages the UI tree, input, and rendering.
Definition root.h:19
Panel root
The root panel widget.
Definition root.h:29
Root()
Default constructor.
Definition root.cpp:5
bool dispatch_pointer(const UIEvent &e)
Route a pointer event to the appropriate widget.
Definition root.cpp:54
Widget * hit_test(Widget &w, const asw::Vec2< float > &pointer_pos)
Find the deepest widget at a given pointer position.
Definition root.cpp:31
bool dispatch_to_focused(const UIEvent &e)
Dispatch an event to the currently focused widget.
Definition root.cpp:73
void rebuild_focus_if_needed()
Rebuild the focus list if the tree has changed.
Definition root.cpp:20
void update()
Process input and dispatch UI events.
Definition root.cpp:87
Context ctx
The UI context.
Definition root.h:26
void draw()
Draw the UI tree.
Definition root.cpp:223
void set_size(float w, float h)
Set the size of the root panel.
Definition root.cpp:11
Base class for all UI widgets.
Definition widget.h:28
UI context and focus management for the ASW UI module.
Panel widget for the ASW UI module.
Event structure for UI interactions.
Definition event.h:21