Example #1
0
/*----------------------------------------------------------------------*/
static void
BufferFree(Widget w)
{
    /*if (_XfeBufferType(w) != XmBUFFER_NONE );*/

    switch(_XfeBufferType(w))
    {
		/* Single buffer: Free the buffer pixmap only if needed */
    case XmBUFFER_PRIVATE:

		if (_XfePixmapGood(_XfeBufferPixmap(w)))
		{
			XFreePixmap(XtDisplay(w),_XfeBufferPixmap(w));
		}

		break;

		/* Multiple buffer: release the shared buffer */
    case XmBUFFER_SHARED:

		/*_XfePixmapBufferRelease(w,_XfeBufferPixmap(w));*/

		break;

		/* Nothing */
    case XmBUFFER_NONE:
		break;
    }
}
Example #2
0
/*----------------------------------------------------------------------*/
static Boolean
SetValues(Widget ow,Widget rw,Widget nw,ArgList args,Cardinal *nargs)
{
	Boolean					redisplay = False;
	Boolean					resize = False;
 	XmCascadeButtonPart *	old_cp = _XfeXmCascadeButtonPart(ow);
 	XmCascadeButtonPart *	new_cp = _XfeXmCascadeButtonPart(nw);
	XmLabelPart *			old_lp = _XfeXmLabelPart(ow);
	XmLabelPart *			new_lp = _XfeXmLabelPart(nw);
    XfeBmCascadePart *		new_bmc = _XfeBmCascadePart(nw);
    XfeBmCascadePart *		old_bmc = _XfeBmCascadePart(ow);

	/* accent_type */
	if (new_bmc->accent_type != old_bmc->accent_type)
	{
		new_bmc->accent_type = old_bmc->accent_type;

		_XfeWarning(nw,MESSAGE2);
	}

	/* label_pixmap */
	if (new_lp->pixmap != old_lp->pixmap)
	{
		_XfePixmapPrepare(nw,&new_lp->pixmap,
						  &new_bmc->pixmap_width,
						  &new_bmc->pixmap_height,
						  XmNlabelPixmap);

		redisplay = True;
		resize = True;
	}

	/* arm_pixmap */
	if (new_bmc->arm_pixmap != old_bmc->arm_pixmap)
	{
		Dimension width;
		Dimension height;

		assert( _XfePixmapGood(new_lp->pixmap) );

		_XfePixmapPrepare(nw,&new_bmc->arm_pixmap,
						  &width,
						  &height,
						  XmNarmPixmap);

		assert( width == new_bmc->pixmap_width );
		assert( height == new_bmc->pixmap_height );

		redisplay = True;
		resize = True;
	}

	if (resize)
	{
		Resize(nw);
	}

    return redisplay;
}
Example #3
0
/*----------------------------------------------------------------------*/
static void
DrawPixmap(Widget w,XEvent *event,Region region)
{
    XfeBmCascadePart *		bmc = _XfeBmCascadePart(w);
	XmLabelPart *			lp = _XfeXmLabelPart(w);
	Pixmap					pixmap = XmUNSPECIFIED_PIXMAP;
	Pixmap					mask = XmUNSPECIFIED_PIXMAP;
	Boolean					armed = CB_IsArmed(w);

	if (armed && _XfePixmapGood(bmc->arm_pixmap))
	{
		pixmap = bmc->arm_pixmap;

		if (_XfePixmapGood(bmc->arm_pixmap_mask))
		{
			mask = bmc->arm_pixmap_mask;
		}
	}
	else if (_XfePixmapGood(lp->pixmap) && 
			 bmc->pixmap_width && bmc->pixmap_height)
	{
		pixmap = lp->pixmap;

		if (_XfePixmapGood(bmc->label_pixmap_mask))
		{
			mask = bmc->label_pixmap_mask;
		}
	}

	if (_XfePixmapGood(pixmap))
	{
		Position x = _XfePrimitiveOffset(w) + lp->margin_width;
		Position y = (_XfeHeight(w) - bmc->pixmap_height) / 2;

		if (_XfePixmapGood(mask))
		{
			XSetClipOrigin(XtDisplay(w),bmc->pixmap_GC,x,y);
			XSetClipMask(XtDisplay(w),bmc->pixmap_GC,mask);
		}
		else
		{
			XSetClipMask(XtDisplay(w),bmc->pixmap_GC,None);
		}

		XCopyArea(XtDisplay(w),
				  pixmap,
				  _XfeWindow(w),
				  bmc->pixmap_GC,
				  0,0,
				  bmc->pixmap_width,
				  bmc->pixmap_height,
				  x,
				  y);
	}

}
Example #4
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);
	}
}