void createWidget(int index) { super.createWidget(index); int topHandle = topHandle(); if (OS.XtIsRealized(topHandle)) { /* * Make sure that the widget has been properly realized * because the widget was created after the parent * has been realized. */ realizeChildren(); } }
/** * Sets the control that is used to fill the bounds of the item when the item is a <code>SEPARATOR * </code>. * * @param control the new control * @exception IllegalArgumentException * <ul> * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public void setControl(Control control) { checkWidget(); if (control != null) { if (control.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); if (control.parent != parent) error(SWT.ERROR_INVALID_PARENT); } if ((style & SWT.SEPARATOR) == 0) return; if (this.control == control) return; this.control = control; int[] argList = { OS.XmNseparatorType, control == null ? ((parent.style & SWT.FLAT) != 0 ? OS.XmSHADOW_ETCHED_IN : OS.XmSHADOW_ETCHED_OUT) : OS.XmNO_LINE, }; OS.XtSetValues(handle, argList, argList.length / 2); if (control != null && !control.isDisposed()) { /* * It is possible that the control was created with a * z-order below that of the current tool item. In this * case, the control is not visible because it is * obscured by the tool item. The fix is to move the * control above this tool item in the z-order. * The code below is similar to the code found in * setZOrder. */ int xDisplay = OS.XtDisplay(handle); if (xDisplay == 0) return; if (!OS.XtIsRealized(handle)) { Shell shell = parent.getShell(); shell.realizeWidget(); } int topHandle1 = control.topHandle(); int window1 = OS.XtWindow(topHandle1); if (window1 == 0) return; int topHandle2 = this.topHandle(); int window2 = OS.XtWindow(topHandle2); if (window2 == 0) return; XWindowChanges struct = new XWindowChanges(); struct.sibling = window2; struct.stack_mode = OS.Above; int screen = OS.XDefaultScreen(xDisplay); int flags = OS.CWStackMode | OS.CWSibling; OS.XReconfigureWMWindow(xDisplay, window1, screen, flags, struct); } parent.relayout(); }