Пример #1
0
/*ARGSUSED*/
static void
XawFormInitialize(Widget request, Widget cnew,
		  ArgList args, Cardinal *num_args)
{
    FormWidget fw = (FormWidget)cnew;

    /*
     * Get the size from the parent
     */
    if (XtWidth(fw) == 0) XtWidth(fw) = XtWidth(XtParent(fw));
    if (XtHeight(fw) == 0) XtHeight(fw) = XtHeight(XtParent(fw));

    fw->form.old_width = fw->form.old_height = 0;
    fw->form.no_refigure = False;
    fw->form.needs_relayout = False;
    fw->form.resize_in_layout = True;
    fw->form.resize_is_no_op = False;
}
static XtGeometryResult
TestSmaller(ViewportWidget w, XtWidgetGeometry *request,
	    XtWidgetGeometry *reply_return)
{
    if (request->width < XtWidth(w) || request->height < XtHeight(w))
	return (XtMakeGeometryRequest((Widget)w, request, reply_return));

    return (XtGeometryYes);
}
/* Fill the area specified by top and bottom with the given pattern */
static float
FractionLoc(ScrollbarWidget w, int x, int y)
{
    float   result;

    result = PICKLENGTH(w, x / (float)XtWidth(w), y / (float)XtHeight(w));

    return (FloatInRange(result, 0.0, 1.0));
}
Пример #4
0
static void
XawLabelResize(Widget w)
{
    LabelWidget lw = (LabelWidget)w;
    Position dx, dy;

    _Reposition(lw, XtWidth(w), XtHeight(w), &dx, &dy);
    compute_bitmap_offsets(lw);
}
/*ARGSUSED*/
static Boolean
Layout(FormWidget w, unsigned int width, unsigned int height, Bool force)
{
    ComputeLayout((Widget)w, True, True);
    w->form.preferred_width = XtWidth(w);
    w->form.preferred_height = XtHeight(w);

    return (False);
}
Пример #6
0
/****************************************************************
 * Handle query geometry requests for both BB and DA.
 ****************/
XtGeometryResult
_XmGMHandleQueryGeometry(Widget widget,
                       XtWidgetGeometry * intended,
                       XtWidgetGeometry * desired,
#if NeedWidePrototypes
                       int margin_width,
                       int margin_height,        
#else
                       Dimension margin_width,
                       Dimension margin_height,    
#endif /* NeedWidePrototypes */
                       int resize_policy)
{
    Dimension width, height ;
    
    /* first determine what is the desired size, using the resize_policy. */
    if (resize_policy == XmRESIZE_NONE) {
	desired->width = XtWidth(widget) ;
	desired->height = XtHeight(widget) ;
    } else {
	if (GMode( intended) & CWWidth) width = intended->width;
	if (GMode( intended) & CWHeight) height = intended->height;
	
	_XmGMCalcSize ((XmManagerWidget)widget, 
		       margin_width, margin_height, &width, &height);
	if ((resize_policy == XmRESIZE_GROW) &&
	    ((width < XtWidth(widget)) ||
	     (height < XtHeight(widget)))) {
	    desired->width = XtWidth(widget) ;
	    desired->height = XtHeight(widget) ;
	} else {
	    desired->width = width ;
	    desired->height = height ;
	}
    }
    
    /* deal with user initial size setting */
    if (!XtIsRealized(widget))  {
	if (XtWidth(widget) != 0) desired->width = XtWidth(widget) ;
	if (XtHeight(widget) != 0) desired->height = XtHeight(widget) ;
    }	    

    return XmeReplyToQueryGeometry(widget, intended, desired) ;
}
Пример #7
0
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);
    }
}
Пример #8
0
/************************************************************************
 *
 *  ChangeManaged
 *	Process a changed in managed state of the child.  If its
 *	size is out of sync with the frame, make a resize request
 *	to change the size of the frame.
 *	Note: called before ConstraintDestroy.
 *
 ************************************************************************/
