+// ----------------------------------------------------------------------------
+// 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 WXUNUSED(item),
+ int flags) const
+{
+ // We need only to explicitly draw background for items
+ // that should have selected background. Also, call PrepareBackground
+ // always when painting the control so that clipping is done properly.
+
+ if ( (flags & wxODCB_PAINTING_SELECTED) ||
+ ((flags & wxODCB_PAINTING_CONTROL) && HasFlag(wxCB_READONLY)) )
+ {
+ int bgFlags = wxCONTROL_SELECTED;
+
+ if ( !(flags & wxODCB_PAINTING_CONTROL) )
+ bgFlags |= wxCONTROL_ISSUBMENU;
+
+ PrepareBackground(dc, rect, bgFlags);
+ }
+}
+
+#endif // wxUSE_ODCOMBOBOX