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