Ejemplo n.º 1
0
static Widget widget_to_dialog(Widget w)
{
  /* find dialog parent of w, if any */
  while (w)
    {
      w = XtParent(w);
      if (w)
	{
	  if ((XmIsFileSelectionBox(w)) ||     /* file selection dialog */
	      (XmIsMessageBox(w)))             /* includes template dialog */
	    return(w);
	  if ((XmIsDialogShell(w)) ||
	      (XtIsApplicationShell(w)))
	    return(NULL);
	}
    }
  return(NULL);
}
Ejemplo n.º 2
0
/************************************************************************
 *									*
 *  InsertChild								*
 *									*
 ************************************************************************/
static void 
InsertChild(
        Widget w )
{
    CompositeWidgetClass superclass = (CompositeWidgetClass)
	                xmMainWindowClassRec.core_class.superclass ;
    XmMainWindowWidget   mw = (XmMainWindowWidget ) w->core.parent;
    XmScrolledWindowConstraint nc = GetSWConstraint(w);
    XtWidgetProc insert_child;

    if (!XtIsRectObj(w)) return;

    
    /* Try to guess the nature of the child_type .
       If we're lucky, fine, otherwise, something bad might happens: the
       scrolledwindow can take it as a workwindow and possibly reparents
       it to the clipwindow.
       In the absence of a set childType constraint resource set, 
       there is not much we can do to avoid the problem */
    /* Note: auto created Separator were already labelled in Initialize */

    if (nc->child_type == (unsigned char) RESOURCE_DEFAULT) {
	XmMenuSystemTrait menuSTrait;

	if ((menuSTrait = (XmMenuSystemTrait) 
	     XmeTraitGet ((XtPointer) XtClass(w), XmQTmenuSystem)) != NULL) {
	    if (menuSTrait->type(w) == XmMENU_BAR && 
		!mw->mwindow.MenuBar) {	   
		/* If it's a menubar, and we don't have one yet, use it. */
		nc->child_type = XmMENU_BAR ;
	    }
	}  else 

	if (XmIsCommandBox(w)) {
	    if (!mw->mwindow.CommandWindow)   {		
		/* If it's a command, and we don't have one, get it */
		nc->child_type = XmCOMMAND_WINDOW ;
	    }
	} else 

	    /* new in 2.0 */
	if (XmIsMessageBox(w)) {
	    if (!mw->mwindow.Message)   {		
		nc->child_type = XmMESSAGE_WINDOW ;
	    }
	}
    }

    if (nc->child_type == XmMENU_BAR) {
	mw->mwindow.MenuBar = w;	
    } else
    if (nc->child_type == XmCOMMAND_WINDOW) {
	mw->mwindow.CommandWindow = w;
    } else
    if (nc->child_type == XmMESSAGE_WINDOW) {
	mw->mwindow.Message = w;
    } 

    /* call ScrolledWindow InsertChild directly, since it does nothing
       to the MainWindow known childType */
    _XmProcessLock();
    insert_child = superclass->composite_class.insert_child;
    _XmProcessUnlock();
    (*insert_child)(w);

}