+// ----------------------------------------------------------------------------
+// wxOwnerDrawnComboBox item drawing and measuring default implementations
+// ----------------------------------------------------------------------------
+
+void wxOwnerDrawnComboBox::OnDrawItem( wxDC& dc,
+ const wxRect& rect,
+ int item,
+ int flags ) const
+{
+ if ( flags & wxODCB_PAINTING_CONTROL )
+ {
+ dc.DrawText( GetValue(),
+ rect.x + GetTextIndent(),
+ (rect.height-dc.GetCharHeight())/2 + rect.y );
+ }
+ else
+ {
+ dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2, rect.y );
+ }
+}
+
+wxCoord wxOwnerDrawnComboBox::OnMeasureItem( size_t WXUNUSED(item) ) const
+{
+ return -1;
+}
+
+wxCoord wxOwnerDrawnComboBox::OnMeasureItemWidth( size_t WXUNUSED(item) ) const
+{
+ return -1;
+}
+
+void wxOwnerDrawnComboBox::OnDrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const
+{
+ // we need to render selected and current items differently
+ if ( GetVListBoxComboPopup()->IsCurrent((size_t)item) ||
+ (flags & wxODCB_PAINTING_CONTROL) )
+ {
+ int bgFlags = wxCONTROL_SELECTED;
+
+ if ( (flags & wxODCB_PAINTING_CONTROL) != wxODCB_PAINTING_CONTROL )
+ {
+ bgFlags |= wxCONTROL_ISSUBMENU;
+ PrepareBackground(dc, rect, bgFlags);
+ }
+ else if ( HasFlag(wxCB_READONLY) )
+ PrepareBackground(dc, rect, bgFlags);
+ }
+ //else: do nothing for the normal items
+}
+