After bashing my head on the desk for being so stupid I fixed the

wxFloatBar for wxGTK the extremly EASY way...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-01-19 22:09:38 +00:00
parent a4625b8c3b
commit 8211bdcc03

View File

@@ -9,14 +9,36 @@
from wxPython.wx import * from wxPython.wx import *
if wxPlatform == '__WXGTK__': if wxPlatform == '__WXGTK__':
msg = "Due to a bug in wxGTK this class is not available on that "\ #
"platform for this release. Sorry." # For wxGTK all we have to do is set the wxTB_DOCKABLE flag
raise ImportError, msg #
class wxFloatBar(wxToolBar):
def __init__(self, parent, ID,
pos = wxDefaultPosition,
size = wxDefaultSize,
style = 0,
name = 'toolbar'):
wxToolBar.__init__(self, parent, ID, pos, size,
style|wxTB_DOCKABLE, name)
# these other methods just become no-ops
def SetFloatable(self, float):
pass
def IsFloating(self):
return 1
def GetTitle(self):
return ""
_DOCKTHRESHOLD = 25 def SetTitle(self, title):
pass
class wxFloatBar(wxToolBar): else:
_DOCKTHRESHOLD = 25
class wxFloatBar(wxToolBar):
""" """
wxToolBar subclass which can be dragged off its frame and later wxToolBar subclass which can be dragged off its frame and later
replaced there. Drag on the toolbar to release it, close it like replaced there. Drag on the toolbar to release it, close it like
@@ -82,38 +104,38 @@ class wxFloatBar(wxToolBar):
self.floatframe.SetTitle(self.title) self.floatframe.SetTitle(self.title)
## def GetHome(self): ## def GetHome(self):
## """ ## """
## Returns the frame which this toolbar will return to when ## Returns the frame which this toolbar will return to when
## docked, or the parent if currently docked. ## docked, or the parent if currently docked.
## """ ## """
## if hasattr(self, 'parentframe'): ## if hasattr(self, 'parentframe'):
## return self.parentframe ## return self.parentframe
## else: ## else:
## return wxPyTypeCast(self.GetParent(), 'wxFrame') ## return wxPyTypeCast(self.GetParent(), 'wxFrame')
## def SetHome(self, frame): ## def SetHome(self, frame):
## """ ## """
## Called when docked, this will remove the toolbar from its ## Called when docked, this will remove the toolbar from its
## current frame and attach it to another. If called when ## current frame and attach it to another. If called when
## floating, it will dock to the frame specified when the toolbar ## floating, it will dock to the frame specified when the toolbar
## window is closed. ## window is closed.
## """ ## """
## if self.IsFloating(): ## if self.IsFloating():
## self.parentframe = frame ## self.parentframe = frame
## self.floatframe.Reparent(frame) ## self.floatframe.Reparent(frame)
## else: ## else:
## parent = wxPyTypeCast(self.GetParent(), 'wxFrame') ## parent = wxPyTypeCast(self.GetParent(), 'wxFrame')
## self.Reparent(frame) ## self.Reparent(frame)
## parent.SetToolBar(None) ## parent.SetToolBar(None)
## size = parent.GetSize() ## size = parent.GetSize()
## parent.SetSize(wxSize(0,0)) ## parent.SetSize(wxSize(0,0))
## parent.SetSize(size) ## parent.SetSize(size)
## frame.SetToolBar(self) ## frame.SetToolBar(self)
## size = frame.GetSize() ## size = frame.GetSize()
## frame.SetSize(wxSize(0,0)) ## frame.SetSize(wxSize(0,0))
## frame.SetSize(size) ## frame.SetSize(size)
def Float(self, bool): def Float(self, bool):
@@ -252,13 +274,3 @@ class wxFloatBar(wxToolBar):