Ejemplo n.º 1
0
void wxBitmapComboBox::OnDrawBackground(wxDC& dc,
                                        const wxRect& rect,
                                        int item,
                                        int flags) const
{
    if ( GetCustomPaintWidth() == 0 ||
         !(flags & wxODCB_PAINTING_SELECTED) ||
         item < 0 )
    {
        wxOwnerDrawnComboBox::OnDrawBackground(dc, rect, item, flags);
        return;
    }

    //
    // Just paint simple selection background under where is text
    // (ie. emulate what MSW image choice does).
    //

    int xPos = 0;  // Starting x of selection rectangle
    const int vSizeDec = 1;  // Vertical size reduction of selection rectangle edges

    xPos = GetCustomPaintWidth() + 2;

    wxCoord x, y;
    GetTextExtent(GetString(item), &x, &y, 0, 0);

    dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));

    wxColour selCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
    dc.SetPen(selCol);
    dc.SetBrush(selCol);
    dc.DrawRectangle(rect.x+xPos,
                     rect.y+vSizeDec,
                     x + 4,
                     rect.height-(vSizeDec*2));
}
Ejemplo n.º 2
0
void wxBitmapComboBox::OnDrawBackground(wxDC& dc,
                                        const wxRect& rect,
                                        int item,
                                        int flags) const
{
    if ( GetCustomPaintWidth() == 0 ||
         !(flags & wxODCB_PAINTING_SELECTED) ||
         item < 0 ||
         ( (flags & wxODCB_PAINTING_CONTROL) && (GetInternalFlags() & wxCC_FULL_BUTTON)) )
    {
        wxOwnerDrawnComboBox::OnDrawBackground(dc, rect, item, flags);
        return;
    }

    wxBitmapComboBoxBase::DrawBackground(dc, rect, item, flags);
}