29 wxOwnerDrawnComboBox( aParent, aId, wxEmptyString, wxDefaultPosition, wxDefaultSize,
30 0, nullptr, wxCB_READONLY ),
43 using namespace std::placeholders;
44 wxOwnerDrawnComboBox::DoSetPopupControl( aPopup );
62 if(
text == wxEmptyString )
64 wxPen pen(
m_grey, 1, wxPENSTYLE_SOLID );
67 aDC.DrawLine( aRect.x, aRect.y + aRect.height / 2, aRect.x + aRect.width,
68 aRect.y + aRect.height / 2 );
74 if( aFlags & wxODCB_PAINTING_CONTROL )
76 x = aRect.x + GetMargins().x;
77 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 );
130 return wxOwnerDrawnComboBox::OnMeasureItem( aItem );
137 return GetTextRect().GetWidth() - 2;
139 return wxOwnerDrawnComboBox::OnMeasureItemWidth( aItem );
145 aDC.DrawText( aText, x, y );
146 return x + aDC.GetTextExtent( aText ).GetWidth();
152 int item = GetVListBoxComboPopup()->VirtualHitTest( aEvent.GetPosition().y );
163 if( sel >= 0 && sel < (
int) GetCount() )
182 if( aItem >= 0 && aItem < (
int) GetCount() )
183 return GetVListBoxComboPopup()->GetString( aItem );
185 return wxEmptyString;
192 return GetVListBoxComboPopup()->wxVListBox::GetSelection();
194 return GetSelection();
200 if( aSel >= 0 && aSel < (
int) GetCount() )
203 return GetVListBoxComboPopup()->wxVListBox::SetSelection( aSel );
205 return SetSelection( aSel );