]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/ide/activegrid/tool/TabbedView.py
DocView patches from Morgen Hua: bug fixes, and additional SVN
[wxWidgets.git] / wxPython / samples / ide / activegrid / tool / TabbedView.py
1 #----------------------------------------------------------------------------
2 # Name: TabbedView.py
3 # Purpose:
4 #
5 # Author: Peter Yared
6 #
7 # Created: 8/17/04
8 # CVS-ID: $Id$
9 # Copyright: (c) 2004-2005 ActiveGrid, Inc.
10 # License: wxWindows License
11 #----------------------------------------------------------------------------
12
13 import wx
14 import wx.lib.docview
15
16 class TabbedView(dict, wx.lib.docview.View):
17
18 #----------------------------------------------------------------------------
19 # Overridden methods
20 #----------------------------------------------------------------------------
21
22 def __init__(self):
23 wx.lib.docview.View.__init__(self)
24 self._views = {}
25 self._currentView = None
26
27
28 def OnCreate(self, doc, flags):
29 frame = wx.GetApp().CreateDocumentFrame(self, doc, flags)
30 sizer = wx.BoxSizer()
31 self._notebook = wx.Notebook(frame, -1, style = wx.NB_BOTTOM)
32 self.Activate()
33 return True
34
35
36 def AddView(self, viewName, view):
37 self._notebook.AddPage(wx.Panel(self._notebook, -1), viewName)
38 self._currentView = view
39 self._views[viewName] = view
40
41
42 def __getattr__(self, attrname):
43 return getattr(self._currentView, attrname)
44
45
46 def SetView(self, viewName):
47 self._currentview = self._views[viewName]
48