void XtSetSensitive( register Widget widget, _XtBoolean sensitive) { Arg args[1]; register Cardinal i; register WidgetList children; WIDGET_TO_APPCON(widget); LOCK_APP(app); if (widget->core.sensitive == sensitive) { UNLOCK_APP(app); return; } XtSetArg(args[0], XtNsensitive, sensitive); XtSetValues(widget, args, XtNumber(args)); /* If widget's ancestor_sensitive is TRUE, propagate new sensitive to children's ancestor_sensitive; else do nothing as children's ancestor_sensitive is already FALSE */ if (widget->core.ancestor_sensitive && XtIsComposite (widget)) { children = ((CompositeWidget) widget)->composite.children; for (i = 0; i < ((CompositeWidget)widget)->composite.num_children; i++){ SetAncestorSensitive (children[i], sensitive); } } UNLOCK_APP(app); } /* XtSetSensitive */
/* ** 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); } } }
/*----------------------------------------------------------------------*/ /* extern */ WidgetList XfeChildren(Widget w) { assert( XtIsComposite(w) ); return _XfemChildren(w); }
/*----------------------------------------------------------------------*/ /* extern */ Widget XfeChildrenIndex(Widget w,Cardinal i) { assert( XtIsComposite(w) ); return _XfeChildrenIndex(w,i); }
/*----------------------------------------------------------------------*/ /* extern */ void XfeChildrenRemoveEventHandler(Widget w, EventMask event_mask, Boolean nonmaskable, XtEventHandler proc, XtPointer data) { Widget * children; Cardinal num_children; Cardinal i; assert( _XfeIsAlive(w) ); assert( XtIsComposite(w) ); XfeChildrenGet(w,&children,&num_children); for (i = 0; i < num_children; i++) { if (_XfeIsAlive(w)) { XtRemoveEventHandler(children[i],event_mask,nonmaskable,proc,data); } XtRemoveEventHandler(children[i],event_mask,nonmaskable,proc,data); } }
/*----------------------------------------------------------------------*/ /* extern */ Cardinal XfeNumChildren(Widget w) { assert( XtIsComposite(w) ); return _XfemNumChildren(w); }
/* * Apply a function to all the subwidgets of a given widget recursively. */ void XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg) { if (XtIsComposite (w)) { CompositeWidget cw = (CompositeWidget) w; /* We have to copy the children list before mapping over it, because the procedure might add/delete elements, which would lose badly. */ int nkids = cw->composite.num_children; Widget *kids = (Widget *) xmalloc (sizeof (Widget) * nkids); int i; memcpy ((char *) kids, (char *) cw->composite.children, sizeof (Widget) * nkids); for (i = 0; i < nkids; i++) /* This prevent us from using gadgets, why is it here? */ /* if (XtIsWidget (kids [i])) */ { /* do the kiddies first in case we're destroying */ XtApplyToWidgets (kids [i], proc, arg); proc (kids [i], arg); } xfree (kids); } }
void awt_util_mapChildren(Widget w, void (*func)(Widget,void *), int32_t applyToCurrent, void *data) { WidgetList wlist; Cardinal wlen = 0; Cardinal i; /* The widget may have been destroyed by another thread. */ if ((w == NULL) || (!XtIsObject(w)) || (w->core.being_destroyed)) return; if (applyToCurrent != 0) { (*func)(w, data); } if (!XtIsComposite(w)) { return; } XtVaGetValues(w, XmNchildren, &wlist, XmNnumChildren, &wlen, NULL); if (wlen > 0) { for (i=0; i < wlen; i++) { awt_util_mapChildren(wlist[i], func, 1, data); } } }
static void CallChangeManaged( register Widget widget) { register Cardinal i; XtWidgetProc change_managed; register WidgetList children; int managed_children = 0; register CompositePtr cpPtr; register CompositePartPtr clPtr; if (XtIsComposite (widget)) { cpPtr = (CompositePtr)&((CompositeWidget) widget)->composite; clPtr = (CompositePartPtr)&((CompositeWidgetClass) widget->core.widget_class)->composite_class; } else return; children = cpPtr->children; LOCK_PROCESS; change_managed = clPtr->change_managed; UNLOCK_PROCESS; /* CallChangeManaged for all children */ for (i = cpPtr->num_children; i != 0; --i) { CallChangeManaged (children[i-1]); if (XtIsManaged(children[i-1])) managed_children++; } if (change_managed != NULL && managed_children != 0) { CALLGEOTAT(_XtGeoTrace(widget,"Call \"%s\"[%d,%d]'s changemanaged\n", XtName(widget), widget->core.width, widget->core.height)); (*change_managed) (widget); } } /* CallChangeManaged */
/*----------------------------------------------------------------------*/ /* extern */ Widget XfeChildrenGetLast(Widget w) { assert( _XfeIsAlive(w) ); assert( XtIsComposite(w) ); if (_XfemChildren(w) && _XfemNumChildren(w)) { return _XfemChildren(w)[ _XfemNumChildren(w) - 1 ]; } return NULL; }
/* * Function: * ResetList * * Parameters: * w - list widget * changex - allow the height or width to change? * changey - "" * * Description: * Resets the new list when important things change. * * Returns: * True if width or height have been changed */ static void ResetList(Widget w, Bool changex, Bool changey) { Dimension width = XtWidth(w); Dimension height = XtHeight(w); CalculatedValues(w); if (Layout(w, changex, changey, &width, &height)) { if (XtIsComposite(XtParent(w))) ChangeSize(w, width, height); else { XtWidth(w) = width; XtHeight(w) = height; } } }
/*----------------------------------------------------------------------*/ /* extern */ void XfeChildrenGet(Widget w,WidgetList * children,Cardinal * num_children) { assert( _XfeIsAlive(w) ); assert( XtIsComposite(w) ); assert( (children != NULL) || (num_children != NULL) ); if (children) { *children = _XfemChildren(w); } if (num_children) { *num_children = _XfemNumChildren(w); } }
void MotifUI::DumpWidgets(Widget w, boolean verbose, int level) { DumpWidget(w, verbose, level); int i; if (XtIsWidget(w)) { for (i = 0; i < w->core.num_popups; i++) DumpWidgets(w->core.popup_list[i], verbose, level + 1); } if (XtIsComposite(w)) { CompositeWidget cw = (CompositeWidget) w; for (i = 0; i < cw->composite.num_children; i++) DumpWidgets(cw->composite.children[i], verbose, level + 1); } }
/* * Returns a copy of the list of all children of a composite widget */ Widget *XtCompositeChildren(Widget widget, unsigned int *number) { CompositeWidget cw = (CompositeWidget) widget; Widget *result; int n; int i; if (!XtIsComposite(widget)) { *number = 0; return NULL; } n = cw->composite.num_children; result = (Widget *) XtMalloc(n * sizeof(Widget)); *number = n; for (i = 0; i < n; i++) result[i] = cw->composite.children[i]; return result; }
static void VerbosePass1(Widget w, int level) { int i; if (level == 0) G_width = 0; int new_width = (level * 3) + strlen(XrmQuarkToString(w->core.xrm_name)) + strlen(w->core.widget_class->core_class.class_name) + 3; if (new_width > G_width) G_width = new_width; if (XtIsWidget(w)) for (i = 0; i < w->core.num_popups; i++) VerbosePass1(w->core.popup_list[i], level + 1); if (XtIsComposite(w)) { CompositeWidget cw = (CompositeWidget) w; for (i = 0; i < cw->composite.num_children; i++) VerbosePass1(cw->composite.children[i], level + 1); } }
/*----------------------------------------------------------------------*/ /* extern */ Cardinal XfeChildrenGetNumManaged(Widget w) { Cardinal i; Cardinal num_managed = 0; assert( _XfeIsAlive(w) ); assert( XtIsComposite(w) ); for (i = 0; i < _XfemNumChildren(w); i++) { if (_XfeIsManaged(_XfeChildrenIndex(w,i))) { num_managed++; } } return num_managed; }
static void UnrealizeWidget( Widget widget) { CompositeWidget cw; Cardinal i; WidgetList children; if (!XtIsWidget(widget) || !XtIsRealized(widget)) return; /* If this is the application's popup shell, unmap it? */ /* no, the window is being destroyed */ /* Recurse on children */ if (XtIsComposite (widget)) { cw = (CompositeWidget) widget; children = cw->composite.children; /* Unrealize all children */ for (i = cw->composite.num_children; i != 0; --i) { UnrealizeWidget (children[i-1]); } /* Unmap children that are managed and mapped_when_managed? */ /* No, it's ok to be managed and unrealized as long as your parent */ /* is unrealized. XtUnrealize widget makes sure the "top" widget */ /* is unmanaged, we can ignore all descendents */ } if (XtHasCallbacks(widget, XtNunrealizeCallback) == XtCallbackHasSome) XtCallCallbacks(widget, XtNunrealizeCallback, NULL); /* Unregister window */ XtUnregisterDrawable(XtDisplay(widget), XtWindow(widget)); /* Remove Event Handlers */ /* remove grabs. Happens automatically when window is destroyed. */ /* Destroy X Window, done at outer level with one request */ widget->core.window = None; /* Removing the event handler here saves having to keep track if * the translation table is changed while the widget is unrealized. */ _XtRemoveTranslations(widget); } /* UnrealizeWidget */
/* Part fix for bug id 4017222. Return the widget at the given screen coords by searching the widget tree beginning at root. This function will return null if the pointer is not over the root widget or child of the root widget. Additionally, this function will only return a Widget with non-nil XmNuserData. In 1.2.1, when the mouse was dragged over a Choice component, this function returned the GadgetButton associated with the Choice. This GadgetButton had nil as its XmNuserData. This lead to a crash when the nil XmNuserData was extracted and used as a reference to a peer. Ooops. Now the GadgetButton is not returned and the function goes on to find a widget which contains the correct peer reference in XmNuserData. */ Widget awt_WidgetAtXY(Widget root, Position pointerx, Position pointery) { Widget answer = NULL; if(!root) return NULL; if(XtIsComposite(root)) { int32_t i=0; WidgetList wl=NULL; Cardinal wlen=0; XtVaGetValues(root, XmNchildren, &wl, XmNnumChildren, &wlen, NULL); if(wlen>0) { for(i=0; i<wlen && !answer; i++) { answer = awt_WidgetAtXY(wl[i], pointerx, pointery); } } } if(!answer) { Position wx=0, wy=0; Dimension width=0, height=0; int32_t lastx=0, lasty=0; XtPointer widgetUserData=NULL; XtVaGetValues(root, XmNwidth, &width, XmNheight, &height, XmNuserData, &widgetUserData, NULL); XtTranslateCoords(root, 0, 0, &wx, &wy); lastx = wx + width; lasty = wy + height; if(pointerx>=wx && pointerx<=lastx && pointery>=wy && pointery<=lasty && widgetUserData) answer = root; } return answer; }
static Widget SearchChildren( Widget root, XrmNameList names, XrmBindingList bindings, NameMatchProc matchproc, int in_depth, int *out_depth, int *found_depth) { Widget w1 = NULL, w2; int d1, d2; if (XtIsComposite(root)) { w1 = (*matchproc)(names, bindings, ((CompositeWidget) root)->composite.children, ((CompositeWidget) root)->composite.num_children, in_depth, &d1, found_depth); } else d1 = 10000; w2 = (*matchproc)(names, bindings, root->core.popup_list, root->core.num_popups, in_depth, &d2, found_depth); *out_depth = (d1 < d2 ? d1 : d2); return (d1 < d2 ? w1 : w2); }
/* * Apply a function to all the subwidgets of a given widget recursively. * Stop as soon as the function returns non NULL and returns this as a value. */ void * XtApplyUntilToWidgets (Widget w, XtApplyUntilToWidgetsProc proc, XtPointer arg) { void* result; if (XtIsComposite (w)) { CompositeWidget cw = (CompositeWidget)w; int i; for (i = 0; i < cw->composite.num_children; i++) if (XtIsWidget (cw->composite.children [i])){ result = proc (cw->composite.children [i], arg); if (result) return result; result = XtApplyUntilToWidgets (cw->composite.children [i], proc, arg); if (result) return result; } } return NULL; }
void ui_set_active( Widget widget, BOOL state ) { XtSetSensitive(widget, (Boolean)state); if (XtIsComposite(widget)) { int i, num_children = 0; WidgetList children = NULL; XtVaGetValues(widget, XmNnumChildren, &num_children, XmNchildren, &children, NULL); for (i = 0; i < num_children; i++) { int c = 0, num_children_children = 0; WidgetList children_children = NULL; XtSetSensitive(children[i], (Boolean)state); /* REMIND: Hack to get scrolling list to grey out */ XtVaGetValues(children[i], XmNnumChildren, &num_children_children, XmNchildren, &children_children, NULL); if (num_children_children > 0) { for (c = 0; c < num_children_children; c++) XtSetSensitive(children_children[c], (Boolean)state); } } } }
/* ** Look for a widget in the widget tree w, with a mnemonic matching ** keycode. When one is found, simulate a button press on that widget ** and give it the keyboard focus. If the mnemonic is on a label, ** look in the userData field of the label to see if it points to ** another widget, and give that the focus. This routine is just ** sufficient for NEdit, no doubt it will need to be extended for ** mnemonics on widgets other than just buttons and text fields. */ static void findAndActivateMnemonic(Widget w, unsigned int keycode) { WidgetList children; int numChildren, i, isMenu; KeySym mnemonic = '\0'; char mneString[2]; Widget userData; 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++) findAndActivateMnemonic(children[i], keycode); } } else { XtVaGetValues(w, XmNmnemonic, &mnemonic, 0); if (mnemonic != '\0') { mneString[0] = mnemonic; mneString[1] = '\0'; if (XKeysymToKeycode(XtDisplay(XtParent(w)), XStringToKeysym(mneString)) == keycode) { if (XtClass(w) == xmLabelWidgetClass || XtClass(w) == xmLabelGadgetClass) { XtVaGetValues(w, XmNuserData, &userData, 0); if (userData!=NULL && XtIsWidget(userData)) XmProcessTraversal(userData, XmTRAVERSE_CURRENT); } else { XmProcessTraversal(w, XmTRAVERSE_CURRENT); SimulateButtonPress(w); } } } } }
/*----------------------------------------------------------------------*/ /* extern */ void XfeChildrenDestroy(Widget w) { Widget * children; Cardinal i; assert( _XfeIsAlive(w) ); assert( XtIsComposite(w) ); /* Make sure the widget has children */ if (!_XfemNumChildren(w)) { return; } /* Allocate space for a temporary children array */ children = (Widget *) XtMalloc(sizeof(Widget) * _XfemNumChildren(w)); /* Copy the widget ids */ for (i = 0; i < _XfemNumChildren(w); i++) { children[i] = _XfemChildren(w)[i]; } /* Destroy the children */ for (i = 0; i < _XfemNumChildren(w); i++) { if (_XfeIsAlive(children[i])) { XtDestroyWidget(children[i]); } } XtFree((char *) children); /* Update an flush in case the destruction takes a long time */ XmUpdateDisplay(w); XFlush(XtDisplay(w)); }
/*----------------------------------------------------------------------*/ /* extern */ void XfeChildrenRemoveCallback(Widget w, String callback_name, XtCallbackProc callback, XtPointer data) { Widget * children; Cardinal num_children; Cardinal i; assert( _XfeIsAlive(w) ); assert( XtIsComposite(w) ); XfeChildrenGet(w,&children,&num_children); for (i = 0; i < num_children; i++) { assert( _XfeIsAlive(children[i]) ); XtRemoveCallback(children[i],callback_name,callback,data); } }
void Browser::AddHelpCallbacks(Widget w) { // // Add the callback for this one... // XtAddCallback(w, XmNhelpCallback, (XtCallbackProc)Browser_HelpCB, (XtPointer)NULL); // // Add the callback for any descendants // if(XtIsComposite(w)) { WidgetList children; Cardinal nchild; int i; XtVaGetValues(w, XmNchildren, &children, XmNnumChildren, &nchild, NULL); for(i = 0; i < nchild; i++) { Browser::AddHelpCallbacks(children[i]); } } }
static void SetAncestorSensitive( register Widget widget, Boolean ancestor_sensitive) { Arg args[1]; register Cardinal i; register WidgetList children; if (widget->core.ancestor_sensitive == ancestor_sensitive) return; XtSetArg(args[0], XtNancestorSensitive, ancestor_sensitive); XtSetValues(widget, args, XtNumber(args)); /* If widget's sensitive is TRUE, propagate new ancestor_sensitive to children's ancestor_sensitive; else do nothing as children's ancestor_sensitive is already FALSE */ if (widget->core.sensitive && XtIsComposite(widget)) { children = ((CompositeWidget) widget)->composite.children; for (i=0; i < ((CompositeWidget)widget)->composite.num_children; i++) { SetAncestorSensitive (children[i], ancestor_sensitive); } } } /* SetAncestorSensitive */
static void UnmanageChildren( WidgetList children, Cardinal num_children, Widget parent, Cardinal* num_unique_children, Boolean call_change_managed, String caller_func) { Widget child; Cardinal i; XtWidgetProc change_managed = NULL; Bool parent_realized = False; *num_unique_children = 0; if (XtIsComposite((Widget) parent)) { LOCK_PROCESS; change_managed = ((CompositeWidgetClass) parent->core.widget_class) ->composite_class.change_managed; UNLOCK_PROCESS; parent_realized = XtIsRealized((Widget)parent); } else { XtAppErrorMsg(XtWidgetToApplicationContext((Widget)parent), "invalidParent",caller_func, XtCXtToolkitError, "Attempt to unmanage a child when parent is not Composite", (String *) NULL, (Cardinal *) NULL); } for (i = 0; i < num_children; i++) { child = children[i]; if (child == NULL) { XtAppWarningMsg(XtWidgetToApplicationContext(parent), XtNinvalidChild,caller_func,XtCXtToolkitError, "Null child passed to XtUnmanageChildren", (String *)NULL, (Cardinal *)NULL); return; } if (child->core.parent != parent) { XtAppWarningMsg(XtWidgetToApplicationContext(parent), "ambiguousParent",caller_func,XtCXtToolkitError, "Not all children have same parent in UnmanageChildren", (String *)NULL, (Cardinal *)NULL); } else if (child->core.managed) { (*num_unique_children)++; CALLGEOTAT(_XtGeoTrace(child,"Child \"%s\" is marked unmanaged\n", XtName(child))); child->core.managed = FALSE; if (XtIsWidget(child) && XtIsRealized(child) && child->core.mapped_when_managed) XtUnmapWidget(child); else { /* RectObj child */ Widget pw = child->core.parent; RectObj r = (RectObj) child; while ((pw!=NULL) && (!XtIsWidget(pw))) pw = pw->core.parent; if ((pw!=NULL) && XtIsRealized (pw)) XClearArea (XtDisplay (pw), XtWindow (pw), r->rectangle.x, r->rectangle.y, r->rectangle.width + (r->rectangle.border_width << 1), r->rectangle.height + (r->rectangle.border_width << 1), TRUE); } } } if (call_change_managed && *num_unique_children != 0 && change_managed != NULL && parent_realized) { CALLGEOTAT(_XtGeoTrace((Widget)parent, "Call parent: \"%s\"[%d,%d]'s changemanaged proc\n", XtName((Widget)parent), parent->core.width,parent->core.height)); (*change_managed) (parent); } } /* UnmanageChildren */
void set_buttons_from_gdb(Widget buttons, string& text) { bool yn = gdb->ends_with_yn(text); if (yn) { if (!gdb_asks_yn) annotate("query"); gdb_asks_yn = true; } else if (gdb->isReadyWithPrompt()) { if (gdb_asks_yn) annotate("post-query"); gdb_asks_yn = false; unpost_gdb_yn(); } if (yn && !gdb_keyboard_command) { // Fetch previous output lines, in case this is a multi-line message. String s = XmTextGetString(gdb_w); string prompt(s); XtFree(s); // FIXME: Handle JDB char prompt_start = (gdb->type() == XDB ? '>' : '('); int pos = prompt.index(prompt_start, -1); if (pos >= 0) pos = prompt.index('\n', pos) + 1; if (pos == 0) pos = messagePosition; XmTextReplace(gdb_w, pos, XmTextGetLastPosition(gdb_w), XMST("")); promptPosition = pos; prompt = prompt.from(pos); if (text.contains('(')) prompt += text.before('(', -1); // Don't repeat `(y or n)' else prompt += text; post_gdb_yn(prompt); text = ""; return; } if (buttons == 0) return; static bool last_yn = false; if (yn == last_yn) return; last_yn = yn; if (XtIsComposite(buttons)) { set_sensitive(buttons, false); WidgetList children = 0; Cardinal num_children = 0; XtVaGetValues(buttons, XmNchildren, &children, XmNnumChildren, &num_children, XtPointer(0)); int i; for (i = 0; i < int(num_children); i++) XtManageChild(children[i]); for (i = 0; i < int(num_children); i++) { Widget w = children[i]; string name = XtName(w); if (yn == (name == "Yes" || name == "No")) XtManageChild(w); else XtUnmanageChild(w); } set_sensitive(buttons, true); } }
void Container::CreateContainer(MotifUI *parent, char * /*name*/, char * /*category*/, ContainerType container_type, SelectionType select_type) { Arg args[15]; int n; Pixel pixel; Widget parentW; Widget superNode; int radio_behavior = false; int _shadowThickness; if (!trans_tbl) { action_table[0].proc = (XtActionProc) ResizeRC; trans_tbl = XtParseTranslationTable("<Configure>:ResizeRC()"); XtAppAddActions(appContext, action_table, XtNumber(action_table)); } _xm_update_message = NULL; _select_type = select_type; _last_selected = NULL; parentW = parent->InnerWidget(); if (GuiIsIcon(parentW)) superNode = parentW; else superNode = NULL; if (!XtIsComposite(parentW)) parentW = XtParent(parentW); if (select_type == SINGLE_SELECT) radio_behavior = true; switch (_container_type = container_type) { case FORM: _w = XtVaCreateManagedWidget("form", xmFormWidgetClass, parentW, NULL); _workArea = _w; break; case SCROLLED_FORM: _w = XtVaCreateManagedWidget("sw", xmScrolledWindowWidgetClass, parentW, NULL); _workArea = XtVaCreateManagedWidget("form", xmFormWidgetClass, _w, NULL); break; case CANVAS: _w = XtVaCreateManagedWidget("canvas", xmDrawingAreaWidgetClass, parentW, NULL); _workArea = _w; break; case SCROLLED_CANVAS: _w = XtVaCreateManagedWidget("sw", xmScrolledWindowWidgetClass, parentW, NULL); _workArea = XtVaCreateManagedWidget("canvas", xmDrawingAreaWidgetClass, _w, NULL); break; case HORIZONTAL_ROW_COLUMN: _w = XtVaCreateManagedWidget("rc", xmRowColumnWidgetClass, parentW, XmNorientation, XmHORIZONTAL, XmNradioBehavior, radio_behavior, NULL); _workArea = _w; break; case SCROLLED_HORIZONTAL_ROW_COLUMN: _w = XtVaCreateManagedWidget("sw", xmScrolledWindowWidgetClass, parentW, GuiNisOpened, false, GuiNisWorkArea, true, GuiNsuperNode, superNode, XmNspacing, 0, XmNscrollBarDisplayPolicy, XmAS_NEEDED, XmNscrollingPolicy, XmAUTOMATIC, XmNheight, Parent()->Height(), NULL); XtAddCallback(_w, XmNtraverseObscuredCallback, MakeChildVisible, NULL); _workArea = XtVaCreateManagedWidget("rc", xmRowColumnWidgetClass, _w, XmNorientation, XmHORIZONTAL, XmNradioBehavior, radio_behavior, XmNpacking, XmPACK_TIGHT, XmNadjustLast, False, XmNuserData, this, NULL); XtAddCallback(XtParent(_workArea), XmNresizeCallback, ResizeSW, (XtPointer) this); XtOverrideTranslations(_workArea, trans_tbl); break; case VERTICAL_ROW_COLUMN: _w = XtVaCreateManagedWidget("rc", xmRowColumnWidgetClass, parentW, XmNradioBehavior, radio_behavior, NULL); _workArea = _w; break; case SCROLLED_VERTICAL_ROW_COLUMN: _w = XtVaCreateManagedWidget("sw", xmScrolledWindowWidgetClass, parentW, GuiNisOpened, false, GuiNisWorkArea, true, GuiNsuperNode, superNode, XmNspacing, 0, XmNradioBehavior, radio_behavior, XmNscrollBarDisplayPolicy, XmAS_NEEDED, XmNscrollingPolicy, XmAUTOMATIC, NULL); _workArea = XtVaCreateManagedWidget("rc", xmRowColumnWidgetClass, _w, XmNradioBehavior, radio_behavior, NULL); break; case PANE: _w = XtVaCreateManagedWidget("pane", xmPanedWindowWidgetClass, parentW, NULL); _workArea = _w; break; case SCROLLED_PANE: _w = XtVaCreateManagedWidget("sw", xmScrolledWindowWidgetClass, parentW, NULL); _workArea = XtVaCreateManagedWidget("form", xmPanedWindowWidgetClass, _w, NULL); break; case WORK_AREA: _w = XtVaCreateManagedWidget("form", workAreaWidgetClass, parentW, NULL); _workArea = _w; break; case ICON_LIST: _w = XtVaCreateManagedWidget("form", workAreaWidgetClass, parentW, GuiNisList, True, NULL); _workArea = _w; break; case SCROLLED_ICON_LIST: case SCROLLED_WORK_AREA: if (Parent()->UIClass() == DIALOG) _shadowThickness = 0; else _shadowThickness = shadowThickness; _w = XtVaCreateManagedWidget("form", xmFormWidgetClass, parentW, XmNshadowThickness, _shadowThickness, XmNshadowType, XmSHADOW_OUT, NULL); n = 0; if (_container_type == SCROLLED_ICON_LIST) { XtSetArg(args[n], GuiNisList, True); n++; } else { XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; XtSetArg(args[n], XmNentryVerticalAlignment, XmALIGNMENT_CONTENTS_BOTTOM); n++; } XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNtopOffset, 6); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNleftOffset, 6); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightOffset, 6); n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNbottomOffset, 6); n++; XtSetArg(args[n], GuiNlineOffset, 20); n++; XtSetArg(args[n], GuiNlineThickness, 2); n++; XtSetArg(args[n], XmNuserData, this); n++; _workArea = GuiCreateScrolledWorkArea(_w, "workArea", args, n); XtManageChild(_workArea); break; } if (_workArea == _w) { _clipWidget = _sw = _vbar = _hbar = NULL; } else { _clipWidget = XtParent(_workArea); _sw = XtParent(_clipWidget); XtVaGetValues(_sw, XmNverticalScrollBar, &_vbar, XmNhorizontalScrollBar, &_hbar, NULL); if (container_type == SCROLLED_HORIZONTAL_ROW_COLUMN) XtUnmanageChild(_vbar); if (depth > 1 && (container_type == SCROLLED_WORK_AREA || container_type == SCROLLED_ICON_LIST)) { XtVaGetValues(_vbar, XmNtroughColor, &pixel, NULL); XtVaSetValues(_workArea, XmNbackground, pixel, NULL); XtVaSetValues(_clipWidget, XmNbackground, pixel, NULL); } } InstallHelpCB(); InstallDestroyCB(); }
void DumpWidgetLevel(Widget w, String Prefix, String SubPrefix) { char *p; Widget *child, *children, lp; int i, NumPopupChildren, NumObjChildren, NumChildren; String name; if ( XtIsWidget(w) ) { NumPopupChildren = w->core.num_popups; } else { NumPopupChildren = 0; } if ( _XmIsFastSubclass(XtClass(w), XmSCREEN_BIT ) ) { children = ((XmScreenRec *) w)->desktop.children; NumObjChildren = ((XmScreenRec *) w)->desktop.num_children; } else if ( XmIsDesktopObject(w) ) { children = ((XmDesktopRec *) w)->desktop.children; NumObjChildren = ((XmDesktopRec *) w)->desktop.num_children; } else { NumObjChildren = 0; } if ( XtIsComposite(w) ) { NumChildren = ((CompositeRec *) w)->composite.num_children; } else { NumChildren = 0; } p = TreeBuffer + strlen(TreeBuffer); DumpW(w, Prefix, SubPrefix, (NumChildren || NumObjChildren || NumPopupChildren) ? "| " : " "); strcpy(p, SubPrefix); /* * First dump all ordinary children... */ if ( XtIsComposite(w) ) { child = ((CompositeRec *) w)->composite.children; for ( i = NumChildren; i > 0; i-- ) { if ( (i != 1) || NumPopupChildren || NumObjChildren ) { DumpWidgetLevel(*child, "+-- ", "| "); } else { DumpWidgetLevel(*child, "`-- ", " "); } child++; } } /* * ...then dump all popup children... */ child = w->core.popup_list; for ( i = NumPopupChildren; i > 0; i-- ) { if ( (i != 1) ) { DumpWidgetLevel(*child, "+-- (POPUP CHILD) ", "| "); } else { DumpWidgetLevel(*child, "`-- (POPUP CHILD) ", " "); } child++; } /* * ...and finally the illegimate children... */ child = children; for ( i = NumObjChildren; i > 0; i-- ) { if ( (i != 1) ) { DumpWidgetLevel(*child, "+-- ", "| "); } else { DumpWidgetLevel(*child, "`-- ", " "); } child++; } *p = 0; } /* DumpWidgetLevel */