Add toolbar

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-03-10 00:13:55 +00:00
parent 17c0a84335
commit 7409208cd7
5 changed files with 98 additions and 6 deletions

View File

@@ -142,6 +142,7 @@ INCLUDES = [ 'defs',
'spinctrl',
'tglbtn',
'scrolbar',
'toolbar',
# toplevel and dialogs
'nonownedwnd',

View File

@@ -71,7 +71,6 @@ def run():
class wxDropTarget;
class wxCaret;
class wxImageHandler;
class wxToolBar;
class wxExecuteEnv;
"""))

View File

@@ -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'

58
etg/toolbar.py Normal file
View File

@@ -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()

38
unittests/test_toolbar.py Normal file
View File

@@ -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()