static void GetGC(MultiSinkObject sink) { XtGCMask valuemask = (GCGraphicsExposures | GCForeground | GCBackground); XGCValues values; values.graphics_exposures = (Bool) FALSE; values.foreground = sink->text_sink.foreground; values.background = sink->text_sink.background; sink->multi_sink.normgc = XtAllocateGC((Widget) sink, 0, valuemask, &values, GCFont, 0); values.foreground = sink->text_sink.background; values.background = sink->text_sink.foreground; sink->multi_sink.invgc = XtAllocateGC((Widget) sink, 0, valuemask, &values, GCFont, 0); values.function = GXxor; values.background = (unsigned long) 0L; /* (pix ^ 0) = pix */ values.foreground = (sink->text_sink.background ^ sink->text_sink.foreground); valuemask = GCGraphicsExposures | GCFunction | GCForeground | GCBackground; /* if this GC is not used for fontset rendering then AllocateGC aint needed. Dont hurt tho. */ sink->multi_sink.xorgc = XtAllocateGC((Widget) sink, 0, valuemask, &values, GCFont, 0); }
/* * Implementation */ static void GetGCs(Widget w) { XGCValues values; ListWidget lw = (ListWidget)w; values.foreground = lw->list.foreground; values.font = lw->list.font->fid; if (lw->simple.international == True) lw->list.normgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0); else lw->list.normgc = XtGetGC(w, GCForeground | GCFont, &values); values.foreground = lw->core.background_pixel; if (lw->simple.international == True) lw->list.revgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0); else lw->list.revgc = XtGetGC(w, GCForeground | GCFont, &values); values.tile = XmuCreateStippledPixmap(XtScreen(w), lw->list.foreground, lw->core.background_pixel, lw->core.depth); values.fill_style = FillTiled; if (lw->simple.international == True) lw->list.graygc = XtAllocateGC(w, 0, GCTile | GCFillStyle, &values, GCFont, 0); else lw->list.graygc = XtGetGC(w, GCFont | GCTile | GCFillStyle, &values); }
static void GetArrowGC( XmArrowButtonWidget aw ) { XGCValues values; XtGCMask valueMask, unusedMask; valueMask = GCForeground | GCBackground | GCGraphicsExposures; unusedMask = GCClipXOrigin | GCClipYOrigin | GCFont; values.foreground = aw->primitive.foreground; values.background = aw->core.background_pixel; values.graphics_exposures = False; aw->arrowbutton.arrow_GC = XtAllocateGC((Widget) aw, 0, valueMask, &values, GCClipMask, unusedMask); valueMask |= GCFillStyle | GCStipple; values.fill_style = FillOpaqueStippled; values.stipple = _XmGetInsensitiveStippleBitmap((Widget) aw); aw->arrowbutton.insensitive_GC = XtAllocateGC((Widget) aw, 0, valueMask, &values, GCClipMask, unusedMask); }
static void GetGrayGC(LabelWidget lw) { XGCValues values; values.foreground = lw->label.foreground; values.background = lw->core.background_pixel; values.font = lw->label.font->fid; values.fill_style = FillTiled; values.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw), lw->label.foreground, lw->core.background_pixel, lw->core.depth); values.graphics_exposures = False; lw->label.stipple = values.tile; if (lw->simple.international == True) /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC */ lw->label.gray_GC = XtAllocateGC((Widget)lw, 0, GCForeground | GCBackground | GCTile | GCFillStyle | GCGraphicsExposures, &values, GCFont, 0); else lw->label.gray_GC = XtGetGC((Widget)lw, GCForeground | GCBackground | GCFont | GCTile | GCFillStyle | GCGraphicsExposures, &values); }
static void GetGC(MultiSinkObject sink) { XtGCMask valuemask = (GCGraphicsExposures | GCClipXOrigin | GCForeground | GCBackground); XGCValues values; /* XXX We dont want do share a gc that will change the clip-mask */ values.clip_x_origin = (long)sink; values.clip_mask = None; values.graphics_exposures = False; values.foreground = sink->text_sink.foreground; values.background = sink->text_sink.background; sink->multi_sink.normgc = XtAllocateGC((Widget)sink, 0, valuemask, &values, GCFont | GCClipMask, 0); values.foreground = sink->text_sink.background; #ifndef OLDXAW values.background = sink->text_sink.cursor_color; #else values.background = sink->text_sink.foreground; #endif sink->multi_sink.invgc = XtAllocateGC((Widget)sink, 0, valuemask, &values, GCFont | GCClipMask, 0); #ifndef OLDXAW if (sink->text_sink.cursor_color != sink->text_sink.foreground) { values.foreground = sink->text_sink.cursor_color; values.background = sink->text_sink.foreground; sink->multi_sink.xorgc = XtAllocateGC((Widget)sink, 0, valuemask, &values, GCFont | GCClipMask, 0); } else #endif /* OLDXAW */ sink->multi_sink.xorgc = NULL; XawMultiSinkResize((Widget)sink); }
void draw(Widget w, Window win, Dimension width, Dimension height, Pixel color) { GC drawGC; drawGC = XtAllocateGC(w, 0,0, NULL, 0,0); XSetForeground(XtDisplayOfObject(w), drawGC, color); /* NOTE: the skip is per Motif -- no effort is made to avoid the shadows */ XDrawRectangle(XtDisplayOfObject(w), win, drawGC, 10, 10, width - 20, height - 20); XtReleaseGC(w, drawGC); }
static void GetNormalGC(LabelWidget lw) { XGCValues values; values.foreground = lw->label.foreground; values.background = lw->core.background_pixel; values.font = lw->label.font->fid; values.graphics_exposures = False; if (lw->simple.international == True) /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC */ lw->label.normal_GC = XtAllocateGC((Widget)lw, 0, GCForeground | GCBackground | GCGraphicsExposures, &values, GCFont, 0); else lw->label.normal_GC = XtGetGC((Widget)lw, GCForeground | GCBackground | GCFont | GCGraphicsExposures, &values); }
/* * Implementation */ static GC Get_GC(CommandWidget cbw, Pixel fg, Pixel bg) { XGCValues values; values.foreground = fg; values.background = bg; values.font = cbw->label.font->fid; values.cap_style = CapProjecting; if (cbw->command.highlight_thickness > 1) values.line_width = cbw->command.highlight_thickness; else values.line_width = 0; if (cbw->simple.international == True) return (XtAllocateGC((Widget)cbw, 0, GCForeground | GCBackground | GCLineWidth | GCCapStyle, &values, GCFont, 0)); else return (XtGetGC((Widget)cbw, GCForeground | GCBackground | GCFont | GCLineWidth | GCCapStyle, &values)); }