Update README.md
[xmenu] / xmenu.h
CommitLineData
8902c43b 1#define PROGNAME "xmenu"
2
3/* macros for keyboard menu navigation */
4#define ITEMPREV 0
5#define ITEMNEXT 1
6
7/* macros */
cdeaefaa 8#define LEN(x) (sizeof (x) / sizeof (x[0]))
9#define MAX(x,y) ((x)>(y)?(x):(y))
10#define MIN(x,y) ((x)<(y)?(x):(y))
11#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
8902c43b 12
13/* color enum */
14enum {ColorFG, ColorBG, ColorLast};
15
16/* EWMH atoms */
17enum {NetWMName, NetWMWindowType, NetWMWindowTypePopupMenu, NetLast};
18
19/* configuration structure */
20struct Config {
05cfe1a0 21 /* the values below are set by config.h */
8902c43b 22 const char *font;
8902c43b 23 const char *background_color;
24 const char *foreground_color;
25 const char *selbackground_color;
26 const char *selforeground_color;
27 const char *separator_color;
28 const char *border_color;
8902c43b 29 int width_pixels;
30 int height_pixels;
31 int border_pixels;
32 int separator_pixels;
33 int gap_pixels;
8902c43b 34 int triangle_width;
35 int triangle_height;
8902c43b 36 int iconpadding;
71b4db92 37 int horzpadding;
38
05cfe1a0 39 /* the values below are computed by xmenu */
71b4db92 40 int iconsize;
05cfe1a0 41 int posx, posy; /* cursor position */
8902c43b 42 int screenw, screenh; /* screen width and height */
43};
44
45/* draw context structure */
46struct DC {
47 XftColor normal[ColorLast];
48 XftColor selected[ColorLast];
49 XftColor border;
50 XftColor separator;
51
52 GC gc;
cdeaefaa 53
54 XftFont **fonts;
55 size_t nfonts;
8902c43b 56};
57
58/* menu item structure */
59struct Item {
60 char *label; /* string to be drawed on menu */
61 char *output; /* string to be outputed when item is clicked */
62 char *file; /* filename of the icon */
63 int y; /* item y position relative to menu */
64 int h; /* item height */
65 size_t labellen; /* strlen(label) */
66 struct Item *prev; /* previous item */
67 struct Item *next; /* next item */
68 struct Menu *submenu; /* submenu spawned by clicking on item */
cdeaefaa 69 Drawable sel, unsel; /* pixmap for selected and unselected item */
8902c43b 70 Imlib_Image icon;
71};
72
73/* menu structure */
74struct Menu {
75 struct Menu *parent; /* parent menu */
76 struct Item *caller; /* item that spawned the menu */
77 struct Item *list; /* list of items contained by the menu */
78 struct Item *selected; /* item currently selected in the menu */
79 int x, y, w, h; /* menu geometry */
3d853664 80 int drawn; /* whether the menu was already drawn */
8902c43b 81 unsigned level; /* menu level relative to root */
8902c43b 82 Window win; /* menu window to map on the screen */
83};