mfc_editor_scene_invalid_file.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "../mfc_editor_app_i.h"
  2. void mfc_editor_scene_invalid_file_popup_callback(void* context) {
  3. MfcEditorApp* instance = context;
  4. view_dispatcher_send_custom_event(instance->view_dispatcher, MfcEditorCustomEventViewExit);
  5. }
  6. void mfc_editor_scene_invalid_file_on_enter(void* context) {
  7. MfcEditorApp* instance = context;
  8. Popup* popup = instance->popup;
  9. popup_set_header(popup, "Invalid file", 63, 10, AlignCenter, AlignTop);
  10. popup_set_text(
  11. popup, "Only MIFARE Classic files\nare supported", 63, 40, AlignCenter, AlignCenter);
  12. popup_set_context(popup, instance);
  13. popup_set_callback(popup, mfc_editor_scene_invalid_file_popup_callback);
  14. view_dispatcher_switch_to_view(instance->view_dispatcher, MfcEditorAppViewPopup);
  15. }
  16. bool mfc_editor_scene_invalid_file_on_event(void* context, SceneManagerEvent event) {
  17. MfcEditorApp* instance = context;
  18. bool consumed = false;
  19. if(event.type == SceneManagerEventTypeCustom) {
  20. if(event.event == MfcEditorCustomEventViewExit) {
  21. consumed = scene_manager_previous_scene(instance->scene_manager);
  22. }
  23. }
  24. return consumed;
  25. }
  26. void mfc_editor_scene_invalid_file_on_exit(void* context) {
  27. MfcEditorApp* instance = context;
  28. popup_reset(instance->popup);
  29. }