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