1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
#---------------------------------------------------------------------------
# Name: etg/menuitem.py
# Author: Robin Dunn
#
# Created: 10-Sept-2011
# Copyright: (c) 2011-2018 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_core"
NAME = "menuitem" # 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 = [ 'wxMenuItem' ]
#---------------------------------------------------------------------------
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.
c = module.find('wxMenuItem')
assert isinstance(c, etgtools.ClassDef)
c.addPrivateCopyCtor()
tools.removeVirtuals(c)
c.find('SetSubMenu.menu').transfer = True
# These are MSW only. Make them be empty stubs for the other ports
c.find('GetBackgroundColour').type = 'wxColour*'
c.find('GetBackgroundColour').setCppCode("""\
#ifdef __WXMSW__
return &self->GetBackgroundColour();
#else
return &wxNullColour;
#endif
""")
c.find('SetBackgroundColour').setCppCode("""\
#ifdef __WXMSW__
self->SetBackgroundColour(*colour);
#endif
""")
c.find('GetFont').type = 'wxFont*'
c.find('GetFont').setCppCode("""\
#ifdef __WXMSW__
return &self->GetFont();
#else
return &wxNullFont;
#endif
""")
c.find('SetFont').setCppCode("""\
#ifdef __WXMSW__
self->SetFont(*font);
#endif
""")
c.find('GetMarginWidth').setCppCode("""\
#ifdef __WXMSW__
return self->GetMarginWidth();
#else
return -1;
#endif
""")
c.find('SetMarginWidth').setCppCode("""\
#ifdef __WXMSW__
self->SetMarginWidth(width);
#endif
""")
c.find('GetTextColour').type = 'wxColour*'
c.find('GetTextColour').setCppCode("""\
#ifdef __WXMSW__
return &self->GetTextColour();
#else
return &wxNullColour;
#endif
""")
c.find('SetTextColour').setCppCode("""\
#ifdef __WXMSW__
self->SetTextColour(*colour);
#endif
""")
c.find('GetBitmap').type = 'const wxBitmap*'
c.find('GetBitmap').setCppCode("""\
#ifdef __WXMSW__
return &self->GetBitmap(checked);
#else
return &self->GetBitmap();
#endif
""")
c.find('SetBitmap').setCppCode("""\
#ifdef __WXMSW__
self->SetBitmap(*bmp, checked);
#else
self->SetBitmap(*bmp); // no checked arg in this case
#endif
""")
c.find('SetBitmaps').setCppCode("""\
#ifdef __WXMSW__
self->SetBitmaps(*checked, *unchecked);
#else
self->SetBitmap(*checked);
#endif
""")
c.find('GetDisabledBitmap').type = 'const wxBitmap*'
c.find('GetDisabledBitmap').setCppCode("""\
#ifdef __WXMSW__
return &self->GetDisabledBitmap();
#else
return &wxNullBitmap;
#endif
""")
c.find('SetDisabledBitmap').setCppCode("""\
#ifdef __WXMSW__
self->SetDisabledBitmap(*disabled);
#endif
""")
c.addAutoProperties()
c.addItem(etgtools.PropertyDef('Enabled', 'IsEnabled', 'Enable'))
c.find('GetAccel').factory = True
c.find('GetAccelFromString').ignore() # Not implemented anywere?
module.addItem(tools.wxListWrapperTemplate('wxMenuItemList', 'wxMenuItem', module))
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()
|