mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
Switch all wxToolBarBase to wxToolBar
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,10 +32,6 @@ def run():
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
module.insertItem(0, etgtools.WigCode("""\
|
||||
// forward declarations
|
||||
class wxToolBarBase;
|
||||
"""))
|
||||
|
||||
# Use wxPyUserData for the clientData values instead of a plain wxObject
|
||||
def _fixClientData(c):
|
||||
@@ -49,8 +45,21 @@ def run():
|
||||
c = module.find('wxToolBarToolBase')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.abstract = True
|
||||
tools.removeVirtuals(c)
|
||||
_fixClientData(c)
|
||||
|
||||
# Switch all wxToolBarBase to wxToolBar
|
||||
for item in c.allItems():
|
||||
if isinstance(item, etgtools.ParamDef) and item.name == 'tbar':
|
||||
item.type = 'wxToolBar*'
|
||||
|
||||
c.find('GetToolBar').ignore()
|
||||
c.addCppMethod('wxToolBar*', 'GetToolBar', '()',
|
||||
doc="Return the toolbar this tool is a member of.",
|
||||
body="""\
|
||||
return (wxToolBar*)self->GetToolBar();
|
||||
""")
|
||||
|
||||
gcd = c.find('GetClientData')
|
||||
gcd.type = 'wxPyUserData*'
|
||||
gcd.setCppCode('return dynamic_cast<wxPyUserData*>(self->GetClientData());')
|
||||
|
||||
@@ -38,6 +38,13 @@ def run():
|
||||
tools.fixWindowClass(c)
|
||||
tools.fixBookctrlClass(c)
|
||||
|
||||
c.find('GetToolBar').ignore()
|
||||
c.addCppMethod('wxToolBar*', 'GetToolBar', '()',
|
||||
doc="Return the toolbar used for page selection.",
|
||||
body="""\
|
||||
return (wxToolBar*)self->GetToolBar();
|
||||
""")
|
||||
|
||||
module.addPyCode("""\
|
||||
EVT_TOOLBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_TOOLBOOK_PAGE_CHANGED, 1 )
|
||||
EVT_TOOLBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_TOOLBOOK_PAGE_CHANGING, 1 )
|
||||
|
||||
@@ -108,6 +108,16 @@ class toolbar_Tests(wtc.WidgetTestCase):
|
||||
tool.Style
|
||||
tool.ToolBar
|
||||
|
||||
|
||||
def test_toolbarTools2(self):
|
||||
tb = self.frame.CreateToolBar()
|
||||
tools = self._populateToolBar(tb)
|
||||
tool = tools[0]
|
||||
self.assertEqual(tool.GetToolBar(), tb)
|
||||
|
||||
tool = tb.FindById(tools[1].GetId())
|
||||
self.assertEqual(tool.GetToolBar(), tb)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ class toolbook_Tests(wtc.WidgetTestCase):
|
||||
book.AddPage(wx.Panel(book), 'three', imageId=2)
|
||||
book.AddPage(wx.Panel(book), 'four', imageId=3)
|
||||
|
||||
book.GetToolBar()
|
||||
|
||||
self.myYield()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user