]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/gizmos/splittree.cpp
cfad5864ac02084b91e395878ba499c4a7491854
[wxWidgets.git] / contrib / src / gizmos / splittree.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: splittree.cpp
3 // Purpose: Classes to achieve a remotely-scrolled tree in a splitter
4 // window that can be scrolled by a scrolled window higher in the
5 // hierarchy
6 // Author: Julian Smart
7 // Modified by:
8 // Created: 8/7/2000
9 // RCS-ID: $Id$
10 // Copyright: (c) Julian Smart
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 // ============================================================================
15 // declarations
16 // ============================================================================
17
18 // ----------------------------------------------------------------------------
19 // headers
20 // ----------------------------------------------------------------------------
21 #ifdef __GNUG__
22 #pragma implementation "splittree.h"
23 #endif
24
25 // For compilers that support precompilation, includes "wx/wx.h".
26 #include "wx/wxprec.h"
27
28 #ifdef __BORLANDC__
29 #pragma hdrstop
30 #endif
31
32 // for all others, include the necessary headers (this file is usually all you
33 // need because it includes almost all "standard" wxWindows headers)
34 #ifndef WX_PRECOMP
35 #include "wx/wx.h"
36 #endif
37
38 #ifdef __WXMSW__
39 #include <windows.h>
40 #include "wx/msw/winundef.h"
41 #endif
42
43 #include "wx/gizmos/splittree.h"
44 #include <math.h>
45
46 /*
47 * wxRemotelyScrolledTreeCtrl
48 */
49
50 #if USE_GENERIC_TREECTRL
51 IMPLEMENT_CLASS(wxRemotelyScrolledTreeCtrl, wxGenericTreeCtrl)
52 #else
53 IMPLEMENT_CLASS(wxRemotelyScrolledTreeCtrl, wxTreeCtrl)
54 #endif
55
56 #if USE_GENERIC_TREECTRL
57 BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxGenericTreeCtrl)
58 #else
59 BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxTreeCtrl)
60 #endif
61 EVT_SIZE(wxRemotelyScrolledTreeCtrl::OnSize)
62 EVT_PAINT(wxRemotelyScrolledTreeCtrl::OnPaint)
63 EVT_TREE_ITEM_EXPANDED(-1, wxRemotelyScrolledTreeCtrl::OnExpand)
64 EVT_TREE_ITEM_COLLAPSED(-1, wxRemotelyScrolledTreeCtrl::OnExpand)
65 EVT_SCROLLWIN(wxRemotelyScrolledTreeCtrl::OnScroll)
66 END_EVENT_TABLE()
67
68 wxRemotelyScrolledTreeCtrl::wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt,
69 const wxSize& sz, long style):
70 wxTreeCtrl(parent, id, pt, sz, style)
71 {
72 m_companionWindow = NULL;
73 }
74
75 wxRemotelyScrolledTreeCtrl::~wxRemotelyScrolledTreeCtrl()
76 {
77 }
78
79 void wxRemotelyScrolledTreeCtrl::HideVScrollbar()
80 {
81 #if defined(__WXMSW__)
82 #if USE_GENERIC_TREECTRL
83 if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
84 #endif
85 {
86 ::ShowScrollBar((HWND) GetHWND(), SB_VERT, FALSE);
87 }
88 #if USE_GENERIC_TREECTRL
89 else
90 {
91 // Implicit in overriding SetScrollbars
92 }
93 #endif
94 #endif
95 }
96
97 // Number of pixels per user unit (0 or -1 for no scrollbar)
98 // Length of virtual canvas in user units
99 // Length of page in user units
100 void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
101 int noUnitsX, int noUnitsY,
102 int xPos, int yPos,
103 bool noRefresh)
104 {
105 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
106 if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
107 {
108 wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
109 win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, 0, noUnitsX, 0, xPos, 0, noRefresh);
110
111 wxScrolledWindow* scrolledWindow = GetScrolledWindow();
112 if (scrolledWindow)
113 {
114 scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 0, yPos, noRefresh);
115 }
116 }
117 #endif
118 }
119
120 // In case we're using the generic tree control.
121 int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const
122 {
123 wxScrolledWindow* scrolledWindow = GetScrolledWindow();
124
125 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
126 if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
127 {
128 wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
129
130 if (orient == wxHORIZONTAL)
131 return win->wxGenericTreeCtrl::GetScrollPos(orient);
132 else
133 {
134 return scrolledWindow->GetScrollPos(orient);
135 }
136 }
137 #endif
138 return 0;
139 }
140
141
142 // In case we're using the generic tree control.
143 // Get the view start
144 void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const
145 {
146 wxScrolledWindow* scrolledWindow = GetScrolledWindow();
147
148 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
149 if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
150 {
151
152 wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
153 int x1, y1, x2, y2;
154 win->wxGenericTreeCtrl::GetViewStart(& x1, & y1);
155 * x = x1; * y = y1;
156 if (!scrolledWindow)
157 return;
158
159 scrolledWindow->GetViewStart(& x2, & y2);
160 * y = y2;
161 }
162 else
163 #endif
164 {
165 // x is wrong since the horizontal scrollbar is controlled by the
166 // tree control, but we probably don't need it.
167 scrolledWindow->GetViewStart(x, y);
168 }
169 }
170
171 // In case we're using the generic tree control.
172 void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc)
173 {
174 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
175 if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
176 {
177 wxScrolledWindow* scrolledWindow = GetScrolledWindow();
178
179 wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
180
181 int startX, startY;
182 GetViewStart(& startX, & startY);
183
184 int xppu1, yppu1, xppu2, yppu2;
185 win->wxGenericTreeCtrl::GetScrollPixelsPerUnit(& xppu1, & yppu1);
186 scrolledWindow->GetScrollPixelsPerUnit(& xppu2, & yppu2);
187
188 dc.SetDeviceOrigin( -startX * xppu1, -startY * yppu2 );
189 // dc.SetUserScale( win->GetScaleX(), win->GetScaleY() );
190 }
191 #endif
192 }
193
194 // Scroll to the given line (in scroll units where each unit is
195 // the height of an item)
196 void wxRemotelyScrolledTreeCtrl::ScrollToLine(int posHoriz, int posVert)
197 {
198 #ifdef __WXMSW__
199 #if USE_GENERIC_TREECTRL
200 if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
201 #endif
202 {
203 UINT sbCode = SB_THUMBPOSITION;
204 HWND vertScrollBar = 0;
205 MSWDefWindowProc((WXUINT) WM_VSCROLL, MAKELONG(sbCode, posVert), (WXHWND) vertScrollBar);
206 }
207 #if USE_GENERIC_TREECTRL
208 else
209 #endif
210 #endif
211 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
212 {
213 wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
214 win->Refresh();
215 /* Doesn't work yet because scrolling is ignored by Scroll
216 int xppu, yppu;
217 wxScrolledWindow* scrolledWindow = GetScrolledWindow();
218 if (scrolledWindow)
219 {
220 scrolledWindow->GetScrollPixelsPerUnit(& xppu, & yppu);
221 win->Scroll(-1, posVert*yppu);
222 }
223 */
224 }
225 #endif
226 }
227
228 void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event)
229 {
230 HideVScrollbar();
231 AdjustRemoteScrollbars();
232 event.Skip();
233 }
234
235 void wxRemotelyScrolledTreeCtrl::OnExpand(wxTreeEvent& event)
236 {
237 AdjustRemoteScrollbars();
238 event.Skip();
239
240 // If we don't have this, we get some bits of lines still remaining
241 if (event.GetEventType() == wxEVT_COMMAND_TREE_ITEM_COLLAPSED)
242 Refresh();
243
244 // Pass on the event
245 if (m_companionWindow)
246 m_companionWindow->GetEventHandler()->ProcessEvent(event);
247 }
248
249 void wxRemotelyScrolledTreeCtrl::OnPaint(wxPaintEvent& event)
250 {
251 wxPaintDC dc(this);
252
253 wxTreeCtrl::OnPaint(event);
254
255 // The generic tree already knows how to draw lines
256 #ifdef __WXMSW__
257 if ((GetWindowStyle() & wxTR_ROW_LINES) == 0)
258 return FALSE;
259
260 // Reset the device origin since it may have been set
261 dc.SetDeviceOrigin(0, 0);
262
263 wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
264 dc.SetPen(pen);
265 dc.SetBrush(* wxTRANSPARENT_BRUSH);
266
267 wxSize clientSize = GetClientSize();
268 wxRect itemRect;
269 int cy=0;
270 wxTreeItemId h, lastH;
271 for(h=GetFirstVisibleItem();h;h=GetNextVisible(h))
272 {
273 if (GetBoundingRect(h, itemRect))
274 {
275 cy = itemRect.GetTop();
276 dc.DrawLine(0, cy, clientSize.x, cy);
277 lastH = h;
278 }
279 }
280 if (GetBoundingRect(lastH, itemRect))
281 {
282 cy = itemRect.GetBottom();
283 dc.DrawLine(0, cy, clientSize.x, cy);
284 }
285 #endif
286 }
287
288
289 // Adjust the containing wxScrolledWindow's scrollbars appropriately
290 void wxRemotelyScrolledTreeCtrl::AdjustRemoteScrollbars()
291 {
292 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
293 if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
294 {
295 // This is for the generic tree control.
296 // It calls SetScrollbars which has been overridden
297 // to adjust the parent scrolled window vertical
298 // scrollbar.
299 ((wxGenericTreeCtrl*) this)->AdjustMyScrollbars();
300 return;
301 }
302 else
303 #endif
304 {
305 // This is for the wxMSW tree control
306 wxScrolledWindow* scrolledWindow = GetScrolledWindow();
307 if (scrolledWindow)
308 {
309 wxRect itemRect;
310 if (GetBoundingRect(GetRootItem(), itemRect))
311 {
312 // Actually, the real height seems to be 1 less than reported
313 // (e.g. 16 instead of 16)
314 int itemHeight = itemRect.GetHeight() - 1;
315
316 int w, h;
317 GetClientSize(&w, &h);
318
319 wxRect rect(0, 0, 0, 0);
320 CalcTreeSize(rect);
321
322 double f = ((double) (rect.GetHeight()) / (double) itemHeight) ;
323 int treeViewHeight = (int) ceil(f);
324
325 int scrollPixelsPerLine = itemHeight;
326 int scrollPos = - (itemRect.y / itemHeight);
327
328 scrolledWindow->SetScrollbars(0, scrollPixelsPerLine, 0, treeViewHeight, 0, scrollPos);
329
330 // Ensure that when a scrollbar becomes hidden or visible,
331 // the contained window sizes are right.
332 // Problem: this is called too early (?)
333 wxSizeEvent event(scrolledWindow->GetSize(), scrolledWindow->GetId());
334 scrolledWindow->GetEventHandler()->ProcessEvent(event);
335 }
336 }
337 }
338 }
339
340
341 // Calculate the area that contains both rectangles
342 static wxRect CombineRectangles(const wxRect& rect1, const wxRect& rect2)
343 {
344 wxRect rect;
345
346 int right1 = rect1.GetRight();
347 int bottom1 = rect1.GetBottom();
348 int right2 = rect2.GetRight();
349 int bottom2 = rect2.GetBottom();
350
351 wxPoint topLeft = wxPoint(wxMin(rect1.x, rect2.x), wxMin(rect1.y, rect2.y));
352 wxPoint bottomRight = wxPoint(wxMax(right1, right2), wxMax(bottom1, bottom2));
353
354 rect.x = topLeft.x; rect.y = topLeft.y;
355 rect.SetRight(bottomRight.x);
356 rect.SetBottom(bottomRight.y);
357
358 return rect;
359 }
360
361
362 // Calculate the tree overall size so we can set the scrollbar
363 // correctly
364 void wxRemotelyScrolledTreeCtrl::CalcTreeSize(wxRect& rect)
365 {
366 CalcTreeSize(GetRootItem(), rect);
367 }
368
369 void wxRemotelyScrolledTreeCtrl::CalcTreeSize(const wxTreeItemId& id, wxRect& rect)
370 {
371 // More efficient implementation would be to find the last item (but how?)
372 // Q: is the bounding rect relative to the top of the virtual tree workspace
373 // or the top of the window? How would we convert?
374 wxRect itemSize;
375 if (GetBoundingRect(id, itemSize))
376 {
377 rect = CombineRectangles(rect, itemSize);
378 }
379
380 long cookie;
381 wxTreeItemId childId = GetFirstChild(id, cookie);
382 while (childId != 0)
383 {
384 CalcTreeSize(childId, rect);
385 childId = GetNextChild(childId, cookie);
386 }
387 }
388
389 // Find the scrolled window that contains this control
390 wxScrolledWindow* wxRemotelyScrolledTreeCtrl::GetScrolledWindow() const
391 {
392 wxWindow* parent = wxWindow::GetParent();
393 while (parent)
394 {
395 if (parent->IsKindOf(CLASSINFO(wxScrolledWindow)))
396 return (wxScrolledWindow*) parent;
397 parent = parent->GetParent();
398 }
399 return NULL;
400 }
401
402 void wxRemotelyScrolledTreeCtrl::OnScroll(wxScrollWinEvent& event)
403 {
404 int orient = event.GetOrientation();
405 if (orient == wxHORIZONTAL)
406 {
407 event.Skip();
408 return;
409 }
410 wxScrolledWindow* scrollWin = GetScrolledWindow();
411 if (!scrollWin)
412 return;
413
414 int x, y;
415 scrollWin->GetViewStart(& x, & y);
416
417 ScrollToLine(-1, y);
418 }
419
420 /*
421 * wxTreeCompanionWindow
422 *
423 * A window displaying values associated with tree control items.
424 */
425
426 IMPLEMENT_CLASS(wxTreeCompanionWindow, wxWindow)
427
428 BEGIN_EVENT_TABLE(wxTreeCompanionWindow, wxWindow)
429 EVT_PAINT(wxTreeCompanionWindow::OnPaint)
430 EVT_SCROLLWIN(wxTreeCompanionWindow::OnScroll)
431 EVT_TREE_ITEM_EXPANDED(-1, wxTreeCompanionWindow::OnExpand)
432 EVT_TREE_ITEM_COLLAPSED(-1, wxTreeCompanionWindow::OnExpand)
433 END_EVENT_TABLE()
434
435 wxTreeCompanionWindow::wxTreeCompanionWindow(wxWindow* parent, wxWindowID id,
436 const wxPoint& pos,
437 const wxSize& sz,
438 long style):
439 wxWindow(parent, id, pos, sz, style)
440 {
441 m_treeCtrl = NULL;
442 }
443
444 void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect)
445 {
446 // TEST CODE
447 #if 1
448 if (m_treeCtrl)
449 {
450 wxString text = m_treeCtrl->GetItemText(id);
451 dc.SetTextForeground(* wxBLACK);
452 dc.SetBackgroundMode(wxTRANSPARENT);
453
454 int textW, textH;
455 dc.GetTextExtent(text, & textW, & textH);
456
457 int x = 5;
458 int y = rect.GetY() + wxMax(0, (rect.GetHeight() - textH) / 2);
459
460 dc.DrawText(text, x, y);
461 }
462 #endif
463 }
464
465 void wxTreeCompanionWindow::OnPaint(wxPaintEvent& event)
466 {
467 wxPaintDC dc(this);
468
469 if (!m_treeCtrl)
470 return;
471
472 wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
473 dc.SetPen(pen);
474 dc.SetBrush(* wxTRANSPARENT_BRUSH);
475 wxFont font(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
476 dc.SetFont(font);
477
478 wxSize clientSize = GetClientSize();
479 wxRect itemRect;
480 int cy=0;
481 wxTreeItemId h, lastH;
482 for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h))
483 {
484 if (m_treeCtrl->GetBoundingRect(h, itemRect))
485 {
486 cy = itemRect.GetTop();
487 wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight());
488
489 lastH = h;
490
491 // Draw the actual item
492 DrawItem(dc, h, drawItemRect);
493 dc.DrawLine(0, cy, clientSize.x, cy);
494 }
495 }
496 if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect))
497 {
498 cy = itemRect.GetBottom();
499 dc.DrawLine(0, cy, clientSize.x, cy);
500 }
501 }
502
503 void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event)
504 {
505 int orient = event.GetOrientation();
506 if (orient == wxHORIZONTAL)
507 {
508 event.Skip();
509 return;
510 }
511 if (!m_treeCtrl)
512 return;
513
514 // TODO: scroll the window physically instead of just refreshing.
515 Refresh(TRUE);
516 }
517
518 void wxTreeCompanionWindow::OnExpand(wxTreeEvent& event)
519 {
520 // TODO: something more optimized than simply refresh the whole
521 // window when the tree is expanded/collapsed. Tricky.
522 Refresh();
523 }
524
525 /*
526 * wxThinSplitterWindow
527 */
528
529 IMPLEMENT_CLASS(wxThinSplitterWindow, wxSplitterWindow)
530
531 BEGIN_EVENT_TABLE(wxThinSplitterWindow, wxSplitterWindow)
532 EVT_SIZE(wxThinSplitterWindow::OnSize)
533 END_EVENT_TABLE()
534
535 wxThinSplitterWindow::wxThinSplitterWindow(wxWindow* parent, wxWindowID id,
536 const wxPoint& pos,
537 const wxSize& sz,
538 long style):
539 wxSplitterWindow(parent, id, pos, sz, style)
540 {
541 }
542
543 void wxThinSplitterWindow::SizeWindows()
544 {
545 // The client size may have changed inbetween
546 // the sizing of the first window and the sizing of
547 // the second. So repeat SizeWindows.
548 wxSplitterWindow::SizeWindows();
549 wxSplitterWindow::SizeWindows();
550 }
551
552 // Tests for x, y over sash
553 bool wxThinSplitterWindow::SashHitTest(int x, int y, int tolerance)
554 {
555 return wxSplitterWindow::SashHitTest(x, y, 4);
556 }
557
558 void wxThinSplitterWindow::DrawSash(wxDC& dc)
559 {
560 if ( m_sashPosition == 0 || !m_windowTwo)
561 return;
562 if (GetWindowStyle() & wxSP_NOSASH)
563 return;
564
565 int w, h;
566 GetClientSize(&w, &h);
567
568 if ( m_splitMode == wxSPLIT_VERTICAL )
569 {
570 dc.SetPen(* m_facePen);
571 dc.SetBrush(* m_faceBrush);
572 int h1 = h-1;
573 int y1 = 0;
574 if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER )
575 h1 += 1; // Not sure why this is necessary...
576 if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER)
577 {
578 y1 = 2; h1 -= 3;
579 }
580 dc.DrawRectangle(m_sashPosition, y1, m_sashSize, h1);
581 }
582 else
583 {
584 dc.SetPen(* m_facePen);
585 dc.SetBrush(* m_faceBrush);
586 int w1 = w-1;
587 int x1 = 0;
588 if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER )
589 w1 ++;
590 if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER)
591 {
592 x1 = 2; w1 -= 3;
593 }
594 dc.DrawRectangle(x1, m_sashPosition, w1, m_sashSize);
595 }
596
597 dc.SetPen(wxNullPen);
598 dc.SetBrush(wxNullBrush);
599 }
600
601 void wxThinSplitterWindow::OnSize(wxSizeEvent& event)
602 {
603 wxSplitterWindow::OnSize(event);
604 }
605
606 /*
607 * wxSplitterScrolledWindow
608 */
609
610 IMPLEMENT_CLASS(wxSplitterScrolledWindow, wxScrolledWindow)
611
612 BEGIN_EVENT_TABLE(wxSplitterScrolledWindow, wxScrolledWindow)
613 EVT_SCROLLWIN(wxSplitterScrolledWindow::OnScroll)
614 EVT_SIZE(wxSplitterScrolledWindow::OnSize)
615 END_EVENT_TABLE()
616
617 wxSplitterScrolledWindow::wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id,
618 const wxPoint& pos,
619 const wxSize& sz,
620 long style):
621 wxScrolledWindow(parent, id, pos, sz, style)
622 {
623 }
624
625 void wxSplitterScrolledWindow::OnSize(wxSizeEvent& event)
626 {
627 wxSize sz = GetClientSize();
628 if (GetChildren().First())
629 {
630 ((wxWindow*) GetChildren().First()->Data())->SetSize(0, 0, sz.x, sz.y);
631 }
632 }
633
634 void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
635 {
636 // Ensure that events being propagated back up the window hierarchy
637 // don't cause an infinite loop
638 static bool inOnScroll = FALSE;
639 if (inOnScroll)
640 {
641 event.Skip();
642 return;
643 }
644 inOnScroll = TRUE;
645
646 int orient = event.GetOrientation();
647
648 int nScrollInc = CalcScrollInc(event);
649 if (nScrollInc == 0)
650 {
651 inOnScroll = FALSE;
652 return;
653 }
654
655 if (orient == wxHORIZONTAL)
656 {
657 inOnScroll = FALSE;
658 event.Skip();
659 return;
660 #if 0
661 int newPos = m_xScrollPosition + nScrollInc;
662 SetScrollPos(wxHORIZONTAL, newPos, TRUE );
663 #endif
664 }
665 else
666 {
667 int newPos = m_yScrollPosition + nScrollInc;
668 SetScrollPos(wxVERTICAL, newPos, TRUE );
669 }
670
671 if (orient == wxHORIZONTAL)
672 {
673 m_xScrollPosition += nScrollInc;
674 }
675 else
676 {
677 m_yScrollPosition += nScrollInc;
678 }
679
680 // Find targets in splitter window and send the event to them
681 wxNode* node = GetChildren().First();
682 while (node)
683 {
684 wxWindow* child = (wxWindow*) node->Data();
685 if (child->IsKindOf(CLASSINFO(wxSplitterWindow)))
686 {
687 wxSplitterWindow* splitter = (wxSplitterWindow*) child;
688 if (splitter->GetWindow1())
689 splitter->GetWindow1()->ProcessEvent(event);
690 if (splitter->GetWindow2())
691 splitter->GetWindow2()->ProcessEvent(event);
692 break;
693 }
694 node = node->Next();
695 }
696
697 #ifdef __WXMAC__
698 m_targetWindow->MacUpdateImmediately() ;
699 #endif
700
701 inOnScroll = FALSE;
702 }
703