Exemple #1
0
static void 
_XmFastExpose(Widget widg)
{
  register int i;
  register Widget child;
  XmGrabShellWidget gs = (XmGrabShellWidget)widg;

  _XmProcessLock();
  (*(XtClass(widg)->core_class.expose)) (widg, NULL, NULL);
  _XmProcessUnlock();
  
  /* Process each windowed child */
  for (i = 0; i < gs->composite.num_children; i++)
    {
      child = gs->composite.children[i];
      
      if (XtIsWidget(child) && XtIsManaged(child)) {
        _XmProcessLock();
	(*(XtClass(child)->core_class.expose)) (child, NULL, NULL);
	_XmProcessUnlock();
      }
    }
  
  XFlush(XtDisplay(widg));
  DrawBorder(widg);
}
Exemple #2
0
/************************************************************************
 *
 *  _XmSFUpdateNavigatorsValues convenience function
 *
 *************************************<->***********************************/
void
_XmSFUpdateNavigatorsValue(
        Widget sf,
        XmNavigatorData nav_data,
        Boolean notify)
{
    Cardinal i, num_nav_list ;
    Widget * nav_list ;
    Boolean inited ;

    /* there is a possibility that the SW was not inited for
       navigation business: APP_DEFINED where no scrollbar have
       been added yet */
    inited =  ((XmScrollFrameTrait) 
	       XmeTraitGet((XtPointer) XtClass(sf), XmQTscrollFrame))
	->getInfo(sf, NULL, &nav_list, &num_nav_list);

    if (!inited) return ;

    /* loop over the associated navigator list and call the change value
       method for each navigator */
    /* Updating the first navigator only if notify is True is not
       enough, since the dimension is pertinent */

    for (i=0; i < num_nav_list; i++) {
	Widget nav = nav_list[i] ;
	XmNavigatorSetValueProc	nav_setValue =
	    ((XmNavigatorTrait) 
	     XmeTraitGet((XtPointer) XtClass(nav), XmQTnavigator))->setValue;

	nav_setValue(nav, nav_data, notify);
    }
}
Exemple #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);
	}
    }
}
Exemple #4
0
XtCacheRef *_XtGetResources(
    register 	Widget	  	w,
    		ArgList	  	args,
    		Cardinal  	num_args,
		XtTypedArgList	typed_args,
		Cardinal*	num_typed_args)
{
    XrmName	    *names, names_s[50];
    XrmClass	    *classes, classes_s[50];
    XrmQuark	    quark_cache[100];
    XrmQuarkList    quark_args;
    WidgetClass     wc;
    ConstraintWidgetClass   cwc;
    XtCacheRef	    *cache_refs, *cache_refs_core;
    Cardinal	    count;

    wc = XtClass(w);

    count = CountTreeDepth(w);
    names = (XrmName*) XtStackAlloc (count * sizeof(XrmName), names_s);
    classes = (XrmClass*) XtStackAlloc (count * sizeof(XrmClass), classes_s);
    if (names == NULL || classes == NULL) _XtAllocError(NULL);

    /* Get names, classes for widget and ancestors */
    GetNamesAndClasses(w, names, classes);
   
    /* Compile arg list into quarks */
    CacheArgs(args, num_args, typed_args, *num_typed_args, quark_cache,
	      XtNumber(quark_cache), &quark_args);

    /* Get normal resources */
    LOCK_PROCESS;
    cache_refs = GetResources(w, (char*)w, names, classes,
	(XrmResourceList *) wc->core_class.resources,
	wc->core_class.num_resources, quark_args, args, num_args,
	typed_args, num_typed_args, XtIsWidget(w));

    if (w->core.constraints != NULL) {
	cwc = (ConstraintWidgetClass) XtClass(w->core.parent);
	cache_refs_core =
	    GetResources(w, (char*)w->core.constraints, names, classes,
	    (XrmResourceList *) cwc->constraint_class.resources,
	    cwc->constraint_class.num_resources,
	    quark_args, args, num_args, typed_args, num_typed_args, False);
	if (cache_refs_core) {
	    XtFree((char *)cache_refs_core);
	}
    }
    FreeCache(quark_cache, quark_args);
    UNLOCK_PROCESS;
    XtStackFree((XtPointer)names, names_s);
    XtStackFree((XtPointer)classes, classes_s);
    return cache_refs;
} /* _XtGetResources */
Exemple #5
0
Boolean
lw_lucid_widget_p (Widget widget)
{
  WidgetClass the_class = XtClass (widget);

  if (the_class == xlwMenuWidgetClass)
    return True;
  if (the_class == overrideShellWidgetClass)
    return (XtClass (((CompositeWidget)widget)->composite.children [0])
	    == xlwMenuWidgetClass);
  return False;
}
    static void _grabbedLabelGadgetExpose(Widget _w, XEvent *_event, 
					  Region _region)
    {
	GC insensitiveGC;

	XmLabelGadget label = (XmLabelGadget)_w;

	unsigned char label_type = XmSTRING;
	XtVaGetValues(_w, XmNlabelType, &label_type, XtPointer(0));

	if (XtIsSensitive(_w) || label_type != XmSTRING)
	    (*oldLabelGadgetExposeProc)(_w, _event, _region);
	else
	{
#if defined(LesstifVersion)
	    // LessTif invokes resize() when exposing the widget,
	    // creating a new insensitive GC.  Inhibit this.
	    XtWidgetProc oldResizeProc = XtClass(_w)->core_class.resize;
	    XtClass(_w)->core_class.resize = noResize;
	    oldResizeProc(_w);
#endif

	    insensitiveGC = LABEL(label).insensitive_GC;

	    LABEL(label).TextRect.x += 1;
	    LABEL(label).TextRect.y += 1;
	    if (LABEL(label)._acc_text != 0)
	    {
		LABEL(label).acc_TextRect.x += 1;
		LABEL(label).acc_TextRect.y += 1;
	    }
	    LABEL(label).insensitive_GC = _gadgetParentTopShadowGC(label);
	    (*oldLabelGadgetExposeProc)(_w, _event, _region);
	    XtReleaseGC(_w, LABEL(label).insensitive_GC);

	    LABEL(label).TextRect.x -= 1;
	    LABEL(label).TextRect.y -= 1;
	    if (LABEL(label)._acc_text != 0)
	    {
		LABEL(label).acc_TextRect.x -= 1;
		LABEL(label).acc_TextRect.y -= 1;
	    }
	    LABEL(label).insensitive_GC = _gadgetParentBottomShadowGC(label);
	    (*oldLabelGadgetExposeProc)(_w, _event, _region);
	    XtReleaseGC(_w, LABEL(label).insensitive_GC);

	    LABEL(label).insensitive_GC = insensitiveGC;

#if defined(LesstifVersion)
	    XtClass(_w)->core_class.resize = oldResizeProc;
#endif
	}
    }
