rust/cargo-c: update to 0.10.7+cargo-0.84.0
[oi-userland.git] / components / x11 / libXaw4 / src / Xaw3_1Logo.c
blobf59adba0679b582971ee06360a41e63a3eaadee8
1 #ifndef lint
2 static char Xrcsid[] = "$XConsortium: Logo.c,v 1.11 89/10/09 16:20:39 jim Exp $";
3 #endif
5 /*
6 Copyright 1988 by the Massachusetts Institute of Technology
8 Permission to use, copy, modify, and distribute this
9 software and its documentation for any purpose and without
10 fee is hereby granted, provided that the above copyright
11 notice appear in all copies and that both that copyright
12 notice and this permission notice appear in supporting
13 documentation, and that the name of M.I.T. not be used in
14 advertising or publicity pertaining to distribution of the
15 software without specific, written prior permission.
16 M.I.T. makes no representations about the suitability of
17 this software for any purpose. It is provided "as is"
18 without express or implied warranty.
21 #include <X11/StringDefs.h>
22 #include <X11/IntrinsicP.h>
23 #include <./Xaw3_1XawInit.h>
24 #include <./Xaw3_1LogoP.h>
26 static Dimension defDim = 100;
28 static XtResource resources[] = {
29 {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension),
30 XtOffset(Widget,core.width), XtRDimension, (caddr_t)&defDim},
31 {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension),
32 XtOffset(Widget,core.height), XtRDimension, (caddr_t)&defDim},
33 {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
34 XtOffset(Widget,core.background_pixel), XtRString, "White"},
35 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
36 XtOffset(LogoWidget,logo.fgpixel), XtRString, "Black"},
37 {XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof (Boolean),
38 XtOffset(LogoWidget,logo.reverse_video), XtRString, "FALSE"},
41 static void Initialize(), Realize(), Destroy(), Redisplay();
42 static Boolean SetValues();
44 LogoClassRec logoClassRec = {
45 { /* core fields */
46 /* superclass */ &widgetClassRec,
47 /* class_name */ "Logo",
48 /* widget_size */ sizeof(LogoRec),
49 /* class_initialize */ XawInitializeWidgetSet,
50 /* class_part_initialize */ NULL,
51 /* class_inited */ FALSE,
52 /* initialize */ Initialize,
53 /* initialize_hook */ NULL,
54 /* realize */ Realize,
55 /* actions */ NULL,
56 /* num_actions */ 0,
57 /* resources */ resources,
58 /* resource_count */ XtNumber(resources),
59 /* xrm_class */ NULL,
60 /* compress_motion */ TRUE,
61 /* compress_exposure */ TRUE,
62 /* compress_enterleave */ TRUE,
63 /* visible_interest */ FALSE,
64 /* destroy */ Destroy,
65 /* resize */ NULL,
66 /* expose */ Redisplay,
67 /* set_values */ SetValues,
68 /* set_values_hook */ NULL,
69 /* set_values_almost */ XtInheritSetValuesAlmost,
70 /* get_values_hook */ NULL,
71 /* accept_focus */ NULL,
72 /* version */ XtVersion,
73 /* callback_private */ NULL,
74 /* tm_table */ NULL,
75 /* query_geometry */ XtInheritQueryGeometry,
76 /* display_accelerator */ XtInheritDisplayAccelerator,
77 /* extension */ NULL
81 WidgetClass logoWidgetClass = (WidgetClass) &logoClassRec;
83 /* ARGSUSED */
84 static void Initialize (request, new)
85 Widget request, new;
87 LogoWidget w = (LogoWidget)new;
88 XGCValues gcv;
90 if (w->logo.reverse_video) {
91 Pixel fg = w->logo.fgpixel;
92 Pixel bg = w->core.background_pixel;
94 if (w->core.border_pixel == fg)
95 w->core.border_pixel = bg;
96 w->logo.fgpixel = bg;
97 w->core.background_pixel = fg;
100 gcv.foreground = w->logo.fgpixel;
101 w->logo.foreGC = XtGetGC((Widget)w, GCForeground, &gcv);
102 gcv.foreground = w->core.background_pixel;
103 w->logo.backGC = XtGetGC((Widget)w, GCForeground, &gcv);
106 static void Realize (gw, valueMask, attrs)
107 Widget gw;
108 XtValueMask *valueMask;
109 XSetWindowAttributes *attrs;
111 XtCreateWindow( gw, InputOutput, (Visual *)CopyFromParent,
112 *valueMask, attrs);
115 static void Destroy (gw)
116 Widget gw;
118 LogoWidget w = (LogoWidget) gw;
119 XtDestroyGC (w->logo.foreGC);
120 XtDestroyGC (w->logo.backGC);
123 /* ARGSUSED */
124 static void Redisplay (gw, event, region)
125 Widget gw;
126 XEvent *event; /* unused */
127 Region region; /* unused */
129 LogoWidget w = (LogoWidget) gw;
131 XmuDrawLogo(XtDisplay(w), XtWindow(w), w->logo.foreGC, w->logo.backGC,
132 0, 0, (unsigned int) w->core.width,
133 (unsigned int) w->core.height);
136 /* ARGSUSED */
137 static Boolean SetValues (gcurrent, grequest, gnew)
138 Widget gcurrent, grequest, gnew;
140 LogoWidget current = (LogoWidget) gcurrent;
141 LogoWidget new = (LogoWidget) gnew;
142 Boolean redisplay = FALSE;
143 XGCValues gcv;
145 if ((new->logo.fgpixel != current->logo.fgpixel) ||
146 (new->core.background_pixel != current->core.background_pixel)) {
147 XtDestroyGC (current->logo.foreGC);
148 XtDestroyGC (current->logo.backGC);
149 gcv.foreground = new->logo.fgpixel;
150 new->logo.foreGC = XtGetGC(gnew, GCForeground, &gcv);
151 gcv.foreground = new->core.background_pixel;
152 new->logo.backGC = XtGetGC(gnew, GCForeground, &gcv);
153 redisplay = TRUE;
156 return (redisplay);