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