static Widget get_window_widget(Widget w) { if( XtIsShell( w ) || XtIsShell(XtParent(w)) ) return( w ); return( get_window_widget( XtParent(w) ) ); }
Widget UxRealWidget( Widget wgt ) #endif { if (wgt) { if (XtIsShell(wgt)) { return(wgt); } else if (XtIsShell(XtParent(wgt))) { return XtParent(wgt); } } return wgt; }
// Unmanage specific widget void UnmanageThisCB(Widget, XtPointer client_data, XtPointer) { Widget w = Widget(client_data); Widget shell = w; if (!XtIsShell(shell)) shell = XtParent(shell); if (shell != 0 && XtIsShell(shell) && !XmIsDialogShell(shell)) XtPopdown(shell); XtUnmanageChild(w); }
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 */
/*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; }
void _XtPopup( Widget widget, XtGrabKind grab_kind, _XtBoolean spring_loaded) { register ShellWidget shell_widget = (ShellWidget) widget; if (! XtIsShell(widget)) { XtAppErrorMsg(XtWidgetToApplicationContext(widget), "invalidClass","xtPopup",XtCXtToolkitError, "XtPopup requires a subclass of shellWidgetClass", (String *)NULL, (Cardinal *)NULL); } if (! shell_widget->shell.popped_up) { XtGrabKind call_data = grab_kind; XtCallCallbacks(widget, XtNpopupCallback, (XtPointer)&call_data); shell_widget->shell.popped_up = TRUE; shell_widget->shell.grab_kind = grab_kind; shell_widget->shell.spring_loaded = spring_loaded; if (shell_widget->shell.create_popup_child_proc != NULL) { (*(shell_widget->shell.create_popup_child_proc))(widget); } if (grab_kind == XtGrabExclusive) { XtAddGrab(widget, TRUE, spring_loaded); } else if (grab_kind == XtGrabNonexclusive) { XtAddGrab(widget, FALSE, spring_loaded); } XtRealizeWidget(widget); XMapRaised(XtDisplay(widget), XtWindow(widget)); } else XRaiseWindow(XtDisplay(widget), XtWindow(widget)); } /* _XtPopup */
static void BrowseCallback(Widget w, XtPointer client_data, XtPointer call_data) { #ifdef DEBUG printf("%s:BrowseCallback(%d) - %s\n", __FILE__, __LINE__, XtName(w)); #endif if (FilePicker_FileSelectionDialog(XtParent(w)) == NULL) { #ifdef DEBUG printf("%s:BrowseCallback(%d) - %s creating FSB\n", __FILE__, __LINE__, XtName(w)); #endif if (FilePickerClass_FileSelectionDialog(XtParent(w)) == NULL) { Widget Shell = XtParent(w); #ifdef DEBUG printf("%s:BrowseCallback(%d) - %s creating class FSB\n", __FILE__, __LINE__, XtName(w)); #endif while (!XtIsShell(Shell)) Shell = XtParent(Shell); FilePickerClass_FileSelectionDialog(XtParent(w)) = XmCreateFileSelectionDialog(Shell, "FilePickerDialog", NULL, 0); } FilePicker_FileSelectionDialog(XtParent(w)) = FilePickerClass_FileSelectionDialog(XtParent(w)); } XtRemoveAllCallbacks(FilePicker_FileSelectionDialog(XtParent(w)), XmNokCallback); XtRemoveAllCallbacks(FilePicker_FileSelectionDialog(XtParent(w)), XmNcancelCallback); XtAddCallback(FilePicker_FileSelectionDialog(XtParent(w)), XmNokCallback, (XtCallbackProc)BrowseOkCallback, XtParent(w)); XtAddCallback(FilePicker_FileSelectionDialog(XtParent(w)), XmNcancelCallback, (XtCallbackProc)XtUnmanageChild, NULL); XtManageChild(FilePicker_FileSelectionDialog(XtParent(w))); }
int HGU_XmGetShellOffsets( Widget w, Position *x_off, Position *y_off) { Display *dpy; Window win; Window root, parent, *children; unsigned int nchildren; int x=0, y=0, x0=0, y0=0; /* only bother if this is a shell widget */ if( !XtIsShell( w ) ) return( -1 ); /* check XWindow hierarchy for reparenting */ dpy = XtDisplay( w ); win = XtWindow( w ); HGU_XmQueryRootPosition( dpy, win, &x, &y); if( !XQueryTree( dpy, win, &root, &parent, &children, &nchildren ) ) return( -1 ); /* check if reparented */ while( parent != root ){ win = parent; if( !XQueryTree( dpy, win, &root, &parent, &children, &nchildren ) ) return( -1 ); } HGU_XmQueryRootPosition( dpy, win, &x0, &y0 ); *x_off = x - x0; *y_off = y - y0; return( 0 ); }
extern void XltWaitTillMapped(Widget dialog) { XWindowAttributes window_attributes; Boolean mapped = False; Widget w = dialog; while (!XtIsShell(w)) w = XtParent(w); XGetWindowAttributes(XtDisplay(w), XtWindow(w), &window_attributes); if (window_attributes.map_state == IsUnmapped) { XtAddEventHandler(w, StructureNotifyMask, False, (XtEventHandler)StructureNotifyHandler, (XtPointer)&mapped); while (/*XtIsManaged(w) &&*/ !mapped) { XtAppProcessEvent(XtWidgetToApplicationContext(w), XtIMXEvent); } XtRemoveEventHandler(w, StructureNotifyMask, False, (XtEventHandler)StructureNotifyHandler, (XtPointer)&mapped); } XmUpdateDisplay(w); }
/* WIDGET is an Xt widget, VISUAL and DEPTH are return values */ void visual_info_from_widget (Widget widget, Visual **visual, int *depth) { /* grab the visual and depth from the nearest shell ancestor */ Widget p = XtParent(widget); *visual = CopyFromParent; *depth = -1; while (*visual == CopyFromParent && p) { if (XtIsShell(p)) { *visual = ((ShellWidget)p)->shell.visual; *depth = p->core.depth; } p = XtParent(p); } if (*visual == CopyFromParent || !*visual) { if (debug_colors > 1) fprintf (stderr, "\nvisual_info_from_widget:" " failed, using DefaultVisualOfScreen"); *visual = DefaultVisualOfScreen (XtScreen (widget)); *depth = DefaultDepthOfScreen (XtScreen (widget)); } else if (debug_colors > 1) fprintf (stderr, "\nvisual_info_from_widget: succeeded"); }
void xlw_popup_menu (Widget widget, XEvent *event) { XlwMenuWidget mw; if (!XtIsShell (widget)) return; mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0]; if (event) XtCallActionProc ((Widget) mw, "start", event, NULL, 0); else { XEvent dummy; XButtonPressedEvent *bd = &dummy.xbutton; bd->type = ButtonPress; bd->serial = 0; bd->send_event = 0; bd->display = XtDisplay (widget); bd->window = XtWindow (XtParent (widget)); bd->time = CurrentTime; bd->button = 0; XQueryPointer (bd->display, bd->window, &bd->root, &bd->subwindow, &bd->x_root, &bd->y_root, &bd->x, &bd->y, &bd->state); XtCallActionProc ((Widget) mw, "start", &dummy, NULL, 0); } }
static XtPointer* get_im_info_ptr(Widget w, Boolean create) { Widget p; XmVendorShellExtObject ve; XmWidgetExtData extData; XmImShellInfo im_info; XmImDisplayInfo xim_info; if (w == NULL) return NULL; p = w; while (!XtIsShell(p)) p = XtParent(p); /* Check extension data since app could be attempting to create * a text widget as child of menu shell. This is illegal, and will * be detected later, but check here so we don't core dump. */ if ((extData = _XmGetWidgetExtData((Widget)p, XmSHELL_EXTENSION)) == NULL) return NULL; ve = (XmVendorShellExtObject) extData->widget; return &ve->vendor.im_info; }
void PopupCallback( Widget w, XtPointer client_data, XtPointer call_data) { Widget widget; Widget *children; int numChildren; if( w || call_data ) { /* to satisfy IRIX646 compiler */ } widget = (Widget) client_data; if( XtIsShell( widget ) ) { XtVaGetValues(widget, XtNchildren, &children, XtNnumChildren, &numChildren, NULL); if( numChildren ) { XtManageChild(*children); XtMapWidget(*children); } XtPopup( widget, XtGrabNone ); } }
void HelpModeCB( Widget w, caddr_t client_data, caddr_t call_data ) { Widget widget; switch(DtHelpReturnSelectedWidgetId(style.shell, (Cursor)NULL, &widget)) { /* * There are additional cases (e.g. user aborts request) but I * don't feel they warrant an error dialog. */ case DtHELP_SELECT_VALID: while (!XtIsShell(widget)) { if (XtHasCallbacks(widget, XmNhelpCallback) == XtCallbackHasSome) { XtCallCallbacks(widget, XmNhelpCallback, (XtPointer)NULL); return; } widget = XtParent(widget); } break; case DtHELP_SELECT_INVALID: ErrDialog((char *)GETMESSAGE(2, 8, "You must select an item\nwithin the Style Manager."), style.shell); break; } }
void XtTranslateCoords( register Widget w, _XtPosition x, _XtPosition y, register Position *rootx, /* return */ register Position *rooty) /* return */ { Position garbagex, garbagey; XtAppContext app = XtWidgetToApplicationContext(w); LOCK_APP(app); if (rootx == NULL) rootx = &garbagex; if (rooty == NULL) rooty = &garbagey; *rootx = x; *rooty = y; for (; w != NULL && ! XtIsShell(w); w = w->core.parent) { *rootx += w->core.x + w->core.border_width; *rooty += w->core.y + w->core.border_width; } if (w == NULL) XtAppWarningMsg(app, "invalidShell","xtTranslateCoords",XtCXtToolkitError, "Widget has no shell ancestor", (String *)NULL, (Cardinal *)NULL); else { Position x, y; _XtShellGetCoordinates( w, &x, &y ); *rootx += x + w->core.border_width; *rooty += y + w->core.border_width; } UNLOCK_APP(app); }
/* Procedure to create de dialog. */ void create_sigma_dialog(Widget parent){ XmString message; Widget temp_widget = parent; /* Ensure the parent of the dialog is a shell widget */ while ( !XtIsShell(temp_widget) ) { temp_widget = XtParent(temp_widget); } message = XmStringLtoRCreate(SIGMA_MESSAGE, XmSTRING_DEFAULT_CHARSET); argcount = 0; XtSetArg(args[argcount], XmNselectionLabelString, message); argcount++; sigma_dialog = XmCreatePromptDialog(temp_widget, "gaussian dialog", args, argcount); /* Remove the help button from the dialog */ temp_widget = XmSelectionBoxGetChild(sigma_dialog, XmDIALOG_HELP_BUTTON); XtUnmanageChild(temp_widget); /* Add the actions to the buttons */ XtAddCallback(sigma_dialog, XmNokCallback, (XtCallbackProc) ok_sigmabutton_callback, (XtPointer) NULL); XtAddCallback(sigma_dialog, XmNcancelCallback, (XtCallbackProc) cancel_sigmabutton_callback, (XtPointer) NULL); XmStringFree(message); }/*end create_sigma_dialog*/
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); }
void XmdsRaiseWindow(Widget w) { Widget shell; for (shell = w; shell && !XtIsShell(shell); shell = XtParent(shell)); if (shell) XtPopup(shell,XtGrabNone); }
void manage_and_raise(Widget w) { if (w != 0) { // If top-level shell is withdrawn or iconic, realize dialog as icon bool iconic = false; Widget shell = find_shell(w); if (shell != 0) { XWindowAttributes attr; iconic = (!XtIsRealized(shell) || XGetWindowAttributes(XtDisplay(shell), XtWindow(shell), &attr) && attr.map_state != IsViewable); if (iconic) XtVaSetValues(w, XmNinitialState, IconicState, XtPointer(0)); } XtManageChild(w); shell = w; while (shell != 0 && !XtIsShell(shell)) shell = XtParent(shell); if (shell != 0 && !XmIsDialogShell(shell)) { if (!XtIsRealized(shell)) XtRealizeWidget(shell); XtPopup(shell, XtGrabNone); } raise_shell(w); } }
/*! This function is a reimplementation of QWidget::showEvent(). The reimplemented function handles the given \a event by ensuring that the dialog widget is managed and hidden. */ void QtMotifDialog::showEvent(QShowEvent *event) { if (!event->spontaneous()) { // tell motif about modality Arg args[1]; XtSetArg( args[0], XmNdialogStyle, (testAttribute(Qt::WA_ShowModal) ? XmDIALOG_FULL_APPLICATION_MODAL : XmDIALOG_MODELESS)); XtSetValues( d->shell, args, 1 ); XtSetMappedWhenManaged( d->shell, False ); if ( d->dialog ) { XtManageChild( d->dialog ); XSync(x11Info().display(), FALSE); XSync(QtMotif::display(), FALSE); } else if ( !parentWidget() ) { adjustSize(); QApplication::sendPostedEvents(this, QEvent::Resize); Widget p = XtParent( d->shell ), s = p; while ( s != NULL && !XtIsShell( s ) ) // find the shell s = XtParent( s ); if ( p && s ) { int offx = ( ( XtWidth( p ) - width() ) / 2 ); int offy = ( ( XtHeight( p ) - height() ) / 2 ); move( XtX ( s ) + offx, XtY( s ) + offy ); } } XtSetMappedWhenManaged( d->shell, True ); } QDialog::showEvent(event); }
Time _XmValidTimestamp( Widget w ) { Window win; Display *dsp = XtDisplay(w); XEvent event; EventMask shellMask; Atom timeProp = XInternAtom(dsp, "_MOTIF_CURRENT_TIME", False); while (!XtIsShell(w)) w = XtParent(w); win = XtWindow(w); if (! ((shellMask = XtBuildEventMask(w)) & PropertyChangeMask) ) XSelectInput(dsp, win, shellMask | PropertyChangeMask); XChangeProperty(dsp, win, timeProp, timeProp, 8, PropModeAppend, NULL, 0); XWindowEvent(dsp, win, PropertyChangeMask, &event); if (!(shellMask & PropertyChangeMask)) XSelectInput(dsp, win, shellMask); return (event.xproperty.time); }
void create_split_dialog(Widget parent) { XmString message; Widget temp_widget = parent; /* Ensure the parent of the dialog is a shell widget */ while ( !XtIsShell(temp_widget) ) { temp_widget = XtParent(temp_widget); } message = XmStringLtoRCreate(SPLIT_MESSAGE, XmSTRING_DEFAULT_CHARSET); argcount = 0; XtSetArg(args[argcount], XmNselectionLabelString, message); argcount++; split_dialog = XmCreatePromptDialog(temp_widget, "split dialog", args, argcount); /* Remove the help button from the dialog */ temp_widget = XmSelectionBoxGetChild(split_dialog, XmDIALOG_HELP_BUTTON); XtUnmanageChild(temp_widget); /* Add the actions to the buttons */ XtAddCallback(split_dialog, XmNokCallback, (XtCallbackProc) start_split, (XtPointer) NULL); XtAddCallback(split_dialog, XmNokCallback, (XtCallbackProc) activate_merge_dialog, (XtPointer) NULL); XmStringFree(message); create_merge_dialog(main_window); }
/****************************************************************************** NAME: GetTrueToplevel( wgt ) INPUT: Widget wgt - the top user-created widget RETURN: Widget - the shell widget DESCRIPTION: Returns the true toplevel of that interface. This is needed for implicit shells where the widget passed to one of the Ux functions is not always the shell. CREATION: Visual Edge Software April 6 1991 -----------------------------------------------------------------------------*/ Widget GetTrueToplevel( Widget wgt ) { while (wgt && !XtIsShell(wgt)) { wgt = XtParent(wgt); } return wgt; }
Widget awt_util_getXICStatusAreaWindow(Widget w) { while (!XtIsShell(w)){ w = XtParent(w); } return w; }
// Unmanage the ancestor shell void UnmanageShellCB(Widget widget, XtPointer, XtPointer call_data) { Widget w = widget; while (w != 0 && !XtIsShell(XtParent(w))) w = XtParent(w); UnmanageThisCB(widget, XtPointer(w), call_data); }
// Destroy the ancestor shell void DestroyShellCB(Widget widget, XtPointer, XtPointer call_data) { Widget w = widget; while (w != 0 && !XtIsShell(XtParent(w))) w = XtParent(w); DestroyThisCB(widget, XtPointer(w), call_data); }
Widget LocateShell(Widget w) { if(!w) return (Widget)0; while(w) { if(XtIsShell(w) || XmIsDialogShell(w)) return w; w = XtParent(w); } return (Widget)0; }
void destroy_dialog(Widget widget) { do { widget = XtParent(widget); } while (XtParent(widget) && XtIsShell(widget) == FALSE); XtDestroyWidget(widget); }
static void Realize(Widget w,Mask *valueMask,XSetWindowAttributes *attributes) { register GLwDrawingAreaWidget glw=(GLwDrawingAreaWidget)w; GLwDrawingAreaCallbackStruct cb; Widget parentShell; Status status; Window windows[2],*windowsReturn,*windowList; int countReturn,i; /* if we haven't requested that the background be both installed and * allocated, don't install it. */ if(!(glw->glwDrawingArea.installBackground && glw->glwDrawingArea.allocateBackground)) { *valueMask&=~CWBackPixel; } XtCreateWindow(w,(unsigned int)InputOutput,glw->glwDrawingArea.visualInfo->visual,*valueMask,attributes); /* if appropriate, call XSetWMColormapWindows to install the colormap */ if(glw->glwDrawingArea.installColormap) { /* Get parent shell */ for(parentShell=XtParent(w); parentShell&&!XtIsShell(parentShell); parentShell=XtParent(parentShell)); if(parentShell && XtWindow(parentShell)) { /* check to see if there is already a property */ status=XGetWMColormapWindows(XtDisplay(parentShell),XtWindow(parentShell),&windowsReturn,&countReturn); /* if no property, just create one */ if(!status) { windows[0]=XtWindow(w); windows[1]=XtWindow(parentShell); XSetWMColormapWindows(XtDisplay(parentShell),XtWindow(parentShell),windows,2); } /* there was a property, add myself to the beginning */ else { windowList=(Window *)XtMalloc((sizeof(Window))*(countReturn+1)); windowList[0]=XtWindow(w); for(i=0; i<countReturn; i++) windowList[i+1]=windowsReturn[i]; XSetWMColormapWindows(XtDisplay(parentShell),XtWindow(parentShell),windowList,countReturn+1); XtFree((char*)windowList); XtFree((char*)windowsReturn); } } else { warning(w,"Could not set colormap property on parent shell"); } } /* Invoke callbacks */ cb.reason=GLwCR_GINIT; cb.event=NULL; cb.width=glw->core.width; cb.height=glw->core.height; XtCallCallbackList((Widget)glw,glw->glwDrawingArea.ginitCallback,&cb); }
/*! \internal Motif callback to resolve a QtMotifDialog and call QtMotifDialog::deleteChild(). */ void qmotif_dialog_delete_child( Widget w ) { if ( XtIsShell( w ) ) return; // do not allow shell children XtWidgetProc delete_child = xmDialogShellClassRec.composite_class.delete_child; (*delete_child)( w ); QtMotifDialog *dialog = ( (QtMotifDialogWidget) w->core.parent )->qmotifdialog.dialog; dialog->deleteChild( w ); }