menu.h

Go to the documentation of this file.
00001 
00042 /*#*
00043  *#* $Log$
00044  *#* Revision 1.5  2007/09/19 16:23:27  batt
00045  *#* Fix doxygen warnings.
00046  *#*
00047  *#* Revision 1.4  2006/09/13 13:58:33  bernie
00048  *#* Add RenderHook support.
00049  *#*
00050  *#* Revision 1.3  2006/07/19 12:56:27  bernie
00051  *#* Convert to new Doxygen style.
00052  *#*
00053  *#* Revision 1.2  2006/06/03 13:58:02  bernie
00054  *#* Fix recursive timeout and add exit status information.
00055  *#*
00056  *#* Revision 1.1  2006/05/15 07:20:54  bernie
00057  *#* Move menu to gui/.
00058  *#*
00059  *#* Revision 1.4  2006/04/11 00:07:32  bernie
00060  *#* Implemenent MF_SAVESEL flag.
00061  *#*
00062  *#* Revision 1.3  2006/03/22 09:49:51  bernie
00063  *#* Simplifications from project_grl.
00064  *#*
00065  *#* Revision 1.2  2006/03/20 17:48:35  bernie
00066  *#* Implement support for ROM menus.
00067  *#*
00068  *#* Revision 1.1  2006/02/10 12:29:36  bernie
00069  *#* Add menu system.
00070  *#*
00071  *#* Revision 1.20  2005/11/16 18:10:19  bernie
00072  *#* Move top-level headers to cfg/ as in DevLib.
00073  *#*
00074  *#* Revision 1.19  2005/02/11 19:11:38  aleph
00075  *#* Move menu_displaymsg() in new displaymsg module
00076  *#*
00077  *#* Revision 1.18  2005/01/13 16:56:36  aleph
00078  *#* Fix progmem includes.
00079  *#*
00080  *#* Revision 1.17  2004/12/14 12:52:45  aleph
00081  *#* Add exclude menu flags
00082  *#*
00083  *#* Revision 1.16  2004/10/01 14:04:59  customer_pw
00084  *#* Add accessor functions for menu flags
00085  *#*
00086  *#* Revision 1.15  2004/09/09 08:31:36  customer_pw
00087  *#* Add disabled item type
00088  *#*
00089  *#* Revision 1.14  2004/08/29 21:46:12  bernie
00090  *#* CVSSILENT: Mark CVS log blocks.
00091  *#*
00092  *#* Revision 1.13  2004/08/25 15:35:23  customer_pw
00093  *#* IPTR -> iptr_t conversion.
00094  *#*
00095  *#* Revision 1.12  2004/08/25 13:23:45  bernie
00096  *#* IPTR -> iptr_t conversion.
00097  *#*/
00098 #ifndef MWARE_MENU_H
00099 #define MWARE_MENU_H
00100 
00101 #include <cfg/compiler.h>
00102 
00103 /* Fwd decl */
00104 struct Bitmap;
00105 
00107 typedef iptr_t (*MenuHook)(iptr_t userdata);
00108 
00112 typedef struct MenuItem
00113 {
00114     const_iptr_t label;    
00115     int          flags;    
00116     MenuHook     hook;     
00117     iptr_t       userdata; 
00118 } MenuItem;
00119 
00121 typedef void (*RenderHook)(struct Bitmap *bitmap, int ypos, bool selected, const struct MenuItem *item);
00122 
00127 #define MIF_EXCLUDE_MASK    0x00FF 
00128 #define MIF_PRI_MASK        0x00FF 
00129 #define MIF_PRI(x)          ((x) & MIF_PRI_MASK) 
00130 #define MIF_EXCLUDE_0       BV(0)  
00131 #define MIF_EXCLUDE_1       BV(1)  
00132 #define MIF_EXCLUDE_2       BV(2)  
00133 #define MIF_EXCLUDE_3       BV(3)  
00134 #define MIF_EXCLUDE_4       BV(4)  
00135 #define MIF_EXCLUDE_5       BV(5)  
00136 #define MIF_EXCLUDE_6       BV(6)  
00137 #define MIF_EXCLUDE_7       BV(7)  
00138 #define MIF_CHECKED         BV(8)  
00139 #define MIF_CHECKIT         BV(9)  
00140 #define MIF_TOGGLE          BV(10) 
00141 #define MIF_HIDDEN          BV(11) 
00142 #define MIF_DISABLED        BV(12) 
00143 #define MIF_RAMLABEL        BV(13) 
00144 #define MIF_RENDERHOOK      BV(14) 
00145 /* \} */
00146 
00150 typedef struct Menu
00151 {
00152     MenuItem        *items;    
00153     const_iptr_t     title;    
00154     int              flags;    
00155     struct Bitmap   *bitmap;   
00156     int              selected; 
00157 } Menu;
00158 
00163 #define MF_STICKY   BV(0)  
00164 #define MF_TOPLEVEL BV(1)  
00165 #define MF_ROMITEMS BV(2)  
00166 #define MF_SAVESEL  BV(3)  
00167 /* \} */
00168 
00173 #define MENU_OK       ((iptr_t)0)
00174 #define MENU_CANCEL   ((iptr_t)-1)
00175 #define MENU_TIMEOUT  ((iptr_t)-2)
00176 #define MENU_ABORT    ((iptr_t)-3)
00177 #define MENU_DISABLED ((iptr_t)-4)
00178 /* \} */
00179 
00180 /* Function prototypes */
00181 iptr_t menu_handle(const struct Menu *menu);
00182 int menu_setFlags(struct Menu *menu, int idx, int flags);
00183 int menu_clearFlags(struct Menu *menu, int idx, int flags);
00184 
00185 #endif /* MWARE_MENU_H */