1 |
#ifndef MENUBAR_H_ |
2 |
#define MENUBAR_H_ |
3 |
|
4 |
typedef struct { |
5 |
short type; /* must not be changed; first element */ |
6 |
short len; /* strlen (str) */ |
7 |
unsigned char *str; /* action to take */ |
8 |
} action_t; |
9 |
|
10 |
typedef struct { |
11 |
short type; /* must not be changed; first element */ |
12 |
struct menu_t *menu; /* sub-menu */ |
13 |
} submenu_t; |
14 |
|
15 |
typedef struct menuitem_t { |
16 |
struct menuitem_t *prev; /* prev menu-item */ |
17 |
struct menuitem_t *next; /* next menu-item */ |
18 |
char *name; /* character string displayed */ |
19 |
char *name2; /* character string displayed (right) */ |
20 |
short len; /* strlen (name) */ |
21 |
short len2; /* strlen (name) */ |
22 |
union { |
23 |
short type; /* must not be changed; first element */ |
24 |
action_t action; |
25 |
submenu_t submenu; |
26 |
} entry; |
27 |
} menuitem_t; |
28 |
|
29 |
enum menuitem_t_action { |
30 |
MenuLabel, |
31 |
MenuAction, |
32 |
MenuTerminalAction, |
33 |
MenuSubMenu |
34 |
}; |
35 |
|
36 |
typedef struct menu_t { |
37 |
struct menu_t *parent; /* parent menu */ |
38 |
struct menu_t *prev; /* prev menu */ |
39 |
struct menu_t *next; /* next menu */ |
40 |
menuitem_t *head; /* double-linked list */ |
41 |
menuitem_t *tail; /* double-linked list */ |
42 |
menuitem_t *item; /* current item */ |
43 |
char *name; /* menu name */ |
44 |
short len; /* strlen (name) */ |
45 |
short width; /* maximum menu width [chars] */ |
46 |
Window win; /* window of the menu */ |
47 |
struct rxvt_drawable *drawable; |
48 |
short x; /* x location [pixels] (chars if parent == NULL) */ |
49 |
short y; /* y location [pixels] */ |
50 |
short w, h; /* window width, height [pixels] */ |
51 |
} menu_t; |
52 |
|
53 |
typedef struct bar_t { |
54 |
menu_t *head, *tail; /* double-linked list of menus */ |
55 |
char *title; /* title to put in the empty menuBar */ |
56 |
#if (MENUBAR_MAX > 1) |
57 |
# define MAXNAME 16 |
58 |
char name[MAXNAME]; /* name to use to refer to menubar */ |
59 |
struct bar_t *next, *prev; /* circular linked-list */ |
60 |
#endif /* (MENUBAR_MAX > 1) */ |
61 |
#define NARROWS 4 |
62 |
action_t arrows[NARROWS]; |
63 |
} bar_t; |
64 |
|
65 |
/* #define DEBUG_MENU */ |
66 |
/* #define DEBUG_MENU_LAYOUT */ |
67 |
/* #define DEBUG_MENUBAR_STACKING */ |
68 |
|
69 |
#define HSPACE 1 /* one space */ |
70 |
#define isSeparator(name) ((name)[0] == '\0') |
71 |
#define HEIGHT_SEPARATOR (SHADOW + 1) |
72 |
#define HEIGHT_TEXT (Height2Pixel(1) + 2) |
73 |
|
74 |
#define MENU_DELAY_USEC 0 /* no delay */ |
75 |
|
76 |
#define SEPARATOR_NAME "-" |
77 |
#define MENUITEM_BEG '{' |
78 |
#define MENUITEM_END '}' |
79 |
#define COMMENT_CHAR '#' |
80 |
|
81 |
#define DOT "." |
82 |
#define DOTS ".." |
83 |
|
84 |
#endif /* _MENUBAR_H_ */ |