1 # Scan <Menus.h>, generating menugen.py.
4 BGENDIR
=os
.path
.join(sys
.prefix
, ':Tools:bgen:bgen')
5 sys
.path
.append(BGENDIR
)
7 from scantools
import Scanner
8 from bgenlocations
import TOOLBOXDIR
13 defsoutput
= TOOLBOXDIR
+ "Menus.py"
14 scanner
= MyScanner(input, output
, defsoutput
)
17 print "=== Done scanning and generating, now doing 'import menusupport' ==="
19 print "=== Done. It's up to you to compile Menumodule.c ==="
21 class MyScanner(Scanner
):
23 def destination(self
, type, name
, arglist
):
24 classname
= "Function"
25 listname
= "functions"
28 if t
in ("MenuHandle", "MenuRef") and m
== "InMode":
31 return classname
, listname
33 def makeblacklistnames(self
):
35 ## "IsShowContextualMenuClick", # Can't find it in the library
36 ## "InitContextualMenus", # ditto
37 "GetMenuItemProperty", # difficult for the moment
38 "GetMenuItemPropertySize",
39 "SetMenuItemProperty",
40 "RemoveMenuItemProperty",
41 "SetMenuCommandProperty",
42 "GetMenuCommandProperty",
43 "GetMenuTitle", # Funny arg/returnvalue
45 "SetMenuTitleIcon", # void*
48 def makegreylist(self
):
50 ('#if !TARGET_API_MAC_CARBON', [
64 ('#if TARGET_API_MAC_CARBON', [
68 'GetFontFamilyFromMenuSelection',
69 'UpdateStandardFontMenu',
70 'CreateStandardFontMenu',
71 'RemoveMenuCommandProperty',
72 'GetMenuCommandPropertySize',
73 'IsMenuCommandEnabled',
76 'GetIndMenuItemWithCommandID',
77 'CountMenuItemsWithCommandID',
78 'MenuHasEnabledItems',
80 'DisableAllMenuItems',
81 'ChangeMenuItemAttributes',
82 'GetMenuItemAttributes',
83 'ChangeMenuAttributes',
85 'ChangeMenuItemPropertyAttributes',
86 'GetMenuItemPropertyAttributes',
88 'UpdateInvalidMenuItems',
89 'InvalidateMenuItems',
94 'SetMenuItemCommandKey',
95 'GetMenuItemCommandKey',
98 'SetMenuItemTextWithCFString',
99 'CopyMenuItemTextAsCFString',
100 'GetMenuItemHierarchicalMenu',
101 'SetMenuItemHierarchicalMenu',
104 'InvalidateMenuEnabling',
105 'InsertMenuItemTextWithCFString',
106 'AppendMenuItemTextWithCFString',
110 'InvalidateMenuSize',
111 'SetMenuTitleWithCFString',
112 'CopyMenuTitleAsCFString',
116 'GetMenuRetainCount',
120 def makeblacklisttypes(self
):
125 'AEDesc_ptr', # For now: doable, but not easy
126 'ProcessSerialNumber', # ditto
127 "MenuDefSpecPtr", # Too difficult for now
128 "MenuDefSpec_ptr", # ditto
130 "void_ptr", # Don't know yet.
131 "EventRef", # For now, not exported yet.
132 "MenuItemDataPtr", # Not yet.
133 "MenuItemDataRec_ptr",
136 def makerepairinstructions(self
):
138 ([("Str255", "itemString", "InMode")],
139 [("*", "*", "OutMode")]),
141 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
142 [("InBuffer", "*", "*")]),
144 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
145 ("long", "*", "OutMode")],
146 [("VarVarOutBuffer", "*", "InOutMode")]),
147 ([("MenuRef", 'outHierMenu', "OutMode")],
148 [("OptMenuRef", 'outHierMenu', "OutMode")]),
151 def writeinitialdefs(self
):
152 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
154 if __name__
== "__main__":