applied patch that adds wxTR_FULL_ROW_HIGHLIGHT to wxTreeCtrl
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13046 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,6 +32,10 @@ If both wxTR\_HAS\_BUTTONS and wxTR\_TWIST\_BUTTONS are given,
|
|||||||
twister buttons are generated. Generic only.}
|
twister buttons are generated. Generic only.}
|
||||||
\twocolitem{\windowstyle{wxTR\_NO\_LINES}}{Use this style
|
\twocolitem{\windowstyle{wxTR\_NO\_LINES}}{Use this style
|
||||||
to hide vertical level connectors.}
|
to hide vertical level connectors.}
|
||||||
|
\twocolitem{\windowstyle{wxTR\_FULL\_ROW\_HIGHLIGHT}}{Use this style to have the background
|
||||||
|
colour and the selection highlight extend over the entire horizontal
|
||||||
|
row of the tree control window. (This flag is ignored under Windows unless you
|
||||||
|
specified wxTR\_NO\_LINES as well.) }
|
||||||
\twocolitem{\windowstyle{wxTR\_LINES\_AT\_ROOT}}{Use this style
|
\twocolitem{\windowstyle{wxTR\_LINES\_AT\_ROOT}}{Use this style
|
||||||
to show lines between root nodes.
|
to show lines between root nodes.
|
||||||
Only applicable if wxTR\_HIDE\_ROOT is set and wxTR\_NO\_LINES is not set.}
|
Only applicable if wxTR\_HIDE\_ROOT is set and wxTR\_NO\_LINES is not set.}
|
||||||
|
@@ -125,6 +125,7 @@ enum wxTreeItemIcon
|
|||||||
#define wxTR_SINGLE 0x0000 // for convenience
|
#define wxTR_SINGLE 0x0000 // for convenience
|
||||||
#define wxTR_MULTIPLE 0x0020 // can select multiple items
|
#define wxTR_MULTIPLE 0x0020 // can select multiple items
|
||||||
#define wxTR_EXTENDED 0x0040 // TODO: allow extended selection
|
#define wxTR_EXTENDED 0x0040 // TODO: allow extended selection
|
||||||
|
#define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horizontal space
|
||||||
|
|
||||||
#define wxTR_EDIT_LABELS 0x0200 // can edit item labels
|
#define wxTR_EDIT_LABELS 0x0200 // can edit item labels
|
||||||
#define wxTR_ROW_LINES 0x0400 // put border around items
|
#define wxTR_ROW_LINES 0x0400 // put border around items
|
||||||
|
@@ -1883,6 +1883,16 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
|
|||||||
|
|
||||||
int offset = HasFlag(wxTR_ROW_LINES) ? 1 : 0;
|
int offset = HasFlag(wxTR_ROW_LINES) ? 1 : 0;
|
||||||
|
|
||||||
|
if ( HasFlag(wxTR_FULL_ROW_HIGHLIGHT) )
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
|
||||||
|
DoGetPosition(&x, &y);
|
||||||
|
DoGetSize(&w, &h);
|
||||||
|
dc.DrawRectangle(x, item->GetY()+offset, w, total_h-offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if ( item->IsSelected() && image != NO_IMAGE )
|
if ( item->IsSelected() && image != NO_IMAGE )
|
||||||
{
|
{
|
||||||
// If it's selected, and there's an image, then we should
|
// If it's selected, and there's an image, then we should
|
||||||
@@ -1896,6 +1906,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
|
|||||||
dc.DrawRectangle( item->GetX()-2, item->GetY()+offset,
|
dc.DrawRectangle( item->GetX()-2, item->GetY()+offset,
|
||||||
item->GetWidth()+2, total_h-offset );
|
item->GetWidth()+2, total_h-offset );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( image != NO_IMAGE )
|
if ( image != NO_IMAGE )
|
||||||
{
|
{
|
||||||
@@ -1963,6 +1974,50 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
|
|||||||
|
|
||||||
if (IsExposed(exposed_x, exposed_y, 10000, h)) // 10000 = very much
|
if (IsExposed(exposed_x, exposed_y, 10000, h)) // 10000 = very much
|
||||||
{
|
{
|
||||||
|
wxPen *pen =
|
||||||
|
#ifndef __WXMAC__
|
||||||
|
// don't draw rect outline if we already have the
|
||||||
|
// background color under Mac
|
||||||
|
(item->IsSelected() && m_hasFocus) ? wxBLACK_PEN :
|
||||||
|
#endif // !__WXMAC__
|
||||||
|
wxTRANSPARENT_PEN;
|
||||||
|
|
||||||
|
wxColour colText;
|
||||||
|
if ( item->IsSelected() )
|
||||||
|
{
|
||||||
|
colText = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxTreeItemAttr *attr = item->GetAttributes();
|
||||||
|
if (attr && attr->HasTextColour())
|
||||||
|
colText = attr->GetTextColour();
|
||||||
|
else
|
||||||
|
colText = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOWTEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepare to draw
|
||||||
|
dc.SetTextForeground(colText);
|
||||||
|
dc.SetPen(*pen);
|
||||||
|
|
||||||
|
// draw
|
||||||
|
PaintItem(item, dc);
|
||||||
|
|
||||||
|
if (HasFlag(wxTR_ROW_LINES))
|
||||||
|
{
|
||||||
|
// if the background colour is white, choose a
|
||||||
|
// contrasting color for the lines
|
||||||
|
dc.SetPen(*((GetBackgroundColour() == *wxWHITE)
|
||||||
|
? wxMEDIUM_GREY_PEN : wxWHITE_PEN));
|
||||||
|
dc.DrawLine(0, y_top, 10000, y_top);
|
||||||
|
dc.DrawLine(0, y, 10000, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// restore DC objects
|
||||||
|
dc.SetBrush(*wxWHITE_BRUSH);
|
||||||
|
dc.SetPen(m_dottedPen);
|
||||||
|
dc.SetTextForeground(*wxBLACK);
|
||||||
|
|
||||||
if (item->HasPlus() && HasButtons()) // should the item show a button?
|
if (item->HasPlus() && HasButtons()) // should the item show a button?
|
||||||
{
|
{
|
||||||
if (!HasFlag(wxTR_NO_LINES))
|
if (!HasFlag(wxTR_NO_LINES))
|
||||||
@@ -2069,50 +2124,6 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
|
|||||||
x_start = 3;
|
x_start = 3;
|
||||||
dc.DrawLine(x_start, y_mid, x + m_spacing, y_mid);
|
dc.DrawLine(x_start, y_mid, x + m_spacing, y_mid);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen *pen =
|
|
||||||
#ifndef __WXMAC__
|
|
||||||
// don't draw rect outline if we already have the
|
|
||||||
// background color under Mac
|
|
||||||
(item->IsSelected() && m_hasFocus) ? wxBLACK_PEN :
|
|
||||||
#endif // !__WXMAC__
|
|
||||||
wxTRANSPARENT_PEN;
|
|
||||||
|
|
||||||
wxColour colText;
|
|
||||||
if ( item->IsSelected() )
|
|
||||||
{
|
|
||||||
colText = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxTreeItemAttr *attr = item->GetAttributes();
|
|
||||||
if (attr && attr->HasTextColour())
|
|
||||||
colText = attr->GetTextColour();
|
|
||||||
else
|
|
||||||
colText = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOWTEXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// prepare to draw
|
|
||||||
dc.SetTextForeground(colText);
|
|
||||||
dc.SetPen(*pen);
|
|
||||||
|
|
||||||
// draw
|
|
||||||
PaintItem(item, dc);
|
|
||||||
|
|
||||||
if (HasFlag(wxTR_ROW_LINES))
|
|
||||||
{
|
|
||||||
// if the background colour is white, choose a
|
|
||||||
// contrasting color for the lines
|
|
||||||
dc.SetPen(*((GetBackgroundColour() == *wxWHITE)
|
|
||||||
? wxMEDIUM_GREY_PEN : wxWHITE_PEN));
|
|
||||||
dc.DrawLine(0, y_top, 10000, y_top);
|
|
||||||
dc.DrawLine(0, y, 10000, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// restore DC objects
|
|
||||||
dc.SetBrush(*wxWHITE_BRUSH);
|
|
||||||
dc.SetPen(m_dottedPen);
|
|
||||||
dc.SetTextForeground(*wxBLACK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->IsExpanded())
|
if (item->IsExpanded())
|
||||||
|
@@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
|
|
||||||
|
#include "wx/app.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/dynarray.h"
|
#include "wx/dynarray.h"
|
||||||
#include "wx/imaglist.h"
|
#include "wx/imaglist.h"
|
||||||
@@ -547,6 +548,13 @@ bool wxTreeCtrl::Create(wxWindow *parent,
|
|||||||
if ( m_windowStyle & wxTR_LINES_AT_ROOT )
|
if ( m_windowStyle & wxTR_LINES_AT_ROOT )
|
||||||
wstyle |= TVS_LINESATROOT;
|
wstyle |= TVS_LINESATROOT;
|
||||||
|
|
||||||
|
if ( m_windowStyle & wxTR_FULL_ROW_HIGHLIGHT )
|
||||||
|
{
|
||||||
|
if ( wxTheApp->GetComCtl32Version() >= 471 )
|
||||||
|
wstyle |= TVS_FULLROWSELECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// using TVS_CHECKBOXES for emulation of a multiselection tree control
|
// using TVS_CHECKBOXES for emulation of a multiselection tree control
|
||||||
// doesn't work without the new enough headers
|
// doesn't work without the new enough headers
|
||||||
#if wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE && \
|
#if wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE && \
|
||||||
|
Reference in New Issue
Block a user