1 /* -*-c-*- */ 2 3 #ifndef FVWM_MENU_PARAMETERS_H 4 #define FVWM_MENU_PARAMETERS_H 5 6 /* ---------------------------- included header files ---------------------- */ 7 #include "libs/fvwm_x11.h" 8 #include "execcontext.h" 9 10 /* ---------------------------- forward declarations ----------------------- */ 11 12 struct MenuRoot; 13 struct MenuParameters; 14 struct MenuReturn; 15 struct MenuItem; 16 struct FvwmWindow; 17 18 /* ---------------------------- type definitions --------------------------- */ 19 20 /* Return values for UpdateMenu, do_menu, menuShortcuts. This is a lame 21 * hack, in that "_BUTTON" is added to mean a button-release caused the 22 * return-- the macros below help deal with the ugliness. */ 23 typedef enum MenuRC 24 { 25 MENU_ERROR = -1, 26 MENU_NOP = 0, 27 MENU_DONE, 28 MENU_ABORTED, 29 MENU_SUBMENU_DONE, 30 MENU_DOUBLE_CLICKED, 31 MENU_POPUP, 32 MENU_POPDOWN, 33 MENU_SELECTED, 34 MENU_NEWITEM, 35 MENU_NEWITEM_MOVEMENU, 36 MENU_NEWITEM_FIND, 37 MENU_POST, 38 MENU_UNPOST, 39 MENU_TEAR_OFF, 40 MENU_SUBMENU_TORN_OFF, 41 MENU_KILL_TEAR_OFF_MENU, 42 MENU_EXEC_CMD, 43 /* propagate the event to a different menu */ 44 MENU_PROPAGATE_EVENT 45 } MenuRC; 46 47 typedef struct MenuReturn 48 { 49 MenuRC rc; 50 struct MenuRoot *target_menu; 51 struct 52 { 53 unsigned do_unpost_submenu : 1; 54 unsigned is_first_item_selected : 1; 55 unsigned is_key_press : 1; 56 unsigned is_menu_posted : 1; 57 } flags; 58 } MenuReturn; 59 60 typedef struct MenuPosHints 61 { 62 /* suggested x/y position */ 63 int x; 64 int y; 65 /* additional offset to x */ 66 int x_offset; 67 /* width of the parent menu or item */ 68 int menu_width; 69 /* to take menu width into account (0, -1 or -0.5) */ 70 float x_factor; 71 /* additional offset factor to x */ 72 float context_x_factor; 73 /* same with height */ 74 float y_factor; 75 int screen_origin_x; 76 int screen_origin_y; 77 /* False if referring to absolute screen position */ 78 Bool is_relative; 79 /* True if referring to a part of a menu */ 80 Bool is_menu_relative; 81 Bool has_screen_origin; 82 } MenuPosHints; 83 84 typedef struct MenuOptions 85 { 86 struct MenuPosHints pos_hints; 87 /* A position on the Xinerama screen on which the menu should be 88 * started. */ 89 struct 90 { 91 unsigned do_not_warp : 1; 92 unsigned do_warp_on_select : 1; 93 unsigned do_warp_title : 1; 94 unsigned do_select_in_place : 1; 95 unsigned do_tear_off_immediately : 1; 96 unsigned has_poshints : 1; 97 unsigned is_fixed : 1; 98 } flags; 99 } MenuOptions; 100 101 typedef struct MenuParameters 102 { 103 struct MenuRoot *menu; 104 struct MenuRoot *parent_menu; 105 struct MenuItem *parent_item; 106 const exec_context_t **pexc; 107 struct FvwmWindow *tear_off_root_menu_window; 108 char **ret_paction; 109 XEvent *event_propagate_to_submenu; 110 struct MenuOptions *pops; 111 /* A position on the Xinerama screen on which the menu should be 112 * started. */ 113 int screen_origin_x; 114 int screen_origin_y; 115 struct 116 { 117 unsigned has_default_action : 1; 118 unsigned is_already_mapped : 1; 119 unsigned is_first_root_menu : 1; 120 unsigned is_invoked_by_key_press : 1; 121 unsigned is_sticky : 1; 122 unsigned is_submenu : 1; 123 unsigned is_triggered_by_keypress : 1; 124 } flags; 125 } MenuParameters; 126 127 typedef struct MenuRepaintTransparentParameters 128 { 129 struct MenuRoot *mr; 130 struct FvwmWindow *fw; 131 } MenuRepaintTransparentParameters; 132 133 #endif /* FVWM_MENU_PARAMETERS_H */ 134