gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
ui.hpp File Reference

Go to the source code of this file.

Typedefs

typedef std::function< void()> ui::callback_t
 A callback function that takes no arguments and returns nothing.
 

Functions

void ui::setRoot (Widget *const root)
 Set the root widget for the UI to render.
 
void ui::render (bool block=true)
 Update all UI elements and re-render any areas that need it.
 
void ui::showBoundingBoxes (bool enable)
 Toggle whether bounding boxes are displayed for all widgets.
 
Widgetui::getWidgetById (id_t id) noexcept
 Get the first widget (root or any children) that has the given ID.
 
void ui::setTimeout (callback_t callback, time_t timeout)
 Schedule a function to run after a delay.
 

Function Documentation

◆ getWidgetById()

Widget * ui::getWidgetById ( id_t  id)
noexcept

Get the first widget (root or any children) that has the given ID.

An ID is expected to be a unique, typically non-zero value. To generate an id, you can either call ui::id("some text"), or (for constant strings only), "some text"_id.

Parameters
idThe unique identifier of the widget.
Returns
A pointer to the widget, or nullptr if not found.

◆ render()

void ui::render ( bool  block = true)

Update all UI elements and re-render any areas that need it.

Parameters
blockIf true, save CPU usage by blocking until it's time to render the screen. If false, return immediately if it's not time to render yet.

◆ setRoot()

void ui::setRoot ( Widget *const  root)

Set the root widget for the UI to render.

Parameters
rootThe topmost widget where rendering starts.

◆ setTimeout()

void ui::setTimeout ( callback_t  callback,
time_t  timeout 
)

Schedule a function to run after a delay.

Callback functions will be postponed for at least the number of milliseconds specified, but may wait slightly longer, depending on refresh rate.

Parameters
callbackThe function to run.
timeoutThe number of milliseconds to wait.

◆ showBoundingBoxes()

void ui::showBoundingBoxes ( bool  enable)

Toggle whether bounding boxes are displayed for all widgets.

Parameters
enableIf true, show bounding boxes. If false, hide bounding boxes.
Note
This function is only available in debug builds.