menu.h (835B)
1 #ifndef MENU_H 2 #define MENU_H 3 4 #include "pane.h" 5 6 extern Pane_T MAIN, ACTIVE; 7 8 typedef struct menu_T *menu_T; 9 typedef struct menuItem_T *menuItem_T; 10 typedef struct menuStyle_T *menuStyle_T; 11 typedef struct menuInfo_T *menuInfo_T; 12 13 typedef void (*menuItem_select_f)(char *, int); 14 struct menuItem_T { 15 menuItem_select_f select_f; 16 const char *name; 17 }; 18 19 struct menuStyle_T { 20 char *separator; 21 int padding; 22 int spacing; 23 }; 24 25 struct menuInfo_T { 26 int start; 27 /* int end; */ 28 29 int y; 30 int x; 31 int x_sep; 32 33 int max_item_len; 34 int sep_len; 35 int items_num; 36 }; 37 38 typedef void (*menu_back_f)(void); 39 struct menu_T { 40 int current; 41 menu_back_f back_f; 42 43 int items_size; 44 struct menuItem_T items[]; 45 }; 46 47 menu_T menu_new(int item_num, menu_back_f back_f); 48 49 void pane_menu(widget_T widget); 50 int menu_hadleInput(data_T data, struct tb_event ev); 51 52 #endif