Example #1
0
/*----------------------------------------------------------------------*/
void
_XfePrimitiveReleaseBackgroundGC(Widget w)
{
	/* Make sure the gc has been allocated */
	if (!_XfeBackgroundGC(w))
	{
		return;
	}

    /* Free the background gc */
    XtReleaseGC(w,_XfeBackgroundGC(w));
}
Example #2
0
/*----------------------------------------------------------------------*/
void
_XfePrimitiveAllocateBackgroundGC(Widget w)
{
	/* Make sure the background gc gets allocated only once */
	if (_XfeBackgroundGC(w))
	{
		return;
	}

	if (_XfePixmapGood(_XfeBackgroundPixmap(w)))
	{
		_XfeBackgroundGC(w) = XfeAllocateTileGc(w,_XfeBackgroundPixmap(w));
	}
	else
	{
		_XfeBackgroundGC(w) = XfeAllocateColorGc(w,_XfeBackgroundPixel(w),
												 None,True);
	}
}
Example #3
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));
}
Example #4
0
/*----------------------------------------------------------------------*/
static void
Destroy(Widget w)
{
    /* Remove all CallBacks */
    /* XtRemoveAllCallbacks(w,XmNenterCallback); */
    /* XtRemoveAllCallbacks(w,XmNfocusCallback); */
    /* XtRemoveAllCallbacks(w,XmNleaveCallback); */
    /* XtRemoveAllCallbacks(w,XmNresizeCallback); */
	
    /* Free or release a possible buffer */
    BufferFree(w);

    /* Free background gc if needed */
    if (_XfeBackgroundGC(w))
    {
		_XfePrimitiveReleaseBackgroundGC(w);
    }
}
Example #5
0
/*----------------------------------------------------------------------*/
static void
Initialize(Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
    /* Make sure the shadow is ok */
    XfeRepTypeCheck(nw,XmRShadowType,&_XfeShadowType(nw),XfeDEFAULT_SHADOW_TYPE);
    
    /* Make sure the buffer is ok */
    XfeRepTypeCheck(nw,XmRBufferType,&_XfeBufferType(nw),XfeDEFAULT_BUFFER_TYPE);

    /* Initialize private members */
    _XfeBufferPixmap(nw) = XmUNSPECIFIED_PIXMAP;
    _XfeBackgroundGC(nw) = NULL;

    /* Allocate the background gc if needed */
    if (_XfeBufferType(nw) != XmBUFFER_NONE)
    {
		_XfePrimitiveAllocateBackgroundGC(nw);
    }

	/* Finish initialization */
	_XfePrimitiveChainInitialize(rw,nw,xfePrimitiveWidgetClass);
}
Example #6
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));
    }
}
Example #7
0
/*----------------------------------------------------------------------*/
static void
DrawArrow(Widget w,XEvent *event,Region region,XRectangle * clip_rect)
{
    XfeArrowPart *		ap = _XfeArrowPart(w);
    XfeButtonPart *		bp = _XfeButtonPart(w);
    Dimension			width = XfeMin(ap->arrow_width,_XfeRectWidth(w));
    Dimension			height = XfeMin(ap->arrow_height,_XfeRectHeight(w));
    Position			x = (_XfeWidth(w) - width) / 2;
    Position			y = (_XfeHeight(w) - height) / 2;

    /* Draw the arrow as an XmArrowButton would */
    if (bp->emulate_motif)
    {
        GC gc = _XfeBackgroundGC(w);

        if (bp->raised)
        {
            if (bp->raise_on_enter && bp->raised)
            {
                gc = bp->label_raised_GC;
            }
        }
        else if (bp->armed)
        {
            if (bp->fill_on_arm && bp->armed)
            {
                gc = bp->armed_GC;
            }
        }

        XfeDrawMotifArrow(XtDisplay(w),
                          _XfePrimitiveDrawable(w),
                          _XfeTopShadowGC(w),
                          _XfeBottomShadowGC(w),
                          gc,
                          x,
                          y,
                          width,
                          height,
                          ap->arrow_direction,
                          2, /* hard coded to be compatible with Motif */
                          bp->armed);
    }
    /* Draw the arrow as an XfeButton would */
    else
    {
#if 1
        XfeDrawArrow(XtDisplay(w),
                     _XfePrimitiveDrawable(w),
                     ARROW_GC(w,ap),
                     x,y,
                     width,height,
                     ap->arrow_direction);
#else
        XfeDrawMotifArrow(XtDisplay(w),
                          _XfePrimitiveDrawable(w),
                          NULL,
                          NULL,
                          ARROW_GC(w,ap),
                          x,y,
                          width,height,
                          ap->arrow_direction,
                          0,
                          False);
#endif
    }
}