コード例 #1
0
ファイル: Gadget.c プロジェクト: att/uwin
static Boolean
set_values(Widget current, Widget request, Widget new_w, ArgList args, Cardinal *num_args)
{
    Boolean need_refresh = False;

	DEBUGOUT(_LtDebug(__FILE__, new_w, "XmGadget set_values\n"));

    /* Force the borderWidth to 0 */
    new_w->core.border_width = 0;

    if (!XmRepTypeValidValue(XmRepTypeGetId(XmRUnitType),
			     G_UnitType(new_w),
			     new_w))
    {
	G_UnitType(new_w) = G_UnitType(current);
    }

    if (!XmRepTypeValidValue(XmRepTypeGetId(XmRNavigationType),
			     G_NavigationType(new_w),
			     new_w))
    {
	G_NavigationType(new_w) = G_NavigationType(current);
    }

    _XmGadgetImportArgs(new_w, args, num_args);

    need_refresh = _XmNavigSetValues(current, request, new_w, args, num_args);

    return need_refresh;
}
コード例 #2
0
ファイル: DrawnB.c プロジェクト: att/uwin
static void
initialize(Widget request, Widget new_w,
	   ArgList args, Cardinal *num_args)
{
    DEBUGOUT(_LtDebug(__FILE__, new_w,
		      "initialize: %i args\n"
		      "\trequest X %5i Y %5i W %5i H %5i\n"
		      "\t  new_w X %5i Y %5i W %5i H %5i\n",
		      *num_args,
		      XtX(request), XtY(request),
		      XtWidth(request), XtHeight(request),
		      XtX(new_w), XtY(new_w),
		      XtWidth(new_w), XtHeight(new_w)));
    DEBUGOUT(_LtDebugPrintArgList(__FILE__, new_w, args, *num_args, False));

    /* check the RepType resources */
    if (!XmRepTypeValidValue(XmRepTypeGetId(XmRMultiClick),
			     DB_MultiClick(new_w), new_w))
	DB_MultiClick(new_w) = XmMULTICLICK_KEEP;
    if (!XmRepTypeValidValue(XmRepTypeGetId(XmRShadowType),
			     DB_ShadowType(new_w), new_w))
	DB_ShadowType(new_w) = XmSHADOW_ETCHED_IN;

    DB_Armed(new_w) = False;
    DB_Timer(new_w) = 0;
}
コード例 #3
0
ファイル: Gadget.c プロジェクト: att/uwin
static void
initialize(Widget request,
	   Widget new_w,
	   ArgList args,
	   Cardinal *num_args)
{
    XmBaseClassExt bce;

	DEBUGOUT(_LtDebug(__FILE__, new_w, "XmGadget initialize\n"));

    /* Force the borderWidth to 0 */
    new_w->core.border_width = 0;

    if (!XmRepTypeValidValue(XmRepTypeGetId(XmRNavigationType),
			     G_NavigationType(new_w),
			     new_w))
    {
	G_NavigationType(new_w) = XmNONE;
    }

    if (!XmRepTypeValidValue(XmRepTypeGetId(XmRUnitType),
			     G_UnitType(new_w),
			     new_w))
    {
	G_UnitType(new_w) = XmPIXELS;
    }

    if (XtWidth(request) == (Dimension)0)
    {
	XtWidth(new_w) = (G_HighlightThickness(new_w) * 2
			  + G_ShadowThickness(new_w) * 2);
    }
    if (XtHeight(request) == (Dimension)0)
    {
	XtHeight(new_w) = (G_HighlightThickness(new_w) * 2
			   + G_ShadowThickness(new_w) * 2);
    }

    _XmGadgetImportArgs(new_w, args, num_args);

    /* BaseClass stuff provides this */
    _XmGadgetImportSecondaryArgs(new_w, args, num_args);

    bce = *(XmBaseClassExt *)_XmGetBaseClassExtPtr(XtClass(new_w), XmQmotif);

    if (bce && bce->secondaryObjectClass)
    {
	if (bce->secondaryObjectCreate)
	{
	    (bce->secondaryObjectCreate) (request, new_w, args, num_args);
	}
    }

    _XmNavigInitialize(request, new_w, args, num_args);

    G_EventMask(new_w) = 0;
    G_HaveTraversal(new_w) = False;
    G_Highlighted(new_w) = False;
    G_HighlightDrawn(new_w) = False;
}
コード例 #4
0
ファイル: DrawnB.c プロジェクト: att/uwin
static Boolean
set_values(Widget old, Widget request, Widget new_w,
	   ArgList args, Cardinal *num_args)
{
    Boolean refresh_needed = False;

    DEBUGOUT(_LtDebug(__FILE__, new_w,
		      "set_values: %i args\n"
		      "\t    old X %5i Y %5i W %5i H %5i\n"
		      "\trequest X %5i Y %5i W %5i H %5i\n"
		      "\t  new_w X %5i Y %5i W %5i H %5i\n",
		      *num_args,
		      XtX(old), XtY(old),
		      XtWidth(old), XtHeight(old),
		      XtX(request), XtY(request),
		      XtWidth(request), XtHeight(request),
		      XtX(new_w), XtY(new_w),
		      XtWidth(new_w), XtHeight(new_w)));
    DEBUGOUT(_LtDebugPrintArgList(__FILE__, new_w, args, *num_args, False));

    /* check the RepType resources */
    if (!XmRepTypeValidValue(XmRepTypeGetId(XmRMultiClick),
			     DB_MultiClick(new_w), new_w))
	DB_MultiClick(new_w) = DB_MultiClick(old);
    if (!XmRepTypeValidValue(XmRepTypeGetId(XmRShadowType),
			     DB_ShadowType(new_w), new_w))
	DB_ShadowType(new_w) = DB_ShadowType(old);

    if (DB_ShadowType(old) != DB_ShadowType(new_w))
    {
	refresh_needed = True;
    }

    /* rws 23 Jul 1997
       Label will have polluted the height and width since it will not
       be able to determine the correct size, since it does not know what
       is in the window!  Therefore if the size has changed use the
       requested size.
       xdir top right hand logo button
       JHG: If there's something identifiable in the button, trust Label.
       rws 11 Sep 1999
       Don't trust Label. Take a look at drawnbutton/test9
     */
    if (/* !Lab_TextRect_height(new_w) && */
	(XtWidth(new_w) != XtWidth(request) ||
	 XtHeight(new_w) != XtHeight(request)))
    {
	XtWidth(new_w) = XtWidth(request);
	XtHeight(new_w) = XtHeight(request);
	refresh_needed = True;
    }
    return refresh_needed;
}
コード例 #5
0
/*ARGSUSED*/
static void 
Initialize(
        Widget rw,
        Widget nw,
        ArgList args,		/* unused */
        Cardinal *num_args)	/* unused */
{
  XmArrowButtonWidget request = (XmArrowButtonWidget) rw;
  XmArrowButtonWidget new_w = (XmArrowButtonWidget) nw;
  
  /*
   *  Check the data put into the new widget from .Xdefaults
   *  or through the arg list.
   */
  if (!XmRepTypeValidValue(XmRID_ARROW_DIRECTION, 
			   new_w->arrowbutton.direction, (Widget) new_w))
    {
      new_w->arrowbutton.direction = XmARROW_UP;
    }
  
  
  /*  Set up a geometry for the widget if it is currently 0.  */
  if (request->core.width == 0) 
    new_w->core.width += 15;
  if (request->core.height == 0) 
    new_w->core.height += 15;
  
  
  /*  Set the internal arrow variables  */
  new_w->arrowbutton.timer = 0;
  new_w->arrowbutton.selected = False;
  
  /*  Get the drawing graphics contexts.  */
  GetArrowGC (new_w);
}
コード例 #6
0
ファイル: Frame.c プロジェクト: CPFDSoftware-Tony/gmv
/*ARGSUSED*/
static Boolean 
SetValues(
        Widget cw,
        Widget rw,		/* unused */
        Widget nw,
        ArgList args,		/* unused */
        Cardinal *num_args )	/* unused */
{
   XmFrameWidget current = (XmFrameWidget) cw ;
   XmFrameWidget new_w = (XmFrameWidget) nw ;
   Boolean redisplay = False;
   Widget title_area = (new_w->frame.title_area &&
			XtIsManaged(new_w->frame.title_area)) ?
			new_w->frame.title_area : NULL;
   Dimension t_w = (title_area) ? title_area->core.width : 0;
   Dimension t_h = (title_area) ? title_area->core.height : 0;
   Dimension t_bw = (title_area) ? title_area->core.border_width : 0;

   Widget work_area = (new_w->frame.work_area &&
			XtIsManaged(new_w->frame.work_area)) ?
			new_w->frame.work_area : (Widget) NULL;
   Dimension w_w = (work_area) ? work_area->core.width : 0;
   Dimension w_h = (work_area) ? work_area->core.height : 0;
   Dimension w_bw = (work_area) ? work_area->core.border_width : 0;


   if (!XmRepTypeValidValue( XmRID_SHADOW_TYPE, new_w->frame.shadow_type,
			(Widget) new_w))
   {
      new_w->frame.shadow_type = current->frame.shadow_type;
   }

    if (!XtIsRealized((Widget)new_w)) return False ;

   if (new_w->frame.margin_width != current->frame.margin_width ||
       new_w->frame.margin_height != current->frame.margin_height ||
       new_w->manager.shadow_thickness != current->manager.shadow_thickness)
   {
      CalcFrameSize (new_w, t_w, t_h, t_bw, w_w, w_h, w_bw,
			&new_w->core.width, &new_w->core.height);
   }

   if (new_w -> frame.shadow_type != current -> frame.shadow_type ||
       new_w->frame.margin_width != current->frame.margin_width ||
       new_w->frame.margin_height != current->frame.margin_height ||
       new_w->manager.shadow_thickness != current->manager.shadow_thickness)
   {
     redisplay = True;
   }

   return (redisplay);
}
コード例 #7
0
ファイル: Simple.c プロジェクト: fjardon/motif
static void 
Initialize(
        Widget request_w,
        Widget new_w,
        ArgList args,
        Cardinal *num_args )
{
 ExmSimpleWidgetClass wc = (ExmSimpleWidgetClass)XtClass(new_w);
 ExmSimpleWidget rw = (ExmSimpleWidget)request_w;
 ExmSimpleWidget nw = (ExmSimpleWidget)new_w;

 /* Look at the value assigned to the ExmNsimpleShape resource.  If the
    value assigned is neither ExmSHAPE_OVAL nor ExmSHAPE_RECTANGLE, then
    issue a warning message and set ExmNsimpleShape to ExmSHAPE_OVAL. */
   if (!XmRepTypeValidValue (simpleShapeId, 
                             nw->simple.simple_shape, (Widget)nw))
     nw->simple.simple_shape = ExmSHAPE_OVAL;

 /* Call a function that creates the GC's needed by the widget. */ 
   if (wc->simple_class.create_gc) 
     (*(wc->simple_class.create_gc))((Widget)nw);

 /* If the widget's width is set to 0, that's a trigger for the widget 
    to calculate its width.  We are not actually going to calculate
    its width here, rather we are going to set the need_to_compute_width
    flag appropriately. */ 
   if (rw->core.width == FIND_NATURAL_SIZE) {
     nw->simple.need_to_compute_width = True; 
   }
   else {
     nw->simple.need_to_compute_width = False;
     nw->simple.pref_width = rw->core.width;
     nw->core.width = rw->core.width;
   }

   if (rw->core.height == FIND_NATURAL_SIZE) 
     nw->simple.need_to_compute_height = True;
   else {
     nw->simple.need_to_compute_height = False;
     nw->simple.pref_height = rw->core.height;
     nw->core.height = rw->core.height;
   }

 /* mark us as not selected to start with */
   nw->simple.saved_foreground = XmUNSPECIFIED_PIXEL ;
    
 /* In order not to resize the widget at each level of the Initialize
    chain, the actual class is passed to this method */
   if (wc->simple_class.reconfigure) 
     (*(wc->simple_class.reconfigure))(exmSimpleWidgetClass, new_w, NULL);
}
コード例 #8
0
/* ARGSUSED */
static void 
Initialize(
        Widget rw,
        Widget nw,
        ArgList args,
        Cardinal *num_args )
{
    XmMainWindowWidget new_w = (XmMainWindowWidget) nw ;
    int   n;
    Arg loc_args[20];


    /* First, undo our superclass defaulting to a real size in
       AUTOMATIC mode, because MainWindow can build a real size
       out of its children in AUTOMATIC */
    if (new_w->swindow.ScrollPolicy == XmAUTOMATIC) {
	if ((rw->core.width == 0) && new_w->core.width)
	    new_w->core.width = 0 ;
	if ((rw->core.height == 0) && new_w->core.height)
	    new_w->core.height = 0 ;
    }

    if (!XmRepTypeValidValue(XmRID_COMMAND_WINDOW_LOCATION,
			    new_w->mwindow.CommandLoc, nw))
        new_w->mwindow.CommandLoc = XmCOMMAND_ABOVE_WORKSPACE;

    n = 0;
    XtSetArg (loc_args[n], XmNorientation, XmHORIZONTAL); n++;
    XtSetArg (loc_args[n], XmNscrolledWindowChildType, XmSEPARATOR); n++;

    new_w->mwindow.ManagingSep = True ;

    new_w->mwindow.Sep1 = (XmSeparatorGadget) 
	XtCreateManagedWidget("Separator1", xmSeparatorGadgetClass, 
			      nw, loc_args, n);
    new_w->mwindow.Sep2 = (XmSeparatorGadget) 
	XtCreateManagedWidget("Separator2", xmSeparatorGadgetClass, 
			      nw, loc_args, n);
    new_w->mwindow.Sep3 = (XmSeparatorGadget) 
	XtCreateManagedWidget("Separator3", xmSeparatorGadgetClass, 
			      nw, loc_args, n);

    new_w->mwindow.ManagingSep = False ;

    /* override the SW setting here */
    new_w->swindow.XOffset = new_w->mwindow.margin_width;    
    new_w->swindow.YOffset = new_w->mwindow.margin_height;    
    new_w->swindow.WidthPad = new_w->mwindow.margin_width;    
    new_w->swindow.HeightPad = new_w->mwindow.margin_height;    
}
コード例 #9
0
ファイル: Frame.c プロジェクト: CPFDSoftware-Tony/gmv
/*ARGSUSED*/
static void 
Initialize(
        Widget rw,
        Widget nw,
        ArgList args,		/* unused */
        Cardinal *num_args )	/* unused */
{
   XmFrameWidget request = (XmFrameWidget) rw ;
   XmFrameWidget new_w = (XmFrameWidget) nw;

   new_w->frame.title_area = NULL;
   new_w->frame.work_area = NULL;
   new_w->frame.processing_constraints = False;

   if (new_w->frame.shadow_type == (unsigned char) XmINVALID_DIMENSION)
   {
      if (XtIsShell (XtParent(new_w)))
      {
         new_w->frame.shadow_type = XmSHADOW_OUT;
      }
      else
      {
         new_w->frame.shadow_type = XmSHADOW_ETCHED_IN;
      }
  }

   if (!XmRepTypeValidValue( XmRID_SHADOW_TYPE, new_w->frame.shadow_type,
			(Widget) new_w))
   {
      new_w->frame.shadow_type = XmSHADOW_ETCHED_IN;
   }

   if (request->manager.shadow_thickness == XmINVALID_DIMENSION)
   {
      if (XtIsShell (XtParent(new_w)))
      {
         new_w->manager.shadow_thickness = 1;
     }
      else
      {
         new_w->manager.shadow_thickness = 2;
     }
  }
   new_w->frame.old_shadow_x = 0;
   new_w->frame.old_shadow_y = 0;
   new_w->frame.old_width = new_w->core.width;
   new_w->frame.old_height = new_w->core.height;
   new_w->frame.old_shadow_thickness = new_w->manager.shadow_thickness;
}
コード例 #10
0
/*ARGSUSED*/
static Boolean 
SetValues(
        Widget cw,
        Widget rw,
        Widget nw,
        ArgList args,		/* unused */
        Cardinal *num_args)	/* unused */
{
  XmArrowButtonWidget current = (XmArrowButtonWidget) cw;
  XmArrowButtonWidget new_w = (XmArrowButtonWidget) nw;
  
  Boolean returnFlag = FALSE;
  
  /*  Check the data put into the new widget.  */
  
  if (!XmRepTypeValidValue(XmRID_ARROW_DIRECTION, 
			   new_w->arrowbutton.direction, (Widget) new_w))
    {
      new_w->arrowbutton.direction = current->arrowbutton.direction;
    }
  
  
  /*  See if the GC's need to be regenerated and widget redrawn.  */
  if (new_w->core.background_pixel != current->core.background_pixel ||
      new_w->primitive.foreground != current->primitive.foreground)
    {
      returnFlag = TRUE;
      XtReleaseGC ((Widget) new_w, new_w->arrowbutton.arrow_GC);
      XtReleaseGC ((Widget) new_w, new_w->arrowbutton.insensitive_GC);
      GetArrowGC (new_w);
    }
  
  if (new_w->arrowbutton.direction != current->arrowbutton.direction ||
      XtIsSensitive(nw) != XtIsSensitive(cw) ||
      new_w->primitive.highlight_thickness !=
      current->primitive.highlight_thickness ||
      new_w->primitive.shadow_thickness != current->primitive.shadow_thickness)
    {
      returnFlag = TRUE;
    }
  
  return (returnFlag);
}
コード例 #11
0
/*----------------------------------------------------------------------*/
/* extern */ Boolean
XfeRepTypeCheck(Widget				w,
				String				rep_type,
				unsigned char *		address,
				unsigned char		fallback)
/*----------------------------------------------------------------------*/
{
	Boolean result = True;

	assert( address != NULL );

	if (!XmRepTypeValidValue(XmRepTypeGetId(rep_type),*address,w))
	{
		result = False;

		*address = fallback;
	}

	return result;
}
コード例 #12
0
ファイル: Simple.c プロジェクト: fjardon/motif
/******************************************************************************
 *
 *  SetValues:
 *     Called by the Intrinsics when an application attempts to
 *     change the value of a resource.  
 *
 *****************************************************************************/
static Boolean 
SetValues (
        Widget old_w,
        Widget request_w,
        Widget new_w,
        ArgList args,
        Cardinal *num_args
          )
{
 ExmSimpleWidgetClass wc = (ExmSimpleWidgetClass)XtClass(new_w);
 ExmSimpleWidget cw = (ExmSimpleWidget)old_w;
 ExmSimpleWidget rw = (ExmSimpleWidget)request_w;
 ExmSimpleWidget nw = (ExmSimpleWidget)new_w;
 Boolean redisplayFlag = False;

 /* Validate the value of ExmNsimpleShape by calling XmRepTypeValidValue. */
   if (nw->simple.simple_shape != cw->simple.simple_shape) {
     if (!XmRepTypeValidValue (simpleShapeId, nw->simple.simple_shape, 
                               (Widget)nw))
       nw->simple.simple_shape = cw->simple.simple_shape;
     else
       redisplayFlag = True;
   }

 /* Redisplay on change in sensitivity */
 if (XtIsSensitive(new_w) != XtIsSensitive(old_w))
   redisplayFlag = True;

 /* If the widget's foreground or background color changes, 
    then we must update the GC. */ 
   if (nw->primitive.foreground != cw->primitive.foreground ||
       nw->core.background_pixel != cw->core.background_pixel) {
     if (wc->simple_class.destroy_gc)
       (*(wc->simple_class.destroy_gc))((Widget)cw);
     if (wc->simple_class.create_gc)
       (*(wc->simple_class.create_gc))((Widget)nw);
     redisplayFlag = True;
   }

 /* Check for application geometry settings. '0' means 'ideal size' */
   if (rw->core.width == FIND_NATURAL_SIZE) {
     nw->core.width = FIND_NATURAL_SIZE;
     nw->simple.need_to_compute_width = True;
   }
   else if (rw->core.width != cw->core.width) {
     nw->core.width = rw->core.width;
     nw->simple.pref_width = rw->core.width;
     nw->simple.need_to_compute_width = False;
   }

   if (rw->core.height == FIND_NATURAL_SIZE) {
     nw->core.height = FIND_NATURAL_SIZE;
     nw->simple.need_to_compute_height = True;
   }
   else if (rw->core.height != cw->core.height) {
     nw->core.height = rw->core.height;
     nw->simple.pref_height = rw->core.height;
     nw->simple.need_to_compute_height = False;
   }

 /* Check for any changes in total widget set, margin size, or 
    window decoration size.  If any are found, call Reconfigure. */ 
   nw->simple.need_to_reconfigure = False;
   if (nw->core.width != cw->core.width ||
       nw->core.height != cw->core.height ||
       nw->simple.margin_width != cw->simple.margin_width ||
       nw->simple.margin_height != cw->simple.margin_height ||
       nw->primitive.shadow_thickness != cw->primitive.shadow_thickness ||
       nw->primitive.highlight_thickness != cw->primitive.highlight_thickness
      ) 
   Reconfigure (exmSimpleWidgetClass, new_w, old_w);

   return (redisplayFlag);
}
コード例 #13
0
ファイル: Gadget.c プロジェクト: CPFDSoftware-Tony/gmv
/************************************************************************
 *
 *  SetValues
 *     Perform and updating necessary for a set values call.
 *
 ************************************************************************/
static Boolean 
SetValues(
        Widget cw,
        Widget rw,
        Widget nw,
        ArgList args,
        Cardinal *num_args )
{
        XmGadget cur = (XmGadget) cw ;
        XmGadget req = (XmGadget) rw ;
        XmGadget new_w = (XmGadget) nw ;
   Boolean returnFlag;

    if (XtIsSensitive(cw) != XtIsSensitive(nw))
    {
    	if (!XtIsSensitive(nw))
    	{
	    _XmToolTipLeave(nw, NULL, NULL, NULL);
    	}
    }

    if (XmGetToolTipString(nw) != XmGetToolTipString(cw))
    {
        XmSetToolTipString(cw, XmGetToolTipString(nw));
    }

   /* CR 7124: XmNlayoutDirection is a CG resource. */
   if (cur->gadget.layout_direction != new_w->gadget.layout_direction)
     {
       XmeWarning((Widget) new_w, MESSAGE1);
       new_w->gadget.layout_direction = cur->gadget.layout_direction;
     }

   if(    cur->gadget.navigation_type != new_w->gadget.navigation_type    )
     {
       if(    !XmRepTypeValidValue( XmRID_NAVIGATION_TYPE, 
			        new_w->gadget.navigation_type, (Widget) new_w)    )
	 {
	   new_w->gadget.navigation_type = cur->gadget.navigation_type ;
	 } 
     }
   returnFlag = _XmNavigSetValues ((Widget) cur, (Widget) req, (Widget) new_w,
				                               args, num_args);
   /*  Validate changed data.  */

   if(    !XmRepTypeValidValue( XmRID_UNIT_TYPE, new_w->gadget.unit_type,
                                                             (Widget) new_w)    )
   {
      new_w->gadget.unit_type = cur->gadget.unit_type;
   }


   /*  Convert the necessary fields from unit values to pixel values  */

   _XmGadgetImportArgs((Widget) new_w, args, num_args);

   /*  Check for resize conditions  */

   if (cur->gadget.shadow_thickness != new_w->gadget.shadow_thickness ||
       cur->gadget.highlight_thickness != new_w->gadget.highlight_thickness)
      returnFlag = True;
   

   /*  Force the border width to 0  */

   new_w->rectangle.border_width = 0;

   if(    new_w->gadget.highlight_drawn
      &&  (    !XtIsSensitive( (Widget) new_w)
	   ||  (    cur->gadget.highlight_on_enter
		&&  !(new_w->gadget.highlight_on_enter)
		&&  (_XmGetFocusPolicy( (Widget) new_w) == XmPOINTER)))    )
     {
       if(    ((XmGadgetClass) XtClass( new_w))
	                                 ->gadget_class.border_unhighlight    )
	 {
	   (*(((XmGadgetClass) XtClass( new_w))
	                   ->gadget_class.border_unhighlight))( (Widget) new_w) ;
	 }
     }

   /*  Return a flag which may indicate that a redraw needs to occur.  */
   
   return (returnFlag);
}
コード例 #14
0
ファイル: Gadget.c プロジェクト: CPFDSoftware-Tony/gmv
/************************************************************************
 *
 *  Initialize
 *     The main widget instance initialization routine.
 *
 ************************************************************************/
