1 #ifndef LIBFSEMU_INCLUDE_FS_EMU_DIALOG_H_ 2 #define LIBFSEMU_INCLUDE_FS_EMU_DIALOG_H_ 3 4 #define DIALOG_RESULT_AFFIRMATIVE 1 5 #define DIALOG_RESULT_NEGATIVE 2 6 7 #define DIALOG_MAX_LINES 4 8 9 typedef struct fs_emu_dialog { 10 int result; 11 char *title; 12 char *affirmative; 13 char *negative; 14 char *lines[DIALOG_MAX_LINES]; 15 } fs_emu_dialog; 16 17 fs_emu_dialog* fs_emu_dialog_create(const char *title, 18 const char *affirmative, const char *negative); 19 void fs_emu_dialog_add_option(fs_emu_dialog *dialog, const char *option, 20 int value); 21 22 void fs_emu_dialog_set_line(fs_emu_dialog *dialog, int line, const char *text); 23 24 int fs_emu_dialog_result(fs_emu_dialog *dialog); 25 void fs_emu_dialog_destroy(fs_emu_dialog *dialog); 26 27 //void fs_emu_dialog_lock(); 28 //void fs_emu_dialog_unlock(); 29 30 // you must hold the dialog lock when calling this function 31 32 33 // important: must acquire GUI lock before using this 34 void fs_emu_dialog_show(fs_emu_dialog *dialog); 35 36 // important: must acquire GUI lock before using this 37 void fs_emu_dialog_dismiss(fs_emu_dialog *dialog); 38 39 // important: must acquire GUI lock before using this 40 fs_emu_dialog *fs_emu_dialog_get_current(); 41 42 extern int g_fs_emu_dialog_mode; 43 fs_emu_in_dialog_mode()44static inline int fs_emu_in_dialog_mode() { 45 return g_fs_emu_dialog_mode; 46 } 47 48 #endif // LIBFSEMU_INCLUDE_FS_EMU_DIALOG_H_ 49