void CharsetListWin::DrawItem(wal::GC &gc, int n, crect rect) { if (cList && n >= 0 && n < cCount) { bool frame = false; UiCondList ucl; if ((n % 2)==0) ucl.Set(uiOdd, true); if (n == this->GetCurrent()) ucl.Set(uiCurrentItem, true); unsigned bg = UiGetColor(uiBackground, uiItem, &ucl, 0xFFFFFF); unsigned textColor = UiGetColor(uiColor, uiItem, &ucl, 0); unsigned frameColor = UiGetColor(uiFrameColor, uiItem, &ucl, 0);; if (n == this->GetCurrent()) frame = true; gc.SetFillColor(bg); gc.FillRect(rect); gc.Set(GetFont()); int x = 0; const unicode_t *txt = 0; gc.SetTextColor(textColor); gc.TextOutF(rect.left+10, rect.top+2, utf8_to_unicode(cList[n]->name).ptr()); gc.TextOutF(rect.left+10+15*fontW, rect.top+2, utf8_to_unicode(cList[n]->comment).ptr() ); } else { gc.SetFillColor(UiGetColor(uiBackground, uiItem, 0, 0xFFFFFF)); gc.FillRect(rect); } }
void clFileAssociationsListWin::DrawItem( wal::GC& gc, int n, crect rect ) { if ( n < 0 || n >= ( int )m_ItemList->size( ) ) { gc.SetFillColor( UiGetColor( uiBackground, 0, 0, 0xB0B000 ) ); gc.FillRect( rect ); //CCC return; } UiCondList ucl; if ( ( n % 2 ) == 0 ) { ucl.Set( uiOdd, true ); } if ( n == this->GetCurrent() ) { ucl.Set( uiCurrentItem, true ); } unsigned bg = UiGetColor( uiBackground, uiItem, &ucl, 0xB0B000 ); unsigned color = UiGetColor( uiColor, uiItem, &ucl, 0 ); unsigned fcColor = UiGetColor( uiFcColor, uiItem, &ucl, 0xFFFF ); gc.SetFillColor( bg ); gc.FillRect( rect ); const clNCFileAssociation* p = &m_ItemList->at( n ); if ( p ) { gc.Set( GetFont() ); gc.SetTextColor( color ); gc.TextOutF( rect.left + 10, rect.top + 1, p->GetMask().data() ); gc.SetTextColor( fcColor ); gc.TextOutF( rect.left + 10, rect.top + 1, p->GetMask().data(), 1 ); } }
void MenuBar::DrawItem(GC &gc, int n) { if (n<0 || n>=list.count()) return; UiCondList ucl; if (n == select && InFocus()) ucl.Set(uiCurrentItem, true); int color_text = UiGetColor(uiColor, uiItem, &ucl, 0x0); int color_bg = UiGetColor(uiBackground, uiItem, &ucl, 0xFFFFFF); gc.Set(GetFont()); crect itemRect = ItemRect(n); gc.SetFillColor(color_bg); if (n == select && InFocus()) gc.FillRect(itemRect); if (n == select) { DrawBorder(gc, itemRect, UiGetColor(uiCurrentItemFrame, uiItem, &ucl, 0xFFFFFF)); } gc.SetTextColor( color_text ); const unicode_t *text = list[n].text.ptr(); cpoint tsize = gc.GetTextExtents(text); int x = itemRect.left + (itemRect.Width()-tsize.x)/2; int y = itemRect.top + (itemRect.Height()-tsize.y)/2; #ifdef _WIN32 gc.TextOut(x,y,text); #else gc.TextOutF(x,y,text); #endif }
void NCNumberWin::Paint( wal::GC& gc, const crect& paintRect ) { crect rect = ClientRect(); gc.SetFillColor( UiGetColor( uiBackground, 0, 0, 0xFFFFFF ) ); gc.FillRect( rect ); gc.SetTextColor( UiGetColor( uiColor, 0, 0, 0 ) ); gc.Set( GetFont() ); unicode_t c[32]; unicode_t buf[32]; unicode_t* s = buf; int64_t n = _num; bool minus = n < 0; if ( minus ) { n = -n; } int i = 0; for ( ; n > 0; i++, n /= 10 ) { c[i] = char( n % 10 ) + '0'; } if ( minus ) { *s = '-'; s++; } if ( i == 0 ) {*s = '0'; s++; }; for ( i--; i >= 0; i-- ) { *( s++ ) = c[i]; } *s = 0; gc.TextOut( 0, 0, buf ); }
void TBToolTip::Paint(wal::GC &gc, const crect &paintRect) { gc.SetFillColor(UiGetColor(uiBackground, 0,0, 0xFFFFFF)/*GetColor(IC_BG)*/); //0x80FFFF); crect r = ClientRect(); gc.FillRect(r); gc.SetTextColor(UiGetColor(uiColor, 0,0, 0)/*GetColor(IC_TEXT)*/); //gc.TextOutF(0,0,text.ptr()); DrawStaticText(gc, 2, 1, text.ptr(), GetFont(), false); }
void StaticLine::Paint(GC &gc, const crect &paintRect) { crect rect = ClientRect(); gc.SetFillColor(UiGetColor(uiBackground, 0,0, 0xFFFFFF)/*GetColor(0)*/); gc.FillRect(rect); //CCC gc.SetTextColor(UiGetColor(uiColor, 0,0, 0)/*GetColor(IsEnabled() ? IC_TEXT : IC_GRAY_TEXT)*/); //CCC gc.Set(GetFont()); DrawStaticText(gc,0,0,text.ptr()); }
void StaticLabel::Paint(GC& gc, const crect& paintRect) { crect rect = ClientRect(); gc.SetFillColor(UiGetColor(uiBackground, uiClassStaticLabel, 0, 0xFFFFFF)/*GetColor(0)*/); gc.FillRect(rect); gc.Set(GetFont()); text.DrawItem(gc, 0, 0, UiGetColor(uiColor, uiClassStaticLabel, 0, 0), UiGetColor(uiHotkeyColor, uiClassStaticLabel, 0, 0)); }
void PopupMenu::Paint( GC& gc, const crect& paintRect ) { crect rect = ClientRect(); gc.SetFillColor( UiGetColor( uiBackground, 0, 0, 0xFFFFFF ) ); gc.FillRect( rect ); DrawBorder( gc, rect, UiGetColor( uiFrameColor, 0, 0, 0 ) ); for ( int i = 0; i < list.count(); i++ ) { DrawItem( gc, i ); } }
void ScrollBar::Paint( GC& gc, const crect& paintRect ) { crect cr = ClientRect(); unsigned bgColor = UiGetColor( uiBackground, 0, 0, 0xD8E9EC );/*GetColor(IC_SCROLL_BG)*/; unsigned btnColor = UiGetColor( uiButtonColor, 0, 0, 0xD8E9EC ); //GetColor(IC_SCROLL_BUTTON); gc.SetFillColor( bgColor ); gc.FillRect( cr ); DrawBorder( gc, cr, UiGetColor( uiColor, 0, 0, 0xD8E9EC )/*GetColor(IC_SCROLL_BORDER)*/ ); if ( !b1Rect.IsEmpty() ) { SBCDrawButton( gc, b1Rect, vertical ? 4 : 1, btnColor, b1Pressed ); } if ( !b2Rect.IsEmpty() ) { SBCDrawButton( gc, b2Rect, vertical ? 5 : 2, btnColor, b2Pressed ); } if ( !b3Rect.IsEmpty() ) { SBCDrawButton( gc, b3Rect, vertical ? 6 : 3, btnColor, false ); } }
void OperFileNameWin::Paint(wal::GC &gc, const crect &paintRect) { crect rect = ClientRect(); gc.SetFillColor(UiGetColor(uiBackground,0,0,0xFFFFFF)); gc.FillRect(rect); gc.SetTextColor(UiGetColor(uiColor,0,0,0)); gc.Set(GetFont()); unicode_t *p = text.ptr(); if (p) { int l = unicode_strlen(p); if (l > _ccount) { p += l - _ccount; } DrawStaticText(gc,0,0,p); } }
void MenuBar::Paint(GC &gc, const crect &paintRect) { crect rect = ClientRect(); unsigned color = UiGetColor(uiBackground, 0, 0, 0xFFFFFF); unsigned bColor = ColorTone(color, -50), aColor = ColorTone(color,+50); FillHorisontalRect(gc, rect, aColor, bColor); for (int i = 0; i<list.count(); i++) DrawItem(gc,i); }
void SButton::Paint( GC& gc, const crect& paintRect ) { crect cr = ClientRect(); unsigned colorBg = UiGetColor( uiBackground, 0, 0, 0xFFFFFF ); gc.SetFillColor( colorBg ); //CCC gc.FillRect( cr ); if ( group > 0 ) { DrawCE( gc, 1, ( cr.Height() - 13 ) / 2, IsSet() ); } else { DrawCB( gc, 1, ( cr.Height() - 13 ) / 2, IsSet() ); } gc.Set( GetFont() ); cpoint tsize = text.GetTextExtents(gc); gc.SetFillColor( colorBg ); //gc.SetTextColor( UiGetColor( uiColor, 0, 0, 0 ) ); //gc.TextOutF( 14 + 1 + 1 + 1 , ( cr.Height() - tsize.y ) / 2, text.data() ); UiCondList ucl; int color_text = UiGetColor(uiColor, uiItem, &ucl, 0x0); int color_hotkey = UiGetColor(uiHotkeyColor, uiItem, &ucl, 0x0); text.DrawItem(gc, 14 + 1 + 1 + 1, (cr.Height() - tsize.y) / 2, color_text, color_hotkey); if ( InFocus() ) { crect rect; rect.left = 14 + 2; rect.top = ( cr.Height() - tsize.y - 2 ) / 2; rect.right = rect.left + tsize.x + 4; rect.bottom = rect.top + tsize.y + 2; DrawBorder( gc, rect, UiGetColor( uiFocusFrameColor, 0, 0, 0 ) ); //CCC } }
void TextList::DrawItem( GC& gc, int n, crect rect ) { if ( n >= 0 && n < list.count() ) { UiCondList ucl; if ( ( n % 2 ) == 0 ) { ucl.Set( uiOdd, true ); } if ( n == this->GetCurrent() ) { ucl.Set( uiCurrentItem, true ); } unsigned bg = UiGetColor( uiBackground, uiItem, &ucl, 0xFFFFFF ); unsigned textColor = UiGetColor( uiColor, uiItem, &ucl, 0 ); unsigned frameColor = UiGetColor( uiFrameColor, uiItem, &ucl, 0 );; bool frame = ( n == this->GetCurrent() ); gc.SetFillColor( bg ); gc.FillRect( rect ); unicode_t* txt = list[n].str.data(); if ( txt ) { gc.Set( GetFont() ); gc.SetTextColor( textColor ); gc.SetFillColor( bg ); gc.TextOutF( rect.left, rect.top + ( GetItemHeight() - fontH ) / 2, txt ); } if ( frame ) { DrawBorder( gc, rect, frameColor ); } } else { gc.SetFillColor( UiGetColor( uiBackground, uiItem, 0, 0xFFFFFF ) ); gc.FillRect( rect ); //CCC } }
void NCDialog::Paint( wal::GC& gc, const crect& paintRect ) { int bcolor = UiGetColor( uiBackground, 0, 0, 0x808080 ); gc.SetFillColor( bcolor ); gc.FillRect( _borderRect ); Draw3DButtonW2( gc, _borderRect, bcolor, true ); crect rect = _frameRect; Draw3DButtonW2( gc, _frameRect, bcolor, false ); rect.Dec(); rect.Dec(); DrawBorder( gc, rect, 0 ); }
void PathListWin::DrawItem(wal::GC& gc, int n, crect rect) { const PathList::Data* curr = m_dataList.GetData(n); if (curr) { std::vector<unicode_t> text = GetItemText( curr ); UiCondList ucl; if ((n % 2) == 0) { ucl.Set(uiOdd, true); } if (n == this->GetCurrent()) { ucl.Set(uiCurrentItem, true); } unsigned bg = UiGetColor(uiBackground, uiItem, &ucl, 0xB0B000); unsigned color = UiGetColor(uiColor, uiItem, &ucl, 0); // unsigned fcColor = UiGetColor(uiFcColor, uiItem, &ucl, 0xFFFF); gc.SetFillColor(bg); gc.FillRect(rect); gc.Set(GetFont()); gc.SetTextColor(color); gc.TextOutF( rect.left + 10, rect.top + 1, text.data() ); //gc.SetTextColor(fcColor); //gc.TextOutF(rect.left + 10, rect.top + 1, name, 1); } else { gc.SetFillColor(UiGetColor(uiBackground, 0, 0, 0xB0B000)); gc.FillRect(rect); } }
void ToolBar::Paint( wal::GC& gc, const crect& paintRect ) { crect cr = ClientRect(); crect rect = cr; unsigned colorBg = UiGetColor( uiBackground, 0, 0, 0x808080 ); //GetColor(0); unsigned splitColor1 = ColorTone( colorBg, -70 ); unsigned splitColor2 = ColorTone( colorBg, 70 ); if ( g_WcmConfig.styleShow3DUI ) { Draw3DButtonW2( gc, rect, colorBg, true ); rect.Dec(); rect.Dec(); } gc.SetFillColor( colorBg ); gc.FillRect( rect ); gc.Set( GetFont() ); int x = 2; for ( size_t i = 0; i < _list.size(); i++ ) { Node* p = _list[i].ptr(); if ( p ) { DrawNode( gc, p, _pressed == p ? DRAW_PRESSED : DRAW_NORMAL ); x += p->rect.Width(); } else { gc.SetFillColor( splitColor1 ); int x1 = x + SPLITTER_WIDTH / 2; gc.FillRect( crect( x1, rect.top, x1 + 1, rect.bottom ) ); gc.SetFillColor( splitColor2 ); gc.FillRect( crect( x1 + 2, rect.top, x1 + 2, rect.bottom ) ); x += SPLITTER_WIDTH; } } return; }
void ToolBar::DrawNode( wal::GC& gc, Node* pNode, int state ) { if ( !pNode ) { return; } int W = pNode->rect.Width(); int H = pNode->rect.Height(); if ( W <= 0 || H <= 0 ) { return; } int x = pNode->rect.left + 1 + XSPACE; int y = pNode->rect.top + 1 + YSPACE; unsigned bgColor = UiGetColor( uiBackground, uiItem, 0, 0x808080 ); //GetColor(0); unsigned frameColor = ColorTone( bgColor, -150 ); if ( state == DRAW_PRESSED ) { bgColor = ColorTone( bgColor, -50 ); } gc.SetFillColor( bgColor ); { crect r = pNode->rect; r.Dec(); gc.FillRect( r ); } if ( pNode->icon.ptr() && pNode->icon->Valid() ) { pNode->icon->DrawF( gc, x, y ); x += _iconSize; } if ( state != DRAW_NORMAL ) { DrawBorder( gc, pNode->rect, frameColor ); } }
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 ) ); } } }
void Button::Paint( GC& gc, const crect& paintRect ) { unsigned colorBg = UiGetColor(uiBackground, uiClassButton, 0, 0x808080); //GetColor(0); crect cr = this->ClientRect(); crect rect = cr; DrawBorder( gc, rect, ColorTone( colorBg, +20 ) ); rect.Dec(); DrawBorder( gc, rect, ColorTone( colorBg, -200 ) ); rect.Dec(); gc.SetFillColor( colorBg ); gc.FillRect( rect ); if ( pressed ) { #if USE_3D_BUTTONS Draw3DButtonW2( gc, rect, colorBg, false ); #endif rect.Dec(); rect.Dec(); } else { #if USE_3D_BUTTONS Draw3DButtonW2( gc, rect, colorBg, true ); #endif rect.Dec(); if ( InFocus() ) { DrawBorder( gc, rect, /*GetColor(IC_FOCUS_MARK)*/ UiGetColor( uiFocusFrameColor, 0, 0, 0 ) ); } #if USE_3D_BUTTONS rect.Dec(); #endif } //gc.SetTextColor( /*GetColor(IsEnabled() ? IC_TEXT : IC_GRAY_TEXT)*/ UiGetColor( uiColor, 0, 0, 0 ) ); gc.Set( GetFont() ); cpoint tsize = text.GetTextExtents(gc); /* int l = tsize.x + (icon.ptr() ? icon->Width() + ICONX_RIGHTSPACE : 0); int w = rect.Width() - LEFTSPACE - RIGHTSPACE; if (icon.ptr()) w-=ICONX_RIGHTSPACE; //int x = rect.left + LEFTSPACE + (w > l ? (w - l)/2 : 0) +(pressed?2:0); int x = rect.left + LEFTSPACE + (w-l)/2 +(pressed?2:0); */ int l = tsize.x + ( icon.ptr() ? icon->Width() + ICONX_RIGHTSPACE : 0 ); int w = rect.Width(); int x = rect.left + ( w > l ? ( w - l ) / 2 : 0 ) + ( pressed ? 2 : 0 ); if ( icon.ptr() ) { gc.DrawIcon( x, rect.top + ( rect.Height() - icon->Height() ) / 2 + ( pressed ? 2 : 0 ), icon.ptr() ); x += icon->Width() + ICONX_RIGHTSPACE; } gc.SetClipRgn( &rect ); text.DrawItem(gc, x, rect.top + (rect.Height() - tsize.y) / 2 + (pressed ? 2 : 0), UiGetColor(uiColor, uiClassButton, 0, 0), UiGetColor(uiHotkeyColor, uiClassButton, 0, 0)); }
void clSelectDriveDlgMenu::Paint( wal::GC& gc, const crect& paintRect ) { cfont* font = GetFont(); gc.Set( font ); int y = 0; int bgColor = UiGetColor( uiBackground, 0, 0, 0xB0B000 ); int count = _data->Count(); int Splitters = 0; int SplitterTop = 0; int SplitterBottom = 0; for ( int i = 0; i < count; i++ ) { if ( _data->list[i].cmd == 0 ) { gc.SetFillColor( bgColor ); gc.FillRect( crect( 0, y, _width, y + _splitterH ) ); crect rect( 0, y + 1, 0 + _width, y + 2 ); gc.SetFillColor( ColorTone( bgColor, -150 ) ); gc.FillRect( rect ); rect.top += 1; rect.bottom += 1; gc.SetFillColor( ColorTone( bgColor, +50 ) ); gc.FillRect( rect ); y += _splitterH; Splitters++; if ( Splitters == 1 ) { SplitterTop = y; } if ( Splitters == 2 ) { SplitterBottom = y - _splitterH; } } else { UiCondList ucl; if ( i == _current ) { ucl.Set( uiCurrentItem, true ); } unsigned bg = UiGetColor( uiBackground, uiItem, &ucl, 0xFFFFFF ); unsigned textColor = UiGetColor( uiColor, uiItem, &ucl, 0 ); unsigned fcColor = UiGetColor( uiFcColor, uiItem, &ucl, 0xFF ); unsigned commentColor = UiGetColor( uiCommentColor, uiItem, &ucl, 0 ); gc.SetFillColor( bg ); gc.FillRect( crect( 0, y, _width, y + _itemH ) ); cicon icon; if ( _data->list[i].icon >= 0 ) { icon.Load( _data->list[i].icon, 16, 16 ); } else { icon.Load( _data->list[i].cmd, 16, 16 ); } gc.DrawIcon( 0, y, &icon ); gc.SetTextColor( textColor ); int x = 16 + 5; const unicode_t* name = _data->list[i].name.data(); const unicode_t* comment1 = _data->list[i].comment1.data(); const unicode_t* comment2 = _data->list[i].comment2.data(); if ( name ) { gc.TextOutF( x, y, name ); gc.SetTextColor( fcColor ); gc.TextOutF( x, y, name, 1 ); } if ( comment1 ) { gc.SetTextColor( commentColor ); gc.TextOutF( x + _nameW + 5, y, comment1 ); } if ( comment2 ) { gc.SetTextColor( commentColor ); gc.TextOutF( x + _nameW + 5 + _comment1W + 30, y, comment2 ); } y += _itemH; } } if ( _comment2W && SplitterTop && SplitterBottom ) { int cx = _nameW + 5 + _comment1W + 30; gc.SetFillColor( ColorTone( bgColor, -150 ) ); gc.FillRect( crect( cx, SplitterTop, cx + _splitterW, SplitterBottom ) ); } }