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
asw::ui::Root Class Reference

Root container that manages the UI tree, input, and rendering. More...

#include <root.h>

Collaboration diagram for asw::ui::Root:
[legend]

Public Member Functions

 Root ()
 Default constructor.
 
void set_size (float w, float h)
 Set the size of the root panel.
 
void rebuild_focus_if_needed ()
 Rebuild the focus list if the tree has changed.
 
Widgethit_test (Widget &w, const asw::Vec2< float > &pointer_pos)
 Find the deepest widget at a given pointer position.
 
bool dispatch_pointer (const UIEvent &e)
 Route a pointer event to the appropriate widget.
 
bool dispatch_to_focused (const UIEvent &e)
 Dispatch an event to the currently focused widget.
 
void update ()
 Process input and dispatch UI events.
 
void draw ()
 Draw the UI tree.
 

Public Attributes

Context ctx
 The UI context.
 
Panel root
 The root panel widget.
 

Detailed Description

Root container that manages the UI tree, input, and rendering.

Definition at line 19 of file root.h.

Constructor & Destructor Documentation

◆ Root()

asw::ui::Root::Root ( )

Default constructor.

Definition at line 5 of file root.cpp.

Member Function Documentation

◆ dispatch_pointer()

bool asw::ui::Root::dispatch_pointer ( const UIEvent & e)

Route a pointer event to the appropriate widget.

Parameters
eThe UI event to dispatch.
Returns
True if the event was handled.

Definition at line 54 of file root.cpp.

◆ dispatch_to_focused()

bool asw::ui::Root::dispatch_to_focused ( const UIEvent & e)

Dispatch an event to the currently focused widget.

Parameters
eThe UI event to dispatch.
Returns
True if the event was handled.

Definition at line 73 of file root.cpp.

◆ draw()

void asw::ui::Root::draw ( )

Draw the UI tree.

Definition at line 223 of file root.cpp.

◆ hit_test()

asw::ui::Widget * asw::ui::Root::hit_test ( Widget & w,
const asw::Vec2< float > & pointer_pos )

Find the deepest widget at a given pointer position.

Parameters
wThe widget to test.
pointer_posThe pointer position.
Returns
Pointer to the hit widget, or nullptr.

Definition at line 31 of file root.cpp.

◆ rebuild_focus_if_needed()

void asw::ui::Root::rebuild_focus_if_needed ( )

Rebuild the focus list if the tree has changed.

Definition at line 20 of file root.cpp.

◆ set_size()

void asw::ui::Root::set_size ( float w,
float h )

Set the size of the root panel.

Parameters
wThe width.
hThe height.

Definition at line 11 of file root.cpp.

◆ update()

void asw::ui::Root::update ( )

Process input and dispatch UI events.

Definition at line 87 of file root.cpp.

Member Data Documentation

◆ ctx

Context asw::ui::Root::ctx

The UI context.

Definition at line 26 of file root.h.

◆ root

Panel asw::ui::Root::root

The root panel widget.

Definition at line 29 of file root.h.


The documentation for this class was generated from the following files: