Ejemplo n.º 1
0
Archivo: Gadget.c Proyecto: 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;
}
Ejemplo n.º 2
0
/* ARGSUSED */
static void 
SecondaryObjectCreate(
        Widget req,
        Widget new_w,
        ArgList args,
        Cardinal *num_args )
{
    XmBaseClassExt              *cePtr;
    Arg                         myArgs[1];
    ArgList                     mergedArgs;

    XtSetArg(myArgs[0] ,XmNlogicalParent, new_w);

    if (*num_args)
       mergedArgs = XtMergeArgLists(args, *num_args, myArgs, XtNumber(myArgs));
    else
       mergedArgs = myArgs;


    cePtr = _XmGetBaseClassExtPtr(XtClass(new_w), XmQmotif);
    (void) XtCreateWidget(XtName(new_w),
                         (*cePtr)->secondaryObjectClass,
			 XtParent(new_w) ? XtParent(new_w) : new_w,
			 mergedArgs, *num_args + 1);

    if (mergedArgs != myArgs)
      XtFree( (char *) mergedArgs);
}
Ejemplo n.º 3
0
static void 
Initialize(Widget req,
	   Widget new_w,
	   ArgList args,
	   Cardinal *num_args)
{
  XmExtObject      ne = (XmExtObject) new_w;
  XmExtObjectClass ec = (XmExtObjectClass) XtClass(new_w);
  Widget           resParent = ne->ext.logicalParent;
  XmWidgetExtData  extData;
  XmBaseClassExt  *wcePtr = _XmGetBaseClassExtPtr(ec, XmQmotif);
  
  if (!(*wcePtr)->use_sub_resources)
    {
      if (resParent)
	{
	  extData = (XmWidgetExtData) XtCalloc(1, sizeof(XmWidgetExtDataRec));
	  _XmPushWidgetExtData(resParent, extData, ne->ext.extensionType);
	  
	  extData->widget = new_w;
	  _XmProcessLock();
	  extData->reqWidget = (Widget)
	    _XmExtObjAlloc(XtClass(new_w)->core_class.widget_size);
	  memcpy((char *)extData->reqWidget, (char *)req,
		 XtClass(new_w)->core_class.widget_size);
	  _XmProcessUnlock();
	  
	  /*  Convert the fields from unit values to pixel values  */
	  _XmExtImportArgs(new_w, args, num_args);
	}
    }
}
Ejemplo n.º 4
0
Archivo: Gadget.c Proyecto: att/uwin
/*
 * initialize the synthetic resource crap.  The only way I know to get the
 * CachePart stuff for Gadget subclasses is via the baseclass extension
 * (secondary stuff); unfortunately, I don't know how that works yet.
 */
void
_XmBuildGadgetResources(WidgetClass c)
{
    XmGadgetClass super;
    XmGadgetClass gc = (XmGadgetClass)c;
    XmBaseClassExt *bce = NULL;
    XmExtObjectClass subpclass, esuper;

	DEBUGOUT(_LtDebug(__FILE__, NULL, "_XmBuildGadgetResources\n"));


    _XmInitializeSyntheticResources(gc->gadget_class.syn_resources,
				    gc->gadget_class.num_syn_resources);

    /*
     * if we're the Gadget, our super doesn't have synthetic resources
     * nor do we have an extension, so we can bail here.
     */
    if (c == xmGadgetClass)
    {
	return;
    }

    super = ((XmGadgetClass)c->core_class.superclass);
    _XmBuildResources(&gc->gadget_class.syn_resources,
		      &gc->gadget_class.num_syn_resources,
		      super->gadget_class.syn_resources,
		      super->gadget_class.num_syn_resources);

    /*
     * we can get the subpart stuff from the baseclass extension, now that
     * it's there.
     */
    bce = (XmBaseClassExt *)_XmGetBaseClassExtPtr(c, XmQmotif);

    if (!*bce || !(subpclass = (XmExtClassRec *)(*bce)->secondaryObjectClass))
    {
	return;
    }

    _XmInitializeSyntheticResources(subpclass->ext_class.syn_resources,
				    subpclass->ext_class.num_syn_resources);

    /* core dump avoidance overkill */
    esuper = (XmExtObjectClass)subpclass->object_class.superclass;
    if (subpclass == &xmExtClassRec || esuper == &xmExtClassRec)
    {
	return;
    }

    _XmBuildResources(&subpclass->ext_class.syn_resources,
		      &subpclass->ext_class.num_syn_resources,
		      esuper->ext_class.syn_resources,
		      esuper->ext_class.num_syn_resources);
}
Ejemplo n.º 5
0
/*
 * GetSecResData()
 *  - Called from : XmGetSecondaryResourceData ().
 */
