749N/A#ifndef lint
749N/Astatic char Xrcsid[] = "$XConsortium: Logo.c,v 1.11 89/10/09 16:20:39 jim Exp $";
749N/A#endif
749N/A
749N/A/*
749N/ACopyright 1988 by the Massachusetts Institute of Technology
749N/A
749N/APermission to use, copy, modify, and distribute this
749N/Asoftware and its documentation for any purpose and without
749N/Afee is hereby granted, provided that the above copyright
749N/Anotice appear in all copies and that both that copyright
749N/Anotice and this permission notice appear in supporting
749N/Adocumentation, and that the name of M.I.T. not be used in
749N/Aadvertising or publicity pertaining to distribution of the
749N/Asoftware without specific, written prior permission.
749N/AM.I.T. makes no representations about the suitability of
749N/Athis software for any purpose. It is provided "as is"
749N/Awithout express or implied warranty.
749N/A*/
749N/A
749N/A#include <X11/StringDefs.h>
749N/A#include <X11/IntrinsicP.h>
749N/A#include <./Xaw3_1XawInit.h>
749N/A#include <./Xaw3_1LogoP.h>
749N/A
749N/Astatic Dimension defDim = 100;
749N/A
749N/Astatic XtResource resources[] = {
749N/A {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension),
749N/A XtOffset(Widget,core.width), XtRDimension, (caddr_t)&defDim},
749N/A {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension),
749N/A XtOffset(Widget,core.height), XtRDimension, (caddr_t)&defDim},
749N/A {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
749N/A XtOffset(Widget,core.background_pixel), XtRString, "White"},
749N/A {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
749N/A XtOffset(LogoWidget,logo.fgpixel), XtRString, "Black"},
749N/A {XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof (Boolean),
749N/A XtOffset(LogoWidget,logo.reverse_video), XtRString, "FALSE"},
749N/A};
749N/A
749N/Astatic void Initialize(), Realize(), Destroy(), Redisplay();
749N/Astatic Boolean SetValues();
749N/A
749N/ALogoClassRec logoClassRec = {
749N/A { /* core fields */
749N/A /* superclass */ &widgetClassRec,
749N/A /* class_name */ "Logo",
749N/A /* widget_size */ sizeof(LogoRec),
749N/A /* class_initialize */ XawInitializeWidgetSet,
749N/A /* class_part_initialize */ NULL,
749N/A /* class_inited */ FALSE,
749N/A /* initialize */ Initialize,
749N/A /* initialize_hook */ NULL,
749N/A /* realize */ Realize,
749N/A /* actions */ NULL,
749N/A /* num_actions */ 0,
749N/A /* resources */ resources,
749N/A /* resource_count */ XtNumber(resources),
749N/A /* xrm_class */ NULL,
749N/A /* compress_motion */ TRUE,
749N/A /* compress_exposure */ TRUE,
749N/A /* compress_enterleave */ TRUE,
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 /* version */ XtVersion,
749N/A /* callback_private */ NULL,
749N/A /* tm_table */ NULL,
749N/A /* query_geometry */ XtInheritQueryGeometry,
749N/A /* display_accelerator */ XtInheritDisplayAccelerator,
749N/A /* extension */ NULL
749N/A }
749N/A};
749N/A
749N/AWidgetClass logoWidgetClass = (WidgetClass) &logoClassRec;
749N/A
749N/A/* ARGSUSED */
749N/Astatic void Initialize (request, new)
749N/A Widget request, new;
749N/A{
749N/A LogoWidget w = (LogoWidget)new;
749N/A XGCValues gcv;
749N/A
749N/A if (w->logo.reverse_video) {
749N/A Pixel fg = w->logo.fgpixel;
749N/A Pixel bg = w->core.background_pixel;
749N/A
749N/A if (w->core.border_pixel == fg)
749N/A w->core.border_pixel = bg;
749N/A w->logo.fgpixel = bg;
749N/A w->core.background_pixel = fg;
749N/A }
749N/A
749N/A gcv.foreground = w->logo.fgpixel;
749N/A w->logo.foreGC = XtGetGC((Widget)w, GCForeground, &gcv);
749N/A gcv.foreground = w->core.background_pixel;
749N/A w->logo.backGC = XtGetGC((Widget)w, GCForeground, &gcv);
749N/A}
749N/A
749N/Astatic void Realize (gw, valueMask, attrs)
749N/A Widget gw;
749N/A XtValueMask *valueMask;
749N/A XSetWindowAttributes *attrs;
749N/A{
749N/A XtCreateWindow( gw, InputOutput, (Visual *)CopyFromParent,
749N/A *valueMask, attrs);
749N/A}
749N/A
749N/Astatic void Destroy (gw)
749N/A Widget gw;
749N/A{
749N/A LogoWidget w = (LogoWidget) gw;
749N/A XtDestroyGC (w->logo.foreGC);
749N/A XtDestroyGC (w->logo.backGC);
749N/A}
749N/A
749N/A/* ARGSUSED */
749N/Astatic void Redisplay (gw, event, region)
749N/A Widget gw;
749N/A XEvent *event; /* unused */
749N/A Region region; /* unused */
749N/A{
749N/A LogoWidget w = (LogoWidget) gw;
749N/A
749N/A XmuDrawLogo(XtDisplay(w), XtWindow(w), w->logo.foreGC, w->logo.backGC,
749N/A 0, 0, (unsigned int) w->core.width,
749N/A (unsigned int) w->core.height);
749N/A}
749N/A
749N/A/* ARGSUSED */
749N/Astatic Boolean SetValues (gcurrent, grequest, gnew)
749N/A Widget gcurrent, grequest, gnew;
749N/A{
749N/A LogoWidget current = (LogoWidget) gcurrent;
749N/A LogoWidget new = (LogoWidget) gnew;
749N/A Boolean redisplay = FALSE;
749N/A XGCValues gcv;
749N/A
749N/A if ((new->logo.fgpixel != current->logo.fgpixel) ||
749N/A (new->core.background_pixel != current->core.background_pixel)) {
749N/A XtDestroyGC (current->logo.foreGC);
749N/A XtDestroyGC (current->logo.backGC);
749N/A gcv.foreground = new->logo.fgpixel;
749N/A new->logo.foreGC = XtGetGC(gnew, GCForeground, &gcv);
749N/A gcv.foreground = new->core.background_pixel;
749N/A new->logo.backGC = XtGetGC(gnew, GCForeground, &gcv);
749N/A redisplay = TRUE;
749N/A }
749N/A
749N/A return (redisplay);
749N/A}