Merge from emacs-24; up to 2012-12-02T06:22:32Z!cyd@gnu.org
[bpt/emacs.git] / oldXMenu / Create.c
1 /* Copyright Massachusetts Institute of Technology 1985 */
2
3 #include "copyright.h"
4
5 /*
6 Copyright (C) 1993-1994, 2001-2012 Free Software Foundation, Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21
22 /*
23 * XMenu: MIT Project Athena, X Window system menu package
24 *
25 * XMenuCreate - Creates an X window system menu object.
26 *
27 * Author: Tony Della Fera, DEC
28 * January 23, 1986
29 *
30 */
31
32 #include "XMenuInt.h"
33 #include <stdlib.h>
34
35 #ifdef EMACS_BITMAP_FILES
36 #include "../src/bitmaps/dimple1.xbm"
37 #include "../src/bitmaps/dimple3.xbm"
38 #include "../src/bitmaps/gray1.xbm"
39 #include "../src/bitmaps/gray3.xbm"
40 #include "../src/bitmaps/crosswv.xbm"
41
42 #include "../src/bitmaps/leftptr.xbm"
43 #include "../src/bitmaps/leftpmsk.xbm"
44 #include "../src/bitmaps/rtptr.xbm"
45 #include "../src/bitmaps/rtpmsk.xbm"
46 #include "../src/bitmaps/cntrptr.xbm"
47 #include "../src/bitmaps/cntrpmsk.xbm"
48 #include "../src/bitmaps/stipple.xbm"
49
50 #else
51
52 #include <X11/bitmaps/dimple1>
53 #include <X11/bitmaps/dimple3>
54 #include <X11/bitmaps/gray1>
55 #include <X11/bitmaps/gray3>
56 #include <X11/bitmaps/cross_weave>
57
58 #include <X11/bitmaps/left_ptr>
59 #include <X11/bitmaps/left_ptrmsk>
60 #include <X11/bitmaps/right_ptr>
61 #include <X11/bitmaps/right_ptrmsk>
62 #include <X11/bitmaps/cntr_ptr>
63 #include <X11/bitmaps/cntr_ptrmsk>
64 #include <X11/bitmaps/stipple>
65
66 #endif /* not EMACS_BITMAP_FILES */
67
68 #define DEF_FREEZE 0
69 #define DEF_REVERSE 0
70 #define DEF_MENU_STYLE LEFT
71 #define DEF_MENU_MODE BOX
72 #define DEF_INACT_PNUM 3
73
74 #define DEF_P_STYLE CENTER
75
76 #define DEF_P_EVENTS (EnterWindowMask | ExposureMask)
77 #define DEF_P_FNT_NAME "fixed"
78 #define DEF_P_SPREAD 0.5
79 #define DEF_P_BDR_WIDTH 2
80
81 #define DEF_S_STYLE LEFT
82 #define DEF_S_EVENTS (EnterWindowMask | LeaveWindowMask)
83 #define DEF_S_FNT_NAME "fixed"
84 #define DEF_S_SPREAD 0.10
85 #define DEF_S_BDR_WIDTH 1
86
87 #define XASSOC_TABLE_SIZE 64
88
89 char *x_get_resource_string (char const *, char const *);
90
91
92
93 static Status
94 XAllocDisplayColor(Display *display, Colormap map, char const *colorName,
95 XColor *color, XColor *junk)
96 {
97 return (colorName!=0 &&
98 XParseColor(display, map, colorName, color) &&
99 XAllocColor(display, map, color));
100 }
101
102
103 XMenu *
104 XMenuCreate(Display *display, Window parent, register char const *def_env)
105 /* ID of previously opened display */
106 /* Window ID of the menu's parent window. */
107 /* X Defaults program environment name. */
108 {
109 register char *def_val; /* X Default value temp variable. */
110
111 register XMenu *menu; /* Pointer to the new menu. */
112 XMStyle menu_style; /* Menu display style. */
113 XMMode menu_mode; /* Menu display mode. */
114 XMPane *pane; /* Pane list header. */
115 XAssocTable *assoc_tab; /* XAssocTable pointer. */
116
117 int freeze; /* Freeze server mode. */
118 int reverse; /* Reverse video mode. */
119
120 XMStyle p_style; /* Pane display style. */
121 char const *p_fnt_name; /* Flag font name. */
122 XFontStruct *p_fnt_info; /* Flag font structure */
123 int p_fnt_pad; /* Flag font padding in pixels. */
124 double p_spread; /* Pane spread in flag height fractions. */
125 int p_fnt_height; /* Pane character height. */
126 int p_bdr_width; /* Pane border width. */
127 int flag_height; /* Flag window height. */
128 int p_height; /* Pane window height. */
129 int p_x_off; /* Pane X offset. */
130 int p_y_off; /* Pane Y offset. */
131 GC pane_GC; /* Pane graphics context. */
132
133 XMStyle s_style; /* Selection display style. */
134 char const *s_fnt_name; /* Selection font name. */
135 XFontStruct *s_fnt_info; /* Selection font structure. */
136 int s_fnt_pad; /* Selection font padding in pixels. */
137 int s_fnt_height; /* Selection font character height */
138 double s_spread; /* Select spread in line height fractions. */
139 int s_bdr_width; /* Highlight border width. */
140 int s_height; /* Selection window height. */
141 int s_x_off; /* Selection window X offset. */
142 int s_y_off; /* Selection window Y offset. */
143 GC normal_select_GC; /* GC used for normal video selection. */
144 GC inverse_select_GC; /* GC used for inverse video selection. */
145 GC inact_GC; /* GC for inactive pane header and */
146 /* selections. */
147
148 XColor color_def; /* Temp color definition holder. */
149 XColor p_bdr_color; /* Color of border. */
150 XColor s_bdr_color; /* Color of highlight. */
151 XColor p_frg_color; /* Color of pane foreground color. */
152 XColor s_frg_color; /* Color of selection foreground. */
153 XColor bkgnd_color; /* Color of background.. */
154 XColor mouse_color; /* Color of mouse cursor. */
155 Cursor mouse_cursor; /* Mouse cursor. */
156 Pixmap inact_bitmap; /* Menu inactive pixmap. */
157
158 int inact_pnum; /* Inactive background pattern number. */
159
160 Pixmap cursor; /* Cursor pixmap holder. */
161 Pixmap cursor_mask; /* Cursor mask pixmap holder. */
162 Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */
163 unsigned long valuemask;
164 XGCValues *values;
165
166 Window root = RootWindow (display, DefaultScreen (display));
167
168 /*
169 * Calloc the XMenu structure and the initial pane.
170 */
171 menu = (XMenu *)calloc(1, sizeof(XMenu));
172 if (menu == NULL) {
173 _XMErrorCode = XME_CALLOC;
174 return(NULL);
175 }
176 pane = (XMPane *)calloc(1, sizeof(XMPane));
177 if (pane == NULL) {
178 _XMErrorCode = XME_CALLOC;
179 return(NULL);
180 }
181
182 /*
183 * Create the XAssocTable
184 */
185 assoc_tab = (XAssocTable *)XCreateAssocTable(XASSOC_TABLE_SIZE);
186 if(assoc_tab == NULL) {
187 _XMErrorCode= XME_CREATE_ASSOC;
188 return(NULL);
189 }
190
191 /*
192 * Set up the default environment name.
193 */
194 if (def_env == NULL || *def_env == '\0') def_env = "XMenu";
195
196 /*
197 * Set up internal fail-safe defaults.
198 */
199 freeze = DEF_FREEZE;
200 reverse = DEF_REVERSE;
201 menu_style = DEF_MENU_STYLE;
202 menu_mode = DEF_MENU_MODE;
203 inact_pnum = DEF_INACT_PNUM;
204
205 p_style = DEF_P_STYLE;
206 p_spread = DEF_P_SPREAD;
207 p_fnt_name = DEF_P_FNT_NAME;
208 p_bdr_width = DEF_P_BDR_WIDTH;
209
210 s_style = DEF_S_STYLE;
211 s_spread = DEF_S_SPREAD;
212 s_fnt_name = DEF_S_FNT_NAME;
213 s_bdr_width = DEF_S_BDR_WIDTH;
214
215 /*
216 * Get default values from X.
217 */
218 def_val = x_get_resource_string ("menuFreeze", "MenuFreeze");
219 if (def_val != NULL) {
220 if (strcmp(def_val, "on") == 0) freeze = 1;
221 else if (strcmp(def_val, "off") == 0) freeze = 0;
222 }
223
224 def_val = x_get_resource_string ("menuReverseVideo", "MenuReverseVideo");
225 if (def_val != NULL) {
226 if (strcmp(def_val, "on") == 0) reverse = 1;
227 else if (strcmp(def_val, "off") == 0) reverse = 0;
228 }
229
230 def_val = x_get_resource_string ("menuStyle", "MenuStyle");
231 if (def_val != NULL) {
232 if (strcmp(def_val, "right_hand") == 0) menu_style = RIGHT;
233 else if (strcmp(def_val, "left_hand") == 0) menu_style = LEFT;
234 else if (strcmp(def_val, "center") == 0) menu_style = CENTER;
235 }
236
237 def_val = x_get_resource_string ("menuMode", "MenuMode");
238 if (def_val != NULL) {
239 if (strcmp(def_val, "box") == 0) menu_mode = BOX;
240 else if (strcmp(def_val, "invert") == 0) menu_mode = INVERT;
241 }
242
243 def_val = x_get_resource_string ("menuMouse", "MenuMouse");
244 if (
245 def_val != NULL &&
246 DisplayCells(display, DefaultScreen(display)) > 2 &&
247 XAllocDisplayColor(display,
248 DefaultColormap(display, DefaultScreen(display)),
249 def_val,
250 &mouse_color, &color_def)
251 );
252 else if (reverse &&
253 XAllocDisplayColor(display,
254 DefaultColormap(display, DefaultScreen(display)),
255 "white",
256 &mouse_color, &color_def)
257 );
258
259 else if (XAllocDisplayColor(display,
260 DefaultColormap(display, DefaultScreen(display)),
261 "black",
262 &mouse_color, &color_def)
263 );
264
265 else {}
266
267 def_val = x_get_resource_string ("menuBackground", "MenuBackground");
268 if (
269 def_val != NULL &&
270 DisplayCells(display, DefaultScreen(display)) > 2 &&
271 XAllocDisplayColor(display,
272 DefaultColormap(display, DefaultScreen(display)),
273 def_val,
274 &bkgnd_color, &color_def)
275 );
276 else if (reverse &&
277 XAllocDisplayColor(display,
278 DefaultColormap(display, DefaultScreen(display)),
279 "black",
280 &bkgnd_color, &color_def)
281 );
282 else if (XAllocDisplayColor(display,
283 DefaultColormap(display, DefaultScreen(display)),
284 "white",
285 &bkgnd_color, &color_def)
286 );
287 else {}
288
289 def_val = x_get_resource_string ("menuInactivePattern", "MenuInactivePattern");
290 if (def_val != NULL) {
291 if (strcmp(def_val, "dimple1") == 0) inact_pnum = 0;
292 else if (strcmp(def_val, "dimple3") == 0) inact_pnum = 1;
293 else if (strcmp(def_val, "gray1") == 0) inact_pnum = 2;
294 else if (strcmp(def_val, "gray3") == 0) inact_pnum = 3;
295 else if (strcmp(def_val, "cross_weave") == 0) inact_pnum = 4;
296 }
297
298 def_val = x_get_resource_string ("paneStyle", "PaneStyle");
299 if (def_val != NULL) {
300 if (strcmp(def_val, "flush_left") == 0) p_style = LEFT;
301 else if (strcmp(def_val, "flush_right") == 0) p_style = RIGHT;
302 else if (strcmp(def_val, "center") == 0) p_style = CENTER;
303 }
304
305 def_val = x_get_resource_string ("paneFont", "PaneFont");
306 if (def_val != NULL) p_fnt_name = def_val;
307
308 def_val = x_get_resource_string ("paneForeground", "PaneForeground");
309 if (
310 def_val != NULL &&
311 DisplayCells(display, DefaultScreen(display)) > 2
312 )
313 XAllocDisplayColor(display, DefaultColormap(display,
314 DefaultScreen(display)),
315 def_val,
316 &p_frg_color, &color_def);
317
318 else if (reverse) XAllocDisplayColor(display,
319 DefaultColormap(display,
320 DefaultScreen(display)),
321 "white",
322 &p_frg_color, &color_def);
323 else XAllocDisplayColor(display,
324 DefaultColormap(display, DefaultScreen(display)),
325 "black",
326 &p_frg_color, &color_def);
327
328 def_val = x_get_resource_string ("paneBorder", "PaneBorder");
329 if (
330 def_val != NULL &&
331 DisplayCells(display, DefaultScreen(display)) > 2 &&
332 XAllocDisplayColor(display,
333 DefaultColormap(display, DefaultScreen(display)),
334 def_val,
335 &p_bdr_color, &color_def)
336 );
337 else if (reverse &&
338 XAllocDisplayColor(display,
339 DefaultColormap(display, DefaultScreen(display)),
340 "white",
341 &p_bdr_color, &color_def)
342 );
343 else XAllocDisplayColor(display,
344 DefaultColormap(display, DefaultScreen(display)),
345 "black",
346 &p_bdr_color, &color_def);
347
348 def_val = x_get_resource_string ("paneBorderWidth", "PaneBorderWidth");
349 if (def_val != NULL) p_bdr_width = atoi(def_val);
350
351 def_val = x_get_resource_string ("paneSpread", "PaneSpread");
352 if (def_val != NULL) p_spread = atof(def_val);
353
354 def_val = x_get_resource_string ("selectionStyle", "SelectionStyle");
355 if (def_val != NULL) {
356 if (strcmp(def_val, "flush_left") == 0) s_style = LEFT;
357 else if (strcmp(def_val, "flush_right") == 0) s_style = RIGHT;
358 else if (strcmp(def_val, "center") == 0) s_style = CENTER;
359 }
360
361 def_val = x_get_resource_string ("selectionFont", "SelectionFont");
362 if (def_val != NULL) s_fnt_name = def_val;
363
364 def_val = x_get_resource_string ("selectionForeground", "SelectionForeground");
365 if (
366 def_val != NULL &&
367 DisplayCells(display, DefaultScreen(display)) > 2 &&
368 XAllocDisplayColor(display,
369 DefaultColormap(display, DefaultScreen(display)),
370 def_val,
371 &s_frg_color, &color_def)
372 );
373 else if (reverse &&
374 XAllocDisplayColor(display,
375 DefaultColormap(display, DefaultScreen(display)),
376 "white",
377 &s_frg_color, &color_def)
378 ) ;
379 else if (XAllocDisplayColor(display,
380 DefaultColormap(display, DefaultScreen(display)),
381 "black",
382 &s_frg_color, &color_def)
383 ) ;
384 else {}
385
386
387 def_val = x_get_resource_string ("selectionBorder", "SelectionBorder");
388 if (
389 def_val != NULL &&
390 DisplayCells(display, DefaultScreen(display)) > 2 &&
391 XAllocDisplayColor(display,
392 DefaultColormap(display, DefaultScreen(display)),
393 def_val,
394 &s_bdr_color, &color_def)
395 ) ;
396 else if (reverse &&
397 XAllocDisplayColor(display,
398 DefaultColormap(display, DefaultScreen(display)),
399 "white",
400 &s_bdr_color, &color_def)
401 ) ;
402 else if (XAllocDisplayColor(display,
403 DefaultColormap(display, DefaultScreen(display)),
404 "black",
405 &s_bdr_color, &color_def)
406 ) ;
407 else {}
408
409 def_val = x_get_resource_string ("selectionBorderWidth", "SelectionBorderWidth");
410 if (def_val != NULL) s_bdr_width = atoi(def_val);
411
412 def_val = x_get_resource_string ("selectionSpread", "SelectionSpread");
413 if (def_val != NULL) s_spread = atof(def_val);
414
415 /*
416 * Create and store the inactive pattern pixmap.
417 */
418 {
419 char *data = NULL;
420 int width, height;
421
422 switch (inact_pnum)
423 {
424 case 0:
425 data = (char *)dimple1_bits;
426 width = dimple1_width;
427 height = dimple1_height;
428 break;
429
430 case 1:
431 data = (char *)dimple3_bits;
432 width = dimple3_width;
433 height = dimple3_height;
434 break;
435
436 case 2:
437 data = (char *)gray1_bits;
438 width = gray1_width;
439 height = gray1_height;
440 break;
441
442 case 3:
443 data = (char *)gray3_bits;
444 width = gray3_width;
445 height = gray3_height;
446 break;
447
448 case 4:
449 data = (char *)cross_weave_bits;
450 width = cross_weave_width;
451 height = cross_weave_height;
452 break;
453 }
454
455 if (! data)
456 {
457 _XMErrorCode = XME_STORE_BITMAP;
458 return(NULL);
459 }
460
461 inact_bitmap =
462 XCreatePixmapFromBitmapData
463 (display, root, data, width, height,
464 p_frg_color.pixel, bkgnd_color.pixel,
465 DisplayPlanes (display, DefaultScreen (display)));
466 }
467
468 /*
469 * Load the mouse cursor.
470 */
471
472 switch (menu_style) {
473 case LEFT:
474 cursor = XCreateBitmapFromData(display,
475 root,
476 left_ptr_bits,
477 left_ptr_width,
478 left_ptr_height);
479 cursor_mask = XCreateBitmapFromData(display,
480 root,
481 left_ptrmsk_bits,
482 left_ptrmsk_width,
483 left_ptrmsk_height);
484 mouse_cursor = XCreatePixmapCursor(
485 display,
486 cursor, cursor_mask,
487 &mouse_color, &bkgnd_color,
488 left_ptr_x_hot,
489 left_ptr_y_hot
490 );
491 XFreePixmap(display, cursor);
492 XFreePixmap(display, cursor_mask);
493 break;
494 case RIGHT:
495 cursor = XCreateBitmapFromData(display,
496 root,
497 right_ptr_bits,
498 right_ptr_width,
499 right_ptr_height);
500 cursor_mask = XCreateBitmapFromData(display,
501 root,
502 right_ptrmsk_bits,
503 right_ptrmsk_width,
504 right_ptrmsk_height);
505 mouse_cursor = XCreatePixmapCursor(
506 display,
507 cursor, cursor_mask,
508 &mouse_color, &bkgnd_color,
509 right_ptr_x_hot,
510 right_ptr_y_hot
511 );
512 XFreePixmap(display, cursor);
513 XFreePixmap(display, cursor_mask);
514 break;
515 case CENTER:
516 cursor = XCreateBitmapFromData(display,
517 root,
518 cntr_ptr_bits,
519 cntr_ptr_width,
520 cntr_ptr_height);
521 cursor_mask = XCreateBitmapFromData(display,
522 root,
523 cntr_ptrmsk_bits,
524 cntr_ptrmsk_width,
525 cntr_ptrmsk_height);
526 mouse_cursor = XCreatePixmapCursor(
527 display,
528 cursor, cursor_mask,
529 &mouse_color, &bkgnd_color,
530 cntr_ptr_x_hot,
531 cntr_ptr_y_hot
532 );
533 XFreePixmap(display, cursor);
534 XFreePixmap(display, cursor_mask);
535 break;
536 default:
537 /* Error! Invalid style parameter. */
538 _XMErrorCode = XME_STYLE_PARAM;
539 return(NULL);
540 }
541 if (mouse_cursor == _X_FAILURE) {
542 _XMErrorCode = XME_CREATE_CURSOR;
543 return(NULL);
544 }
545
546 /*
547 * Open the pane and selection fonts.
548 */
549
550 p_fnt_info = XLoadQueryFont(display, p_fnt_name);
551 if (p_fnt_info == NULL) {
552 _XMErrorCode = XME_OPEN_FONT;
553 return(NULL);
554
555 }
556
557 s_fnt_info = XLoadQueryFont(display, s_fnt_name);
558 if (s_fnt_info == NULL) {
559 _XMErrorCode = XME_OPEN_FONT;
560 return(NULL);
561 }
562 /*
563 * Calculate the fixed padding value in pixels for each font.
564 */
565 p_fnt_height = p_fnt_info->max_bounds.ascent + p_fnt_info->max_bounds.descent;
566 s_fnt_height = s_fnt_info->max_bounds.ascent + s_fnt_info->max_bounds.descent;
567 p_fnt_pad = s_spread * p_fnt_height;
568 s_fnt_pad = s_spread * s_fnt_height;
569
570 /*
571 * Calculate fixed height and offset requirements.
572 */
573 flag_height = p_fnt_height + (p_fnt_pad << 1);
574
575 p_height = 0;
576 p_y_off = flag_height + p_bdr_width;
577 p_x_off = p_y_off * p_spread;
578
579 s_height = s_fnt_height + (s_fnt_pad << 1) + (s_bdr_width << 1);
580 s_y_off = s_height;
581 s_x_off = p_x_off;
582
583 /*
584 * Set up the pane list header.
585 */
586 pane->next = pane;
587 pane->prev = pane;
588 pane->type = PL_HEADER;
589 pane->serial = -1;
590
591 /*
592 * Initialize the internal pane and selection creation queues.
593 */
594 _XMWinQueInit();
595
596 /*
597 * Create pane, active, and inactive GC's.
598 */
599 values = (XGCValues *)malloc(sizeof(XGCValues));
600 valuemask = (GCForeground | GCBackground | GCFont | GCLineWidth);
601
602 /*
603 * First, pane.
604 */
605
606 values->foreground = p_frg_color.pixel;
607 values->background = bkgnd_color.pixel;
608 values->font = p_fnt_info->fid;
609 values->line_width = p_bdr_width;
610
611 pane_GC = XCreateGC(
612 display,
613 root,
614 valuemask,
615 values);
616 /*
617 * Then normal video selection.
618 */
619
620 values->foreground = s_frg_color.pixel;
621 values->background = bkgnd_color.pixel;
622 values->font = s_fnt_info->fid;
623 values->line_width = s_bdr_width;
624 normal_select_GC = XCreateGC(display,
625 root,
626 valuemask,
627 values);
628 /*
629 * Inverse video selection.
630 */
631
632 values->foreground = bkgnd_color.pixel;
633 values->background = s_frg_color.pixel;
634 values->font = s_fnt_info->fid;
635 values->line_width = s_bdr_width;
636 inverse_select_GC = XCreateGC(display,
637 root,
638 valuemask,
639 values);
640 stipple_pixmap = XCreateBitmapFromData(display,
641 root,
642 stipple_bits,
643 stipple_width,
644 stipple_height);
645
646 /*
647 * Finally, inactive pane header and selections
648 */
649 valuemask |= (GCFillStyle | GCStipple);
650 values->foreground = s_frg_color.pixel;
651 values->background = bkgnd_color.pixel;
652 values->font = s_fnt_info->fid;
653 values->line_width = s_bdr_width;
654 values->fill_style = FillStippled;
655 values->stipple = stipple_pixmap;
656
657 inact_GC = XCreateGC(display,
658 root,
659 valuemask,
660 values);
661
662 valuemask |= (GCGraphicsExposures);
663 values->graphics_exposures = False;
664
665
666 /*
667 * Construct the XMenu object.
668 */
669 /* -------------------- Menu data -------------------- */
670 menu->menu_style = menu_style;
671 menu->menu_mode = menu_mode;
672 menu->freeze = freeze;
673 menu->aeq = 0;
674 menu->recompute = 1;
675 menu->parent = parent;
676 menu->height = 0;
677 menu->width = 0;
678 menu->mouse_cursor = mouse_cursor;
679 menu->assoc_tab = assoc_tab;
680 menu->p_list = pane;
681 /* -------------------- Pane window data -------------------- */
682 menu->p_style = p_style;
683 menu->p_events = DEF_P_EVENTS;
684 menu->p_fnt_info = p_fnt_info;
685 menu->p_fnt_pad = p_fnt_pad;
686 menu->p_spread = p_spread;
687 menu->p_bdr_width = p_bdr_width;
688 menu->flag_height = flag_height;
689 menu->p_width = 0;
690 menu->p_height = p_height;
691 menu->p_x_off = p_x_off;
692 menu->p_y_off = p_y_off;
693 menu->p_count = 0;
694 menu->pane_GC = pane_GC;
695 menu->x_pos = 0;
696 menu->y_pos = 0;
697 /* -------------------- Selection window data -------------------- */
698 menu->s_style = s_style;
699 menu->s_events = DEF_S_EVENTS;
700 menu->s_fnt_info = s_fnt_info;
701 menu->s_fnt_pad = s_fnt_pad;
702 menu->s_spread = s_spread;
703 menu->s_bdr_width = s_bdr_width; /* unnecessary */
704 menu->s_width = 0;
705 menu->s_height = s_height;
706 menu->s_x_off = s_x_off;
707 menu->s_y_off = s_y_off;
708 menu->s_count = 0;
709 menu->normal_select_GC = normal_select_GC;
710 menu->inverse_select_GC = inverse_select_GC;
711 menu->inact_GC = inact_GC;
712 /* -------------------- Color data -------------------- */
713 menu->p_bdr_color = p_bdr_color.pixel;
714 menu->s_bdr_color = s_bdr_color.pixel;
715 menu->p_frg_color = p_frg_color.pixel;
716 menu->s_frg_color = s_frg_color.pixel;
717 menu->bkgnd_color = bkgnd_color.pixel;
718 /* -------------------- Pixmap data -------------------- */
719 menu->p_bdr_pixmap = None;
720 menu->s_bdr_pixmap = None;
721 menu->p_frg_pixmap = None;
722 menu->s_frg_pixmap = None;
723 menu->bkgnd_pixmap = None;
724 menu->inact_pixmap = inact_bitmap;
725
726 /*
727 * Return the completed XMenu.
728 */
729 _XMErrorCode = XME_NO_ERROR;
730 return(menu);
731 }