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