add tests for menu and menustyle commands.
[fvwm.git] / fvwm / functions.h
blobd0012662fdce62754ec81dc1d3806c5c6630edd4
1 /* This program is free software; you can redistribute it and/or modify
2 * it under the terms of the GNU General Public License as published by
3 * the Free Software Foundation; either version 2 of the License, or
4 * (at your option) any later version.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 #ifndef _FUNCTIONS_
17 #define _FUNCTIONS_
19 struct FvwmFunction; /* forward declaration */
21 typedef struct FunctionItem
23 struct FvwmFunction *func; /* the function this item is in */
24 struct FunctionItem *next_item; /* next function item */
25 char condition; /* the character string displayed on left*/
26 char *action; /* action to be performed */
27 short type; /* type of built in function */
28 unsigned char flags;
29 } FunctionItem;
31 typedef struct FvwmFunction
33 struct FvwmFunction *next_func; /* next in list of root menus */
34 FunctionItem *first_item; /* first item in function */
35 FunctionItem *last_item; /* last item in function */
36 char *name; /* function name */
37 unsigned int use_depth;
38 } FvwmFunction;
40 /* used for parsing commands*/
41 typedef struct
43 char *keyword;
44 #ifdef __STDC__
45 void (*action)(XEvent *,Window,FvwmWindow *, unsigned long,char *, int *);
46 #else
47 void (*action)();
48 #endif
49 short func_type;
50 unsigned char flags;
51 } func_type;
53 /* Bits for the function flag byte. */
54 #define FUNC_NEEDS_WINDOW 0x01
55 #define FUNC_DONT_REPEAT 0x02
56 #define FUNC_ADD_TO 0x04
57 #define FUNC_DECOR 0x08
59 /* Types of events for the FUNCTION builtin */
60 typedef enum
62 CF_IMMEDIATE = 'i',
63 CF_MOTION = 'm',
64 CF_HOLD = 'h',
65 CF_CLICK = 'c',
66 CF_DOUBLE_CLICK = 'd',
67 CF_TIMEOUT = '-'
68 } cfunc_action_type;
70 /* for exec_flags parameter of ExecuteFunction */
71 #define FUNC_DONT_EXPAND_COMMAND 0x01
72 #define FUNC_DO_SYNC_BUTTONS 0x02
74 void find_func_type(char *action, short *func_type, unsigned char *flags);
75 FvwmFunction *FindFunction(const char *function_name);
76 extern FvwmFunction *NewFvwmFunction(const char *name);
77 void DestroyFunction(FvwmFunction *func);
78 extern int DeferExecution(XEvent *, Window *,FvwmWindow **, unsigned long *,
79 cursor_type, int);
80 void ExecuteFunction(
81 char *Action, FvwmWindow *tmp_win, XEvent *eventp, unsigned long context,
82 int Module, unsigned int exec_flags, char *args[]);
83 void ExecuteFunctionSaveTmpWin(
84 char *Action, FvwmWindow *tmp_win, XEvent *eventp, unsigned long context,
85 int Module, unsigned int exec_flags, char *args[]);
86 void AddToFunction(FvwmFunction *func, char *action);
88 enum
90 F_UNDEFINED = -1,
92 /* functions that need no window */
93 F_NOP = 0,
94 F_ADDFUNC,
95 F_ADDMENU,
96 F_ADDMENU2,
97 F_ALL,
98 F_BEEP,
99 F_BUG_OPTS,
100 F_BUSY_CURSOR,
101 F_BUTTON_STATE,
102 F_BUTTON_STYLE,
103 F_CHANGE_MENUSTYLE,
104 F_CIRCULATE_DOWN,
105 F_CIRCULATE_UP,
106 F_CLICK,
107 F_CLOSE,
108 F_COLORMAP_FOCUS,
109 F_CONFIG_LIST,
110 F_CURRENT,
111 F_CURSOR_STYLE,
112 F_DESTROY_FUNCTION,
113 F_DESTROY_MENU,
114 F_DESTROY_MENUSTYLE,
115 F_DESTROY_STYLE,
116 F_DFLT_COLORS,
117 F_DFLT_COLORSET,
118 F_DFLT_FONT,
119 F_DFLT_ICON,
120 F_DFLT_LAYERS,
121 F_DIRECTION,
122 F_EDGE_RES,
123 F_EDGE_SCROLL,
124 F_EMULATE,
125 F_ESCAPE_FUNC,
126 F_EXEC,
127 F_EXEC_SETUP,
128 F_FUNCTION,
129 F_GLOBAL_OPTS,
130 F_GOTO_DESK,
131 F_GOTO_PAGE,
132 F_HICOLOR,
133 F_HICOLORSET,
134 F_HIDEGEOMWINDOW,
135 F_ICONFONT,
136 F_ICON_PATH,
137 F_IGNORE_MODIFIERS,
138 F_IMAGE_PATH,
139 F_KEY,
140 F_KILL_MODULE,
141 F_LAYER,
142 F_MENUSTYLE,
143 F_MODULE,
144 F_MODULE_PATH,
145 F_MODULE_SYNC,
146 F_MOUSE,
147 F_MOVECURSOR,
148 F_MOVE_TO_DESK,
149 F_NEXT,
150 F_NONE,
151 F_OPAQUE,
152 F_PICK,
153 F_PIXMAP_PATH,
154 F_POINTERKEY,
155 F_POPUP,
156 F_PREV,
157 F_QUIT,
158 F_QUIT_SESSION,
159 F_QUIT_SCREEN,
160 F_READ,
161 F_RECAPTURE,
162 F_RECAPTURE_WINDOW,
163 F_REFRESH,
164 F_REPEAT,
165 F_RESTART,
166 F_SAVE_SESSION,
167 F_SAVE_QUIT_SESSION,
168 F_SCROLL,
169 F_SETDESK,
170 F_SETENV,
171 F_SET_ANIMATION,
172 F_SET_MASK,
173 F_SET_NOGRAB_MASK,
174 F_SET_SYNC_MASK,
175 F_SHADE_ANIMATE,
176 F_SILENT,
177 F_SNAP_ATT,
178 F_SNAP_GRID,
179 F_STAYSUP,
180 STROKE_ARG(F_STROKE)
181 STROKE_ARG(F_STROKE_FUNC)
182 F_STYLE,
183 F_TITLE,
184 F_TITLESTYLE,
185 F_TOGGLE_PAGE,
186 F_UPDATE_STYLES,
187 F_WAIT,
188 F_WINDOWFONT,
189 F_WINDOWLIST,
190 F_XOR,
192 /* functions that need a window to operate on */
193 F_ADD_BUTTON_STYLE,
194 F_ADD_DECOR,
195 F_ADD_TITLE_STYLE,
196 F_ANIMATED_MOVE,
197 F_BORDERSTYLE,
198 F_CHANGE_DECOR,
199 F_COLOR_LIMIT,
200 F_DELETE,
201 F_DESTROY,
202 F_DESTROY_DECOR,
203 F_DESTROY_MOD,
204 F_ECHO,
205 F_FLIP_FOCUS,
206 F_FOCUS,
207 F_ICONIFY,
208 F_LOWER,
209 F_MAXIMIZE,
210 F_MOVE,
211 F_MOVE_THRESHOLD,
212 F_MOVE_TO_PAGE,
213 F_PLACEAGAIN,
214 F_RAISE,
215 F_RAISELOWER,
216 F_RESIZE,
217 F_RESIZEMOVE,
218 F_SEND_STRING,
219 F_STICK,
220 F_UPDATE_DECOR,
221 F_WARP,
222 F_WINDOWID,
223 F_WINDOW_SHADE,
225 F_END_OF_LIST = 999,
227 /* Functions for use by modules only! */
228 F_SEND_WINDOW_LIST = 1000
231 #endif /* _FUNCTIONS_ */