static void 
ChangeManaged(
        Widget wid )
{
   XmFrameWidget fw = (XmFrameWidget) wid ;

   Widget title_area = (fw->frame.title_area &&
			XtIsManaged(fw->frame.title_area)) ?
			fw->frame.title_area : (Widget) NULL;
   Dimension t_w = 0;
   Dimension t_h = 0;
   Dimension t_bw = (title_area) ? title_area->core.border_width : 0;

   Widget work_area = (fw->frame.work_area &&
			XtIsManaged(fw->frame.work_area)) ?
			fw->frame.work_area : (Widget) NULL;

   Dimension w_w = (work_area) ? work_area->core.width : 0;
   Dimension w_h = (work_area) ? work_area->core.height : 0;
   Dimension w_bw = (work_area) ? work_area->core.border_width : 0;
   Dimension fwWidth, fwHeight;

   if (title_area) 
   {                                          
	/* We don't want the current size of the title object -- width/height
	** may have been set on it. Because we'll be forcing it to the size we
	** want (see ConfigureChildren), we must use the "natural" size here,
	** so query its value now. (Use current border_width.)
        */
	XtWidgetGeometry title_reply;                           
	XtQueryGeometry (title_area, NULL, &title_reply);      
	t_w = (title_reply.request_mode & CWWidth) ?          
		title_reply.width : title_area->core.width;   
	t_h = (title_reply.request_mode & CWHeight) ?       
		title_reply.height : title_area->core.height;
   }                             

   /* need to  check on initial sizing (not null) */
   if (XtIsRealized((Widget)fw) || (XtWidth(fw) == 0) || (XtHeight(fw) == 0)) {
       CalcFrameSize (fw, t_w, t_h, t_bw, w_w, w_h, w_bw,
		      &fwWidth, &fwHeight);

       while (XtMakeResizeRequest ((Widget) fw, 
				   fwWidth, fwHeight,
				   &fwWidth, &fwHeight) == XtGeometryAlmost) 
	 /*EMPTY*/;
       ClearShadow(fw);
   }
 
   ConfigureChildren(fw, NULL, NULL);

   DrawShadow(fw);

   XmeNavigChangeManaged((Widget) fw);
}
Пример #9
0
/* 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
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);
    }
}
Пример #11
0
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
static void 
_DtMapCB(
        Widget w,
        XtPointer client_data,
        XtPointer call_data )
{
    XSizeHints hints;

    if (save.restoreFlag)
    {
	hints.min_width  = XtWidth(w);
	hints.min_height = XtHeight(w);
	hints.max_width  = XtWidth(w);
	hints.max_height = XtHeight(w);
	hints.flags      = PMinSize | PMaxSize;
	XSetWMNormalHints (style.display, XtWindow(w), &hints);
    }

    XtRemoveCallback(style.shell, XtNpopupCallback, _DtMapCB, NULL);
}
/* ARGSUSED */
static void
XawScrollbarInitialize(Widget request, Widget cnew,
		       ArgList args, Cardinal *num_args)
{
    ScrollbarWidget w = (ScrollbarWidget)cnew;

    CreateGC(cnew);

    if (XtWidth(w) == 0)
	XtWidth(w) = w->scrollbar.orientation == XtorientVertical ?
			w->scrollbar.thickness : w->scrollbar.length;

    if (XtHeight(w) == 0)
	XtHeight(w) = w->scrollbar.orientation == XtorientHorizontal ?
			w->scrollbar.thickness : w->scrollbar.length;

    SetDimensions(w);
    w->scrollbar.direction = 0;
    w->scrollbar.topLoc = 0;
    w->scrollbar.shownLength = w->scrollbar.min_thumb;
}
Пример #13
0
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;
}
Пример #14
0
Файл: Command.c Проект: aosm/X11
static Bool
ShapeButton(CommandWidget cbw, Bool checkRectangular)
{
    Dimension corner_size = 0;

    if (cbw->command.shape_style == XawShapeRoundedRectangle) {
	corner_size = XtWidth(cbw) < XtHeight(cbw) ?
			XtWidth(cbw) : XtHeight(cbw);
	corner_size = (corner_size * cbw->command.corner_round) / 100;
    }

    if (checkRectangular || cbw->command.shape_style != XawShapeRectangle) {
	if (!XmuReshapeWidget((Widget)cbw, cbw->command.shape_style,
			      corner_size, corner_size)) {
	    cbw->command.shape_style = XawShapeRectangle;
	    return (False);
	}
    }

    return (True);
}
Пример #15
0
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;
}
Пример #16
0
Файл: List.c Проект: aosm/X11
static void
XawListResize(Widget w)
{
    Dimension width, height;

    width = XtWidth(w);
    height = XtHeight(w);

    if (Layout(w, False, False, &width, &height))
	XtAppWarning(XtWidgetToApplicationContext(w),
		     "List Widget: Size changed when it shouldn't "
		     "have when resising.");
}
Пример #17
0
Файл: DrawnB.c Проект: att/uwin
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;
}
Пример #18
0
Файл: List.c Проект: aosm/X11
/* ClipToShadowInteriorAndLongest()
 *
 * Converts the passed gc so that any drawing done with that GC will not
 * write in the empty margin (specified by internal_width/height) (which also
 * prevents erasing the shadow.  It also clips against the value longest.
 * If the user doesn't set longest, this has no effect (as longest is the
 * maximum of all item lengths).  If the user does specify, say, 80 pixel
 * columns, though, this prevents items from overwriting other items.
 */
