scenes.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include "flipper.h"
  2. #include "app_state.h"
  3. #include "scenes.h"
  4. #include "scene_main_menu.h"
  5. /** collection of all scene on_enter handlers */
  6. void (*const lwc_scene_on_enter_handlers[])(void*) = {
  7. lwc_main_menu_scene_on_enter,
  8. lwc_sub_menu_scene_on_enter,
  9. lwc_dcf77_scene_on_enter,
  10. lwc_msf_scene_on_enter,
  11. lwc_info_scene_on_enter,
  12. lwc_about_scene_on_enter};
  13. /** collection of all scene on event handlers */
  14. bool (*const lwc_scene_on_event_handlers[])(void*, SceneManagerEvent) = {
  15. lwc_main_menu_scene_on_event,
  16. lwc_sub_menu_scene_on_event,
  17. lwc_dcf77_scene_on_event,
  18. lwc_msf_scene_on_event,
  19. lwc_info_scene_on_event,
  20. lwc_about_scene_on_event};
  21. /** collection of all scene on exit handlers */
  22. void (*const lwc_scene_on_exit_handlers[])(void*) = {
  23. lwc_main_menu_scene_on_exit,
  24. lwc_sub_menu_scene_on_exit,
  25. lwc_dcf77_scene_on_exit,
  26. lwc_msf_scene_on_exit,
  27. lwc_info_scene_on_exit,
  28. lwc_about_scene_on_exit};
  29. /** collection of all on_enter, on_event, on_exit handlers */
  30. const SceneManagerHandlers lwc_scene_manager_handlers = {
  31. .on_enter_handlers = lwc_scene_on_enter_handlers,
  32. .on_event_handlers = lwc_scene_on_event_handlers,
  33. .on_exit_handlers = lwc_scene_on_exit_handlers,
  34. .scene_num = __lwc_number_of_scenes};
  35. /* callbacks */
  36. /** custom event handler */
  37. bool lwc_custom_callback(void* context, uint32_t custom_event) {
  38. furi_assert(context);
  39. App* app = context;
  40. return scene_manager_handle_custom_event(app->scene_manager, custom_event);
  41. }
  42. bool lwc_back_event_callback(void* context) {
  43. furi_assert(context);
  44. App* app = context;
  45. return scene_manager_handle_back_event(app->scene_manager);
  46. }
  47. void lwc_tick_event_callback(void* context) {
  48. furi_assert(context);
  49. App* app = context;
  50. scene_manager_handle_tick_event(app->scene_manager);
  51. }