1 /*
2  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
3  * Copyright (C) 2004-2017 Kim Woelders
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to
7  * deal in the Software without restriction, including without limitation the
8  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9  * sell copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies of the Software, its documentation and marketing & publicity
14  * materials, and acknowledgment shall be given in the documentation, materials
15  * and software packages that this Software was used.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20  * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _MENUS_H_
25 #define _MENUS_H_
26 
27 #include "etypes.h"
28 
29 typedef struct _menu Menu;
30 typedef struct _menuitem MenuItem;
31 typedef struct _menustyle MenuStyle;
32 
33 typedef int         (MenuLoader) (Menu * m);
34 
35 /* menus.c */
36 int                 MenuStyleConfigLoad(FILE * fs);
37 MenuStyle          *MenuStyleFind(const char *name);
38 
39 int                 MenuConfigLoad(FILE * fs);
40 Menu               *MenuCreate(const char *name, const char *title,
41 			       Menu * parent, MenuStyle * ms);
42 void                MenuEmpty(Menu * m, int destroying);
43 int                 MenuLoad(Menu * m);
44 Menu               *MenuFind(const char *name, const char *param);
45 MenuItem           *MenuItemCreate(const char *text, const char *icon,
46 				   const char *action_params, Menu * child);
47 void                MenuSetInternal(Menu * m);
48 void                MenuSetDynamic(Menu * m);
49 void                MenuSetTransient(Menu * m);
50 void                MenuSetName(Menu * m, const char *name);
51 void                MenuSetAlias(Menu * m, const char *alias);
52 void                MenuSetStyle(Menu * m, MenuStyle * ms);
53 void                MenuSetTitle(Menu * m, const char *title);
54 void                MenuSetIconSize(Menu * m, int size);
55 void                MenuSetData(Menu * m, char *data);
56 void                MenuSetLoader(Menu * m, MenuLoader * loader);
57 void                MenuSetTimestamp(Menu * m, time_t t);
58 void                MenuAddItem(Menu * m, MenuItem * mi);
59 const char         *MenuGetName(const Menu * m);
60 const char         *MenuGetData(const Menu * m);
61 time_t              MenuGetTimestamp(const Menu * m);
62 
63 int                 MenusActive(void);
64 
65 /* menus-misc.c */
66 Menu               *MenusCreateInternal(const char *type, const char *name,
67 					const char *style, const char *prm);
68 
69 #endif /* _MENUS_H_ */
70