+int wxSplitterWindow::GetWindowSize() const
+{
+ wxSize size = GetClientSize();
+
+ return m_splitMode == wxSPLIT_VERTICAL ? size.x : size.y;
+}
+
+int wxSplitterWindow::AdjustSashPosition(int sashPos) const
+{
+ int window_size = GetWindowSize();
+
+ wxWindow *win;
+
+ win = GetWindow1();
+ if ( win )
+ {
+ // the window shouldn't be smaller than its own minimal size nor
+ // smaller than the minimual pane size specified for this splitter
+ int minSize = m_splitMode == wxSPLIT_VERTICAL ? win->GetMinWidth()
+ : win->GetMinHeight();
+
+ if ( minSize == -1 || m_minimumPaneSize > minSize )
+ minSize = m_minimumPaneSize;
+
+ minSize += GetBorderSize();
+
+ if ( sashPos < minSize )
+ sashPos = minSize;
+ }
+
+ win = GetWindow2();
+ if ( win )
+ {
+ int minSize = m_splitMode == wxSPLIT_VERTICAL ? win->GetMinWidth()
+ : win->GetMinHeight();
+
+ if ( minSize == -1 || m_minimumPaneSize > minSize )
+ minSize = m_minimumPaneSize;
+
+ int maxSize = window_size - minSize - GetBorderSize();
+ if ( sashPos > maxSize )
+ sashPos = maxSize;
+ }
+
+ return sashPos;
+}
+
+bool wxSplitterWindow::DoSetSashPosition(int sashPos)
+{
+ int newSashPosition = AdjustSashPosition(sashPos);
+
+ if ( newSashPosition == m_sashPosition )
+ return FALSE;
+
+ m_sashPosition = newSashPosition;
+
+ return TRUE;
+}
+
+void wxSplitterWindow::SetSashPositionAndNotify(int sashPos)
+{
+ if ( DoSetSashPosition(sashPos) )
+ {
+ wxSplitterEvent event(wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, this);
+ event.m_data.pos = m_sashPosition;
+
+ (void)DoSendEvent(event);
+ }