STOP CAT ABUSE!!!
[xmenu] / xmenu.h
... / ...
CommitLineData
1#define PROGNAME "xmenu"
2
3/* Actions for the main loop */
4#define ACTION_NOP 0
5#define ACTION_CLEAR 1<<0 /* clear text */
6#define ACTION_SELECT 1<<1 /* select item */
7#define ACTION_MAP 1<<2 /* remap menu windows */
8#define ACTION_DRAW 1<<3 /* redraw menu windows */
9#define ACTION_WARP 1<<4 /* warp the pointer */
10
11/* enum for keyboard menu navigation */
12enum { ITEMPREV, ITEMNEXT, ITEMFIRST, ITEMLAST };
13
14/* enum for text alignment */
15enum {LeftAlignment, CenterAlignment, RightAlignment};
16
17/* macros */
18#define LEN(x) (sizeof (x) / sizeof (x[0]))
19#define MAX(x,y) ((x)>(y)?(x):(y))
20#define MIN(x,y) ((x)<(y)?(x):(y))
21#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))
22#define GETNUM(n, s) { \
23 unsigned long __TMP__; \
24 if ((__TMP__ = strtoul((s), NULL, 10)) < INT_MAX) \
25 (n) = __TMP__; \
26 }
27
28/* color enum */
29enum {ColorFG, ColorBG, ColorLast};
30
31/* EWMH atoms */
32enum {NetWMName, NetWMWindowType, NetWMWindowTypePopupMenu, NetLast};
33
34/* configuration structure */
35struct Config {
36 /* the values below are set by config.h */
37 const char *font;
38 const char *background_color;
39 const char *foreground_color;
40 const char *selbackground_color;
41 const char *selforeground_color;
42 const char *separator_color;
43 const char *border_color;
44 int width_pixels;
45 int height_pixels;
46 int border_pixels;
47 int separator_pixels;
48 int gap_pixels;
49 int triangle_width;
50 int triangle_height;
51 int iconpadding;
52 int horzpadding;
53 int alignment;
54
55 /* the values below are set by options */
56 int monitor;
57 int posx, posy; /* rootmenu position */
58
59 /* the value below is computed by xmenu */
60 int iconsize;
61};
62
63/* draw context structure */
64struct DC {
65 XftColor normal[ColorLast];
66 XftColor selected[ColorLast];
67 XftColor border;
68 XftColor separator;
69
70 GC gc;
71
72 FcPattern *pattern;
73 XftFont **fonts;
74 size_t nfonts;
75};
76
77/* menu item structure */
78struct Item {
79 char *label; /* string to be drawed on menu */
80 char *output; /* string to be outputed when item is clicked */
81 char *file; /* filename of the icon */
82 int y; /* item y position relative to menu */
83 int h; /* item height */
84 int textw; /* text width */
85 struct Item *prev; /* previous item */
86 struct Item *next; /* next item */
87 struct Menu *submenu; /* submenu spawned by clicking on item */
88 Drawable sel, unsel; /* pixmap for selected and unselected item */
89 Imlib_Image icon;
90};
91
92/* monitor geometry structure */
93struct Monitor {
94 int x, y, w, h; /* monitor geometry */
95};
96
97/* menu structure */
98struct Menu {
99 struct Menu *parent; /* parent menu */
100 struct Item *caller; /* item that spawned the menu */
101 struct Item *list; /* list of items contained by the menu */
102 struct Item *selected; /* item currently selected in the menu */
103 int x, y, w, h; /* menu geometry */
104 int hasicon; /* whether the menu has item with icons */
105 int drawn; /* whether the menu was already drawn */
106 int maxtextw; /* maximum text width */
107 unsigned level; /* menu level relative to root */
108 Window win; /* menu window to map on the screen */
109 XIC xic; /* input context */
110};