Use wxBrush objects instead of pointers in wxGenericTreeCtrl
There is no need for double indirection, wxBrush object is already pointer-like internally. No real changes, just simplify/optimize the code a little.
This commit is contained in:
@@ -13,8 +13,9 @@
|
|||||||
|
|
||||||
#if wxUSE_TREECTRL
|
#if wxUSE_TREECTRL
|
||||||
|
|
||||||
#include "wx/scrolwin.h"
|
#include "wx/brush.h"
|
||||||
#include "wx/pen.h"
|
#include "wx/pen.h"
|
||||||
|
#include "wx/scrolwin.h"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// forward declaration
|
// forward declaration
|
||||||
@@ -243,8 +244,8 @@ protected:
|
|||||||
unsigned short m_indent;
|
unsigned short m_indent;
|
||||||
int m_lineHeight;
|
int m_lineHeight;
|
||||||
wxPen m_dottedPen;
|
wxPen m_dottedPen;
|
||||||
wxBrush *m_hilightBrush,
|
wxBrush m_hilightBrush,
|
||||||
*m_hilightUnfocusedBrush;
|
m_hilightUnfocusedBrush;
|
||||||
bool m_hasFocus;
|
bool m_hasFocus;
|
||||||
bool m_dirty;
|
bool m_dirty;
|
||||||
bool m_ownsImageListButtons;
|
bool m_ownsImageListButtons;
|
||||||
|
@@ -937,8 +937,6 @@ void wxGenericTreeCtrl::Init()
|
|||||||
m_indent = 15;
|
m_indent = 15;
|
||||||
m_spacing = 18;
|
m_spacing = 18;
|
||||||
|
|
||||||
m_hilightBrush = NULL;
|
|
||||||
m_hilightUnfocusedBrush = NULL;
|
|
||||||
m_imageListButtons = NULL;
|
m_imageListButtons = NULL;
|
||||||
m_ownsImageListButtons = false;
|
m_ownsImageListButtons = false;
|
||||||
|
|
||||||
@@ -995,9 +993,6 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxGenericTreeCtrl::~wxGenericTreeCtrl()
|
wxGenericTreeCtrl::~wxGenericTreeCtrl()
|
||||||
{
|
{
|
||||||
delete m_hilightBrush;
|
|
||||||
delete m_hilightUnfocusedBrush;
|
|
||||||
|
|
||||||
DeleteAllItems();
|
DeleteAllItems();
|
||||||
|
|
||||||
delete m_renameTimer;
|
delete m_renameTimer;
|
||||||
@@ -1020,10 +1015,8 @@ void wxGenericTreeCtrl::OnSysColourChanged(wxSysColourChangedEvent&)
|
|||||||
if (!m_hasExplicitFont)
|
if (!m_hasExplicitFont)
|
||||||
SetOwnFont(attr.font);
|
SetOwnFont(attr.font);
|
||||||
|
|
||||||
delete m_hilightBrush;
|
m_hilightBrush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
||||||
m_hilightBrush = new wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
m_hilightUnfocusedBrush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
|
||||||
delete m_hilightUnfocusedBrush;
|
|
||||||
m_hilightUnfocusedBrush = new wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
|
|
||||||
|
|
||||||
m_dottedPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), 1, wxPENSTYLE_DOT);
|
m_dottedPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), 1, wxPENSTYLE_DOT);
|
||||||
|
|
||||||
@@ -2544,7 +2537,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
|
|||||||
|
|
||||||
if ( item->IsSelected() )
|
if ( item->IsSelected() )
|
||||||
{
|
{
|
||||||
dc.SetBrush(*(m_hasFocus ? m_hilightBrush : m_hilightUnfocusedBrush));
|
dc.SetBrush(m_hasFocus ? m_hilightBrush : m_hilightUnfocusedBrush);
|
||||||
drawItemBackground = true;
|
drawItemBackground = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user