static void
ClipToShadowInteriorAndLongest(ListWidget lw, GC *gc_p, unsigned int x)
{
    XRectangle rect;

    rect.x = x;
    rect.y = lw->list.internal_height;
    rect.height = XtHeight(lw) - (lw->list.internal_height << 1);
    rect.width = XtWidth(lw) - lw->list.internal_width - x;
    if (rect.width > lw->list.longest)
	rect.width = lw->list.longest;

    XSetClipRectangles(XtDisplay((Widget)lw), *gc_p, 0, 0, &rect, 1, YXBanded);
}
Пример #19
0
static void 
GetDefaultPosition(
        Widget child,
        Widget parent,
        Position *xRtn,
        Position *yRtn )
{
    Display 	*disp;
    int 	max_w, max_h;
    Position 	x, y;

    x = HALFDIFF(XtWidth(parent), XtWidth(child));
    y = HALFDIFF(XtHeight(parent), XtHeight(child));
    
    /* 
     * find root co-ords of the parent's center
     */
    if (XtIsRealized (parent))
      XtTranslateCoords(parent, x, y, &x, &y);
    
    /*
     * try to keep the popup from dribbling off the display
     */
    disp = XtDisplay (child);
    max_w = DisplayWidth  (disp, DefaultScreen (disp));
    max_h = DisplayHeight (disp, DefaultScreen (disp));
    
    if ((x + (int)TotalWidth  (child)) > max_w) 
      x = max_w - TotalWidth  (child);
    if ((y + (int)TotalHeight (child)) > max_h) 
      y = max_h - TotalHeight (child);
    if (x < 0) x = 0;
    if (y < 0) y = 0;

    *xRtn = x;
    *yRtn = y;
}
static void
FillArea(ScrollbarWidget w, int top, int bottom, int thumb)
{
    Dimension length;

    top = XawMax(1, top);
    if (w->scrollbar.orientation == XtorientHorizontal)
    bottom = XawMin(bottom, XtWidth(w) - 1);
    else
    bottom = XawMin(bottom, XtHeight(w) - 1);

    if (bottom <= top)
	return;

    length = bottom - top;

    switch(thumb) {
	/* Fill the new Thumb location */
	case 1:
	    if (w->scrollbar.orientation == XtorientHorizontal)
		XFillRectangle(XtDisplay(w), XtWindow(w), w->scrollbar.gc,
			       top, 1, length, XtHeight(w) - 2);
	    else
		XFillRectangle(XtDisplay(w), XtWindow(w), w->scrollbar.gc,
			       1, top, XtWidth(w) - 2, length);
	    break;
	/* Clear the old Thumb location */
	case 0:
	    if (w->scrollbar.orientation == XtorientHorizontal)
		XClearArea(XtDisplay(w), XtWindow(w),
			   top, 1, length, XtHeight(w) - 2, False);
	    else
		XClearArea(XtDisplay(w), XtWindow(w),
			   1, top, XtWidth(w) - 2, length, False);
	    break;
    }
}
/*
 * Implementation
 */
