1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/splitter.cpp
3 // Purpose: wxSplitterWindow implementation
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "splitter.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
26 #include "wx/string.h"
30 #include "wx/dcscreen.h"
32 #include "wx/window.h"
33 #include "wx/dialog.h"
36 #include "wx/settings.h"
40 #include "wx/mac/private.h"
43 #include "wx/renderer.h"
45 #include "wx/splitter.h"
49 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
)
50 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING
)
51 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
)
52 DEFINE_EVENT_TYPE(wxEVT_COMMAND_SPLITTER_UNSPLIT
)
54 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow
, wxWindow
)
65 IMPLEMENT_DYNAMIC_CLASS(wxSplitterEvent
, wxNotifyEvent
)
67 BEGIN_EVENT_TABLE(wxSplitterWindow
, wxWindow
)
68 EVT_PAINT(wxSplitterWindow::OnPaint
)
69 EVT_SIZE(wxSplitterWindow::OnSize
)
70 EVT_MOUSE_EVENTS(wxSplitterWindow::OnMouseEvent
)
72 #if defined( __WXMSW__ ) || defined( __WXMAC__)
73 EVT_SET_CURSOR(wxSplitterWindow::OnSetCursor
)
76 WX_EVENT_TABLE_CONTROL_CONTAINER(wxSplitterWindow
)
79 WX_DELEGATE_TO_CONTROL_CONTAINER(wxSplitterWindow
);
81 bool wxSplitterWindow::Create(wxWindow
*parent
, wxWindowID id
,
87 // allow TABbing from one window to the other
88 style
|= wxTAB_TRAVERSAL
;
90 // we draw our border ourselves to blend the sash with it
91 style
&= ~wxBORDER_MASK
;
92 style
|= wxBORDER_NONE
;
94 if ( !wxWindow::Create(parent
, id
, pos
, size
, style
, name
) )
97 m_permitUnsplitAlways
= (style
& wxSP_PERMIT_UNSPLIT
) != 0;
99 // don't erase the splitter background, it's pointless as we overwrite it
101 SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
106 void wxSplitterWindow::Init()
108 m_container
.SetContainerWindow(this);
110 m_splitMode
= wxSPLIT_VERTICAL
;
111 m_permitUnsplitAlways
= true;
112 m_windowOne
= (wxWindow
*) NULL
;
113 m_windowTwo
= (wxWindow
*) NULL
;
114 m_dragMode
= wxSPLIT_DRAG_NONE
;
119 m_sashPosition
= m_requestedSashPosition
= 0;
121 m_lastSize
= wxSize(0,0);
122 m_checkRequestedSashPosition
= false;
123 m_minimumPaneSize
= 0;
124 m_sashCursorWE
= wxCursor(wxCURSOR_SIZEWE
);
125 m_sashCursorNS
= wxCursor(wxCURSOR_SIZENS
);
126 m_sashTrackerPen
= new wxPen(*wxBLACK
, 2, wxSOLID
);
128 m_needUpdating
= false;
132 wxSplitterWindow::~wxSplitterWindow()
134 delete m_sashTrackerPen
;
137 // ----------------------------------------------------------------------------
138 // entering/leaving sash
139 // ----------------------------------------------------------------------------
141 void wxSplitterWindow::RedrawIfHotSensitive(bool isHot
)
143 if ( wxRendererNative::Get().GetSplitterParams(this).isHotSensitive
)
150 //else: we don't change our appearance, don't redraw to avoid flicker
153 void wxSplitterWindow::OnEnterSash()
157 RedrawIfHotSensitive(true);
160 void wxSplitterWindow::OnLeaveSash()
162 SetCursor(*wxSTANDARD_CURSOR
);
164 RedrawIfHotSensitive(false);
167 void wxSplitterWindow::SetResizeCursor()
169 SetCursor(m_splitMode
== wxSPLIT_VERTICAL
? m_sashCursorWE
173 // ----------------------------------------------------------------------------
174 // other event handlers
175 // ----------------------------------------------------------------------------
177 void wxSplitterWindow::OnPaint(wxPaintEvent
& WXUNUSED(event
))
184 void wxSplitterWindow::OnInternalIdle()
186 wxWindow::OnInternalIdle();
188 // if this is the first idle time after a sash position has potentially
189 // been set, allow SizeWindows to check for a requested size.
190 if (!m_checkRequestedSashPosition
)
192 m_checkRequestedSashPosition
= true;
194 return; // it won't needUpdating in this case
201 void wxSplitterWindow::OnMouseEvent(wxMouseEvent
& event
)
203 int x
= (int)event
.GetX(),
204 y
= (int)event
.GetY();
206 if (GetWindowStyle() & wxSP_NOSASH
)
209 // with wxSP_LIVE_UPDATE style the splitter windows are always resized
210 // following the mouse movement while it drags the sash, without it we only
211 // draw the sash at the new position but only resize the windows when the
212 // dragging is finished
213 #if defined( __WXMAC__ ) && TARGET_API_MAC_OSX == 1
216 bool isLive
= (GetWindowStyleFlag() & wxSP_LIVE_UPDATE
) != 0;
218 if (event
.LeftDown())
220 if ( SashHitTest(x
, y
) )
222 // Start the drag now
223 m_dragMode
= wxSPLIT_DRAG_DRAGGING
;
225 // Capture mouse and set the cursor
231 // remember the initial sash position and draw the initial
233 m_sashPositionCurrent
= m_sashPosition
;
235 DrawSashTracker(x
, y
);
245 else if (event
.LeftUp() && m_dragMode
== wxSPLIT_DRAG_DRAGGING
)
247 // We can stop dragging now and see what we've got.
248 m_dragMode
= wxSPLIT_DRAG_NONE
;
250 // Release mouse and unset the cursor
252 SetCursor(* wxSTANDARD_CURSOR
);
254 // exit if unsplit after doubleclick
263 DrawSashTracker(m_oldX
, m_oldY
);
266 // the position of the click doesn't exactly correspond to
267 // m_sashPosition, rather it changes it by the distance by which the
269 int diff
= m_splitMode
== wxSPLIT_VERTICAL
? x
- m_oldX
: y
- m_oldY
;
271 int posSashOld
= isLive
? m_sashPosition
: m_sashPositionCurrent
;
272 int posSashNew
= OnSashPositionChanging(posSashOld
+ diff
);
273 if ( posSashNew
== -1 )
275 // change not allowed
279 if ( m_permitUnsplitAlways
|| m_minimumPaneSize
== 0 )
281 // Deal with possible unsplit scenarios
282 if ( posSashNew
== 0 )
284 // We remove the first window from the view
285 wxWindow
*removedWindow
= m_windowOne
;
286 m_windowOne
= m_windowTwo
;
287 m_windowTwo
= (wxWindow
*) NULL
;
288 OnUnsplit(removedWindow
);
289 wxSplitterEvent
event(wxEVT_COMMAND_SPLITTER_UNSPLIT
, this);
290 event
.m_data
.win
= removedWindow
;
291 (void)DoSendEvent(event
);
292 SetSashPositionAndNotify(0);
294 else if ( posSashNew
== GetWindowSize() )
296 // We remove the second window from the view
297 wxWindow
*removedWindow
= m_windowTwo
;
298 m_windowTwo
= (wxWindow
*) NULL
;
299 OnUnsplit(removedWindow
);
300 wxSplitterEvent
event(wxEVT_COMMAND_SPLITTER_UNSPLIT
, this);
301 event
.m_data
.win
= removedWindow
;
302 (void)DoSendEvent(event
);
303 SetSashPositionAndNotify(0);
307 SetSashPositionAndNotify(posSashNew
);
312 SetSashPositionAndNotify(posSashNew
);
316 } // left up && dragging
317 else if ((event
.Moving() || event
.Leaving() || event
.Entering()) && (m_dragMode
== wxSPLIT_DRAG_NONE
))
319 if ( event
.Leaving() || !SashHitTest(x
, y
) )
324 else if (event
.Dragging() && (m_dragMode
== wxSPLIT_DRAG_DRAGGING
))
326 int diff
= m_splitMode
== wxSPLIT_VERTICAL
? x
- m_oldX
: y
- m_oldY
;
329 // nothing to do, mouse didn't really move far enough
333 int posSashOld
= isLive
? m_sashPosition
: m_sashPositionCurrent
;
334 int posSashNew
= OnSashPositionChanging(posSashOld
+ diff
);
335 if ( posSashNew
== -1 )
337 // change not allowed
341 if ( posSashNew
== m_sashPosition
)
347 DrawSashTracker(m_oldX
, m_oldY
);
350 if (m_splitMode
== wxSPLIT_VERTICAL
)
355 // Remember old positions
360 // As we captured the mouse, we may get the mouse events from outside
361 // our window - for example, negative values in x, y. This has a weird
362 // consequence under MSW where we use unsigned values sometimes and
363 // signed ones other times: the coordinates turn as big positive
364 // numbers and so the sash is drawn on the *right* side of the window
365 // instead of the left (or bottom instead of top). Correct this.
366 if ( (short)m_oldX
< 0 )
368 if ( (short)m_oldY
< 0 )
375 m_sashPositionCurrent
= posSashNew
;
377 DrawSashTracker(m_oldX
, m_oldY
);
381 SetSashPositionAndNotify(posSashNew
);
382 m_needUpdating
= true;
385 else if ( event
.LeftDClick() && m_windowTwo
)
387 OnDoubleClickSash(x
, y
);
391 void wxSplitterWindow::OnSize(wxSizeEvent
& event
)
393 // only process this message if we're not iconized - otherwise iconizing
394 // and restoring a window containing the splitter has a funny side effect
395 // of changing the splitter position!
396 wxWindow
*parent
= wxGetTopLevelParent(this);
399 wxTopLevelWindow
*winTop
= wxDynamicCast(parent
, wxTopLevelWindow
);
402 iconized
= winTop
->IsIconized();
406 wxFAIL_MSG(wxT("should have a top level parent!"));
413 m_lastSize
= wxSize(0,0);
423 GetClientSize(&w
, &h
);
425 int size
= m_splitMode
== wxSPLIT_VERTICAL
? w
: h
;
427 int old_size
= m_splitMode
== wxSPLIT_VERTICAL
? m_lastSize
.x
: m_lastSize
.y
;
430 int delta
= (int) ( (size
- old_size
)*m_sashGravity
);
433 int newPosition
= m_sashPosition
+ delta
;
434 if( newPosition
< m_minimumPaneSize
)
435 newPosition
= m_minimumPaneSize
;
436 SetSashPositionAndNotify(newPosition
);
440 if ( m_sashPosition
>= size
- 5 )
441 SetSashPositionAndNotify(wxMax(10, size
- 40));
442 m_lastSize
= wxSize(w
,h
);
448 void wxSplitterWindow::SetSashGravity(double gravity
)
450 wxCHECK_RET( gravity
>= 0. && gravity
<= 1.,
451 _T("invalid gravity value") );
453 m_sashGravity
= gravity
;
456 bool wxSplitterWindow::SashHitTest(int x
, int y
, int tolerance
)
458 if ( m_windowTwo
== NULL
|| m_sashPosition
== 0)
459 return false; // No sash
461 int z
= m_splitMode
== wxSPLIT_VERTICAL
? x
: y
;
462 int hitMin
= m_sashPosition
- tolerance
;
463 int hitMax
= m_sashPosition
+ GetSashSize() + tolerance
;
465 return z
>= hitMin
&& z
<= hitMax
;
468 int wxSplitterWindow::GetSashSize() const
470 return wxRendererNative::Get().GetSplitterParams(this).widthSash
;
473 int wxSplitterWindow::GetBorderSize() const
475 return wxRendererNative::Get().GetSplitterParams(this).border
;
479 void wxSplitterWindow::DrawSash(wxDC
& dc
)
481 if (HasFlag(wxSP_3DBORDER
))
482 wxRendererNative::Get().DrawSplitterBorder
489 // don't draw sash if we're not split
490 if ( m_sashPosition
== 0 || !m_windowTwo
)
493 // nor if we're configured to not show it
494 if ( HasFlag(wxSP_NOSASH
) )
497 wxRendererNative::Get().DrawSplitterSash
503 m_splitMode
== wxSPLIT_VERTICAL
? wxVERTICAL
505 m_isHot
? wxCONTROL_CURRENT
: 0
509 // Draw the sash tracker (for whilst moving the sash)
510 void wxSplitterWindow::DrawSashTracker(int x
, int y
)
513 GetClientSize(&w
, &h
);
519 if ( m_splitMode
== wxSPLIT_VERTICAL
)
550 ClientToScreen(&x1
, &y1
);
551 ClientToScreen(&x2
, &y2
);
553 screenDC
.SetLogicalFunction(wxINVERT
);
554 screenDC
.SetPen(*m_sashTrackerPen
);
555 screenDC
.SetBrush(*wxTRANSPARENT_BRUSH
);
557 screenDC
.DrawLine(x1
, y1
, x2
, y2
);
559 screenDC
.SetLogicalFunction(wxCOPY
);
562 int wxSplitterWindow::GetWindowSize() const
564 wxSize size
= GetClientSize();
566 return m_splitMode
== wxSPLIT_VERTICAL
? size
.x
: size
.y
;
569 int wxSplitterWindow::AdjustSashPosition(int sashPos
) const
571 int window_size
= GetWindowSize();
578 // the window shouldn't be smaller than its own minimal size nor
579 // smaller than the minimual pane size specified for this splitter
580 int minSize
= m_splitMode
== wxSPLIT_VERTICAL
? win
->GetMinWidth()
581 : win
->GetMinHeight();
583 if ( minSize
== -1 || m_minimumPaneSize
> minSize
)
584 minSize
= m_minimumPaneSize
;
586 minSize
+= GetBorderSize();
588 if ( sashPos
< minSize
)
595 int minSize
= m_splitMode
== wxSPLIT_VERTICAL
? win
->GetMinWidth()
596 : win
->GetMinHeight();
598 if ( minSize
== -1 || m_minimumPaneSize
> minSize
)
599 minSize
= m_minimumPaneSize
;
601 int maxSize
= window_size
- minSize
- GetBorderSize() - GetSashSize();
602 if ( sashPos
> maxSize
)
609 bool wxSplitterWindow::DoSetSashPosition(int sashPos
)
611 int newSashPosition
= AdjustSashPosition(sashPos
);
613 if ( newSashPosition
== m_sashPosition
)
616 m_sashPosition
= newSashPosition
;
621 void wxSplitterWindow::SetSashPositionAndNotify(int sashPos
)
623 // we must reset the request here, otherwise the sash would be stuck at
624 // old position if the user attempted to move the sash after invalid
625 // (e.g. smaller than minsize) sash position was requested using
626 // SetSashPosition():
627 m_requestedSashPosition
= INT_MAX
;
629 if ( DoSetSashPosition(sashPos
) )
631 wxSplitterEvent
event(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
, this);
632 event
.m_data
.pos
= m_sashPosition
;
634 (void)DoSendEvent(event
);
638 // Position and size subwindows.
639 // Note that the border size applies to each subwindow, not
640 // including the edges next to the sash.
641 void wxSplitterWindow::SizeWindows()
643 // check if we have delayed setting the real sash position
644 if ( m_checkRequestedSashPosition
&& m_requestedSashPosition
!= INT_MAX
)
646 int newSashPosition
= ConvertSashPosition(m_requestedSashPosition
);
647 if ( newSashPosition
!= m_sashPosition
)
649 DoSetSashPosition(newSashPosition
);
652 if ( newSashPosition
<= m_sashPosition
653 && newSashPosition
>= m_sashPosition
- GetBorderSize() )
655 // don't update it any more
656 m_requestedSashPosition
= INT_MAX
;
661 GetClientSize(&w
, &h
);
663 if ( GetWindow1() && !GetWindow2() )
665 GetWindow1()->SetSize(GetBorderSize(), GetBorderSize(),
666 w
- 2*GetBorderSize(), h
- 2*GetBorderSize());
668 else if ( GetWindow1() && GetWindow2() )
670 const int border
= GetBorderSize(),
671 sash
= GetSashSize();
673 int size1
= GetSashPosition() - border
,
674 size2
= GetSashPosition() + sash
;
676 int x2
, y2
, w1
, h1
, w2
, h2
;
677 if ( GetSplitMode() == wxSPLIT_VERTICAL
)
680 w2
= w
- 2*border
- sash
- w1
;
686 else // horz splitter
691 h2
= h
- 2*border
- sash
- h1
;
696 GetWindow1()->SetSize(border
, border
, w1
, h1
);
697 GetWindow2()->SetSize(x2
, y2
, w2
, h2
);
703 SetNeedUpdating(false);
706 // Set pane for unsplit window
707 void wxSplitterWindow::Initialize(wxWindow
*window
)
709 wxASSERT_MSG( (!window
|| (window
&& window
->GetParent() == this)),
710 _T("windows in the splitter should have it as parent!") );
712 m_windowOne
= window
;
713 m_windowTwo
= (wxWindow
*) NULL
;
714 DoSetSashPosition(0);
717 // Associates the given window with window 2, drawing the appropriate sash
718 // and changing the split mode.
719 // Does nothing and returns false if the window is already split.
720 bool wxSplitterWindow::DoSplit(wxSplitMode mode
,
721 wxWindow
*window1
, wxWindow
*window2
,
727 wxCHECK_MSG( window1
&& window2
, false,
728 _T("can not split with NULL window(s)") );
730 wxCHECK_MSG( window1
->GetParent() == this && window2
->GetParent() == this, false,
731 _T("windows in the splitter should have it as parent!") );
734 m_windowOne
= window1
;
735 m_windowTwo
= window2
;
737 // remember the sash position we want to set for later if we can't set it
738 // right now (e.g. because the window is too small)
739 m_requestedSashPosition
= sashPosition
;
740 m_checkRequestedSashPosition
= false;
742 DoSetSashPosition(ConvertSashPosition(sashPosition
));
749 int wxSplitterWindow::ConvertSashPosition(int sashPosition
) const
751 if ( sashPosition
> 0 )
755 else if ( sashPosition
< 0 )
757 // It's negative so adding is subtracting
758 return GetWindowSize() + sashPosition
;
760 else // sashPosition == 0
762 // default, put it in the centre
763 return GetWindowSize() / 2;
767 // Remove the specified (or second) window from the view
768 // Doesn't actually delete the window.
769 bool wxSplitterWindow::Unsplit(wxWindow
*toRemove
)
775 if ( toRemove
== NULL
|| toRemove
== m_windowTwo
)
778 m_windowTwo
= (wxWindow
*) NULL
;
780 else if ( toRemove
== m_windowOne
)
783 m_windowOne
= m_windowTwo
;
784 m_windowTwo
= (wxWindow
*) NULL
;
788 wxFAIL_MSG(wxT("splitter: attempt to remove a non-existent window"));
794 DoSetSashPosition(0);
800 // Replace a window with another one
801 bool wxSplitterWindow::ReplaceWindow(wxWindow
*winOld
, wxWindow
*winNew
)
803 wxCHECK_MSG( winOld
, false, wxT("use one of Split() functions instead") );
804 wxCHECK_MSG( winNew
, false, wxT("use Unsplit() functions instead") );
806 if ( winOld
== m_windowTwo
)
808 m_windowTwo
= winNew
;
810 else if ( winOld
== m_windowOne
)
812 m_windowOne
= winNew
;
816 wxFAIL_MSG(wxT("splitter: attempt to replace a non-existent window"));
826 void wxSplitterWindow::SetMinimumPaneSize(int min
)
828 m_minimumPaneSize
= min
;
829 int pos
= m_requestedSashPosition
!= INT_MAX
? m_requestedSashPosition
: m_sashPosition
;
830 SetSashPosition(pos
); // re-check limits
833 void wxSplitterWindow::SetSashPosition(int position
, bool redraw
)
835 // remember the sash position we want to set for later if we can't set it
836 // right now (e.g. because the window is too small)
837 m_requestedSashPosition
= position
;
838 m_checkRequestedSashPosition
= false;
840 DoSetSashPosition(ConvertSashPosition(position
));
848 // Make sure the child window sizes are updated. This is useful
849 // for reducing flicker by updating the sizes before a
850 // window is shown, if you know the overall size is correct.
851 void wxSplitterWindow::UpdateSize()
853 m_checkRequestedSashPosition
= true;
855 m_checkRequestedSashPosition
= false;
858 bool wxSplitterWindow::DoSendEvent(wxSplitterEvent
& event
)
860 return !GetEventHandler()->ProcessEvent(event
) || event
.IsAllowed();
863 wxSize
wxSplitterWindow::DoGetBestSize() const
865 // get best sizes of subwindows
868 size1
= m_windowOne
->GetBestSize();
870 size2
= m_windowTwo
->GetBestSize();
874 // pSash points to the size component to which sash size must be added
877 if ( m_splitMode
== wxSPLIT_VERTICAL
)
879 sizeBest
.y
= wxMax(size1
.y
, size2
.y
);
880 sizeBest
.x
= wxMax(size1
.x
, m_minimumPaneSize
) +
881 wxMax(size2
.x
, m_minimumPaneSize
);
885 else // wxSPLIT_HORIZONTAL
887 sizeBest
.x
= wxMax(size1
.x
, size2
.x
);
888 sizeBest
.y
= wxMax(size1
.y
, m_minimumPaneSize
) +
889 wxMax(size2
.y
, m_minimumPaneSize
);
894 // account for the border and the sash
895 int border
= 2*GetBorderSize();
896 *pSash
+= GetSashSize();
897 sizeBest
.x
+= border
;
898 sizeBest
.y
+= border
;
903 // ---------------------------------------------------------------------------
904 // wxSplitterWindow virtual functions: they now just generate the events
905 // ---------------------------------------------------------------------------
907 bool wxSplitterWindow::OnSashPositionChange(int WXUNUSED(newSashPosition
))
909 // always allow by default
913 int wxSplitterWindow::OnSashPositionChanging(int newSashPosition
)
915 // If within UNSPLIT_THRESHOLD from edge, set to edge to cause closure.
916 const int UNSPLIT_THRESHOLD
= 4;
918 // first of all, check if OnSashPositionChange() doesn't forbid this change
919 if ( !OnSashPositionChange(newSashPosition
) )
925 // Obtain relevant window dimension for bottom / right threshold check
926 int window_size
= GetWindowSize();
928 bool unsplit_scenario
= false;
929 if ( m_permitUnsplitAlways
|| m_minimumPaneSize
== 0 )
931 // Do edge detection if unsplit premitted
932 if ( newSashPosition
<= UNSPLIT_THRESHOLD
)
934 // threshold top / left check
936 unsplit_scenario
= true;
938 if ( newSashPosition
>= window_size
- UNSPLIT_THRESHOLD
)
940 // threshold bottom/right check
941 newSashPosition
= window_size
;
942 unsplit_scenario
= true;
946 if ( !unsplit_scenario
)
948 // If resultant pane would be too small, enlarge it
949 newSashPosition
= AdjustSashPosition(newSashPosition
);
952 // If the result is out of bounds it means minimum size is too big,
953 // so split window in half as best compromise.
954 if ( newSashPosition
< 0 || newSashPosition
> window_size
)
955 newSashPosition
= window_size
/ 2;
957 // now let the event handler have it
959 // FIXME: shouldn't we do it before the adjustments above so as to ensure
960 // that the sash position is always reasonable?
961 wxSplitterEvent
event(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING
, this);
962 event
.m_data
.pos
= newSashPosition
;
964 if ( !DoSendEvent(event
) )
966 // the event handler vetoed the change
967 newSashPosition
= -1;
971 // it could have been changed by it
972 newSashPosition
= event
.GetSashPosition();
975 return newSashPosition
;
978 // Called when the sash is double-clicked. The default behaviour is to remove
979 // the sash if the minimum pane size is zero.
980 void wxSplitterWindow::OnDoubleClickSash(int x
, int y
)
982 wxCHECK_RET(m_windowTwo
, wxT("splitter: no window to remove"));
984 // new code should handle events instead of using the virtual functions
985 wxSplitterEvent
event(wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
, this);
986 event
.m_data
.pt
.x
= x
;
987 event
.m_data
.pt
.y
= y
;
988 if ( DoSendEvent(event
) )
990 if ( GetMinimumPaneSize() == 0 || m_permitUnsplitAlways
)
992 wxWindow
* win
= m_windowTwo
;
995 wxSplitterEvent
unsplitEvent(wxEVT_COMMAND_SPLITTER_UNSPLIT
, this);
996 unsplitEvent
.m_data
.win
= win
;
997 (void)DoSendEvent(unsplitEvent
);
1001 //else: blocked by user
1004 void wxSplitterWindow::OnUnsplit(wxWindow
*winRemoved
)
1006 // call this before calling the event handler which may delete the window
1007 winRemoved
->Show(false);
1010 #if defined( __WXMSW__ ) || defined( __WXMAC__)
1012 // this is currently called (and needed) under MSW only...
1013 void wxSplitterWindow::OnSetCursor(wxSetCursorEvent
& event
)
1015 // if we don't do it, the resizing cursor might be set for child window:
1016 // and like this we explicitly say that our cursor should not be used for
1017 // children windows which overlap us
1019 if ( SashHitTest(event
.GetX(), event
.GetY(), 0) )
1021 // default processing is ok
1024 //else: do nothing, in particular, don't call Skip()
1027 #endif // wxMSW || wxMac
1029 #endif // wxUSE_SPLITTER