X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f0bc6afbbd36e1f75ef22bedb9cb2e3abc2b7b64..8e1a5bf979fcdf82238b20cda1209a4f67f394c0:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index c6d79cde38..fa66da1ac6 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: treectlg.cpp +// Name: src/generic/treectlg.cpp // Purpose: generic tree control implementation // Author: Robert Roebling // Created: 01/02/97 @@ -26,14 +26,17 @@ #if wxUSE_TREECTRL -#include "wx/treebase.h" #include "wx/treectrl.h" + +#ifndef WX_PRECOMP + #include "wx/dcclient.h" + #include "wx/timer.h" + #include "wx/settings.h" +#endif + #include "wx/generic/treectlg.h" -#include "wx/timer.h" #include "wx/textctrl.h" #include "wx/imaglist.h" -#include "wx/settings.h" -#include "wx/dcclient.h" #include "wx/renderer.h" @@ -199,9 +202,9 @@ public: wxGenericTreeItem *GetParent() const { return m_parent; } // operations - // deletes all children notifying the treectrl about it if !NULL - // pointer given - void DeleteChildren(wxGenericTreeCtrl *tree = NULL); + + // deletes all children notifying the treectrl about it + void DeleteChildren(wxGenericTreeCtrl *tree); // get count of all children (and grand children if 'recursively') size_t GetChildrenCount(bool recursively = true) const; @@ -548,11 +551,10 @@ void wxGenericTreeItem::DeleteChildren(wxGenericTreeCtrl *tree) for ( size_t n = 0; n < count; n++ ) { wxGenericTreeItem *child = m_children[n]; - if (tree) - tree->SendDeleteEvent(child); + tree->SendDeleteEvent(child); child->DeleteChildren(tree); - if (child == tree->m_select_me) + if ( child == tree->m_select_me ) tree->m_select_me = NULL; delete child; } @@ -864,7 +866,7 @@ wxGenericTreeCtrl::~wxGenericTreeCtrl() // accessors // ----------------------------------------------------------------------------- -size_t wxGenericTreeCtrl::GetCount() const +unsigned int wxGenericTreeCtrl::GetCount() const { if ( !m_anchor ) { @@ -872,7 +874,7 @@ size_t wxGenericTreeCtrl::GetCount() const return 0; } - size_t count = m_anchor->GetChildrenCount(); + unsigned int count = m_anchor->GetChildrenCount(); if ( !HasFlag(wxTR_HIDE_ROOT) ) { // take the root itself into account @@ -2324,7 +2326,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level if (IsExposed(exposed_x, exposed_y, 10000, h)) // 10000 = very much { - wxPen *pen = + const wxPen *pen = #ifndef __WXMAC__ // don't draw rect outline if we already have the // background color under Mac @@ -2888,12 +2890,9 @@ bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item, wxGenericTreeItem *i = (wxGenericTreeItem*) item.m_pItem; - int startX, startY; - GetViewStart(& startX, & startY); - if ( textOnly ) { - rect.x = i->GetX() - startX*PIXELS_PER_UNIT; + rect.x = i->GetX(); rect.width = i->GetWidth(); if ( m_imageListNormal ) @@ -2909,9 +2908,12 @@ bool wxGenericTreeCtrl::GetBoundingRect(const wxTreeItemId& item, rect.width = GetClientSize().x; } - rect.y = i->GetY() - startY*PIXELS_PER_UNIT; + rect.y = i->GetY(); rect.height = GetLineHeight(i); + // we have to return the logical coordinates, not physical ones + rect.SetTopLeft(CalcScrolledPosition(rect.GetTopLeft())); + return true; }