projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed setting selection when there are NULL pages in the tree
[wxWidgets.git]
/
contrib
/
src
/
gizmos
/
splittree.cpp
diff --git
a/contrib/src/gizmos/splittree.cpp
b/contrib/src/gizmos/splittree.cpp
index 1c9449bd8851700de305714cb67bec5ac3be844b..0eaed896c243caef4188feebe72157f32e6745bc 100644
(file)
--- a/
contrib/src/gizmos/splittree.cpp
+++ b/
contrib/src/gizmos/splittree.cpp
@@
-18,9
+18,6
@@
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
- #pragma implementation "splittree.h"
-#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
@@
-30,7
+27,7
@@
#endif
// for all others, include the necessary headers (this file is usually all you
#endif
// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWi
ndow
s headers)
+// need because it includes almost all "standard" wxWi
dget
s headers)
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
@@
-60,8
+57,8
@@
BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxTreeCtrl)
#endif
EVT_SIZE(wxRemotelyScrolledTreeCtrl::OnSize)
EVT_PAINT(wxRemotelyScrolledTreeCtrl::OnPaint)
#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()
EVT_SCROLLWIN(wxRemotelyScrolledTreeCtrl::OnScroll)
END_EVENT_TABLE()
@@
-90,7
+87,7
@@
void wxRemotelyScrolledTreeCtrl::HideVScrollbar()
if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
#endif
{
if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
#endif
{
- ::ShowScrollBar((HWND) GetHWND(), SB_VERT,
FALSE
);
+ ::ShowScrollBar((HWND) GetHWND(), SB_VERT,
false
);
}
#if USE_GENERIC_TREECTRL
else
}
#if USE_GENERIC_TREECTRL
else
@@
-104,16
+101,25
@@
void wxRemotelyScrolledTreeCtrl::HideVScrollbar()
// Number of pixels per user unit (0 or -1 for no scrollbar)
// Length of virtual canvas in user units
// Length of page in user units
// Number of pixels per user unit (0 or -1 for no scrollbar)
// Length of virtual canvas in user units
// Length of page in user units
-void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
+void wxRemotelyScrolledTreeCtrl::SetScrollbars(
+ #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+ int pixelsPerUnitX, int pixelsPerUnitY,
int noUnitsX, int noUnitsY,
int xPos, int yPos,
int noUnitsX, int noUnitsY,
int xPos, int yPos,
- bool noRefresh)
+ bool noRefresh
+ #else
+ int WXUNUSED(pixelsPerUnitX), int WXUNUSED(pixelsPerUnitY),
+ int WXUNUSED(noUnitsX), int WXUNUSED(noUnitsY),
+ int WXUNUSED(xPos), int WXUNUSED(yPos),
+ bool WXUNUSED(noRefresh)
+ #endif
+ )
{
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
{
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
{
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
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)
wxScrolledWindow* scrolledWindow = GetScrolledWindow();
if (scrolledWindow)
@@
-125,9
+131,21
@@
void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPer
}
// In case we're using the generic tree control.
}
// In case we're using the generic tree control.
-int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const
+int wxRemotelyScrolledTreeCtrl::GetScrollPos(
+ #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+ int orient
+ #else
+ int WXUNUSED(orient)
+ #endif
+ ) const
{
{
- wxScrolledWindow* scrolledWindow = GetScrolledWindow();
+
+#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+ // this condition fixes extsitence of warning but
+ wxScrolledWindow* scrolledWindow =
+ // but GetScrolledWindow is still executed in case internally does something
+#endif
+ GetScrolledWindow();
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
@@
-176,7
+194,13
@@
void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const
}
// In case we're using the generic tree control.
}
// In case we're using the generic tree control.
-void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc)
+void wxRemotelyScrolledTreeCtrl::PrepareDC(
+ #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+ wxDC& dc
+ #else
+ wxDC& WXUNUSED(dc)
+ #endif
+ )
{
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
{
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
@@
-200,21
+224,21
@@
void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc)
// Scroll to the given line (in scroll units where each unit is
// the height of an item)
// Scroll to the given line (in scroll units where each unit is
// the height of an item)
-void wxRemotelyScrolledTreeCtrl::ScrollToLine(int
posHoriz
, int posVert)
+void wxRemotelyScrolledTreeCtrl::ScrollToLine(int
WXUNUSED(posHoriz)
, int posVert)
{
#ifdef __WXMSW__
#if USE_GENERIC_TREECTRL
if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
{
#ifdef __WXMSW__
#if USE_GENERIC_TREECTRL
if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
-#endif
+#endif
// USE_GENERIC_TREECTRL
{
UINT sbCode = SB_THUMBPOSITION;
HWND vertScrollBar = 0;
{
UINT sbCode = SB_THUMBPOSITION;
HWND vertScrollBar = 0;
- MSWDefWindowProc((WXUINT) WM_VSCROLL, MAKELONG(sbCode, posVert), (WX
HWND
) vertScrollBar);
+ MSWDefWindowProc((WXUINT) WM_VSCROLL, MAKELONG(sbCode, posVert), (WX
LPARAM
) vertScrollBar);
}
#if USE_GENERIC_TREECTRL
else
}
#if USE_GENERIC_TREECTRL
else
-#endif
-#endif
+#endif
// USE_GENERIC_TREECTRL
+#endif
// __WXMSW__
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
{
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
{
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
@@
-229,7
+253,8
@@
void wxRemotelyScrolledTreeCtrl::ScrollToLine(int posHoriz, int posVert)
}
*/
}
}
*/
}
-#endif
+#endif // USE_GENERIC_TREECTRL || !defined(__WXMSW__)
+ wxUnusedVar(posVert);
}
void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event)
}
void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event)
@@
-271,20
+296,23
@@
void wxRemotelyScrolledTreeCtrl::OnPaint(wxPaintEvent& event)
wxSize clientSize = GetClientSize();
wxRect itemRect;
wxSize clientSize = GetClientSize();
wxRect itemRect;
- int cy=0;
wxTreeItemId h, lastH;
wxTreeItemId h, lastH;
- for(h=GetFirstVisibleItem();h;h=GetNextVisible(h))
+ for (h=GetFirstVisibleItem();
+ h.IsOk();
+ h=GetNextVisible(h))
{
if (GetBoundingRect(h, itemRect))
{
{
if (GetBoundingRect(h, itemRect))
{
- cy = itemRect.GetTop();
+
int
cy = itemRect.GetTop();
dc.DrawLine(0, cy, clientSize.x, cy);
lastH = h;
}
dc.DrawLine(0, cy, clientSize.x, cy);
lastH = h;
}
+ if (! IsVisible(h))
+ break;
}
if (lastH.IsOk() && GetBoundingRect(lastH, itemRect))
{
}
if (lastH.IsOk() && GetBoundingRect(lastH, itemRect))
{
- cy = itemRect.GetBottom();
+
int
cy = itemRect.GetBottom();
dc.DrawLine(0, cy, clientSize.x, cy);
}
}
dc.DrawLine(0, cy, clientSize.x, cy);
}
}
@@
-383,7
+411,7
@@
void wxRemotelyScrolledTreeCtrl::CalcTreeSize(const wxTreeItemId& id, wxRect& re
wxTreeItemIdValue cookie;
wxTreeItemId childId = GetFirstChild(id, cookie);
wxTreeItemIdValue cookie;
wxTreeItemId childId = GetFirstChild(id, cookie);
- while (childId
!= 0
)
+ while (childId)
{
CalcTreeSize(childId, rect);
childId = GetNextChild(childId, cookie);
{
CalcTreeSize(childId, rect);
childId = GetNextChild(childId, cookie);
@@
-466,7
+494,7
@@
void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& re
#endif
}
#endif
}
-void wxTreeCompanionWindow::OnPaint(wxPaintEvent&
event
)
+void wxTreeCompanionWindow::OnPaint(wxPaintEvent&
WXUNUSED(event)
)
{
wxPaintDC dc(this);
{
wxPaintDC dc(this);
@@
-481,13
+509,14
@@
void wxTreeCompanionWindow::OnPaint(wxPaintEvent& event)
wxSize clientSize = GetClientSize();
wxRect itemRect;
wxSize clientSize = GetClientSize();
wxRect itemRect;
- int cy=0;
wxTreeItemId h, lastH;
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))
{
{
if (m_treeCtrl->GetBoundingRect(h, itemRect))
{
- cy = itemRect.GetTop();
+
int
cy = itemRect.GetTop();
wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight());
lastH = h;
wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight());
lastH = h;
@@
-496,10
+525,12
@@
void wxTreeCompanionWindow::OnPaint(wxPaintEvent& event)
DrawItem(dc, h, drawItemRect);
dc.DrawLine(0, cy, clientSize.x, cy);
}
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))
{
}
if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect))
{
- cy = itemRect.GetBottom();
+
int
cy = itemRect.GetBottom();
dc.DrawLine(0, cy, clientSize.x, cy);
}
}
dc.DrawLine(0, cy, clientSize.x, cy);
}
}
@@
-516,10
+547,10
@@
void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event)
return;
// TODO: scroll the window physically instead of just refreshing.
return;
// TODO: scroll the window physically instead of just refreshing.
- Refresh(
TRUE
);
+ Refresh(
true
);
}
}
-void wxTreeCompanionWindow::OnExpand(wxTreeEvent&
event
)
+void wxTreeCompanionWindow::OnExpand(wxTreeEvent&
WXUNUSED(event)
)
{
// TODO: something more optimized than simply refresh the whole
// window when the tree is expanded/collapsed. Tricky.
{
// TODO: something more optimized than simply refresh the whole
// window when the tree is expanded/collapsed. Tricky.
@@
-564,7
+595,7
@@
void wxThinSplitterWindow::SizeWindows()
}
// Tests for x, y over sash
}
// Tests for x, y over sash
-bool wxThinSplitterWindow::SashHitTest(int x, int y, int
tolerance
)
+bool wxThinSplitterWindow::SashHitTest(int x, int y, int
WXUNUSED(tolerance)
)
{
return wxSplitterWindow::SashHitTest(x, y, 4);
}
{
return wxSplitterWindow::SashHitTest(x, y, 4);
}
@@
-636,7
+667,7
@@
wxSplitterScrolledWindow::wxSplitterScrolledWindow(wxWindow* parent, wxWindowID
{
}
{
}
-void wxSplitterScrolledWindow::OnSize(wxSizeEvent&
event
)
+void wxSplitterScrolledWindow::OnSize(wxSizeEvent&
WXUNUSED(event)
)
{
wxSize sz = GetClientSize();
if (GetChildren().GetFirst())
{
wxSize sz = GetClientSize();
if (GetChildren().GetFirst())
@@
-649,37
+680,37
@@
void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
{
// Ensure that events being propagated back up the window hierarchy
// don't cause an infinite loop
{
// 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;
}
if (inOnScroll)
{
event.Skip();
return;
}
- inOnScroll =
TRUE
;
+ inOnScroll =
true
;
int orient = event.GetOrientation();
int nScrollInc = CalcScrollInc(event);
if (nScrollInc == 0)
{
int orient = event.GetOrientation();
int nScrollInc = CalcScrollInc(event);
if (nScrollInc == 0)
{
- inOnScroll =
FALSE
;
+ inOnScroll =
false
;
return;
}
if (orient == wxHORIZONTAL)
{
return;
}
if (orient == wxHORIZONTAL)
{
- inOnScroll =
FALSE
;
+ inOnScroll =
false
;
event.Skip();
return;
#if 0
int newPos = m_xScrollPosition + nScrollInc;
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;
#endif
}
else
{
int newPos = m_yScrollPosition + nScrollInc;
- SetScrollPos(wxVERTICAL, newPos,
TRUE
);
+ SetScrollPos(wxVERTICAL, newPos,
true
);
}
if (orient == wxHORIZONTAL)
}
if (orient == wxHORIZONTAL)
@@
-692,7
+723,7
@@
void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
}
// Find targets in splitter window and send the event to them
}
// Find targets in splitter window and send the event to them
- wxWindowList
Node*
node = GetChildren().GetFirst();
+ wxWindowList
::compatibility_iterator
node = GetChildren().GetFirst();
while (node)
{
wxWindow* child = (wxWindow*) node->GetData();
while (node)
{
wxWindow* child = (wxWindow*) node->GetData();
@@
-708,10
+739,7
@@
void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
node = node->GetNext();
}
node = node->GetNext();
}
-#ifdef __WXMAC__
- m_targetWindow->MacUpdateImmediately() ;
-#endif
+ m_targetWindow->Update() ;
- inOnScroll =
FALSE
;
+ inOnScroll =
false
;
}
}
-