File: ctledit.py

package info (click to toggle)
python2.4 2.4.6-1%2Blenny1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 44,888 kB
  • ctags: 86,995
  • sloc: ansic: 306,391; python: 271,931; sh: 10,210; makefile: 4,248; perl: 3,736; lisp: 3,678; xml: 894; objc: 756; cpp: 7; sed: 2
file content (45 lines) | stat: -rw-r--r-- 1,447 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# FindControlUnderMouse() returns an existing control, not a new one,
# so create this one by hand.
f = Function(ExistingControlHandle, 'FindControlUnderMouse',
    (Point, 'inWhere', InMode),
    (WindowRef, 'inWindow', InMode),
    (SInt16, 'outPart', OutMode),
)
functions.append(f)

f = Function(ControlHandle, 'as_Control',
        (Handle, 'h', InMode))
functions.append(f)

f = Method(Handle, 'as_Resource', (ControlHandle, 'ctl', InMode))
methods.append(f)

f = Method(void, 'GetControlRect', (ControlHandle, 'ctl', InMode), (Rect, 'rect', OutMode))
methods.append(f)

DisposeControl_body = """
        if (!PyArg_ParseTuple(_args, ""))
                return NULL;
        if ( _self->ob_itself ) {
                SetControlReference(_self->ob_itself, (long)0); /* Make it forget about us */
                DisposeControl(_self->ob_itself);
                _self->ob_itself = NULL;
        }
        Py_INCREF(Py_None);
        _res = Py_None;
        return _res;
"""

f = ManualGenerator("DisposeControl", DisposeControl_body)
f.docstring = lambda : "() -> None"

methods.append(f)

# All CreateXxxXxxControl() functions return a new object in an output
# parameter; these should however be managed by us (we're creating them
# after all), so set the type to ControlRef.
for f in functions:
    if f.name.startswith("Create"):
        v = f.argumentList[-1]
        if v.type == ExistingControlHandle:
            v.type = ControlRef