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