]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/splitter.cpp
pane sizes within a dock are not allowed to exceed the dock's entire current pixel...
[wxWidgets.git] / src / generic / splitter.cpp
index d0ac066eee8714ce418735b1d8dfe81cc8a60fbd..411595f88f25fb62e5f3c00f3c2945404cf16387 100644 (file)
 
 #include <stdlib.h>
 
-wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, wxSplitterEvent )
-wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, wxSplitterEvent )
-wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, wxSplitterEvent )
-wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_UNSPLIT, wxSplitterEvent )
+wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, wxSplitterEvent );
+wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, wxSplitterEvent );
+wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, wxSplitterEvent );
+wxDEFINE_EVENT( wxEVT_COMMAND_SPLITTER_UNSPLIT, wxSplitterEvent );
 
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
 
@@ -211,8 +211,11 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
     int x = (int)event.GetX(),
         y = (int)event.GetY();
 
-    if (GetWindowStyle() & wxSP_NOSASH)
+    if ( GetWindowStyle() & wxSP_NOSASH )
+    {
+        event.Skip();
         return;
+    }
 
     // with wxSP_LIVE_UPDATE style the splitter windows are always resized
     // following the mouse movement while it drags the sash, without it we only
@@ -396,6 +399,10 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
     {
         OnDoubleClickSash(x, y);
     }
+    else
+    {
+        event.Skip();
+    }
 }
 
 void wxSplitterWindow::OnSize(wxSizeEvent& event)
@@ -607,7 +614,7 @@ int wxSplitterWindow::AdjustSashPosition(int sashPos) const
             minSize = m_minimumPaneSize;
 
         int maxSize = GetWindowSize() - minSize - GetBorderSize() - GetSashSize();
-        if ( maxSize > 0 && sashPos > maxSize )
+        if ( maxSize > 0 && sashPos > maxSize && maxSize >= m_minimumPaneSize)
             sashPos = maxSize;
     }
 
@@ -917,9 +924,12 @@ wxSize wxSplitterWindow::DoGetBestSize() const
         pSash = &sizeBest.y;
     }
 
-    // account for the border and the sash
+    // account for the sash if the window is actually split
+    if ( m_windowOne && m_windowTwo )
+        *pSash += GetSashSize();
+
+    // account for the border too
     int border = 2*GetBorderSize();
-    *pSash += GetSashSize();
     sizeBest.x += border;
     sizeBest.y += border;