29 wxOwnerDrawnComboBox( aParent, aId, wxEmptyString, wxDefaultPosition, wxDefaultSize,
30 0, nullptr, wxCB_READONLY ),
43 using namespace std::placeholders;
44 wxOwnerDrawnComboBox::DoSetPopupControl( aPopup );
61 if(
text == wxEmptyString )
63 wxPen pen(
m_grey, 1, wxPENSTYLE_SOLID );
66 aDC.DrawLine( aRect.x, aRect.y + aRect.height / 2, aRect.x + aRect.width,
67 aRect.y + aRect.height / 2 );
73 if( aFlags & wxODCB_PAINTING_CONTROL )
75 x = aRect.x + GetMargins().x;
76 y = ( aRect.height - aDC.GetCharHeight() ) / 2 + aRect.y;
87 size_t start_grey = 0;
90 wxString lib =
static_cast<wxStringClientData*
>( GetClientObject( aItem ) )->GetData();
91 size_t colon_index = lib.rfind(
':' );
93 if( colon_index != wxString::npos )
95 wxString library_part = lib.SubString( 0, colon_index );
96 size_t library_index =
text.rfind( library_part );
98 if( library_index != wxString::npos )
100 start_grey = library_index;
101 end_grey = start_grey + library_part.Length();
105 if( start_grey != end_grey && !( aFlags & wxODCB_PAINTING_SELECTED ) )
109 wxColour standard_color = aDC.GetTextForeground();
111 aDC.SetTextForeground(
m_grey );
114 aDC.SetTextForeground( standard_color );
119 aDC.DrawText(
text, x, y );
129 return wxOwnerDrawnComboBox::OnMeasureItem( aItem );
136 return GetTextRect().GetWidth() - 2;
138 return wxOwnerDrawnComboBox::OnMeasureItemWidth( aItem );
144 aDC.DrawText( aText, x, y );
145 return x + aDC.GetTextExtent( aText ).GetWidth();
151 int item = GetVListBoxComboPopup()->VirtualHitTest( aEvent.GetPosition().y );
162 if( sel >= 0 && sel < (
int) GetCount() )
181 if( aItem >= 0 && aItem < (
int) GetCount() )
182 return GetVListBoxComboPopup()->GetString( aItem );
184 return wxEmptyString;
191 return GetVListBoxComboPopup()->wxVListBox::GetSelection();
193 return GetSelection();
199 if( aSel >= 0 && aSel < (
int) GetCount() )
202 return GetVListBoxComboPopup()->wxVListBox::SetSelection( aSel );
204 return SetSelection( aSel );