Пример #1
0
/*----------------------------------------------------------------------*/
static void
LayoutTitle(Widget w)
{
    XfeFancyBoxPart *	fp = _XfeFancyBoxPart(w);
    XfeComboBoxPart *	cp = _XfeComboBoxPart(w);
	int					x;
	int					total_icon_width = 0;

	if (_XfeIsAlive(fp->icon))
	{
		x = _XfeX(fp->icon) + _XfeWidth(fp->icon);

		total_icon_width = _XfeWidth(fp->icon) + cp->spacing;
	}
	else
	{
		x = CB_OFFSET_LEFT(w,cp) + cp->title_shadow_thickness;
	}

	_XfeConfigureWidget(cp->title,

						x,

						(_XfeHeight(w) - _XfeHeight(cp->title)) / 2,
						
						CB_RECT_WIDTH(w,cp) - 
						cp->spacing -
						_XfeWidth(cp->arrow) -
						total_icon_width -
						2 * cp->title_shadow_thickness,
						
						CB_RECT_HEIGHT(w,cp) - 
						2 * cp->title_shadow_thickness);
}
Пример #2
0
static Dimension
GetWidth(Widget w)
{
	Dimension	min_width;
	Dimension	width;

	/* Compute the min possible width */
	min_width = 2 * _XfeHighlightThickness(w) + 2 * _XfeShadowThickness(w);

	/* A reasonable preferred width is needed */
	assert( _XfePreferredWidth(w) > 0 );
	assert( _XfePreferredWidth(w) >= min_width );

    /* Force the preferred width if needed */
    if (_XfeUsePreferredWidth(w) || 
		(_XfeWidth(w) == XfeDEFAULT_PREFERRED_WIDTH) ||
		(_XfeWidth(w) <= min_width))
	{
		width = _XfePreferredWidth(w);
	}
	else
	{
		width = _XfeWidth(w);
	}

	return width;
}
Пример #3
0
/*----------------------------------------------------------------------*/
/* extern */ Dimension
XfeVaGetWidestWidget(Widget widget, ...)
{
	va_list		vargs;
	Widget		current;
	Dimension	width;
	Dimension	widest_width;

	/*
	 * Get the first widget's width
	 * (because of the way var args works
	 *  we have to start the loop at the second widget)
	 */
	widest_width = _XfeWidth(widget);

	/*
	 * Get the widest width
	 */
	va_start (vargs, widget);

	while ((current = va_arg (vargs, Widget))) 
	{
		width = _XfeWidth(current);

		if (width > widest_width)
		{
			widest_width = width;
		}
	}

	va_end (vargs);

	return widest_width;
}
Пример #4
0
/*----------------------------------------------------------------------*/
static void
DrawHighlight(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
    XfeComboBoxPart *	cp = _XfeComboBoxPart(w);

	/* Make sure the highlight is needed */
	if (!cp->highlight_thickness || !_XfeIsRealized(w))
	{
		return;
	}

	if (cp->highlighted)
	{
		_XmDrawSimpleHighlight(XtDisplay(w),
							   _XfeWindow(w), 
							   _XfemHighlightGC(w),
							   0,0, 
							   _XfeWidth(w),_XfeHeight(w),
							   cp->highlight_thickness);
	}
	else
	{
		assert( XmIsManager(_XfeParent(w)) );

		_XmDrawSimpleHighlight(XtDisplay(w),
							   _XfeWindow(w), 
							   _XfemBackgroundGC(_XfeParent(w)),
							   0,0, 
							   _XfeWidth(w),_XfeHeight(w),
							   cp->highlight_thickness);
	}
}
Пример #5
0
/*----------------------------------------------------------------------*/
/* extern */ Dimension
_XfeWidthCenter(Widget one,Widget two)
{
	assert( one != NULL );
	assert( _XfeIsAlive(one) );
	assert( two != NULL );
	assert( _XfeIsAlive(two) );

	return
		(_XfeWidth(one) > _XfeWidth(two)) ? 
		((_XfeWidth(one) - _XfeWidth(two)) / 2) :
		0;
}
Пример #6
0
/*----------------------------------------------------------------------*/
static void
AccentBottom(Widget			w,
			 GC				top_gc,
			 GC				bottom_gc,
			 Dimension		offset_left,
			 Dimension		offset_right,
			 Dimension		shadow_thickness,
			 Dimension		accent_thickness,
			 int			code)
{
	Widget		pw = _XfeParent(w);
	int			position_index = XfeMenuItemPositionIndex(w);
	Cardinal	num_children = _XfemNumChildren(pw);
	Position	x;
	Position	y;
	Dimension	width;
	Dimension	height = 2 * shadow_thickness + accent_thickness;

	assert( code == ACCENT_DRAW || code == ACCENT_ERASE );

	/* Last item */
	if (position_index == (num_children - 1))
	{
		x = _XfeX(w) + offset_left;
		y = _XfeY(w) + _XfeHeight(w) - height;
		
		width = _XfeWidth(w) - offset_left - offset_right;
	}
	/* Any other item */
	else
	{
		x = _XfeX(w) + offset_left;
		y = _XfeY(w) + _XfeHeight(w) - height / 2;
		
		width = _XfeWidth(w) - offset_left - offset_right;
	}

	if (code == ACCENT_DRAW)
	{
		/* Draw accent */
		_XmDrawShadows(XtDisplay(pw),_XfeWindow(pw),top_gc,bottom_gc,
					   x,y,width,height,shadow_thickness,XmSHADOW_IN);
	}
	else
	{
		/* Erase accent */
		XfeDrawRectangle(XtDisplay(pw),_XfeWindow(pw),top_gc,
						 x,y,width,height,shadow_thickness);
	}
}
Пример #7
0
/*----------------------------------------------------------------------*/
static XtGeometryResult
QueryGeometry(Widget w,XtWidgetGeometry	*req,XtWidgetGeometry *reply)
{
	assert( req != NULL );
	assert( reply != NULL );

	reply->request_mode	= CWWidth | CWHeight;

	/* Set the reply dimensions */
	reply->width  = GetWidth(w);

	reply->height = GetHeight(w);

	/* XtGeometryYes: Request matches Prefered Geometry. */
	if (((req->request_mode & CWWidth) && (req->width == reply->width)) &&
		((req->request_mode & CWHeight) && (req->height == reply->height)))
	{
		return XtGeometryYes;
	}
   
	/* XtGeometryNo: Reply matches current Geometry. */
	if ((reply->width == _XfeWidth(w)) && (reply->height == _XfeHeight(w)))
	{
		return XtGeometryNo; 
	}
   
	/* XtGeometryAlmost: One of reply fields doesn't match cur/req Geometry. */
	return XtGeometryAlmost; 
}
Пример #8
0
/*----------------------------------------------------------------------*/
/* extern */ Widget
XfeBiggestWidget(Boolean horizontal,WidgetList widgets,Cardinal n)
{
	Dimension		biggest_dim = 0;
	Dimension		dim;
	Widget			max_widget = NULL;
	Widget			widget;
	Cardinal		i;

	assert( widgets != NULL );
	
	if (!widgets)
	{
		return NULL;
	}

	for (i = 0; i < n; i++) 
	{
		widget = widgets[i];

		assert( _XfeIsAlive(widget) );

		dim = (horizontal ? _XfeWidth(widget) : _XfeHeight(widget));

		if (dim > biggest_dim) 
		{
			biggest_dim = dim;
			max_widget = widget;
		}
	}
	
	return max_widget;
}
Пример #9
0
/*----------------------------------------------------------------------*/
/* extern */ void
_XfeConfigureOrHideWidget(Widget w,int x,int y,int width,int height)
{
	assert( _XfeIsAlive(w) );

	/* Make sure the widget is alive */
	if (!_XfeIsAlive(w))
	{
		return;
	}

	/* Make sure the positions and dimensions are different */
	if ((_XfeX(w) == x) && (_XfeY(w) == y) && 
		(_XfeWidth(w) == width) && (_XfeHeight(w) == height))
	{
		return;
	}

	/* Hide the widget if its dimensions are less thanb zero */
	if (!width || !height)
	{
		_XfeSetMappedWhenManaged(w,False);

		return;
	}

	_XfeConfigureWidget(w,x,y,width,height);

	/* Show the widget */
	_XfeSetMappedWhenManaged(w,True);
}
Пример #10
0
/*----------------------------------------------------------------------*/
/* extern */ void
_XfeResizeWidget(Widget w,int width,int height)
{
    assert( _XfeIsAlive(w) );

#if 0
	printf("_XfeResizeWidget(%s,%d,%d)\n",XtName(w),width,height);
#endif

#if 0
	assert( width > 0 );
	assert( height > 0 );
#endif

	/* Ignore this request if width or height are 0 */
	if (!width || !height)
	{
		return;
	}

	/* Make sure the dimension are different */
	if ((_XfeWidth(w) == width) && (_XfeHeight(w) == height))
	{
		return;
	}

	_XfeConfigureWidget(w,_XfeX(w),_XfeY(w),width,height);
}
Пример #11
0
/*----------------------------------------------------------------------*/
/* extern */ void
XfeDrawShadowsAroundWidget(Widget			parent,
						   Widget			child,
						   GC				top_gc,
						   GC				bottom_gc,
						   Dimension		offset,
						   Dimension		shadow_thickness,
						   unsigned char	shadow_type)
{
	assert( _XfeIsAlive(parent) );
	assert( _XfeIsAlive(child) );
	assert( shadow_thickness > 0 );
	assert( XmIsManager(parent) );

	_XmDrawShadows(XtDisplay(parent),
				   _XfeWindow(parent),
				   _XfemTopShadowGC(parent),
				   _XfemBottomShadowGC(parent),
				   _XfeX(child) - shadow_thickness - offset,
				   _XfeY(child) - shadow_thickness - offset,
				   _XfeWidth(child) + 2 * shadow_thickness + 2 * offset,
				   _XfeHeight(child) + 2 * shadow_thickness + 2 * offset,
				   shadow_thickness,
				   shadow_type);
}
Пример #12
0
/*----------------------------------------------------------------------*/
static void
PreferredGeometry(Widget w,Dimension * width,Dimension * height)
{
    XfeComboBoxPart *		cp = _XfeComboBoxPart(w);
	
	*height = 
		CB_OFFSET_TOP(w,cp)  + CB_OFFSET_BOTTOM(w,cp) +
		XfeMax(_XfeHeight(cp->title),_XfeHeight(cp->arrow)) +
		2 * cp->title_shadow_thickness;

	*width  = 
		CB_OFFSET_LEFT(w,cp) + CB_OFFSET_RIGHT(w,cp) + 
		_XfeWidth(cp->title) +
		cp->spacing +
		_XfeWidth(cp->arrow) +
		2 * cp->title_shadow_thickness;
}
Пример #13
0
/*----------------------------------------------------------------------*/
static void
LayoutArrow(Widget w)
{
    XfeComboBoxPart *	cp = _XfeComboBoxPart(w);

	_XfeConfigureWidget(cp->arrow,

						_XfeWidth(w) - 
						CB_OFFSET_RIGHT(w,cp) - 
						_XfeWidth(cp->arrow),

						(_XfeHeight(w) - _XfeHeight(cp->arrow)) / 2,

						_XfeWidth(cp->arrow),

						_XfeHeight(cp->arrow));
}
Пример #14
0
/*----------------------------------------------------------------------*/
/* extern */ Dimension
XfeWidth(Widget w)
{
    assert( w != NULL );

#if DEBUG_DIMENSIONS
	{
		Dimension width;

		XtVaGetValues(w,XmNwidth,&width,NULL);

		assert( width == _XfeWidth(w) );
	}
#endif
    
    return _XfeWidth(w);
}
Пример #15
0
/*----------------------------------------------------------------------*/
static void
ActionPopup(Widget item,XEvent * event,char ** params,Cardinal * nparams)
{
	Widget				w = XfeIsComboBox(item) ? item : _XfeParent(item);
    XfeComboBoxPart *	cp = _XfeComboBoxPart(w);
	int					space_below = ScreenGetSpaceBelow(w);
	int					space_above = ScreenGetSpaceAbove(w);

#if 1
	printf("ActionPopup(%s,above = %d,below = %d)\n",
		   XtName(w),
		   space_above,
		   space_below);
#endif

	/* Check if we are already popped up */
	if (cp->popped_up)
	{
		printf("already popped up\n");

		StickRemoveTimeout(w);

		ListUnmanage(w);
		
		XtVaSetValues(cp->arrow,XmNarmed,False,NULL);

		return;
	}

	space_below = 200;

  	_XfeConfigureWidget(cp->shell,
						XfeRootX(w),
						XfeRootY(w) + _XfeHeight(w),
						_XfeWidth(w),
						space_below);

/*   	XtVaSetValues(cp->list, */
/* 				  XmNlistMarginWidth, 100, */
/* 				  NULL); */

/* 	XtVaSetValues(cp->arrow,XmCArmed,True,NULL); */

/* 	XtPopup(cp->shell,XtGrabNone); */
/* 	XMapRaised(XtDisplay(w),_XfeWindow(cp->shell)); */
/* 	XMapRaised(XtDisplay(w),_XfeWindow(cp->shell)); */

 	cp->remain_popped_up = False;

#if 1
	StickAddTimeout(w);
#endif

 	XtVaSetValues(cp->arrow,XmNarmed,True,NULL);

	ListManage(w);
}
Пример #16
0
/*----------------------------------------------------------------------*/
/* extern */ void
_XfePreferredGeometry(Widget w,Dimension *width_out,Dimension *height_out)
{
	Dimension width;
	Dimension height;

    assert( _XfeIsAlive(w) );

	if (XfeIsPrimitive(w))
	{
		width  = _XfePreferredWidth(w);
		height = _XfePreferredHeight(w);
	}
	else if (XfeIsManager(w))
	{
		width  = _XfemPreferredWidth(w);
		height = _XfemPreferredHeight(w);
	}
	else
	{
		XtWidgetGeometry reply;

		XtQueryGeometry(w,NULL,&reply);

		if (reply.request_mode & CWWidth)
		{
			width = reply.width;
		}
		else
		{
			width = _XfeWidth(w);
		}


		if (reply.request_mode & CWHeight)
		{
			height = reply.height;
		}
		else
		{
			height = _XfeHeight(w);
		}
	}

	if (width_out)
	{
		*width_out = width;
	}

	if (height_out)
	{
		*height_out = height;
	}
}
Пример #17
0
/*----------------------------------------------------------------------*/
void
_XfePrimitiveDrawBuffer(Widget w,XEvent * event,Region region)
{
    XCopyArea(XtDisplay(w),
			  _XfePrimitiveDrawable(w),
			  _XfeWindow(w),
			  _XfeBackgroundGC(w),
			  _XfeHighlightThickness(w),_XfeHighlightThickness(w),
			  _XfeWidth(w) - 2 * _XfeHighlightThickness(w),
			  _XfeHeight(w) - 2 * _XfeHighlightThickness(w),
			  _XfeHighlightThickness(w),_XfeHighlightThickness(w));
}
Пример #18
0
/*----------------------------------------------------------------------*/
static void
BufferAllocate(Widget w)
{
    assert( _XfeBufferType(w) != XmBUFFER_NONE );

    switch(_XfeBufferType(w))
    {
		/* Single buffer: allocate a buffer big enough for widget */
    case XmBUFFER_PRIVATE:

		_XfeBufferPixmap(w) = XCreatePixmap(XtDisplay(w),
											DefaultRootWindow(XtDisplay(w)),
											_XfeWidth(w),
											_XfeHeight(w),
											_XfeDepth(w));


#if 0
		printf("%s: Allocating a private buffer at (%d,%d)\n",
			   XtName(w),
			   _XfeWidth(w),_XfeHeight(w));
#endif

		break;

		/* Multiple buffer: ask the buffer manager for a buffer */
    case XmBUFFER_SHARED:

#if 0
		printf("%s: Allocating a shared buffer at (%d,%d)\n",
			   XtName(w),
			   _XfeWidth(w),_XfeHeight(w));
#endif

		_XfeBufferPixmap(w) = _XfePixmapBufferAllocate(w);

		break;
    }

}
Пример #19
0
/*----------------------------------------------------------------------*/
static void
UpdateRect(Widget w)
{
	/* Assign the rect coordinates */
	XfeRectSet(&_XfeWidgetRect(w),
			   
			   _XfeOffsetLeft(w),
			   
			   _XfeOffsetTop(w),
			   
			   _XfeWidth(w) - _XfeOffsetLeft(w) - _XfeOffsetRight(w),
			   
			   _XfeHeight(w) - _XfeOffsetTop(w) - _XfeOffsetBottom(w));
}
Пример #20
0
/*----------------------------------------------------------------------*/
void
_XfePrimitiveClearBackground(Widget w)
{
    /* Clear the widget background including margins */
    if (_XfeBufferType(w) == XmBUFFER_NONE)
    {
		XClearArea(XtDisplay(w),_XfeWindow(w),
				   _XfeHighlightThickness(w),_XfeHighlightThickness(w),
				   _XfeWidth(w) - 2 * _XfeHighlightThickness(w),
				   _XfeHeight(w) - 2 * _XfeHighlightThickness(w),
				   False);

		/*XClearWindow(XtDisplay(w),_XfeWindow(w));*/
    }
    else
    {
		XFillRectangle(XtDisplay(w),
					   _XfePrimitiveDrawable(w),
					   _XfeBackgroundGC(w),
					   0,0,
					   _XfeWidth(w),_XfeHeight(w));
    }
}
Пример #21
0
/*----------------------------------------------------------------------*/
static void
DrawShadow(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
    /* Draw the shadow */
    _XmDrawShadows(XtDisplay(w),
				   _XfePrimitiveDrawable(w),
				   _XfeTopShadowGC(w),_XfeBottomShadowGC(w),
				   _XfeHighlightThickness(w),
				   _XfeHighlightThickness(w),
				   _XfeWidth(w) - 2 * _XfeHighlightThickness(w),
				   _XfeHeight(w) - 2 * _XfeHighlightThickness(w),
				   _XfeShadowThickness(w),
				   _XfeShadowType(w));
}
Пример #22
0
/*----------------------------------------------------------------------*/
static void
DrawBackground(Widget w,XEvent *event,Region region,XRectangle * clip_rect)
{
    XfeArrowPart *	ap = _XfeArrowPart(w);
    XfeButtonPart *	bp = _XfeButtonPart(w);

    if (bp->emulate_motif)
    {
        return;
    }

#if 0
    (*xfeButtonClassRec.xfe_primitive_class.draw_background)(w,
            event,
            region,
            clip_rect);
#else
    /* Fill the background if needed */
    if (bp->fill_on_arm && bp->armed)
    {
        XFillRectangle(XtDisplay(w),
                       _XfePrimitiveDrawable(w),
                       bp->armed_GC,
                       0,0,
                       _XfeWidth(w),_XfeHeight(w));
    }
    else if (bp->fill_on_enter && (bp->raised || _XfePointerInside(w)))
    {
        XFillRectangle(XtDisplay(w),
                       _XfePrimitiveDrawable(w),
                       bp->label_raised_GC,
                       0,0,
                       _XfeWidth(w),_XfeHeight(w));
    }
#endif
}
Пример #23
0
/*----------------------------------------------------------------------*/
static void
Resize(Widget w)
{
	/*printf("%s: Resize to (%d,%d)\n",XtName(w),_XfeWidth(w),_XfeHeight(w));*/

    /* Obtain the Prefered Geometry */
    _XfePrimitivePreferredGeometry(w,
								   &_XfePreferredWidth(w),
								   &_XfePreferredHeight(w));
    
    /* Force the preferred dimensions if required */
    if (_XfeUsePreferredWidth(w))
    {
		_XfeWidth(w) = _XfePreferredWidth(w);
    }
    
    if (_XfeUsePreferredHeight(w))
    {
		_XfeHeight(w) = _XfePreferredHeight(w);
    }
    
    /* Update the widget rect */
    _XfePrimitiveUpdateRect(w);
    
    /* Layout the components */
    _XfePrimitiveLayoutComponents(w);
    
    switch(_XfeBufferType(w))
    {
		/* No buffer: nothing */
    case XmBUFFER_NONE:
		break;
	
		/* Single buffer: update the buffer size and contents */
    case XmBUFFER_PRIVATE:
		BufferUpdate(w);
		_XfePrimitiveDrawEverything(w,NULL,NULL);
		break;
	
	/* Multiple buffer: update the buffer size only */
    case XmBUFFER_SHARED:
		BufferUpdate(w);
		break;
    }
    
    /* Invoke Resize Callbacks */
    _XfeInvokeCallbacks(w,_XfeResizeCallbacks(w),XmCR_RESIZE,NULL,True);
}
Пример #24
0
/*----------------------------------------------------------------------*/
static void
DrawTitleShadow(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
    XfeFancyBoxPart *	fp = _XfeFancyBoxPart(w);
    XfeComboBoxPart *	cp = _XfeComboBoxPart(w);

	/* Make sure the shadow is needed */
	if (!cp->title_shadow_thickness)
	{
		return;
	}

	if (_XfeIsAlive(fp->icon))
	{
		Dimension icon_x1 = _XfeX(fp->icon) - cp->spacing;
		Dimension title_x2 = _XfeX(cp->title) + _XfeWidth(cp->title);

		/* Draw the shadow around the icon and text */
		_XmDrawShadows(XtDisplay(w),
					   _XfeWindow(w),
					   _XfemTopShadowGC(w),_XfemBottomShadowGC(w),
					   
					   CB_OFFSET_LEFT(w,cp),
					   
					   _XfeY(cp->title) - 
					   cp->title_shadow_thickness,

					   (title_x2 - icon_x1) + 
					   2 * cp->title_shadow_thickness,
					   
					   _XfeHeight(cp->title) + 
					   2 * cp->title_shadow_thickness,
					   
					   cp->title_shadow_thickness,
					   cp->title_shadow_type);
	}
	else
	{
		/* Draw the shadow around the text only */
		XfeDrawShadowsAroundWidget(w,
								   cp->title,
								   _XfemTopShadowGC(w),
								   _XfemBottomShadowGC(w),
								   0,
								   cp->title_shadow_thickness,
								   cp->title_shadow_type);
	}
}
Пример #25
0
/*----------------------------------------------------------------------*/
static void
InitializePostHook(Widget rw,Widget nw)
{
    /* Set preparation flag so that all components get prepared */
    _XfePrepareFlags(nw) = XfePrepareAll;
    
    /* Prepare the Widget */
    _XfePrimitivePrepareComponents(nw,_XfePrepareFlags(nw));

    /* Obtain the preferred dimensions for the first time. */
    _XfePrimitivePreferredGeometry(nw,
								   &_XfePreferredWidth(nw),
								   &_XfePreferredHeight(nw));

	/* Set the new dimensions */
	_XfeWidth(nw)  = GetWidth(nw);

	_XfeHeight(nw) = GetHeight(nw);

    /* Update the widget rect */
    _XfePrimitiveUpdateRect(nw);
    
    /* Layout the Widget */
    _XfePrimitiveLayoutComponents(nw);
    
    switch(_XfeBufferType(nw))
    {
		/* No buffer: nothing */
    case XmBUFFER_NONE:
		break;
	
		/* Single buffer: update the buffer size and contents */
    case XmBUFFER_PRIVATE:
		BufferUpdate(nw);
		_XfePrimitiveDrawEverything(nw,NULL,NULL);
		break;
	
	/* Multiple buffer: update the buffer size only */
    case XmBUFFER_SHARED:
		BufferUpdate(nw);
		break;
    }
    
    /* Dont need to prepare components any more */
    _XfePrepareFlags(nw) = XfePrepareNone;
}
Пример #26
0
/*----------------------------------------------------------------------*/
static void
PreferredGeometry(Widget w,Dimension * width,Dimension * height)
{
    XfeFancyBoxPart *		fp = _XfeFancyBoxPart(w);
    XfeComboBoxPart *		cp = _XfeComboBoxPart(w);

	/* Invoke the super class' preferred_geometry method */
	(*xfeComboBoxClassRec.xfe_manager_class.preferred_geometry)(w,
																width,
																height);

	/* Add the icon widht if needed */
	if (_XfeChildIsShown(fp->icon))
	{
		*width  += (cp->spacing + _XfeWidth(fp->icon));
	}
}
Пример #27
0
/*----------------------------------------------------------------------*/
static void
LayoutTitle(Widget w)
{
    XfeComboBoxPart *	cp = _XfeComboBoxPart(w);

	_XfeConfigureWidget(cp->title,

						CB_OFFSET_LEFT(w,cp) + cp->title_shadow_thickness,

						(_XfeHeight(w) - _XfeHeight(cp->title)) / 2,
						
						CB_RECT_WIDTH(w,cp) - 
						cp->spacing -
						_XfeWidth(cp->arrow) -
						2 * cp->title_shadow_thickness,
						
						CB_RECT_HEIGHT(w,cp) - 
						2 * cp->title_shadow_thickness);
}
Пример #28
0
/*----------------------------------------------------------------------*/
static void
DrawShadow(Widget w,XEvent * event,Region region,XRectangle * clip_rect)
{
    XfeComboBoxPart *	cp = _XfeComboBoxPart(w);

	if (!_XfemShadowThickness(w))
 	{
 		return;
 	}

    /* Draw the shadow */
    _XmDrawShadows(XtDisplay(w),
				   _XfeWindow(w),
				   _XfemTopShadowGC(w),_XfemBottomShadowGC(w),
				   cp->highlight_thickness,
				   cp->highlight_thickness,
				   _XfeWidth(w) - 2 * cp->highlight_thickness,
				   _XfeHeight(w) - 2 * cp->highlight_thickness,
				   _XfemShadowThickness(w),
				   _XfemShadowType(w));
}
Пример #29
0
/*----------------------------------------------------------------------*/
static void
IconLayout(Widget w)
{
    XfeFancyBoxPart *	fp = _XfeFancyBoxPart(w);
    XfeComboBoxPart *	cp = _XfeComboBoxPart(w);

	if (!_XfeIsAlive(fp->icon))
	{
		return;
	}

	_XfeConfigureWidget(fp->icon,

						CB_OFFSET_LEFT(w,cp) + 
						cp->title_shadow_thickness +
						cp->spacing,

						(_XfeHeight(w) - _XfeHeight(fp->icon)) / 2,

						_XfeWidth(fp->icon),

						_XfeHeight(fp->icon));
}
Пример #30
0
/*----------------------------------------------------------------------*/
static void
AccentAll(Widget			w,
		  GC				top_gc,
		  GC				bottom_gc,
		  Dimension			offset_left,
		  Dimension			offset_right,
		  Dimension			shadow_thickness,
		  Dimension			accent_thickness,
		  int				code)
{
#if 1	
	if (code == ACCENT_DRAW)
	{
		/* Draw accent */
		_XmDrawShadows(XtDisplay(w),_XfeWindow(w),
					   top_gc,bottom_gc,
					   _XfeHighlightThickness(w),
					   _XfeHighlightThickness(w),
					   _XfeWidth(w) - 2 * _XfeHighlightThickness(w),
					   _XfeHeight(w) - 2 * _XfeHighlightThickness(w),
					   _XfeShadowThickness(w),
					   XmSHADOW_OUT);
	}
	else
	{
		/* Erase accent */
		XfeDrawRectangle(XtDisplay(w),_XfeWindow(w),top_gc,
						 _XfeHighlightThickness(w),
						 _XfeHighlightThickness(w),
						 _XfeWidth(w) - 2 * _XfeHighlightThickness(w),
						 _XfeHeight(w) - 2 * _XfeHighlightThickness(w),
						 _XfeShadowThickness(w));
	}
#else
	Widget		pw = _XfeParent(w);
	int			position_index = XfeMenuItemPositionIndex(w);
	Cardinal	num_children = _XfemNumChildren(pw);
	Position	x;
	Position	y;
	Dimension	width;
	Dimension	height;
	Dimension	total_thickness = shadow_thickness + accent_thickness;

	assert( code == ACCENT_DRAW || code == ACCENT_ERASE );

	/* One and only */
	if (num_children == 1)
	{
		x = _XfeX(w) + offset_left;
		y = _XfeY(w);

		width = _XfeWidth(w) - offset_left - offset_right;
		height = _XfeHeight(w);
	}
	else
	{
		Dimension overlap = (2 * shadow_thickness + accent_thickness) / 2;

		/* First item */
		if (position_index == 0)
		{
			x = _XfeX(w) + offset_left;
			y = _XfeY(w);
			
			width = _XfeWidth(w) - offset_left - offset_right;

			height = _XfeHeight(w) + overlap;
		}
		/* Last item */
		else if (position_index == (num_children - 1))
		{
			x = _XfeX(w) + offset_left;
			y = _XfeY(w) - overlap;
			
			width = _XfeWidth(w) - offset_left - offset_right;

			height = _XfeHeight(w) + overlap;
		}
		/* In between two others */
		else
		{
			x = _XfeX(w) + offset_left;
			y = _XfeY(w) - overlap;
			
			width = _XfeWidth(w) - offset_left - offset_right;

			height = _XfeHeight(w) + 2 * total_thickness;
		}
	}

	if (code == ACCENT_DRAW)
	{
		/* Draw accent */
		_XmDrawShadows(XtDisplay(pw),_XfeWindow(pw),top_gc,bottom_gc,
				   x,y,width,height,shadow_thickness,XmSHADOW_IN);
		
		x += total_thickness;
		y += total_thickness;
		
		width -= (2 * total_thickness);
		height -= (2 * total_thickness);
				   
		_XmDrawShadows(XtDisplay(pw),_XfeWindow(pw),top_gc,bottom_gc,
					   x,y,width,height,shadow_thickness,XmSHADOW_OUT);
	}
	else
	{
		/* Erase accent */
		XfeDrawRectangle(XtDisplay(pw),_XfeWindow(pw),top_gc,
						 x,y,width,height,shadow_thickness);
		
		x += total_thickness;
		y += total_thickness;
		
		width -= (2 * total_thickness);
		height -= (2 * total_thickness);
				   
		XfeDrawRectangle(XtDisplay(pw),_XfeWindow(pw),top_gc,
						 x,y,width,height,shadow_thickness);
	}
#endif
}