GUI: ViewDispatcher API. More...
Go to the source code of this file.
Enumerations | |
enum | ViewDispatcherType { ViewDispatcherTypeDesktop , ViewDispatcherTypeWindow , ViewDispatcherTypeFullscreen } |
ViewDispatcher view_port placement. More... | |
Functions | |
ViewDispatcher * | view_dispatcher_alloc (void) |
Allocate ViewDispatcher instance. | |
ViewDispatcher * | view_dispatcher_alloc_ex (FuriEventLoop *loop) |
Allocate ViewDispatcher instance with an externally owned event loop. | |
void | view_dispatcher_free (ViewDispatcher *view_dispatcher) |
Free ViewDispatcher instance. | |
FURI_DEPRECATED void | view_dispatcher_enable_queue (ViewDispatcher *view_dispatcher) |
Enable queue support. | |
void | view_dispatcher_send_custom_event (ViewDispatcher *view_dispatcher, uint32_t event) |
Send custom event. | |
void | view_dispatcher_set_custom_event_callback (ViewDispatcher *view_dispatcher, ViewDispatcherCustomEventCallback callback) |
Set custom event handler. | |
void | view_dispatcher_set_navigation_event_callback (ViewDispatcher *view_dispatcher, ViewDispatcherNavigationEventCallback callback) |
Set navigation event handler. | |
void | view_dispatcher_set_tick_event_callback (ViewDispatcher *view_dispatcher, ViewDispatcherTickEventCallback callback, uint32_t tick_period) |
Set tick event handler. | |
void | view_dispatcher_set_event_callback_context (ViewDispatcher *view_dispatcher, void *context) |
Set event callback context. | |
FuriEventLoop * | view_dispatcher_get_event_loop (ViewDispatcher *view_dispatcher) |
Get event_loop instance. | |
void | view_dispatcher_run (ViewDispatcher *view_dispatcher) |
Run ViewDispatcher. | |
void | view_dispatcher_stop (ViewDispatcher *view_dispatcher) |
Stop ViewDispatcher. | |
void | view_dispatcher_add_view (ViewDispatcher *view_dispatcher, uint32_t view_id, View *view) |
Add view to ViewDispatcher. | |
void | view_dispatcher_remove_view (ViewDispatcher *view_dispatcher, uint32_t view_id) |
Remove view from ViewDispatcher. | |
void | view_dispatcher_switch_to_view (ViewDispatcher *view_dispatcher, uint32_t view_id) |
Switch to View. | |
void | view_dispatcher_send_to_front (ViewDispatcher *view_dispatcher) |
Send ViewPort of this ViewDispatcher instance to front. | |
void | view_dispatcher_send_to_back (ViewDispatcher *view_dispatcher) |
Send ViewPort of this ViewDispatcher instance to back. | |
void | view_dispatcher_attach_to_gui (ViewDispatcher *view_dispatcher, Gui *gui, ViewDispatcherType type) |
Attach ViewDispatcher to GUI. | |
GUI: ViewDispatcher API.
ViewDispatcher is used to connect several Views to a Gui instance, switch between them and handle various events. This is useful in applications featuring an advanced graphical user interface.
Internally, ViewDispatcher employs a FuriEventLoop instance together with two separate message queues for input and custom event handling. See FuriEventLoop for more information.
If no multi-view or complex event handling capabilities are required, consider using ViewHolder instead.
enum ViewDispatcherType |
void view_dispatcher_add_view | ( | ViewDispatcher * | view_dispatcher, |
uint32_t | view_id, | ||
View * | view ) |
Add view to ViewDispatcher.
view_dispatcher | ViewDispatcher instance |
view_id | View id to register |
view | View instance |
ViewDispatcher * view_dispatcher_alloc | ( | void | ) |
Allocate ViewDispatcher instance.
ViewDispatcher * view_dispatcher_alloc_ex | ( | FuriEventLoop * | loop | ) |
Allocate ViewDispatcher instance with an externally owned event loop.
If this constructor is used instead of view_dispatcher_alloc
, the burden of freeing the event loop is placed on the caller.
loop | pointer to FuriEventLoop instance |
void view_dispatcher_attach_to_gui | ( | ViewDispatcher * | view_dispatcher, |
Gui * | gui, | ||
ViewDispatcherType | type ) |
Attach ViewDispatcher to GUI.
view_dispatcher | ViewDispatcher instance | |
gui | GUI instance to attach to | |
[in] | type | The type |
FURI_DEPRECATED void view_dispatcher_enable_queue | ( | ViewDispatcher * | view_dispatcher | ) |
Enable queue support.
view_dispatcher | ViewDispatcher instance |
void view_dispatcher_free | ( | ViewDispatcher * | view_dispatcher | ) |
Free ViewDispatcher instance.
view_dispatcher | pointer to ViewDispatcher |
FuriEventLoop * view_dispatcher_get_event_loop | ( | ViewDispatcher * | view_dispatcher | ) |
Get event_loop instance.
Use the return value to connect additional supported primitives (message queues, timers, etc) to this ViewDispatcher instance's event loop.
view_dispatcher | ViewDispatcher instance |
void view_dispatcher_remove_view | ( | ViewDispatcher * | view_dispatcher, |
uint32_t | view_id ) |
Remove view from ViewDispatcher.
view_dispatcher | ViewDispatcher instance |
view_id | View id to remove |
void view_dispatcher_run | ( | ViewDispatcher * | view_dispatcher | ) |
Run ViewDispatcher.
This function will start the event loop and block until view_dispatcher_stop() is called or the current thread receives a FuriSignalExit signal.
view_dispatcher | ViewDispatcher instance |
void view_dispatcher_send_custom_event | ( | ViewDispatcher * | view_dispatcher, |
uint32_t | event ) |
Send custom event.
view_dispatcher | ViewDispatcher instance | |
[in] | event | The event |
void view_dispatcher_send_to_back | ( | ViewDispatcher * | view_dispatcher | ) |
Send ViewPort of this ViewDispatcher instance to back.
view_dispatcher | ViewDispatcher instance |
void view_dispatcher_send_to_front | ( | ViewDispatcher * | view_dispatcher | ) |
Send ViewPort of this ViewDispatcher instance to front.
view_dispatcher | ViewDispatcher instance |
void view_dispatcher_set_custom_event_callback | ( | ViewDispatcher * | view_dispatcher, |
ViewDispatcherCustomEventCallback | callback ) |
Set custom event handler.
Called on Custom Event, if it is not consumed by view
view_dispatcher | ViewDispatcher instance |
callback | ViewDispatcherCustomEventCallback instance |
void view_dispatcher_set_event_callback_context | ( | ViewDispatcher * | view_dispatcher, |
void * | context ) |
Set event callback context.
view_dispatcher | ViewDispatcher instance |
context | pointer to context |
void view_dispatcher_set_navigation_event_callback | ( | ViewDispatcher * | view_dispatcher, |
ViewDispatcherNavigationEventCallback | callback ) |
Set navigation event handler.
Called on Input Short Back Event, if it is not consumed by view
view_dispatcher | ViewDispatcher instance |
callback | ViewDispatcherNavigationEventCallback instance |
void view_dispatcher_set_tick_event_callback | ( | ViewDispatcher * | view_dispatcher, |
ViewDispatcherTickEventCallback | callback, | ||
uint32_t | tick_period ) |
Set tick event handler.
view_dispatcher_alloc
, not view_dispatcher_alloc_ex
.view_dispatcher | ViewDispatcher instance |
callback | ViewDispatcherTickEventCallback |
tick_period | callback call period |
void view_dispatcher_stop | ( | ViewDispatcher * | view_dispatcher | ) |
Stop ViewDispatcher.
view_dispatcher | ViewDispatcher instance |
void view_dispatcher_switch_to_view | ( | ViewDispatcher * | view_dispatcher, |
uint32_t | view_id ) |
Switch to View.
view_dispatcher | ViewDispatcher instance |
view_id | View id to register |