Exemple #7
0
void XtGetValues(
    register Widget   w,
    register ArgList  args,
    register Cardinal num_args)
{
    WidgetClass wc;
    int targ;
    XtAppContext app = XtWidgetToApplicationContext(w);

    if (num_args == 0) return;
    if ((args == NULL) && (num_args != 0)) {
	XtAppErrorMsg(app,
		"invalidArgCount","xtGetValues",XtCXtToolkitError,
            "Argument count > 0 on NULL argument list in XtGetValues",
              (String *)NULL, (Cardinal *)NULL);
    }

    LOCK_APP(app);
    wc = XtClass(w);
    LOCK_PROCESS;
    /* Get widget values */
    targ = GetValues((char*)w, (XrmResourceList *) wc->core_class.resources,
	wc->core_class.num_resources, args, num_args);
    UNLOCK_PROCESS;
    if (targ != -1 && XtIsWidget(w)) {
	XtTranslations translations = _XtGetTranslationValue(w);
	_XtCopyToArg((char*)&translations, &args[targ].value,
		     sizeof(XtTranslations));
    }

    /* Get constraint values if necessary */
    /* constraints may be NULL if constraint_size==0 */
    if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)) &&
	w->core.constraints) {
	ConstraintWidgetClass cwc
	    = (ConstraintWidgetClass) XtClass(XtParent(w));
	LOCK_PROCESS;
	GetValues((char*)w->core.constraints,
		  (XrmResourceList *)(cwc->constraint_class.resources),
		  cwc->constraint_class.num_resources, args, num_args);
	UNLOCK_PROCESS;
    }
    /* Notify any class procedures that we have performed get_values */
    CallGetValuesHook(wc, w, args, num_args);

    /* Notify constraint get_values if necessary */
    if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)))
	CallConstraintGetValuesHook(XtClass(XtParent(w)), w, args,num_args);
    UNLOCK_APP(app);
} /* XtGetValues */
Exemple #8
0
static void
FocusChange(
        Widget wid,
        XmFocusChange change)
{   
  /* Enter/Leave is called only in pointer mode,
   * Focus in/out only called in explicit mode.
   */
  switch(    change    )
    {
    case XmENTER:
      if(    !(((XmGadget) wid)->gadget.highlight_on_enter)    )
	{
	  break ;
	}
      /* Drop through. */
    case XmFOCUS_IN:
      if(    change == XmFOCUS_IN    ) /* Because of drop-though. */
	{
	  ((XmGadget) wid)->gadget.have_traversal = TRUE ;
	}
      if(    ((XmGadgetClass) XtClass( wid))
                                           ->gadget_class.border_highlight    )
        {   
	  (*(((XmGadgetClass) XtClass( wid))
                                      ->gadget_class.border_highlight))( wid) ;
	} 
      break ;
    case XmLEAVE:
      if(    !(((XmGadget) wid)->gadget.highlight_on_enter)    )
	{
	  break ;
	}
      /* Drop through. */
    case XmFOCUS_OUT:
      if(    change == XmFOCUS_OUT    ) /* Because of drop-though. */
	{
	  ((XmGadget) wid)->gadget.have_traversal = FALSE ;
	}
      if(    ((XmGadgetClass) XtClass( wid))
                                         ->gadget_class.border_unhighlight    )
        {   
	  (*(((XmGadgetClass) XtClass( wid))
                                    ->gadget_class.border_unhighlight))( wid) ;
	} 
      break ;
    }
  return ;
}
/*ARGSUSED*/
static void
XawLabelInitialize(Widget request, Widget cnew,
		   ArgList args, Cardinal *num_args)
{
    LabelWidget lw = (LabelWidget)cnew;

    if (!lw->label.font) XtError("Aborting: no font found\n");
    if (lw->simple.international && !lw->label.fontset)
	XtError("Aborting: no fontset found\n");

    if (lw->label.label == NULL)
	lw->label.label = XtNewString(lw->core.name);
    else
	lw->label.label = XtNewString(lw->label.label);

    GetNormalGC(lw);
    GetGrayGC(lw);

    SetTextWidthAndHeight(lw);

    if (XtHeight(lw) == 0)
	XtHeight(lw) = lw->label.label_height + 2 * lw->label.internal_height;

    set_bitmap_info(lw);		/* need core.height */

    if (XtWidth(lw) == 0)		/* need label.lbm_width */
	XtWidth(lw) = lw->label.label_width + 2 * lw->label.internal_width +
		      LEFT_OFFSET(lw);

    lw->label.label_x = lw->label.label_y = 0;
    (*XtClass(cnew)->core_class.resize)((Widget)lw);
}
Exemple #10
0
void
XltHelpOnStrokes(Widget W)
{
static Widget Dialog = NULL;
Widget Shell = W;

	while (!XtIsShell(Shell)) Shell = XtParent(Shell);
	if (Dialog == NULL)
	{
	XmString string;
	XtResource resources[] =
	{
	    {"messageString", "MessageString", XtRString, sizeof(String), XtOffset(AppResourcesPtr, DefaultHelpString), XtRImmediate, DefaultHelp},
	};
	    Dialog = XmCreateInformationDialog(Shell, "HelpOnStrokes", NULL, 0);
	    XtGetSubresources(W,
			      &AppResources,
			      XtName(Dialog),
			      XtClass(Dialog)->core_class.class_name,
			      resources,
			      XtNumber(resources),
			      NULL, 0);
	    string = XmStringCreateLtoR(AppResources.DefaultHelpString, XmFONTLIST_DEFAULT_TAG);
	    XtVaSetValues(Dialog,
		    XmNmessageString, string,
		    NULL);
	    XmStringFree(string);
	    XtUnmanageChild(XmMessageBoxGetChild(Dialog, XmDIALOG_HELP_BUTTON));
	}
	XtManageChild(Dialog);
}
Exemple #11
0
/*ARGSUSED*/
static Boolean
XawFormConstraintSetValues(Widget current, Widget request, Widget cnew,
			   ArgList args, Cardinal *num_args)
{
    FormConstraints cfc = (FormConstraints)current->core.constraints;
    FormConstraints nfc = (FormConstraints)cnew->core.constraints;

    if (cfc->form.top != nfc->form.top || cfc->form.bottom != nfc->form.bottom
	|| cfc->form.left != nfc->form.left || cfc->form.right != nfc->form.right
	|| cfc->form.dx != nfc->form.dx || cfc->form.dy != nfc->form.dy
	|| cfc->form.horiz_base != nfc->form.horiz_base
	|| cfc->form.vert_base != nfc->form.vert_base) {
	FormWidget fp = (FormWidget)XtParent(cnew);

	/* If there are no subclass ConstraintSetValues procedures remaining
	 * to be invoked, and if there is no geometry request about to be
	 * made, then invoke the new layout now; else defer it
	 */
	if (XtClass(XtParent(cnew)) == formWidgetClass
	    && XtX(current) == XtX(cnew)
	    && XtY(current) == XtY(cnew)
	    && XtWidth(current) == XtWidth(cnew)
	    && XtHeight(current) == XtHeight(cnew)
	    && XtBorderWidth(current) == XtBorderWidth(cnew))
	    Layout(fp, 0, 0, True);
	else
	    fp->form.needs_relayout = True;
    }

    return (False);
}
Exemple #12
0
/*
 * Fix for Bug Traq 4251941 - segfault after double tear-off and close
 * This callback is added to menu after the creation. 
 * It adds the destroy callback awtTearOffShellDestroy to remove the lost focus callback on destroy
 */
