X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f89d65ea8d5f480a0d5cbffe83604fd49a6a2137..f925e7b4f3d017b33749bd23a64592c1985e8f98:/src/generic/treectlg.cpp?ds=sidebyside diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 609aa9d5a4..24dec8e4cb 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -681,7 +681,7 @@ BEGIN_EVENT_TABLE(wxGenericTreeCtrl,wxScrolledWindow) EVT_TREE_ITEM_GETTOOLTIP(-1, wxGenericTreeCtrl::OnGetToolTip) END_EVENT_TABLE() -#if !defined(__WXMSW__) || defined(__WIN16__) || defined(__WXUNIVERSAL__) +#if !defined(__WXMSW__) || defined(__WXUNIVERSAL__) /* * wxTreeCtrl has to be a real class or we have problems with * the run-time information. @@ -734,6 +734,8 @@ void wxGenericTreeCtrl::Init() m_textCtrl = NULL; m_renameTimer = NULL; + m_freezeCount = 0; + m_findTimer = NULL; m_lastOnSame = FALSE; @@ -834,7 +836,9 @@ void wxGenericTreeCtrl::SetSpacing(unsigned int spacing) m_dirty = TRUE; } -size_t wxGenericTreeCtrl::GetChildrenCount(const wxTreeItemId& item, bool recursively) +size_t +wxGenericTreeCtrl::GetChildrenCount(const wxTreeItemId& item, + bool recursively) const { wxCHECK_MSG( item.IsOk(), 0u, wxT("invalid tree item") ); @@ -2904,7 +2908,9 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) int flags = 0; wxGenericTreeItem *thisItem = m_anchor->HitTest(pt, this, flags, 0); wxGenericTreeItem *underMouse = thisItem; +#if wxUSE_TOOLTIPS bool underMouseChanged = (underMouse != m_underMouse) ; +#endif // wxUSE_TOOLTIPS if ((underMouse) && (flags & wxTREE_HITTEST_ONITEMBUTTON) && @@ -3217,7 +3223,8 @@ void wxGenericTreeCtrl::OnInternalIdle() * we actually redraw the tree when everything is over */ if (!m_dirty) return; - + if (m_freezeCount) return; + m_dirty = FALSE; CalculatePositions(); @@ -3328,6 +3335,7 @@ void wxGenericTreeCtrl::CalculatePositions() void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item) { if (m_dirty) return; + if (m_freezeCount) return; wxSize client = GetClientSize(); @@ -3344,6 +3352,7 @@ void wxGenericTreeCtrl::RefreshSubtree(wxGenericTreeItem *item) void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item ) { if (m_dirty) return; + if (m_freezeCount) return; wxRect rect; CalcScrolledPosition(0, item->GetY(), NULL, &rect.y); @@ -3355,6 +3364,8 @@ void wxGenericTreeCtrl::RefreshLine( wxGenericTreeItem *item ) void wxGenericTreeCtrl::RefreshSelected() { + if (m_freezeCount) return; + // TODO: this is awfully inefficient, we should keep the list of all // selected items internally, should be much faster if ( m_anchor ) @@ -3363,6 +3374,8 @@ void wxGenericTreeCtrl::RefreshSelected() void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item) { + if (m_freezeCount) return; + if ( item->IsSelected() ) RefreshLine(item); @@ -3374,6 +3387,21 @@ void wxGenericTreeCtrl::RefreshSelectedUnder(wxGenericTreeItem *item) } } +void wxGenericTreeCtrl::Freeze() +{ + m_freezeCount++; +} + +void wxGenericTreeCtrl::Thaw() +{ + wxCHECK_RET( m_freezeCount > 0, _T("thawing unfrozen tree control?") ); + + if ( !--m_freezeCount ) + { + Refresh(); + } +} + // ---------------------------------------------------------------------------- // changing colours: we need to refresh the tree control // ---------------------------------------------------------------------------- @@ -3383,6 +3411,8 @@ bool wxGenericTreeCtrl::SetBackgroundColour(const wxColour& colour) if ( !wxWindow::SetBackgroundColour(colour) ) return FALSE; + if (m_freezeCount) return TRUE; + Refresh(); return TRUE; @@ -3393,6 +3423,8 @@ bool wxGenericTreeCtrl::SetForegroundColour(const wxColour& colour) if ( !wxWindow::SetForegroundColour(colour) ) return FALSE; + if (m_freezeCount) return TRUE; + Refresh(); return TRUE;