Register Cheetah as a Column Handler for folders
[git-cheetah/bosko.git] / menuengine.h
blob79ade00984dab36dce1bb5db51765a19b4905206
1 #ifndef MENUENGINE_H
2 #define MENUENGINE_H
4 struct git_data {
5 struct git_shell_ext {
6 void *virtual_table;
7 struct git_data *git_data;
8 } shell_ext;
9 struct git_menu {
10 void *virtual_table;
11 struct git_data *git_data;
12 } menu;
13 struct git_columns {
14 void *virtual_table;
15 struct git_data *git_data;
16 } columns;
17 unsigned int count;
18 char name[MAX_PATH];
22 * flags to match the selection
24 #define MENU_ITEM_ALWAYS 0 /* always insert the menu item */
25 #define MENU_ITEM_CLEANUP (1 << 31) /* menu item requires free() of
26 string and helptext */
27 #define MENU_ITEM_LAST -1 /* the last menu item */
29 struct menu_item;
31 typedef unsigned int selection_to_mask(struct git_data *);
32 typedef void menu_item_handler(struct git_data *, unsigned int);
34 * if platform-specific builder returns TRUE, the menu item
35 * is added to the active menu and can be passed to menu_item_handler
36 * later, e.g. when a user selects the item
38 typedef BOOL menu_item_builder(struct git_data *, const struct menu_item *, void *);
40 struct menu_item {
41 unsigned int selection;
42 char *string;
43 char *helptext;
44 menu_item_builder *builder;
45 menu_item_handler *handler;
48 extern struct menu_item *active_menu;
49 extern unsigned int next_active_item;
52 * The main entry point of the menu engine.
54 * Important things to note:
55 * - it resets the active menu;
56 * - it walks menu_def until MENU_ITEM_LAST is found or
57 * menu_def_count times, whatever is earlier.
59 void build_menu_items(struct git_data *data,
60 selection_to_mask *mask_builder,
61 const struct menu_item menu_def[],
62 const unsigned int menu_def_count,
63 void *platform);
65 void reset_active_menu();
67 char *get_menu_item_text(unsigned int id);
68 void handle_menu_item(void *data, unsigned int id);
70 #endif /* MENUENGINE_H */