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