1#---------------------------------------------------------------------------
2# Name:        etg/ribbon_bar.py
3# Author:      Robin Dunn
4#
5# Created:     20-Jun-2016
6# Copyright:   (c) 2016-2018 by Total Control Software
7# License:     wxWindows License
8#---------------------------------------------------------------------------
9
10import etgtools
11import etgtools.tweaker_tools as tools
12
13PACKAGE   = "wx"
14MODULE    = "_ribbon"
15NAME      = "ribbon_bar"   # Base name of the file to generate to for this script
16DOCSTRING = ""
17
18# The classes and/or the basename of the Doxygen XML files to be processed by
19# this script.
20ITEMS  = [ 'wxRibbonBarEvent',
21           'wxRibbonPageTabInfo',
22           'wxRibbonBar',
23           ]
24
25#---------------------------------------------------------------------------
26
27def run():
28    # Parse the XML file(s) building a collection of Extractor objects
29    module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
30    etgtools.parseDoxyXML(module, ITEMS)
31
32    #-----------------------------------------------------------------
33    # Tweak the parsed meta objects in the module object as needed for
34    # customizing the generated code and docstrings.
35
36    module.addHeaderCode('#include <wx/ribbon/bar.h>')
37
38    c = module.find('wxRibbonBar')
39    assert isinstance(c, etgtools.ClassDef)
40    tools.fixWindowClass(c)
41    c.find('SetArtProvider.art').transfer = True
42
43
44    c = module.find('wxRibbonBarEvent')
45    tools.fixEventClass(c)
46
47    module.addPyCode("""\
48        EVT_RIBBONBAR_PAGE_CHANGED    = wx.PyEventBinder(wxEVT_RIBBONBAR_PAGE_CHANGED, 1)
49        EVT_RIBBONBAR_PAGE_CHANGING   = wx.PyEventBinder(wxEVT_RIBBONBAR_PAGE_CHANGING,1)
50        EVT_RIBBONBAR_TAB_MIDDLE_DOWN = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_MIDDLE_DOWN, 1)
51        EVT_RIBBONBAR_TAB_MIDDLE_UP   = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_MIDDLE_UP, 1)
52        EVT_RIBBONBAR_TAB_RIGHT_DOWN  = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_RIGHT_DOWN, 1)
53        EVT_RIBBONBAR_TAB_RIGHT_UP    = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_RIGHT_UP, 1)
54        EVT_RIBBONBAR_TAB_LEFT_DCLICK = wx.PyEventBinder(wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, 1)
55        EVT_RIBBONBAR_TOGGLED         = wx.PyEventBinder(wxEVT_RIBBONBAR_TOGGLED, 1)
56        EVT_RIBBONBAR_HELP_CLICK      = wx.PyEventBinder(wxEVT_RIBBONBAR_HELP_CLICK, 1)
57        """)
58
59
60    module.addItem(
61        tools.wxArrayWrapperTemplate('wxRibbonPageTabInfoArray',
62                                     'wxRibbonPageTabInfo',
63                                     module))
64
65
66    #-----------------------------------------------------------------
67    tools.doCommonTweaks(module)
68    tools.runGenerators(module)
69
70
71#---------------------------------------------------------------------------
72if __name__ == '__main__':
73    run()
74
75