1 /* $XConsortium: SmeBSB.c,v 1.19 94/04/17 20:12:49 kaleb Exp $ */
4 Copyright (c) 1989, 1994 X Consortium
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 Except as contained in this notice, the name of the X Consortium shall not be
24 used in advertising or otherwise to promote the sale, use or other dealings
25 in this Software without prior written authorization from the X Consortium.
29 * SmeBSB.c - Source code file for BSB Menu Entry object.
31 * Date: September 26, 1989
33 * By: Chris D. Peterson
35 * kit@expo.lcs.mit.edu
38 #include <X11/IntrinsicP.h>
39 #include <X11/StringDefs.h>
42 /* needed for abs() */
53 #include <X11/Xmu/Drawing.h>
55 #include <X11/Xaw/XawInit.h>
56 #include <X11/Xaw/SimpleMenu.h>
57 #include <X11/Xaw/SmeBSBP.h>
58 #include <X11/Xaw/Cardinals.h>
62 #define ONE_HUNDRED 100
64 #define offset(field) XtOffsetOf(SmeBSBRec, sme_bsb.field)
66 static XtResource resources
[] = {
67 {XtNlabel
, XtCLabel
, XtRString
, sizeof(String
),
68 offset(label
), XtRString
, NULL
},
69 {XtNvertSpace
, XtCVertSpace
, XtRInt
, sizeof(int),
70 offset(vert_space
), XtRImmediate
, (XtPointer
) 25},
71 {XtNleftBitmap
, XtCLeftBitmap
, XtRBitmap
, sizeof(Pixmap
),
72 offset(left_bitmap
), XtRImmediate
, (XtPointer
)None
},
73 {XtNjustify
, XtCJustify
, XtRJustify
, sizeof(XtJustify
),
74 offset(justify
), XtRImmediate
, (XtPointer
) XtJustifyLeft
},
75 {XtNrightBitmap
, XtCRightBitmap
, XtRBitmap
, sizeof(Pixmap
),
76 offset(right_bitmap
), XtRImmediate
, (XtPointer
)None
},
77 {XtNleftMargin
, XtCHorizontalMargins
, XtRDimension
, sizeof(Dimension
),
78 offset(left_margin
), XtRImmediate
, (XtPointer
) 4},
79 {XtNrightMargin
, XtCHorizontalMargins
, XtRDimension
, sizeof(Dimension
),
80 offset(right_margin
), XtRImmediate
, (XtPointer
) 4},
81 {XtNforeground
, XtCForeground
, XtRPixel
, sizeof(Pixel
),
82 offset(foreground
), XtRString
, XtDefaultForeground
},
83 {XtNfont
, XtCFont
, XtRFontStruct
, sizeof(XFontStruct
*),
84 offset(font
), XtRString
, XtDefaultFont
},
85 {XtNfontSet
, XtCFontSet
, XtRFontSet
, sizeof(XFontSet
),
86 offset(fontset
),XtRString
, XtDefaultFontSet
},
91 * Semi Public function definitions.
94 static void Redisplay(), Destroy(), Initialize(), FlipColors();
95 static void ClassInitialize();
96 static Boolean
SetValues();
97 static XtGeometryResult
QueryGeometry();
100 * Private Function Definitions.
103 static void GetDefaultSize(), DrawBitmaps(), GetBitmapInfo();
104 static void CreateGCs(), DestroyGCs();
106 #define superclass (&smeClassRec)
107 SmeBSBClassRec smeBSBClassRec
= {
109 /* superclass */ (WidgetClass
) superclass
,
110 /* class_name */ "SmeBSB",
111 /* size */ sizeof(SmeBSBRec
),
112 /* class_initializer */ ClassInitialize
,
113 /* class_part_initialize*/ NULL
,
114 /* Class init'ed */ FALSE
,
115 /* initialize */ Initialize
,
116 /* initialize_hook */ NULL
,
119 /* num_actions */ ZERO
,
120 /* resources */ resources
,
121 /* resource_count */ XtNumber(resources
),
122 /* xrm_class */ NULLQUARK
,
123 /* compress_motion */ FALSE
,
124 /* compress_exposure */ FALSE
,
125 /* compress_enterleave*/ FALSE
,
126 /* visible_interest */ FALSE
,
127 /* destroy */ Destroy
,
129 /* expose */ Redisplay
,
130 /* set_values */ SetValues
,
131 /* set_values_hook */ NULL
,
132 /* set_values_almost */ XtInheritSetValuesAlmost
,
133 /* get_values_hook */ NULL
,
134 /* accept_focus */ NULL
,
135 /* intrinsics version */ XtVersion
,
136 /* callback offsets */ NULL
,
138 /* query_geometry */ QueryGeometry
,
139 /* display_accelerator*/ NULL
,
142 /* SimpleMenuClass Fields */
143 /* highlight */ FlipColors
,
144 /* unhighlight */ FlipColors
,
145 /* notify */ XtInheritNotify
,
148 /* BSBClass Fields */
153 WidgetClass smeBSBObjectClass
= (WidgetClass
) &smeBSBClassRec
;
155 /************************************************************
157 * Semi-Public Functions.
159 ************************************************************/
161 /* Function Name: ClassInitialize
162 * Description: Initializes the SmeBSBObject.
170 XawInitializeWidgetSet();
171 XtAddConverter( XtRString
, XtRJustify
, XmuCvtStringToJustify
,
172 (XtConvertArgList
)NULL
, (Cardinal
)0 );
175 /* Function Name: Initialize
176 * Description: Initializes the simple menu widget
177 * Arguments: request - the widget requested by the argument list.
178 * new - the new widget with both resource and non
185 Initialize(request
, new, args
, num_args
)
190 SmeBSBObject entry
= (SmeBSBObject
) new;
192 if (entry
->sme_bsb
.label
== NULL
)
193 entry
->sme_bsb
.label
= XtName(new);
195 entry
->sme_bsb
.label
= XtNewString( entry
->sme_bsb
.label
);
197 GetDefaultSize(new, &(entry
->rectangle
.width
), &(entry
->rectangle
.height
));
200 entry
->sme_bsb
.left_bitmap_width
= entry
->sme_bsb
.left_bitmap_height
= 0;
201 entry
->sme_bsb
.right_bitmap_width
= entry
->sme_bsb
.right_bitmap_height
= 0;
203 GetBitmapInfo(new, TRUE
); /* Left Bitmap Info */
204 GetBitmapInfo(new, FALSE
); /* Right Bitmap Info */
207 /* Function Name: Destroy
208 * Description: Called at destroy time, cleans up.
209 * Arguments: w - the simple menu widget.
217 SmeBSBObject entry
= (SmeBSBObject
) w
;
220 if (entry
->sme_bsb
.label
!= XtName(w
))
221 XtFree(entry
->sme_bsb
.label
);
224 /* Function Name: Redisplay
225 * Description: Redisplays the contents of the widget.
226 * Arguments: w - the simple menu widget.
227 * event - the X event that caused this redisplay.
228 * region - the region the needs to be repainted.
234 Redisplay(w
, event
, region
)
240 SmeBSBObject entry
= (SmeBSBObject
) w
;
241 int font_ascent
, font_descent
, y_loc
;
243 int fontset_ascent
, fontset_descent
;
244 XFontSetExtents
*ext
= XExtentsOfFontSet(entry
->sme_bsb
.fontset
);
246 entry
->sme_bsb
.set_values_area_cleared
= FALSE
;
247 if ( entry
->sme
.international
== True
) {
248 fontset_ascent
= abs(ext
->max_ink_extent
.y
);
249 fontset_descent
= ext
->max_ink_extent
.height
- fontset_ascent
;
251 else { /*else, compute size from font like R5*/
252 font_ascent
= entry
->sme_bsb
.font
->max_bounds
.ascent
;
253 font_descent
= entry
->sme_bsb
.font
->max_bounds
.descent
;
255 y_loc
= entry
->rectangle
.y
;
258 if (XtIsSensitive(w
) && XtIsSensitive( XtParent(w
) ) ) {
259 if ( w
== XawSimpleMenuGetActiveEntry(XtParent(w
)) ) {
260 XFillRectangle(XtDisplayOfObject(w
), XtWindowOfObject(w
),
261 entry
->sme_bsb
.norm_gc
, 0, y_loc
,
262 (unsigned int) entry
->rectangle
.width
,
263 (unsigned int) entry
->rectangle
.height
);
264 gc
= entry
->sme_bsb
.rev_gc
;
267 gc
= entry
->sme_bsb
.norm_gc
;
270 gc
= entry
->sme_bsb
.norm_gray_gc
;
272 if (entry
->sme_bsb
.label
!= NULL
) {
273 int x_loc
= entry
->sme_bsb
.left_margin
;
274 int len
= strlen(entry
->sme_bsb
.label
);
275 char * label
= entry
->sme_bsb
.label
;
277 switch(entry
->sme_bsb
.justify
) {
280 case XtJustifyCenter
:
281 if ( entry
->sme
.international
== True
) {
282 t_width
= XmbTextEscapement(entry
->sme_bsb
.fontset
,label
,len
);
283 width
= entry
->rectangle
.width
- (entry
->sme_bsb
.left_margin
+
284 entry
->sme_bsb
.right_margin
);
287 t_width
= XTextWidth(entry
->sme_bsb
.font
, label
, len
);
288 width
= entry
->rectangle
.width
- (entry
->sme_bsb
.left_margin
+
289 entry
->sme_bsb
.right_margin
);
291 x_loc
+= (width
- t_width
)/2;
294 if ( entry
->sme
.international
== True
) {
295 t_width
= XmbTextEscapement(entry
->sme_bsb
.fontset
,label
,len
);
296 x_loc
= entry
->rectangle
.width
- ( entry
->sme_bsb
.right_margin
300 t_width
= XTextWidth(entry
->sme_bsb
.font
, label
, len
);
301 x_loc
= entry
->rectangle
.width
- ( entry
->sme_bsb
.right_margin
311 /* this will center the text in the gadget top-to-bottom */
313 if ( entry
->sme
.international
==True
) {
314 y_loc
+= ((int)entry
->rectangle
.height
-
315 (fontset_ascent
+ fontset_descent
)) / 2 + fontset_ascent
;
317 XmbDrawString(XtDisplayOfObject(w
), XtWindowOfObject(w
),
318 entry
->sme_bsb
.fontset
, gc
, x_loc
, y_loc
, label
, len
);
321 y_loc
+= ((int)entry
->rectangle
.height
-
322 (font_ascent
+ font_descent
)) / 2 + font_ascent
;
324 XDrawString(XtDisplayOfObject(w
), XtWindowOfObject(w
), gc
,
325 x_loc
, y_loc
, label
, len
);
333 /* Function Name: SetValues
334 * Description: Relayout the menu when one of the resources is changed.
335 * Arguments: current - current state of the widget.
336 * request - what was requested.
337 * new - what the widget will become.
343 SetValues(current
, request
, new, args
, num_args
)
344 Widget current
, request
, new;
348 SmeBSBObject entry
= (SmeBSBObject
) new;
349 SmeBSBObject old_entry
= (SmeBSBObject
) current
;
350 Boolean ret_val
= FALSE
;
352 if (old_entry
->sme_bsb
.label
!= entry
->sme_bsb
.label
) {
353 if (old_entry
->sme_bsb
.label
!= XtName( new ) )
354 XtFree( (char *) old_entry
->sme_bsb
.label
);
356 if (entry
->sme_bsb
.label
!= XtName(new) )
357 entry
->sme_bsb
.label
= XtNewString( entry
->sme_bsb
.label
);
362 if (entry
->rectangle
.sensitive
!= old_entry
->rectangle
.sensitive
)
365 if (entry
->sme_bsb
.left_bitmap
!= old_entry
->sme_bsb
.left_bitmap
) {
366 GetBitmapInfo(new, TRUE
);
370 if (entry
->sme_bsb
.right_bitmap
!= old_entry
->sme_bsb
.right_bitmap
) {
371 GetBitmapInfo(new, FALSE
);
375 if ( ( (old_entry
->sme_bsb
.font
!= entry
->sme_bsb
.font
) &&
376 (old_entry
->sme
.international
== False
) ) ||
377 (old_entry
->sme_bsb
.foreground
!= entry
->sme_bsb
.foreground
) ) {
383 if ( ( old_entry
->sme_bsb
.fontset
!= entry
->sme_bsb
.fontset
) &&
384 (old_entry
->sme
.international
== True
) )
385 /* DONT changes the GCs, because the fontset is not in them. */
390 &(entry
->rectangle
.width
), &(entry
->rectangle
.height
));
391 entry
->sme_bsb
.set_values_area_cleared
= TRUE
;
396 /* Function Name: QueryGeometry.
397 * Description: Returns the preferred geometry for this widget.
398 * Arguments: w - the menu entry object.
399 * itended, return_val - the intended and return geometry info.
400 * Returns: A Geometry Result.
402 * See the Intrinsics manual for details on what this function is for.
404 * I just return the height and width of the label plus the margins.
407 static XtGeometryResult
408 QueryGeometry(w
, intended
, return_val
)
410 XtWidgetGeometry
*intended
, *return_val
;
412 SmeBSBObject entry
= (SmeBSBObject
) w
;
413 Dimension width
, height
;
414 XtGeometryResult ret_val
= XtGeometryYes
;
415 XtGeometryMask mode
= intended
->request_mode
;
417 GetDefaultSize(w
, &width
, &height
);
419 if ( ((mode
& CWWidth
) && (intended
->width
!= width
)) ||
420 !(mode
& CWWidth
) ) {
421 return_val
->request_mode
|= CWWidth
;
422 return_val
->width
= width
;
423 ret_val
= XtGeometryAlmost
;
426 if ( ((mode
& CWHeight
) && (intended
->height
!= height
)) ||
427 !(mode
& CWHeight
) ) {
428 return_val
->request_mode
|= CWHeight
;
429 return_val
->height
= height
;
430 ret_val
= XtGeometryAlmost
;
433 if (ret_val
== XtGeometryAlmost
) {
434 mode
= return_val
->request_mode
;
436 if ( ((mode
& CWWidth
) && (width
== entry
->rectangle
.width
)) &&
437 ((mode
& CWHeight
) && (height
== entry
->rectangle
.height
)) )
438 return(XtGeometryNo
);
444 /* Function Name: FlipColors
445 * Description: Invert the colors of the current entry.
446 * Arguments: w - the bsb menu entry widget.
454 SmeBSBObject entry
= (SmeBSBObject
) w
;
455 SmeBSBObjectClass oclass
= (SmeBSBObjectClass
) XtClass (w
);
457 if (entry
->sme_bsb
.set_values_area_cleared
) {
461 XFillRectangle(XtDisplayOfObject(w
), XtWindowOfObject(w
),
462 entry
->sme_bsb
.invert_gc
,
463 0, (int) entry
->rectangle
.y
,
464 (unsigned int) entry
->rectangle
.width
,
465 (unsigned int) entry
->rectangle
.height
);
468 /************************************************************
472 ************************************************************/
474 /* Function Name: GetDefaultSize
475 * Description: Calculates the Default (preferred) size of
477 * Arguments: w - the menu entry widget.
478 * width, height - default sizes (RETURNED).
483 GetDefaultSize(w
, width
, height
)
485 Dimension
* width
, * height
;
487 SmeBSBObject entry
= (SmeBSBObject
) w
;
489 if ( entry
->sme
.international
== True
) {
490 XFontSetExtents
*ext
= XExtentsOfFontSet(entry
->sme_bsb
.fontset
);
491 if (entry
->sme_bsb
.label
== NULL
)
494 *width
= XmbTextEscapement(entry
->sme_bsb
.fontset
, entry
->sme_bsb
.label
,
495 strlen(entry
->sme_bsb
.label
));
496 *width
+= entry
->sme_bsb
.left_margin
+ entry
->sme_bsb
.right_margin
;
497 *height
= ext
->max_ink_extent
.height
;
498 *height
= ((int)*height
* ( ONE_HUNDRED
+
499 entry
->sme_bsb
.vert_space
)) / ONE_HUNDRED
;
502 if (entry
->sme_bsb
.label
== NULL
)
505 *width
= XTextWidth(entry
->sme_bsb
.font
, entry
->sme_bsb
.label
,
506 strlen(entry
->sme_bsb
.label
));
508 *width
+= entry
->sme_bsb
.left_margin
+ entry
->sme_bsb
.right_margin
;
510 *height
= (entry
->sme_bsb
.font
->max_bounds
.ascent
+
511 entry
->sme_bsb
.font
->max_bounds
.descent
);
513 *height
= ((int)*height
* ( ONE_HUNDRED
+
514 entry
->sme_bsb
.vert_space
)) / ONE_HUNDRED
;
518 /* Function Name: DrawBitmaps
519 * Description: Draws left and right bitmaps.
520 * Arguments: w - the simple menu widget.
521 * gc - graphics context to use for drawing.
531 SmeBSBObject entry
= (SmeBSBObject
) w
;
533 if ( (entry
->sme_bsb
.left_bitmap
== None
) &&
534 (entry
->sme_bsb
.right_bitmap
== None
) ) return;
540 if (entry
->sme_bsb
.left_bitmap
!= None
) {
541 x_loc
= (int)(entry
->sme_bsb
.left_margin
-
542 entry
->sme_bsb
.left_bitmap_width
) / 2;
544 y_loc
= entry
->rectangle
.y
+
545 (int)(entry
->rectangle
.height
-
546 entry
->sme_bsb
.left_bitmap_height
) / 2;
548 XCopyPlane(XtDisplayOfObject(w
), entry
->sme_bsb
.left_bitmap
,
549 XtWindowOfObject(w
), gc
, 0, 0,
550 entry
->sme_bsb
.left_bitmap_width
,
551 entry
->sme_bsb
.left_bitmap_height
, x_loc
, y_loc
, 1);
559 if (entry
->sme_bsb
.right_bitmap
!= None
) {
560 x_loc
= entry
->rectangle
.width
-
561 (int)(entry
->sme_bsb
.right_margin
+
562 entry
->sme_bsb
.right_bitmap_width
) / 2;
564 y_loc
= entry
->rectangle
.y
+
565 (int)(entry
->rectangle
.height
-
566 entry
->sme_bsb
.right_bitmap_height
) / 2;
568 XCopyPlane(XtDisplayOfObject(w
), entry
->sme_bsb
.right_bitmap
,
569 XtWindowOfObject(w
), gc
, 0, 0,
570 entry
->sme_bsb
.right_bitmap_width
,
571 entry
->sme_bsb
.right_bitmap_height
, x_loc
, y_loc
, 1);
575 /* Function Name: GetBitmapInfo
576 * Description: Gets the bitmap information from either of the bitmaps.
577 * Arguments: w - the bsb menu entry widget.
578 * is_left - TRUE if we are testing left bitmap,
579 * FALSE if we are testing the right bitmap.
584 GetBitmapInfo(w
, is_left
)
588 SmeBSBObject entry
= (SmeBSBObject
) w
;
589 unsigned int depth
, bw
;
592 unsigned int width
, height
;
596 char* fmt1
= "%s Could not get %s Bitmap geometry information for menu entry \"%s\"";
597 char* def1
= "%s Could not get Bitmap geometry information for menu entry";
598 char* fmt2
= "%s %s Bitmap of entry \"%s\" is not one bit deep";
599 char* def2
= "%s Bitmap of entry is not one bit deep";
601 char* Right
= "Right";
602 char* smeobj
= "Xaw SmeBSB Object:";
605 if (entry
->sme_bsb
.left_bitmap
!= None
) {
606 if (!XGetGeometry(XtDisplayOfObject(w
),
607 entry
->sme_bsb
.left_bitmap
, &root
,
608 &x
, &y
, &width
, &height
, &bw
, &depth
)) {
609 if ((len
= strlen (fmt1
) + strlen (smeobj
) + strlen (Left
) + strlen (XtName (w
))) < sizeof buf
)
612 bufp
= XtMalloc (len
+ 1);
615 (void) sprintf (bufp
, def1
, smeobj
);
617 (void) sprintf(bufp
, fmt1
, smeobj
, Left
, XtName(w
));
618 XtAppError(XtWidgetToApplicationContext(w
), bufp
);
619 if (bufp
!= buf
) XtFree (bufp
);
622 if ((len
= strlen (fmt2
) + strlen (smeobj
) + strlen (Left
) + strlen (XtName (w
))) < sizeof buf
)
625 bufp
= XtMalloc (len
+ 1);
628 (void) sprintf (bufp
, def2
, smeobj
);
630 (void) sprintf(buf
, fmt2
, smeobj
, Left
, XtName(w
));
631 XtAppError(XtWidgetToApplicationContext(w
), buf
);
632 if (bufp
!= buf
) XtFree (bufp
);
634 entry
->sme_bsb
.left_bitmap_width
= (Dimension
) width
;
635 entry
->sme_bsb
.left_bitmap_height
= (Dimension
) height
;
638 else if (entry
->sme_bsb
.right_bitmap
!= None
) {
639 if (!XGetGeometry(XtDisplayOfObject(w
),
640 entry
->sme_bsb
.right_bitmap
, &root
,
641 &x
, &y
, &width
, &height
, &bw
, &depth
)) {
642 if ((len
= strlen (fmt1
) + strlen (smeobj
) + strlen (Right
) + strlen (XtName (w
))) < sizeof buf
)
645 bufp
= XtMalloc (len
+ 1);
648 (void) sprintf (bufp
, def1
, smeobj
);
650 (void) sprintf(bufp
, fmt1
, smeobj
, Right
, XtName(w
));
651 XtAppError(XtWidgetToApplicationContext(w
), bufp
);
652 if (bufp
!= buf
) XtFree (bufp
);
655 if ((len
= strlen (fmt2
) + strlen (smeobj
) + strlen (Right
) + strlen (XtName (w
))) < sizeof buf
)
658 bufp
= XtMalloc (len
+ 1);
661 (void) sprintf (bufp
, def2
, smeobj
);
663 (void) sprintf(buf
, fmt2
, smeobj
, Right
, XtName(w
));
664 XtAppError(XtWidgetToApplicationContext(w
), buf
);
665 if (bufp
!= buf
) XtFree (bufp
);
667 entry
->sme_bsb
.right_bitmap_width
= (Dimension
) width
;
668 entry
->sme_bsb
.right_bitmap_height
= (Dimension
) height
;
672 /* Function Name: CreateGCs
673 * Description: Creates all gc's for the simple menu widget.
674 * Arguments: w - the simple menu widget.
682 SmeBSBObject entry
= (SmeBSBObject
) w
;
684 XtGCMask mask
, mask_i18n
;
686 values
.foreground
= XtParent(w
)->core
.background_pixel
;
687 values
.background
= entry
->sme_bsb
.foreground
;
688 values
.font
= entry
->sme_bsb
.font
->fid
;
689 values
.graphics_exposures
= FALSE
;
690 mask
= GCForeground
| GCBackground
| GCGraphicsExposures
| GCFont
;
691 mask_i18n
= GCForeground
| GCBackground
| GCGraphicsExposures
;
692 if ( entry
->sme
.international
== True
)
693 entry
->sme_bsb
.rev_gc
= XtAllocateGC(w
, 0, mask_i18n
, &values
, GCFont
, 0 );
695 entry
->sme_bsb
.rev_gc
= XtGetGC(w
, mask
, &values
);
697 values
.foreground
= entry
->sme_bsb
.foreground
;
698 values
.background
= XtParent(w
)->core
.background_pixel
;
699 if ( entry
->sme
.international
== True
)
700 entry
->sme_bsb
.norm_gc
= XtAllocateGC(w
, 0, mask_i18n
, &values
, GCFont
, 0 );
702 entry
->sme_bsb
.norm_gc
= XtGetGC(w
, mask
, &values
);
704 values
.fill_style
= FillTiled
;
705 values
.tile
= XmuCreateStippledPixmap(XtScreenOfObject(w
),
706 entry
->sme_bsb
.foreground
,
707 XtParent(w
)->core
.background_pixel
,
708 XtParent(w
)->core
.depth
);
709 values
.graphics_exposures
= FALSE
;
710 mask
|= GCTile
| GCFillStyle
;
711 mask_i18n
|= GCTile
| GCFillStyle
;
712 if ( entry
->sme
.international
== True
)
713 entry
->sme_bsb
.norm_gray_gc
= XtAllocateGC(w
, 0, mask_i18n
, &values
, GCFont
, 0 );
715 entry
->sme_bsb
.norm_gray_gc
= XtGetGC(w
, mask
, &values
);
717 values
.foreground
^= values
.background
;
718 values
.background
= 0;
719 values
.function
= GXxor
;
720 mask
= GCForeground
| GCBackground
| GCGraphicsExposures
| GCFunction
;
721 entry
->sme_bsb
.invert_gc
= XtGetGC(w
, mask
, &values
);
724 /* Function Name: DestroyGCs
725 * Description: Removes all gc's for the simple menu widget.
726 * Arguments: w - the simple menu widget.
734 SmeBSBObject entry
= (SmeBSBObject
) w
;
736 XtReleaseGC(w
, entry
->sme_bsb
.norm_gc
);
737 XtReleaseGC(w
, entry
->sme_bsb
.norm_gray_gc
);
738 XtReleaseGC(w
, entry
->sme_bsb
.rev_gc
);
739 XtReleaseGC(w
, entry
->sme_bsb
.invert_gc
);
745 * The apollo compiler that we have optomizes out my code for
746 * FlipColors() since it is static. and no one executes it in this
747 * file. I am setting the function pointer into the class structure so
748 * that it can be called by my parent who will tell me to when to
749 * highlight and unhighlight.
752 void _XawSmeBSBApolloHack ()