menu.h
Go to the documentation of this file.00001
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 #ifndef MWARE_MENU_H
00099 #define MWARE_MENU_H
00100
00101 #include <cfg/compiler.h>
00102
00103
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
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