1 # Scan <Controls.h>, generating ctlgen.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
+ "Controls.py"
14 scanner
= MyScanner(input, output
, defsoutput
)
17 print "=== Done scanning and generating, now doing 'import ctlsupport' ==="
19 print "=== Done. It's up to you to compile Ctlmodule.c ==="
21 class MyScanner(Scanner
):
23 def destination(self
, type, name
, arglist
):
24 classname
= "Function"
25 listname
= "functions"
28 if t
in ("ControlHandle", "ControlRef") and m
== "InMode":
31 return classname
, listname
33 def writeinitialdefs(self
):
34 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
35 self
.defsfile
.write("from TextEdit import *\n")
36 self
.defsfile
.write("from QuickDraw import *\n")
37 self
.defsfile
.write("\n")
39 def makeblacklistnames(self
):
41 'DisposeControl', # Generated manually
42 'KillControls', # Implied by close of dialog
44 'TrackControl', # Generated manually
45 'kControlBevelButtonCenterPopupGlyphTag', # Constant with funny definition
46 'kControlProgressBarIndeterminateTag', # ditto
47 # The following are unavailable for static 68k (appearance manager)
48 'GetBevelButtonMenuValue',
49 'SetBevelButtonMenuValue',
50 'GetBevelButtonMenuHandle',
51 'SetBevelButtonTransform',
52 'SetBevelButtonGraphicAlignment',
53 'SetBevelButtonTextAlignment',
54 'SetBevelButtonTextPlacement',
55 'SetImageWellTransform',
58 'SetDisclosureTriangleLastValue',
59 # Unavailable in CW Pro 3 libraries
60 'SetUpControlTextColor',
63 def makeblacklisttypes(self
):
67 'ControlButtonContentInfoPtr',
71 def makerepairinstructions(self
):
73 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
74 [("InBuffer", "*", "*")]),
76 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
77 ("long", "*", "OutMode")],
78 [("VarVarOutBuffer", "*", "InOutMode")]),
81 ## ([("ProcPtr", "actionProc", "InMode")],
82 ## [("FakeType('(ControlActionUPP)0')", "*", "*")]),
83 ## ([("ControlActionUPP", "actionProc", "InMode")],
84 ## [("FakeType('(ControlActionUPP)0')", "*", "*")]),
87 ([('Str255', 'title', 'InMode')],
88 [('Str255', 'title', 'OutMode')]),
90 ([("ControlHandle", "*", "OutMode")],
91 [("ExistingControlHandle", "*", "*")]),
92 ([("ControlRef", "*", "OutMode")], # Ditto, for Universal Headers
93 [("ExistingControlHandle", "*", "*")]),
96 if __name__
== "__main__":