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; }
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; }
/**************** * 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) ; }
/*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); }
void XmdsPopupMenuPosition(XmRowColumnWidget w,XButtonEvent *event) { Widget option = w->row_column.memory_subwidget; XtX(w) = event->x_root - (option ? XtX(option) + XtWidth(option) / 2 : 0); XtY(w) = event->y_root - (option ? XtY(option) + XtHeight(option) / 2 : 0); RC_SetWidgetMoved(w,1); RC_CascadeBtn(w) = XtWindowToWidget(XtDisplay(w),event->window); }
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; }
static Boolean set_values(Widget old, Widget request, Widget new_w, ArgList args, Cardinal *num_args) { Boolean refresh_needed = False; DEBUGOUT(_LtDebug(__FILE__, new_w, "set_values: %i args\n" "\t old X %5i Y %5i W %5i H %5i\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(old), XtY(old), XtWidth(old), XtHeight(old), 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) = DB_MultiClick(old); if (!XmRepTypeValidValue(XmRepTypeGetId(XmRShadowType), DB_ShadowType(new_w), new_w)) DB_ShadowType(new_w) = DB_ShadowType(old); if (DB_ShadowType(old) != DB_ShadowType(new_w)) { refresh_needed = True; } /* rws 23 Jul 1997 Label will have polluted the height and width since it will not be able to determine the correct size, since it does not know what is in the window! Therefore if the size has changed use the requested size. xdir top right hand logo button JHG: If there's something identifiable in the button, trust Label. rws 11 Sep 1999 Don't trust Label. Take a look at drawnbutton/test9 */ if (/* !Lab_TextRect_height(new_w) && */ (XtWidth(new_w) != XtWidth(request) || XtHeight(new_w) != XtHeight(request))) { XtWidth(new_w) = XtWidth(request); XtHeight(new_w) = XtHeight(request); refresh_needed = True; } return refresh_needed; }
/* Enforce margins for children if margins are non-zero */ void _XmGMEnforceMargin(XmManagerWidget manager, #if NeedWidePrototypes int margin_width, int margin_height, int setvalue #else Dimension margin_width, Dimension margin_height, Boolean setvalue #endif /* NeedWidePrototypes */ ) { int i ; register Widget child ; register Boolean do_move ; Position newx, newy ; for(i = 0 ; i < manager->composite.num_children ; i++) { do_move = False ; child = (Widget) manager->composite.children[i] ; if(XtIsManaged (child)) { if ((margin_width != 0) && (XtX(child) < (int) margin_width )) { do_move = True ; newx = margin_width ; } else newx = XtX(child) ; if ((margin_height != 0) && (XtY(child) < (int) margin_height )) { do_move = True ; newy = margin_height ; } else newy = XtY(child) ; if(do_move) { if (setvalue) { Arg args[2] ; XtSetArg(args[0], XmNx, newx); XtSetArg(args[1], XmNy, newy); XtSetValues(child, args, 2); } else XmeConfigureObject(child, newx, newy, child->core.width, child->core.height, child->core.border_width); } } } }
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); }
/******************************************************************* * Figure out how much size we need. Shrink wrap around the children. ****************/ void _XmGMCalcSize(XmManagerWidget manager, #if NeedWidePrototypes int margin_width, int margin_height, #else Dimension margin_width, Dimension margin_height, #endif /* NeedWidePrototypes */ Dimension *replyWidth, Dimension *replyHeight ) { register int i ; register Widget child ; int right, bottom ; *replyWidth = *replyHeight = 0 ; for (i = 0; i < manager->composite.num_children; i++) { child = manager->composite.children[i]; if (XtIsManaged (child)) { right = XtX(child) + 2*XtBorderWidth(child) + XtWidth(child) ; bottom = XtY(child) + 2*XtBorderWidth(child) + XtHeight(child) ; if (right > (int) *replyWidth) *replyWidth = right ; if (bottom > (int) *replyHeight) *replyHeight = bottom ; } } *replyWidth += margin_width + MGR_ShadowThickness(manager); *replyHeight += margin_height + MGR_ShadowThickness(manager); if (!(*replyWidth)) *replyWidth = 10; if (!(*replyHeight)) *replyHeight = 10; }
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); } }
static void initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args) { /* printf("%s:%s(%d) - %s %li\n", __FILE__, __FUNCTION__, __LINE__, XtName(new_w), Slide_Interval(new_w)); */ if (Slide_DestWidth(new_w) == (Dimension)XmUNSPECIFIED) { Slide_DestWidth(new_w) = XtWidth(Slide_Widget(new_w)); } if (Slide_DestHeight(new_w) == (Dimension)XmUNSPECIFIED) { Slide_DestHeight(new_w) = XtHeight(Slide_Widget(new_w)); } if (Slide_DestX(new_w) == XmUNSPECIFIED_POSITION) { Slide_DestX(new_w) = XtX(Slide_Widget(new_w)); } if (Slide_DestY(new_w) == XmUNSPECIFIED_POSITION) { Slide_DestY(new_w) = XtY(Slide_Widget(new_w)); } Slide_Id(new_w) = XtAppAddTimeOut(XtWidgetToApplicationContext(new_w), Slide_Interval(new_w), (XtTimerCallbackProc)_XltSlideProc, new_w); XtAddCallback(Slide_Widget(new_w), XmNdestroyCallback, (XtCallbackProc)targetDestroy, new_w); }
/************************************************************************ * saveKeybd() * * This routine will write out to the passed file descriptor any state * information this dialog needs. It is called from saveSessionCB with the * file already opened. * All information is saved in xrm format. There is no restriction * on what can be saved. It doesn't have to be defined or be part of any * widget or Xt definition. Just name and save it here and recover it in * restoreBackdrop. The suggested minimum is whether you are mapped, and your * location. ************************************************************************/ void saveKeybd( int fd ) { Position x,y; char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */ XmVendorShellExtObject vendorExt; XmWidgetExtData extData; if (style.kbdDialog != NULL) { if (XtIsManaged(style.kbdDialog)) sprintf(bufr, "*keyboardDlg.ismapped: True\n"); else sprintf(bufr, "*keyboardDlg.ismapped: False\n"); /* Get and write out the geometry info for our Window */ x = XtX(XtParent(style.kbdDialog)); y = XtY(XtParent(style.kbdDialog)); /* Modify x & y to take into account window mgr frames * This is pretty bogus, but I don't know a better way to do it. */ extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION); vendorExt = (XmVendorShellExtObject)extData->widget; x -= vendorExt->vendor.xOffset; y -= vendorExt->vendor.yOffset; sprintf(bufr, "%s*keyboardDlg.x: %d\n", bufr, x); sprintf(bufr, "%s*keyboardDlg.y: %d\n", bufr, y); write (fd, bufr, strlen(bufr)); } }
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); } }
/*! 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); }
inline void callFunction(mxArray* plhs[], const mxArray*prhs[]) { if (!mexCheckType<T>(prhs[0])) mexErrMsgTxt("type of argument 1 is not consistent"); if (mxIsSparse(prhs[0])) mexErrMsgTxt("argument 1 should be full"); if (!mexCheckType<T>(prhs[1])) mexErrMsgTxt("type of argument 2 is not consistent"); if (mxIsSparse(prhs[1])) mexErrMsgTxt("argument 2 should be full"); T* prX = reinterpret_cast<T*>(mxGetPr(prhs[0])); const mwSize* dimsX=mxGetDimensions(prhs[0]); int n=static_cast<int>(dimsX[0]); int M=static_cast<int>(dimsX[1]); T* prY = reinterpret_cast<T*>(mxGetPr(prhs[1])); const mwSize* dimsY=mxGetDimensions(prhs[1]); int nY=static_cast<int>(dimsY[0]); int MY=static_cast<int>(dimsY[1]); if (n != nY) mexErrMsgTxt("argument sizes are not consistent"); plhs[0]=createMatrix<T>(M,MY); T* prXY=reinterpret_cast<T*>(mxGetPr(plhs[0])); Matrix<T> X(prX,n,M); Matrix<T> Y(prY,nY,MY); Matrix<T> XtY(prXY,M,MY); X.mult(Y,XtY,true,false); }
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 Boolean set_values(Widget current, Widget request, Widget new_w, ArgList args, Cardinal *num_args) { DEBUGOUT(_LtDebug(__FILE__, new_w, "%s:set_values(%d) - %i args\n" "\t old X %5i Y %5i W %5i H %5i\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(current), XtY(current), XtWidth(current), XtHeight(current), 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)); return True; }
XtGeometryResult qmotif_dialog_geometry_manger( Widget w, XtWidgetGeometry *req, XtWidgetGeometry *rep ) { XtGeometryHandler geometry_manager = xmDialogShellClassRec.composite_class.geometry_manager; XtGeometryResult result = (*geometry_manager)( w, req, rep ); QtMotifDialog *dialog = ( (QtMotifDialogWidget) w->core.parent )->qmotifdialog.dialog; dialog->setGeometry( XtX( w ), XtY( w ), XtWidth( w ), XtHeight( w ) ); return result; }
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 ScrollUpDownProc(Widget widget, XtPointer closure, XtPointer call_data) { ViewportWidget w = (ViewportWidget)closure; Widget child = w->viewport.child; int pix = (long)call_data; int x, y; if (child == NULL) return; x = XtX(child) - (widget == w->viewport.horiz_bar ? pix : 0); y = XtY(child) - (widget == w->viewport.vert_bar ? pix : 0); MoveChild(w, x, y); }
void EmbeddedClientReparent (char * client_name, Widget icon) { WmFpEmbeddedClientList embedded_client_list = (WmFpEmbeddedClientList) panel.embedded_client_list; int i; for (i = 0; i < panel.embedded_client_count; i++) { if (strcmp (client_name, embedded_client_list[i].pchResName) == 0) break; } /* Try to reparent the client to/from the main panel. If this */ /* fails, it is because of a dtwm restart and the clients have */ /* not yet been grabbed. So just reset the embedded client data */ if (ReparentEmbeddedClient (&embedded_client_list[i], icon, XtWindow (XtParent (icon)), XtX (icon) + 3, XtY (icon) + 3, XtWidth(icon) - 6, XtHeight(icon) - 6) == False) { embedded_client_list[i].wControl = icon; embedded_client_list[i].winParent = XtWindow (XtParent (icon)); embedded_client_list[i].x = XtX (icon) + 3; embedded_client_list[i].y = XtY (icon) + 3; embedded_client_list[i].width = XtWidth (icon) - 6; embedded_client_list[i].height = XtHeight (icon) - 6; } }
static void EmbeddedClientSetGeometry (WmFpEmbeddedClientData * embedded_client_data) { Widget control; control = embedded_client_data->wControl; embedded_client_data->winParent = XtWindow (XtParent (control)); embedded_client_data->x = XtX (control) + 3; embedded_client_data->y = XtY (control) + 3; embedded_client_data->width = XtWidth (control) - 6; embedded_client_data->height = XtHeight (control) - 6; }
static void layout_child(PortholeWidget pw, Widget child, XtWidgetGeometry *geomp, Position *xp, Position *yp, Dimension *widthp, Dimension *heightp) { Position minx, miny; *xp = XtX(child); /* default to current values */ *yp = XtY(child); *widthp = XtWidth(child); *heightp = XtHeight(child); if (geomp) { /* mix in any requested changes */ if (geomp->request_mode & CWX) *xp = geomp->x; if (geomp->request_mode & CWY) *yp = geomp->y; if (geomp->request_mode & CWWidth) *widthp = geomp->width; if (geomp->request_mode & CWHeight) *heightp = geomp->height; } /* * Make sure that the child is at least as large as the porthole; there * is no maximum size */ if (*widthp < XtWidth(pw)) *widthp = XtWidth(pw); if (*heightp < XtHeight(pw)) *heightp = XtHeight(pw); /* * Make sure that the child is still on the screen. Note that this must * be done *after* the size computation so that we know where to put it */ minx = (Position)XtWidth(pw) - (Position)*widthp; miny = (Position)XtHeight(pw) - (Position)*heightp; if (*xp < minx) *xp = minx; if (*yp < miny) *yp = miny; if (*xp > 0) *xp = 0; if (*yp > 0) *yp = 0; }
/* * Function: * ResizeChildren * * Parameters: * w - form widget * * Description: * Resizes all children to new_x and new_y. */ static void ResizeChildren(Widget w) { FormWidget fw = (FormWidget)w; int num_children = fw->composite.num_children; WidgetList children = fw->composite.children; Widget *childP; for (childP = children; childP - children < num_children; childP++) { FormConstraints form; Position x, y; if (!XtIsManaged(*childP)) continue; form = (FormConstraints)(*childP)->core.constraints; if (fw->form.old_width && fw->form.old_height) { x = TransformCoord(form->form.new_x, fw->form.old_width, XtWidth(fw), form->form.left); y = TransformCoord(form->form.new_y, fw->form.old_height, XtHeight(fw), form->form.top); } else { x = form->form.new_x; y = form->form.new_y; } if (fw->form.no_refigure) { /* * I am changing the widget wrapper w/o modifing the window. This is * risky, but I can get away with it since I am the parent of this * widget, and he must ask me for any geometry changes * * The window will be updated when no_refigure is set back to False */ XtX(*childP) = x; XtY(*childP) = y; } else XtMoveWidget(*childP, x, y); } }
static void SendReport(PortholeWidget pw, unsigned int changed) { Widget child = find_child(pw); if (pw->porthole.report_callbacks && child) { XawPannerReport prep; prep.changed = changed; prep.slider_x = -XtX(child); /* porthole is "inner" */ prep.slider_y = -XtY(child); /* child is outer since it is larger */ prep.slider_width = XtWidth(pw); prep.slider_height = XtHeight(pw); prep.canvas_width = XtWidth(child); prep.canvas_height = XtHeight(child); XtCallCallbackList((Widget)pw, pw->porthole.report_callbacks, (XtPointer)&prep); } }
static void gadget_border_highlight(Widget w) { DEBUGOUT(_LtDebug(__FILE__, w, "gadget_border_highlight\n")); /* with zero width, we don't need this... */ if (G_HighlightThickness(w) == 0) { return; } _XmDrawHighlight(XtDisplayOfObject(w), XtWindowOfObject(w), XmParentHighlightGC(w), XtX(w), XtY(w), XtWidth(w), XtHeight(w), G_HighlightThickness(w), LineSolid); G_Highlighted(w) = True; G_HighlightDrawn(w) = True; }
static void SendReport(ViewportWidget w, unsigned int changed) { XawPannerReport rep; if (w->viewport.report_callbacks) { Widget child = w->viewport.child; Widget clip = w->viewport.clip; rep.changed = changed; rep.slider_x = -XtX(child); /* child is canvas */ rep.slider_y = -XtY(child); /* clip is slider */ rep.slider_width = XtWidth(clip); rep.slider_height = XtHeight(clip); rep.canvas_width = XtWidth(child); rep.canvas_height = XtHeight(child); XtCallCallbackList((Widget)w, w->viewport.report_callbacks, (XtPointer)&rep); } }
/************************************************************************ * saveMain() * * This routine will write out to the passed file descriptor any state * information this dialog needs. It is called from saveSessionCB with the * file already opened. * All information is saved in xrm format. There is no restriction * on what can be saved. It doesn't have to be defined or be part of any * widget or Xt definition. Just name and save it here and recover it in * restoreMain. The suggested minimum is whether you are mapped, and your * location. ************************************************************************/ void saveMain( int fd ) { Position x,y; char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */ if (style.mainWindow != NULL) { if (XtIsRealized(style.mainWindow)) sprintf(bufr, "*mainWindow.ismapped: True\n"); /* Get and write out the geometry info for our Window */ x = XtX(XtParent(style.mainWindow)); y = XtY(XtParent(style.mainWindow)); sprintf(bufr, "%s*mainWindow.x: %d\n", bufr, x); sprintf(bufr, "%s*mainWindow.y: %d\n", bufr, y); write (fd, bufr, strlen(bufr)); } }
/************************************************************************ * saveI18n() * * This routine will write out to the passed file descriptor any state * information this dialog needs. It is called from saveSessionCB with the * file already opened. * All information is saved in xrm format. There is no restriction * on what can be saved. It doesn't have to be defined or be part of any * widget or Xt definition. Just name and save it here and recover it in * restoreBackdrop. The suggested minimum is whether you are mapped, and your * location. ************************************************************************/ void saveI18n( int fd ) { Position x,y; Dimension width, height; char *bufr = style.tmpBigStr; /* size=[1024], make bigger if needed */ XmVendorShellExtObject vendorExt; XmWidgetExtData extData; if (style.i18nDialog != NULL) { if (XtIsManaged(style.i18nDialog)) sprintf(bufr, "*i18nDlg.ismapped: True\n"); else sprintf(bufr, "*i18nDlg.ismapped: False\n"); /* Get and write out the geometry info for our Window */ x = XtX(XtParent(style.i18nDialog)); y = XtY(XtParent(style.i18nDialog)); /* Modify x & y to take into account window mgr frames * This is pretty bogus, but I don't know a better way to do it. */ extData = _XmGetWidgetExtData(style.shell, XmSHELL_EXTENSION); vendorExt = (XmVendorShellExtObject)extData->widget; x -= vendorExt->vendor.xOffset; y -= vendorExt->vendor.yOffset; width = XtWidth(style.i18nDialog); height = XtHeight(style.i18nDialog); sprintf(bufr, "%s*i18nDlg.x: %d\n", bufr, x); sprintf(bufr, "%s*i18nDlg.y: %d\n", bufr, y); sprintf(bufr, "%s*i18nDlg.width: %d\n", bufr, width); sprintf(bufr, "%s*i18nDlg.height: %d\n", bufr, height); if(-1 == write (fd, bufr, strlen(bufr))) { perror(strerror(errno)); } } }