static void 
Initialize(
        Widget rw,
        Widget nw,
        ArgList args,
        Cardinal *num_args )
{
    XmGadget request = (XmGadget) rw ;
    XmGadget 			gw = (XmGadget) nw;
    XmBaseClassExt              *cePtr;
    XtInitProc                  secondaryCreate;
    XmString                    tool_tip_string;

    static XtResource subresources[] =
    {
        {
            XmNtoolTipString, XmCToolTipString, XmRXmString,
            sizeof(XmString), 0,
            XmRImmediate, (XtPointer) NULL
        },
    };

   if(    !XmRepTypeValidValue( XmRID_UNIT_TYPE, gw->gadget.unit_type,
                                                             (Widget) gw)    )
   {
      gw->gadget.unit_type = XmPIXELS;
   }


   /*  Convert the fields from unit values to pixel values  */

   _XmGadgetImportArgs( (Widget) gw, args, num_args);
   _XmGadgetImportSecondaryArgs( (Widget) gw, args, num_args);

    cePtr = _XmGetBaseClassExtPtr(XtClass(gw), XmQmotif);

    if ((*cePtr) &&
	(*cePtr)->secondaryObjectClass &&
	(secondaryCreate = (*cePtr)->secondaryObjectCreate))
      (*secondaryCreate)( (Widget) request, (Widget) gw, args, num_args);

    XtGetSubresources(nw, &tool_tip_string, NULL, NULL,
         subresources, XtNumber(subresources),
	 args, *num_args);

    XmSetToolTipString(nw, tool_tip_string);
   
   gw->gadget.event_mask = 0;
   gw->gadget.have_traversal = FALSE ;
   gw->gadget.highlighted = FALSE ;
   gw->gadget.highlight_drawn = FALSE ;

   if(    (gw->gadget.navigation_type != XmDYNAMIC_DEFAULT_TAB_GROUP)
       && !XmRepTypeValidValue( XmRID_NAVIGATION_TYPE, 
                                  gw->gadget.navigation_type, (Widget) gw)    )
   {   gw->gadget.navigation_type = XmNONE ;
       } 

   _XmNavigInitialize ((Widget) request, (Widget) gw, args, num_args);

   gw->gadget.have_traversal = FALSE ;

   /*  Check the geometry information for the widget  */

   if (request->rectangle.width == 0)
      gw->rectangle.width += gw->gadget.highlight_thickness * 2 +
                             gw->gadget.shadow_thickness * 2;

   if (request->rectangle.height == 0)
      gw->rectangle.height += gw->gadget.highlight_thickness * 2 + 
                              gw->gadget.shadow_thickness * 2;


   /*  Force the border width to 0  */

   gw->rectangle.border_width = 0;

   return ;
   }