static void awtTearOffActivatedCallback(Widget widget, XtPointer closure, XtPointer data) {
    Widget shell;
    shell = XtParent(widget);
    if (shell != NULL && XtClass(shell) == transientShellWidgetClass) {
	XtAddCallback(shell, XtNdestroyCallback, awtTearOffShellDestroy, widget);
    }
}
void test2sub(){

Widget labelw_msg;
int status;

	avs_xt_hier("Tchcksbcls2", "XtCheckSubclass");
	tet_infoline("PREP: Install error message handler");
	XtAppSetErrorMsgHandler(app_ctext, &XtEM_Proc2);
        tet_infoline("PREP: Create test label widget");
        labelw_msg = (Widget) CreateLabelWidget("Test", boxw1);
        tet_infoline("PREP: Create windows for widgets and map them");
        XtRealizeWidget(topLevel);
	tet_infoline("TEST: Error message is not generated for subclass widget");
	XtCheckSubclass(labelw_msg, coreWidgetClass, "ApTest");
	status = avs_get_event(1);
	if (status != 0) {
		tet_infoline("ERROR: Error message handler was called");
		tet_result(TET_FAIL);
		avs_set_event(1,0);
	}
	tet_infoline("TEST: Error message is not generated for class of widget");
	XtCheckSubclass(labelw_msg, XtClass(labelw_msg), "ApTest");
	status = avs_get_event(1);
	if (status != 0) {
		tet_infoline("ERROR: Error message handler was called");
		tet_result(TET_FAIL);
	}
	tet_result(TET_PASS);
}
Exemple #14
0
/*ARGSUSED*/
static Boolean 
SetValues(Widget old,
	  Widget ref,
	  Widget new_w,
	  ArgList args,
	  Cardinal *num_args)
{
  XmExtObject	  ne = (XmExtObject) new_w;
  Widget	  resParent = ne->ext.logicalParent;
  XmWidgetExtData ext = _XmGetWidgetExtData(resParent, ne->ext.extensionType);
  Cardinal	  extSize;
  
  if (resParent)
    {
      _XmProcessLock();
      extSize = XtClass(new_w)->core_class.widget_size;
      
      ext->widget = new_w;
      
      ext->oldWidget = (Widget) _XmExtObjAlloc(extSize);
      memcpy((char *)ext->oldWidget, (char *)old, extSize); 
      
      ext->reqWidget = (Widget) _XmExtObjAlloc(extSize);
      memcpy((char *)ext->reqWidget, (char *)ref, extSize); 
      _XmProcessUnlock();

      /* Convert the necessary fields from unit values to pixel values. */
      _XmExtImportArgs(new_w, args, num_args);
    }

  return FALSE;
}
Exemple #15
0
/*ARGSUSED*/
static Boolean 
SetValues(
        Widget current,
        Widget request,		/* unused */
        Widget new_w,
        ArgList args,		/* unused */
        Cardinal *num_args )	/* unused */
{
    Widget child ;
    XmDialogSavvyTrait trait ;

    if(!current->core.mapped_when_managed 
       && new_w->core.mapped_when_managed) {   
        if((child = GetRectObjKid ((CompositeWidget) new_w))
	   && !child->core.being_destroyed    ) {   
	    if ((trait = (XmDialogSavvyTrait)
		 XmeTraitGet((XtPointer) XtClass(child), 
			     XmQTdialogShellSavvy)) != NULL) {
		trait->callMapUnmapCB(child, True);	/* call Map callback */
	    }
            XtPopup(new_w, XtGrabNone) ;
	} 
    } 

    return (FALSE);
}
Exemple #16
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);
}
Exemple #17
0
/*----------------------------------------------------------------------*/
void
_XfePrimitivePrepareComponents(Widget w,int flags)
{
	WidgetClass					cc;
	XfePrimitiveWidgetClass		pc;
	Cardinal					i;
	Cardinal					count;

	/* Someone has to be nuts to have more than 32 subclasses... */
	static XfePrepareProc		proc_table[32];

	/* Traverse all classes until we find XmPrimitive */
	for (cc = XtClass(w),count = 0; 
		 cc != xmPrimitiveWidgetClass; 
		 cc = cc->core_class.superclass)
	{
		pc = (XfePrimitiveWidgetClass) cc;

		/* Add the method to the table as long as it is not NULL */
		if (pc->xfe_primitive_class.prepare_components)
		{
			proc_table[count++] = pc->xfe_primitive_class.prepare_components;
		}
	}

	/* Invoke the methods in reverse order */
	for (i = count; i; i--)
	{
		XfePrepareProc proc = proc_table[i - 1];

		/* Invoke the prepare components method for this class */
		(*proc)(w,flags);
	}
}
Exemple #18
0
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;
}
Exemple #19
0
/*----------------------------------------------------------------------*/
static void
Realize(Widget w,XtValueMask * mask,XSetWindowAttributes* wa)
{
    XSetWindowAttributes attr;

    /* Make sure only subclasses of XfePrimitive get instanciated */
    if ((XtClass(w) == xfePrimitiveWidgetClass))
    {
		_XfeWarning(w,MESSAGE0);

		return;
    }

    /* Let XmPrimitive create the window */
    (*xmPrimitiveWidgetClass->core_class.realize)(w,mask,wa);
    
    /* Set the Bit Gravity */
    attr.bit_gravity = _XfePrimitiveAccessBitGravity(w);
    
    XChangeWindowAttributes(XtDisplay(w),_XfeWindow(w),CWBitGravity,&attr);

    /* Define the cursor if needed */
    if (_XfeCursorGood(_XfeCursor(w)) && _XfePointerInside(w))
	{
		XfeCursorDefine(w,_XfeCursor(w));
    }
}
Exemple #20
0
/*
 *	zuePXAUEUnitEditorForSubWidget
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *	Return a pointer to the UnitEditor field in the
 *	collection of UnitEditors for the particular
 *	Widget.
 *
 *	The caller can provide ANY
 */
