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
47 def makegreylist(self
):
49 ('#if !TARGET_API_MAC_CARBON', [
63 ('#if TARGET_API_MAC_CARBON', [
67 'GetFontFamilyFromMenuSelection',
68 'UpdateStandardFontMenu',
69 'CreateStandardFontMenu',
70 'RemoveMenuCommandProperty',
71 'GetMenuCommandPropertySize',
72 'IsMenuCommandEnabled',
75 'GetIndMenuItemWithCommandID',
76 'CountMenuItemsWithCommandID',
77 'MenuHasEnabledItems',
79 'DisableAllMenuItems',
80 'ChangeMenuItemAttributes',
81 'GetMenuItemAttributes',
82 'ChangeMenuAttributes',
84 'ChangeMenuItemPropertyAttributes',
85 'GetMenuItemPropertyAttributes',
89 def makeblacklisttypes(self
):
94 'AEDesc_ptr', # For now: doable, but not easy
95 'ProcessSerialNumber', # ditto
96 "MenuDefSpecPtr", # Too difficult for now
97 "MenuDefSpec_ptr", # ditto
101 def makerepairinstructions(self
):
103 ([("Str255", "itemString", "InMode")],
104 [("*", "*", "OutMode")]),
106 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
107 [("InBuffer", "*", "*")]),
109 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
110 ("long", "*", "OutMode")],
111 [("VarVarOutBuffer", "*", "InOutMode")]),
114 def writeinitialdefs(self
):
115 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
117 if __name__
== "__main__":