1 | /* |
---|
2 | * $Id: Menu.h,v 1.2 1999-01-22 23:16:57 ghudson Exp $ |
---|
3 | * |
---|
4 | * Copyright 1990, 1991 by the Massachusetts Institute of Technology. |
---|
5 | * |
---|
6 | * For copying and distribution information, please see the file |
---|
7 | * <mit-copyright.h>. |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef _Xj_Menu_h |
---|
12 | #define _Xj_Menu_h |
---|
13 | |
---|
14 | #include <X11/Xlib.h> |
---|
15 | #include <X11/Xresource.h> |
---|
16 | #include "Jets.h" |
---|
17 | #include "hash.h" |
---|
18 | |
---|
19 | extern JetClass menuJetClass; |
---|
20 | extern JetClass menuBarJetClass; |
---|
21 | extern void PrintMenu(); |
---|
22 | extern int loadNewMenus(); |
---|
23 | extern void computeMenuSize(); |
---|
24 | extern void computeRootMenuSize(); |
---|
25 | extern void computeAllMenuSizes(); |
---|
26 | |
---|
27 | typedef struct {int littlefoo;} MenuClassPart; |
---|
28 | |
---|
29 | typedef struct _MenuClassRec { |
---|
30 | CoreClassPart core_class; |
---|
31 | MenuClassPart menu_class; |
---|
32 | } MenuClassRec; |
---|
33 | |
---|
34 | extern MenuClassRec menuClassRec; |
---|
35 | |
---|
36 | #define VERTICAL 0 |
---|
37 | #define HORIZONTAL 1 |
---|
38 | |
---|
39 | #define NORMAL 0 |
---|
40 | #define HELP 1 |
---|
41 | |
---|
42 | #define CLOSED 0 |
---|
43 | #define SELECTED 1 |
---|
44 | #define OPENED 2 |
---|
45 | |
---|
46 | typedef struct _Menu { |
---|
47 | /* |
---|
48 | * Information to be filled in by parent/runtime activities |
---|
49 | */ |
---|
50 | struct _Menu *parent; |
---|
51 | struct _Menu *sibling; |
---|
52 | int label_x, label_y; |
---|
53 | int pane_x, pane_y; |
---|
54 | Window menuPane; |
---|
55 | int x, y; |
---|
56 | int state; /* CLOSED, SELECTED, OPENED */ |
---|
57 | |
---|
58 | /* |
---|
59 | * Self and child-dependent variables - known or computed at |
---|
60 | * initialization time |
---|
61 | */ |
---|
62 | int supported; |
---|
63 | Boolean verify; |
---|
64 | struct _Menu *child; |
---|
65 | int weight; |
---|
66 | char *title; |
---|
67 | int title_width, title_height; |
---|
68 | XjCallback *activateProc; |
---|
69 | int paneType; /* one of NORMAL, HELP */ |
---|
70 | int orientation; /* one of HORIZONTAL, VERTICAL */ |
---|
71 | int label_width, label_height; |
---|
72 | int pane_width, pane_height; |
---|
73 | int pane_open_x; |
---|
74 | } Menu; |
---|
75 | |
---|
76 | #define MAXMENUSPERTYPE 10 |
---|
77 | #define MAXPARENTS 10 |
---|
78 | #define MAXCHILDREN 5 |
---|
79 | |
---|
80 | typedef struct _MenuU { |
---|
81 | int orientation; |
---|
82 | XrmQuark children[MAXCHILDREN]; /* possible types of children */ |
---|
83 | Menu *m; /* menu entry if this exists */ |
---|
84 | } MenuU; |
---|
85 | |
---|
86 | typedef struct _ItemU { |
---|
87 | char *help; |
---|
88 | int help_width, help_height; |
---|
89 | XjCallback *activateProc; |
---|
90 | #ifdef MENU_COMPILER |
---|
91 | char *activateString; |
---|
92 | #endif |
---|
93 | int supported; |
---|
94 | Boolean verify; |
---|
95 | } ItemU; |
---|
96 | |
---|
97 | #define ItemITEM 0 |
---|
98 | #define MenuITEM 1 |
---|
99 | #define HelpITEM 2 |
---|
100 | #define TitleITEM 2 |
---|
101 | #define SeparatorITEM 2 |
---|
102 | |
---|
103 | #define titleFLAG 1<<0 |
---|
104 | #define parentsFLAG 1<<1 |
---|
105 | #define activateFLAG 1<<2 |
---|
106 | #define orientationFLAG 1<<3 |
---|
107 | #define childrenFLAG 1<<4 |
---|
108 | #define verifyFLAG 1<<5 |
---|
109 | |
---|
110 | typedef struct _Item { |
---|
111 | int type; |
---|
112 | int flags; |
---|
113 | char *title; |
---|
114 | int title_width; |
---|
115 | XrmQuark name; |
---|
116 | XrmQuark parents[MAXPARENTS]; /* possible types of parents */ |
---|
117 | int weight[MAXPARENTS]; /* weight per-parent */ |
---|
118 | struct _Item *next; |
---|
119 | union _u { |
---|
120 | MenuU m; |
---|
121 | ItemU i; |
---|
122 | } u; |
---|
123 | } Item; |
---|
124 | |
---|
125 | typedef struct _TypeDef { |
---|
126 | XrmQuark type; |
---|
127 | Item *menus[MAXMENUSPERTYPE]; |
---|
128 | } TypeDef; |
---|
129 | |
---|
130 | typedef struct { |
---|
131 | XjCallbackProc activateProc; |
---|
132 | Boolean showHelp; |
---|
133 | int sticky; |
---|
134 | XFontStruct *font; |
---|
135 | GC gc, invert_gc, background_gc, dim_gc, dash_gc, dot_gc; |
---|
136 | int foreground, background; |
---|
137 | Boolean reverseVideo; |
---|
138 | char *items, *file, *fallback; |
---|
139 | char *userItems, *userFile; |
---|
140 | Menu *rootMenu; |
---|
141 | Menu *deepestOpened; |
---|
142 | int buttonDown; |
---|
143 | Boolean inside; |
---|
144 | Boolean same; |
---|
145 | int hMenuPadding; |
---|
146 | int vMenuPadding; |
---|
147 | Boolean screenWidth; |
---|
148 | XjPixmap *helpPixmap, |
---|
149 | *submenuPixmap, |
---|
150 | *grey; |
---|
151 | struct hash *Names, *Types; |
---|
152 | Item *firstMenu; |
---|
153 | Item *firstItem; |
---|
154 | Boolean rude; |
---|
155 | Boolean grabbed; |
---|
156 | Boolean autoRaise; |
---|
157 | int scrollx; |
---|
158 | Menu *responsibleParent; |
---|
159 | XjCallback *verifyProc; |
---|
160 | Boolean verify; |
---|
161 | Boolean moveMenus; |
---|
162 | char *rightJet; |
---|
163 | Jet right_jet; |
---|
164 | } MenuPart; |
---|
165 | |
---|
166 | typedef struct _MenuRec { |
---|
167 | CorePart core; |
---|
168 | MenuPart menu; |
---|
169 | } MenuRec; |
---|
170 | |
---|
171 | typedef struct _MenuRec *MenuJet; |
---|
172 | typedef struct _MenuClassRec *MenuJetClass; |
---|
173 | |
---|
174 | #define XjCStartItems "StartItems" /* backwards compatibility... */ |
---|
175 | #define XjNstartItems "startItems" |
---|
176 | #define XjCItems "Items" |
---|
177 | #define XjNitems "items" |
---|
178 | #define XjCFile "File" |
---|
179 | #define XjNfile "file" |
---|
180 | #define XjCFallback "FallbackFile" |
---|
181 | #define XjNfallback "fallbackFile" |
---|
182 | #define XjCUserItems "UserItems" |
---|
183 | #define XjNuserItems "userItems" |
---|
184 | #define XjCUserFile "UserFile" |
---|
185 | #define XjNuserFile "userFile" |
---|
186 | #define XjCMenuPadding "MenuPadding" |
---|
187 | #define XjNhMenuPadding "hMenuPadding" |
---|
188 | #define XjNvMenuPadding "vMenuPadding" |
---|
189 | #define XjCScreenWidth "ScreenWidth" |
---|
190 | #define XjNscreenWidth "screenWidth" |
---|
191 | #define XjNhelpPixmap "helpPixmap" |
---|
192 | #define XjNsubmenuPixmap "submenuPixmap" |
---|
193 | #define XjCShowHelp "ShowHelp" |
---|
194 | #define XjNshowHelp "showHelp" |
---|
195 | #define XjNsticky "sticky" |
---|
196 | #define XjCSticky "Sticky" |
---|
197 | #define XjCGrey "Grey" |
---|
198 | #define XjNgrey "grey" |
---|
199 | #define XjCRude "Rude" |
---|
200 | #define XjNrude "rude" |
---|
201 | #define XjCVerifyProc "VerifyProc" |
---|
202 | #define XjNverifyProc "verifyProc" |
---|
203 | #define XjCVerify "Verify" |
---|
204 | #define XjNverify "verify" |
---|
205 | #define XjCAutoRaise "AutoRaise" |
---|
206 | #define XjNautoRaise "autoRaise" |
---|
207 | #define XjCMoveMenus "MoveMenus" |
---|
208 | #define XjNmoveMenus "moveMenus" |
---|
209 | #define XjCJet "Jet" |
---|
210 | #define XjNrightJet "rightJet" |
---|
211 | |
---|
212 | typedef struct _MenuInfo |
---|
213 | { |
---|
214 | char *null; |
---|
215 | MenuJet menubar; |
---|
216 | Menu *menu; |
---|
217 | } MenuInfo; |
---|
218 | |
---|
219 | #endif /* _Xj_Menu_h */ |
---|