]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/splitter.cpp
Applied patch for multiple file selection, documented.
[wxWidgets.git] / src / generic / splitter.cpp
index 70ac816c857e5874c8f2f7c431eccb6ccf5774b9..874a63621d7894d0e7cbf298e7cd4a09b51f7224 100644 (file)
@@ -31,6 +31,7 @@
 #include "wx/string.h"
 #include "wx/splitter.h"
 #include "wx/dcscreen.h"
+#include "wx/settings.h"
 
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindow, wxWindow)
@@ -184,9 +185,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
             m_dragMode = wxSPLIT_DRAG_DRAGGING;
 
             if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
-           {
-               DrawSashTracker(x, y);
-           }
+            {
+                DrawSashTracker(x, y);
+            }
 
             m_oldX = x;
             m_oldY = y;
@@ -201,9 +202,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
 
         // Erase old tracker
         if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
-       {
+        {
             DrawSashTracker(m_oldX, m_oldY);
-       }
+        }
 
         // Obtain window size. We are only interested in the dimension the sash
         // splits up
@@ -303,9 +304,9 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
 
         // Erase old tracker
         if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
-       {
+        {
             DrawSashTracker(m_oldX, m_oldY);
-       }
+        }
 
         if (m_splitMode == wxSPLIT_VERTICAL)
             x = new_sash_position;
@@ -334,14 +335,14 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
 
         // Draw new one
         if ((GetWindowStyleFlag() & wxSP_LIVE_UPDATE) == 0)
-       {
+        {
             DrawSashTracker(m_oldX, m_oldY);
-       }
-       else
-       {
+        }
+        else
+        {
             m_sashPosition = new_sash_position;
-           m_needUpdating = TRUE;
-       }
+            m_needUpdating = TRUE;
+        }
     }
     else if ( event.LeftDClick() )
     {
@@ -423,8 +424,6 @@ bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance)
         else
             return FALSE;
     }
-
-    return FALSE;
 }
 
 // Draw 3D effect borders
@@ -491,14 +490,14 @@ void wxSplitterWindow::DrawSash(wxDC& dc)
             dc.SetBrush(*wxTRANSPARENT_BRUSH);
 
             dc.SetPen(*m_lightShadowPen);
-                       int xShadow = m_borderSize ? m_borderSize - 1 : 0 ;
+                        int xShadow = m_borderSize ? m_borderSize - 1 : 0 ;
             dc.DrawLine(m_sashPosition, xShadow , m_sashPosition, h-m_borderSize);
 
             dc.SetPen(*m_hilightPen);
             dc.DrawLine(m_sashPosition+1, m_borderSize - 2, m_sashPosition+1, h - m_borderSize+2);
 
             dc.SetPen(*m_mediumShadowPen);
-                       int yMedium = m_borderSize ? h-m_borderSize+1 : h ;
+                        int yMedium = m_borderSize ? h-m_borderSize+1 : h ;
             dc.DrawLine(m_sashPosition+m_sashSize-2, xShadow, m_sashPosition+m_sashSize-2, yMedium);
 
             dc.SetPen(*m_darkShadowPen);
@@ -650,8 +649,8 @@ void wxSplitterWindow::SizeWindows()
         }
     }
     wxClientDC dc(this);
-       if ( m_borderSize > 0 )
-               DrawBorders(dc);
+    if ( m_borderSize > 0 )
+        DrawBorders(dc);
     DrawSash(dc);
 }
 
@@ -892,8 +891,7 @@ void wxSplitterWindow::OnDoubleClick(wxSplitterEvent& event)
     // for compatibility, call the virtual function
     OnDoubleClickSash(event.GetX(), event.GetY());
 
-    if ( GetMinimumPaneSize() == 0
-        || m_permitUnsplitAlways)
+    if ( GetMinimumPaneSize() == 0 || m_permitUnsplitAlways )
     {
         Unsplit();
     }
@@ -903,8 +901,9 @@ void wxSplitterWindow::OnUnsplitEvent(wxSplitterEvent& event)
 {
     wxWindow *win = event.GetWindowBeingRemoved();
 
+    // do it before calling OnUnsplit() which may delete the window
+    win->Show(FALSE);
+
     // for compatibility, call the virtual function
     OnUnsplit(win);
-
-    win->Show(FALSE);
 }