]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/splitter.cpp
Correct week day returned from wxCalendarCtrl::HitTest() on header click.
[wxWidgets.git] / src / generic / splitter.cpp
index 257939be07dcf339cf56b746e31424d89574087d..3b967a86b03c764751d363d53bc39e79a6427324 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)
 
@@ -465,7 +465,7 @@ void wxSplitterWindow::OnSize(wxSizeEvent& event)
 void wxSplitterWindow::SetSashGravity(double gravity)
 {
     wxCHECK_RET( gravity >= 0. && gravity <= 1.,
-                    _T("invalid gravity value") );
+                    wxT("invalid gravity value") );
 
     m_sashGravity = gravity;
 }
@@ -614,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;
     }
 
@@ -732,7 +732,7 @@ void wxSplitterWindow::SizeWindows()
 void wxSplitterWindow::Initialize(wxWindow *window)
 {
     wxASSERT_MSG( (!window || window->GetParent() == this),
-                  _T("windows in the splitter should have it as parent!") );
+                  wxT("windows in the splitter should have it as parent!") );
 
     if (window && !window->IsShown())
         window->Show();
@@ -753,10 +753,10 @@ bool wxSplitterWindow::DoSplit(wxSplitMode mode,
         return false;
 
     wxCHECK_MSG( window1 && window2, false,
-                 _T("can not split with NULL window(s)") );
+                 wxT("can not split with NULL window(s)") );
 
     wxCHECK_MSG( window1->GetParent() == this && window2->GetParent() == this, false,
-                  _T("windows in the splitter should have it as parent!") );
+                  wxT("windows in the splitter should have it as parent!") );
 
     if (! window1->IsShown())
         window1->Show();
@@ -924,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;