Xaw3_1SmeBSB.c revision 749
749N/A#if ( !defined(lint) && !defined(SABER) )
749N/Astatic char Xrcsid[] = "$XConsortium: SmeBSB.c,v 1.12 90/02/15 13:57:53 kit Exp $";
749N/A#endif
749N/A
749N/A/*
749N/A * Copyright 1989 Massachusetts Institute of Technology
749N/A *
749N/A * Permission to use, copy, modify, distribute, and sell this software and its
749N/A * documentation for any purpose is hereby granted without fee, provided that
749N/A * the above copyright notice appear in all copies and that both that
749N/A * copyright notice and this permission notice appear in supporting
749N/A * documentation, and that the name of M.I.T. not be used in advertising or
749N/A * publicity pertaining to distribution of the software without specific,
749N/A * written prior permission. M.I.T. makes no representations about the
749N/A * suitability of this software for any purpose. It is provided "as is"
749N/A * without express or implied warranty.
749N/A *
749N/A * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
749N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
749N/A * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
749N/A * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
749N/A * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
749N/A * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
749N/A */
749N/A
749N/A/*
749N/A * SmeBSB.c - Source code file for BSB Menu Entry object.
749N/A *
749N/A * Date: September 26, 1989
749N/A *
749N/A * By: Chris D. Peterson
749N/A * MIT X Consortium
749N/A * kit@expo.lcs.mit.edu
749N/A */
749N/A
749N/A#include <stdio.h>
749N/A#include <X11/IntrinsicP.h>
749N/A#include <X11/StringDefs.h>
749N/A
749N/A#include <X11/Xmu/Drawing.h>
749N/A
749N/A#include <./Xaw3_1XawInit.h>
749N/A#include <./Xaw3_1SimpleMenu.h>
749N/A#include <./Xaw3_1SmeBSBP.h>
749N/A#include <./Xaw3_1Cardinals.h>
749N/A
749N/A#define ONE_HUNDRED 100
749N/A
749N/A#define offset(field) XtOffset(SmeBSBObject, sme_bsb.field)
749N/A
749N/Astatic XtResource resources[] = {
749N/A {XtNlabel, XtCLabel, XtRString, sizeof(String),
749N/A offset(label), XtRString, NULL},
749N/A {XtNvertSpace, XtCVertSpace, XtRInt, sizeof(int),
749N/A offset(vert_space), XtRImmediate, (caddr_t) 25},
749N/A {XtNleftBitmap, XtCLeftBitmap, XtRBitmap, sizeof(Pixmap),
749N/A offset(left_bitmap), XtRImmediate, (caddr_t)None},
749N/A {XtNjustify, XtCJustify, XtRJustify, sizeof(XtJustify),
749N/A offset(justify), XtRImmediate, (caddr_t) XtJustifyLeft},
749N/A {XtNrightBitmap, XtCRightBitmap, XtRBitmap, sizeof(Pixmap),
749N/A offset(right_bitmap), XtRImmediate, (caddr_t)None},
749N/A {XtNleftMargin, XtCHorizontalMargins, XtRDimension, sizeof(Dimension),
749N/A offset(left_margin), XtRImmediate, (caddr_t) 4},
749N/A {XtNrightMargin, XtCHorizontalMargins, XtRDimension, sizeof(Dimension),
749N/A offset(right_margin), XtRImmediate, (caddr_t) 4},
749N/A {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
749N/A offset(foreground), XtRString, "XtDefaultForeground"},
749N/A {XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
749N/A offset(font), XtRString, "XtDefaultFont"},
749N/A};
749N/A#undef offset
749N/A
749N/A/*
749N/A * Semi Public function definitions.
749N/A */
749N/A
749N/Astatic void Redisplay(), Destroy(), Initialize(), FlipColors();
749N/Astatic void ClassInitialize();
749N/Astatic Boolean SetValues();
749N/Astatic XtGeometryResult QueryGeometry();
749N/A
749N/A/*
749N/A * Private Function Definitions.
749N/A */
749N/A
749N/Astatic void GetDefaultSize(), DrawBitmaps(), GetBitmapInfo();
749N/Astatic void CreateGCs(), DestroyGCs();
749N/A
749N/A#define superclass (&smeClassRec)
749N/ASmeBSBClassRec smeBSBClassRec = {
749N/A {
749N/A /* superclass */ (WidgetClass) superclass,
749N/A /* class_name */ "SmeBSB",
749N/A /* size */ sizeof(SmeBSBRec),
749N/A /* class_initializer */ ClassInitialize,
749N/A /* class_part_initialize*/ NULL,
749N/A /* Class init'ed */ FALSE,
749N/A /* initialize */ Initialize,
749N/A /* initialize_hook */ NULL,
749N/A /* realize */ NULL,
749N/A /* actions */ NULL,
749N/A /* num_actions */ ZERO,
749N/A /* resources */ resources,
749N/A /* resource_count */ XtNumber(resources),
749N/A /* xrm_class */ NULLQUARK,
749N/A /* compress_motion */ FALSE,
749N/A /* compress_exposure */ FALSE,
749N/A /* compress_enterleave*/ FALSE,
749N/A /* visible_interest */ FALSE,
749N/A /* destroy */ Destroy,
749N/A /* resize */ NULL,
749N/A /* expose */ Redisplay,
749N/A /* set_values */ SetValues,
749N/A /* set_values_hook */ NULL,
749N/A /* set_values_almost */ XtInheritSetValuesAlmost,
749N/A /* get_values_hook */ NULL,
749N/A /* accept_focus */ NULL,
749N/A /* intrinsics version */ XtVersion,
749N/A /* callback offsets */ NULL,
749N/A /* tm_table */ NULL,
749N/A /* query_geometry */ QueryGeometry,
749N/A /* display_accelerator*/ NULL,
749N/A /* extension */ NULL
749N/A },{
749N/A /* Menu Entry Fields */
749N/A
749N/A /* highlight */ FlipColors,
749N/A /* unhighlight */ FlipColors,
749N/A /* notify */ XtInheritNotify,
749N/A /* extension */ NULL
749N/A }, {
749N/A /* BSB Menu entry Fields */
749N/A
749N/A /* extension */ NULL
749N/A }
749N/A};
749N/A
749N/AWidgetClass smeBSBObjectClass = (WidgetClass) &smeBSBClassRec;
749N/A
749N/A/************************************************************
749N/A *
749N/A * Semi-Public Functions.
749N/A *
749N/A ************************************************************/
749N/A
749N/A/* Function Name: ClassInitialize
749N/A * Description: Initializes the SmeBSBObject.
749N/A * Arguments: none.
749N/A * Returns: none.
749N/A */
749N/A
749N/Astatic void
749N/AClassInitialize()
749N/A{
749N/A XawInitializeWidgetSet();
749N/A XtAddConverter( XtRString, XtRJustify, XmuCvtStringToJustify, NULL, 0 );
749N/A}
749N/A
749N/A/* Function Name: Initialize
749N/A * Description: Initializes the simple menu widget
749N/A * Arguments: request - the widget requested by the argument list.
749N/A * new - the new widget with both resource and non
749N/A * resource values.
749N/A * Returns: none.
749N/A */
749N/A
749N/A/* ARGSUSED */
749N/Astatic void
749N/AInitialize(request, new)
749N/AWidget request, new;
749N/A{
749N/A SmeBSBObject entry = (SmeBSBObject) new;
749N/A
749N/A if (entry->sme_bsb.label == NULL)
749N/A entry->sme_bsb.label = XtName(new);
749N/A else
749N/A entry->sme_bsb.label = XtNewString( entry->sme_bsb.label );
749N/A
749N/A GetDefaultSize(new, &(entry->rectangle.width), &(entry->rectangle.height));
749N/A CreateGCs(new);
749N/A
749N/A entry->sme_bsb.left_bitmap_width = entry->sme_bsb.left_bitmap_height = 0;
749N/A entry->sme_bsb.right_bitmap_width = entry->sme_bsb.right_bitmap_height = 0;
749N/A
749N/A GetBitmapInfo(new, TRUE); /* Left Bitmap Info */
749N/A GetBitmapInfo(new, FALSE); /* Right Bitmap Info */
749N/A}
749N/A
749N/A/* Function Name: Destroy
749N/A * Description: Called at destroy time, cleans up.
749N/A * Arguments: w - the simple menu widget.
749N/A * Returns: none.
749N/A */
749N/A
749N/Astatic void
749N/ADestroy(w)
749N/AWidget w;
749N/A{
749N/A SmeBSBObject entry = (SmeBSBObject) w;
749N/A
749N/A DestroyGCs(w);
749N/A if (entry->sme_bsb.label != XtName(w))
749N/A XtFree(entry->sme_bsb.label);
749N/A}
749N/A
749N/A/* Function Name: Redisplay
749N/A * Description: Redisplays the contents of the widget.
749N/A * Arguments: w - the simple menu widget.
749N/A * event - the X event that caused this redisplay.
749N/A * region - the region the needs to be repainted.
749N/A * Returns: none.
749N/A */
749N/A
749N/A/* ARGSUSED */
749N/Astatic void
749N/ARedisplay(w, event, region)
749N/AWidget w;
749N/AXEvent * event;
749N/ARegion region;
749N/A{
749N/A GC gc;
749N/A SmeBSBObject entry = (SmeBSBObject) w;
749N/A int font_ascent, font_descent, y_loc;
749N/A
749N/A entry->sme_bsb.set_values_area_cleared = FALSE;
749N/A font_ascent = entry->sme_bsb.font->max_bounds.ascent;
749N/A font_descent = entry->sme_bsb.font->max_bounds.descent;
749N/A
749N/A y_loc = entry->rectangle.y;
749N/A
749N/A if (XtIsSensitive(w) && XtIsSensitive( XtParent(w) ) ) {
749N/A if ( w == XawSimpleMenuGetActiveEntry(XtParent(w)) ) {
749N/A XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
749N/A entry->sme_bsb.norm_gc, 0, y_loc,
749N/A (unsigned int) entry->rectangle.width,
749N/A (unsigned int) entry->rectangle.height);
749N/A gc = entry->sme_bsb.rev_gc;
749N/A }
749N/A else
749N/A gc = entry->sme_bsb.norm_gc;
749N/A }
749N/A else
749N/A gc = entry->sme_bsb.norm_gray_gc;
749N/A
749N/A if (entry->sme_bsb.label != NULL) {
749N/A int x_loc = entry->sme_bsb.left_margin;
749N/A int len = strlen(entry->sme_bsb.label);
749N/A char * label = entry->sme_bsb.label;
749N/A
749N/A switch(entry->sme_bsb.justify) {
749N/A int width, t_width;
749N/A
749N/A case XtJustifyCenter:
749N/A t_width = XTextWidth(entry->sme_bsb.font, label, len);
749N/A width = entry->rectangle.width - (entry->sme_bsb.left_margin +
749N/A entry->sme_bsb.right_margin);
749N/A x_loc += (width - t_width)/2;
749N/A break;
749N/A case XtJustifyRight:
749N/A t_width = XTextWidth(entry->sme_bsb.font, label, len);
749N/A x_loc = entry->rectangle.width - (entry->sme_bsb.right_margin +
749N/A t_width);
749N/A break;
749N/A case XtJustifyLeft:
749N/A default:
749N/A break;
749N/A }
749N/A
749N/A y_loc += (entry->rectangle.height -
749N/A (font_ascent + font_descent)) / 2 + font_ascent;
749N/A
749N/A XDrawString(XtDisplayOfObject(w), XtWindowOfObject(w), gc,
749N/A x_loc, y_loc, label, len);
749N/A }
749N/A
749N/A DrawBitmaps(w, gc);
749N/A}
749N/A
749N/A
749N/A/* Function Name: SetValues
749N/A * Description: Relayout the menu when one of the resources is changed.
749N/A * Arguments: current - current state of the widget.
749N/A * request - what was requested.
749N/A * new - what the widget will become.
749N/A * Returns: none
749N/A */
749N/A
749N/A/* ARGSUSED */
749N/Astatic Boolean
749N/ASetValues(current, request, new)
749N/AWidget current, request, new;
749N/A{
749N/A SmeBSBObject entry = (SmeBSBObject) new;
749N/A SmeBSBObject old_entry = (SmeBSBObject) current;
749N/A Boolean ret_val = FALSE;
749N/A
749N/A if (old_entry->sme_bsb.label != entry->sme_bsb.label) {
749N/A if (old_entry->sme_bsb.label != XtName( new ) )
749N/A XtFree( (char *) old_entry->sme_bsb.label );
749N/A
749N/A if (entry->sme_bsb.label != XtName(new) )
749N/A entry->sme_bsb.label = XtNewString( entry->sme_bsb.label );
749N/A
749N/A ret_val = True;
749N/A }
749N/A
749N/A if (entry->rectangle.sensitive != old_entry->rectangle.sensitive )
749N/A ret_val = TRUE;
749N/A
749N/A if (entry->sme_bsb.left_bitmap != old_entry->sme_bsb.left_bitmap) {
749N/A GetBitmapInfo(new, TRUE);
749N/A ret_val = TRUE;
749N/A }
749N/A
749N/A if (entry->sme_bsb.right_bitmap != old_entry->sme_bsb.right_bitmap) {
749N/A GetBitmapInfo(new, FALSE);
749N/A ret_val = TRUE;
749N/A }
749N/A
749N/A if ( (old_entry->sme_bsb.font != entry->sme_bsb.font) ||
749N/A (old_entry->sme_bsb.foreground != entry->sme_bsb.foreground) ) {
749N/A DestroyGCs(current);
749N/A CreateGCs(new);
749N/A ret_val = TRUE;
749N/A }
749N/A
749N/A if (ret_val) {
749N/A GetDefaultSize(new,
749N/A &(entry->rectangle.width), &(entry->rectangle.height));
749N/A entry->sme_bsb.set_values_area_cleared = TRUE;
749N/A }
749N/A return(ret_val);
749N/A}
749N/A
749N/A/* Function Name: QueryGeometry.
749N/A * Description: Returns the preferred geometry for this widget.
749N/A * Arguments: w - the menu entry object.
749N/A * itended, return_val - the intended and return geometry info.
749N/A * Returns: A Geometry Result.
749N/A *
749N/A * See the Intrinsics manual for details on what this function is for.
749N/A *
749N/A * I just return the height and width of the label plus the margins.
749N/A */
749N/A
749N/Astatic XtGeometryResult
749N/AQueryGeometry(w, intended, return_val)
749N/AWidget w;
749N/AXtWidgetGeometry *intended, *return_val;
749N/A{
749N/A SmeBSBObject entry = (SmeBSBObject) w;
749N/A Dimension width, height;
749N/A XtGeometryResult ret_val = XtGeometryYes;
749N/A XtGeometryMask mode = intended->request_mode;
749N/A
749N/A GetDefaultSize(w, &width, &height );
749N/A
749N/A if ( ((mode & CWWidth) && (intended->width != width)) ||
749N/A !(mode & CWWidth) ) {
749N/A return_val->request_mode |= CWWidth;
749N/A return_val->width = width;
749N/A ret_val = XtGeometryAlmost;
749N/A }
749N/A
749N/A if ( ((mode & CWHeight) && (intended->height != height)) ||
749N/A !(mode & CWHeight) ) {
749N/A return_val->request_mode |= CWHeight;
749N/A return_val->height = height;
749N/A ret_val = XtGeometryAlmost;
749N/A }
749N/A
749N/A if (ret_val == XtGeometryAlmost) {
749N/A mode = return_val->request_mode;
749N/A
749N/A if ( ((mode & CWWidth) && (width == entry->rectangle.width)) &&
749N/A ((mode & CWHeight) && (height == entry->rectangle.height)) )
749N/A return(XtGeometryNo);
749N/A }
749N/A
749N/A return(ret_val);
749N/A}
749N/A
749N/A/* Function Name: FlipColors
749N/A * Description: Invert the colors of the current entry.
749N/A * Arguments: w - the bsb menu entry widget.
749N/A * Returns: none.
749N/A */
749N/A
749N/Astatic void
749N/AFlipColors(w)
749N/AWidget w;
749N/A{
749N/A SmeBSBObject entry = (SmeBSBObject) w;
749N/A
749N/A if (entry->sme_bsb.set_values_area_cleared) return;
749N/A
749N/A XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
749N/A entry->sme_bsb.invert_gc, 0, (int) entry->rectangle.y,
749N/A (unsigned int) entry->rectangle.width,
749N/A (unsigned int) entry->rectangle.height);
749N/A}
749N/A
749N/A/************************************************************
749N/A *
749N/A * Private Functions.
749N/A *
749N/A ************************************************************/
749N/A
749N/A/* Function Name: GetDefaultSize
749N/A * Description: Calculates the Default (preferred) size of
749N/A * this menu entry.
749N/A * Arguments: w - the menu entry widget.
749N/A * width, height - default sizes (RETURNED).
749N/A * Returns: none.
749N/A */
749N/A
749N/Astatic void
749N/AGetDefaultSize(w, width, height)
749N/AWidget w;
749N/ADimension * width, * height;
749N/A{
749N/A SmeBSBObject entry = (SmeBSBObject) w;
749N/A
749N/A if (entry->sme_bsb.label == NULL)
749N/A *width = 0;
749N/A else
749N/A *width = XTextWidth(entry->sme_bsb.font, entry->sme_bsb.label,
749N/A strlen(entry->sme_bsb.label));
749N/A
749N/A *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin;
749N/A
749N/A *height = (entry->sme_bsb.font->max_bounds.ascent +
749N/A entry->sme_bsb.font->max_bounds.descent);
749N/A
749N/A *height = (*height * ( ONE_HUNDRED +
749N/A entry->sme_bsb.vert_space )) / ONE_HUNDRED;
749N/A}
749N/A
749N/A/* Function Name: DrawBitmaps
749N/A * Description: Draws left and right bitmaps.
749N/A * Arguments: w - the simple menu widget.
749N/A * gc - graphics context to use for drawing.
749N/A * Returns: none
749N/A */
749N/A
749N/Astatic void
749N/ADrawBitmaps(w, gc)
749N/AWidget w;
749N/AGC gc;
749N/A{
749N/A int x_loc, y_loc;
749N/A SmeBSBObject entry = (SmeBSBObject) w;
749N/A
749N/A if ( (entry->sme_bsb.left_bitmap == None) &&
749N/A (entry->sme_bsb.right_bitmap == None) ) return;
749N/A
749N/A/*
749N/A * Draw Left Bitmap.
749N/A */
749N/A
749N/A if (entry->sme_bsb.left_bitmap != None) {
749N/A x_loc = (entry->sme_bsb.left_margin -
749N/A entry->sme_bsb.left_bitmap_width) / 2;
749N/A
749N/A y_loc = entry->rectangle.y + (entry->rectangle.height -
749N/A entry->sme_bsb.left_bitmap_height) / 2;
749N/A
749N/A XCopyPlane(XtDisplayOfObject(w), entry->sme_bsb.left_bitmap,
749N/A XtWindowOfObject(w), gc, 0, 0,
749N/A entry->sme_bsb.left_bitmap_width,
749N/A entry->sme_bsb.left_bitmap_height, x_loc, y_loc, 1);
749N/A }
749N/A
749N/A/*
749N/A * Draw Right Bitmap.
749N/A */
749N/A
749N/A
749N/A if (entry->sme_bsb.right_bitmap != None) {
749N/A x_loc = entry->rectangle.width - (entry->sme_bsb.right_margin +
749N/A entry->sme_bsb.right_bitmap_width) / 2;
749N/A
749N/A y_loc = entry->rectangle.y + (entry->rectangle.height -
749N/A entry->sme_bsb.right_bitmap_height) / 2;
749N/A
749N/A XCopyPlane(XtDisplayOfObject(w), entry->sme_bsb.right_bitmap,
749N/A XtWindowOfObject(w), gc, 0, 0,
749N/A entry->sme_bsb.right_bitmap_width,
749N/A entry->sme_bsb.right_bitmap_height, x_loc, y_loc, 1);
749N/A }
749N/A}
749N/A
749N/A/* Function Name: GetBitmapInfo
749N/A * Description: Gets the bitmap information from either of the bitmaps.
749N/A * Arguments: w - the bsb menu entry widget.
749N/A * is_left - TRUE if we are testing left bitmap,
749N/A * FALSE if we are testing the right bitmap.
749N/A * Returns: none
749N/A */
749N/A
749N/Astatic void
749N/AGetBitmapInfo(w, is_left)
749N/AWidget w;
749N/ABoolean is_left;
749N/A{
749N/A SmeBSBObject entry = (SmeBSBObject) w;
749N/A unsigned int depth, bw;
749N/A Window root;
749N/A int x, y;
749N/A unsigned int width, height;
749N/A char buf[BUFSIZ];
749N/A
749N/A if (is_left) {
749N/A if (entry->sme_bsb.left_bitmap != None) {
749N/A if (!XGetGeometry(XtDisplayOfObject(w),
749N/A entry->sme_bsb.left_bitmap, &root,
749N/A &x, &y, &width, &height, &bw, &depth)) {
749N/A sprintf(buf, "SmeBSB Object: %s %s \"%s\".", "Could not",
749N/A "get Left Bitmap geometry information for menu entry ",
749N/A XtName(w));
749N/A XtAppError(XtWidgetToApplicationContext(w), buf);
749N/A }
749N/A if (depth != 1) {
749N/A sprintf(buf, "SmeBSB Object: %s \"%s\"%s.",
749N/A "Left Bitmap of entry ",
749N/A XtName(w), " is not one bit deep.");
749N/A XtAppError(XtWidgetToApplicationContext(w), buf);
749N/A }
749N/A entry->sme_bsb.left_bitmap_width = (Dimension) width;
749N/A entry->sme_bsb.left_bitmap_height = (Dimension) height;
749N/A }
749N/A }
749N/A else if (entry->sme_bsb.right_bitmap != None) {
749N/A if (!XGetGeometry(XtDisplayOfObject(w),
749N/A entry->sme_bsb.right_bitmap, &root,
749N/A &x, &y, &width, &height, &bw, &depth)) {
749N/A sprintf(buf, "SmeBSB Object: %s %s \"%s\".", "Could not",
749N/A "get Right Bitmap geometry information for menu entry ",
749N/A XtName(w));
749N/A XtAppError(XtWidgetToApplicationContext(w), buf);
749N/A }
749N/A if (depth != 1) {
749N/A sprintf(buf, "SmeBSB Object: %s \"%s\"%s.",
749N/A "Right Bitmap of entry ", XtName(w),
749N/A " is not one bit deep.");
749N/A XtAppError(XtWidgetToApplicationContext(w), buf);
749N/A }
749N/A entry->sme_bsb.right_bitmap_width = (Dimension) width;
749N/A entry->sme_bsb.right_bitmap_height = (Dimension) height;
749N/A }
749N/A}
749N/A
749N/A/* Function Name: CreateGCs
749N/A * Description: Creates all gc's for the simple menu widget.
749N/A * Arguments: w - the simple menu widget.
749N/A * Returns: none.
749N/A */
749N/A
749N/Astatic void
749N/ACreateGCs(w)
749N/AWidget w;
749N/A{
749N/A SmeBSBObject entry = (SmeBSBObject) w;
749N/A XGCValues values;
749N/A XtGCMask mask;
749N/A
749N/A values.foreground = XtParent(w)->core.background_pixel;
749N/A values.background = entry->sme_bsb.foreground;
749N/A values.font = entry->sme_bsb.font->fid;
749N/A values.graphics_exposures = FALSE;
749N/A mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
749N/A entry->sme_bsb.rev_gc = XtGetGC(w, mask, &values);
749N/A
749N/A values.foreground = entry->sme_bsb.foreground;
749N/A values.background = XtParent(w)->core.background_pixel;
749N/A entry->sme_bsb.norm_gc = XtGetGC(w, mask, &values);
749N/A
749N/A values.fill_style = FillTiled;
749N/A values.tile = XmuCreateStippledPixmap(XtScreenOfObject(w),
749N/A entry->sme_bsb.foreground,
749N/A XtParent(w)->core.background_pixel,
749N/A XtParent(w)->core.depth);
749N/A values.graphics_exposures = FALSE;
749N/A mask |= GCTile | GCFillStyle;
749N/A entry->sme_bsb.norm_gray_gc = XtGetGC(w, mask, &values);
749N/A
749N/A values.foreground ^= values.background;
749N/A values.background = 0;
749N/A values.function = GXxor;
749N/A mask = GCForeground | GCBackground | GCGraphicsExposures | GCFunction;
749N/A entry->sme_bsb.invert_gc = XtGetGC(w, mask, &values);
749N/A}
749N/A
749N/A/* Function Name: DestroyGCs
749N/A * Description: Removes all gc's for the simple menu widget.
749N/A * Arguments: w - the simple menu widget.
749N/A * Returns: none.
749N/A */
749N/A
749N/Astatic void
749N/ADestroyGCs(w)
749N/AWidget w;
749N/A{
749N/A SmeBSBObject entry = (SmeBSBObject) w;
749N/A
749N/A XtReleaseGC(w, entry->sme_bsb.norm_gc);
749N/A XtReleaseGC(w, entry->sme_bsb.norm_gray_gc);
749N/A XtReleaseGC(w, entry->sme_bsb.rev_gc);
749N/A XtReleaseGC(w, entry->sme_bsb.invert_gc);
749N/A}
749N/A
749N/A#ifdef apollo
749N/A
749N/A/*
749N/A * The apollo compiler that we have optomizes out my code for
749N/A * FlipColors() since it is static. and no one executes it in this
749N/A * file. I am setting the function pointer into the class structure so
749N/A * that it can be called by my parent who will tell me to when to
749N/A * highlight and unhighlight.
749N/A */
749N/A
749N/Avoid _XawSmeBSBApolloHack ()
749N/A{
749N/A FlipColors();
749N/A}
749N/A#endif /* apollo */