static UNITEDITORt *
zuePXAUEUnitEditorForSubWidget( Widget wSub )
{
    int		i;
    UNITEDITORt	*uePCur;
    Widget		wTop;

    /* First find the TOP Widget for the UNITEDITOR */
    /* Do this by climbing up the Widget hierarchy */
    /* until we find a Widget of the proper class */


    wTop = wSub;
    while ( wTop != NULL ) {
        if ( XtClass(wTop) == UNITEDITORCLASS ) break;
        wTop = XtParent(wTop);
    }

    /* Now find the UNITEDITOR that is associated with */
    /* the TOP Widget */

    uePCur = PVAI(SvaEditors,UNITEDITORt,0);
    for ( i=0; i<iVarArrayElementCount(SvaEditors); i++, uePCur++ ) {
        if ( uePCur->wTop == wTop )
            return(uePCur);
    }

    DFATAL(( "Could not find a UnitEditor" ));
    return(NULL);	/* for lint */
}
Exemple #21
0
/************************************************************************
 *
 *  _XmNotifyChildrenVisual
 *	Loop through the child set of new and for any widget/gadget that has
 *	a CareParentVisual trait, call the redraw proc.
 *      The redraw proc will return True if the widget needs to have the
 *	parent redrawn as well.
 *
 ************************************************************************/
