fixed background colour handling in wxTreeCtrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6099 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2000-02-16 23:23:19 +00:00
parent 178f951f78
commit c0fba4d1be
2 changed files with 10 additions and 18 deletions

View File

@ -440,7 +440,6 @@ protected:
int m_lineHeight; int m_lineHeight;
wxPen m_dottedPen; wxPen m_dottedPen;
wxBrush *m_hilightBrush; wxBrush *m_hilightBrush;
wxBrush *m_normalBrush;
wxImageList *m_imageListNormal, wxImageList *m_imageListNormal,
*m_imageListState; *m_imageListState;
int m_dragCount; int m_dragCount;

View File

@ -558,11 +558,6 @@ void wxTreeCtrl::Init()
wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHT), wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHT),
wxSOLID wxSOLID
); );
m_normalBrush = new wxBrush
(
wxSystemSettings::GetSystemColour(wxSYS_COLOUR_LISTBOX),
wxSOLID
);
m_imageListNormal = m_imageListNormal =
m_imageListState = (wxImageList *) NULL; m_imageListState = (wxImageList *) NULL;
@ -603,7 +598,6 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id,
wxTreeCtrl::~wxTreeCtrl() wxTreeCtrl::~wxTreeCtrl()
{ {
wxDELETE( m_hilightBrush ); wxDELETE( m_hilightBrush );
wxDELETE( m_normalBrush );
DeleteAllItems(); DeleteAllItems();
@ -1537,12 +1531,17 @@ void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
int total_h = GetLineHeight(item); int total_h = GetLineHeight(item);
wxColour colBg; if (item->IsSelected())
if ( attr && attr->HasBackgroundColour() ) dc.SetBrush(*m_hilightBrush);
colBg = attr->GetBackgroundColour();
else else
colBg = m_backgroundColour; {
dc.SetBrush(wxBrush(colBg, wxSOLID)); wxColour colBg;
if ( attr && attr->HasBackgroundColour() )
colBg = attr->GetBackgroundColour();
else
colBg = m_backgroundColour;
dc.SetBrush(wxBrush(colBg, wxSOLID));
}
dc.DrawRectangle( item->GetX()-2, item->GetY(), item->GetWidth()+2, total_h ); dc.DrawRectangle( item->GetX()-2, item->GetY(), item->GetWidth()+2, total_h );
@ -1606,15 +1605,12 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
} }
wxPen *pen = wxTRANSPARENT_PEN; wxPen *pen = wxTRANSPARENT_PEN;
wxBrush *brush; // FIXME is this really needed?
wxColour colText; wxColour colText;
if ( item->IsSelected() ) if ( item->IsSelected() )
{ {
colText = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ); colText = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT );
brush = m_hilightBrush;
if ( m_hasFocus ) if ( m_hasFocus )
pen = wxBLACK_PEN; pen = wxBLACK_PEN;
@ -1626,14 +1622,11 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int &
colText = attr->GetTextColour(); colText = attr->GetTextColour();
else else
colText = *wxBLACK; colText = *wxBLACK;
brush = m_normalBrush;
} }
// prepare to draw // prepare to draw
dc.SetTextForeground(colText); dc.SetTextForeground(colText);
dc.SetPen(*pen); dc.SetPen(*pen);
dc.SetBrush(*brush);
// draw // draw
PaintItem(item, dc); PaintItem(item, dc);