void wxOwnerDrawnComboBox::OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const { if ( flags & wxODCB_PAINTING_CONTROL ) { wxString text; if ( !ShouldUseHintText() ) { text = GetValue(); } else { text = GetHint(); wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); dc.SetTextForeground(col); } dc.DrawText( text, rect.x + GetMargins().x, (rect.height-dc.GetCharHeight())/2 + rect.y ); } else { dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2, rect.y ); } }
void ODIconCombo::OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const { int offset_x = bmpArray.Item(item).GetWidth(); int bmpHeight = bmpArray.Item(item).GetHeight(); dc.DrawBitmap(bmpArray.Item(item), rect.x, rect.y + (rect.height - bmpHeight)/2, true); if ( flags & wxODCB_PAINTING_CONTROL ) { wxString text = GetValue(); int margin_x = 2; #if wxCHECK_VERSION(2, 9, 0) if ( ShouldUseHintText() ) { text = GetHint(); wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); dc.SetTextForeground(col); } margin_x = GetMargins().x; #endif dc.DrawText( text, rect.x + margin_x + offset_x, (rect.height-dc.GetCharHeight())/2 + rect.y ); } else { dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x, (rect.height-dc.GetCharHeight())/2 + rect.y ); } }