X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/970b97a267e1e60f4e269fb15317d9364526ac21..18d491685c8e13a5536f2f9dd6c8041c110a76d9:/src/generic/vlbox.cpp?ds=inline diff --git a/src/generic/vlbox.cpp b/src/generic/vlbox.cpp index bc846054a2..938b9d331c 100644 --- a/src/generic/vlbox.cpp +++ b/src/generic/vlbox.cpp @@ -69,11 +69,12 @@ bool wxVListBox::Create(wxWindow *parent, if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) ) return false; - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX)); - if ( style & wxLB_MULTIPLE ) m_selStore = new wxSelectionStore; + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX)); + m_colBgSel = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); + return true; } @@ -248,8 +249,11 @@ void wxVListBox::SetSelection(int selection) (selection >= 0 && (size_t)selection < GetItemCount()), _T("wxVListBox::SetSelection(): invalid item index") ); - wxASSERT_MSG( !HasMultipleSelection(), - _T("SetSelection() is invalid with multiselection listbox") ); + if ( HasMultipleSelection() ) + { + Select(selection); + m_anchor = selection; + } DoSetCurrent(selection); } @@ -282,7 +286,7 @@ int wxVListBox::GetNextSelected(unsigned long& cookie) const } // ---------------------------------------------------------------------------- -// wxVListBox painting +// wxVListBox appearance parameters // ---------------------------------------------------------------------------- void wxVListBox::SetMargins(const wxPoint& pt) @@ -295,6 +299,15 @@ void wxVListBox::SetMargins(const wxPoint& pt) } } +void wxVListBox::SetSelectionBackground(const wxColour& col) +{ + m_colBgSel = col; +} + +// ---------------------------------------------------------------------------- +// wxVListBox painting +// ---------------------------------------------------------------------------- + wxCoord wxVListBox::OnGetLineHeight(size_t line) const { return OnMeasureItem(line) + 2*m_ptMargins.y; @@ -337,10 +350,7 @@ void wxVListBox::OnPaint(wxPaintEvent& event) { if ( isSelected ) { - wxBrush brush(wxSystemSettings:: - GetColour(wxSYS_COLOUR_HIGHLIGHT), - wxSOLID); - dc.SetBrush(brush); + dc.SetBrush(wxBrush(m_colBgSel, wxSOLID)); } else // !selected {