1 #ifndef __al_included_allegro5_allegro_native_dialog_h 2 #define __al_included_allegro5_allegro_native_dialog_h 3 4 #include "allegro5/allegro.h" 5 6 #ifdef __cplusplus 7 extern "C" { 8 #endif 9 10 #if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) 11 #ifndef ALLEGRO_STATICLINK 12 #ifdef ALLEGRO_NATIVE_DIALOG_SRC 13 #define _ALLEGRO_DIALOG_DLL __declspec(dllexport) 14 #else 15 #define _ALLEGRO_DIALOG_DLL __declspec(dllimport) 16 #endif 17 #else 18 #define _ALLEGRO_DIALOG_DLL 19 #endif 20 #endif 21 22 #if defined ALLEGRO_MSVC 23 #define ALLEGRO_DIALOG_FUNC(type, name, args) _ALLEGRO_DIALOG_DLL type __cdecl name args 24 #elif defined ALLEGRO_MINGW32 25 #define ALLEGRO_DIALOG_FUNC(type, name, args) extern type name args 26 #elif defined ALLEGRO_BCC32 27 #define ALLEGRO_DIALOG_FUNC(type, name, args) extern _ALLEGRO_DIALOG_DLL type name args 28 #else 29 #define ALLEGRO_DIALOG_FUNC AL_FUNC 30 #endif 31 32 #ifdef ALLEGRO_WITH_XWINDOWS 33 #define ALLEGRO_GTK_TOPLEVEL ALLEGRO_GTK_TOPLEVEL_INTERNAL 34 #endif 35 36 /* Type: ALLEGRO_FILECHOOSER 37 */ 38 typedef struct ALLEGRO_FILECHOOSER ALLEGRO_FILECHOOSER; 39 40 /* Type: ALLEGRO_TEXTLOG 41 */ 42 typedef struct ALLEGRO_TEXTLOG ALLEGRO_TEXTLOG; 43 44 /* Type: ALLEGRO_MENU 45 */ 46 typedef struct ALLEGRO_MENU ALLEGRO_MENU; 47 48 /* Type: ALLEGRO_MENU_INFO 49 */ 50 typedef struct ALLEGRO_MENU_INFO { 51 const char *caption; 52 uint16_t id; 53 int flags; 54 ALLEGRO_BITMAP *icon; 55 } ALLEGRO_MENU_INFO; 56 57 #define ALLEGRO_MENU_SEPARATOR { NULL, -1, 0, NULL } 58 #define ALLEGRO_START_OF_MENU(caption, id) { caption "->", id, 0, NULL } 59 #define ALLEGRO_END_OF_MENU { NULL, 0, 0, NULL } 60 61 ALLEGRO_DIALOG_FUNC(bool, al_init_native_dialog_addon, (void)); 62 ALLEGRO_DIALOG_FUNC(bool, al_is_native_dialog_addon_initialized, (void)); 63 ALLEGRO_DIALOG_FUNC(void, al_shutdown_native_dialog_addon, (void)); 64 65 ALLEGRO_DIALOG_FUNC(ALLEGRO_FILECHOOSER *, al_create_native_file_dialog, (char const *initial_path, 66 char const *title, char const *patterns, int mode)); 67 ALLEGRO_DIALOG_FUNC(bool, al_show_native_file_dialog, (ALLEGRO_DISPLAY *display, ALLEGRO_FILECHOOSER *dialog)); 68 ALLEGRO_DIALOG_FUNC(int, al_get_native_file_dialog_count, (const ALLEGRO_FILECHOOSER *dialog)); 69 ALLEGRO_DIALOG_FUNC(const char *, al_get_native_file_dialog_path, (const ALLEGRO_FILECHOOSER *dialog, 70 size_t index)); 71 ALLEGRO_DIALOG_FUNC(void, al_destroy_native_file_dialog, (ALLEGRO_FILECHOOSER *dialog)); 72 73 ALLEGRO_DIALOG_FUNC(int, al_show_native_message_box, (ALLEGRO_DISPLAY *display, char const *title, 74 char const *heading, char const *text, char const *buttons, int flags)); 75 76 ALLEGRO_DIALOG_FUNC(ALLEGRO_TEXTLOG *, al_open_native_text_log, (char const *title, int flags)); 77 ALLEGRO_DIALOG_FUNC(void, al_close_native_text_log, (ALLEGRO_TEXTLOG *textlog)); 78 ALLEGRO_DIALOG_FUNC(void, al_append_native_text_log, (ALLEGRO_TEXTLOG *textlog, char const *format, ...)); 79 ALLEGRO_DIALOG_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_native_text_log_event_source, (ALLEGRO_TEXTLOG *textlog)); 80 81 /* creating/modifying menus */ 82 ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_create_menu, (void)); 83 ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_create_popup_menu, (void)); 84 ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_build_menu, (ALLEGRO_MENU_INFO *info)); 85 ALLEGRO_DIALOG_FUNC(int, al_append_menu_item, (ALLEGRO_MENU *parent, char const *title, uint16_t id, int flags, 86 ALLEGRO_BITMAP *icon, ALLEGRO_MENU *submenu)); 87 ALLEGRO_DIALOG_FUNC(int, al_insert_menu_item, (ALLEGRO_MENU *parent, int pos, char const *title, uint16_t id, 88 int flags, ALLEGRO_BITMAP *icon, ALLEGRO_MENU *submenu)); 89 ALLEGRO_DIALOG_FUNC(bool, al_remove_menu_item, (ALLEGRO_MENU *menu, int pos)); 90 ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_clone_menu, (ALLEGRO_MENU *menu)); 91 ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_clone_menu_for_popup, (ALLEGRO_MENU *menu)); 92 ALLEGRO_DIALOG_FUNC(void, al_destroy_menu, (ALLEGRO_MENU *menu)); 93 94 /* properties */ 95 ALLEGRO_DIALOG_FUNC(const char *, al_get_menu_item_caption, (ALLEGRO_MENU *menu, int pos)); 96 ALLEGRO_DIALOG_FUNC(void, al_set_menu_item_caption, (ALLEGRO_MENU *menu, int pos, const char *caption)); 97 ALLEGRO_DIALOG_FUNC(int, al_get_menu_item_flags, (ALLEGRO_MENU *menu, int pos)); 98 ALLEGRO_DIALOG_FUNC(void, al_set_menu_item_flags, (ALLEGRO_MENU *menu, int pos, int flags)); 99 ALLEGRO_DIALOG_FUNC(ALLEGRO_BITMAP *, al_get_menu_item_icon, (ALLEGRO_MENU *menu, int pos)); 100 ALLEGRO_DIALOG_FUNC(void, al_set_menu_item_icon, (ALLEGRO_MENU *menu, int pos, ALLEGRO_BITMAP *icon)); 101 102 #if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_NATIVE_DIALOG_SRC) 103 ALLEGRO_DIALOG_FUNC(int, al_toggle_menu_item_flags, (ALLEGRO_MENU *menu, int pos, int flags)); 104 #endif 105 106 /* querying menus */ 107 ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_find_menu, (ALLEGRO_MENU *haystack, uint16_t id)); 108 ALLEGRO_DIALOG_FUNC(bool, al_find_menu_item, (ALLEGRO_MENU *haystack, uint16_t id, ALLEGRO_MENU **menu, int *index)); 109 110 /* menu events */ 111 ALLEGRO_DIALOG_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_default_menu_event_source, (void)); 112 ALLEGRO_DIALOG_FUNC(ALLEGRO_EVENT_SOURCE *, al_enable_menu_event_source, (ALLEGRO_MENU *menu)); 113 ALLEGRO_DIALOG_FUNC(void, al_disable_menu_event_source, (ALLEGRO_MENU *menu)); 114 115 /* displaying menus */ 116 ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_get_display_menu, (ALLEGRO_DISPLAY *display)); 117 ALLEGRO_DIALOG_FUNC(bool, al_set_display_menu, (ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu)); 118 ALLEGRO_DIALOG_FUNC(bool, al_popup_menu, (ALLEGRO_MENU *popup, ALLEGRO_DISPLAY *display)); 119 ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_remove_display_menu, (ALLEGRO_DISPLAY *display)); 120 121 ALLEGRO_DIALOG_FUNC(uint32_t, al_get_allegro_native_dialog_version, (void)); 122 123 enum { 124 ALLEGRO_FILECHOOSER_FILE_MUST_EXIST = 1, 125 ALLEGRO_FILECHOOSER_SAVE = 2, 126 ALLEGRO_FILECHOOSER_FOLDER = 4, 127 ALLEGRO_FILECHOOSER_PICTURES = 8, 128 ALLEGRO_FILECHOOSER_SHOW_HIDDEN = 16, 129 ALLEGRO_FILECHOOSER_MULTIPLE = 32 130 }; 131 132 enum { 133 ALLEGRO_MESSAGEBOX_WARN = 1<<0, 134 ALLEGRO_MESSAGEBOX_ERROR = 1<<1, 135 ALLEGRO_MESSAGEBOX_OK_CANCEL = 1<<2, 136 ALLEGRO_MESSAGEBOX_YES_NO = 1<<3, 137 ALLEGRO_MESSAGEBOX_QUESTION = 1<<4 138 }; 139 140 enum { 141 ALLEGRO_TEXTLOG_NO_CLOSE = 1<<0, 142 ALLEGRO_TEXTLOG_MONOSPACE = 1<<1 143 }; 144 145 enum { 146 ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE = 600, 147 ALLEGRO_EVENT_MENU_CLICK = 601 148 }; 149 150 enum { 151 ALLEGRO_MENU_ITEM_ENABLED = 0, 152 ALLEGRO_MENU_ITEM_CHECKBOX = 1, 153 ALLEGRO_MENU_ITEM_CHECKED = 2, 154 ALLEGRO_MENU_ITEM_DISABLED = 4 155 }; 156 157 158 #ifdef __cplusplus 159 } 160 #endif 161 162 #endif 163 164 /* vim: set sts=3 sw=3 et: */ 165