Flipper Zero Firmware
Loading...
Searching...
No Matches
scene_manager.h File Reference

GUI: SceneManager API. More...

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  SceneManagerEvent
 Scene Manager event. More...
 
struct  SceneManagerHandlers
 Scene Manager configuration structure Contains array of Scene handlers. More...
 

Typedefs

typedef void(* AppSceneOnEnterCallback) (void *context)
 Prototype for Scene on_enter handler.
 
typedef bool(* AppSceneOnEventCallback) (void *context, SceneManagerEvent event)
 Prototype for Scene on_event handler.
 
typedef void(* AppSceneOnExitCallback) (void *context)
 Prototype for Scene on_exit handler.
 
typedef struct SceneManager SceneManager
 

Enumerations

enum  SceneManagerEventType { SceneManagerEventTypeCustom , SceneManagerEventTypeBack , SceneManagerEventTypeTick }
 Scene Manager events type.
 

Functions

void scene_manager_set_scene_state (SceneManager *scene_manager, uint32_t scene_id, uint32_t state)
 Set Scene state.
 
uint32_t scene_manager_get_scene_state (const SceneManager *scene_manager, uint32_t scene_id)
 Get Scene state.
 
SceneManagerscene_manager_alloc (const SceneManagerHandlers *app_scene_handlers, void *context)
 Scene Manager allocation and configuration.
 
void scene_manager_free (SceneManager *scene_manager)
 Free Scene Manager with allocated Scenes.
 
bool scene_manager_handle_custom_event (SceneManager *scene_manager, uint32_t custom_event)
 Custom event handler.
 
bool scene_manager_handle_back_event (SceneManager *scene_manager)
 Back event handler.
 
void scene_manager_handle_tick_event (SceneManager *scene_manager)
 Tick event handler.
 
void scene_manager_next_scene (SceneManager *scene_manager, uint32_t next_scene_id)
 Add and run next Scene.
 
bool scene_manager_previous_scene (SceneManager *scene_manager)
 Run previous Scene.
 
bool scene_manager_has_previous_scene (const SceneManager *scene_manager, uint32_t scene_id)
 Search previous Scene.
 
bool scene_manager_search_and_switch_to_previous_scene (SceneManager *scene_manager, uint32_t scene_id)
 Search and switch to previous Scene.
 
bool scene_manager_search_and_switch_to_previous_scene_one_of (SceneManager *scene_manager, const uint32_t *scene_ids, size_t scene_ids_size)
 Search and switch to previous Scene, multiple choice.
 
bool scene_manager_search_and_switch_to_another_scene (SceneManager *scene_manager, uint32_t scene_id)
 Clear Scene stack and switch to another Scene.
 
void scene_manager_stop (SceneManager *scene_manager)
 Exit from current scene.
 

Detailed Description

GUI: SceneManager API.

Function Documentation

◆ scene_manager_alloc()

SceneManager * scene_manager_alloc ( const SceneManagerHandlers * app_scene_handlers,
void * context )

Scene Manager allocation and configuration.

Scene Manager allocates all scenes internally

Parameters
app_scene_handlersSceneManagerHandlers instance
contextcontext to be set on Scene handlers calls
Returns
SceneManager instance

◆ scene_manager_free()

void scene_manager_free ( SceneManager * scene_manager)

Free Scene Manager with allocated Scenes.

Parameters
scene_managerSceneManager instance

◆ scene_manager_get_scene_state()

uint32_t scene_manager_get_scene_state ( const SceneManager * scene_manager,
uint32_t scene_id )

Get Scene state.

Parameters
scene_managerSceneManager instance
scene_idScene ID
Returns
Scene state

◆ scene_manager_handle_back_event()

bool scene_manager_handle_back_event ( SceneManager * scene_manager)

Back event handler.

Calls Scene event handler with Back event parameter

Parameters
scene_managerSceneManager instance
Returns
true if event was consumed, false otherwise

◆ scene_manager_handle_custom_event()

bool scene_manager_handle_custom_event ( SceneManager * scene_manager,
uint32_t custom_event )

Custom event handler.

Calls Scene event handler with Custom event parameter

Parameters
scene_managerSceneManager instance
custom_eventCustom event code
Returns
true if event was consumed, false otherwise

◆ scene_manager_handle_tick_event()

void scene_manager_handle_tick_event ( SceneManager * scene_manager)

Tick event handler.

Calls Scene event handler with Tick event parameter

Parameters
scene_managerSceneManager instance

◆ scene_manager_has_previous_scene()

bool scene_manager_has_previous_scene ( const SceneManager * scene_manager,
uint32_t scene_id )

Search previous Scene.

Parameters
scene_managerSceneManager instance
scene_idScene ID
Returns
true if previous scene was found, false otherwise

◆ scene_manager_next_scene()

void scene_manager_next_scene ( SceneManager * scene_manager,
uint32_t next_scene_id )

Add and run next Scene.

Parameters
scene_managerSceneManager instance
next_scene_idnext Scene ID

◆ scene_manager_previous_scene()

bool scene_manager_previous_scene ( SceneManager * scene_manager)

Run previous Scene.

Parameters
scene_managerSceneManager instance
Returns
true if previous scene was found, false otherwise

◆ scene_manager_search_and_switch_to_another_scene()

bool scene_manager_search_and_switch_to_another_scene ( SceneManager * scene_manager,
uint32_t scene_id )

Clear Scene stack and switch to another Scene.

Parameters
scene_managerSceneManager instance
scene_idScene ID
Returns
true if previous scene was found, false otherwise

◆ scene_manager_search_and_switch_to_previous_scene()

bool scene_manager_search_and_switch_to_previous_scene ( SceneManager * scene_manager,
uint32_t scene_id )

Search and switch to previous Scene.

Parameters
scene_managerSceneManager instance
scene_idScene ID
Returns
true if previous scene was found, false otherwise

◆ scene_manager_search_and_switch_to_previous_scene_one_of()

bool scene_manager_search_and_switch_to_previous_scene_one_of ( SceneManager * scene_manager,
const uint32_t * scene_ids,
size_t scene_ids_size )

Search and switch to previous Scene, multiple choice.

Parameters
scene_managerSceneManager instance
scene_idsArray of scene IDs
scene_ids_sizeArray of scene IDs size
Returns
true if one of previous scenes was found, false otherwise

◆ scene_manager_set_scene_state()

void scene_manager_set_scene_state ( SceneManager * scene_manager,
uint32_t scene_id,
uint32_t state )

Set Scene state.

Parameters
scene_managerSceneManager instance
scene_idScene ID
stateScene new state

◆ scene_manager_stop()

void scene_manager_stop ( SceneManager * scene_manager)

Exit from current scene.

Parameters
scene_managerSceneManager instance