From 7409208cd70d3efd1e4616b47381f2e9e2d69e8a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 10 Mar 2012 00:13:55 +0000 Subject: [PATCH] Add toolbar git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etg/_core.py | 1 + etg/defs.py | 1 - etg/frame.py | 6 +--- etg/toolbar.py | 58 +++++++++++++++++++++++++++++++++++++++ unittests/test_toolbar.py | 38 +++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 etg/toolbar.py create mode 100644 unittests/test_toolbar.py diff --git a/etg/_core.py b/etg/_core.py index e0b2996f..63f26951 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -142,6 +142,7 @@ INCLUDES = [ 'defs', 'spinctrl', 'tglbtn', 'scrolbar', + 'toolbar', # toplevel and dialogs 'nonownedwnd', diff --git a/etg/defs.py b/etg/defs.py index 61c7aef1..78a244e5 100644 --- a/etg/defs.py +++ b/etg/defs.py @@ -71,7 +71,6 @@ def run(): class wxDropTarget; class wxCaret; class wxImageHandler; - class wxToolBar; class wxExecuteEnv; """)) diff --git a/etg/frame.py b/etg/frame.py index af67de45..1435b6ef 100644 --- a/etg/frame.py +++ b/etg/frame.py @@ -32,11 +32,7 @@ def run(): c = module.find('wxFrame') assert isinstance(c, etgtools.ClassDef) - - # TODO: Remove these when wxToolBar is added to Phoenix - module.addGlobalStr('wxToolBarNameStr', c) - module.insertItemBefore(c, etgtools.GlobalVarDef(type='const int', name='wxTB_HORIZONTAL')) - + c.find('wxFrame.title').default = 'wxEmptyString' c.find('Create.title').default = 'wxEmptyString' diff --git a/etg/toolbar.py b/etg/toolbar.py new file mode 100644 index 00000000..6ba3260a --- /dev/null +++ b/etg/toolbar.py @@ -0,0 +1,58 @@ +#--------------------------------------------------------------------------- +# Name: etg/toolbar.py +# Author: Robin Dunn +# +# Created: 07-Mar-2012 +# Copyright: (c) 2012 by Total Control Software +# License: wxWindows License +#--------------------------------------------------------------------------- + +import etgtools +import etgtools.tweaker_tools as tools + +PACKAGE = "wx" +MODULE = "_core" +NAME = "toolbar" # Base name of the file to generate to for this script +DOCSTRING = "" + +# The classes and/or the basename of the Doxygen XML files to be processed by +# this script. +ITEMS = [ "wxToolBarToolBase", + "wxToolBar", + ] + +#--------------------------------------------------------------------------- + +def run(): + # Parse the XML file(s) building a collection of Extractor objects + module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING) + etgtools.parseDoxyXML(module, ITEMS) + + #----------------------------------------------------------------- + # 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; + """)) + + c = module.find('wxToolBarToolBase') + assert isinstance(c, etgtools.ClassDef) + c.abstract = True + module.addGlobalStr('wxToolBarNameStr', c) + + + c = module.find('wxToolBar') + c.find('SetBitmapResource').ignore() + + + #----------------------------------------------------------------- + tools.doCommonTweaks(module) + tools.runGenerators(module) + + +#--------------------------------------------------------------------------- +if __name__ == '__main__': + run() + diff --git a/unittests/test_toolbar.py b/unittests/test_toolbar.py new file mode 100644 index 00000000..e21f7c0e --- /dev/null +++ b/unittests/test_toolbar.py @@ -0,0 +1,38 @@ +import imp_unittest, unittest +import wtc +import wx + +#--------------------------------------------------------------------------- + +class toolbar_Tests(wtc.WidgetTestCase): + + def test_toolbar1(self): + wx.TOOL_STYLE_BUTTON + wx.TOOL_STYLE_SEPARATOR + wx.TOOL_STYLE_CONTROL + + wx.TB_HORIZONTAL + wx.TB_VERTICAL + wx.TB_TOP + wx.TB_LEFT + wx.TB_BOTTOM + wx.TB_RIGHT + + wx.TB_3DBUTTONS + wx.TB_FLAT + wx.TB_DOCKABLE + wx.TB_NOICONS + wx.TB_TEXT + wx.TB_NODIVIDER + wx.TB_NOALIGN + wx.TB_HORZ_LAYOUT + wx.TB_HORZ_TEXT + wx.TB_NO_TOOLTIPS + + + +#--------------------------------------------------------------------------- + + +if __name__ == '__main__': + unittest.main()