]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxSplitterWindow.py
Merged wxPython 2.4.x to the 2.5 branch (Finally!!!)
[wxWidgets.git] / wxPython / demo / wxSplitterWindow.py
1
2 from wxPython.wx import *
3
4
5 #---------------------------------------------------------------------------
6
7 class MySplitter(wxSplitterWindow):
8 def __init__(self, parent, ID, log):
9 wxSplitterWindow.__init__(self, parent, ID)
10 self.log = log
11 EVT_SPLITTER_SASH_POS_CHANGED(self, self.GetId(), self.OnSashChanged)
12 EVT_SPLITTER_SASH_POS_CHANGING(self, self.GetId(), self.OnSashChanging)
13
14 def OnSashChanged(self, evt):
15 self.log.WriteText("sash changed to %s\n" % str(evt.GetSashPosition()))
16 # uncomment this to not allow the change
17 #evt.SetSashPosition(-1)
18
19 def OnSashChanging(self, evt):
20 self.log.WriteText("sash changing to %s\n" % str(evt.GetSashPosition()))
21 # uncomment this to not allow the change
22 #evt.SetSashPosition(-1)
23
24 #---------------------------------------------------------------------------
25
26 def runTest(frame, nb, log):
27 splitter = MySplitter(nb, -1, log)
28
29 p1 = wxWindow(splitter, -1)
30 p1.SetBackgroundColour(wxRED)
31 wxStaticText(p1, -1, "Panel One", wxPoint(5,5)).SetBackgroundColour(wxRED)
32
33 p2 = wxWindow(splitter, -1)
34 p2.SetBackgroundColour(wxBLUE)
35 wxStaticText(p2, -1, "Panel Two", wxPoint(5,5)).SetBackgroundColour(wxBLUE)
36
37 splitter.SetMinimumPaneSize(20)
38 splitter.SplitVertically(p1, p2, 100)
39
40 ## splitter.SetSize((300,300))
41 ## print splitter.GetSashPosition()
42 ## splitter.SetSashPosition(100)
43 ## print splitter.GetSashPosition()
44
45 return splitter
46
47
48 #---------------------------------------------------------------------------
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 overview = """\
65 This class manages up to two subwindows. The current view can be split into two programmatically (perhaps from a menu command), and unsplit either programmatically or via the wxSplitterWindow user interface.
66
67 wxSplitterWindow()
68 -----------------------------------
69
70 Default constructor.
71
72 wxSplitterWindow(wxWindow* parent, wxWindowID id, int x, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style=wxSP_3D, const wxString& name = "splitterWindow")
73
74 Constructor for creating the window.
75
76 Parameters
77 -------------------
78
79 parent = The parent of the splitter window.
80
81 id = The window identifier.
82
83 pos = The window position.
84
85 size = The window size.
86
87 style = The window style. See wxSplitterWindow.
88
89 name = The window name.
90 """