Generic tree control fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
941830cbe5
commit
233058c7ab
@ -13,7 +13,7 @@
|
||||
#define _GENERIC_TREECTRL_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "treectrg.h"
|
||||
#pragma interface "treectlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
@ -394,5 +394,32 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericTreeCtrl)
|
||||
};
|
||||
|
||||
#if !defined(__WXMSW__) || defined(__WIN16__)
|
||||
/*
|
||||
* wxTreeCtrl has to be a real class or we have problems with
|
||||
* the run-time information.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxTreeCtrl: public wxGenericTreeCtrl
|
||||
{
|
||||
public:
|
||||
DECLARE_DYNAMIC_CLASS(wxTreeCtrl)
|
||||
|
||||
wxTreeCtrl() {}
|
||||
|
||||
wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
|
||||
const wxValidator &validator = wxDefaultValidator,
|
||||
const wxString& name = wxTreeCtrlNameStr)
|
||||
{
|
||||
Create(parent, id, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _GENERIC_TREECTRL_H_
|
||||
|
||||
|
@ -27,10 +27,12 @@
|
||||
#include "wx/generic/treectlg.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if !defined(__WXMSW__)
|
||||
#define wxTreeCtrl wxGenericTreeCtrl
|
||||
#define sm_classwxTreeCtrl sm_classwxGenericTreeCtrl
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
||||
// _WX_TREECTRL_H_BASE_
|
||||
|
@ -215,7 +215,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
|
||||
|
||||
m_treeCtrl = new MyTreeCtrl(this, TreeTest_Ctrl,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS |
|
||||
wxTR_HAS_BUTTONS | // wxTR_NO_LINES |
|
||||
wxTR_EDIT_LABELS |
|
||||
#ifndef NO_VARIABLE_HEIGHT
|
||||
wxTR_HAS_VARIABLE_ROW_HEIGHT |
|
||||
|
@ -580,6 +580,15 @@ BEGIN_EVENT_TABLE(wxGenericTreeCtrl,wxScrolledWindow)
|
||||
EVT_IDLE (wxGenericTreeCtrl::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#if !defined(__WXMSW__) || defined(__WIN16__)
|
||||
/*
|
||||
* wxTreeCtrl has to be a real class or we have problems with
|
||||
* the run-time information.
|
||||
*/
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxGenericTreeCtrl)
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// construction/destruction
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -1687,6 +1696,8 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
|
||||
int exposed_x = dc.LogicalToDeviceX( 0 );
|
||||
int exposed_y = dc.LogicalToDeviceY( item->GetY() );
|
||||
|
||||
bool drawLines = ((GetWindowStyle() & wxTR_NO_LINES) == 0);
|
||||
|
||||
if (IsExposed( exposed_x, exposed_y, 10000, GetLineHeight(item) )) // 10000 = very much
|
||||
{
|
||||
int startX = horizX;
|
||||
@ -1695,11 +1706,13 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
|
||||
// if (!item->HasChildren()) endX += (m_indent+5);
|
||||
if (!item->HasChildren()) endX += 20;
|
||||
|
||||
dc.DrawLine( startX, y, endX, y );
|
||||
if (drawLines)
|
||||
dc.DrawLine( startX, y, endX, y );
|
||||
|
||||
if (item->HasPlus())
|
||||
{
|
||||
dc.DrawLine( horizX+(m_indent+5), y, horizX+(m_indent+15), y );
|
||||
if (drawLines)
|
||||
dc.DrawLine( horizX+(m_indent+5), y, horizX+(m_indent+15), y );
|
||||
dc.SetPen( *wxGREY_PEN );
|
||||
dc.SetBrush( *wxWHITE_BRUSH );
|
||||
dc.DrawRectangle( horizX+(m_indent-5), y-4, 11, 9 );
|
||||
@ -1766,7 +1779,8 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
|
||||
if (count > 0)
|
||||
{
|
||||
semiOldY+=GetLineHeight(children[--n])/2;
|
||||
dc.DrawLine( horizX+m_indent, oldY+5, horizX+m_indent, semiOldY );
|
||||
if (drawLines)
|
||||
dc.DrawLine( horizX+m_indent, oldY+5, horizX+m_indent, semiOldY );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user