mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
Better implementation to ensure all window classes have a GetClassDefaultAttributes and that they are marked mustHaveApp
This commit is contained in:
@@ -46,7 +46,6 @@ def run():
|
||||
|
||||
|
||||
c = module.find('wxProgressDialog')
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
# Copy methods from the generic to the native class. This is needed
|
||||
# because none of the methods are declared in the interface files, and
|
||||
@@ -59,6 +58,7 @@ def run():
|
||||
not item.isDtor):
|
||||
c.addItem(copy.deepcopy(item))
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
|
||||
@@ -261,17 +261,27 @@ def fixWindowClass(klass, hideVirtuals=True, ignoreProtected=True):
|
||||
removeVirtuals(klass)
|
||||
addWindowVirtuals(klass)
|
||||
|
||||
if not klass.findItem('GetClassDefaultAttributes'):
|
||||
klass.addItem(extractors.WigCode("""\
|
||||
static wxVisualAttributes
|
||||
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
|
||||
"""))
|
||||
|
||||
if not ignoreProtected:
|
||||
for item in klass.allItems():
|
||||
if isinstance(item, extractors.MethodDef) and item.protection == 'protected':
|
||||
item.ignore(False)
|
||||
|
||||
fixDefaultAttributesMethods(klass)
|
||||
|
||||
|
||||
def fixDefaultAttributesMethods(klass):
|
||||
if not klass.findItem('GetClassDefaultAttributes'):
|
||||
m = extractors.MethodDef(
|
||||
type='wxVisualAttributes', name='GetClassDefaultAttributes',
|
||||
isStatic=True, protection='public',
|
||||
items=[extractors.ParamDef(
|
||||
type='wxWindowVariant', name='variant', default='wxWINDOW_VARIANT_NORMAL')]
|
||||
)
|
||||
klass.addItem(m)
|
||||
|
||||
if klass.findItem('GetDefaultAttributes'):
|
||||
klass.find('GetDefaultAttributes').mustHaveApp()
|
||||
klass.find('GetClassDefaultAttributes').mustHaveApp()
|
||||
|
||||
|
||||
def fixTopLevelWindowClass(klass, hideVirtuals=True, ignoreProtected=True):
|
||||
@@ -308,6 +318,8 @@ def fixTopLevelWindowClass(klass, hideVirtuals=True, ignoreProtected=True):
|
||||
if isinstance(item, extractors.MethodDef) and item.protection == 'protected':
|
||||
item.ignore(False)
|
||||
|
||||
fixDefaultAttributesMethods(klass)
|
||||
|
||||
|
||||
|
||||
def fixSizerClass(klass):
|
||||
|
||||
Reference in New Issue
Block a user