Back to index

plt-scheme  4.2.1
xwEnforcer.c
Go to the documentation of this file.
00001 /* Generated by wbuild
00002  * (generator version 3.2)
00003  */
00004 #include <X11/IntrinsicP.h>
00005 #include <X11/StringDefs.h>
00006 #include <stdio.h>
00007 #include "xwTabString.h"
00008 #include <./xwEnforcerP.h>
00009 static void propagateKey(
00010 #if NeedFunctionPrototypes
00011 Widget,XEvent*,String*,Cardinal*
00012 #endif
00013 );
00014 
00015 static XtActionsRec actionsList[] = {
00016 {"propagateKey", propagateKey},
00017 };
00018 static void _resolve_inheritance(
00019 #if NeedFunctionPrototypes
00020 WidgetClass
00021 #endif
00022 );
00023 static void initialize(
00024 #if NeedFunctionPrototypes
00025 Widget ,Widget,ArgList ,Cardinal *
00026 #endif
00027 );
00028 static void destroy(
00029 #if NeedFunctionPrototypes
00030 Widget
00031 #endif
00032 );
00033 static Boolean  set_values(
00034 #if NeedFunctionPrototypes
00035 Widget ,Widget ,Widget,ArgList ,Cardinal *
00036 #endif
00037 );
00038 static void _expose(
00039 #if NeedFunctionPrototypes
00040 Widget,XEvent *,Region 
00041 #endif
00042 );
00043 static void resize(
00044 #if NeedFunctionPrototypes
00045 Widget
00046 #endif
00047 );
00048 static void insert_child(
00049 #if NeedFunctionPrototypes
00050 Widget 
00051 #endif
00052 );
00053 static void change_managed(
00054 #if NeedFunctionPrototypes
00055 Widget
00056 #endif
00057 );
00058 static XtGeometryResult  geometry_manager(
00059 #if NeedFunctionPrototypes
00060 Widget ,XtWidgetGeometry *,XtWidgetGeometry *
00061 #endif
00062 );
00063 static void compute_inside(
00064 #if NeedFunctionPrototypes
00065 Widget,Position *,Position *,int *,int *
00066 #endif
00067 );
00068 static void highlight_border(
00069 #if NeedFunctionPrototypes
00070 Widget
00071 #endif
00072 );
00073 static void unhighlight_border(
00074 #if NeedFunctionPrototypes
00075 Widget
00076 #endif
00077 );
00078 static char  propagateTranslation[] = "<KeyPress> : propagateKey() \n <KeyRelease> : propagateKey()";;
00079 static XtTranslations  propagate_trans = NULL ;;
00080 static void compute_label_size(
00081 #if NeedFunctionPrototypes
00082 Widget
00083 #endif
00084 );
00085 static void make_textgc(
00086 #if NeedFunctionPrototypes
00087 Widget
00088 #endif
00089 );
00090 static void make_graygc(
00091 #if NeedFunctionPrototypes
00092 Widget
00093 #endif
00094 );
00095 /*ARGSUSED*/
00096 #if NeedFunctionPrototypes
00097 static void compute_label_size(Widget self)
00098 #else
00099 static void compute_label_size(self)Widget self;
00100 #endif
00101 {
00102     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.label) {
00103        int len = strlen(((XfwfEnforcerWidget)self)->xfwfEnforcer.label);
00104        ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelWidth  = XfwfTextWidth(XtDisplay(self), ((XfwfEnforcerWidget)self)->xfwfEnforcer.font, ((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont, ((XfwfEnforcerWidget)self)->xfwfEnforcer.label, len, NULL);
00105        ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelHeight = (wx_ASCENT(((XfwfEnforcerWidget)self)->xfwfEnforcer.font, ((wxExtFont)((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont))
00106                      + wx_DESCENT(((XfwfEnforcerWidget)self)->xfwfEnforcer.font, ((wxExtFont)((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont)));
00107     } else {
00108        ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelWidth = ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelHeight = 0;
00109     }
00110 }
00111 /*ARGSUSED*/
00112 #if NeedFunctionPrototypes
00113 static void make_textgc(Widget self)
00114 #else
00115 static void make_textgc(self)Widget self;
00116 #endif
00117 {
00118     XtGCMask mask;
00119     XGCValues values;
00120 
00121     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc != NULL) XtReleaseGC(self, ((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc);
00122     values.background = ((XfwfEnforcerWidget)self)->core.background_pixel;
00123     mask = GCBackground | GCForeground;
00124     if (!((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont) {
00125       values.foreground = ((XfwfEnforcerWidget)self)->xfwfEnforcer.foreground;
00126       values.font = ((XfwfEnforcerWidget)self)->xfwfEnforcer.font->fid;
00127       mask |= GCFont;
00128     } else 
00129       values.foreground = values.background;
00130     ((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc = XtGetGC(self, mask, &values);
00131 }
00132 /*ARGSUSED*/
00133 #if NeedFunctionPrototypes
00134 static void make_graygc(Widget self)
00135 #else
00136 static void make_graygc(self)Widget self;
00137 #endif
00138 {
00139     XtGCMask mask;
00140     XGCValues values;
00141 
00142     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc != NULL) XtReleaseGC(self, ((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc);
00143 
00144    if (!wx_enough_colors(XtScreen(self))) {
00145       /* A GC to draw over text: */
00146       values.foreground = ((XfwfEnforcerWidget)self)->core.background_pixel;
00147       values.stipple = GetGray(self);
00148       values.fill_style = FillStippled;
00149       mask = GCForeground | GCStipple | GCFillStyle;
00150     } else {
00151       /* A GC for drawing gray text: */
00152       static Pixel color;
00153       values.background = ((XfwfEnforcerWidget)self)->core.background_pixel;
00154       ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.darker_color(self, ((XfwfEnforcerWidget)self)->core.background_pixel, &color);
00155       values.foreground = color;
00156       mask = GCBackground | GCForeground;
00157       if (((XfwfEnforcerWidget)self)->xfwfEnforcer.font) {
00158        values.font = ((XfwfEnforcerWidget)self)->xfwfEnforcer.font->fid;
00159        mask |= GCFont;
00160       }
00161     }
00162  
00163     ((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc = XtGetGC(self, mask, &values);
00164 }
00165 
00166 static XtResource resources[] = {
00167 {XtNshrinkToFit,XtCShrinkToFit,XtRBoolean,sizeof(((XfwfEnforcerRec*)NULL)->xfwfEnforcer.shrinkToFit),XtOffsetOf(XfwfEnforcerRec,xfwfEnforcer.shrinkToFit),XtRImmediate,(XtPointer)FALSE },
00168 {XtNmultipleKids,XtCMultipleKids,XtRBoolean,sizeof(((XfwfEnforcerRec*)NULL)->xfwfEnforcer.multipleKids),XtOffsetOf(XfwfEnforcerRec,xfwfEnforcer.multipleKids),XtRImmediate,(XtPointer)FALSE },
00169 {XtNrel_width,XtCRel_width,XtRFloat,sizeof(((XfwfEnforcerRec*)NULL)->xfwfBoard.rel_width),XtOffsetOf(XfwfEnforcerRec,xfwfBoard.rel_width),XtRString,(XtPointer)"0.0"},
00170 {XtNrel_height,XtCRel_height,XtRFloat,sizeof(((XfwfEnforcerRec*)NULL)->xfwfBoard.rel_height),XtOffsetOf(XfwfEnforcerRec,xfwfBoard.rel_height),XtRString,(XtPointer)"0.0"},
00171 {XtNabs_width,XtCAbs_width,XtRPosition,sizeof(((XfwfEnforcerRec*)NULL)->xfwfBoard.abs_width),XtOffsetOf(XfwfEnforcerRec,xfwfBoard.abs_width),XtRImmediate,(XtPointer)10 },
00172 {XtNabs_height,XtCAbs_height,XtRPosition,sizeof(((XfwfEnforcerRec*)NULL)->xfwfBoard.abs_height),XtOffsetOf(XfwfEnforcerRec,xfwfBoard.abs_height),XtRImmediate,(XtPointer)10 },
00173 {XtNlabel,XtCLabel,XtRString,sizeof(((XfwfEnforcerRec*)NULL)->xfwfEnforcer.label),XtOffsetOf(XfwfEnforcerRec,xfwfEnforcer.label),XtRImmediate,(XtPointer)NULL },
00174 {XtNfont,XtCFont,XtRFontStruct,sizeof(((XfwfEnforcerRec*)NULL)->xfwfEnforcer.font),XtOffsetOf(XfwfEnforcerRec,xfwfEnforcer.font),XtRString,(XtPointer)XtDefaultFont },
00175 {XtNxfont,XtCXFont,XtRvoid,sizeof(((XfwfEnforcerRec*)NULL)->xfwfEnforcer.xfont),XtOffsetOf(XfwfEnforcerRec,xfwfEnforcer.xfont),XtRPointer,(XtPointer)NULL },
00176 {XtNforeground,XtCForeground,XtRPixel,sizeof(((XfwfEnforcerRec*)NULL)->xfwfEnforcer.foreground),XtOffsetOf(XfwfEnforcerRec,xfwfEnforcer.foreground),XtRString,(XtPointer)XtDefaultForeground },
00177 {XtNalignment,XtCAlignment,XtRAlignment,sizeof(((XfwfEnforcerRec*)NULL)->xfwfEnforcer.alignment),XtOffsetOf(XfwfEnforcerRec,xfwfEnforcer.alignment),XtRImmediate,(XtPointer)XfwfTop },
00178 {XtNpropagateTarget,XtCPropagateTarget,XtRPropagateTarget,sizeof(((XfwfEnforcerRec*)NULL)->xfwfEnforcer.propagateTarget),XtOffsetOf(XfwfEnforcerRec,xfwfEnforcer.propagateTarget),XtRImmediate,(XtPointer)0 },
00179 {XtNdrawgray,XtCDrawgray,XtRBoolean,sizeof(((XfwfEnforcerRec*)NULL)->xfwfEnforcer.drawgray),XtOffsetOf(XfwfEnforcerRec,xfwfEnforcer.drawgray),XtRImmediate,(XtPointer)FALSE },
00180 };
00181 
00182 XfwfEnforcerClassRec xfwfEnforcerClassRec = {
00183 { /* core_class part */
00184 /* superclass        */  (WidgetClass) &xfwfBoardClassRec,
00185 /* class_name        */  "XfwfEnforcer",
00186 /* widget_size       */  sizeof(XfwfEnforcerRec),
00187 /* class_initialize  */  NULL,
00188 /* class_part_initialize*/  _resolve_inheritance,
00189 /* class_inited      */  FALSE,
00190 /* initialize        */  initialize,
00191 /* initialize_hook   */  NULL,
00192 /* realize           */  XtInheritRealize,
00193 /* actions           */  actionsList,
00194 /* num_actions       */  1,
00195 /* resources         */  resources,
00196 /* num_resources     */  13,
00197 /* xrm_class         */  NULLQUARK,
00198 /* compres_motion    */  True ,
00199 /* compress_exposure        */  XtExposeCompressMaximal ,
00200 /* compress_enterleave      */  True ,
00201 /* visible_interest  */  False ,
00202 /* destroy           */  destroy,
00203 /* resize            */  resize,
00204 /* expose            */  XtInheritExpose,
00205 /* set_values        */  set_values,
00206 /* set_values_hook   */  NULL,
00207 /* set_values_almost        */  XtInheritSetValuesAlmost,
00208 /* get_values+hook   */  NULL,
00209 /* accept_focus      */  XtInheritAcceptFocus,
00210 /* version           */  XtVersion,
00211 /* callback_private  */  NULL,
00212 /* tm_table          */  NULL,
00213 /* query_geometry    */  XtInheritQueryGeometry,
00214 /* display_acceleator       */  XtInheritDisplayAccelerator,
00215 /* extension         */  NULL 
00216 },
00217 { /* composite_class part */
00218 geometry_manager,
00219 change_managed,
00220 insert_child,
00221 XtInheritDeleteChild,
00222 NULL
00223 },
00224 { /* XfwfCommon_class part */
00225 compute_inside,
00226 XtInherit_total_frame_width,
00227 _expose,
00228 highlight_border,
00229 unhighlight_border,
00230 XtInherit_hilite_callbacks,
00231 XtInherit_would_accept_focus,
00232 XtInherit_traverse,
00233 XtInherit_lighter_color,
00234 XtInherit_darker_color,
00235 XtInherit_set_color,
00236 /* traversal_trans */  NULL ,
00237 /* traversal_trans_small */  NULL ,
00238 /* travMode */  1 ,
00239 },
00240 { /* XfwfFrame_class part */
00241  /* dummy */  0
00242 },
00243 { /* XfwfBoard_class part */
00244 XtInherit_set_abs_location,
00245 },
00246 { /* XfwfEnforcer_class part */
00247  /* dummy */  0
00248 },
00249 };
00250 WidgetClass xfwfEnforcerWidgetClass = (WidgetClass) &xfwfEnforcerClassRec;
00251 /*ARGSUSED*/
00252 static void propagateKey(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params;
00253 {
00254 #if 0
00255     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.propagateTarget && ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.travMode)
00256       if (event->xkey.state & ControlMask)
00257        ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.travMode = 0;
00258 
00259     if (!((XfwfEnforcerWidget)self)->xfwfEnforcer.propagateTarget || ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.travMode)
00260       XtCallActionProc(self, "checkTraverse", event, NULL, 0);
00261 #endif
00262     
00263     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.propagateTarget /* && !$travMode */) {
00264        event->xkey.display  = XtDisplay(((XfwfEnforcerWidget)self)->xfwfEnforcer.propagateTarget);
00265        event->xkey.send_event      = True;
00266        event->xkey.window   = XtWindow(((XfwfEnforcerWidget)self)->xfwfEnforcer.propagateTarget);
00267        XSendEvent(XtDisplay(((XfwfEnforcerWidget)self)->xfwfEnforcer.propagateTarget), XtWindow(((XfwfEnforcerWidget)self)->xfwfEnforcer.propagateTarget),
00268                  FALSE, KeyPressMask | KeyReleaseMask, event);
00269     }
00270 }
00271 
00272 static void _resolve_inheritance(class)
00273 WidgetClass class;
00274 {
00275   XfwfEnforcerWidgetClass c = (XfwfEnforcerWidgetClass) class;
00276   XfwfEnforcerWidgetClass super;
00277   static CompositeClassExtensionRec extension_rec = {
00278     NULL, NULLQUARK, XtCompositeExtensionVersion,
00279     sizeof(CompositeClassExtensionRec), True};
00280   CompositeClassExtensionRec *ext;
00281   ext = (XtPointer)XtMalloc(sizeof(*ext));
00282   *ext = extension_rec;
00283   ext->next_extension = c->composite_class.extension;
00284   c->composite_class.extension = ext;
00285   if (class == xfwfEnforcerWidgetClass) return;
00286   super = (XfwfEnforcerWidgetClass)class->core_class.superclass;
00287 }
00288 /*ARGSUSED*/
00289 #if NeedFunctionPrototypes
00290 static void initialize(Widget  request,Widget self,ArgList  args,Cardinal * num_args)
00291 #else
00292 static void initialize(request,self,args,num_args)Widget  request;Widget self;ArgList  args;Cardinal * num_args;
00293 #endif
00294 {
00295     if (propagate_trans == NULL)
00296         propagate_trans = XtParseTranslationTable(propagateTranslation);
00297 
00298     XtAugmentTranslations(self, propagate_trans);
00299 
00300     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.label)
00301       ((XfwfEnforcerWidget)self)->xfwfEnforcer.label = XtNewString(((XfwfEnforcerWidget)self)->xfwfEnforcer.label);
00302     ((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc = NULL;
00303     ((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc = NULL;
00304     /* make_textgc($); - On demand */
00305     compute_label_size(self);
00306 }
00307 /*ARGSUSED*/
00308 #if NeedFunctionPrototypes
00309 static void destroy(Widget self)
00310 #else
00311 static void destroy(self)Widget self;
00312 #endif
00313 {
00314   if (((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc) XtReleaseGC(self, ((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc); ((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc = NULL;
00315   if (((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc) XtReleaseGC(self, ((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc); ((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc = NULL;
00316 }
00317 /*ARGSUSED*/
00318 #if NeedFunctionPrototypes
00319 static Boolean  set_values(Widget  old,Widget  request,Widget self,ArgList  args,Cardinal * num_args)
00320 #else
00321 static Boolean  set_values(old,request,self,args,num_args)Widget  old;Widget  request;Widget self;ArgList  args;Cardinal * num_args;
00322 #endif
00323 {
00324     Boolean need_redraw = False;
00325 
00326     if ((((XfwfEnforcerWidget)self)->core.background_pixel != ((XfwfEnforcerWidget)old)->core.background_pixel) && ((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc)
00327        make_graygc(self);
00328 
00329     if (((XfwfEnforcerWidget)old)->xfwfEnforcer.label != ((XfwfEnforcerWidget)self)->xfwfEnforcer.label) {
00330        if (((XfwfEnforcerWidget)old)->xfwfEnforcer.label)
00331          XtFree(((XfwfEnforcerWidget)old)->xfwfEnforcer.label);
00332        if (((XfwfEnforcerWidget)self)->xfwfEnforcer.label)
00333          ((XfwfEnforcerWidget)self)->xfwfEnforcer.label = XtNewString(((XfwfEnforcerWidget)self)->xfwfEnforcer.label);
00334        need_redraw = True;
00335     }
00336     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.font != ((XfwfEnforcerWidget)old)->xfwfEnforcer.font || ((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont != ((XfwfEnforcerWidget)old)->xfwfEnforcer.xfont || ((XfwfEnforcerWidget)self)->xfwfEnforcer.foreground != ((XfwfEnforcerWidget)old)->xfwfEnforcer.foreground) {
00337        if (((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc) make_textgc(self);
00338        if (((XfwfEnforcerWidget)self)->xfwfEnforcer.label != NULL)
00339            need_redraw = True;
00340     }
00341     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.label != ((XfwfEnforcerWidget)old)->xfwfEnforcer.label || ((XfwfEnforcerWidget)self)->xfwfEnforcer.font != ((XfwfEnforcerWidget)old)->xfwfEnforcer.font || ((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont != ((XfwfEnforcerWidget)old)->xfwfEnforcer.xfont)
00342        compute_label_size(self);
00343 
00344     /* adjust board abs variables */
00345     if (((XfwfEnforcerWidget)self)->core.width != ((XfwfEnforcerWidget)old)->core.width)
00346        ((XfwfEnforcerWidget)self)->xfwfBoard.abs_width = ((XfwfEnforcerWidget)self)->core.width;
00347     if (((XfwfEnforcerWidget)self)->core.height != ((XfwfEnforcerWidget)old)->core.height)
00348        ((XfwfEnforcerWidget)self)->xfwfBoard.abs_height = ((XfwfEnforcerWidget)self)->core.height;
00349 
00350     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.label && (((XfwfEnforcerWidget)self)->xfwfEnforcer.drawgray != ((XfwfEnforcerWidget)old)->xfwfEnforcer.drawgray))
00351       need_redraw = True;
00352 
00353     return need_redraw;
00354 }
00355 /*ARGSUSED*/
00356 #if NeedFunctionPrototypes
00357 static void _expose(Widget self,XEvent * event,Region  region)
00358 #else
00359 static void _expose(self,event,region)Widget self;XEvent * event;Region  region;
00360 #endif
00361 {
00362     int w, h;
00363     Position x, y;
00364 
00365     if (! XtIsRealized(self)) return;
00366     xfwfBoardClassRec.xfwfCommon_class._expose(self, event, region);
00367     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.label) {
00368         GC agc;
00369 
00370        if (!((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc) make_textgc(self);
00371        
00372        ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00373 
00374        w = max(0, w);
00375        h = max(0, h);
00376 
00377        if (((XfwfEnforcerWidget)self)->xfwfEnforcer.drawgray && !((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc)
00378          make_graygc(self);
00379 
00380        if (((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont)
00381          agc = ((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc;
00382        else
00383          agc = ((((XfwfEnforcerWidget)self)->xfwfEnforcer.drawgray && wx_enough_colors(XtScreen(self))) ? ((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc : ((XfwfEnforcerWidget)self)->xfwfEnforcer.textgc);
00384 
00385        switch (((XfwfEnforcerWidget)self)->xfwfEnforcer.alignment) {
00386        case XfwfTop:
00387          XfwfDrawImageString(XtDisplay(self), XtWindow(self), agc,
00388                            x, wx_ASCENT(((XfwfEnforcerWidget)self)->xfwfEnforcer.font, ((wxExtFont)((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont)),
00389                            ((XfwfEnforcerWidget)self)->xfwfEnforcer.label, strlen(((XfwfEnforcerWidget)self)->xfwfEnforcer.label), NULL, ((XfwfEnforcerWidget)self)->xfwfEnforcer.font, ((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont, !((XfwfEnforcerWidget)self)->xfwfEnforcer.drawgray, NULL);
00390          break;
00391        case XfwfTopLeft:
00392          XfwfDrawImageString(XtDisplay(self), XtWindow(self), agc,
00393                            0, y+wx_ASCENT(((XfwfEnforcerWidget)self)->xfwfEnforcer.font, ((wxExtFont)((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont)),
00394                            ((XfwfEnforcerWidget)self)->xfwfEnforcer.label, strlen(((XfwfEnforcerWidget)self)->xfwfEnforcer.label), NULL, ((XfwfEnforcerWidget)self)->xfwfEnforcer.font, ((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont, !((XfwfEnforcerWidget)self)->xfwfEnforcer.drawgray, NULL);
00395          break;
00396        case XfwfLeft:
00397          XfwfDrawImageString(XtDisplay(self), XtWindow(self), agc,
00398                            0, y+(h-((XfwfEnforcerWidget)self)->xfwfEnforcer.labelHeight)/2+wx_ASCENT(((XfwfEnforcerWidget)self)->xfwfEnforcer.font, ((wxExtFont)((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont)),
00399                            ((XfwfEnforcerWidget)self)->xfwfEnforcer.label, strlen(((XfwfEnforcerWidget)self)->xfwfEnforcer.label), NULL, ((XfwfEnforcerWidget)self)->xfwfEnforcer.font, ((XfwfEnforcerWidget)self)->xfwfEnforcer.xfont, !((XfwfEnforcerWidget)self)->xfwfEnforcer.drawgray, NULL);
00400          break;
00401        }
00402 
00403        if (((XfwfEnforcerWidget)self)->xfwfEnforcer.drawgray && !wx_enough_colors(XtScreen(self))) {
00404          XFillRectangle(XtDisplay(self), XtWindow(self), ((XfwfEnforcerWidget)self)->xfwfEnforcer.graygc, 
00405                       0, y, w + x, h);
00406        }
00407     }
00408 }
00409 /*ARGSUSED*/
00410 #if NeedFunctionPrototypes
00411 static void resize(Widget self)
00412 #else
00413 static void resize(self)Widget self;
00414 #endif
00415 {
00416   if (((XfwfEnforcerWidget)self)->xfwfEnforcer.multipleKids) {
00417     xfwfBoardClassRec.core_class.resize(self);
00418   } else {
00419     Position x, y;
00420     int w, h;
00421     Widget child;
00422 
00423     if (((XfwfEnforcerWidget)self)->composite.num_children == 0) return;
00424     ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00425     child = ((XfwfEnforcerWidget)self)->composite.children[0];
00426     w -= 2 * ((XfwfEnforcerWidget)child)->core.border_width;
00427     h -= 2 * ((XfwfEnforcerWidget)child)->core.border_width;
00428     XtConfigureWidget(child, x, y, max(1, w), max(1, h), ((XfwfEnforcerWidget)child)->core.border_width);
00429   }
00430 }
00431 /*ARGSUSED*/
00432 #if NeedFunctionPrototypes
00433 static void insert_child(Widget  child)
00434 #else
00435 static void insert_child(child)Widget  child;
00436 #endif
00437 { Widget self = XtParent(child); {
00438     xfwfBoardClassRec.composite_class.insert_child(child);
00439 
00440     if (!((XfwfEnforcerWidget)self)->xfwfEnforcer.multipleKids) {
00441       if (child == ((XfwfEnforcerWidget)self)->composite.children[0] && ((XfwfEnforcerWidget)self)->xfwfEnforcer.shrinkToFit) {
00442        Position x, y; int w, h, cw;
00443        
00444        ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00445        if (((XfwfEnforcerWidget)self)->xfwfEnforcer.alignment == XfwfTop)
00446          cw = max(((XfwfEnforcerWidget)child)->core.width, ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelWidth);
00447        else
00448          cw = max(1, ((XfwfEnforcerWidget)child)->core.width);
00449        w = cw + 2*((XfwfEnforcerWidget)child)->core.border_width + ((XfwfEnforcerWidget)self)->core.width - w;
00450        h = ((XfwfEnforcerWidget)self)->core.height - h + ((XfwfEnforcerWidget)child)->core.height + 2*((XfwfEnforcerWidget)child)->core.border_width;
00451        XtVaSetValues(self, XtNwidth, max(1, w), XtNheight, max(1, h), NULL);
00452       }
00453     }
00454 }
00455 }
00456 /*ARGSUSED*/
00457 #if NeedFunctionPrototypes
00458 static void change_managed(Widget self)
00459 #else
00460 static void change_managed(self)Widget self;
00461 #endif
00462 {
00463   if (((XfwfEnforcerWidget)self)->xfwfEnforcer.multipleKids) {
00464     xfwfBoardClassRec.composite_class.change_managed(self);
00465   } else {
00466     Widget child;
00467     Position x, y; int w, h;
00468 
00469     if (((XfwfEnforcerWidget)self)->composite.num_children == 0) return;
00470     ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00471     child = ((XfwfEnforcerWidget)self)->composite.children[0];
00472 
00473     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.shrinkToFit) {
00474        int selfw, selfh, cw;
00475 
00476        if (((XfwfEnforcerWidget)self)->xfwfEnforcer.alignment == XfwfTop)
00477          cw = max(((XfwfEnforcerWidget)child)->core.width, ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelWidth);
00478        else
00479          cw = max(1, ((XfwfEnforcerWidget)child)->core.width);
00480 
00481        selfw = ((XfwfEnforcerWidget)self)->core.width  - w + cw  + 2*((XfwfEnforcerWidget)child)->core.border_width;
00482        selfh = ((XfwfEnforcerWidget)self)->core.height - h + ((XfwfEnforcerWidget)child)->core.height + 2*((XfwfEnforcerWidget)child)->core.border_width;
00483 
00484        XtVaSetValues(self, XtNwidth, max(1, selfw), XtNheight, max(1, selfh), NULL);
00485        ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00486     } else  {
00487        w -= 2 * ((XfwfEnforcerWidget)child)->core.border_width;
00488        h -= 2 * ((XfwfEnforcerWidget)child)->core.border_width;
00489     }
00490     
00491     XtConfigureWidget(child, x, y, max(1, w), max(1, h), ((XfwfEnforcerWidget)child)->core.border_width);
00492   }
00493 }
00494 /*ARGSUSED*/
00495 #if NeedFunctionPrototypes
00496 static XtGeometryResult  geometry_manager(Widget  child,XtWidgetGeometry * request,XtWidgetGeometry * reply)
00497 #else
00498 static XtGeometryResult  geometry_manager(child,request,reply)Widget  child;XtWidgetGeometry * request;XtWidgetGeometry * reply;
00499 #endif
00500 { Widget self = XtParent(child); {
00501     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.shrinkToFit) {
00502        Position x, y; int w, h;
00503 
00504        /* ask parent to resize (granted because parent is a Board Widget) */
00505        ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00506        if (request->request_mode & CWWidth) {
00507            Dimension cw;
00508 
00509            if (((XfwfEnforcerWidget)self)->xfwfEnforcer.alignment == XfwfTop)
00510              cw = max(request->width, ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelWidth);
00511            else
00512              cw = max(1, request->width);
00513 
00514            w = ((XfwfEnforcerWidget)self)->core.width  - w + cw;
00515            XtVaSetValues(self, XtNwidth, max(1, w), NULL);
00516        }
00517        if (request->request_mode & CWHeight) {
00518          h = ((XfwfEnforcerWidget)self)->core.height - h + request->height;
00519          XtVaSetValues(self, XtNheight, max(1, h), NULL);
00520        }
00521        ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00522        XtConfigureWidget(child, x, y, max(1, w), max(1, h), ((XfwfEnforcerWidget)child)->core.border_width);
00523 
00524        return XtGeometryDone;
00525     }
00526     return XtGeometryNo;
00527 }
00528 }
00529 /*ARGSUSED*/
00530 #if NeedFunctionPrototypes
00531 static void compute_inside(Widget self,Position * x,Position * y,int * w,int * h)
00532 #else
00533 static void compute_inside(self,x,y,w,h)Widget self;Position * x;Position * y;int * w;int * h;
00534 #endif
00535 {
00536     xfwfBoardClassRec.xfwfCommon_class.compute_inside(self, x, y, w, h);
00537     /* change sizes to have enough space for the label */
00538     if (((XfwfEnforcerWidget)self)->xfwfEnforcer.label) {
00539        switch (((XfwfEnforcerWidget)self)->xfwfEnforcer.alignment) {
00540        case XfwfTop:
00541            *y += ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelHeight + ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness;
00542            *h -= ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelHeight + ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness;
00543            break;
00544        case XfwfLeft:
00545        case XfwfTopLeft:
00546            *x += ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelWidth + ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness;
00547            *w -= ((XfwfEnforcerWidget)self)->xfwfEnforcer.labelWidth + ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness;
00548            break;
00549        }
00550     }
00551 }
00552 /*ARGSUSED*/
00553 #if NeedFunctionPrototypes
00554 static void highlight_border(Widget self)
00555 #else
00556 static void highlight_border(self)Widget self;
00557 #endif
00558 {
00559     XRectangle  rect[4];
00560     Position    x, y;
00561     int   w, h, t;
00562 
00563     if (((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness == 0) return;
00564 
00565     ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00566     x -= ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
00567     y -= ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
00568     w += 2 * ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
00569     h += 2 * ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
00570 
00571     w = max(0, w);
00572     h = max(0, h);
00573     t = 1 /*$highlightThickness */;
00574 
00575     rect[0].x = x+1;
00576     rect[0].y = y;
00577     rect[0].width = w-2;
00578     rect[0].height = t;
00579 
00580     rect[1].x = x;
00581     rect[1].y = y+1;
00582     rect[1].width = t;
00583     rect[1].height = h-2;
00584 
00585     rect[2].x = ((XfwfEnforcerWidget)self)->core.width - t;
00586     rect[2].y = y+1;
00587     rect[2].width = t;
00588     rect[2].height = h-2;
00589 
00590     rect[3].x = x+1;
00591     rect[3].y = ((XfwfEnforcerWidget)self)->core.height - t;
00592     rect[3].width = w-2;
00593     rect[3].height = t;
00594 
00595     if (!((XfwfEnforcerWidget)self)->xfwfCommon.bordergc) create_bordergc(self);
00596     XFillRectangles(XtDisplay(self), XtWindow(self), ((XfwfEnforcerWidget)self)->xfwfCommon.bordergc, &rect[0], 4);
00597 }
00598 /*ARGSUSED*/
00599 #if NeedFunctionPrototypes
00600 static void unhighlight_border(Widget self)
00601 #else
00602 static void unhighlight_border(self)Widget self;
00603 #endif
00604 {
00605     Position   x, y;
00606     int  w, h;
00607 
00608     if (((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness == 0) return;
00609 
00610     ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.compute_inside(self, &x, &y, &w, &h);
00611     x -= ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
00612     y -= ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
00613     w += 2 * ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
00614     h += 2 * ((XfwfEnforcerWidgetClass)self->core.widget_class)->xfwfCommon_class.total_frame_width(self);
00615 
00616     w = max(w, 0);
00617     h = max(h, 0);
00618 
00619     XClearArea(XtDisplay(self), XtWindow(self), 
00620                x, y, w, ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness, False);
00621     XClearArea(XtDisplay(self), XtWindow(self),
00622                x, y, ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness, h, False);
00623     XClearArea(XtDisplay(self), XtWindow(self),
00624                ((XfwfEnforcerWidget)self)->core.width - ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness, y, 
00625                ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness, h, False);
00626     XClearArea(XtDisplay(self), XtWindow(self),
00627                x, ((XfwfEnforcerWidget)self)->core.height - ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness,
00628                w, ((XfwfEnforcerWidget)self)->xfwfCommon.highlightThickness, False);
00629 }