]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MultiSash.py
   3 import  wx
.lib
.multisash    
as  sash
 
   6 #--------------------------------------------------------------------------- 
   9 You can drag the little tab on the vertical sash left to create another view, 
  10 or you can drag the tab on the horizontal sash to the top to create another 
  13 The red blocks on the sashes will destroy the view (bottom,left) this block 
  16 A yellow rectangle also highlights the current selected view. 
  18 By calling GetSaveData on the multiSash control the control will return its 
  19 contents and the positions of each sash as a dictionary. 
  20 Calling SetSaveData with such a dictionary will restore the control to the 
  21 state it was in when it was saved. 
  23 If the class, that is used as a view, has GetSaveData/SetSaveData implemented, 
  24 these will also be called to save/restore their state. Any object can be 
  25 returned by GetSaveData, as it is just another object in the dictionary. 
  28 #--------------------------------------------------------------------------- 
  30 class TestWindow(stc
.StyledTextCtrl
): 
  32     # shared document reference 
  35     def __init__(self
, parent
): 
  36         stc
.StyledTextCtrl
.__init
__(self
, parent
, -1, style
=wx
.NO_BORDER
) 
  37         self
.SetMarginWidth(1,0) 
  39         if wx
.Platform 
== '__WXMSW__': 
  45             stc
.STC_STYLE_DEFAULT
, 
  46             wx
.Font(fSize
, wx
.MODERN
, wx
.NORMAL
, wx
.NORMAL
) 
  50             self
.SetDocPointer(self
.doc
) 
  52             self
.SetText(sampleText
) 
  53             TestWindow
.doc 
= self
.GetDocPointer() 
  56     def ShutDownDemo(self
): 
  57         # Reset doc reference in case this demo is run again 
  61 #--------------------------------------------------------------------------- 
  64 def runTest(frame
, nb
, log
): 
  65     multi 
= sash
.MultiSash(nb
, -1, pos 
= (0,0), size 
= (640,480)) 
  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
) 
  74 #---------------------------------------------------------------------- 
  78 overview 
= """<html><body> 
  79 <h2><center>MultiSash</center></h2> 
  81 MultiSash allows the user to split a window any number of times 
  82 either horizontally or vertically, and to close the split off windows 
  90 if __name__ 
== '__main__': 
  93     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])