- // We remove the second window from the view
- wxWindow *removedWindow = m_windowTwo;
- m_windowTwo = (wxWindow *) NULL;
- SendUnsplitEvent(removedWindow);
- m_sashPosition = 0;
+ // Deal with possible unsplit scenarios
+ if ( posSashNew == 0 )
+ {
+ // We remove the first window from the view
+ wxWindow *removedWindow = m_windowOne;
+ m_windowOne = m_windowTwo;
+ m_windowTwo = NULL;
+ OnUnsplit(removedWindow);
+ wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this);
+ eventUnsplit.m_data.win = removedWindow;
+ (void)DoSendEvent(eventUnsplit);
+ SetSashPositionAndNotify(0);
+ }
+ else if ( posSashNew == GetWindowSize() )
+ {
+ // We remove the second window from the view
+ wxWindow *removedWindow = m_windowTwo;
+ m_windowTwo = NULL;
+ OnUnsplit(removedWindow);
+ wxSplitterEvent eventUnsplit(wxEVT_COMMAND_SPLITTER_UNSPLIT, this);
+ eventUnsplit.m_data.win = removedWindow;
+ (void)DoSendEvent(eventUnsplit);
+ SetSashPositionAndNotify(0);
+ }
+ else
+ {
+ SetSashPositionAndNotify(posSashNew);
+ }