mfc_editor_scene_save_success.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "../mfc_editor_app_i.h"
  2. void mfc_editor_scene_save_success_popup_callback(void* context) {
  3. MfcEditorApp* instance = context;
  4. view_dispatcher_send_custom_event(instance->view_dispatcher, MfcEditorCustomEventViewExit);
  5. }
  6. void mfc_editor_scene_save_success_on_enter(void* context) {
  7. MfcEditorApp* instance = context;
  8. Popup* popup = instance->popup;
  9. popup_set_icon(popup, 36, 5, &I_DolphinSaved_92x58);
  10. popup_set_header(popup, "Saved", 15, 19, AlignLeft, AlignBottom);
  11. popup_set_timeout(popup, 1500);
  12. popup_set_context(popup, instance);
  13. popup_set_callback(popup, mfc_editor_scene_save_success_popup_callback);
  14. popup_enable_timeout(popup);
  15. view_dispatcher_switch_to_view(instance->view_dispatcher, MfcEditorAppViewPopup);
  16. }
  17. bool mfc_editor_scene_save_success_on_event(void* context, SceneManagerEvent event) {
  18. MfcEditorApp* instance = context;
  19. bool consumed = false;
  20. if(event.type == SceneManagerEventTypeCustom) {
  21. if(event.event == MfcEditorCustomEventViewExit) {
  22. consumed = scene_manager_search_and_switch_to_previous_scene(
  23. instance->scene_manager, MfcEditorSceneFileSelect);
  24. }
  25. }
  26. return consumed;
  27. }
  28. void mfc_editor_scene_save_success_on_exit(void* context) {
  29. MfcEditorApp* instance = context;
  30. popup_reset(instance->popup);
  31. }