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