static Widget
CreateScrollbar(ViewportWidget w, Bool horizontal)
{
    static Arg barArgs[] = {
	{XtNorientation,	    0},
	{XtNlength,		    0},
	{XtNleft,		    0},
	{XtNright,		    0},
	{XtNtop,		    0},
	{XtNbottom,		    0},
	{XtNmappedWhenManaged,	    False},
    };
    Widget clip = w->viewport.clip;
    ViewportConstraints constraints =
	(ViewportConstraints)clip->core.constraints;
    Widget bar;

    XtSetArg(barArgs[0], XtNorientation,
	   horizontal ? XtorientHorizontal : XtorientVertical);
    XtSetArg(barArgs[1], XtNlength,
	   horizontal ? XtWidth(clip) : XtHeight(clip));
    XtSetArg(barArgs[2], XtNleft,
	   !horizontal && w->viewport.useright ? XtChainRight : XtChainLeft);
    XtSetArg(barArgs[3], XtNright,
	   !horizontal && !w->viewport.useright ? XtChainLeft : XtChainRight);
    XtSetArg(barArgs[4], XtNtop,
	   horizontal && w->viewport.usebottom ? XtChainBottom: XtChainTop);
    XtSetArg(barArgs[5], XtNbottom,
	   horizontal && !w->viewport.usebottom ? XtChainTop: XtChainBottom);

    bar = XtCreateWidget(horizontal ? "horizontal" : "vertical",
			 scrollbarWidgetClass, (Widget)w,
			 barArgs, XtNumber(barArgs));
    XtAddCallback(bar, XtNscrollProc, ScrollUpDownProc, (XtPointer)w);
    XtAddCallback(bar, XtNjumpProc, ThumbProc, (XtPointer)w);

    if (horizontal) {
	w->viewport.horiz_bar = bar;
	constraints->form.vert_base = bar;
    }
    else {
	w->viewport.vert_bar = bar;
	constraints->form.horiz_base = bar;
    }

    XtManageChild(bar);

    return (bar);
}
Пример #22
0
static void
initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args)
{
#ifdef DEBUG
    printf("%s:initialize(%d) - %s %ix%i\n", __FILE__, __LINE__, 
    	XtName(new_w),
    	XtWidth(new_w), XtHeight(new_w));
#endif

    FilePicker_Label(new_w) = XmCreateLabel(new_w, XtName(new_w), args, *num_args);
    FilePicker_TextField(new_w) = XmCreateTextField(new_w, "TextField", args, *num_args);
    FilePicker_Button(new_w) = XltCreateBubbleButton(new_w, "Browse", args, *num_args);
    if (XtHeight(new_w) == 0)
    {
    	XtHeight(new_w) = XtHeight(FilePicker_Label(new_w)) > XtHeight(FilePicker_TextField(new_w)) ? XtHeight(FilePicker_Label(new_w)) : XtHeight(FilePicker_TextField(new_w));
    	XtHeight(new_w) = XtHeight(new_w) > XtHeight(FilePicker_Button(new_w)) ? XtHeight(new_w) : XtHeight(FilePicker_Button(new_w));
    }
    XtVaSetValues(FilePicker_Label(new_w),
    	XmNalignment, XmALIGNMENT_BEGINNING,
    	XmNtopAttachment, XmATTACH_FORM,
    	XmNleftAttachment, XmATTACH_FORM,
    	XmNrightAttachment, XmATTACH_WIDGET,
    	XmNrightWidget, FilePicker_TextField(new_w),
    	XmNbottomAttachment, XmATTACH_FORM,
    	NULL);
    XtVaSetValues(FilePicker_Button(new_w),
    	XmNtopAttachment, XmATTACH_FORM,
    	XmNtopOffset, (int)((XtHeight(new_w) - XtHeight(FilePicker_Button(new_w))) / 2),
    	XmNrightAttachment, XmATTACH_FORM,
    	NULL);
    XtVaSetValues(FilePicker_TextField(new_w),
    	XmNtopAttachment, XmATTACH_FORM,
    	XmNtopOffset, (int)((XtHeight(new_w) - XtHeight(FilePicker_TextField(new_w))) / 2),
    	XmNrightAttachment, XmATTACH_WIDGET,
    	XmNrightWidget, FilePicker_Button(new_w),
    	NULL);
    if (FilePicker_Value(new_w))
    {
    	XmTextFieldSetString(FilePicker_TextField(new_w), FilePicker_Value(new_w));
	XmTextFieldSetInsertionPosition(FilePicker_TextField(new_w), XmTextFieldGetLastPosition(FilePicker_TextField(new_w)));
    }
    XtManageChild(FilePicker_Label(new_w));
    XtManageChild(FilePicker_Button(new_w));
    XtManageChild(FilePicker_TextField(new_w));
    XtAddCallback(FilePicker_Button(new_w), XmNactivateCallback, (XtCallbackProc)BrowseCallback, NULL);
    /*
    XtAddCallback(new_w, XmNhelpCallback, (XtCallbackProc)Help, NULL);
    */
}
void
XawViewportSetCoordinates(Widget gw,
#if NeedWidePrototypes
	int x, int y
#else
	Position x, Position y
#endif
)
{
    ViewportWidget w = (ViewportWidget)gw;
    Widget child = w->viewport.child;

    if (x > XtWidth(child))
	x = XtWidth(child);
    else if (x < 0)
	x = XtX(child);

    if (y > XtHeight(child))
	y = XtHeight(child);
    else if (y < 0)
	y = XtY(child);

    MoveChild (w, -x, -y);
}
Пример #24
0
static void
DrawBorder(Widget widg) 
{
  XmGrabShellWidget gs = (XmGrabShellWidget)widg;
  int offset = 0;
  
  XmeDrawShadows(XtDisplay(widg), XtWindow(widg),
		 gs->grab_shell.top_shadow_GC,
		 gs->grab_shell.bottom_shadow_GC,
		 offset, offset,
		 XtWidth(widg) - 2 * offset,
		 XtHeight(widg) - 2 * offset,
		 gs->grab_shell.shadow_thickness,
		 XmSHADOW_OUT);
}
Пример #25
0
Файл: Main.c Проект: juddy/edcde
/************************************************************************
 * CenterMsgCB 
 *    - to be used with message dialogs (assumptions are being made that 
 *      parent is dialog shell, and child is bb, due to Xm hacks for them)
 *      (eg. it sets bb x,y to 0,0 and parents x,y to x,y set for bb)
 *    - parent for positioning only (may not be real parent)
 *    - use client_data for parent... if NULL, use style.errParent if ok,
 *    - or main style.shell (makes this routine more generally usefull)
 *
 ************************************************************************/