Boolean 
_XmNotifyChildrenVisual(
        Widget cur,
        Widget new_w,
        Mask visual_flag)
{
   register int i;
   Widget child;
   Boolean redisplay = False;
   XmCareVisualTrait care_visual ;
   CompositeWidget cw = (CompositeWidget) new_w ;

   for (i = 0; i < cw->composite.num_children; i++) {
       child = cw->composite.children[i];

       if ((care_visual = (XmCareVisualTrait)
	    XmeTraitGet((XtPointer) XtClass(child),
			XmQTcareParentVisual)) != NULL)

	   redisplay |= care_visual->redraw(child, cur, new_w, visual_flag) ;

   }

   return (redisplay);
}
Exemple #22
0
static void
Disarm(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XmDrawnButtonCallbackStruct cbs;

    if (DB_Armed(w))
    {
	DB_Armed(w) = False;
	if (XtIsRealized(w))
	    XtClass(w)->core_class.expose(w, event, (Region)NULL);
    }

    if (DB_DisarmCallback(w))
    {
	cbs.reason = XmCR_DISARM;
	cbs.event = event;
	cbs.window = XtWindow(w);
	cbs.click_count = DB_ClickCount(w);

	XFlush(XtDisplay(w));

	XtCallCallbackList(w,
			   DB_DisarmCallback(w),
			   (XtPointer)&cbs);
    }
}
Exemple #23
0
/*
** Part of dialog mnemonic processing.  Search the widget tree under w
** for widgets with mnemonics.  When found, add a passive grab to the
** dialog widget for the mnemonic character, thus directing mnemonic
** events to the dialog widget.
*/
static void addMnemonicGrabs(Widget dialog, Widget w)
{
    char mneString[2];
    WidgetList children;
    int numChildren, i, isMenu;
    KeySym mnemonic = '\0';
    unsigned char rowColType;
    
    if (XtIsComposite(w)) {
	if (XtClass(w) == xmRowColumnWidgetClass) {
	    XtVaGetValues(w, XmNrowColumnType, &rowColType, 0);
	    isMenu = rowColType != XmWORK_AREA;
	} else
	    isMenu = False;
	if (!isMenu) {
	    XtVaGetValues(w, XmNchildren, &children, XmNnumChildren,
		    &numChildren, 0);
	    for (i=0; i<numChildren; i++)
    		addMnemonicGrabs(dialog, children[i]);
    	}
    } else {
	XtVaGetValues(w, XmNmnemonic, &mnemonic, 0);
	if (mnemonic != '\0') {
	    mneString[0] = mnemonic; mneString[1] = '\0';
	    XtGrabKey(dialog, XKeysymToKeycode(XtDisplay(dialog),
	    	    XStringToKeysym(mneString)), Mod1Mask,
	    	    True, GrabModeAsync, GrabModeAsync);
	}
    }
}
Exemple #24
0
static void
Arm(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XmDrawnButtonCallbackStruct cbs;

    XmProcessTraversal(w, XmTRAVERSE_CURRENT);

    if (!DB_Armed(w))
    {
	DB_Armed(w) = True;
	if (event)
	    DB_ArmTimeStamp(w) = event->xbutton.time;

	if (XtIsRealized(w))
	    XtClass(w)->core_class.expose(w, event, NULL);

	if (DB_ArmCallback(w))
	{
	    cbs.reason = XmCR_ARM;
	    cbs.event = event;
	    cbs.window = XtWindow(w);
	    cbs.click_count = DB_ClickCount(w);

	    XFlush(XtDisplay(w));

	    XtCallCallbackList(w,
			       DB_ArmCallback(w),
			       (XtPointer)&cbs);
	}
    }
}
Exemple #25
0
static void
Activate(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XmDrawnButtonCallbackStruct cbs;

    DB_ClickCount(w) = 1;

    DB_Armed(w) = False;

    if (XtIsRealized(w))
	XtClass(w)->core_class.expose(w, event, NULL);

    if (event->xany.type == KeyPress || event->xany.type == KeyRelease ||
	(event->xbutton.x >= 0 && event->xbutton.x < XtWidth(w) &&
	 event->xbutton.y >= 0 && event->xbutton.y < XtHeight(w)))
    {
	cbs.reason = XmCR_ACTIVATE;
	cbs.event = event;
	cbs.window = XtWindow(w);
	cbs.click_count = DB_ClickCount(w);
	if (XmIsRowColumn(XtParent(w)))
	{
	    RC_MenuMenuCallback(w, &cbs);
	}
	if (!Lab_SkipCallback(w) && DB_ActivateCallback(w))
	{
	    XFlush(XtDisplay(w));

	    XtCallCallbackList(w,
			       DB_ActivateCallback(w),
			       (XtPointer)&cbs);
	}
    }
}
Exemple #26
0
static int
handle_dialog_child(Widget wgt, void (*manage_func) (Widget))
#endif
{
    int i,
        num_children;
    Widget *children;
    int error_flag = UX_ERROR;

    XtVaGetValues(wgt,
		  XmNnumChildren, &num_children,
		  XmNchildren, &children,
		  NULL);

    /*-----------------------------------------------------
     * We manage/unmanage the first rectObj child in the list.
     * Note that the check for rectObjClass is necessary since
     * some implementations of Motif add protocol children to
     * the dialogShell. Additionally, when the LANG is set to
     * Japanese, a widget of class Core is created. This widget
     * should not be managed. We'll skip it.
     *-----------------------------------------------------*/

    for (i = 0; i < num_children; i++) {
	if (XtIsSubclass(children[i], rectObjClass) &&
	    (XtClass(children[i]) != coreWidgetClass)) {
	    (*manage_func) (children[i]);
	    error_flag = UX_NO_ERROR;
	    break;
	}
    }

    return (error_flag);
}
Exemple #27
0
/******************************************************************************
 *
 *  CalcWidgetSize:
 *      Called by Reconfigure 
 *
 *****************************************************************************/
