added possibility to customize the listbox colours

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-06-13 22:26:45 +00:00
parent 6874238c54
commit 9a9b4940a1
6 changed files with 252 additions and 56 deletions

View File

@@ -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;
}
@@ -282,7 +283,7 @@ int wxVListBox::GetNextSelected(unsigned long& cookie) const
}
// ----------------------------------------------------------------------------
// wxVListBox painting
// wxVListBox appearance parameters
// ----------------------------------------------------------------------------
void wxVListBox::SetMargins(const wxPoint& pt)
@@ -295,6 +296,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 +347,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
{