GUI system APIs.
More...
#include <input/input.h>
#include "widget.h"
Go to the source code of this file.
|
|
#define | RECORD_GUI "gui" |
| |
| #define | with_gui(gui, code) |
| | Shorthand for automatically locking and unlocking the GUI.
|
| |
|
|
typedef struct Gui | Gui |
| | Gui opaque type declaration.
|
| |
|
typedef struct GuiLayer | GuiLayer |
| | GuiLayer opaque type declaration.
|
| |
| typedef bool(* | GuiInputCallback) (const InputEvent *event, void *context) |
| | Input callback function type.
|
| |
◆ with_gui
| #define with_gui |
( |
| gui, |
|
|
| code ) |
Value: { \
gui_lock(gui); \
{code}; \
gui_unlock(gui); \
}
Shorthand for automatically locking and unlocking the GUI.
- Parameters
-
| [in,out] | gui | pointer to the Gui instance |
| [in] | code | the code to execute when the Gui will be in locked state |
◆ GuiInputCallback
| typedef bool(* GuiInputCallback) (const InputEvent *event, void *context) |
Input callback function type.
- Parameters
-
| [in] | event | pointer to the input event that has occurred |
| [in,out] | context | pointer to a user-specific object, given upon callback registration |
- Returns
- true if the event was consumed (handled) by the recipient, false otherwise
◆ GuiDisplayId
Enumeration of available display identifiers.
| Enumerator |
|---|
| GuiDisplayIdFront | Front (main display)
|
| GuiDisplayIdBack | Back (greyscale) display.
|
| GuiDisplayIdMax | Special value, equal to display number.
|
◆ GuiLayerId
Enumeration of available layer identifiers.
| Enumerator |
|---|
| GuiLayerIdSystem | System layer - for displaying statuses and other persistent info.
|
| GuiLayerIdTop | Top layer - for displaying dialog windows and overlays.
|
| GuiLayerIdMain | Main layer - for displaying regular applications.
|
| GuiLayerIdBottom | Bottom layer - visible only if there is nothing on layers above it.
|
| GuiLayerIdMax | Special value, not to be used in application code.
|
◆ gui_display_get_frame_buffer()
| const uint8_t * gui_display_get_frame_buffer |
( |
Gui * | instance, |
|
|
GuiDisplayId | display_id ) |
Returns pointer to frame buffer for requested display.
- Parameters
-
| [in,out] | instance | pointer to the Gui instance |
| [in] | display_id | identifier of the display which frame buffer required |
- Returns
- pointer to the frame buffer
◆ gui_display_get_parameters()
Get the static parameters for a given display.
- Parameters
-
| [in] | display_id | identifier of the display to query |
- Returns
- pointer to the GuiDisplayParameters for the requested display
- See also
- GuiDisplayParameters
◆ gui_get_display_id()
Get the display a widget instance belongs to.
- Parameters
-
| [in] | widget | pointer to the Widget instance to be queried |
- Returns
- identifier of the display the widget instance is attached to
◆ gui_get_layer()
Get a GUI layer by its identifier.
- Parameters
-
| [in,out] | instance | pointer to the Gui instance |
| [in] | layer_id | identifier of the layer to retrieve |
- Returns
- pointer to the requested GuiLayer, or NULL on invalid arguments
◆ gui_layer_add_input_callback()
Register a callback to report for unhandled input events on a certain layer.
- Parameters
-
| [in,out] | layer | pointer to the layer to be modified |
| [in] | callback | pointer to the function to be called upon eligible events |
| [in,out] | context | pointer to a user-specific object (will be passed to the callback) |
◆ gui_layer_get_root_widget()
Get the root widget of a Layer on a certain display.
A root widget cannot be moved, resized or used as the input event source.
- Parameters
-
| [in,out] | layer | pointer to the GuiLayer instance |
| [in] | display_id | identifier of the display required |
- Returns
- pointer to the root widget
◆ gui_layer_remove_input_callback()
Unregister a previously registered input callback.
- Parameters
-
| [in,out] | layer | pointer to the layer to be modified |
| [in] | callback | pointer to the function to be unregistered |
◆ gui_lock()
| void gui_lock |
( |
Gui * | instance | ) |
|
Lock the GUI system.
- Warning
- This function MUST be called BEFORE ANY Gui-related function calls. Examples include, but not limited to: creating, deleting and modifying of Widgets, adding or removing of active widgets, etc. Failure to do so will result in possible instabilities and crashes.
- Parameters
-
| [in,out] | instance | pointer to the Gui instance to lock |
◆ gui_unlock()
| void gui_unlock |
( |
Gui * | instance | ) |
|
Unlock the GUI system.
- Warning
- This function MUST be called AFTER calling gui_lock() and performing the required Gui-related calls. Failure to do so will result in Gui lockup.
- Parameters
-
| [in,out] | instance | pointer to the Gui instance to unlock |