static void 
CalcWidgetSize(
        Widget w
              )
{
 ExmSimpleWidgetClass wc = (ExmSimpleWidgetClass)XtClass(w);
 ExmSimpleWidget sw = (ExmSimpleWidget)w;

 /* Call CalcVisualSize */
   if (wc->simple_class.calc_visual_size)
     (*(wc->simple_class.calc_visual_size))((Widget)sw);

 /* Compute the widget's width if asked to.  Otherwise, set the
    widget's width to the preferred width. */ 
   if (sw->simple.need_to_compute_width == True)
     sw->core.width = sw->simple.visual.width + 
                     (2 * (sw->simple.margin_width +
		           sw->primitive.shadow_thickness +
		           sw->primitive.highlight_thickness));
   else
     sw->core.width = sw->simple.pref_width;

 /* Compute the widget's height if asked to.  Otherwise, set the
    widget's height to the preferred height. */ 
   if (sw->simple.need_to_compute_height == True)
     sw->core.height = sw->simple.visual.height + 
                      (2 * (sw->simple.margin_height +
		            sw->primitive.shadow_thickness +
		            sw->primitive.highlight_thickness));
   else
     sw->core.height = sw->simple.pref_height;
}
Exemple #28
0
/******************************************************************************
 *
 *  DrawVisual:
 *     Called by ExmSimple whenever it needs to draw or redraw the
 *     widget visual (either an oval or a rectangle).
 *
 *****************************************************************************/
