]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/gizmos/splittree.cpp
031a39cb8a4b65bd46627c09c38f1299d81c7697
[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 if ((GetWindowStyle() & wxTR_ROW_LINES) == 0)
256 return ;
257
258 // Reset the device origin since it may have been set
259 dc.SetDeviceOrigin(0, 0);
260
261 wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
262 dc.SetPen(pen);
263 dc.SetBrush(* wxTRANSPARENT_BRUSH);
264
265 wxSize clientSize = GetClientSize();
266 wxRect itemRect;
267 int cy=0;
268 wxTreeItemId h, lastH;
269 for(h=GetFirstVisibleItem();h;h=GetNextVisible(h))
270 {
271 if (GetBoundingRect(h, itemRect))
272 {
273 cy = itemRect.GetTop();
274 dc.DrawLine(0, cy, clientSize.x, cy);
275 lastH = h;
276 }
277 }
278 if (GetBoundingRect(lastH, itemRect))
279 {
280 cy = itemRect.GetBottom();
281 dc.DrawLine(0, cy, clientSize.x, cy);
282 }
283 }
284
285
286 // Adjust the containing wxScrolledWindow's scrollbars appropriately
287 void wxRemotelyScrolledTreeCtrl::AdjustRemoteScrollbars()
288 {
289 #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
290 if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
291 {
292 // This is for the generic tree control.
293 // It calls SetScrollbars which has been overridden
294 // to adjust the parent scrolled window vertical
295 // scrollbar.
296 ((wxGenericTreeCtrl*) this)->AdjustMyScrollbars();
297 return;
298 }
299 else
300 #endif
301 {
302 // This is for the wxMSW tree control
303 wxScrolledWindow* scrolledWindow = GetScrolledWindow();
304 if (scrolledWindow)
305 {
306 wxRect itemRect;
307 if (GetBoundingRect(GetRootItem(), itemRect))
308 {
309 // Actually, the real height seems to be 1 less than reported
310 // (e.g. 16 instead of 16)
311 int itemHeight = itemRect.GetHeight() - 1;
312
313 int w, h;
314 GetClientSize(&w, &h);
315
316 wxRect rect(0, 0, 0, 0);
317 CalcTreeSize(rect);
318
319 double f = ((double) (rect.GetHeight()) / (double) itemHeight) ;
320 int treeViewHeight = (int) ceil(f);
321
322 int scrollPixelsPerLine = itemHeight;
323 int scrollPos = - (itemRect.y / itemHeight);
324
325 scrolledWindow->SetScrollbars(0, scrollPixelsPerLine, 0, treeViewHeight, 0, scrollPos);
326
327 // Ensure that when a scrollbar becomes hidden or visible,
328 // the contained window sizes are right.
329 // Problem: this is called too early (?)
330 wxSizeEvent event(scrolledWindow->GetSize(), scrolledWindow->GetId());
331 scrolledWindow->GetEventHandler()->ProcessEvent(event);
332 }
333 }
334 }
335 }
336
337
338 // Calculate the area that contains both rectangles
339 static wxRect CombineRectangles(const wxRect& rect1, const wxRect& rect2)
340 {
341 wxRect rect;
342
343 int right1 = rect1.GetRight();
344 int bottom1 = rect1.GetBottom();
345 int right2 = rect2.GetRight();
346 int bottom2 = rect2.GetBottom();
347
348 wxPoint topLeft = wxPoint(wxMin(rect1.x, rect2.x), wxMin(rect1.y, rect2.y));
349 wxPoint bottomRight = wxPoint(wxMax(right1, right2), wxMax(bottom1, bottom2));
350
351 rect.x = topLeft.x; rect.y = topLeft.y;
352 rect.SetRight(bottomRight.x);
353 rect.SetBottom(bottomRight.y);
354
355 return rect;
356 }
357
358
359 // Calculate the tree overall size so we can set the scrollbar
360 // correctly
361 void wxRemotelyScrolledTreeCtrl::CalcTreeSize(wxRect& rect)
362 {
363 CalcTreeSize(GetRootItem(), rect);
364 }
365
366 void wxRemotelyScrolledTreeCtrl::CalcTreeSize(const wxTreeItemId& id, wxRect& rect)
367 {
368 // More efficient implementation would be to find the last item (but how?)
369 // Q: is the bounding rect relative to the top of the virtual tree workspace
370 // or the top of the window? How would we convert?
371 wxRect itemSize;
372 if (GetBoundingRect(id, itemSize))
373 {
374 rect = CombineRectangles(rect, itemSize);
375 }
376
377 long cookie;
378 wxTreeItemId childId = GetFirstChild(id, cookie);
379 while (childId != 0)
380 {
381 CalcTreeSize(childId, rect);
382 childId = GetNextChild(childId, cookie);
383 }
384 }
385
386 // Find the scrolled window that contains this control
387 wxScrolledWindow* wxRemotelyScrolledTreeCtrl::GetScrolledWindow() const
388 {
389 wxWindow* parent = wxWindow::GetParent();
390 while (parent)
391 {
392 if (parent->IsKindOf(CLASSINFO(wxScrolledWindow)))
393 return (wxScrolledWindow*) parent;
394 parent = parent->GetParent();
395 }
396 return NULL;
397 }
398
399 void wxRemotelyScrolledTreeCtrl::OnScroll(wxScrollWinEvent& event)
400 {
401 int orient = event.GetOrientation();
402 if (orient == wxHORIZONTAL)
403 {
404 event.Skip();
405 return;
406 }
407 wxScrolledWindow* scrollWin = GetScrolledWindow();
408 if (!scrollWin)
409 return;
410
411 int x, y;
412 scrollWin->GetViewStart(& x, & y);
413
414 ScrollToLine(-1, y);
415 }
416
417 /*
418 * wxTreeCompanionWindow
419 *
420 * A window displaying values associated with tree control items.
421 */
422
423 IMPLEMENT_CLASS(wxTreeCompanionWindow, wxWindow)
424
425 BEGIN_EVENT_TABLE(wxTreeCompanionWindow, wxWindow)
426 EVT_PAINT(wxTreeCompanionWindow::OnPaint)
427 EVT_SCROLLWIN(wxTreeCompanionWindow::OnScroll)
428 EVT_TREE_ITEM_EXPANDED(-1, wxTreeCompanionWindow::OnExpand)
429 EVT_TREE_ITEM_COLLAPSED(-1, wxTreeCompanionWindow::OnExpand)
430 END_EVENT_TABLE()
431
432 wxTreeCompanionWindow::wxTreeCompanionWindow(wxWindow* parent, wxWindowID id,
433 const wxPoint& pos,
434 const wxSize& sz,
435 long style):
436 wxWindow(parent, id, pos, sz, style)
437 {
438 m_treeCtrl = NULL;
439 }
440
441 void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect)
442 {
443 // TEST CODE
444 #if 1
445 if (m_treeCtrl)
446 {
447 wxString text = m_treeCtrl->GetItemText(id);
448 dc.SetTextForeground(* wxBLACK);
449 dc.SetBackgroundMode(wxTRANSPARENT);
450
451 int textW, textH;
452 dc.GetTextExtent(text, & textW, & textH);
453
454 int x = 5;
455 int y = rect.GetY() + wxMax(0, (rect.GetHeight() - textH) / 2);
456
457 dc.DrawText(text, x, y);
458 }
459 #endif
460 }
461
462 void wxTreeCompanionWindow::OnPaint(wxPaintEvent& event)
463 {
464 wxPaintDC dc(this);
465
466 if (!m_treeCtrl)
467 return;
468
469 wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
470 dc.SetPen(pen);
471 dc.SetBrush(* wxTRANSPARENT_BRUSH);
472 wxFont font(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
473 dc.SetFont(font);
474
475 wxSize clientSize = GetClientSize();
476 wxRect itemRect;
477 int cy=0;
478 wxTreeItemId h, lastH;
479 for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h))
480 {
481 if (m_treeCtrl->GetBoundingRect(h, itemRect))
482 {
483 cy = itemRect.GetTop();
484 wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight());
485
486 lastH = h;
487
488 // Draw the actual item
489 DrawItem(dc, h, drawItemRect);
490 dc.DrawLine(0, cy, clientSize.x, cy);
491 }
492 }
493 if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect))
494 {
495 cy = itemRect.GetBottom();
496 dc.DrawLine(0, cy, clientSize.x, cy);
497 }
498 }
499
500 void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event)
501 {
502 int orient = event.GetOrientation();
503 if (orient == wxHORIZONTAL)
504 {
505 event.Skip();
506 return;
507 }
508 if (!m_treeCtrl)
509 return;
510
511 // TODO: scroll the window physically instead of just refreshing.
512 Refresh(TRUE);
513 }
514
515 void wxTreeCompanionWindow::OnExpand(wxTreeEvent& event)
516 {
517 // TODO: something more optimized than simply refresh the whole
518 // window when the tree is expanded/collapsed. Tricky.
519 Refresh();
520 }
521
522 /*
523 * wxThinSplitterWindow
524 */
525
526 IMPLEMENT_CLASS(wxThinSplitterWindow, wxSplitterWindow)
527
528 BEGIN_EVENT_TABLE(wxThinSplitterWindow, wxSplitterWindow)
529 EVT_SIZE(wxThinSplitterWindow::OnSize)
530 END_EVENT_TABLE()
531
532 wxThinSplitterWindow::wxThinSplitterWindow(wxWindow* parent, wxWindowID id,
533 const wxPoint& pos,
534 const wxSize& sz,
535 long style):
536 wxSplitterWindow(parent, id, pos, sz, style)
537 {
538 }
539
540 void wxThinSplitterWindow::SizeWindows()
541 {
542 // The client size may have changed inbetween
543 // the sizing of the first window and the sizing of
544 // the second. So repeat SizeWindows.
545 wxSplitterWindow::SizeWindows();
546 wxSplitterWindow::SizeWindows();
547 }
548
549 // Tests for x, y over sash
550 bool wxThinSplitterWindow::SashHitTest(int x, int y, int tolerance)
551 {
552 return wxSplitterWindow::SashHitTest(x, y, 4);
553 }
554
555 void wxThinSplitterWindow::DrawSash(wxDC& dc)
556 {
557 if ( m_sashPosition == 0 || !m_windowTwo)
558 return;
559 if (GetWindowStyle() & wxSP_NOSASH)
560 return;
561
562 int w, h;
563 GetClientSize(&w, &h);
564
565 if ( m_splitMode == wxSPLIT_VERTICAL )
566 {
567 dc.SetPen(* m_facePen);
568 dc.SetBrush(* m_faceBrush);
569 int h1 = h-1;
570 int y1 = 0;
571 if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER )
572 h1 += 1; // Not sure why this is necessary...
573 if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER)
574 {
575 y1 = 2; h1 -= 3;
576 }
577 dc.DrawRectangle(m_sashPosition, y1, m_sashSize, h1);
578 }
579 else
580 {
581 dc.SetPen(* m_facePen);
582 dc.SetBrush(* m_faceBrush);
583 int w1 = w-1;
584 int x1 = 0;
585 if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER )
586 w1 ++;
587 if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER)
588 {
589 x1 = 2; w1 -= 3;
590 }
591 dc.DrawRectangle(x1, m_sashPosition, w1, m_sashSize);
592 }
593
594 dc.SetPen(wxNullPen);
595 dc.SetBrush(wxNullBrush);
596 }
597
598 void wxThinSplitterWindow::OnSize(wxSizeEvent& event)
599 {
600 wxSplitterWindow::OnSize(event);
601 }
602
603 /*
604 * wxSplitterScrolledWindow
605 */
606
607 IMPLEMENT_CLASS(wxSplitterScrolledWindow, wxScrolledWindow)
608
609 BEGIN_EVENT_TABLE(wxSplitterScrolledWindow, wxScrolledWindow)
610 EVT_SCROLLWIN(wxSplitterScrolledWindow::OnScroll)
611 EVT_SIZE(wxSplitterScrolledWindow::OnSize)
612 END_EVENT_TABLE()
613
614 wxSplitterScrolledWindow::wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id,
615 const wxPoint& pos,
616 const wxSize& sz,
617 long style):
618 wxScrolledWindow(parent, id, pos, sz, style)
619 {
620 }
621
622 void wxSplitterScrolledWindow::OnSize(wxSizeEvent& event)
623 {
624 wxSize sz = GetClientSize();
625 if (GetChildren().First())
626 {
627 ((wxWindow*) GetChildren().First()->Data())->SetSize(0, 0, sz.x, sz.y);
628 }
629 }
630
631 void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
632 {
633 // Ensure that events being propagated back up the window hierarchy
634 // don't cause an infinite loop
635 static bool inOnScroll = FALSE;
636 if (inOnScroll)
637 {
638 event.Skip();
639 return;
640 }
641 inOnScroll = TRUE;
642
643 int orient = event.GetOrientation();
644
645 int nScrollInc = CalcScrollInc(event);
646 if (nScrollInc == 0)
647 {
648 inOnScroll = FALSE;
649 return;
650 }
651
652 if (orient == wxHORIZONTAL)
653 {
654 inOnScroll = FALSE;
655 event.Skip();
656 return;
657 #if 0
658 int newPos = m_xScrollPosition + nScrollInc;
659 SetScrollPos(wxHORIZONTAL, newPos, TRUE );
660 #endif
661 }
662 else
663 {
664 int newPos = m_yScrollPosition + nScrollInc;
665 SetScrollPos(wxVERTICAL, newPos, TRUE );
666 }
667
668 if (orient == wxHORIZONTAL)
669 {
670 m_xScrollPosition += nScrollInc;
671 }
672 else
673 {
674 m_yScrollPosition += nScrollInc;
675 }
676
677 // Find targets in splitter window and send the event to them
678 wxNode* node = GetChildren().First();
679 while (node)
680 {
681 wxWindow* child = (wxWindow*) node->Data();
682 if (child->IsKindOf(CLASSINFO(wxSplitterWindow)))
683 {
684 wxSplitterWindow* splitter = (wxSplitterWindow*) child;
685 if (splitter->GetWindow1())
686 splitter->GetWindow1()->ProcessEvent(event);
687 if (splitter->GetWindow2())
688 splitter->GetWindow2()->ProcessEvent(event);
689 break;
690 }
691 node = node->Next();
692 }
693
694 #ifdef __WXMAC__
695 m_targetWindow->MacUpdateImmediately() ;
696 #endif
697
698 inOnScroll = FALSE;
699 }
700