]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/sashwin.cpp
changed make_int, make_exp .. to wxmake_int..
[wxWidgets.git] / src / generic / sashwin.cpp
index 2f53738112fc6546364547d891a8afeae7c77bcb..2553c9f70044d3224dd4d0d565983729c941e3e3 100644 (file)
@@ -59,8 +59,8 @@ wxSashWindow::wxSashWindow()
 
     m_minimumPaneSizeX = 0;
     m_minimumPaneSizeY = 0;
-    m_maximumPaneSizeX = 0;
-    m_maximumPaneSizeY = 0;
+    m_maximumPaneSizeX = 10000;
+    m_maximumPaneSizeY = 10000;
 }
 
 wxSashWindow::wxSashWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
@@ -77,8 +77,8 @@ wxSashWindow::wxSashWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
     m_extraBorderSize = 0;
     m_minimumPaneSizeX = 0;
     m_minimumPaneSizeY = 0;
-    m_maximumPaneSizeX = 0;
-    m_maximumPaneSizeY = 0;
+    m_maximumPaneSizeX = 10000;
+    m_maximumPaneSizeY = 10000;
     m_sashCursorWE = new wxCursor(wxCURSOR_SIZEWE);
     m_sashCursorNS = new wxCursor(wxCURSOR_SIZENS);
 
@@ -96,10 +96,8 @@ void wxSashWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
 
-#if 0
-    if ( m_borderSize > 0 )
-        DrawBorders(dc);
-#endif
+    //    if ( m_borderSize > 0 )
+    DrawBorders(dc);
 
     DrawSashes(dc);
 }
@@ -115,13 +113,21 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
        {
         if ( sashHit != wxSASH_NONE )
         {
-               CaptureMouse();
+            CaptureMouse();
 
            // Required for X to specify that
-               // that we wish to draw on top of all windows
-               // - and we optimise by specifying the area
-               // for creating the overlap window.
-               wxScreenDC::StartDrawingOnTop(this);
+            // that we wish to draw on top of all windows
+            // - and we optimise by specifying the area
+            // for creating the overlap window.
+            // Find the first frame or dialog and use this to specify
+            // the area to draw on.
+            wxWindow* parent = this;
+
+            while (parent && !parent->IsKindOf(CLASSINFO(wxDialog)) &&
+                             !parent->IsKindOf(CLASSINFO(wxFrame)))
+              parent = parent->GetParent();
+
+            wxScreenDC::StartDrawingOnTop(parent);
 
             // We don't say we're dragging yet; we leave that
             // decision for the Dragging() branch, to ensure
@@ -171,6 +177,8 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
                 if (y > (yp + h))
                     status = wxSASH_STATUS_OUT_OF_RANGE;
                 int newHeight = (h - y);
+               newHeight=wxMax(newHeight,m_minimumPaneSizeY);
+               newHeight=wxMin(newHeight,m_maximumPaneSizeY);
                 dragRect = wxRect(xp, (yp + h) - newHeight, w, newHeight);
                 break;
             }
@@ -179,6 +187,8 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
                 if (y < 0)
                     status = wxSASH_STATUS_OUT_OF_RANGE;
                 int newHeight = y;
+               newHeight=wxMax(newHeight,m_minimumPaneSizeY);
+               newHeight=wxMin(newHeight,m_maximumPaneSizeY);
                 dragRect = wxRect(xp, yp, w, newHeight);
                 break;
             }
@@ -187,6 +197,8 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
                 if (x > (xp + w))
                     status = wxSASH_STATUS_OUT_OF_RANGE;
                 int newWidth = (w - x);
+               newWidth=wxMax(newWidth,m_minimumPaneSizeX);
+               newWidth=wxMin(newWidth,m_maximumPaneSizeX);
                 dragRect = wxRect((xp + w) - newWidth, yp, newWidth, h);
                 break;
             }
@@ -195,9 +207,15 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
                 if (x < 0)
                     status = wxSASH_STATUS_OUT_OF_RANGE;
                 int newWidth = x;
+               newWidth=wxMax(newWidth,m_minimumPaneSizeX);
+               newWidth=wxMin(newWidth,m_maximumPaneSizeX);
                 dragRect = wxRect(xp, yp, newWidth, h);
                 break;
             }
+           case wxSASH_NONE:
+           {
+               break;
+           }
         }
 
         wxSashEvent event(GetId(), edge);
@@ -271,7 +289,7 @@ void wxSashWindow::OnSize(wxSizeEvent& WXUNUSED(event))
     SizeWindows();
 }
 
-wxSashEdgePosition wxSashWindow::SashHitTest(int x, int y, int tolerance)
+wxSashEdgePosition wxSashWindow::SashHitTest(int x, int y, int WXUNUSED(tolerance))
 {
     int cx, cy;
     GetClientSize(& cx, & cy);
@@ -310,6 +328,10 @@ wxSashEdgePosition wxSashWindow::SashHitTest(int x, int y, int tolerance)
                         return wxSASH_LEFT;
                     break;
                 }
+                case wxSASH_NONE:
+                {
+                    break;
+                }
             }
         }
     }
@@ -511,9 +533,9 @@ void wxSashWindow::SizeWindows()
     int cw, ch;
     GetClientSize(&cw, &ch);
 
-    if (GetChildren()->Number() > 0)
+    if (GetChildren().Number() > 0)
     {
-        wxWindow* child = (wxWindow*) (GetChildren()->First()->Data());
+        wxWindow* child = (wxWindow*) (GetChildren().First()->Data());
 
         int x = 0;
         int y = 0;
@@ -570,7 +592,7 @@ void wxSashWindow::InitColours()
     m_hilightColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DHILIGHT);
 #else
     m_faceColour = *(wxTheColourDatabase->FindColour("LIGHT GREY"));
-    m_mediumShadowColour = *(wxTheColourDatabase->FindColour("GREY", 1, wxSOLID));
+    m_mediumShadowColour = *(wxTheColourDatabase->FindColour("GREY"));
     m_darkShadowColour = *(wxTheColourDatabase->FindColour("BLACK"));
     m_lightShadowColour = *(wxTheColourDatabase->FindColour("LIGHT GREY"));
     m_hilightColour = *(wxTheColourDatabase->FindColour("WHITE"));