static void 
DrawVisual (
        Widget w
           )
{
 ExmSimpleWidgetClass wc = (ExmSimpleWidgetClass)XtClass(w);
 ExmSimpleWidget sw = (ExmSimpleWidget)w;

 /* Draw the oval or the rectangle, space permitting. */
   if (sw->simple.visual.width > 0 && sw->simple.visual.height > 0) {
     switch (sw->simple.simple_shape) {
	    case(ExmSHAPE_OVAL):
	    default:
		XFillArc (XtDisplay(w), XtWindow(w),
			  wc->simple_class.select_gc(w),
			  sw->simple.visual.x, sw->simple.visual.y,
			  sw->simple.visual.width, sw->simple.visual.height,
			  0, 360 * 64);
		break;
	    case(ExmSHAPE_RECTANGLE):
		XFillRectangle (XtDisplay(w), XtWindow(w),
                          wc->simple_class.select_gc(w),
                          sw->simple.visual.x, sw->simple.visual.y,
                          sw->simple.visual.width, sw->simple.visual.height);
		break;
     }
   }
}
Exemple #29
0
/*
 * ENTER/LEAVE should only happen when mwm is in pointer-follows-mouse mode.
 * FOCUS_IN/FOCUS_OUT otherwise.
 */
static void
focus_change(Widget w, XmFocusChange change)
{
    XmGadgetClass gc = (XmGadgetClass)XtClass(w);

	DEBUGOUT(_LtDebug(__FILE__, w, "XmGadget focus_change\n"));

    switch (change)
    {
    case XmENTER:
	if (!G_HighlightOnEnter(w))
	{
	    break;
	}

	if (gc->gadget_class.border_highlight)
	{
	    (gc->gadget_class.border_highlight) (w);
	}

	break;

    case XmFOCUS_IN:
	G_HaveTraversal(w) = True;

	if (gc->gadget_class.border_highlight)
	{
	    (gc->gadget_class.border_highlight) (w);
	}

	break;

    case XmLEAVE:
	if (!G_HighlightOnEnter(w))
	{
	    break;
	}

	if (gc->gadget_class.border_unhighlight)
	{
	    (gc->gadget_class.border_unhighlight) (w);
	}

	break;

    case XmFOCUS_OUT:
	G_HaveTraversal(w) = False;

	if (gc->gadget_class.border_unhighlight)
	{
	    (gc->gadget_class.border_unhighlight) (w);
	}

	break;
    }
}
Exemple #30
0
/******************************************************************************
 *
 *  Destroy: 
 *      Called by the Intrinsics whenever this widget is deallocated. 
 *
 *****************************************************************************/
static void
Destroy (Widget w)
{
 ExmSimpleWidgetClass wc = (ExmSimpleWidgetClass) XtClass(w);

 /* The ExmSimple widget allocates two internal GC's.  In order to prevent 
    memory leaks, we must destroy these GC's.  */ 
   if (wc->simple_class.destroy_gc) 
     (*(wc->simple_class.destroy_gc))(w);
}