1 /* Generated by wbuild from "Frame.w"
2 ** (generator version $Revision: 2.5 $ of $Date: 94/07/29 15:31:49 $)
3 */
4 #include <X11/IntrinsicP.h>
5 #include <X11/StringDefs.h>
6 #line 766 "Frame.w"
7 #include <string.h>
8 #line 767 "Frame.w"
9 #include <stdio.h>
10 #line 768 "Frame.w"
11 #include <X11/Xmu/Converters.h>
12 #line 769 "Frame.w"
13 #include <X11/Xmu/CharSet.h>
14 #line 773 "Frame.w"
15 #include "stip4.bm"
16 #include <Xfwf/FrameP.h>
17 #line 521 "Frame.w"
18 static void set_shadow(
19 #if NeedFunctionPrototypes
20 Widget,XEvent*,String*,Cardinal*
21 #endif
22 );
23 
24 static XtActionsRec actionsList[] = {
25 {"set_shadow", set_shadow},
26 };
27 static void _resolve_inheritance(
28 #if NeedFunctionPrototypes
29 WidgetClass
30 #endif
31 );
32 #line 201 "Frame.w"
33 static void class_initialize(
34 #if NeedFunctionPrototypes
35 void
36 #endif
37 );
38 #line 224 "Frame.w"
39 static void initialize(
40 #if NeedFunctionPrototypes
41 Widget ,Widget,ArgList ,Cardinal *
42 #endif
43 );
44 #line 248 "Frame.w"
45 static void realize(
46 #if NeedFunctionPrototypes
47 Widget,XtValueMask *,XSetWindowAttributes *
48 #endif
49 );
50 #line 276 "Frame.w"
51 static Boolean  set_values(
52 #if NeedFunctionPrototypes
53 Widget ,Widget ,Widget,ArgList ,Cardinal *
54 #endif
55 );
56 #line 338 "Frame.w"
57 static void expose(
58 #if NeedFunctionPrototypes
59 Widget,XEvent *,Region
60 #endif
61 );
62 #line 362 "Frame.w"
63 static void compute_inside(
64 #if NeedFunctionPrototypes
65 Widget,Position *,Position *,Dimension *,Dimension *
66 #endif
67 );
68 #line 375 "Frame.w"
69 static Dimension  total_frame_width(
70 #if NeedFunctionPrototypes
71 Widget
72 #endif
73 );
74 #line 385 "Frame.w"
75 static XtGeometryResult  query_geometry(
76 #if NeedFunctionPrototypes
77 Widget,XtWidgetGeometry *,XtWidgetGeometry *
78 #endif
79 );
80 #line 438 "Frame.w"
81 static XtGeometryResult  geometry_manager(
82 #if NeedFunctionPrototypes
83 Widget ,XtWidgetGeometry *,XtWidgetGeometry *
84 #endif
85 );
86 #line 465 "Frame.w"
87 static void resize(
88 #if NeedFunctionPrototypes
89 Widget
90 #endif
91 );
92 #line 486 "Frame.w"
93 static void change_managed(
94 #if NeedFunctionPrototypes
95 Widget
96 #endif
97 );
98 #line 547 "Frame.w"
99 #define done(type, value) do {\
100       if (to->addr != NULL) {\
101 	  if (to->size < sizeof(type)) {\
102 	      to->size = sizeof(type);\
103 	      return False;\
104 	  }\
105 	  *(type*)(to->addr) = (value);\
106       } else {\
107 	  static type static_val;\
108 	  static_val = (value);\
109 	  to->addr = (XtPointer)&static_val;\
110       }\
111       to->size = sizeof(type);\
112       return True;\
113   }while (0 )
114 
115 
116 #line 657 "Frame.w"
117 static char  rcsid[] = "$Header: Frame.w,v 1.5 92/11/02 14:07:52 bert Exp $";
118 #line 664 "Frame.w"
119 static void create_darkgc(
120 #if NeedFunctionPrototypes
121 Widget
122 #endif
123 );
124 #line 703 "Frame.w"
125 static void create_lightgc(
126 #if NeedFunctionPrototypes
127 Widget
128 #endif
129 );
130 #line 741 "Frame.w"
131 static void compute_topcolor(
132 #if NeedFunctionPrototypes
133 Widget,int ,XrmValue *
134 #endif
135 );
136 #line 752 "Frame.w"
137 static void compute_bottomcolor(
138 #if NeedFunctionPrototypes
139 Widget,int ,XrmValue *
140 #endif
141 );
142 #line 664 "Frame.w"
create_darkgc(self)143 /*ARGSUSED*/static void create_darkgc(self)Widget self;
144 {
145     XtGCMask mask;
146     XGCValues values;
147 
148     if (((XfwfFrameWidget)self)->xfwfFrame.darkgc != NULL) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.darkgc);
149     switch (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme) {
150     case XfwfColor:
151 	mask = GCForeground;
152 	values.foreground = ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowColor;
153 	break;
154     case XfwfStipple:
155 	mask = GCFillStyle | GCStipple | GCForeground | GCBackground;
156 	values.fill_style = FillOpaqueStippled;
157 	values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple;
158 	values.foreground = BlackPixelOfScreen(XtScreen(self));
159 	values.background = ((XfwfFrameWidget)self)->core.background_pixel;
160 	break;
161     case XfwfAuto:
162 	if (DefaultDepthOfScreen(XtScreen(self)) > 4
163 	    && ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &values.foreground)) {
164 	    mask = GCForeground;
165 	} else {
166 	    mask = GCFillStyle | GCBackground | GCForeground | GCStipple;
167 	    values.fill_style = FillOpaqueStippled;
168 	    values.background = ((XfwfFrameWidget)self)->core.background_pixel;
169 	    values.foreground = WhitePixelOfScreen(XtScreen(self));
170 	    values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.stip4;
171 	}
172 	break;
173     }
174     ((XfwfFrameWidget)self)->xfwfFrame.darkgc = XtGetGC(self, mask, &values);
175 }
176 #line 703 "Frame.w"
create_lightgc(self)177 /*ARGSUSED*/static void create_lightgc(self)Widget self;
178 {
179     XtGCMask mask;
180     XGCValues values;
181 
182     if (((XfwfFrameWidget)self)->xfwfFrame.lightgc != NULL) XtReleaseGC(self, ((XfwfFrameWidget)self)->xfwfFrame.lightgc);
183     switch (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme) {
184     case XfwfColor:
185 	mask = GCForeground;
186 	values.foreground = ((XfwfFrameWidget)self)->xfwfFrame.topShadowColor;
187 	break;
188     case XfwfStipple:
189 	mask = GCFillStyle | GCStipple | GCForeground | GCBackground;
190 	values.fill_style = FillOpaqueStippled;
191 	values.background = ((XfwfFrameWidget)self)->core.background_pixel;
192 	values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple;
193 	values.foreground = WhitePixelOfScreen(XtScreen(self));
194 	break;
195     case XfwfAuto:
196 	if (DefaultDepthOfScreen(XtScreen(self)) > 4
197 	    && ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.lighter_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &values.foreground)) {
198 	    mask = GCForeground;
199 	} else {
200 	    mask = GCFillStyle | GCBackground | GCForeground | GCStipple;
201 	    values.fill_style = FillOpaqueStippled;
202 	    values.background = ((XfwfFrameWidget)self)->core.background_pixel;
203 	    values.foreground = WhitePixelOfScreen(XtScreen(self));
204 	    values.stipple = ((XfwfFrameWidget)self)->xfwfFrame.stip4;
205 	}
206 	break;
207     }
208     ((XfwfFrameWidget)self)->xfwfFrame.lightgc = XtGetGC(self, mask, &values);
209 }
210 #line 741 "Frame.w"
compute_topcolor(self,offset,value)211 /*ARGSUSED*/static void compute_topcolor(self,offset,value)Widget self;int  offset;XrmValue * value;
212 {
213     static Pixel color;
214 #if 1
215     ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.lighter_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &color);
216 #else
217     (void) choose_color(self, 1.35, ((XfwfFrameWidget)self)->core.background_pixel, &color);
218 #endif
219     value->addr = (XtPointer) &color;
220 }
221 #line 752 "Frame.w"
compute_bottomcolor(self,offset,value)222 /*ARGSUSED*/static void compute_bottomcolor(self,offset,value)Widget self;int  offset;XrmValue * value;
223 {
224     static Pixel color;
225 #if 1
226     ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfFrameWidget)self)->core.background_pixel, &color);
227 #else
228     (void) choose_color(self, 0.6, ((XfwfFrameWidget)self)->core.background_pixel, &color);
229 #endif
230     value->addr = (XtPointer) &color;
231 }
232 
233 static XtResource resources[] = {
234 #line 41 "Frame.w"
235 {XtNcursor,XtCCursor,XtRCursor,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.cursor),XtOffsetOf(XfwfFrameRec,xfwfFrame.cursor),XtRImmediate,(XtPointer)None },
236 #line 45 "Frame.w"
237 {XtNframeType,XtCFrameType,XtRFrameType,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.frameType),XtOffsetOf(XfwfFrameRec,xfwfFrame.frameType),XtRImmediate,(XtPointer)XfwfRaised },
238 #line 51 "Frame.w"
239 {XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfFrameRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)0 },
240 #line 57 "Frame.w"
241 {XtNouterOffset,XtCOuterOffset,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.outerOffset),XtOffsetOf(XfwfFrameRec,xfwfFrame.outerOffset),XtRImmediate,(XtPointer)0 },
242 #line 62 "Frame.w"
243 {XtNinnerOffset,XtCInnerOffset,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.innerOffset),XtOffsetOf(XfwfFrameRec,xfwfFrame.innerOffset),XtRImmediate,(XtPointer)0 },
244 #line 86 "Frame.w"
245 {XtNshadowScheme,XtCShadowScheme,XtRShadowScheme,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.shadowScheme),XtOffsetOf(XfwfFrameRec,xfwfFrame.shadowScheme),XtRImmediate,(XtPointer)XfwfAuto },
246 #line 87 "Frame.w"
247 {XtNtopShadowColor,XtCTopShadowColor,XtRPixel,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.topShadowColor),XtOffsetOf(XfwfFrameRec,xfwfFrame.topShadowColor),XtRCallProc,(XtPointer)compute_topcolor },
248 #line 88 "Frame.w"
249 {XtNbottomShadowColor,XtCBottomShadowColor,XtRPixel,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.bottomShadowColor),XtOffsetOf(XfwfFrameRec,xfwfFrame.bottomShadowColor),XtRCallProc,(XtPointer)compute_bottomcolor },
250 #line 89 "Frame.w"
251 {XtNtopShadowStipple,XtCTopShadowStipple,XtRBitmap,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.topShadowStipple),XtOffsetOf(XfwfFrameRec,xfwfFrame.topShadowStipple),XtRImmediate,(XtPointer)NULL },
252 #line 90 "Frame.w"
253 {XtNbottomShadowStipple,XtCBottomShadowStipple,XtRBitmap,sizeof(((XfwfFrameRec*)NULL)->xfwfFrame.bottomShadowStipple),XtOffsetOf(XfwfFrameRec,xfwfFrame.bottomShadowStipple),XtRImmediate,(XtPointer)NULL },
254 #line 95 "Frame.w"
255 {XtNborderWidth,XtCBorderWidth,XtRDimension,sizeof(((XfwfFrameRec*)NULL)->core.border_width),XtOffsetOf(XfwfFrameRec,core.border_width),XtRImmediate,(XtPointer)0 },
256 };
257 
258 XfwfFrameClassRec xfwfFrameClassRec = {
259 { /* core_class part */
260 (WidgetClass) &xfwfCommonClassRec,
261 "XfwfFrame",
262 sizeof(XfwfFrameRec),
263 class_initialize,
264 _resolve_inheritance,
265 FALSE,
266 initialize,
267 NULL,
268 realize,
269 actionsList,
270 1,
271 resources,
272 11,
273 NULLQUARK,
274 True ,
275 XtExposeCompressMultiple ,
276 True ,
277 False ,
278 NULL,
279 resize,
280 expose,
281 set_values,
282 NULL,
283 XtInheritSetValuesAlmost,
284 NULL,
285 XtInheritAcceptFocus,
286 XtVersion,
287 NULL,
288 NULL,
289 query_geometry,
290 XtInheritDisplayAccelerator,
291 NULL
292 },
293 { /* composite_class part */
294 geometry_manager,
295 change_managed,
296 XtInheritInsertChild,
297 XtInheritDeleteChild,
298 NULL
299 },
300 { /* XfwfCommon_class part */
301 compute_inside,
302 total_frame_width,
303 XtInherit_highlight_border,
304 XtInherit_unhighlight_border,
305 XtInherit_would_accept_focus,
306 XtInherit_traverse,
307 XtInherit_lighter_color,
308 XtInherit_darker_color,
309 NULL ,
310 },
311 { /* XfwfFrame_class part */
312 0
313 },
314 };
315 WidgetClass xfwfFrameWidgetClass = (WidgetClass) &xfwfFrameClassRec;
316 /*ARGSUSED*/
317 #line 521 "Frame.w"
set_shadow(self,event,params,num_params)318 static void set_shadow(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params;
319 {
320     Position x, y;
321     Dimension w, h;
322     FrameType f = XfwfSunken;
323 
324     if (*num_params == 0) f = ((XfwfFrameWidget)self)->xfwfFrame.old_frame_type;	/* Reset to old style */
325     else if (strcmp("raised", params[0]) == 0) f = XfwfRaised;
326     else if (strcmp("sunken", params[0]) == 0) f = XfwfSunken;
327     else if (strcmp("chiseled", params[0]) == 0) f = XfwfChiseled;
328     else if (strcmp("ledged", params[0]) == 0) f = XfwfLedged;
329     else XtWarning("Unknown frame type in set_shadow action");
330 
331     if (((XfwfFrameWidget)self)->xfwfFrame.frameType != f) {
332 	((XfwfFrameWidget)self)->xfwfFrame.frameType = f;
333 	xfwfCommonClassRec.xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
334 	XfwfDrawFrame(self, x + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset, y + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset,
335 		      w - 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset, h - 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset,
336 		      ((XfwfFrameWidget)self)->xfwfFrame.frameType, ((XfwfFrameWidget)self)->xfwfFrame.frameWidth, ((XfwfFrameWidget)self)->xfwfFrame.lightgc, ((XfwfFrameWidget)self)->xfwfFrame.darkgc);
337     }
338 }
339 
_resolve_inheritance(class)340 static void _resolve_inheritance(class)
341 WidgetClass class;
342 {
343   XfwfFrameWidgetClass c = (XfwfFrameWidgetClass) class;
344   XfwfFrameWidgetClass super;
345   static CompositeClassExtensionRec extension_rec = {
346     NULL, NULLQUARK, XtCompositeExtensionVersion,
347     sizeof(CompositeClassExtensionRec), True};
348   CompositeClassExtensionRec *ext;
349   ext = (XtPointer)XtMalloc(sizeof(*ext));
350   *ext = extension_rec;
351   ext->next_extension = c->composite_class.extension;
352   c->composite_class.extension = ext;
353   if (class == xfwfFrameWidgetClass) return;
354   super = (XfwfFrameWidgetClass)class->core_class.superclass;
355 }
356 #line 201 "Frame.w"
class_initialize()357 /*ARGSUSED*/static void class_initialize()
358 {
359     static XtConvertArgRec screenArg[] = {
360     {XtBaseOffset, (XtPointer)XtOffset(Widget, core.screen), sizeof(Screen*)}};
361 
362     XtSetTypeConverter(XtRString, XtRFrameType, cvtStringToFrameType,
363 		       NULL, 0, XtCacheNone, NULL);
364     XtSetTypeConverter(XtRFrameType, XtRString, cvtFrameTypeToString,
365 		       NULL, 0, XtCacheNone, NULL);
366 
367     XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
368 		       screenArg, XtNumber(screenArg));
369 
370     XtSetTypeConverter(XtRString, XtRShadowScheme, cvtStringToShadowScheme,
371 		       NULL, 0, XtCacheNone, NULL);
372     XtSetTypeConverter(XtRShadowScheme, XtRString, cvtShadowSchemeToString,
373 		       NULL, 0, XtCacheNone, NULL);
374 }
375 #line 224 "Frame.w"
initialize(request,self,args,num_args)376 /*ARGSUSED*/static void initialize(request,self,args,num_args)Widget  request;Widget self;ArgList  args;Cardinal * num_args;
377 {
378     Dimension frame;
379     Position x, y;
380 
381     ((XfwfFrameWidget)self)->xfwfFrame.lightgc = NULL;
382     ((XfwfFrameWidget)self)->xfwfFrame.darkgc = NULL;
383     ((XfwfFrameWidget)self)->xfwfFrame.old_frame_type = ((XfwfFrameWidget)self)->xfwfFrame.frameType;
384     /* Make sure the width and height are at least as large as the frame */
385     frame = ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
386     if (((XfwfFrameWidget)self)->core.width < 2 * frame) ((XfwfFrameWidget)self)->core.width = 2 * frame;
387     if (((XfwfFrameWidget)self)->core.height < 2 * frame) ((XfwfFrameWidget)self)->core.height = 2 * frame;
388 }
389 #line 248 "Frame.w"
realize(self,mask,attributes)390 /*ARGSUSED*/static void realize(self,mask,attributes)Widget self;XtValueMask * mask;XSetWindowAttributes * attributes;
391 {
392     *mask |= CWCursor;
393     attributes->cursor = ((XfwfFrameWidget)self)->xfwfFrame.cursor;
394     xfwfCommonClassRec.core_class.realize(self, mask, attributes);
395 
396     ((XfwfFrameWidget)self)->xfwfFrame.stip4 = XCreateBitmapFromData(XtDisplay(self), XtWindow(self),
397         stip4_bits, stip4_width, stip4_height);
398 
399     if (! ((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple) ((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple = ((XfwfFrameWidget)self)->xfwfFrame.stip4;
400     if (! ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple) ((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple = ((XfwfFrameWidget)self)->xfwfFrame.stip4;
401 
402     create_lightgc(self);
403     create_darkgc(self);
404 }
405 #line 276 "Frame.w"
set_values(old,request,self,args,num_args)406 /*ARGSUSED*/static Boolean  set_values(old,request,self,args,num_args)Widget  old;Widget  request;Widget self;ArgList  args;Cardinal * num_args;
407 {
408     Boolean need_redisplay = False;
409 
410     if (((XfwfFrameWidget)self)->xfwfFrame.cursor != ((XfwfFrameWidget)old)->xfwfFrame.cursor && XtIsRealized(self))
411 	XDefineCursor(XtDisplay(self), XtWindow(self), ((XfwfFrameWidget)self)->xfwfFrame.cursor);
412 
413     if (((XfwfFrameWidget)self)->xfwfFrame.frameType == XfwfChiseled || ((XfwfFrameWidget)self)->xfwfFrame.frameType == XfwfLedged)
414 	((XfwfFrameWidget)self)->xfwfFrame.frameWidth = 2 * ((int) (((XfwfFrameWidget)self)->xfwfFrame.frameWidth / 2));
415 
416     if (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme != ((XfwfFrameWidget)old)->xfwfFrame.shadowScheme) {
417 	create_darkgc(self);
418 	create_lightgc(self);
419 	need_redisplay = True;
420     } else if (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme == XfwfColor) {
421 	if (((XfwfFrameWidget)self)->xfwfFrame.topShadowColor != ((XfwfFrameWidget)old)->xfwfFrame.topShadowColor) {
422 	    create_lightgc(self);
423 	    need_redisplay = True;
424 	}
425 	if (((XfwfFrameWidget)self)->xfwfFrame.bottomShadowColor != ((XfwfFrameWidget)old)->xfwfFrame.bottomShadowColor) {
426 	    create_darkgc(self);
427 	    need_redisplay = True;
428 	}
429     } else if (((XfwfFrameWidget)self)->xfwfFrame.shadowScheme == XfwfStipple) {
430 	if (((XfwfFrameWidget)self)->xfwfFrame.topShadowStipple != ((XfwfFrameWidget)old)->xfwfFrame.topShadowStipple) {
431 	    create_lightgc(self);
432 	    need_redisplay = True;
433 	}
434 	if (((XfwfFrameWidget)self)->xfwfFrame.bottomShadowStipple != ((XfwfFrameWidget)old)->xfwfFrame.bottomShadowStipple) {
435 	    create_darkgc(self);
436 	    need_redisplay = True;
437 	}
438     }
439 
440     if (((XfwfFrameWidget)self)->xfwfFrame.outerOffset != ((XfwfFrameWidget)old)->xfwfFrame.outerOffset)
441 	need_redisplay = True;
442 
443     if (((XfwfFrameWidget)self)->xfwfFrame.innerOffset != ((XfwfFrameWidget)old)->xfwfFrame.innerOffset)
444 	need_redisplay = True;
445 
446     if (((XfwfFrameWidget)self)->xfwfFrame.frameType != ((XfwfFrameWidget)old)->xfwfFrame.frameType) {
447 	((XfwfFrameWidget)self)->xfwfFrame.old_frame_type = ((XfwfFrameWidget)self)->xfwfFrame.frameType;
448 	need_redisplay = True;
449     }
450 
451     if (((XfwfFrameWidget)self)->xfwfFrame.frameWidth != ((XfwfFrameWidget)old)->xfwfFrame.frameWidth)
452 	need_redisplay = True;
453     else if (((XfwfFrameWidget)self)->xfwfFrame.frameWidth == 0)
454 	need_redisplay = False;
455 
456     return need_redisplay;
457 }
458 #line 338 "Frame.w"
expose(self,event,region)459 /*ARGSUSED*/static void expose(self,event,region)Widget self;XEvent * event;Region  region;
460 {
461     Position x, y;
462     Dimension w, h;
463 
464     if (! XtIsRealized(self)) return;
465     if (region != NULL) {
466 	XSetRegion(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.lightgc, region);
467 	XSetRegion(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.darkgc, region);
468     }
469     xfwfCommonClassRec.xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
470     XfwfDrawFrame(self, x + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset, y + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset, w - 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset,
471 	 h - 2*((XfwfFrameWidget)self)->xfwfFrame.outerOffset, ((XfwfFrameWidget)self)->xfwfFrame.frameType, ((XfwfFrameWidget)self)->xfwfFrame.frameWidth, ((XfwfFrameWidget)self)->xfwfFrame.lightgc, ((XfwfFrameWidget)self)->xfwfFrame.darkgc);
472     if (region != NULL) {
473 	XSetClipMask(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.lightgc, None);
474 	XSetClipMask(XtDisplay(self), ((XfwfFrameWidget)self)->xfwfFrame.darkgc, None);
475     }
476     xfwfCommonClassRec.core_class.expose(self, event, region);
477 }
478 #line 362 "Frame.w"
compute_inside(self,x,y,w,h)479 /*ARGSUSED*/static void compute_inside(self,x,y,w,h)Widget self;Position * x;Position * y;Dimension * w;Dimension * h;
480 {
481     xfwfCommonClassRec.xfwfCommon_class.compute_inside(self, x, y, w, h);
482     *x += ((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset;
483     *y += ((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset;
484     *w -= 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset);
485     *h -= 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset);
486 }
487 #line 375 "Frame.w"
total_frame_width(self)488 /*ARGSUSED*/static Dimension  total_frame_width(self)Widget self;
489 {
490     return xfwfCommonClassRec.xfwfCommon_class.total_frame_width(self) + ((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset ;
491 }
492 #line 385 "Frame.w"
query_geometry(self,request,reply)493 /*ARGSUSED*/static XtGeometryResult  query_geometry(self,request,reply)Widget self;XtWidgetGeometry * request;XtWidgetGeometry * reply;
494 {
495     XtWidgetGeometry request2, reply2;
496     XtGeometryResult result;
497     Dimension h;
498 
499     if (((XfwfFrameWidget)self)->composite.num_children == 0) return XtGeometryYes;
500 
501     /* We're only interested in size and stacking order */
502     reply->request_mode =
503 	(CWWidth | CWHeight | CWStackMode) & request->request_mode;
504 
505     /* If nothing of interest is left, we can return immediately */
506     if (reply->request_mode == 0)
507 	return XtGeometryYes;
508 
509     /* Prepare a request to the child */
510     h = 2 * (((XfwfFrameWidget)self)->xfwfFrame.outerOffset + ((XfwfFrameWidget)self)->xfwfFrame.frameWidth + ((XfwfFrameWidget)self)->xfwfFrame.innerOffset);
511     request2.request_mode = reply->request_mode;
512     request2.width = request->width - h;
513     request2.height = request->height - h;
514     request2.sibling = request->sibling;
515     request2.stack_mode = request->stack_mode;
516 
517     result = XtQueryGeometry(((XfwfFrameWidget)self)->composite.children[0], &request2, &reply2);
518 
519     /* If the child accepted its proposal, we accept ours */
520     if (result == XtGeometryYes) return XtGeometryYes;
521 
522     /* If the child doesn't want any change, we don't want any, either */
523     if (result == XtGeometryNo) return XtGeometryNo;
524 
525     /* Otherwise, ignore everything but size and stacking order */
526     reply->request_mode &= reply2.request_mode;
527     if (reply->request_mode == 0) return XtGeometryYes;
528 
529     reply->width = reply2.width + h;
530     reply->height = reply2.height + h;
531     reply->sibling = reply2.sibling;
532     reply->stack_mode = reply2.stack_mode;
533     return XtGeometryAlmost;
534 }
535 #line 438 "Frame.w"
geometry_manager(child,request,reply)536 /*ARGSUSED*/static XtGeometryResult  geometry_manager(child,request,reply)Widget  child;XtWidgetGeometry * request;XtWidgetGeometry * reply;
537 { Widget self = XtParent(child); {
538     XtWidgetGeometry request2, reply2;
539     XtGeometryResult result;
540     Position x, y;
541     Dimension w, h, extraw, extrah;
542 
543     ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
544     if (! (request->request_mode & (CWWidth|CWHeight))) return XtGeometryYes;
545     extraw = ((XfwfFrameWidget)self)->core.width - w;
546     extrah = ((XfwfFrameWidget)self)->core.height - h;
547     request2.request_mode = request->request_mode & (CWWidth|CWHeight);
548     request2.width = request->width + extraw;
549     request2.height = request->height + extrah;
550     result = XtMakeGeometryRequest(self, &request2, &reply2);
551     if (result == XtGeometryNo) return XtGeometryNo;
552     if (result == XtGeometryYes) return XtGeometryYes;
553     reply->request_mode = reply2.request_mode & (CWWidth|CWHeight);
554     reply->width = reply2.width - extraw;
555     reply->height = reply2.height - extrah;
556     return XtGeometryAlmost;
557 }
558 }
559 #line 465 "Frame.w"
resize(self)560 /*ARGSUSED*/static void resize(self)Widget self;
561 {
562     Position x, y;
563     Dimension w, h;
564     Widget child;
565 
566     if (((XfwfFrameWidget)self)->composite.num_children == 0) return;
567     ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
568     child = ((XfwfFrameWidget)self)->composite.children[0];
569     w -= 2 * ((XfwfFrameWidget)child)->core.border_width;
570     h -= 2 * ((XfwfFrameWidget)child)->core.border_width;
571     XtConfigureWidget(child, x, y, w, h, ((XfwfFrameWidget)child)->core.border_width);
572 }
573 #line 486 "Frame.w"
change_managed(self)574 /*ARGSUSED*/static void change_managed(self)Widget self;
575 {
576     XtWidgetGeometry request2, reply2;
577     XtGeometryResult result;
578     Widget child;
579     Position x, y;
580     Dimension w, h;
581 
582     if (((XfwfFrameWidget)self)->composite.num_children == 0) return;
583     ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
584     child = ((XfwfFrameWidget)self)->composite.children[0];
585     request2.request_mode = CWWidth | CWHeight;
586     request2.width = ((XfwfFrameWidget)child)->core.width + ((XfwfFrameWidget)self)->core.width - w;
587     request2.height = ((XfwfFrameWidget)child)->core.height + ((XfwfFrameWidget)self)->core.height - h;
588     result = XtMakeGeometryRequest(self, &request2, &reply2);
589     ((XfwfFrameWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
590     w -= 2 * ((XfwfFrameWidget)child)->core.border_width;
591     h -= 2 * ((XfwfFrameWidget)child)->core.border_width;
592     XtConfigureWidget(child, x, y, w, h, ((XfwfFrameWidget)child)->core.border_width);
593 }
594 #line 103 "Frame.w"
595 #line 109 "Frame.w"
596 #line 114 "Frame.w"
597 #line 120 "Frame.w"
XfwfDrawFrame(self,x,y,w,h,tp,t,lightgc,darkgc)598 /*ARGSUSED*/void XfwfDrawFrame(self,x,y,w,h,tp,t,lightgc,darkgc)Widget self;int  x;int  y;int  w;int  h;FrameType  tp;int  t;GC  lightgc;GC  darkgc;
599 {
600     XPoint tlPoints[7], brPoints[7];
601 
602     if (t == 0) return;
603     switch (tp) {
604     case XfwfRaised:
605     case XfwfSunken:
606 	tlPoints[0].x = x;		tlPoints[0].y = y;
607 	tlPoints[1].x = x + w;		tlPoints[1].y = y;
608 	tlPoints[2].x = x + w - t;	tlPoints[2].y = y + t;
609 	tlPoints[3].x = x + t;		tlPoints[3].y = y + t;
610 	tlPoints[4].x = x + t;		tlPoints[4].y = y + h - t;
611 	tlPoints[5].x = x;		tlPoints[5].y = y + h;
612 	tlPoints[6].x = x;		tlPoints[6].y = y;
613 	brPoints[0].x = x + w;		brPoints[0].y = y + h;
614 	brPoints[1].x = x;		brPoints[1].y = y + h;
615 	brPoints[2].x = x + t;		brPoints[2].y = y + h - t;
616 	brPoints[3].x = x + w - t;	brPoints[3].y = y + h - t;
617 	brPoints[4].x = x + w - t;	brPoints[4].y = y + t;
618 	brPoints[5].x = x + w;		brPoints[5].y = y;
619 	brPoints[6].x = x + w;		brPoints[6].y = y + h;
620 	if (tp == XfwfSunken) {
621 	    XFillPolygon(XtDisplay(self), XtWindow(self),
622 			 darkgc, tlPoints, 7, Nonconvex, CoordModeOrigin);
623 	    XFillPolygon(XtDisplay(self), XtWindow(self),
624 			 lightgc, brPoints, 7, Nonconvex, CoordModeOrigin);
625 	} else {
626 	    XFillPolygon(XtDisplay(self), XtWindow(self),
627 			 lightgc, tlPoints, 7, Nonconvex, CoordModeOrigin);
628 	    XFillPolygon(XtDisplay(self), XtWindow(self),
629 			 darkgc, brPoints, 7, Nonconvex, CoordModeOrigin);
630 	}
631 	break;
632     case XfwfLedged:
633 	XfwfDrawFrame(self, x, y, w, h, XfwfRaised, t/2, lightgc, darkgc);
634 	XfwfDrawFrame(self, x+t/2, y+t/2, w-2*(int)(t/2), h-2*(int)(t/2),
635 		  XfwfSunken, t/2, lightgc, darkgc);
636 	break;
637     case XfwfChiseled:
638 	XfwfDrawFrame(self, x, y, w, h, XfwfSunken, t/2, lightgc, darkgc);
639 	XfwfDrawFrame(self, x+t/2, y+t/2, w-2*(int)(t/2), h-2*(int)(t/2),
640 		  XfwfRaised, t/2, lightgc, darkgc);
641 	break;
642     }
643 
644 }
645 #line 569 "Frame.w"
cvtStringToFrameType(display,args,num_args,from,to,converter_data)646 /*ARGSUSED*/Boolean  cvtStringToFrameType(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr  args;Cardinal * num_args;XrmValuePtr  from;XrmValuePtr  to;XtPointer * converter_data;
647 {
648     String s = (String) from->addr;
649 
650     if (*num_args != 0)
651 	XtAppErrorMsg(XtDisplayToApplicationContext(display),
652 		      "cvtStringToFrameType", "wrongParameters",
653 		      "XtToolkitError",
654 		      "String to frame type conversion needs no arguments",
655 		      (String*) NULL, (Cardinal*) NULL);
656 
657     if (XmuCompareISOLatin1(s, "raised") == 0) done(FrameType, XfwfRaised);
658     if (XmuCompareISOLatin1(s, "sunken") == 0) done(FrameType, XfwfSunken);
659     if (XmuCompareISOLatin1(s, "chiseled") == 0) done(FrameType, XfwfChiseled);
660     if (XmuCompareISOLatin1(s, "ledged") == 0) done(FrameType, XfwfLedged);
661     XtDisplayStringConversionWarning(display, s, XtRFrameType);
662     done(FrameType, XfwfRaised);
663 }
664 #line 590 "Frame.w"
cvtFrameTypeToString(display,args,num_args,from,to,converter_data)665 /*ARGSUSED*/Boolean  cvtFrameTypeToString(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr  args;Cardinal * num_args;XrmValuePtr  from;XrmValuePtr  to;XtPointer * converter_data;
666 {
667     if (*num_args != 0)
668 	XtAppErrorMsg(XtDisplayToApplicationContext(display),
669 		      "cvtFrameTypeToString", "wrongParameters",
670 		      "XtToolkitError",
671 		      "Fframe type to String conversion needs no arguments",
672 		      (String*) NULL, (Cardinal*) NULL);
673     switch (*(FrameType*)from->addr) {
674     case XfwfRaised: done(String, "raised");
675     case XfwfSunken: done(String, "sunken");
676     case XfwfChiseled: done(String, "chiseled");
677     case XfwfLedged: done(String, "ledged");
678     default: XtError("Illegal FrameType");
679     }
680 }
681 #line 612 "Frame.w"
cvtStringToShadowScheme(display,args,num_args,from,to,converter_data)682 /*ARGSUSED*/Boolean  cvtStringToShadowScheme(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr  args;Cardinal * num_args;XrmValuePtr  from;XrmValuePtr  to;XtPointer * converter_data;
683 {
684     String s = (String) from->addr;
685 
686     if (*num_args != 0)
687 	XtAppErrorMsg(XtDisplayToApplicationContext(display),
688 		      "cvtStringToShadowScheme", "wrongParameters",
689 		      "XtToolkitError",
690 		      "String to shadow scheme conversion needs no arguments",
691 		      (String*) NULL, (Cardinal*) NULL);
692 
693     if (XmuCompareISOLatin1(s, "auto")==0) done(ShadowScheme, XfwfAuto);
694     if (XmuCompareISOLatin1(s, "color")==0) done(ShadowScheme, XfwfColor);
695     if (XmuCompareISOLatin1(s, "stipple")==0) done(ShadowScheme, XfwfStipple);
696     XtDisplayStringConversionWarning(display, s, XtRShadowScheme);
697     done(ShadowScheme, XfwfAuto);
698 }
699 #line 632 "Frame.w"
cvtShadowSchemeToString(display,args,num_args,from,to,converter_data)700 /*ARGSUSED*/Boolean  cvtShadowSchemeToString(display,args,num_args,from,to,converter_data)Display * display;XrmValuePtr  args;Cardinal * num_args;XrmValuePtr  from;XrmValuePtr  to;XtPointer * converter_data;
701 {
702     if (*num_args != 0)
703 	XtAppErrorMsg(XtDisplayToApplicationContext(display),
704 		      "cvtShadowSchemeToString", "wrongParameters",
705 		      "XtToolkitError",
706 		      "Shadow scheme to String conversion needs no arguments",
707 		      (String*) NULL, (Cardinal*) NULL);
708 
709     switch (*(ShadowScheme*)from->addr) {
710     case XfwfAuto: done(String, "auto");
711     case XfwfColor: done(String, "color");
712     case XfwfStipple: done(String, "stipple");
713     default: XtError("Illegal ShadowScheme");
714     }
715 }
716