コード例 #1
0
ファイル: util.cpp プロジェクト: AbdelghaniDr/mirror
static void DrawDragDropRectRaw(Draw& draw, const Rect& rc, int width)
{
	Size size = rc.Size();
	if(2 * width <= min(size.cx, size.cy))
		XFillRectangle(Xdisplay, draw.GetDrawable(), draw.GetGC(), rc.left, rc.top, size.cx, size.cy);
	else
	{
		XFillRectangle(Xdisplay, draw.GetDrawable(), draw.GetGC(), rc.left, rc.top, size.cx, width);
		XFillRectangle(Xdisplay, draw.GetDrawable(), draw.GetGC(), rc.left, rc.bottom - width, size.cx, width);
		XFillRectangle(Xdisplay, draw.GetDrawable(), draw.GetGC(), rc.left, rc.top + width, width, size.cy - 2 * width);
		XFillRectangle(Xdisplay, draw.GetDrawable(), draw.GetGC(), rc.right - width, rc.top + width, width, size.cy - 2 * width);
	}
}
コード例 #2
0
ファイル: util.cpp プロジェクト: AbdelghaniDr/mirror
void DrawDragDropRect(Draw& draw, const Rect& rc_old, const Rect& rc_new, int width, Color c1, Color c2)
{
#ifdef PLATFORM_WIN32
#ifdef SYSTEMDRAW
	SystemDraw *w = dynamic_cast<SystemDraw *>(&draw);
	if(w) { SystemDraw& draw = *w;
#endif
	static const word halftone[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
	HBITMAP bitmap = CreateBitmap(8, 8, 1, 1, halftone);
	HBRUSH brush = CreatePatternBrush(bitmap);
	DeleteObject(bitmap);
	draw.BeginGdi();
	SetTextColor(draw, c1);
	SetBkColor(draw, c2);
	if(!IsNull(rc_old))
		DrawDragDropRectRaw(draw, rc_old, brush, width);
	if(!IsNull(rc_new))
		DrawDragDropRectRaw(draw, rc_new, brush, width);
	DeleteObject(brush);
	draw.EndGdi();
#ifdef SYSTEMDRAW
	}
#endif
#endif
#ifdef PLATFORM_X11
	XGCValues gcv_old, gcv_new;
	XGetGCValues(Xdisplay, draw.GetGC(), GCForeground | GCFunction, &gcv_old);
	gcv_new.function = X11_ROP2_XOR;
	gcv_new.foreground = GetXPixel(c1);
	XChangeGC(Xdisplay, draw.GetGC(), GCForeground | GCFunction, &gcv_new);
	if(!IsNull(rc_old))
		DrawDragDropRectRaw(draw, rc_old, width);
	if(!IsNull(rc_new))
		DrawDragDropRectRaw(draw, rc_new, width);
	XChangeGC(Xdisplay, draw.GetGC(), GCForeground | GCFunction, &gcv_old);
#endif
}