💾 Archived View for gemini.rmf-dev.com › repo › Vaati › Menkar › files › 672e2ae2118ddfca7b54b176733… captured on 2022-07-16 at 17:11:08. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
0 #if !defined(MENU_H)
1 #define MENU_H
2
3 /*
4 * Copyright 2006-2007 Johan Veenhuizen
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25 #include <X11/Xlib.h>
26
27 #include "list.h"
28 #include "widget.h"
29
30 struct menuitem {
31 struct menu *menu;
32 char *name;
33 void (*select)(void *);
34 void *arg;
35 LIST itemlink;
36 };
37
38 struct menu { struct widget widget;
39 GC gc;
40 Pixmap pixmap;
41 int pixmapwidth;
42 int pixmapheight;
43 int current;
44 int button;
45 int nitems;
46 LIST itemlist;
47 };
48
49 struct menu *create_menu(void);
50 void destroy_menu(struct menu *);
51 struct menuitem *create_menuitem(struct menu *, const char *,
52 void (*)(void *), void *);
53 void destroy_menuitem(struct menuitem *);
54 void hide_menu(struct menu *);
55 void put_menuitem_first(struct menuitem *);
56 void put_menuitem_last(struct menuitem *);
57 void show_menu(struct menu *, int, int, int);
58 void rename_menuitem(struct menuitem *, const char *);
59 void select_current_menuitem(struct menu *);
60
61 #endif /* !defined(MENU_H) */
62