annotate Mac/Modules/ctl/ctledit.py @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents c3a096bfbd6b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21403
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
1 # FindControlUnderMouse() returns an existing control, not a new one,
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
2 # so create this one by hand.
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
3 f = Function(ExistingControlHandle, 'FindControlUnderMouse',
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
4 (Point, 'inWhere', InMode),
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
5 (WindowRef, 'inWindow', InMode),
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
6 (SInt16, 'outPart', OutMode),
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
7 )
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
8 functions.append(f)
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
9
10116
49e7e21849b3 Added Ctl.as_Control and Menu.as_Menu methods, which take a resource as
Jack Jansen <jack.jansen@cwi.nl>
parents: 6330
diff changeset
10 f = Function(ControlHandle, 'as_Control',
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
11 (Handle, 'h', InMode))
10116
49e7e21849b3 Added Ctl.as_Control and Menu.as_Menu methods, which take a resource as
Jack Jansen <jack.jansen@cwi.nl>
parents: 6330
diff changeset
12 functions.append(f)
49e7e21849b3 Added Ctl.as_Control and Menu.as_Menu methods, which take a resource as
Jack Jansen <jack.jansen@cwi.nl>
parents: 6330
diff changeset
13
11622
65dc082f7004 Unified handle-conversion scheme to
Jack Jansen <jack.jansen@cwi.nl>
parents: 10116
diff changeset
14 f = Method(Handle, 'as_Resource', (ControlHandle, 'ctl', InMode))
2751
ae64003b2a75 Added as_Resource() method to convert ctl object to res object
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15 methods.append(f)
4348
852ca23c80cc Fixed very nasty null-dereferencing bug in DisposeControl/destroy
Jack Jansen <jack.jansen@cwi.nl>
parents: 2751
diff changeset
16
12027
f955fbd513ee Added a GetControlRect() method to controls which returns the bounding rectangle. To my surprise this call is missing from the C API...
Jack Jansen <jack.jansen@cwi.nl>
parents: 11622
diff changeset
17 f = Method(void, 'GetControlRect', (ControlHandle, 'ctl', InMode), (Rect, 'rect', OutMode))
f955fbd513ee Added a GetControlRect() method to controls which returns the bounding rectangle. To my surprise this call is missing from the C API...
Jack Jansen <jack.jansen@cwi.nl>
parents: 11622
diff changeset
18 methods.append(f)
f955fbd513ee Added a GetControlRect() method to controls which returns the bounding rectangle. To my surprise this call is missing from the C API...
Jack Jansen <jack.jansen@cwi.nl>
parents: 11622
diff changeset
19
4348
852ca23c80cc Fixed very nasty null-dereferencing bug in DisposeControl/destroy
Jack Jansen <jack.jansen@cwi.nl>
parents: 2751
diff changeset
20 DisposeControl_body = """
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
21 if (!PyArg_ParseTuple(_args, ""))
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
22 return NULL;
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
23 if ( _self->ob_itself ) {
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
24 SetControlReference(_self->ob_itself, (long)0); /* Make it forget about us */
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
25 DisposeControl(_self->ob_itself);
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
26 _self->ob_itself = NULL;
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
27 }
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
28 Py_INCREF(Py_None);
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
29 _res = Py_None;
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
30 return _res;
4348
852ca23c80cc Fixed very nasty null-dereferencing bug in DisposeControl/destroy
Jack Jansen <jack.jansen@cwi.nl>
parents: 2751
diff changeset
31 """
852ca23c80cc Fixed very nasty null-dereferencing bug in DisposeControl/destroy
Jack Jansen <jack.jansen@cwi.nl>
parents: 2751
diff changeset
32
852ca23c80cc Fixed very nasty null-dereferencing bug in DisposeControl/destroy
Jack Jansen <jack.jansen@cwi.nl>
parents: 2751
diff changeset
33 f = ManualGenerator("DisposeControl", DisposeControl_body)
852ca23c80cc Fixed very nasty null-dereferencing bug in DisposeControl/destroy
Jack Jansen <jack.jansen@cwi.nl>
parents: 2751
diff changeset
34 f.docstring = lambda : "() -> None"
852ca23c80cc Fixed very nasty null-dereferencing bug in DisposeControl/destroy
Jack Jansen <jack.jansen@cwi.nl>
parents: 2751
diff changeset
35
852ca23c80cc Fixed very nasty null-dereferencing bug in DisposeControl/destroy
Jack Jansen <jack.jansen@cwi.nl>
parents: 2751
diff changeset
36 methods.append(f)
21403
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
37
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
38 # All CreateXxxXxxControl() functions return a new object in an output
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
39 # parameter; these should however be managed by us (we're creating them
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
40 # after all), so set the type to ControlRef.
fbd57ee5b77d - "manage" controls created by CreateXxxXxxControl() functions.
Just van Rossum <just@letterror.com>
parents: 12027
diff changeset
41 for f in functions:
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
42 if f.name.startswith("Create"):
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
43 v = f.argumentList[-1]
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
44 if v.type == ExistingControlHandle:
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 21403
diff changeset
45 v.type = ControlRef