static Cardinal 
GetSecResData(
        WidgetClass w_class,
        XmSecondaryResourceData **secResDataRtn )
{
  XmBaseClassExt  *bcePtr;	/* bcePtr is really **XmBaseClassExtRec */
  Cardinal count = 0;
  
  bcePtr = _XmGetBaseClassExtPtr( w_class, XmQmotif); 
  if ((bcePtr) && (*bcePtr) && ((*bcePtr)->getSecResData))
    count = ( (*bcePtr)->getSecResData)( w_class, secResDataRtn);

  return count;
}
Ejemplo n.º 6
0
Archivo: Gadget.c Proyecto: att/uwin
static void
secondary_object_create(Widget req, Widget new_w,
			ArgList args, Cardinal *num_args)
{
    XmBaseClassExt *bce;
    Arg argl[1];
    ArgList merged;

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

    XtSetArg(argl[0], XmNlogicalParent, new_w);

    if (*num_args)
    {
	merged = XtMergeArgLists(args, *num_args, argl, XtNumber(argl));

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

	XtCreateWidget(XtName(new_w), (*bce)->secondaryObjectClass,
		       XtParent(new_w)
		       ? XtParent(new_w)
		       : new_w,
		       merged, *num_args + 1);

	XtFree((char *)merged);
    }
    else
    {
	bce = _XmGetBaseClassExtPtr(XtClass(new_w), XmQmotif);

	XtCreateWidget(XtName(new_w), (*bce)->secondaryObjectClass,
		       XtParent(new_w)
		       ? XtParent(new_w)
		       : new_w,
		       argl, 1);
    }
}
Ejemplo n.º 7
0
static void 
ClassPartInitPosthook(WidgetClass c)
{
  XmExtObjectClass wc = (XmExtObjectClass) c;
  XmBaseClassExt  *wcePtr = _XmGetBaseClassExtPtr(wc, XmQmotif);
  
  if ((*wcePtr) && (*wcePtr)->use_sub_resources)
    {
      /*
       * Put our compiled resources back and zero out oject class so
       * it's invisible to object class create processing.
       */
      (*wcePtr)->compiled_ext_resources = wc->object_class.resources;
      (*wcePtr)->num_ext_resources = wc->object_class.num_resources;
    }
}
Ejemplo n.º 8
0
static void 
GetValuesPrehook(Widget new_w,
		 ArgList args,
		 Cardinal *num_args)
{
  XmExtObjectClass ec = (XmExtObjectClass) XtClass(new_w);
  XmBaseClassExt *wcePtr = _XmGetBaseClassExtPtr(ec, XmQmotif);
  
  if ((*wcePtr)->use_sub_resources)
    {
      _XmProcessLock();
      XtGetSubvalues((XtPointer)new_w,
		     (*wcePtr)->ext_resources,
		     (*wcePtr)->num_ext_resources,
		     args, *num_args);
      _XmProcessUnlock();
    }
}
Ejemplo n.º 9
0
int main(int argc, char **argv)
{
    XtAppContext    AppCtx;
    Widget          TopLevel, TopLevel2;
    XmBaseClassExt *bce;

    TopLevel = XtAppInitialize(&AppCtx, "Exttest", NULL, 0,
                               &argc, argv, NULL, NULL, 0);
    CreateMainW(TopLevel, "main_first");
    
    bce = _XmGetBaseClassExtPtr(XtClass(TopLevel), XmQmotif);
    printf("bce: %08X (sec obj create = %08X)\n\n",
           (int) (*bce),
           (int) ((*bce)->secondaryObjectCreate)
           );

    TopLevel2 = XtAppCreateShell("exttest2", "Exttest", 
				 applicationShellWidgetClass, 
				 XtDisplay(TopLevel),
				 NULL, 0);
    XtVaSetValues(TopLevel, XmNx, 500, NULL);
    CreateMainW(TopLevel2, "main_second");

    XtRealizeWidget(TopLevel); XtRealizeWidget(TopLevel2);
    DumpWidgetTree(TopLevel);
    DumpDisplayTree(TopLevel);
    DumpGrabList(TopLevel);
    
{
    static XtWidgetGeometry Expected[] = {
   CWWidth | CWHeight            ,   56,   72,  148,   48, 0,0,0, /* main_first */
   CWWidth | CWHeight | CWX | CWY,    0,    0,  148,   31, 0,0,0, /* menubar */
   CWWidth | CWHeight | CWX | CWY,    5,    5,   40,   21, 0,0,0, /* File */
   CWWidth | CWHeight | CWX | CWY,    0,   31,  148,   17, 0,0,0, /* ExtTest Test Application */ 
    };
    PrintDetails(    TopLevel ,Expected);
};
   LessTifTestMainLoop(    TopLevel );
   
   exit(0);
} /* main */
Ejemplo n.º 10
0
/*ARGSUSED*/
static void 
InitializePrehook(Widget req,	/* unused */
		  Widget new_w,
		  ArgList args,
		  Cardinal *num_args)
{
  XmExtObjectClass ec = (XmExtObjectClass) XtClass(new_w);
  XmBaseClassExt  *wcePtr = _XmGetBaseClassExtPtr(ec, XmQmotif);
  
  if ((*wcePtr)->use_sub_resources)
    {
      /*
       * Get a uncompiled resource list to use with XtGetSubresources.
       * We can't do this in ClassPartInitPosthook because Xt doesn't
       * set class_inited at the right place and thereby mishandles
       * the XtGetResourceList call.
       */
      _XmProcessLock();
      if ((*wcePtr)->ext_resources == NULL)
	{
	  ec->object_class.resources = (*wcePtr)->compiled_ext_resources;
	  ec->object_class.num_resources = (*wcePtr)->num_ext_resources;
	  
	  XtGetResourceList((WidgetClass) ec,
			    &((*wcePtr)->ext_resources),
			    &((*wcePtr)->num_ext_resources));
	}

      XtGetSubresources(XtParent(new_w),
			(XtPointer)new_w,
			NULL, NULL,
			(*wcePtr)->ext_resources,
			(*wcePtr)->num_ext_resources,
			args, *num_args);
      _XmProcessUnlock();
    }
}
Ejemplo n.º 11
0
static void 
ClassPartInitPrehook(WidgetClass c)
{
  XmExtObjectClass wc = (XmExtObjectClass) c;
  
  if ((WidgetClass)wc != xmExtObjectClass)
    {
      XmExtObjectClass sc = (XmExtObjectClass) c->core_class.superclass;
      XmBaseClassExt *scePtr = _XmGetBaseClassExtPtr(sc, XmQmotif);

      /*
       * If our superclass uses subresources, then we need to
       * temporarily fill it's core resource fields so that objectClass
       * classPartInit will be able to find them for merging.  We
       * assume that we only need to set things up for the
       * superclass and not any deeper ancestors.
       */
      if ((*scePtr)->use_sub_resources)
	{
	  sc->object_class.resources = (*scePtr)->compiled_ext_resources;
	  sc->object_class.num_resources = (*scePtr)->num_ext_resources;
	}
    }
}
Ejemplo n.º 12
0
/**********************************************************************
 *
 *  _XmBuildGadgetResources
 *	Build up the gadget's synthetic resource processing list 
 *	by combining the super classes with this class.
 *
 **********************************************************************/