コード例 #15
0
ファイル: Balloon.c プロジェクト: Gilles86/afni
/*****
* Name: 		Initialize
* Return Type: 	void
* Description: 	XmBalloonWidgetClass initialize method
* In:
*	request:	widget with resource values set as requested by the argument
*				list, resource database and widget defaults
*	init:		same widget with values as modified by superclass initialize()
*				methods
*	args:		argument list passed to XtCreateWidget
*	num_args:	number of entries in the argument list
* Returns:
*	nothing, but init is updated with checked/updated resource values.
*****/
static void
Initialize(Widget request, Widget init, ArgList args, Cardinal *num_args)
{
	XmBalloonWidget balloon = (XmBalloonWidget)init;
	XmBalloonWidget req     = (XmBalloonWidget)request;
	int shape_event_base, shape_error_base;

	/* initialize fields */
	ATTR(gc)			= NULL;
	ATTR(popped)		= False;
	ATTR(pop_x)		    = (Position)0;
	ATTR(pop_y)	    	= (Position)0;
	ATTR(popup_id)    	= (XtIntervalId)0;
	ATTR(popdown_id)	= (XtIntervalId)0;
	ATTR(context)		= XtWidgetToApplicationContext(XtParent(request));

	balloon->core.x     = 0;
	balloon->core.y     = 0;
	balloon->core.width = 1;
	balloon->core.height= 1;

	/* select default backingStore model */
	ATTR(backing_store) = Always + WhenMapped + NotUseful;

	/* check for correct XmNcornerStyle value */
	if(!XmRepTypeValidValue(corner_style_repid, ATTR(corner_style), init))
	{
		_XmHTMLWarning(__WFUNC__(balloon, "initialize"),
			"Bad XmNcornerStyle value, reset to XmCORNER_STRAIGHT");
		ATTR(corner_style) = XmCORNER_STRAIGHT;
	}

	/* check for correct XmNballoonStyle value */
	if(!XmRepTypeValidValue(balloon_style_repid, ATTR(balloon_style), init))
	{
		_XmHTMLWarning(__WFUNC__(balloon, "Initialize"),
			"Bad XmNballoonStyle value, reset to XmBALLOON_SQUARE");
		ATTR(balloon_style) = XmBALLOON_SQUARE;
	}

	/* When a shaped balloon is requested, check if the server supports it. */
	if(ATTR(balloon_style) == XmBALLOON_SHAPED &&
		!XShapeQueryExtension(XtDisplay(balloon), &shape_event_base,
			&shape_error_base))
	{
		_XmHTMLWarning(__WFUNC__(balloon, "Initialize"),
			"Shape extension not supported by XServer, resetting "
			"XmNballoonStyle to XmBALLOON_SQUARE.");
		ATTR(balloon_style) = XmBALLOON_SQUARE;
	}
	ATTR(shape_window) = (ATTR(balloon_style) == XmBALLOON_SHAPED);
	ATTR(shape_mask)   = None;
	ATTR(shape_gc)     = 0;
	ATTR(shape_width)  = 0;
	ATTR(shape_height) = 0;

	/* get font info */
	computeFontInfo(balloon);

	/* and create the GC's for us to use */
	checkGC(balloon);

	/* label string */
	if(req->balloon.label != NULL)
	{
		ATTR(source) = strdup(req->balloon.label);
		ATTR(source_len) = strlen(req->balloon.label);
	}
	else
	{
		ATTR(source) = NULL;
		ATTR(source_len) = 0;
	}
}
コード例 #16
0
/*ARGSUSED*/
static Boolean 
SetValues(
        Widget cw,
        Widget rw,		/* unused */
        Widget nw,
        ArgList args,		/* unused */
        Cardinal *num_args )	/* unused */
{
    XmMainWindowWidget current = (XmMainWindowWidget) cw ;
    XmMainWindowWidget new_w = (XmMainWindowWidget) nw ;
    Boolean flag = False;

    CheckKids(new_w);

    /* somehow, this used not to create problem in 1.2,
       some apps did setvalue of XmNmenubar to itself ?
       check that and change back */
    if ((new_w->mwindow.MenuBar != current->mwindow.MenuBar) &&
        (new_w->mwindow.MenuBar == nw)) {
	new_w->mwindow.MenuBar = current->mwindow.MenuBar;
    }

    /* fix for 8990: these warnings must be here for bc... */
    if ((new_w->mwindow.MenuBar != current->mwindow.MenuBar) &&
        (new_w->mwindow.MenuBar == NULL)) {
        XmeWarning( (Widget) new_w, MWMessage1);
	new_w->mwindow.MenuBar = current->mwindow.MenuBar;
    }

    if ((new_w->mwindow.CommandWindow != current->mwindow.CommandWindow) &&
        (new_w->mwindow.CommandWindow == NULL)) {
        XmeWarning( (Widget) new_w, MWMessage2);    
	new_w->mwindow.CommandWindow = current->mwindow.CommandWindow;
    }

    /* first deal with the layout attributes, and set up a flag */

    /* There is a potential bug here: if the change in margin
       concur with a change on some other stuff, like separator
       or a new child, and the getSize call return the same size,
       no resize call will be generated by Xt.
       A way to fix that is to check this no change in size
       and to fake a request.. maybe not worth. */

    if ((new_w->mwindow.margin_width != current->mwindow.margin_width) ||
	(new_w->mwindow.margin_height != current->mwindow.margin_height) ||
	(new_w->mwindow.ShowSep != current->mwindow.ShowSep)) {
	flag = True;
    }

    if ((new_w->mwindow.CommandLoc != current->mwindow.CommandLoc) &&
        (XmRepTypeValidValue(XmRID_COMMAND_WINDOW_LOCATION,
			     new_w->mwindow.CommandLoc, (Widget) new_w))) {
        XtWidgetProc resize;
	_XmProcessLock();
	resize = XtCoreProc(nw, resize);
	_XmProcessUnlock();
	(*resize) (nw) ;
    }
    else
        new_w->mwindow.CommandLoc = current->mwindow.CommandLoc;


    /* At InsertChild time, a lot of bad things might have happened.
       The command window, messagewindow and work window, which we have 
       no real way to identify at that time, might have been mixed up.
       (MenuBar and application ScrollBars shouldn't be a problem)
       The first unidentifiable kid will take the workwindow slot (and 
       possibly be reparented), and the followers will be just inserted 
       in the child list without reparenting (to the clipwindow in 
       AUTO mode I mean).
       After creation time, the application will use XtSetValues to set up
       things correctly (except changing the workwindow in AUTO,
       which is not allowed). 
       The requirement, if a childType resource isn't provided, 
       is that the workwindow be created first, at least in AUTO mode
       where the reparenting happens */
       
   

    if ((new_w->mwindow.MenuBar != current->mwindow.MenuBar) ||
        (new_w->mwindow.Message != current->mwindow.Message) ||
        (new_w->mwindow.CommandWindow != current->mwindow.CommandWindow ) ||
        (new_w->swindow.hScrollBar != current->swindow.hScrollBar) ||
	(new_w->swindow.vScrollBar != current->swindow.vScrollBar) ||
	(new_w->swindow.WorkWindow != current->swindow.WorkWindow ) ||
        (flag)) {
	/* set our core geometry to the needed size - 
	   no resizePolicy here...
	   Change in child type can happen before realize time, before
	   change managed has been called, and we don't want to set up
	   a size for the main window at this point, since its children
	   size haven't been set up yet */
	if (XtIsRealized((Widget)new_w)) {
	    Dimension width = 0, height = 0 ;
	    GetSize (new_w, &width, &height);
	    new_w->core.width = width ;
	    new_w->core.height = height ;
	}
    }
           
    return (False);
}