- args = (self,) + _args
- apply(wxToolBar.__init__, args, _kwargs)
- if _kwargs.has_key('floatable'):
- self.floatable = _kwargs['floatable']
- assert type(self.floatable) == type(0)
- else:
- self.floatable = 0
- self.floating = 0
- if _kwargs.has_key('title'):
- self.title = _kwargs['title']
- assert type(self.title) == type("")
- else:
- self.title = ""
- EVT_MOUSE_EVENTS(self, self.OnMouse)
- self.parentframe = wxPyTypeCast(args[1], 'wxFrame')
-
-
- def IsFloatable(self):
- return self.floatable
-
-
- def SetFloatable(self, float):
- self.floatable = float
- #Find the size of a title bar.
- if not hasattr(self, 'titleheight'):
- test = wxMiniFrame(NULL, -1, "TEST")
- test.SetClientSize(wxSize(0,0))
- self.titleheight = test.GetSizeTuple()[1]
- test.Destroy()
-
-
- def IsFloating(self):
- return self.floating
-
-
- def Realize(self):
- wxToolBar.Realize(self)
-
-
- def GetTitle(self):
- return self.title
-
-
- def SetTitle(self, title):
- print 'SetTitle', title
- self.title = title
- if self.IsFloating():
- self.floatframe.SetTitle(self.title)
-
-
-## def GetHome(self):
-## """
-## Returns the frame which this toolbar will return to when
-## docked, or the parent if currently docked.
-## """
-## if hasattr(self, 'parentframe'):
-## return self.parentframe
-## else:
-## return wxPyTypeCast(self.GetParent(), 'wxFrame')
-
-
-## def SetHome(self, frame):
-## """
-## Called when docked, this will remove the toolbar from its
-## current frame and attach it to another. If called when
-## floating, it will dock to the frame specified when the toolbar
-## window is closed.
-## """
-## if self.IsFloating():
-## self.parentframe = frame
-## self.floatframe.Reparent(frame)
-## else:
-## parent = wxPyTypeCast(self.GetParent(), 'wxFrame')
-## self.Reparent(frame)
-## parent.SetToolBar(None)
-## size = parent.GetSize()
-## parent.SetSize(wxSize(0,0))
-## parent.SetSize(size)
-## frame.SetToolBar(self)
-## size = frame.GetSize()
-## frame.SetSize(wxSize(0,0))
-## frame.SetSize(size)
-
-
- def Float(self, bool):
- "Floats or docks the toolbar programmatically."
- if bool:
- self.parentframe = wxPyTypeCast(self.GetParent(), 'wxFrame')
- print self.title
- if self.title:
- useStyle = wxDEFAULT_FRAME_STYLE
+
+ def __init__(self,*_args,**_kwargs):
+ """
+ In addition to the usual arguments, wxFloatBar accepts keyword
+ args of: title(string): the title that should appear on the
+ toolbar's frame when it is floating. floatable(bool): whether
+ user actions (i.e., dragging) can float the toolbar or not.
+ """
+ args = (self,) + _args
+ apply(wxToolBar.__init__, args, _kwargs)
+ if _kwargs.has_key('floatable'):
+ self.floatable = _kwargs['floatable']
+ assert type(self.floatable) == type(0)