void 
_XmBuildGadgetResources(
        WidgetClass c )
{
	XmGadgetClass wc = (XmGadgetClass) c ;
	XmGadgetClass sc;
	XmBaseClassExt *classExtPtr;
	XmExtClassRec *secondaryObjClass;
	WidgetClass secObjSuperClass;

	_XmProcessLock();

	sc = (XmGadgetClass) wc->rect_class.superclass;

	_XmInitializeSyntheticResources(wc->gadget_class.syn_resources,
		wc->gadget_class.num_syn_resources);

	/*
	 * RectObj has no synthetic resources to incorporate.
	 */
	if (sc != (XmGadgetClass) rectObjClass)
	{
		_XmBuildResources (&(wc->gadget_class.syn_resources),
			&(wc->gadget_class.num_syn_resources),
			sc->gadget_class.syn_resources,
			sc->gadget_class.num_syn_resources);
	}

	classExtPtr = _XmGetBaseClassExtPtr(c, XmQmotif);
	secondaryObjClass = (XmExtClassRec *)
		((*classExtPtr)->secondaryObjectClass);

	/*
	 * Not all gadgets have secondary objects.
	 */
	if (secondaryObjClass == NULL) {_XmProcessUnlock(); return; }

	secObjSuperClass = secondaryObjClass->object_class.superclass;

	/*
	 * secondary object resources have already been inited when they are
	 * inherited
	 */
	if (!secObjSuperClass->core_class.class_inited) {
	    _XmInitializeSyntheticResources(
		secondaryObjClass->ext_class.syn_resources,
		secondaryObjClass->ext_class.num_syn_resources);
	    secObjSuperClass->core_class.class_inited = True;
	}

	/*
	 * ExtObject has no synthetic resources to incorporate.
	 */
	if (secObjSuperClass != (WidgetClass) xmExtObjectClass)
	{
		_XmBuildResources (
			&(secondaryObjClass->ext_class.syn_resources),
			&(secondaryObjClass->ext_class.num_syn_resources),
			((XmExtClassRec *)secObjSuperClass)
				->ext_class.syn_resources,
			((XmExtClassRec *)secObjSuperClass)
				->ext_class.num_syn_resources);
	}
	_XmProcessUnlock();	
}
Ejemplo n.º 13
0
/************************************************************************
 *
 *  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 ;
   }