Add explanations to Windows-specific menu_item_builder's
[git-cheetah/kirill.git] / menuengine.h
blob9d0ddce858fad9de17eecbc5bb82ec654817d4bb
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 unsigned int count;
14 char name[MAX_PATH];
18 * flags to match the selection
20 #define MENU_ITEM_ALWAYS 0 /* always insert the menu item */
21 #define MENU_ITEM_CLEANUP (1 << 31) /* menu item requires free() of
22 string and helptext */
23 #define MENU_ITEM_LAST -1 /* the last menu item */
25 struct menu_item;
27 typedef unsigned int selection_to_mask(struct git_data *);
28 typedef void menu_item_handler(struct git_data *, unsigned int);
30 * if platform-specific builder returns TRUE, the menu item
31 * is added to the active menu and can be passed to menu_item_handler
32 * later, e.g. when a user selects the item
34 typedef BOOL menu_item_builder(struct git_data *, const struct menu_item *, void *);
36 struct menu_item {
37 unsigned int selection;
38 char *string;
39 char *helptext;
40 menu_item_builder *builder;
41 menu_item_handler *handler;
44 extern struct menu_item *active_menu;
45 extern unsigned int next_active_item;
48 * The main entry point of the menu engine.
50 * Important things to note:
51 * - it resets the active menu;
52 * - it walks menu_def until MENU_ITEM_LAST is found or
53 * menu_def_count times, whatever is earlier.
55 void build_menu_items(struct git_data *data,
56 selection_to_mask *mask_builder,
57 const struct menu_item menu_def[],
58 const unsigned int menu_def_count,
59 void *platform);
61 void reset_active_menu();
63 char *get_menu_item_text(unsigned int id);
64 void handle_menu_item(void *data, unsigned int id);
66 #endif /* MENUENGINE_H */