/**************** * Return True if w intersects with any other siblins. ****************/ Boolean _XmGMOverlap(XmManagerWidget manager, Widget w) { register int i ; Position left1 = XtX(w) ; Position top1 = XtY(w) ; Dimension right1 = XtX(w) + 2*XtBorderWidth(w) + XtWidth(w) ; Dimension bottom1 = XtY(w) + 2*XtBorderWidth(w) + XtHeight(w); /****************/ for(i=0 ; i<manager->composite.num_children ; i++) { Widget kid = manager->composite.children[i] ; Position left2 = XtX(kid) ; Position top2 = XtY(kid) ; Dimension right2 = XtX(kid) + 2*XtBorderWidth(kid) + XtWidth(kid); Dimension bottom2 = XtY(kid) + 2*XtBorderWidth(kid) + XtHeight(kid) ; if(w != kid && (((left1 >= left2) && ((Dimension)left1 <= right2)) || ((left2 >= left1) && ((Dimension)left2 <= right1))) && (((top1 >= top2) && ((Dimension)top1 <= bottom2)) || ((top2 >= top1) && ((Dimension)top2 <= bottom1))) ) { return( True) ; } } return( False) ; }
static XtGeometryResult XawPortholeQueryGeometry(Widget gw, XtWidgetGeometry *intended, XtWidgetGeometry *preferred) { PortholeWidget pw = (PortholeWidget)gw; Widget child = find_child(pw); if (child) { #define SIZEONLY (CWWidth | CWHeight) preferred->request_mode = SIZEONLY; preferred->width = XtWidth(child); preferred->height = XtHeight(child); if ((intended->request_mode & SIZEONLY) == SIZEONLY && intended->width == preferred->width && intended->height == preferred->height) return (XtGeometryYes); else if (preferred->width == XtWidth(pw) && preferred->height == XtHeight(pw)) return (XtGeometryNo); return (XtGeometryAlmost); #undef SIZEONLY } return (XtGeometryNo); }
static void gadget_border_unhighlight(Widget w) { DEBUGOUT(_LtDebug(__FILE__, w, "gadget_border_unhighlight\n")); /* with zero width, we don't need this... */ if (G_HighlightThickness(w) == 0) { return; } if (XmIsManager(XtParent(w))) { _XmDrawHighlight(XtDisplayOfObject(w), XtWindowOfObject(w), XmParentBackgroundGC(w), XtX(w), XtY(w), XtWidth(w), XtHeight(w), G_HighlightThickness(w), LineSolid); } else { _XmClearBorder(XtDisplay(w), XtWindow(w), XtX(w), XtY(w), XtWidth(w), XtHeight(w), G_HighlightThickness(w)); } G_Highlighted(w) = False; G_HighlightDrawn(w) = False; }
static Region HighlightRegion(CommandWidget cbw) { static Region outerRegion = NULL, innerRegion, emptyRegion; XRectangle rect; if (cbw->command.highlight_thickness == 0 || cbw->command.highlight_thickness > Min(XtWidth(cbw), XtHeight(cbw)) / 2) return (NULL); if (outerRegion == NULL) { /* save time by allocating scratch regions only once. */ outerRegion = XCreateRegion(); innerRegion = XCreateRegion(); emptyRegion = XCreateRegion(); } rect.x = rect.y = 0; rect.width = XtWidth(cbw); rect.height = XtHeight(cbw); XUnionRectWithRegion(&rect, emptyRegion, outerRegion); rect.x = rect.y = cbw->command.highlight_thickness; rect.width -= cbw->command.highlight_thickness * 2; rect.height -= cbw->command.highlight_thickness * 2; XUnionRectWithRegion(&rect, emptyRegion, innerRegion); XSubtractRegion(outerRegion, innerRegion, outerRegion); return (outerRegion); }
/*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); }
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; }
static void XawFormChangeManaged(Widget w) { FormWidget fw = (FormWidget)w; FormConstraints form; WidgetList children, childP; int num_children = fw->composite.num_children; Widget child; (*((FormWidgetClass)w->core.widget_class)->form_class.layout) (fw, XtWidth(w), XtHeight(w), True); fw->form.old_width = XtWidth(w); fw->form.old_height = XtHeight(w); for (children = childP = fw->composite.children; childP - children < num_children; childP++) { child = *childP; if (!XtIsManaged(child)) continue; form = (FormConstraints)child->core.constraints; #ifndef OLDXAW form->form.virtual_x = XtX(child); form->form.virtual_y = XtY(child); #endif form->form.virtual_width = XtWidth(child); form->form.virtual_height = XtHeight(child); } }
/*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); }
static void expose(Widget w, XEvent *event, Region region) { DEBUGOUT(_LtDebug(__FILE__, w, "Sash expose\n")); _XmDrawShadows(XtDisplay(w), XtWindow(w), Prim_TopShadowGC(w), Prim_BottomShadowGC(w), 0, 0, XtWidth(w), XtHeight(w), Prim_ShadowThickness(w), XmSHADOW_OUT); if (!Prim_Highlighted(w)) { XFillRectangle(XtDisplay(w), XtWindow(w), XmParentBackgroundGC(w), Prim_ShadowThickness(w), Prim_ShadowThickness(w), XtWidth(w) - 2 * Prim_ShadowThickness(w), XtHeight(w) - 2 * Prim_ShadowThickness(w)); } }
void putDialog( Widget parent, Widget dialog ) { int n; Position newX, newY, pY, pX; Dimension pHeight, myHeight, pWidth, myWidth; Arg args[4]; pX = XtX(parent); pY = XtY(parent); pHeight = XtHeight(parent); pWidth = XtWidth(parent); myHeight = XtHeight(dialog); myWidth = XtWidth(dialog); if ((newY = pY - myHeight +5) < 0) newY = pY + pHeight; newX = pX + pWidth/2 - myWidth/2; n = 0; XtSetArg(args[n], XmNx, newX); n++; XtSetArg(args[n], XmNy, newY); n++; XtSetValues(dialog,args,n); #ifdef PutDDEBUG printf("newX, newY, pY, pX;\n"); printf("%d %d %d %d\n",newX, newY, pY, pX); printf("pHeight, myHeight, pWidth, myWidth;\n"); printf("%d %d %d %d\n", pHeight, myHeight, pWidth, myWidth); #endif }
static XtGeometryResult query_geometry(Widget w, XtWidgetGeometry *proposed, XtWidgetGeometry *answer) { /* Motif does not have this method */ XmSashWidget sw = (XmSashWidget)w; answer->request_mode = CWWidth | CWHeight; answer->width = XtWidth(w) + 2 * Prim_ShadowThickness(sw); answer->height = XtHeight(w) + 2 * Prim_ShadowThickness(sw); if (((proposed->request_mode & (CWWidth | CWHeight)) == (CWWidth | CWHeight)) && proposed->width == answer->width && proposed->height == answer->height) { return XtGeometryYes; } else if (answer->width == XtWidth(sw) && answer->height == XtHeight(sw)) { return XtGeometryNo; } else { return XtGeometryAlmost; } }
static void initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args) { DEBUGOUT(_LtDebug(__FILE__, new_w, "initialize: %i args\n" "\trequest X %5i Y %5i W %5i H %5i\n" "\t new_w X %5i Y %5i W %5i H %5i\n", *num_args, XtX(request), XtY(request), XtWidth(request), XtHeight(request), XtX(new_w), XtY(new_w), XtWidth(new_w), XtHeight(new_w))); DEBUGOUT(_LtDebugPrintArgList(__FILE__, new_w, args, *num_args, False)); /* check the RepType resources */ if (!XmRepTypeValidValue(XmRepTypeGetId(XmRMultiClick), DB_MultiClick(new_w), new_w)) DB_MultiClick(new_w) = XmMULTICLICK_KEEP; if (!XmRepTypeValidValue(XmRepTypeGetId(XmRShadowType), DB_ShadowType(new_w), new_w)) DB_ShadowType(new_w) = XmSHADOW_ETCHED_IN; DB_Armed(new_w) = False; DB_Timer(new_w) = 0; }
void XawViewportSetLocation ( Widget gw, #if NeedWidePrototypes double xoff, double yoff #else float xoff, float yoff #endif ) { ViewportWidget w = (ViewportWidget)gw; Widget child = w->viewport.child; int x, y; if (xoff > 1.0) /* scroll to right */ x = XtWidth(child); else if (xoff < 0.0) /* if the offset is < 0.0 nothing */ x = XtX(child); else x = (float)XtWidth(child) * xoff; if (yoff > 1.0) y = XtHeight(child); else if (yoff < 0.0) y = XtY(child); else y = (float)XtHeight(child) * yoff; MoveChild (w, -x, -y); }
static void XawPortholeChangeManaged(Widget gw) { PortholeWidget pw = (PortholeWidget)gw; Widget child = find_child (pw); /* ignore extra children */ if (child) { if (!XtIsRealized (gw)) { XtWidgetGeometry geom, retgeom; geom.request_mode = 0; if (XtWidth(pw) == 0) { geom.width = XtWidth(child); geom.request_mode |= CWWidth; } if (XtHeight(pw) == 0) { geom.height = XtHeight(child); geom.request_mode |= CWHeight; } if (geom.request_mode && XtMakeGeometryRequest (gw, &geom, &retgeom) == XtGeometryAlmost) (void)XtMakeGeometryRequest(gw, &retgeom, NULL); } XtResizeWidget(child, Max(XtWidth(child), XtWidth(pw)), Max(XtHeight(child), XtHeight(pw)), 0); SendReport(pw, XawPRAll); } }
/*ARGSUSED*/ static void draw_it(XtPointer client_data, XtIntervalId *id) { StripChartWidget w = (StripChartWidget)client_data; double value; if (w->strip_chart.update > 0) w->strip_chart.interval_id = XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)w), w->strip_chart.update * MS_PER_SEC,draw_it, client_data); if (w->strip_chart.interval >= XtWidth(w)) MoveChart((StripChartWidget)w, True); /* Get the value, stash the point and draw corresponding line */ if (w->strip_chart.get_value == NULL) return; XtCallCallbacks((Widget)w, XtNgetValue, (XtPointer)&value); /* * Keep w->strip_chart.max_value up to date, and if this data * point is off the graph, change the scale to make it fit */ if (value > w->strip_chart.max_value) { w->strip_chart.max_value = value; if (XtIsRealized((Widget)w) && w->strip_chart.max_value > w->strip_chart.scale) { XClearWindow(XtDisplay(w), XtWindow(w)); w->strip_chart.interval = repaint_window(w, 0, XtWidth(w)); } } w->strip_chart.valuedata[w->strip_chart.interval] = value; if (XtIsRealized((Widget)w)) { int y = (int)(XtHeight(w) - XtHeight(w) * value / w->strip_chart.scale); XFillRectangle(XtDisplay(w), XtWindow(w), w->strip_chart.fgGC, w->strip_chart.interval, y, 1, XtHeight(w) - y); /* * Fill in the graph lines we just painted over */ if (w->strip_chart.points != NULL) { w->strip_chart.points[0].x = w->strip_chart.interval; XDrawPoints(XtDisplay(w), XtWindow(w), w->strip_chart.hiGC, w->strip_chart.points, w->strip_chart.scale - 1, CoordModePrevious); } XFlush(XtDisplay(w)); /* Flush output buffers */ } w->strip_chart.interval++; /* Next point */ }
/*ARGSUSED*/ static void Initialize( Widget request, /* unused */ Widget new_w, ArgList args, /* unused */ Cardinal *num_args ) /* unused */ { if (XtWidth (new_w) <= 0) XtWidth (new_w) = 5; if (XtHeight (new_w) <= 0) XtHeight (new_w) = 5; }
static void XawViewportChangeManaged(Widget widget) { ViewportWidget w = (ViewportWidget)widget; int num_children = w->composite.num_children; Widget child, *childP; int i; child = NULL; for (childP = w->composite.children, i = 0; i < num_children; childP++, i++) { if (XtIsManaged(*childP) && *childP != w->viewport.clip && *childP != w->viewport.horiz_bar && *childP != w->viewport.vert_bar) { child = *childP; break; } } if (child != w->viewport.child) { w->viewport.child = child; if (child != NULL) { XtResizeWidget(child, XtWidth(child), XtHeight(child), 0); if (XtIsRealized(widget)) { ViewportConstraints constraints = (ViewportConstraints)child->core.constraints; if (!XtIsRealized(child)) { Window window = XtWindow(w); XtMoveWidget(child, 0, 0); w->core.window = XtWindow(w->viewport.clip); XtRealizeWidget(child); w->core.window = window; constraints->viewport.reparented = True; } else if (!constraints->viewport.reparented) { XReparentWindow(XtDisplay(w), XtWindow(child), XtWindow(w->viewport.clip), 0, 0); constraints->viewport.reparented = True; if (child->core.mapped_when_managed) XtMapWidget(child); } } GetGeometry(widget, XtWidth(child), XtHeight(child)); (*((ViewportWidgetClass)w->core.widget_class)->form_class.layout) ((FormWidget)w, XtWidth(w), XtHeight(w), True /* True? */); } } #ifdef notdef (*Superclass->composite_class.change_managed)(widget); #endif }
static void initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args) { XmDropTransferEntry entries; DEBUGOUT(_LtDebug(__FILE__, new_w, "%s:initialize(%d) - %i args\n" "\trequest X %5i Y %5i W %5i H %5i\n" "\t new_w X %5i Y %5i W %5i H %5i\n", __FILE__, __LINE__, *num_args, XtX(request), XtY(request), XtWidth(request), XtHeight(request), XtX(new_w), XtY(new_w), XtWidth(new_w), XtHeight(new_w))); DEBUGOUT(_LtDebugPrintArgList(__FILE__, new_w, args, *num_args, False)); if (DT_NumDropTransfers(new_w) != 0) { /* Copy the user specified list */ DT_NumDropTransferLists(new_w) = 1; DT_DropTransferLists(new_w) = (XmDropTransferList)XtMalloc(sizeof(XmDropTransferListRec)); entries = (XmDropTransferEntry)XtMalloc(DT_NumDropTransfers(new_w) * sizeof(XmDropTransferEntryRec)); memcpy(entries, DT_DropTransfers(new_w), DT_NumDropTransfers(new_w) * sizeof(XmDropTransferEntryRec)); DT_DropTransferLists(new_w)[0].transfer_list = entries; DT_DropTransferLists(new_w)[0].num_transfers = DT_NumDropTransfers(new_w); DT_DropTransfers(new_w) = entries; } else { DT_DropTransferLists(new_w) = NULL; DT_NumDropTransferLists(new_w) = 0; } DT_MotifDropAtom(new_w) = XmInternAtom(XtDisplay(new_w), _XA_MOTIF_DROP, False); DT_CurDropTransferList(new_w) = XmUNSPECIFIED; DT_CurXfer(new_w) = XmUNSPECIFIED; DT_CurTargets(new_w) = NULL; DT_CurClientData(new_w) = NULL; }
/* Blts data according to current size, then redraws the stripChart window * Next represents the number of valid points in data. Returns the (possibly) * adjusted value of next. If next is 0, this routine draws an empty window * (scale - 1 lines for graph). If next is less than the current window width, * the returned value is identical to the initial value of next and data is * unchanged. Otherwise keeps half a window's worth of data. If data is * changed, then w->strip_chart.max_value is updated to reflect the * largest data point */ static int repaint_window(StripChartWidget w, int left, int width) { int i, j; int next = w->strip_chart.interval; int scale = w->strip_chart.scale; int scalewidth = 0; /* Compute the minimum scale required to graph the data, but don't go lower than min_scale */ if (w->strip_chart.interval != 0 || scale <= w->strip_chart.max_value) scale = w->strip_chart.max_value + 1; if (scale < w->strip_chart.min_scale) scale = w->strip_chart.min_scale; if (scale != w->strip_chart.scale) { w->strip_chart.scale = scale; left = 0; width = next; scalewidth = XtWidth(w); XawStripChartResize((Widget)w); if (XtIsRealized((Widget)w)) XClearWindow(XtDisplay(w), XtWindow(w)); } if (XtIsRealized((Widget)w)) { Display *dpy = XtDisplay(w); Window win = XtWindow(w); width += left - 1; if (!scalewidth) scalewidth = width; if (next < ++width) width = next; /* Draw data point lines */ for (i = left; i < width; i++) { int y = XtHeight(w) - (XtHeight(w) * w->strip_chart.valuedata[i]) / w->strip_chart.scale; XFillRectangle(dpy, win, w->strip_chart.fgGC, i, y, 1, XtHeight(w) - y); } /* Draw graph reference lines */ for (i = 1; i < w->strip_chart.scale; i++) { j = i * ((int)XtHeight(w) / w->strip_chart.scale); XDrawLine(dpy, win, w->strip_chart.hiGC, left, j, scalewidth, j); } } return (next); }
static void SetDimensions(ScrollbarWidget w) { if (w->scrollbar.orientation == XtorientVertical) { w->scrollbar.length = XtHeight(w); w->scrollbar.thickness = XtWidth(w); } else { w->scrollbar.length = XtWidth(w); w->scrollbar.thickness = XtHeight(w); } }
static void XawPortholeRealize(Widget gw, Mask *valueMask, XSetWindowAttributes *attr) { attr->bit_gravity = NorthWestGravity; *valueMask |= CWBitGravity; if (XtWidth(gw) < 1) XtWidth(gw) = 1; if (XtHeight(gw) < 1) XtHeight(gw) = 1; (*portholeWidgetClass->core_class.superclass->core_class.realize) (gw, valueMask, attr); }
static void RedrawThumbs(ViewportWidget w) { Widget child = w->viewport.child; Widget clip = w->viewport.clip; if (w->viewport.horiz_bar != NULL) SetBar(w->viewport.horiz_bar, -(int)XtX(child), XtWidth(clip), XtWidth(child)); if (w->viewport.vert_bar != NULL) SetBar(w->viewport.vert_bar, -(int)XtY(child), XtHeight(clip), XtHeight(child)); }
static void draw_highlight(XmEnhancedButtonWidget eb) { eb->primitive.highlighted = True; eb->primitive.highlight_drawn = True; if (!XtWidth(eb) || !XtHeight(eb) || !eb->primitive.highlight_thickness) return; XmeDrawHighlight(XtDisplay(eb), XtWindow(eb), eb->primitive.highlight_GC, 0, 0, XtWidth(eb), XtHeight(eb), eb->primitive.highlight_thickness); }
static void draw_unhighlight(XmEnhancedButtonWidget eb) { GC manager_background_GC; eb->primitive.highlighted = False; eb->primitive.highlight_drawn = False; if (!XtWidth(eb) || !XtHeight(eb) || !eb->primitive.highlight_thickness) return; if (XmIsManager(eb->core.parent)) { #ifdef UNHIGHLIGHTT XmSpecifyUnhighlightTrait UnhighlightT; if (((UnhighlightT = (XmSpecifyUnhighlightTrait) XmeTraitGet((XtPointer) XtClass(eb->core.parent), XmQTspecifyUnhighlight)) != NULL) && (UnhighlightT->getUnhighlightGC != NULL)) { /* if unhighlight trait in parent use specified GC... */ manager_background_GC = UnhighlightT->getUnhighlightGC(eb->core.parent, (Widget) eb); } else { /* ...otherwise, use parent's background GC */ manager_background_GC = ((XmManagerWidget) (eb->core.parent))->manager.background_GC; } #else manager_background_GC = ((XmManagerWidget) (eb->core.parent))->manager.background_GC; #endif XmeDrawHighlight(XtDisplay(eb), XtWindow(eb), manager_background_GC, 0, 0, XtWidth(eb), XtHeight(eb), eb->primitive.highlight_thickness); if (!eb->pushbutton.armed && eb->primitive.shadow_thickness) XmeClearBorder(XtDisplay(eb), XtWindow(eb), eb->primitive.highlight_thickness, eb->primitive.highlight_thickness, eb->core.width - 2 * eb->primitive.highlight_thickness, eb->core.height - 2 * eb->primitive.highlight_thickness, eb->primitive.shadow_thickness); } else XmeClearBorder(XtDisplay(eb), XtWindow(eb), 0, 0, XtWidth(eb), XtHeight(eb), eb->primitive.highlight_thickness); }
UnhighlightBorder(Widget w) #endif /* _NO_PROTO */ { XmPrimitiveWidget pw = (XmPrimitiveWidget) w ; pw->primitive.highlighted = False ; pw->primitive.highlight_drawn = False ; if(XtWidth( w) == 0 || XtHeight( w) == 0 || pw->primitive.highlight_thickness == 0) return ; _XmClearBorder( XtDisplay (pw), XtWindow (pw), 0, 0, XtWidth( w), XtHeight( w) , pw->primitive.highlight_thickness) ; }
/*! 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); }
/*ARGSUSED*/ static void ClearToBackground(Widget w, int x, int y, unsigned int width, unsigned int height) { /* * Don't clear in height or width are zero * XClearArea() has special semantic for these values */ TextWidget xaw = (TextWidget)XtParent(w); Position x1, y1, x2, y2; x1 = XawMax(x, xaw->text.r_margin.left); y1 = XawMax(y, xaw->text.r_margin.top); x2 = XawMin(x + (int)width, (int)XtWidth(xaw) - xaw->text.r_margin.right); y2 = XawMin(y + (int)height, (int)XtHeight(xaw) - xaw->text.r_margin.bottom); x = x1; y = y1; width = XawMax(0, x2 - x1); height = XawMax(0, y2 - y1); if (height != 0 && width != 0) XClearArea(XtDisplayOfObject(w), XtWindowOfObject(w), x, y, width, height, False); }
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); } } }
static void resize(Widget w) { XmDrawnButtonCallbackStruct cbs; DEBUGOUT(_LtDebug(__FILE__, w, "Resize (%dx%d%+d%+d)\n", XtWidth(w), XtHeight(w),XtX(w),XtY(w))); #define superclass (&xmLabelClassRec) (*superclass->core_class.resize) (w); #undef superclass if (XtIsRealized(w) && DB_ResizeCallback(w)) { cbs.reason = XmCR_RESIZE; cbs.event = NULL; cbs.window = XtWindow(w); cbs.click_count = DB_ClickCount(w); XFlush(XtDisplay(w)); XtCallCallbackList(w, DB_ResizeCallback(w), (XtPointer)&cbs); } }
static void BtnDown (Widget grabshell, XEvent *event, String *params, Cardinal *num_params) { int x, y; Window win; /* Ignore modal cascade replay of event */ if (! _XmIsEventUnique(event)) return; /* Move to grabshell's coordinate system */ XTranslateCoordinates(XtDisplay(grabshell), event -> xbutton.window, XtWindow(grabshell), event -> xbutton.x, event -> xbutton.y, &x, &y, &win); /* Popdown if outside the shell */ if (x >= 0 && y >= 0 && x <= XtWidth(grabshell) && y <= XtHeight(grabshell)) { GSAllowEvents(grabshell, SyncPointer, event -> xbutton.time); } else { Popdown(grabshell, event, params, num_params); } }