]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxSashWindow.py
fix text scrolling in GTK2 (patch 703988)
[wxWidgets.git] / wxPython / demo / wxSashWindow.py
index 93b8b984177085afc3b1d8171157361607bdf9d4..17105b0a9db149c2d3c1f2bb013db9c382fa4694 100644 (file)
@@ -15,6 +15,9 @@ class TestSashWindow(wxPanel):
 
         self.log = log
 
+        # will occupy the space not used by the Layout Algorithm
+        self.remainingSpace = wxPanel(self, -1, style=wxSUNKEN_BORDER)
+
         EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP,
                                self.ID_WINDOW_BOTTOM, self.OnSashDrag)
         EVT_SIZE(self, self.OnSize)
@@ -28,7 +31,7 @@ class TestSashWindow(wxPanel):
         win.SetOrientation(wxLAYOUT_HORIZONTAL)
         win.SetAlignment(wxLAYOUT_TOP)
         win.SetBackgroundColour(wxColour(255, 0, 0))
-        win.SetSashVisible(wxSASH_BOTTOM, true)
+        win.SetSashVisible(wxSASH_BOTTOM, True)
 
         self.topWindow = win
 
@@ -41,7 +44,7 @@ class TestSashWindow(wxPanel):
         win.SetOrientation(wxLAYOUT_HORIZONTAL)
         win.SetAlignment(wxLAYOUT_BOTTOM)
         win.SetBackgroundColour(wxColour(0, 0, 255))
-        win.SetSashVisible(wxSASH_TOP, true)
+        win.SetSashVisible(wxSASH_TOP, True)
 
         self.bottomWindow = win
 
@@ -54,12 +57,11 @@ class TestSashWindow(wxPanel):
         win.SetOrientation(wxLAYOUT_VERTICAL)
         win.SetAlignment(wxLAYOUT_LEFT)
         win.SetBackgroundColour(wxColour(0, 255, 0))
-        win.SetSashVisible(wxSASH_RIGHT, TRUE)
+        win.SetSashVisible(wxSASH_RIGHT, True)
         win.SetExtraBorderSize(10)
-
         textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
                                 wxTE_MULTILINE|wxSUNKEN_BORDER)
-        textWindow.SetValue("A help window")
+        textWindow.SetValue("A sub window")
 
         self.leftWindow1 = win
 
@@ -72,7 +74,7 @@ class TestSashWindow(wxPanel):
         win.SetOrientation(wxLAYOUT_VERTICAL)
         win.SetAlignment(wxLAYOUT_LEFT)
         win.SetBackgroundColour(wxColour(0, 255, 255))
-        win.SetSashVisible(wxSASH_RIGHT, TRUE)
+        win.SetSashVisible(wxSASH_RIGHT, True)
 
         self.leftWindow2 = win
 
@@ -95,11 +97,11 @@ class TestSashWindow(wxPanel):
         elif eID == self.ID_WINDOW_BOTTOM:
             self.bottomWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
 
-        wxLayoutAlgorithm().LayoutWindow(self)
-
+        wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
+        self.remainingSpace.Refresh()
 
     def OnSize(self, event):
-        wxLayoutAlgorithm().LayoutWindow(self)
+        wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
 
 #---------------------------------------------------------------------------
 
@@ -112,42 +114,13 @@ def runTest(frame, nb, log):
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
 overview = """\
-wxSashLayoutWindow responds to OnCalculateLayout events generated by wxLayoutAlgorithm. It allows the application to use simple accessors to specify how the window should be laid out, rather than having to respond to events. The fact that the class derives from wxSashWindow allows sashes to be used if required, to allow the windows to be user-resizable.
-
-wxSashLayoutWindow()
--------------------------------------------
-
-Default constructor.
-
-wxSashLayoutWindow(wxSashLayoutWindow* parent, wxSashLayoutWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLIP_CHILDREN | wxSW_3D, const wxString& name = "layoutWindow")
-
-Constructs a sash layout window, which can be a child of a frame, dialog or any other non-control window.
-
-Parameters
--------------------
-
-parent = Pointer to a parent window.
-
-id = Window identifier. If -1, will automatically create an identifier.
+"""
 
-pos = Window position. wxDefaultPosition is (-1, -1) which indicates that wxSashLayoutWindows should generate a default position for the window. If using the wxSashLayoutWindow class directly, supply an actual position.
 
-size = Window size. wxDefaultSize is (-1, -1) which indicates that wxSashLayoutWindows should generate a default size for the window.
 
-style = Window style. For window styles, please see wxSashLayoutWindow.
 
-name = Window name.
-"""
+if __name__ == '__main__':
+    import sys,os
+    import run
+    run.main(['', os.path.basename(sys.argv[0])])