7 struct git_data
*git_data
;
11 struct git_data
*git_data
;
15 struct git_data
*git_data
;
19 struct strbuf other_files
;
23 * flags to match the selection
25 #define MENU_ITEM_ALWAYS 0 /* always insert the menu item */
26 #define MENU_ITEM_CLEANUP (1 << 31) /* menu item requires free() of
27 string and helptext */
28 #define MENU_ITEM_LAST -1 /* the last menu item */
32 typedef unsigned int selection_to_mask(struct git_data
*);
33 typedef void menu_item_handler(struct git_data
*, unsigned int);
35 * if platform-specific builder returns TRUE, the menu item
36 * is added to the active menu and can be passed to menu_item_handler
37 * later, e.g. when a user selects the item
39 typedef BOOL
menu_item_builder(struct git_data
*, const struct menu_item
*, void *);
42 unsigned int selection
;
45 menu_item_builder
*builder
;
46 menu_item_handler
*handler
;
49 extern struct menu_item
*active_menu
;
50 extern unsigned int next_active_item
;
53 * The main entry point of the menu engine.
55 * Important things to note:
56 * - it resets the active menu;
57 * - it walks menu_def until MENU_ITEM_LAST is found or
58 * menu_def_count times, whatever is earlier.
60 void build_menu_items(struct git_data
*data
,
61 selection_to_mask
*mask_builder
,
62 const struct menu_item menu_def
[],
63 const unsigned int menu_def_count
,
66 void reset_active_menu();
68 char *get_menu_item_text(unsigned int id
);
69 void handle_menu_item(void *data
, unsigned int id
);
72 * usually, menu engine will append items, based on the return
73 * from menu_item_builder, but a custom builder might need to
74 * instruct the engine to track a particular item
76 void append_active_menu(const struct menu_item item
);
78 #endif /* MENUENGINE_H */