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