void 
CenterMsgCB(
        Widget w,
        XtPointer client_data,
        XtPointer call_data )
{
    int n;
    Position newX, newY;
    Arg args[4];
    Widget   shell;

    /* figure out what to use as "visual" parent */
    shell = (Widget)client_data;
    if (shell == NULL)
    {
        if (!style.errParent || !XtParent(style.errParent) || 
	    !XtIsManaged(style.errParent))
            shell = style.shell;
        else
            shell = XtParent(style.errParent);
    }
    else
	shell = XtParent(shell);

    /* calculate new x,y to be centered in visualParent */
    newX = XtX(shell) + XtWidth(shell)/2 - XtWidth(w)/2;
    newY = XtY(shell) + XtHeight(shell)/2 - XtHeight(w)/2;

    if (newX < 0) newX = 0;
    if (newY < 0) newY = 0;

    n = 0;
    XtSetArg(args[n], XmNx, newX); n++;
    XtSetArg(args[n], XmNy, newY); n++;
    XtSetValues(w, args, n);
}
static void
MoveChild(ViewportWidget w, int x, int y)
{
    Widget child = w->viewport.child;
    Widget clip = w->viewport.clip;

    /* make sure we never move past right/bottom borders */
    if (-x + (int)XtWidth(clip) > XtWidth(child))
	x = -(int)(XtWidth(child) - XtWidth(clip));

    if (-y + (int)XtHeight(clip) > XtHeight(child))
	y = -(int)(XtHeight(child) - XtHeight(clip));

    /* make sure we never move past left/top borders */
    if (x >= 0)
	x = 0;
    if (y >= 0)
	y = 0;

    XtMoveWidget(child, x, y);
    SendReport(w, (XawPRSliderX | XawPRSliderY));

    RedrawThumbs(w);
}
static Bool
GetGeometry(Widget w, unsigned int width, unsigned int height)
{
    XtWidgetGeometry geometry, return_geom;
    XtGeometryResult result;

    if (width == XtWidth(w) && height == XtHeight(w))
	return (False);

    geometry.request_mode = CWWidth | CWHeight;
    geometry.width = width;
    geometry.height = height;

    if (XtIsRealized(w)) {
	if (((ViewportWidget)w)->viewport.allowhoriz && width > XtWidth(w))
	    geometry.width = XtWidth(w);
	if (((ViewportWidget)w)->viewport.allowvert && height > XtHeight(w))
	    geometry.height = XtHeight(w);
    }
    else {
	/* This is the Realize call; we'll inherit a w&h iff none currently */
	if (XtWidth(w) != 0) {
	    if (XtHeight(w) != 0)
		return (False);
	    geometry.width = XtWidth(w);
	}
	if (XtHeight(w) != 0)
	    geometry.height = XtHeight(w);
    }

    result = XtMakeGeometryRequest(w, &geometry, &return_geom);
    if (result == XtGeometryAlmost)
	result = XtMakeGeometryRequest(w, &return_geom, NULL);

    return (result == XtGeometryYes);
}
Пример #28
0
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 XtGeometryResult
GeometryRequestPlusScrollbar(ViewportWidget w, Bool horizontal,
			     XtWidgetGeometry *request,
			     XtWidgetGeometry *reply_return)
{
    Widget sb;
    XtWidgetGeometry plusScrollbars;

    plusScrollbars = *request;
    if ((sb = w->viewport.horiz_bar) == NULL)
	sb = CreateScrollbar(w, horizontal);
    request->width += XtWidth(sb);
    request->height += XtHeight(sb);
    XtDestroyWidget(sb);
    return (XtMakeGeometryRequest((Widget)w, &plusScrollbars, reply_return));
}
Пример #30
0
Файл: DrawnB.c Проект: att/uwin
static void
MultiActivate(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XButtonEvent *ev = (XButtonEvent *)event;
    XmDrawnButtonCallbackStruct cbs;

    DEBUGOUT(_LtDebug(__FILE__, w, "DrawnB: MultiClick\n"));

    if (DB_MultiClick(w) == XmMULTICLICK_KEEP)
    {
	Time mctime = XtGetMultiClickTime(XtDisplay(w));

	if ((event->xbutton.time - DB_ArmTimeStamp(w)) < mctime)
	{
	    DB_ClickCount(w)++;
	}
	else
	{
	    DB_ClickCount(w) = 1;
	}

	DB_Armed(w) = False;

	if (XtIsRealized(w))
	    XtClass(w)->core_class.expose(w, event, NULL);

	if (ev->type == KeyPress || ev->type == KeyRelease ||
	    ((ev->x >= 0 && ev->x < XtWidth(w)) &&
	     (ev->y >= 0 && ev->y < XtHeight(w))))
	{
	    if (!Lab_SkipCallback(w) && DB_ActivateCallback(w))
	    {
		cbs.reason = XmCR_ACTIVATE;
		cbs.event = event;
		cbs.click_count = DB_ClickCount(w);

		XFlush(XtDisplay(w));

		XtCallCallbackList(w,
				   DB_ActivateCallback(w),
				   (XtPointer)&cbs);
	    }
	}

	Disarm(w, event, params, num_params);
    }
}