1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSplitterWindow implementation
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "splitter.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
29 #include "wx/string.h"
30 #include "wx/splitter.h"
31 #include "wx/dcscreen.h"
33 #if !USE_SHARED_LIBRARY
34 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow
, wxWindow
)
35 IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent
, wxCommandEvent
)
37 BEGIN_EVENT_TABLE(wxSplitterWindow
, wxWindow
)
38 EVT_PAINT(wxSplitterWindow::OnPaint
)
39 EVT_SIZE(wxSplitterWindow::OnSize
)
40 EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent
)
42 EVT_SPLITTER_SASH_POS_CHANGED(-1, wxSplitterWindow::OnSashPosChanged
)
43 // NB: we borrow OnSashPosChanged for purposes of
44 // EVT_SPLITTER_SASH_POS_CHANGING since default implementation is identical
45 EVT_SPLITTER_SASH_POS_CHANGING(-1, wxSplitterWindow::OnSashPosChanged
)
46 EVT_SPLITTER_DCLICK(-1, wxSplitterWindow::OnDoubleClick
)
47 EVT_SPLITTER_UNSPLIT(-1, wxSplitterWindow::OnUnsplitEvent
)
51 wxSplitterWindow::wxSplitterWindow()
53 m_splitMode
= wxSPLIT_VERTICAL
;
54 m_permitUnsplitAlways
= FALSE
;
55 m_windowOne
= (wxWindow
*) NULL
;
56 m_windowTwo
= (wxWindow
*) NULL
;
57 m_dragMode
= wxSPLIT_DRAG_NONE
;
65 m_sashCursorWE
= (wxCursor
*) NULL
;
66 m_sashCursorNS
= (wxCursor
*) NULL
;
67 m_sashTrackerPen
= (wxPen
*) NULL
;
68 m_lightShadowPen
= (wxPen
*) NULL
;
69 m_mediumShadowPen
= (wxPen
*) NULL
;
70 m_darkShadowPen
= (wxPen
*) NULL
;
71 m_faceBrush
= (wxBrush
*) NULL
;
72 m_facePen
= (wxPen
*) NULL
;
73 m_hilightPen
= (wxPen
*) NULL
;
74 m_minimumPaneSize
= 0;
77 wxSplitterWindow::wxSplitterWindow(wxWindow
*parent
, wxWindowID id
,
82 : wxWindow(parent
, id
, pos
, size
, style
, name
)
84 m_splitMode
= wxSPLIT_VERTICAL
;
85 m_permitUnsplitAlways
= (style
& wxSP_PERMIT_UNSPLIT
) != 0;
86 m_windowOne
= (wxWindow
*) NULL
;
87 m_windowTwo
= (wxWindow
*) NULL
;
88 m_dragMode
= wxSPLIT_DRAG_NONE
;
96 m_minimumPaneSize
= 0;
97 m_sashCursorWE
= new wxCursor(wxCURSOR_SIZEWE
);
98 m_sashCursorNS
= new wxCursor(wxCURSOR_SIZENS
);
99 m_sashTrackerPen
= new wxPen(*wxBLACK
, 2, wxSOLID
);
100 m_lightShadowPen
= (wxPen
*) NULL
;
101 m_mediumShadowPen
= (wxPen
*) NULL
;
102 m_darkShadowPen
= (wxPen
*) NULL
;
103 m_faceBrush
= (wxBrush
*) NULL
;
104 m_facePen
= (wxPen
*) NULL
;
105 m_hilightPen
= (wxPen
*) NULL
;
107 if ( style
& wxSP_3D
)
112 else if ( style
& wxSP_BORDER
)
123 // Eventually, we'll respond to colour change messages
126 // For debugging purposes, to see the background.
127 // SetBackground(wxBLUE_BRUSH);
130 wxSplitterWindow::~wxSplitterWindow()
132 delete m_sashCursorWE
;
133 delete m_sashCursorNS
;
134 delete m_sashTrackerPen
;
135 delete m_lightShadowPen
;
136 delete m_darkShadowPen
;
137 delete m_mediumShadowPen
;
143 void wxSplitterWindow::OnPaint(wxPaintEvent
& WXUNUSED(event
))
147 if ( m_borderSize
> 0 )
153 void wxSplitterWindow::OnMouseEvent(wxMouseEvent
& event
)
155 long x
= event
.GetX();
156 long y
= event
.GetY();
160 SetCursor(* wxSTANDARD_CURSOR
);
163 SetCursor(wxCursor());
166 // under wxGTK the method above causes the mouse
167 // to flicker so we set the standard cursor only
168 // when leaving the window and when moving over
169 // non-sash parts of the window. this should work
170 // on the other platforms as well, but who knows.
173 SetCursor(* wxSTANDARD_CURSOR
);
176 if (event
.LeftDown())
178 if ( SashHitTest(x
, y
) )
182 m_dragMode
= wxSPLIT_DRAG_DRAGGING
;
184 DrawSashTracker(x
, y
);
190 else if (event
.LeftUp() && m_dragMode
== wxSPLIT_DRAG_DRAGGING
)
192 // We can stop dragging now and see what we've got.
193 m_dragMode
= wxSPLIT_DRAG_NONE
;
197 DrawSashTracker(m_oldX
, m_oldY
);
199 // Obtain window size. We are only interested in the dimension the sash
202 GetClientSize(&w
, &h
);
203 int window_size
= (m_splitMode
== wxSPLIT_VERTICAL
? w
: h
);
204 int new_sash_position
=
205 (int) ( m_splitMode
== wxSPLIT_VERTICAL
? x
: y
);
207 wxSplitterEvent
eventSplitter(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
,
209 eventSplitter
.m_data
.pos
= new_sash_position
;
210 if ( GetEventHandler()->ProcessEvent(eventSplitter
) )
212 new_sash_position
= eventSplitter
.GetSashPosition();
213 if ( new_sash_position
== -1 )
215 // change not allowed
220 if ( m_permitUnsplitAlways
221 || m_minimumPaneSize
== 0 )
223 // Deal with possible unsplit scenarios
224 if ( new_sash_position
== 0 )
226 // We remove the first window from the view
227 wxWindow
*removedWindow
= m_windowOne
;
228 m_windowOne
= m_windowTwo
;
229 m_windowTwo
= (wxWindow
*) NULL
;
230 SendUnsplitEvent(removedWindow
);
233 else if ( new_sash_position
== window_size
)
235 // We remove the second window from the view
236 wxWindow
*removedWindow
= m_windowTwo
;
237 m_windowTwo
= (wxWindow
*) NULL
;
238 SendUnsplitEvent(removedWindow
);
243 m_sashPosition
= new_sash_position
;
248 m_sashPosition
= new_sash_position
;
252 } // left up && dragging
253 else if (event
.Moving() && !event
.Dragging())
255 // Just change the cursor if required
256 if ( SashHitTest(x
, y
) )
258 if ( m_splitMode
== wxSPLIT_VERTICAL
)
260 SetCursor(*m_sashCursorWE
);
264 SetCursor(*m_sashCursorNS
);
270 // where else do we unset the cursor?
271 SetCursor(* wxSTANDARD_CURSOR
);
275 else if (event
.Dragging() && (m_dragMode
== wxSPLIT_DRAG_DRAGGING
))
277 // Obtain window size. We are only interested in the dimension the sash
279 int new_sash_position
=
280 (int) ( m_splitMode
== wxSPLIT_VERTICAL
? x
: y
);
282 wxSplitterEvent
eventSplitter(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING
,
284 eventSplitter
.m_data
.pos
= new_sash_position
;
285 if ( GetEventHandler()->ProcessEvent(eventSplitter
) )
287 new_sash_position
= eventSplitter
.GetSashPosition();
288 if ( new_sash_position
== -1 )
290 // change not allowed
296 DrawSashTracker(m_oldX
, m_oldY
);
298 if (m_splitMode
== wxSPLIT_VERTICAL
)
299 x
= new_sash_position
;
301 y
= new_sash_position
;
303 if (new_sash_position
!= -1)
305 // Only modify if permitted
311 // As we captured the mouse, we may get the mouse events from outside
312 // our window - for example, negative values in x, y. This has a weird
313 // consequence under MSW where we use unsigned values sometimes and
314 // signed ones other times: the coordinates turn as big positive
315 // numbers and so the sash is drawn on the *right* side of the window
316 // instead of the left (or bottom instead of top). Correct this.
317 if ( (short)m_oldX
< 0 )
319 if ( (short)m_oldY
< 0 )
324 DrawSashTracker(m_oldX
, m_oldY
);
326 else if ( event
.LeftDClick() )
328 wxSplitterEvent
eventSplitter(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
,
330 eventSplitter
.m_data
.pt
.x
= x
;
331 eventSplitter
.m_data
.pt
.y
= y
;
333 (void)GetEventHandler()->ProcessEvent(eventSplitter
);
337 void wxSplitterWindow::OnSize(wxSizeEvent
& WXUNUSED(event
))
340 GetClientSize( &cw
, &ch
);
343 if ( m_splitMode
== wxSPLIT_VERTICAL
)
345 if ( m_sashPosition
>= (cw
- 5) )
346 m_sashPosition
= wxMax(10, cw
- 40);
348 if ( m_splitMode
== wxSPLIT_HORIZONTAL
)
350 if ( m_sashPosition
>= (ch
- 5) )
351 m_sashPosition
= wxMax(10, ch
- 40);
357 bool wxSplitterWindow::SashHitTest(int x
, int y
, int tolerance
)
359 if ( m_windowTwo
== NULL
|| m_sashPosition
== 0)
360 return FALSE
; // No sash
362 if ( m_splitMode
== wxSPLIT_VERTICAL
)
364 if ( (x
>= m_sashPosition
- tolerance
) && (x
<= m_sashPosition
+ m_sashSize
+ tolerance
) )
371 if ( (y
>= (m_sashPosition
- tolerance
)) && (y
<= (m_sashPosition
+ m_sashSize
+ tolerance
)) )
380 // Draw 3D effect borders
381 void wxSplitterWindow::DrawBorders(wxDC
& dc
)
384 GetClientSize(&w
, &h
);
386 if ( GetWindowStyleFlag() & wxSP_3D
)
388 dc
.SetPen(*m_mediumShadowPen
);
389 dc
.DrawLine(0, 0, w
-1, 0);
390 dc
.DrawLine(0, 0, 0, h
- 1);
392 dc
.SetPen(*m_darkShadowPen
);
393 dc
.DrawLine(1, 1, w
-2, 1);
394 dc
.DrawLine(1, 1, 1, h
-2);
396 dc
.SetPen(*m_hilightPen
);
397 dc
.DrawLine(0, h
-1, w
-1, h
-1);
398 dc
.DrawLine(w
-1, 0, w
-1, h
); // Surely the maximum y pos. should be h - 1.
399 /// Anyway, h is required for MSW.
401 dc
.SetPen(*m_lightShadowPen
);
402 dc
.DrawLine(w
-2, 1, w
-2, h
-2); // Right hand side
403 dc
.DrawLine(1, h
-2, w
-1, h
-2); // Bottom
405 else if ( GetWindowStyleFlag() & wxSP_BORDER
)
407 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
408 dc
.SetPen(*wxBLACK_PEN
);
409 dc
.DrawRectangle(0, 0, w
-1, h
-1);
412 dc
.SetPen(wxNullPen
);
413 dc
.SetBrush(wxNullBrush
);
417 void wxSplitterWindow::DrawSash(wxDC
& dc
)
419 if ( m_sashPosition
== 0 || !m_windowTwo
)
423 GetClientSize(&w
, &h
);
425 if ( GetWindowStyleFlag() & wxSP_3D
)
427 if ( m_splitMode
== wxSPLIT_VERTICAL
)
429 dc
.SetPen(*m_facePen
);
430 dc
.SetBrush(*m_faceBrush
);
431 dc
.DrawRectangle(m_sashPosition
+ 2, 0, m_sashSize
- 4, h
);
433 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
435 dc
.SetPen(*m_lightShadowPen
);
436 dc
.DrawLine(m_sashPosition
, 1, m_sashPosition
, h
-2);
438 dc
.SetPen(*m_hilightPen
);
439 dc
.DrawLine(m_sashPosition
+1, 0, m_sashPosition
+1, h
);
441 dc
.SetPen(*m_mediumShadowPen
);
442 dc
.DrawLine(m_sashPosition
+m_sashSize
-2, 1, m_sashPosition
+m_sashSize
-2, h
-1);
444 dc
.SetPen(*m_darkShadowPen
);
445 dc
.DrawLine(m_sashPosition
+m_sashSize
-1, 2, m_sashPosition
+m_sashSize
-1, h
-2);
449 dc
.SetPen(*m_facePen
);
450 dc
.SetBrush(*m_faceBrush
);
451 dc
.DrawRectangle(0, m_sashPosition
+ 2, w
, m_sashSize
- 4);
453 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
455 dc
.SetPen(*m_lightShadowPen
);
456 dc
.DrawLine(1, m_sashPosition
, w
-2, m_sashPosition
);
458 dc
.SetPen(*m_hilightPen
);
459 dc
.DrawLine(0, m_sashPosition
+1, w
, m_sashPosition
+1);
461 dc
.SetPen(*m_mediumShadowPen
);
462 dc
.DrawLine(1, m_sashPosition
+m_sashSize
-2, w
-1, m_sashPosition
+m_sashSize
-2);
464 dc
.SetPen(*m_darkShadowPen
);
465 dc
.DrawLine(2, m_sashPosition
+m_sashSize
-1, w
-2, m_sashPosition
+m_sashSize
-1);
470 if ( m_splitMode
== wxSPLIT_VERTICAL
)
472 dc
.SetPen(*wxBLACK_PEN
);
473 dc
.SetBrush(*wxBLACK_BRUSH
);
475 if ( (GetWindowStyleFlag() & wxSP_BORDER
) != wxSP_BORDER
)
476 h1
+= 1; // Not sure why this is necessary...
477 dc
.DrawRectangle(m_sashPosition
, 0, m_sashSize
, h1
);
481 dc
.SetPen(*wxBLACK_PEN
);
482 dc
.SetBrush(*wxBLACK_BRUSH
);
484 if ( (GetWindowStyleFlag() & wxSP_BORDER
) != wxSP_BORDER
)
487 dc
.DrawRectangle(0, m_sashPosition
, w1
, m_sashSize
);
492 dc
.SetPen(wxNullPen
);
493 dc
.SetBrush(wxNullBrush
);
496 // Draw the sash tracker (for whilst moving the sash)
497 void wxSplitterWindow::DrawSashTracker(int x
, int y
)
500 GetClientSize(&w
, &h
);
506 if ( m_splitMode
== wxSPLIT_VERTICAL
)
537 ClientToScreen(&x1
, &y1
);
538 ClientToScreen(&x2
, &y2
);
540 screenDC
.SetLogicalFunction(wxINVERT
);
541 screenDC
.SetPen(*m_sashTrackerPen
);
542 screenDC
.SetBrush(*wxTRANSPARENT_BRUSH
);
544 screenDC
.DrawLine(x1
, y1
, x2
, y2
);
546 screenDC
.SetLogicalFunction(wxCOPY
);
548 screenDC
.SetPen(wxNullPen
);
549 screenDC
.SetBrush(wxNullBrush
);
552 // Position and size subwindows.
553 // Note that the border size applies to each subwindow, not
554 // including the edges next to the sash.
555 void wxSplitterWindow::SizeWindows()
558 GetClientSize(&w
, &h
);
560 if ( m_windowOne
&& !m_windowTwo
)
562 m_windowOne
->SetSize(m_borderSize
, m_borderSize
, w
- 2*m_borderSize
, h
- 2*m_borderSize
);
564 if (m_windowOne
->GetAutoLayout())
565 m_windowOne
->Layout();
567 else if ( m_windowOne
&& m_windowTwo
)
569 if (m_splitMode
== wxSPLIT_VERTICAL
)
571 int x1
= m_borderSize
;
572 int y1
= m_borderSize
;
573 int w1
= m_sashPosition
- m_borderSize
;
574 int h1
= h
- 2*m_borderSize
;
576 int x2
= m_sashPosition
+ m_sashSize
;
577 int y2
= m_borderSize
;
578 int w2
= w
- 2*m_borderSize
- m_sashSize
- w1
;
579 int h2
= h
- 2*m_borderSize
;
581 m_windowOne
->SetSize(x1
, y1
, w1
, h1
);
582 m_windowTwo
->SetSize(x2
, y2
, w2
, h2
);
584 if (m_windowOne
->GetAutoLayout())
585 m_windowOne
->Layout();
586 if (m_windowTwo
->GetAutoLayout())
587 m_windowTwo
->Layout();
591 m_windowOne
->SetSize(m_borderSize
, m_borderSize
,
592 w
- 2*m_borderSize
, m_sashPosition
- m_borderSize
);
593 m_windowTwo
->SetSize(m_borderSize
, m_sashPosition
+ m_sashSize
,
594 w
- 2*m_borderSize
, h
- 2*m_borderSize
- m_sashSize
- (m_sashPosition
- m_borderSize
));
596 if (m_windowOne
->GetAutoLayout())
597 m_windowOne
->Layout();
598 if (m_windowTwo
->GetAutoLayout())
599 m_windowTwo
->Layout();
611 // Set pane for unsplit window
612 void wxSplitterWindow::Initialize(wxWindow
*window
)
614 m_windowOne
= window
;
615 m_windowTwo
= (wxWindow
*) NULL
;
619 // Associates the given window with window 2, drawing the appropriate sash
620 // and changing the split mode.
621 // Does nothing and returns FALSE if the window is already split.
622 bool wxSplitterWindow::SplitVertically(wxWindow
*window1
, wxWindow
*window2
, int sashPosition
)
628 GetClientSize(&w
, &h
);
630 m_splitMode
= wxSPLIT_VERTICAL
;
631 m_windowOne
= window1
;
632 m_windowTwo
= window2
;
633 if ( sashPosition
> 0 )
634 m_sashPosition
= sashPosition
;
635 else if ( sashPosition
< 0 )
636 m_sashPosition
= w
- sashPosition
;
638 m_sashPosition
= w
/2;
645 bool wxSplitterWindow::SplitHorizontally(wxWindow
*window1
, wxWindow
*window2
, int sashPosition
)
651 GetClientSize(&w
, &h
);
653 m_splitMode
= wxSPLIT_HORIZONTAL
;
654 m_windowOne
= window1
;
655 m_windowTwo
= window2
;
656 if ( sashPosition
> 0 )
657 m_sashPosition
= sashPosition
;
658 else if ( sashPosition
< 0 )
659 m_sashPosition
= h
- sashPosition
;
661 m_sashPosition
= h
/2;
669 // Remove the specified (or second) window from the view
670 // Doesn't actually delete the window.
671 bool wxSplitterWindow::Unsplit(wxWindow
*toRemove
)
676 wxWindow
*win
= NULL
;
677 if ( toRemove
== NULL
|| toRemove
== m_windowTwo
)
680 m_windowTwo
= (wxWindow
*) NULL
;
682 else if ( toRemove
== m_windowOne
)
685 m_windowOne
= m_windowTwo
;
686 m_windowTwo
= (wxWindow
*) NULL
;
690 wxFAIL_MSG(_T("splitter: attempt to remove a non-existent window"));
695 SendUnsplitEvent(win
);
702 // Replace a window with another one
703 bool wxSplitterWindow::ReplaceWindow(wxWindow
*winOld
, wxWindow
*winNew
)
705 wxCHECK_MSG( winOld
, FALSE
, _T("use one of Split() functions instead") );
706 wxCHECK_MSG( winNew
, FALSE
, _T("use Unsplit() functions instead") );
708 if ( winOld
== m_windowTwo
)
710 m_windowTwo
= winNew
;
712 else if ( winOld
== m_windowOne
)
714 m_windowOne
= winNew
;
718 wxFAIL_MSG(_T("splitter: attempt to replace a non-existent window"));
728 void wxSplitterWindow::SetSashPosition(int position
, bool redraw
)
730 m_sashPosition
= position
;
738 // Initialize colours
739 void wxSplitterWindow::InitColours()
741 wxDELETE( m_facePen
);
742 wxDELETE( m_faceBrush
);
743 wxDELETE( m_mediumShadowPen
);
744 wxDELETE( m_darkShadowPen
);
745 wxDELETE( m_lightShadowPen
);
746 wxDELETE( m_hilightPen
);
749 #if defined(__WIN95__)
750 wxColour
faceColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
));
751 m_facePen
= new wxPen(faceColour
, 1, wxSOLID
);
752 m_faceBrush
= new wxBrush(faceColour
, wxSOLID
);
754 wxColour
mediumShadowColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DSHADOW
));
755 m_mediumShadowPen
= new wxPen(mediumShadowColour
, 1, wxSOLID
);
757 wxColour
darkShadowColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DDKSHADOW
));
758 m_darkShadowPen
= new wxPen(darkShadowColour
, 1, wxSOLID
);
760 wxColour
lightShadowColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT
));
761 m_lightShadowPen
= new wxPen(lightShadowColour
, 1, wxSOLID
);
763 wxColour
hilightColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHILIGHT
));
764 m_hilightPen
= new wxPen(hilightColour
, 1, wxSOLID
);
766 m_facePen
= new wxPen("LIGHT GREY", 1, wxSOLID
);
767 m_faceBrush
= new wxBrush("LIGHT GREY", wxSOLID
);
768 m_mediumShadowPen
= new wxPen("GREY", 1, wxSOLID
);
769 m_darkShadowPen
= new wxPen("BLACK", 1, wxSOLID
);
770 m_lightShadowPen
= new wxPen("LIGHT GREY", 1, wxSOLID
);
771 m_hilightPen
= new wxPen("WHITE", 1, wxSOLID
);
772 #endif // Win32/!Win32
775 void wxSplitterWindow::SendUnsplitEvent(wxWindow
*winRemoved
)
777 wxSplitterEvent
event(wxEVT_COMMAND_SPLITTER_UNSPLIT
, this);
778 event
.m_data
.win
= winRemoved
;
780 (void)GetEventHandler()->ProcessEvent(event
);
783 // ---------------------------------------------------------------------------
784 // splitter event handlers
785 // ---------------------------------------------------------------------------
787 void wxSplitterWindow::OnSashPosChanged(wxSplitterEvent
& event
)
789 // If within UNSPLIT_THRESHOLD from edge, set to edge to cause closure.
790 const int UNSPLIT_THRESHOLD
= 4;
792 int newSashPosition
= event
.GetSashPosition();
794 // Obtain relevant window dimension for bottom / right threshold check
796 GetClientSize(&w
, &h
);
797 int window_size
= (m_splitMode
== wxSPLIT_VERTICAL
) ? w
: h
;
799 bool unsplit_scenario
= FALSE
;
800 if ( m_permitUnsplitAlways
801 || m_minimumPaneSize
== 0 )
803 // Do edge detection if unsplit premitted
804 if ( newSashPosition
<= UNSPLIT_THRESHOLD
)
806 // threshold top / left check
808 unsplit_scenario
= TRUE
;
810 if ( newSashPosition
>= window_size
- UNSPLIT_THRESHOLD
)
812 // threshold bottom/right check
813 newSashPosition
= window_size
;
814 unsplit_scenario
= TRUE
;
818 if ( !unsplit_scenario
)
820 // If resultant pane would be too small, enlarge it
821 if ( newSashPosition
< m_minimumPaneSize
)
822 newSashPosition
= m_minimumPaneSize
;
823 if ( newSashPosition
> window_size
- m_minimumPaneSize
)
824 newSashPosition
= window_size
- m_minimumPaneSize
;
827 // If the result is out of bounds it means minimum size is too big,
828 // so split window in half as best compromise.
829 if ( newSashPosition
< 0 || newSashPosition
> window_size
)
830 newSashPosition
= window_size
/ 2;
832 // for compatibility, call the virtual function
833 if ( !OnSashPositionChange(newSashPosition
) )
835 newSashPosition
= -1;
838 event
.SetSashPosition(newSashPosition
);
841 // Called when the sash is double-clicked. The default behaviour is to remove
842 // the sash if the minimum pane size is zero.
843 void wxSplitterWindow::OnDoubleClick(wxSplitterEvent
& event
)
845 // for compatibility, call the virtual function
846 OnDoubleClickSash(event
.GetX(), event
.GetY());
848 if ( GetMinimumPaneSize() == 0
849 || m_permitUnsplitAlways
)
855 void wxSplitterWindow::OnUnsplitEvent(wxSplitterEvent
& event
)
857 wxWindow
*win
= event
.GetWindowBeingRemoved();
859 // for compatibility, call the virtual function