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