Esempio n. 1
0
/*----------------------------------------------------------------------*/
static void
Redisplay(Widget w,XEvent *event,Region region)
{
	XmCascadeButtonWidgetClass		pwc = 
		(XmCascadeButtonWidgetClass) xmCascadeButtonWidgetClass;

	if (XfeBmAccentIsEnabled())
	{
		Dimension shadow_thickness = _XfeShadowThickness(w);

		/*
		 * We change the shadow thickness to 0, so that the real Expose() 
		 * method not draw anything the shadow so that the accent lines
		 * are not disturbed.
		 */
		_XfeShadowThickness(w)		= 0;
		_XfeHighlightThickness(w)	= shadow_thickness;
		
		(*pwc->core_class.expose)(w,event,region);
		
		_XfeShadowThickness(w)		= shadow_thickness;
		_XfeHighlightThickness(w)	= 0;
	}
	else
	{
		(*pwc->core_class.expose)(w,event,region);
	}
	
	DrawPixmap(w,event,region);
}
Esempio n. 2
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));
}
Esempio n. 3
0
/*----------------------------------------------------------------------*/
static Dimension
GetHeight(Widget w)
{
	Dimension	min_height;
	Dimension	height;

	/* Compute the min possible height */
	min_height = 2 * _XfeHighlightThickness(w) + 2 * _XfeShadowThickness(w);

	/* A reasonable preferred height is needed */
	assert( _XfePreferredHeight(w) > 0 );
	assert( _XfePreferredHeight(w) >= min_height );

    /* Force the preferred height if needed */
    if (_XfeUsePreferredHeight(w) || 
		(_XfeHeight(w) == XfeDEFAULT_PREFERRED_HEIGHT) ||
		(_XfeHeight(w) <= min_height))
	{
		height = _XfePreferredHeight(w);
	}
	else
	{
		height = _XfeHeight(w);
	}

	return height;
}
Esempio n. 4
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;
}
Esempio n. 5
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));
    }
}
Esempio n. 6
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));
}
Esempio n. 7
0
/*----------------------------------------------------------------------*/
void
_XfePrimitiveDrawEverything(Widget w,XEvent * event,Region region)
{
    static XRectangle rect;

    /* Clear the buffer background if needed */
    if (_XfeBufferType(w) != XmBUFFER_NONE)
    {
		_XfePrimitiveClearBackground(w);
    }

    /* Draw Background */ 
    XfeRectSet(&rect,
			   _XfeRectX(w) - _XfeMarginLeft(w),
			   _XfeRectY(w) - _XfeMarginTop(w),
			   _XfeRectWidth(w) + _XfeMarginLeft(w) + _XfeMarginRight(w),
			   _XfeRectHeight(w) + _XfeMarginTop(w) + _XfeMarginBottom(w));
    
    _XfePrimitiveDrawBackground(w,event,region,&rect);
    
    /* Draw -or Erase the Widget's highlight if needed */
    if (_XfeHighlighted(w) && _XfeHighlightThickness(w))
    {
		_XfePrimitiveBorderHighlight(w);
    }
    else
    {
		_XfePrimitiveBorderUnhighlight(w);
    }
    
    /* Draw Shadow */ 
    _XfePrimitiveDrawShadow(w,event,region,&_XfeWidgetRect(w));
    
    /* Draw Components */ 
    _XfePrimitiveDrawComponents(w,event,region,&_XfeWidgetRect(w));
}
Esempio n. 8
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
}
Esempio n. 9
0
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
    /* Reset the configuration Flags */
    _XfeConfigFlags(nw) = XfeConfigNone;
    
    /* Reset the preparation Flags */
    _XfePrepareFlags(nw) = XfePrepareNone;
    
    /* buffer_type */
    if (_XfeBufferType(nw) != _XfeBufferType(ow))
    {
		_XfeBufferType(nw) = _XfeBufferType(ow);
	
		_XfeWarning(nw,MESSAGE7);
    }
    
    /* preferred_height */
    if (_XfePreferredHeight(nw) != _XfePreferredHeight(ow))
    {
		_XfePreferredHeight(nw) = _XfePreferredHeight(ow);
	
		_XfeWarning(nw,MESSAGE2);
    }
    
    /* preferred_width */
    if (_XfePreferredWidth(nw) != _XfePreferredWidth(ow))
    {
		_XfePreferredWidth(nw) = _XfePreferredWidth(ow);
	
		_XfeWarning(nw,MESSAGE3);
    }
    
    /* pointer_inside */
    if (_XfePointerInside(nw) != _XfePointerInside(ow))
    {
		_XfePointerInside(nw) = _XfePointerInside(ow);
	
		_XfeWarning(nw,MESSAGE4);
    }
    
    /* num_popups */
    if (_XfeNumPopups(nw) != _XfeNumPopups(ow))
    {
		_XfeNumPopups(nw) = _XfeNumPopups(ow);
	
		_XfeWarning(nw,MESSAGE5);
    }
    
    /* popup_list */
    if (_XfePopupList(nw) != _XfePopupList(ow))
    {
		_XfePopupList(nw) = _XfePopupList(ow);
	
		_XfeWarning(nw,MESSAGE6);
    }

    /* resize_width */
    if (_XfeUsePreferredWidth(nw) != _XfeUsePreferredWidth(ow))
    {
		if(_XfeUsePreferredWidth(nw))
		{
			_XfeConfigFlags(nw) |= (XfeConfigLayout|
									XfeConfigGeometry|
									XfeConfigExpose);
		}
    }

    /* resize_height */
    if (_XfeUsePreferredHeight(nw) != _XfeUsePreferredHeight(ow))
    {
		if(_XfeUsePreferredHeight(nw))
		{
			_XfeConfigFlags(nw) |= (XfeConfigLayout|
									XfeConfigGeometry|
									XfeConfigExpose);
		}
    }
    
    /* height */
    if (_XfeHeight(nw) != _XfeHeight(ow))
    {
		/* if resize_heigh is True, we dont allow width changes */
		if (_XfeUsePreferredHeight(nw)) 
		{
			_XfeHeight(nw) = _XfeHeight(ow);
		}
		else
		{
			_XfeConfigFlags(nw) |= (XfeConfigLayout|XfeConfigExpose);
		}
    }
    
    /* width */
    if (_XfeWidth(nw) != _XfeWidth(ow))
    {
		/* if resize_width is True, we dont allow width changes */
		if (_XfeUsePreferredWidth(nw)) 
		{
			_XfeWidth(nw) = _XfeWidth(ow);
		}
		else
		{
			_XfeConfigFlags(nw) |= (XfeConfigLayout|XfeConfigExpose);
		}
    }
    
    /* cursor */
    if (_XfeCursor(nw) != _XfeCursor(ow))
    {
		/* If the new cursor is good, define it */
		if (_XfeCursorGood(_XfeCursor(nw)))
		{
			XfeCursorDefine(nw,_XfeCursor(nw));
		}
		else
		{
			XfeCursorUndefine(nw);
		}
    }
    
    /* Changes that affect the layout and geometry */
    if ((_XfeHighlightThickness(nw)	!= _XfeHighlightThickness(ow)) ||
		(_XfeMarginTop(nw)		!= _XfeMarginTop(ow)) ||
		(_XfeMarginBottom(nw)		!= _XfeMarginBottom(ow)) ||
		(_XfeMarginLeft(nw)		!= _XfeMarginLeft(ow)) ||
		(_XfeMarginRight(nw)		!= _XfeMarginRight(ow)) ||       
		(_XfeShadowThickness(nw)		!= _XfeShadowThickness(ow)) ||
		(_XfeUnitType(nw)			!= _XfeUnitType(ow)))
    {
		_XfeConfigFlags(nw) |= (XfeConfigLayout|XfeConfigGeometry|XfeConfigExpose);
    }
    
    /* shadow_type */
    if (_XfeShadowType(nw) != _XfeShadowType(ow))
    {
		/* Make sure the new shadow type is ok */
		XfeRepTypeCheck(nw,XmRShadowType,&_XfeShadowType(nw),XfeDEFAULT_SHADOW_TYPE);
	
		_XfeConfigFlags(nw) |= XfeConfigExpose;
    }
    
    /* sensitive */
    if (_XfeSensitive(nw) != _XfeSensitive(ow))
    {
		_XfeConfigFlags(nw) |= XfeConfigExpose;
    }

    /* pretend_sensitive */
    if (_XfeIsSensitive(nw) != _XfeIsSensitive(ow))
    {
		_XfeConfigFlags(nw) |= XfeConfigExpose;
    }
    
    /* background_pixel or background_pixmap */
    if (((_XfeBackgroundPixel(nw) != _XfeBackgroundPixel(ow)) ||
		 (_XfeBackgroundPixmap(nw) != _XfeBackgroundPixmap(ow))) &&
		(_XfeBufferType(nw) != XmBUFFER_NONE))
    {
		/* Release the old background GC */
		_XfePrimitiveReleaseBackgroundGC(nw);
		
		/* Allocate the new background GC */
		_XfePrimitiveAllocateBackgroundGC(nw);
    }
	
    return _XfePrimitiveChainSetValues(ow,rw,nw,xfePrimitiveWidgetClass);
}