menu.h
Go to the documentation of this file.00001 00043 #ifndef GUI_MENU_H 00044 #define GUI_MENU_H 00045 00046 #include <cfg/compiler.h> 00047 00048 #include <gfx/gfx.h> 00049 00051 typedef iptr_t (*MenuHook)(iptr_t userdata); 00052 typedef void (*BlitBitmap)(const Bitmap *bm); 00053 00057 typedef struct MenuItem 00058 { 00059 const_iptr_t label; 00060 int flags; 00061 MenuHook hook; 00062 iptr_t userdata; 00063 } MenuItem; 00064 00066 typedef void (*RenderHook)(struct Bitmap *bitmap, int ypos, bool selected, const struct MenuItem *item); 00067 00072 #define MIF_EXCLUDE_MASK 0x00FF 00073 #define MIF_PRI_MASK 0x00FF 00074 #define MIF_PRI(x) ((x) & MIF_PRI_MASK) 00075 #define MIF_EXCLUDE_0 BV(0) 00076 #define MIF_EXCLUDE_1 BV(1) 00077 #define MIF_EXCLUDE_2 BV(2) 00078 #define MIF_EXCLUDE_3 BV(3) 00079 #define MIF_EXCLUDE_4 BV(4) 00080 #define MIF_EXCLUDE_5 BV(5) 00081 #define MIF_EXCLUDE_6 BV(6) 00082 #define MIF_EXCLUDE_7 BV(7) 00083 #define MIF_CHECKED BV(8) 00084 #define MIF_CHECKIT BV(9) 00085 #define MIF_TOGGLE BV(10) 00086 #define MIF_HIDDEN BV(11) 00087 #define MIF_DISABLED BV(12) 00088 #define MIF_RAMLABEL BV(13) 00089 #define MIF_RENDERHOOK BV(14) 00090 /* \} */ 00091 00095 typedef struct Menu 00096 { 00097 MenuItem *items; 00098 const_iptr_t title; 00099 int flags; 00100 struct Bitmap *bitmap; 00101 int selected; 00102 BlitBitmap lcd_blitBitmap; 00103 } Menu; 00104 00109 #define MF_STICKY BV(0) 00110 #define MF_TOPLEVEL BV(1) 00111 #define MF_ROMITEMS BV(2) 00112 #define MF_SAVESEL BV(3) 00113 /* \} */ 00114 00119 #define MENU_OK ((iptr_t)0) 00120 #define MENU_CANCEL ((iptr_t)-1) 00121 #define MENU_TIMEOUT ((iptr_t)-2) 00122 #define MENU_ABORT ((iptr_t)-3) 00123 #define MENU_DISABLED ((iptr_t)-4) 00124 /* \} */ 00125 00126 /* Function prototypes */ 00127 iptr_t menu_handle(const struct Menu *menu); 00128 int menu_setFlags(struct Menu *menu, int idx, int flags); 00129 int menu_clearFlags(struct Menu *menu, int idx, int flags); 00130 00131 #endif /* GUI_MENU_H */
