X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be5a51fb592f3fa2ba38ac6cd1e488d6d806058c..582ca3535a3680817ec4448141437eb2812df090:/contrib/src/gizmos/splittree.cpp diff --git a/contrib/src/gizmos/splittree.cpp b/contrib/src/gizmos/splittree.cpp index 6ce95b5552..0eaed896c2 100644 --- a/contrib/src/gizmos/splittree.cpp +++ b/contrib/src/gizmos/splittree.cpp @@ -18,9 +18,6 @@ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "splittree.h" -#endif // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" @@ -60,8 +57,8 @@ BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxTreeCtrl) #endif EVT_SIZE(wxRemotelyScrolledTreeCtrl::OnSize) EVT_PAINT(wxRemotelyScrolledTreeCtrl::OnPaint) - EVT_TREE_ITEM_EXPANDED(-1, wxRemotelyScrolledTreeCtrl::OnExpand) - EVT_TREE_ITEM_COLLAPSED(-1, wxRemotelyScrolledTreeCtrl::OnExpand) + EVT_TREE_ITEM_EXPANDED(wxID_ANY, wxRemotelyScrolledTreeCtrl::OnExpand) + EVT_TREE_ITEM_COLLAPSED(wxID_ANY, wxRemotelyScrolledTreeCtrl::OnExpand) EVT_SCROLLWIN(wxRemotelyScrolledTreeCtrl::OnScroll) END_EVENT_TABLE() @@ -90,7 +87,7 @@ void wxRemotelyScrolledTreeCtrl::HideVScrollbar() if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) #endif { - ::ShowScrollBar((HWND) GetHWND(), SB_VERT, FALSE); + ::ShowScrollBar((HWND) GetHWND(), SB_VERT, false); } #if USE_GENERIC_TREECTRL else @@ -122,7 +119,7 @@ void wxRemotelyScrolledTreeCtrl::SetScrollbars( if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; - win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ TRUE); + win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ true); wxScrolledWindow* scrolledWindow = GetScrolledWindow(); if (scrolledWindow) @@ -144,8 +141,8 @@ int wxRemotelyScrolledTreeCtrl::GetScrollPos( { #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - // this condition fixes extsitence of warning but - wxScrolledWindow* scrolledWindow = + // this condition fixes extsitence of warning but + wxScrolledWindow* scrolledWindow = // but GetScrolledWindow is still executed in case internally does something #endif GetScrolledWindow(); @@ -197,7 +194,7 @@ void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const } // In case we're using the generic tree control. -void wxRemotelyScrolledTreeCtrl::PrepareDC( +void wxRemotelyScrolledTreeCtrl::PrepareDC( #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) wxDC& dc #else @@ -232,7 +229,7 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer #ifdef __WXMSW__ #if USE_GENERIC_TREECTRL if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) -#endif +#endif // USE_GENERIC_TREECTRL { UINT sbCode = SB_THUMBPOSITION; HWND vertScrollBar = 0; @@ -240,8 +237,8 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer } #if USE_GENERIC_TREECTRL else -#endif -#endif +#endif // USE_GENERIC_TREECTRL +#endif // __WXMSW__ #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; @@ -256,7 +253,8 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer } */ } -#endif +#endif // USE_GENERIC_TREECTRL || !defined(__WXMSW__) + wxUnusedVar(posVert); } void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event) @@ -299,7 +297,9 @@ void wxRemotelyScrolledTreeCtrl::OnPaint(wxPaintEvent& event) wxSize clientSize = GetClientSize(); wxRect itemRect; wxTreeItemId h, lastH; - for(h=GetFirstVisibleItem();h;h=GetNextVisible(h)) + for (h=GetFirstVisibleItem(); + h.IsOk(); + h=GetNextVisible(h)) { if (GetBoundingRect(h, itemRect)) { @@ -307,6 +307,8 @@ void wxRemotelyScrolledTreeCtrl::OnPaint(wxPaintEvent& event) dc.DrawLine(0, cy, clientSize.x, cy); lastH = h; } + if (! IsVisible(h)) + break; } if (lastH.IsOk() && GetBoundingRect(lastH, itemRect)) { @@ -508,7 +510,9 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) wxSize clientSize = GetClientSize(); wxRect itemRect; wxTreeItemId h, lastH; - for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h)) + for (h=m_treeCtrl->GetFirstVisibleItem(); + h.IsOk(); + h=m_treeCtrl->GetNextVisible(h)) { if (m_treeCtrl->GetBoundingRect(h, itemRect)) { @@ -521,6 +525,8 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) DrawItem(dc, h, drawItemRect); dc.DrawLine(0, cy, clientSize.x, cy); } + if (! m_treeCtrl->IsVisible(h)) + break; } if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect)) { @@ -541,7 +547,7 @@ void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event) return; // TODO: scroll the window physically instead of just refreshing. - Refresh(TRUE); + Refresh(true); } void wxTreeCompanionWindow::OnExpand(wxTreeEvent& WXUNUSED(event)) @@ -674,37 +680,37 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event) { // Ensure that events being propagated back up the window hierarchy // don't cause an infinite loop - static bool inOnScroll = FALSE; + static bool inOnScroll = false; if (inOnScroll) { event.Skip(); return; } - inOnScroll = TRUE; + inOnScroll = true; int orient = event.GetOrientation(); int nScrollInc = CalcScrollInc(event); if (nScrollInc == 0) { - inOnScroll = FALSE; + inOnScroll = false; return; } if (orient == wxHORIZONTAL) { - inOnScroll = FALSE; + inOnScroll = false; event.Skip(); return; #if 0 int newPos = m_xScrollPosition + nScrollInc; - SetScrollPos(wxHORIZONTAL, newPos, TRUE ); + SetScrollPos(wxHORIZONTAL, newPos, true ); #endif } else { int newPos = m_yScrollPosition + nScrollInc; - SetScrollPos(wxVERTICAL, newPos, TRUE ); + SetScrollPos(wxVERTICAL, newPos, true ); } if (orient == wxHORIZONTAL) @@ -735,6 +741,5 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event) m_targetWindow->Update() ; - inOnScroll = FALSE; + inOnScroll = false; } -