]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxMultiSash.py
German translations update from Martin Jost (patch 782996)
[wxWidgets.git] / wxPython / demo / wxMultiSash.py
CommitLineData
1e4a197e
RD
1from wxPython.wx import *
2from wxPython.lib.multisash import wxMultiSash
3from wxPython.stc import *
4
5#---------------------------------------------------------------------------
6
7sampleText="""\
8You can drag the little tab on the vertical sash left to create another view,
9or you can drag the tab on the horizontal sash to the top to create another
10horizontal view.
11
12The red blocks on the sashes will destroy the view (bottom,left) this block
13belongs to.
14
15A yellow rectangle also highlights the current selected view.
16
17By calling GetSaveData on the multiSash control the control will return its
18contents and the positions of each sash as a dictionary.
19Calling SetSaveData with such a dictionary will restore the control to the
20state it was in when it was saved.
21
22If the class, that is used as a view, has GetSaveData/SetSaveData implemented,
23these will also be called to save/restore their state. Any object can be
24returned by GetSaveData, as it is just another object in the dictionary.
25"""
26
27#---------------------------------------------------------------------------
28
29class TestWindow(wxStyledTextCtrl):
30 def __init__(self, parent):
31 wxStyledTextCtrl.__init__(self, parent, -1, style=wxNO_BORDER)
32 self.SetMarginWidth(1,0)
33 if wxPlatform == '__WXMSW__':
34 fSize = 10
35 else:
36 fSize = 12
37 self.StyleSetFont(wxSTC_STYLE_DEFAULT,
38 wxFont(fSize, wxMODERN, wxNORMAL, wxNORMAL))
39 self.SetText(sampleText)
40
41class TestFrame(wxFrame):
42 def __init__(self, parent, log):
43 wxFrame.__init__(self, parent, -1, "Multi Sash Demo",
44 size=(640,480))
45 self.multi = wxMultiSash(self,-1,pos = wxPoint(0,0),
46 size = (640,480))
47
48 # Use this method to set the default class that will be created when
49 # a new sash is created. The class's constructor needs 1 parameter
50 # which is the parent of the window
51 self.multi.SetDefaultChildClass(TestWindow)
52
53
54#---------------------------------------------------------------------------
55
56
57def runTest(frame, nb, log):
58 multi = wxMultiSash(nb, -1, pos = (0,0), size = (640,480))
59
60 # Use this method to set the default class that will be created when
61 # a new sash is created. The class's constructor needs 1 parameter
62 # which is the parent of the window
63 multi.SetDefaultChildClass(TestWindow)
64
65 return multi
66
67# win = TestPanel(nb, log)
68# return win
69
70#----------------------------------------------------------------------
71
72
73
74overview = """<html><body>
75<h2><center>wxMultiSash</center></h2>
76
77wxMultiSash allows the user to split a window any number of times
78either horizontally or vertically, and to close the split off windows
79when desired.
80
81</body></html>
82"""
83
84
85
86if __name__ == '__main__':
87 import sys,os
88 import run
89 run.main(['', os.path.basename(sys.argv[0])])
90