+#endif // Win32/!Win32
+}
+
+void wxSplitterWindow::SendUnsplitEvent(wxWindow *winRemoved)
+{
+ wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_UNSPLIT, this);
+ event.m_data.win = winRemoved;
+
+ (void)GetEventHandler()->ProcessEvent(event);
+}
+
+// ---------------------------------------------------------------------------
+// splitter event handlers
+// ---------------------------------------------------------------------------
+
+void wxSplitterWindow::OnSashPosChanged(wxSplitterEvent& event)
+{
+ // If within UNSPLIT_THRESHOLD from edge, set to edge to cause closure.
+ const int UNSPLIT_THRESHOLD = 4;
+
+ int newSashPosition = event.GetSashPosition();
+
+ // Obtain relevant window dimension for bottom / right threshold check
+ int w, h;
+ GetClientSize(&w, &h);
+ int window_size = (m_splitMode == wxSPLIT_VERTICAL) ? w : h ;
+
+ bool unsplit_scenario = FALSE;
+ if ( m_permitUnsplitAlways
+ || m_minimumPaneSize == 0 )
+ {
+ // Do edge detection if unsplit premitted
+ if ( newSashPosition <= UNSPLIT_THRESHOLD )
+ {
+ // threshold top / left check
+ newSashPosition = 0;
+ unsplit_scenario = TRUE;
+ }
+ if ( newSashPosition >= window_size - UNSPLIT_THRESHOLD )
+ {
+ // threshold bottom/right check
+ newSashPosition = window_size;
+ unsplit_scenario = TRUE;
+ }
+ }
+
+ if ( !unsplit_scenario )
+ {
+ // If resultant pane would be too small, enlarge it
+ if ( newSashPosition < m_minimumPaneSize )
+ newSashPosition = m_minimumPaneSize;
+ if ( newSashPosition > window_size - m_minimumPaneSize )
+ newSashPosition = window_size - m_minimumPaneSize;
+ }
+
+ // If the result is out of bounds it means minimum size is too big,
+ // so split window in half as best compromise.
+ if ( newSashPosition < 0 || newSashPosition > window_size )
+ newSashPosition = window_size / 2;
+
+ // for compatibility, call the virtual function
+ if ( !OnSashPositionChange(newSashPosition) )
+ {
+ newSashPosition = -1;
+ }
+
+ event.SetSashPosition(newSashPosition);
+}
+
+// Called when the sash is double-clicked. The default behaviour is to remove
+// the sash if the minimum pane size is zero.
+void wxSplitterWindow::OnDoubleClick(wxSplitterEvent& event)
+{
+ // for compatibility, call the virtual function
+ OnDoubleClickSash(event.GetX(), event.GetY());
+
+ if ( GetMinimumPaneSize() == 0 || m_permitUnsplitAlways )
+ {
+ Unsplit();
+ }