00001 00025 #ifndef _menu_h_ 00026 #define _menu_h_ 00027 00028 #ifdef WIN32 00029 // Avoid a name conflict with a function in the win32 API 00030 #define RemoveMenu _RemoveMenu_win32_ 00031 #endif 00032 00033 #include "render.h" 00034 #include "text.h" 00035 00036 #ifdef WIN32 00037 // Avoid multiply defined symbols 00038 #undef RemoveMenu 00039 #define RemoveMenu _RemoveMenu_tank_ 00040 #endif 00041 00049 typedef struct MenuItem_t MenuItem; 00050 00058 typedef void (*MenuItemFocus)(MenuItem *item); 00059 00073 typedef int (*MenuItemInput)(MenuItem *item, Uint8 *ec, rtsa_char keyval); 00074 00086 typedef int (*MenuItemUpdate)(MenuItem *item); 00087 00092 struct MenuItem_t { 00097 int minWidth, minHeight; 00103 SDL_Rect region; 00108 RenderItem *graphics; 00112 Uint32 numGraphics; 00117 MenuItemFocus focus; 00122 MenuItemInput input; 00128 MenuItemUpdate update; 00129 union { 00135 Uint32 flags; 00136 struct { 00140 Bool active : 1; 00144 Bool hasFocus : 1; 00150 Bool lockFocus : 1; 00156 Bool expandHeight : 1; 00163 Bool isPlaced : 1; 00164 }; 00165 }; 00169 void *data; 00170 }; 00171 00185 void SetupMenu(MenuItem *menu, int first, int count); 00186 00191 void RemoveMenu(); 00192 00201 int MenuRun(); 00202 00205 #endif 00206