/*
	types:
	   1 -left 2 - right 3 - horisontal slider
	   4 - up 5 - down   6 - vert. slider
	*/
	void SBCDrawButton( GC& gc, crect rect, int type, unsigned bg, bool pressed )
	{
		static unsigned short up[] = {6, 0x10, 0x38, 0x7c, 0xee, 0x1c7, 0x82};
		static unsigned short down[] = {6, 0x82, 0x1c7, 0xee, 0x7c, 0x38, 0x10,};
		static unsigned short left[] = {9, 0x10, 0x38, 0x1c, 0x0e, 0x07, 0x0e, 0x1c, 0x38, 0x10};
		static unsigned short right[] = {9, 0x02, 0x07, 0x0E, 0x1c, 0x38, 0x1c, 0x0e, 0x07, 0x02};
		DrawBorder( gc, rect, ColorTone( bg, -100 ) );
		rect.Dec();
		Draw3DButtonW1( gc, rect, bg, !pressed );
		//rect.Dec();
		rect.Dec();
		gc.SetFillColor( bg );
		gc.FillRect( rect );
		int xPlus = 0;
		int yPlus = 0;

		if ( pressed )
		{
			// xPlus = 1;
			yPlus = 1;
		}

		unsigned color = ColorTone( bg, -200 );

		switch ( type )
		{
			case 1:
				DrawPixelList( gc, left, rect.left + ( rect.Width() - 6 ) / 2 + xPlus, rect.top + ( rect.Height() - 9 ) / 2 + yPlus, color );
				break;

			case 2:
				DrawPixelList( gc, right, rect.left + ( rect.Width() - 6 ) / 2 + xPlus, rect.top + ( rect.Height() - 9 ) / 2 + yPlus, color );
				break;

			case 4:
				DrawPixelList( gc, up, rect.left + ( rect.Width() - 9 ) / 2 + xPlus, rect.top + ( rect.Height() - 6 ) / 2 + yPlus, color );
				break;

			case 5:
				DrawPixelList( gc, down, rect.left + ( rect.Width() - 9 ) / 2 + xPlus, rect.top + ( rect.Height() - 6 ) / 2 + yPlus, color );
				break;
		};
	}
Exemplo n.º 2
0
void Draw3DButtonW2(GC &gc, crect r, unsigned bg, bool up)
{
	static unsigned hp1,lp1;
	static unsigned hp2,lp2;
	static unsigned lastBg = 0;
	static bool initialized = false;

	if (!initialized || lastBg != bg)
	{
		hp1 = ColorTone(bg, -10);
		lp1 = ColorTone(bg, -90);
		hp2 = ColorTone(bg, +150);
		lp2 = ColorTone(bg, -60);
		lastBg = bg;
		initialized = true;
	}

	unsigned php1,plp1,php2,plp2;
	if (up) {
		php1 = hp1;
		plp1 = lp1;
		php2 = hp2;
		plp2 = lp2;
	} else {
		php1 = lp1;
		plp1 = hp1;
		php2 = lp2;
		plp2 = hp2;
	}

	gc.SetLine(plp1);
	gc.MoveTo(r.right-1,r.top);
	gc.LineTo(r.right-1,r.bottom-1);
	gc.LineTo(r.left,r.bottom-1);
	gc.SetLine(php1);
	gc.LineTo(r.left,r.top);
	gc.LineTo(r.right-1,r.top);
	r.Dec();
	gc.MoveTo(r.right-1, r.top);
	gc.SetLine(php2);
	gc.LineTo(r.left, r.top);
	gc.LineTo(r.left, r.bottom-1);
	gc.SetLine(plp2);
	gc.LineTo(r.right-1, r.bottom-1);
	gc.LineTo(r.right-1, r.top);
}