/* 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; }; }
static void DrawCE( GC& gc, int x, int y, bool isSet ) { gc.SetLine( CBC_BOXFRAME ); gc.SetFillColor( CBC_BOX_BG ); gc.Ellipce( crect( x, y, x + 13, y + 13 ) ); if ( isSet ) { DrawPixelList( gc, rbPix, x + 4, y + 4, CBC_CHECK ); } }
static void DrawCB( GC& gc, int x, int y, bool isSet ) { gc.SetLine( CBC_BOXFRAME ); gc.MoveTo( x, y ); gc.LineTo( x + 13, y ); gc.LineTo( x + 13, y + 13 ); gc.LineTo( x, y + 13 ); gc.LineTo( x, y ); gc.SetFillColor( CBC_BOX_BG ); //CCC gc.FillRect( crect( x + 1, y + 1, x + 13, y + 13 ) ); if ( isSet ) { DrawPixelList( gc, chPix, x + 3, y + 3, CBC_CHECK ); } }
void PopupMenu::DrawItem( GC& gc, int n ) { if ( n < 0 || n >= list.count() ) { return; } UiCondList ucl; if ( n == selected ) { ucl.Set( uiCurrentItem, true ); } int color_text = UiGetColor( uiColor, uiItem, &ucl, 0x0 ); int color_hotkey = UiGetColor( uiHotkeyColor, uiItem, &ucl, 0x0 ); int color_bg = UiGetColor( uiBackground, uiItem, &ucl, 0xFFFFFF ); int color_left = UiGetColor( uiBackground, 0, 0, 0xFFFFFF ); crect r = list[n].rect; int height = r.Height(); r.right = MENU_LEFT_BLOCK; gc.SetFillColor( n == selected ? color_bg : color_left ); gc.FillRect( r ); r = list[n].rect; r.left = MENU_LEFT_BLOCK ; gc.SetFillColor( color_bg ); gc.FillRect( r ); unsigned colorLine = UiGetColor( uiLineColor, uiItem, &ucl, 0 ); gc.SetLine( colorLine ); gc.MoveTo( r.left, r.top ); gc.LineTo( r.left, r.bottom ); if ( IsSplit( n ) ) { gc.SetLine( colorLine ); int y = r.top + ( r.Height() - 1 ) / 2; gc.MoveTo( 1, y ); gc.LineTo( r.right, y ); } else { gc.Set( GetFont() ); MenuTextInfo& lText = ( list[n].data->leftText ); //unicode_t* lText = list[n].data->leftText.data(); unicode_t* rText = list[n].data->rightText.data(); //if ( lText ) { gc.TextOutF( MENU_LEFT_BLOCK + MENU_TEXT_OFFSET, r.top + ( height - fontHeight ) / 2, lText ); } if ( !lText.isEmpty() ) { lText.DrawItem( gc, MENU_LEFT_BLOCK + MENU_TEXT_OFFSET, r.top + ( height - fontHeight ) / 2, color_text, color_hotkey ); } if ( rText ) { gc.SetTextColor( color_text ); gc.TextOutF( MENU_LEFT_BLOCK + MENU_TEXT_OFFSET + leftWidth + fontHeight, r.top + ( height - fontHeight ) / 2, rText ); } if ( IsSub( n ) ) { int y = r.top + ( height - RightMenuPointer[0] ) / 2; DrawPixelList( gc, RightMenuPointer, r.right - 10 , y, UiGetColor( uiPointerColor, uiItem, &ucl, 0 ) ); } if ( IsCmd( n ) ) { int y = r.top + ( height - MENU_ICON_SIZE ) / 2; int x = ( MENU_LEFT_BLOCK - MENU_ICON_SIZE ) / 2; gc.DrawIcon( x, y, GetCmdIcon( list[n].data->id ) ); } } }