]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxSashWindow.py
adapted to new sending for radiobutton events for unselecting too
[wxWidgets.git] / wxPython / demo / wxSashWindow.py
1
2 from wxPython.wx import *
3
4 #---------------------------------------------------------------------------
5
6 class TestSashWindow(wxPanel):
7 ID_WINDOW_TOP = 5100
8 ID_WINDOW_LEFT1 = 5101
9 ID_WINDOW_LEFT2 = 5102
10 ID_WINDOW_BOTTOM = 5103
11
12
13 def __init__(self, parent, log):
14 wxPanel.__init__(self, parent, -1)
15
16 self.log = log
17
18 # will occupy the space not used by the Layout Algorithm
19 self.remainingSpace = wxPanel(self, -1, style=wxSUNKEN_BORDER)
20
21 EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP,
22 self.ID_WINDOW_BOTTOM, self.OnSashDrag)
23 EVT_SIZE(self, self.OnSize)
24
25
26 # Create some layout windows
27 # A window like a toolbar
28 win = wxSashLayoutWindow(self, self.ID_WINDOW_TOP, wxDefaultPosition,
29 wxSize(200, 30), wxNO_BORDER|wxSW_3D)
30 win.SetDefaultSize(wxSize(1000, 30))
31 win.SetOrientation(wxLAYOUT_HORIZONTAL)
32 win.SetAlignment(wxLAYOUT_TOP)
33 win.SetBackgroundColour(wxColour(255, 0, 0))
34 win.SetSashVisible(wxSASH_BOTTOM, true)
35
36 self.topWindow = win
37
38
39 # A window like a statusbar
40 win = wxSashLayoutWindow(self, self.ID_WINDOW_BOTTOM,
41 wxDefaultPosition, wxSize(200, 30),
42 wxNO_BORDER|wxSW_3D)
43 win.SetDefaultSize(wxSize(1000, 30))
44 win.SetOrientation(wxLAYOUT_HORIZONTAL)
45 win.SetAlignment(wxLAYOUT_BOTTOM)
46 win.SetBackgroundColour(wxColour(0, 0, 255))
47 win.SetSashVisible(wxSASH_TOP, true)
48
49 self.bottomWindow = win
50
51
52 # A window to the left of the client window
53 win = wxSashLayoutWindow(self, self.ID_WINDOW_LEFT1,
54 wxDefaultPosition, wxSize(200, 30),
55 wxNO_BORDER|wxSW_3D)
56 win.SetDefaultSize(wxSize(120, 1000))
57 win.SetOrientation(wxLAYOUT_VERTICAL)
58 win.SetAlignment(wxLAYOUT_LEFT)
59 win.SetBackgroundColour(wxColour(0, 255, 0))
60 win.SetSashVisible(wxSASH_RIGHT, TRUE)
61 win.SetExtraBorderSize(10)
62 textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
63 wxTE_MULTILINE|wxSUNKEN_BORDER)
64 textWindow.SetValue("A sub window")
65
66 self.leftWindow1 = win
67
68
69 # Another window to the left of the client window
70 win = wxSashLayoutWindow(self, self.ID_WINDOW_LEFT2,
71 wxDefaultPosition, wxSize(200, 30),
72 wxNO_BORDER|wxSW_3D)
73 win.SetDefaultSize(wxSize(120, 1000))
74 win.SetOrientation(wxLAYOUT_VERTICAL)
75 win.SetAlignment(wxLAYOUT_LEFT)
76 win.SetBackgroundColour(wxColour(0, 255, 255))
77 win.SetSashVisible(wxSASH_RIGHT, TRUE)
78
79 self.leftWindow2 = win
80
81
82 def OnSashDrag(self, event):
83 if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE:
84 return
85
86 eID = event.GetId()
87 if eID == self.ID_WINDOW_TOP:
88 self.topWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
89
90 elif eID == self.ID_WINDOW_LEFT1:
91 self.leftWindow1.SetDefaultSize(wxSize(event.GetDragRect().width, 1000))
92
93
94 elif eID == self.ID_WINDOW_LEFT2:
95 self.leftWindow2.SetDefaultSize(wxSize(event.GetDragRect().width, 1000))
96
97 elif eID == self.ID_WINDOW_BOTTOM:
98 self.bottomWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
99
100 wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
101 self.remainingSpace.Refresh()
102
103 def OnSize(self, event):
104 wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
105
106 #---------------------------------------------------------------------------
107
108 def runTest(frame, nb, log):
109 win = TestSashWindow(nb, log)
110 return win
111
112 #---------------------------------------------------------------------------
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129 overview = """\
130 """