|
1 |
|
2 /* ========================== Module _Ctl =========================== */ |
|
3 |
|
4 #include "Python.h" |
|
5 |
|
6 #ifndef __LP64__ |
|
7 |
|
8 |
|
9 #include "pymactoolbox.h" |
|
10 |
|
11 /* Macro to test whether a weak-loaded CFM function exists */ |
|
12 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ |
|
13 PyErr_SetString(PyExc_NotImplementedError, \ |
|
14 "Not available in this shared library/OS version"); \ |
|
15 return NULL; \ |
|
16 }} while(0) |
|
17 |
|
18 |
|
19 #include <Carbon/Carbon.h> |
|
20 |
|
21 #ifdef USE_TOOLBOX_OBJECT_GLUE |
|
22 extern PyObject *_CtlObj_New(ControlHandle); |
|
23 extern int _CtlObj_Convert(PyObject *, ControlHandle *); |
|
24 |
|
25 #define CtlObj_New _CtlObj_New |
|
26 #define CtlObj_Convert _CtlObj_Convert |
|
27 #endif |
|
28 |
|
29 static PyObject *CtlObj_WhichControl(ControlHandle); |
|
30 |
|
31 #define as_Control(h) ((ControlHandle)h) |
|
32 #define as_Resource(ctl) ((Handle)ctl) |
|
33 #define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp) |
|
34 |
|
35 #define MAXTABS 32 /* maximum number of tabs that we support in a tabs control */ |
|
36 /* |
|
37 ** Parse/generate ControlFontStyleRec records |
|
38 */ |
|
39 #if 0 /* Not needed */ |
|
40 static PyObject * |
|
41 ControlFontStyle_New(ControlFontStyleRec *itself) |
|
42 { |
|
43 |
|
44 return Py_BuildValue("hhhhhhO&O&", itself->flags, itself->font, |
|
45 itself->size, itself->style, itself->mode, itself->just, |
|
46 QdRGB_New, &itself->foreColor, QdRGB_New, &itself->backColor); |
|
47 } |
|
48 #endif |
|
49 |
|
50 static int |
|
51 ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself) |
|
52 { |
|
53 return PyArg_Parse(v, "(hhhhhhO&O&)", &itself->flags, |
|
54 &itself->font, &itself->size, &itself->style, &itself->mode, |
|
55 &itself->just, QdRGB_Convert, &itself->foreColor, |
|
56 QdRGB_Convert, &itself->backColor); |
|
57 } |
|
58 |
|
59 /* |
|
60 ** Parse/generate ControlID records |
|
61 */ |
|
62 static PyObject * |
|
63 PyControlID_New(ControlID *itself) |
|
64 { |
|
65 |
|
66 return Py_BuildValue("O&l", PyMac_BuildOSType, itself->signature, itself->id); |
|
67 } |
|
68 |
|
69 static int |
|
70 PyControlID_Convert(PyObject *v, ControlID *itself) |
|
71 { |
|
72 return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id); |
|
73 } |
|
74 |
|
75 /* |
|
76 ** generate DataBrowserListViewColumnDesc records |
|
77 */ |
|
78 static int |
|
79 DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself) |
|
80 { |
|
81 return PyArg_Parse(v, "(lO&l)", |
|
82 &itself->propertyID, |
|
83 PyMac_GetOSType, &itself->propertyType, |
|
84 &itself->propertyFlags); |
|
85 } |
|
86 |
|
87 static int |
|
88 ControlButtonContentInfo_Convert(PyObject *v, ControlButtonContentInfo *itself) |
|
89 { |
|
90 return PyArg_Parse(v, "(hO&)", |
|
91 &itself->contentType, |
|
92 OptResObj_Convert, &itself->u.iconSuite); |
|
93 } |
|
94 |
|
95 static int |
|
96 DataBrowserListViewHeaderDesc_Convert(PyObject *v, DataBrowserListViewHeaderDesc *itself) |
|
97 { |
|
98 itself->version = kDataBrowserListViewLatestHeaderDesc; |
|
99 return PyArg_Parse(v, "(HHhO&HO&O&)", |
|
100 &itself->minimumWidth, |
|
101 &itself->maximumWidth, |
|
102 &itself->titleOffset, |
|
103 CFStringRefObj_Convert, &itself->titleString, |
|
104 &itself->initialOrder, |
|
105 ControlFontStyle_Convert, &itself->btnFontStyle, |
|
106 ControlButtonContentInfo_Convert, &itself->btnContentInfo); |
|
107 } |
|
108 |
|
109 static int |
|
110 DataBrowserListViewColumnDesc_Convert(PyObject *v, DataBrowserListViewColumnDesc *itself) |
|
111 { |
|
112 return PyArg_Parse(v, "(O&O&)", |
|
113 DataBrowserTableViewColumnDesc_Convert, &itself->propertyDesc, |
|
114 DataBrowserListViewHeaderDesc_Convert, &itself->headerBtnDesc); |
|
115 } |
|
116 |
|
117 /* TrackControl and HandleControlClick callback support */ |
|
118 #define kMyControlActionProcTag 'ACTN' /* not an official tag, only for internal use */ |
|
119 static PyObject *tracker; |
|
120 static ControlActionUPP mytracker_upp; |
|
121 static ControlActionUPP myactionproc_upp; |
|
122 static ControlUserPaneKeyDownUPP mykeydownproc_upp; |
|
123 static ControlUserPaneFocusUPP myfocusproc_upp; |
|
124 static ControlUserPaneDrawUPP mydrawproc_upp; |
|
125 static ControlUserPaneIdleUPP myidleproc_upp; |
|
126 static ControlUserPaneHitTestUPP myhittestproc_upp; |
|
127 static ControlUserPaneTrackingUPP mytrackingproc_upp; |
|
128 |
|
129 static int settrackfunc(PyObject *); /* forward */ |
|
130 static void clrtrackfunc(void); /* forward */ |
|
131 static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *); |
|
132 |
|
133 static PyObject *Ctl_Error; |
|
134 |
|
135 /* ---------------------- Object type Control ----------------------- */ |
|
136 |
|
137 PyTypeObject Control_Type; |
|
138 |
|
139 #define CtlObj_Check(x) ((x)->ob_type == &Control_Type || PyObject_TypeCheck((x), &Control_Type)) |
|
140 |
|
141 typedef struct ControlObject { |
|
142 PyObject_HEAD |
|
143 ControlHandle ob_itself; |
|
144 PyObject *ob_callbackdict; |
|
145 } ControlObject; |
|
146 |
|
147 PyObject *CtlObj_New(ControlHandle itself) |
|
148 { |
|
149 ControlObject *it; |
|
150 if (itself == NULL) return PyMac_Error(resNotFound); |
|
151 it = PyObject_NEW(ControlObject, &Control_Type); |
|
152 if (it == NULL) return NULL; |
|
153 it->ob_itself = itself; |
|
154 SetControlReference(itself, (long)it); |
|
155 it->ob_callbackdict = NULL; |
|
156 return (PyObject *)it; |
|
157 } |
|
158 |
|
159 int CtlObj_Convert(PyObject *v, ControlHandle *p_itself) |
|
160 { |
|
161 if (!CtlObj_Check(v)) |
|
162 { |
|
163 PyErr_SetString(PyExc_TypeError, "Control required"); |
|
164 return 0; |
|
165 } |
|
166 *p_itself = ((ControlObject *)v)->ob_itself; |
|
167 return 1; |
|
168 } |
|
169 |
|
170 static void CtlObj_dealloc(ControlObject *self) |
|
171 { |
|
172 Py_XDECREF(self->ob_callbackdict); |
|
173 if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */ |
|
174 self->ob_type->tp_free((PyObject *)self); |
|
175 } |
|
176 |
|
177 static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args) |
|
178 { |
|
179 PyObject *_res = NULL; |
|
180 ControlPartCode hiliteState; |
|
181 #ifndef HiliteControl |
|
182 PyMac_PRECHECK(HiliteControl); |
|
183 #endif |
|
184 if (!PyArg_ParseTuple(_args, "h", |
|
185 &hiliteState)) |
|
186 return NULL; |
|
187 HiliteControl(_self->ob_itself, |
|
188 hiliteState); |
|
189 Py_INCREF(Py_None); |
|
190 _res = Py_None; |
|
191 return _res; |
|
192 } |
|
193 |
|
194 static PyObject *CtlObj_ShowControl(ControlObject *_self, PyObject *_args) |
|
195 { |
|
196 PyObject *_res = NULL; |
|
197 #ifndef ShowControl |
|
198 PyMac_PRECHECK(ShowControl); |
|
199 #endif |
|
200 if (!PyArg_ParseTuple(_args, "")) |
|
201 return NULL; |
|
202 ShowControl(_self->ob_itself); |
|
203 Py_INCREF(Py_None); |
|
204 _res = Py_None; |
|
205 return _res; |
|
206 } |
|
207 |
|
208 static PyObject *CtlObj_HideControl(ControlObject *_self, PyObject *_args) |
|
209 { |
|
210 PyObject *_res = NULL; |
|
211 #ifndef HideControl |
|
212 PyMac_PRECHECK(HideControl); |
|
213 #endif |
|
214 if (!PyArg_ParseTuple(_args, "")) |
|
215 return NULL; |
|
216 HideControl(_self->ob_itself); |
|
217 Py_INCREF(Py_None); |
|
218 _res = Py_None; |
|
219 return _res; |
|
220 } |
|
221 |
|
222 static PyObject *CtlObj_IsControlActive(ControlObject *_self, PyObject *_args) |
|
223 { |
|
224 PyObject *_res = NULL; |
|
225 Boolean _rv; |
|
226 #ifndef IsControlActive |
|
227 PyMac_PRECHECK(IsControlActive); |
|
228 #endif |
|
229 if (!PyArg_ParseTuple(_args, "")) |
|
230 return NULL; |
|
231 _rv = IsControlActive(_self->ob_itself); |
|
232 _res = Py_BuildValue("b", |
|
233 _rv); |
|
234 return _res; |
|
235 } |
|
236 |
|
237 static PyObject *CtlObj_IsControlVisible(ControlObject *_self, PyObject *_args) |
|
238 { |
|
239 PyObject *_res = NULL; |
|
240 Boolean _rv; |
|
241 #ifndef IsControlVisible |
|
242 PyMac_PRECHECK(IsControlVisible); |
|
243 #endif |
|
244 if (!PyArg_ParseTuple(_args, "")) |
|
245 return NULL; |
|
246 _rv = IsControlVisible(_self->ob_itself); |
|
247 _res = Py_BuildValue("b", |
|
248 _rv); |
|
249 return _res; |
|
250 } |
|
251 |
|
252 static PyObject *CtlObj_ActivateControl(ControlObject *_self, PyObject *_args) |
|
253 { |
|
254 PyObject *_res = NULL; |
|
255 OSErr _err; |
|
256 #ifndef ActivateControl |
|
257 PyMac_PRECHECK(ActivateControl); |
|
258 #endif |
|
259 if (!PyArg_ParseTuple(_args, "")) |
|
260 return NULL; |
|
261 _err = ActivateControl(_self->ob_itself); |
|
262 if (_err != noErr) return PyMac_Error(_err); |
|
263 Py_INCREF(Py_None); |
|
264 _res = Py_None; |
|
265 return _res; |
|
266 } |
|
267 |
|
268 static PyObject *CtlObj_DeactivateControl(ControlObject *_self, PyObject *_args) |
|
269 { |
|
270 PyObject *_res = NULL; |
|
271 OSErr _err; |
|
272 #ifndef DeactivateControl |
|
273 PyMac_PRECHECK(DeactivateControl); |
|
274 #endif |
|
275 if (!PyArg_ParseTuple(_args, "")) |
|
276 return NULL; |
|
277 _err = DeactivateControl(_self->ob_itself); |
|
278 if (_err != noErr) return PyMac_Error(_err); |
|
279 Py_INCREF(Py_None); |
|
280 _res = Py_None; |
|
281 return _res; |
|
282 } |
|
283 |
|
284 static PyObject *CtlObj_SetControlVisibility(ControlObject *_self, PyObject *_args) |
|
285 { |
|
286 PyObject *_res = NULL; |
|
287 OSErr _err; |
|
288 Boolean inIsVisible; |
|
289 Boolean inDoDraw; |
|
290 #ifndef SetControlVisibility |
|
291 PyMac_PRECHECK(SetControlVisibility); |
|
292 #endif |
|
293 if (!PyArg_ParseTuple(_args, "bb", |
|
294 &inIsVisible, |
|
295 &inDoDraw)) |
|
296 return NULL; |
|
297 _err = SetControlVisibility(_self->ob_itself, |
|
298 inIsVisible, |
|
299 inDoDraw); |
|
300 if (_err != noErr) return PyMac_Error(_err); |
|
301 Py_INCREF(Py_None); |
|
302 _res = Py_None; |
|
303 return _res; |
|
304 } |
|
305 |
|
306 static PyObject *CtlObj_IsControlEnabled(ControlObject *_self, PyObject *_args) |
|
307 { |
|
308 PyObject *_res = NULL; |
|
309 Boolean _rv; |
|
310 #ifndef IsControlEnabled |
|
311 PyMac_PRECHECK(IsControlEnabled); |
|
312 #endif |
|
313 if (!PyArg_ParseTuple(_args, "")) |
|
314 return NULL; |
|
315 _rv = IsControlEnabled(_self->ob_itself); |
|
316 _res = Py_BuildValue("b", |
|
317 _rv); |
|
318 return _res; |
|
319 } |
|
320 |
|
321 static PyObject *CtlObj_EnableControl(ControlObject *_self, PyObject *_args) |
|
322 { |
|
323 PyObject *_res = NULL; |
|
324 OSStatus _err; |
|
325 #ifndef EnableControl |
|
326 PyMac_PRECHECK(EnableControl); |
|
327 #endif |
|
328 if (!PyArg_ParseTuple(_args, "")) |
|
329 return NULL; |
|
330 _err = EnableControl(_self->ob_itself); |
|
331 if (_err != noErr) return PyMac_Error(_err); |
|
332 Py_INCREF(Py_None); |
|
333 _res = Py_None; |
|
334 return _res; |
|
335 } |
|
336 |
|
337 static PyObject *CtlObj_DisableControl(ControlObject *_self, PyObject *_args) |
|
338 { |
|
339 PyObject *_res = NULL; |
|
340 OSStatus _err; |
|
341 #ifndef DisableControl |
|
342 PyMac_PRECHECK(DisableControl); |
|
343 #endif |
|
344 if (!PyArg_ParseTuple(_args, "")) |
|
345 return NULL; |
|
346 _err = DisableControl(_self->ob_itself); |
|
347 if (_err != noErr) return PyMac_Error(_err); |
|
348 Py_INCREF(Py_None); |
|
349 _res = Py_None; |
|
350 return _res; |
|
351 } |
|
352 |
|
353 static PyObject *CtlObj_Draw1Control(ControlObject *_self, PyObject *_args) |
|
354 { |
|
355 PyObject *_res = NULL; |
|
356 #ifndef Draw1Control |
|
357 PyMac_PRECHECK(Draw1Control); |
|
358 #endif |
|
359 if (!PyArg_ParseTuple(_args, "")) |
|
360 return NULL; |
|
361 Draw1Control(_self->ob_itself); |
|
362 Py_INCREF(Py_None); |
|
363 _res = Py_None; |
|
364 return _res; |
|
365 } |
|
366 |
|
367 static PyObject *CtlObj_GetBestControlRect(ControlObject *_self, PyObject *_args) |
|
368 { |
|
369 PyObject *_res = NULL; |
|
370 OSErr _err; |
|
371 Rect outRect; |
|
372 SInt16 outBaseLineOffset; |
|
373 #ifndef GetBestControlRect |
|
374 PyMac_PRECHECK(GetBestControlRect); |
|
375 #endif |
|
376 if (!PyArg_ParseTuple(_args, "")) |
|
377 return NULL; |
|
378 _err = GetBestControlRect(_self->ob_itself, |
|
379 &outRect, |
|
380 &outBaseLineOffset); |
|
381 if (_err != noErr) return PyMac_Error(_err); |
|
382 _res = Py_BuildValue("O&h", |
|
383 PyMac_BuildRect, &outRect, |
|
384 outBaseLineOffset); |
|
385 return _res; |
|
386 } |
|
387 |
|
388 static PyObject *CtlObj_SetControlFontStyle(ControlObject *_self, PyObject *_args) |
|
389 { |
|
390 PyObject *_res = NULL; |
|
391 OSErr _err; |
|
392 ControlFontStyleRec inStyle; |
|
393 #ifndef SetControlFontStyle |
|
394 PyMac_PRECHECK(SetControlFontStyle); |
|
395 #endif |
|
396 if (!PyArg_ParseTuple(_args, "O&", |
|
397 ControlFontStyle_Convert, &inStyle)) |
|
398 return NULL; |
|
399 _err = SetControlFontStyle(_self->ob_itself, |
|
400 &inStyle); |
|
401 if (_err != noErr) return PyMac_Error(_err); |
|
402 Py_INCREF(Py_None); |
|
403 _res = Py_None; |
|
404 return _res; |
|
405 } |
|
406 |
|
407 static PyObject *CtlObj_DrawControlInCurrentPort(ControlObject *_self, PyObject *_args) |
|
408 { |
|
409 PyObject *_res = NULL; |
|
410 #ifndef DrawControlInCurrentPort |
|
411 PyMac_PRECHECK(DrawControlInCurrentPort); |
|
412 #endif |
|
413 if (!PyArg_ParseTuple(_args, "")) |
|
414 return NULL; |
|
415 DrawControlInCurrentPort(_self->ob_itself); |
|
416 Py_INCREF(Py_None); |
|
417 _res = Py_None; |
|
418 return _res; |
|
419 } |
|
420 |
|
421 static PyObject *CtlObj_SetUpControlBackground(ControlObject *_self, PyObject *_args) |
|
422 { |
|
423 PyObject *_res = NULL; |
|
424 OSErr _err; |
|
425 SInt16 inDepth; |
|
426 Boolean inIsColorDevice; |
|
427 #ifndef SetUpControlBackground |
|
428 PyMac_PRECHECK(SetUpControlBackground); |
|
429 #endif |
|
430 if (!PyArg_ParseTuple(_args, "hb", |
|
431 &inDepth, |
|
432 &inIsColorDevice)) |
|
433 return NULL; |
|
434 _err = SetUpControlBackground(_self->ob_itself, |
|
435 inDepth, |
|
436 inIsColorDevice); |
|
437 if (_err != noErr) return PyMac_Error(_err); |
|
438 Py_INCREF(Py_None); |
|
439 _res = Py_None; |
|
440 return _res; |
|
441 } |
|
442 |
|
443 static PyObject *CtlObj_SetUpControlTextColor(ControlObject *_self, PyObject *_args) |
|
444 { |
|
445 PyObject *_res = NULL; |
|
446 OSErr _err; |
|
447 SInt16 inDepth; |
|
448 Boolean inIsColorDevice; |
|
449 #ifndef SetUpControlTextColor |
|
450 PyMac_PRECHECK(SetUpControlTextColor); |
|
451 #endif |
|
452 if (!PyArg_ParseTuple(_args, "hb", |
|
453 &inDepth, |
|
454 &inIsColorDevice)) |
|
455 return NULL; |
|
456 _err = SetUpControlTextColor(_self->ob_itself, |
|
457 inDepth, |
|
458 inIsColorDevice); |
|
459 if (_err != noErr) return PyMac_Error(_err); |
|
460 Py_INCREF(Py_None); |
|
461 _res = Py_None; |
|
462 return _res; |
|
463 } |
|
464 |
|
465 static PyObject *CtlObj_DragControl(ControlObject *_self, PyObject *_args) |
|
466 { |
|
467 PyObject *_res = NULL; |
|
468 Point startPoint; |
|
469 Rect limitRect; |
|
470 Rect slopRect; |
|
471 DragConstraint axis; |
|
472 #ifndef DragControl |
|
473 PyMac_PRECHECK(DragControl); |
|
474 #endif |
|
475 if (!PyArg_ParseTuple(_args, "O&O&O&H", |
|
476 PyMac_GetPoint, &startPoint, |
|
477 PyMac_GetRect, &limitRect, |
|
478 PyMac_GetRect, &slopRect, |
|
479 &axis)) |
|
480 return NULL; |
|
481 DragControl(_self->ob_itself, |
|
482 startPoint, |
|
483 &limitRect, |
|
484 &slopRect, |
|
485 axis); |
|
486 Py_INCREF(Py_None); |
|
487 _res = Py_None; |
|
488 return _res; |
|
489 } |
|
490 |
|
491 static PyObject *CtlObj_TestControl(ControlObject *_self, PyObject *_args) |
|
492 { |
|
493 PyObject *_res = NULL; |
|
494 ControlPartCode _rv; |
|
495 Point testPoint; |
|
496 #ifndef TestControl |
|
497 PyMac_PRECHECK(TestControl); |
|
498 #endif |
|
499 if (!PyArg_ParseTuple(_args, "O&", |
|
500 PyMac_GetPoint, &testPoint)) |
|
501 return NULL; |
|
502 _rv = TestControl(_self->ob_itself, |
|
503 testPoint); |
|
504 _res = Py_BuildValue("h", |
|
505 _rv); |
|
506 return _res; |
|
507 } |
|
508 |
|
509 static PyObject *CtlObj_HandleControlContextualMenuClick(ControlObject *_self, PyObject *_args) |
|
510 { |
|
511 PyObject *_res = NULL; |
|
512 OSStatus _err; |
|
513 Point inWhere; |
|
514 Boolean menuDisplayed; |
|
515 #ifndef HandleControlContextualMenuClick |
|
516 PyMac_PRECHECK(HandleControlContextualMenuClick); |
|
517 #endif |
|
518 if (!PyArg_ParseTuple(_args, "O&", |
|
519 PyMac_GetPoint, &inWhere)) |
|
520 return NULL; |
|
521 _err = HandleControlContextualMenuClick(_self->ob_itself, |
|
522 inWhere, |
|
523 &menuDisplayed); |
|
524 if (_err != noErr) return PyMac_Error(_err); |
|
525 _res = Py_BuildValue("b", |
|
526 menuDisplayed); |
|
527 return _res; |
|
528 } |
|
529 |
|
530 static PyObject *CtlObj_GetControlClickActivation(ControlObject *_self, PyObject *_args) |
|
531 { |
|
532 PyObject *_res = NULL; |
|
533 OSStatus _err; |
|
534 Point inWhere; |
|
535 EventModifiers inModifiers; |
|
536 ClickActivationResult outResult; |
|
537 #ifndef GetControlClickActivation |
|
538 PyMac_PRECHECK(GetControlClickActivation); |
|
539 #endif |
|
540 if (!PyArg_ParseTuple(_args, "O&H", |
|
541 PyMac_GetPoint, &inWhere, |
|
542 &inModifiers)) |
|
543 return NULL; |
|
544 _err = GetControlClickActivation(_self->ob_itself, |
|
545 inWhere, |
|
546 inModifiers, |
|
547 &outResult); |
|
548 if (_err != noErr) return PyMac_Error(_err); |
|
549 _res = Py_BuildValue("l", |
|
550 outResult); |
|
551 return _res; |
|
552 } |
|
553 |
|
554 static PyObject *CtlObj_HandleControlKey(ControlObject *_self, PyObject *_args) |
|
555 { |
|
556 PyObject *_res = NULL; |
|
557 ControlPartCode _rv; |
|
558 SInt16 inKeyCode; |
|
559 SInt16 inCharCode; |
|
560 EventModifiers inModifiers; |
|
561 #ifndef HandleControlKey |
|
562 PyMac_PRECHECK(HandleControlKey); |
|
563 #endif |
|
564 if (!PyArg_ParseTuple(_args, "hhH", |
|
565 &inKeyCode, |
|
566 &inCharCode, |
|
567 &inModifiers)) |
|
568 return NULL; |
|
569 _rv = HandleControlKey(_self->ob_itself, |
|
570 inKeyCode, |
|
571 inCharCode, |
|
572 inModifiers); |
|
573 _res = Py_BuildValue("h", |
|
574 _rv); |
|
575 return _res; |
|
576 } |
|
577 |
|
578 static PyObject *CtlObj_HandleControlSetCursor(ControlObject *_self, PyObject *_args) |
|
579 { |
|
580 PyObject *_res = NULL; |
|
581 OSStatus _err; |
|
582 Point localPoint; |
|
583 EventModifiers modifiers; |
|
584 Boolean cursorWasSet; |
|
585 #ifndef HandleControlSetCursor |
|
586 PyMac_PRECHECK(HandleControlSetCursor); |
|
587 #endif |
|
588 if (!PyArg_ParseTuple(_args, "O&H", |
|
589 PyMac_GetPoint, &localPoint, |
|
590 &modifiers)) |
|
591 return NULL; |
|
592 _err = HandleControlSetCursor(_self->ob_itself, |
|
593 localPoint, |
|
594 modifiers, |
|
595 &cursorWasSet); |
|
596 if (_err != noErr) return PyMac_Error(_err); |
|
597 _res = Py_BuildValue("b", |
|
598 cursorWasSet); |
|
599 return _res; |
|
600 } |
|
601 |
|
602 static PyObject *CtlObj_MoveControl(ControlObject *_self, PyObject *_args) |
|
603 { |
|
604 PyObject *_res = NULL; |
|
605 SInt16 h; |
|
606 SInt16 v; |
|
607 #ifndef MoveControl |
|
608 PyMac_PRECHECK(MoveControl); |
|
609 #endif |
|
610 if (!PyArg_ParseTuple(_args, "hh", |
|
611 &h, |
|
612 &v)) |
|
613 return NULL; |
|
614 MoveControl(_self->ob_itself, |
|
615 h, |
|
616 v); |
|
617 Py_INCREF(Py_None); |
|
618 _res = Py_None; |
|
619 return _res; |
|
620 } |
|
621 |
|
622 static PyObject *CtlObj_SizeControl(ControlObject *_self, PyObject *_args) |
|
623 { |
|
624 PyObject *_res = NULL; |
|
625 SInt16 w; |
|
626 SInt16 h; |
|
627 #ifndef SizeControl |
|
628 PyMac_PRECHECK(SizeControl); |
|
629 #endif |
|
630 if (!PyArg_ParseTuple(_args, "hh", |
|
631 &w, |
|
632 &h)) |
|
633 return NULL; |
|
634 SizeControl(_self->ob_itself, |
|
635 w, |
|
636 h); |
|
637 Py_INCREF(Py_None); |
|
638 _res = Py_None; |
|
639 return _res; |
|
640 } |
|
641 |
|
642 static PyObject *CtlObj_SetControlTitle(ControlObject *_self, PyObject *_args) |
|
643 { |
|
644 PyObject *_res = NULL; |
|
645 Str255 title; |
|
646 #ifndef SetControlTitle |
|
647 PyMac_PRECHECK(SetControlTitle); |
|
648 #endif |
|
649 if (!PyArg_ParseTuple(_args, "O&", |
|
650 PyMac_GetStr255, title)) |
|
651 return NULL; |
|
652 SetControlTitle(_self->ob_itself, |
|
653 title); |
|
654 Py_INCREF(Py_None); |
|
655 _res = Py_None; |
|
656 return _res; |
|
657 } |
|
658 |
|
659 static PyObject *CtlObj_GetControlTitle(ControlObject *_self, PyObject *_args) |
|
660 { |
|
661 PyObject *_res = NULL; |
|
662 Str255 title; |
|
663 #ifndef GetControlTitle |
|
664 PyMac_PRECHECK(GetControlTitle); |
|
665 #endif |
|
666 if (!PyArg_ParseTuple(_args, "")) |
|
667 return NULL; |
|
668 GetControlTitle(_self->ob_itself, |
|
669 title); |
|
670 _res = Py_BuildValue("O&", |
|
671 PyMac_BuildStr255, title); |
|
672 return _res; |
|
673 } |
|
674 |
|
675 static PyObject *CtlObj_SetControlTitleWithCFString(ControlObject *_self, PyObject *_args) |
|
676 { |
|
677 PyObject *_res = NULL; |
|
678 OSStatus _err; |
|
679 CFStringRef inString; |
|
680 #ifndef SetControlTitleWithCFString |
|
681 PyMac_PRECHECK(SetControlTitleWithCFString); |
|
682 #endif |
|
683 if (!PyArg_ParseTuple(_args, "O&", |
|
684 CFStringRefObj_Convert, &inString)) |
|
685 return NULL; |
|
686 _err = SetControlTitleWithCFString(_self->ob_itself, |
|
687 inString); |
|
688 if (_err != noErr) return PyMac_Error(_err); |
|
689 Py_INCREF(Py_None); |
|
690 _res = Py_None; |
|
691 return _res; |
|
692 } |
|
693 |
|
694 static PyObject *CtlObj_CopyControlTitleAsCFString(ControlObject *_self, PyObject *_args) |
|
695 { |
|
696 PyObject *_res = NULL; |
|
697 OSStatus _err; |
|
698 CFStringRef outString; |
|
699 #ifndef CopyControlTitleAsCFString |
|
700 PyMac_PRECHECK(CopyControlTitleAsCFString); |
|
701 #endif |
|
702 if (!PyArg_ParseTuple(_args, "")) |
|
703 return NULL; |
|
704 _err = CopyControlTitleAsCFString(_self->ob_itself, |
|
705 &outString); |
|
706 if (_err != noErr) return PyMac_Error(_err); |
|
707 _res = Py_BuildValue("O&", |
|
708 CFStringRefObj_New, outString); |
|
709 return _res; |
|
710 } |
|
711 |
|
712 static PyObject *CtlObj_GetControlValue(ControlObject *_self, PyObject *_args) |
|
713 { |
|
714 PyObject *_res = NULL; |
|
715 SInt16 _rv; |
|
716 #ifndef GetControlValue |
|
717 PyMac_PRECHECK(GetControlValue); |
|
718 #endif |
|
719 if (!PyArg_ParseTuple(_args, "")) |
|
720 return NULL; |
|
721 _rv = GetControlValue(_self->ob_itself); |
|
722 _res = Py_BuildValue("h", |
|
723 _rv); |
|
724 return _res; |
|
725 } |
|
726 |
|
727 static PyObject *CtlObj_SetControlValue(ControlObject *_self, PyObject *_args) |
|
728 { |
|
729 PyObject *_res = NULL; |
|
730 SInt16 newValue; |
|
731 #ifndef SetControlValue |
|
732 PyMac_PRECHECK(SetControlValue); |
|
733 #endif |
|
734 if (!PyArg_ParseTuple(_args, "h", |
|
735 &newValue)) |
|
736 return NULL; |
|
737 SetControlValue(_self->ob_itself, |
|
738 newValue); |
|
739 Py_INCREF(Py_None); |
|
740 _res = Py_None; |
|
741 return _res; |
|
742 } |
|
743 |
|
744 static PyObject *CtlObj_GetControlMinimum(ControlObject *_self, PyObject *_args) |
|
745 { |
|
746 PyObject *_res = NULL; |
|
747 SInt16 _rv; |
|
748 #ifndef GetControlMinimum |
|
749 PyMac_PRECHECK(GetControlMinimum); |
|
750 #endif |
|
751 if (!PyArg_ParseTuple(_args, "")) |
|
752 return NULL; |
|
753 _rv = GetControlMinimum(_self->ob_itself); |
|
754 _res = Py_BuildValue("h", |
|
755 _rv); |
|
756 return _res; |
|
757 } |
|
758 |
|
759 static PyObject *CtlObj_SetControlMinimum(ControlObject *_self, PyObject *_args) |
|
760 { |
|
761 PyObject *_res = NULL; |
|
762 SInt16 newMinimum; |
|
763 #ifndef SetControlMinimum |
|
764 PyMac_PRECHECK(SetControlMinimum); |
|
765 #endif |
|
766 if (!PyArg_ParseTuple(_args, "h", |
|
767 &newMinimum)) |
|
768 return NULL; |
|
769 SetControlMinimum(_self->ob_itself, |
|
770 newMinimum); |
|
771 Py_INCREF(Py_None); |
|
772 _res = Py_None; |
|
773 return _res; |
|
774 } |
|
775 |
|
776 static PyObject *CtlObj_GetControlMaximum(ControlObject *_self, PyObject *_args) |
|
777 { |
|
778 PyObject *_res = NULL; |
|
779 SInt16 _rv; |
|
780 #ifndef GetControlMaximum |
|
781 PyMac_PRECHECK(GetControlMaximum); |
|
782 #endif |
|
783 if (!PyArg_ParseTuple(_args, "")) |
|
784 return NULL; |
|
785 _rv = GetControlMaximum(_self->ob_itself); |
|
786 _res = Py_BuildValue("h", |
|
787 _rv); |
|
788 return _res; |
|
789 } |
|
790 |
|
791 static PyObject *CtlObj_SetControlMaximum(ControlObject *_self, PyObject *_args) |
|
792 { |
|
793 PyObject *_res = NULL; |
|
794 SInt16 newMaximum; |
|
795 #ifndef SetControlMaximum |
|
796 PyMac_PRECHECK(SetControlMaximum); |
|
797 #endif |
|
798 if (!PyArg_ParseTuple(_args, "h", |
|
799 &newMaximum)) |
|
800 return NULL; |
|
801 SetControlMaximum(_self->ob_itself, |
|
802 newMaximum); |
|
803 Py_INCREF(Py_None); |
|
804 _res = Py_None; |
|
805 return _res; |
|
806 } |
|
807 |
|
808 static PyObject *CtlObj_GetControlViewSize(ControlObject *_self, PyObject *_args) |
|
809 { |
|
810 PyObject *_res = NULL; |
|
811 SInt32 _rv; |
|
812 #ifndef GetControlViewSize |
|
813 PyMac_PRECHECK(GetControlViewSize); |
|
814 #endif |
|
815 if (!PyArg_ParseTuple(_args, "")) |
|
816 return NULL; |
|
817 _rv = GetControlViewSize(_self->ob_itself); |
|
818 _res = Py_BuildValue("l", |
|
819 _rv); |
|
820 return _res; |
|
821 } |
|
822 |
|
823 static PyObject *CtlObj_SetControlViewSize(ControlObject *_self, PyObject *_args) |
|
824 { |
|
825 PyObject *_res = NULL; |
|
826 SInt32 newViewSize; |
|
827 #ifndef SetControlViewSize |
|
828 PyMac_PRECHECK(SetControlViewSize); |
|
829 #endif |
|
830 if (!PyArg_ParseTuple(_args, "l", |
|
831 &newViewSize)) |
|
832 return NULL; |
|
833 SetControlViewSize(_self->ob_itself, |
|
834 newViewSize); |
|
835 Py_INCREF(Py_None); |
|
836 _res = Py_None; |
|
837 return _res; |
|
838 } |
|
839 |
|
840 static PyObject *CtlObj_GetControl32BitValue(ControlObject *_self, PyObject *_args) |
|
841 { |
|
842 PyObject *_res = NULL; |
|
843 SInt32 _rv; |
|
844 #ifndef GetControl32BitValue |
|
845 PyMac_PRECHECK(GetControl32BitValue); |
|
846 #endif |
|
847 if (!PyArg_ParseTuple(_args, "")) |
|
848 return NULL; |
|
849 _rv = GetControl32BitValue(_self->ob_itself); |
|
850 _res = Py_BuildValue("l", |
|
851 _rv); |
|
852 return _res; |
|
853 } |
|
854 |
|
855 static PyObject *CtlObj_SetControl32BitValue(ControlObject *_self, PyObject *_args) |
|
856 { |
|
857 PyObject *_res = NULL; |
|
858 SInt32 newValue; |
|
859 #ifndef SetControl32BitValue |
|
860 PyMac_PRECHECK(SetControl32BitValue); |
|
861 #endif |
|
862 if (!PyArg_ParseTuple(_args, "l", |
|
863 &newValue)) |
|
864 return NULL; |
|
865 SetControl32BitValue(_self->ob_itself, |
|
866 newValue); |
|
867 Py_INCREF(Py_None); |
|
868 _res = Py_None; |
|
869 return _res; |
|
870 } |
|
871 |
|
872 static PyObject *CtlObj_GetControl32BitMaximum(ControlObject *_self, PyObject *_args) |
|
873 { |
|
874 PyObject *_res = NULL; |
|
875 SInt32 _rv; |
|
876 #ifndef GetControl32BitMaximum |
|
877 PyMac_PRECHECK(GetControl32BitMaximum); |
|
878 #endif |
|
879 if (!PyArg_ParseTuple(_args, "")) |
|
880 return NULL; |
|
881 _rv = GetControl32BitMaximum(_self->ob_itself); |
|
882 _res = Py_BuildValue("l", |
|
883 _rv); |
|
884 return _res; |
|
885 } |
|
886 |
|
887 static PyObject *CtlObj_SetControl32BitMaximum(ControlObject *_self, PyObject *_args) |
|
888 { |
|
889 PyObject *_res = NULL; |
|
890 SInt32 newMaximum; |
|
891 #ifndef SetControl32BitMaximum |
|
892 PyMac_PRECHECK(SetControl32BitMaximum); |
|
893 #endif |
|
894 if (!PyArg_ParseTuple(_args, "l", |
|
895 &newMaximum)) |
|
896 return NULL; |
|
897 SetControl32BitMaximum(_self->ob_itself, |
|
898 newMaximum); |
|
899 Py_INCREF(Py_None); |
|
900 _res = Py_None; |
|
901 return _res; |
|
902 } |
|
903 |
|
904 static PyObject *CtlObj_GetControl32BitMinimum(ControlObject *_self, PyObject *_args) |
|
905 { |
|
906 PyObject *_res = NULL; |
|
907 SInt32 _rv; |
|
908 #ifndef GetControl32BitMinimum |
|
909 PyMac_PRECHECK(GetControl32BitMinimum); |
|
910 #endif |
|
911 if (!PyArg_ParseTuple(_args, "")) |
|
912 return NULL; |
|
913 _rv = GetControl32BitMinimum(_self->ob_itself); |
|
914 _res = Py_BuildValue("l", |
|
915 _rv); |
|
916 return _res; |
|
917 } |
|
918 |
|
919 static PyObject *CtlObj_SetControl32BitMinimum(ControlObject *_self, PyObject *_args) |
|
920 { |
|
921 PyObject *_res = NULL; |
|
922 SInt32 newMinimum; |
|
923 #ifndef SetControl32BitMinimum |
|
924 PyMac_PRECHECK(SetControl32BitMinimum); |
|
925 #endif |
|
926 if (!PyArg_ParseTuple(_args, "l", |
|
927 &newMinimum)) |
|
928 return NULL; |
|
929 SetControl32BitMinimum(_self->ob_itself, |
|
930 newMinimum); |
|
931 Py_INCREF(Py_None); |
|
932 _res = Py_None; |
|
933 return _res; |
|
934 } |
|
935 |
|
936 static PyObject *CtlObj_IsValidControlHandle(ControlObject *_self, PyObject *_args) |
|
937 { |
|
938 PyObject *_res = NULL; |
|
939 Boolean _rv; |
|
940 #ifndef IsValidControlHandle |
|
941 PyMac_PRECHECK(IsValidControlHandle); |
|
942 #endif |
|
943 if (!PyArg_ParseTuple(_args, "")) |
|
944 return NULL; |
|
945 _rv = IsValidControlHandle(_self->ob_itself); |
|
946 _res = Py_BuildValue("b", |
|
947 _rv); |
|
948 return _res; |
|
949 } |
|
950 |
|
951 static PyObject *CtlObj_SetControlID(ControlObject *_self, PyObject *_args) |
|
952 { |
|
953 PyObject *_res = NULL; |
|
954 OSStatus _err; |
|
955 ControlID inID; |
|
956 #ifndef SetControlID |
|
957 PyMac_PRECHECK(SetControlID); |
|
958 #endif |
|
959 if (!PyArg_ParseTuple(_args, "O&", |
|
960 PyControlID_Convert, &inID)) |
|
961 return NULL; |
|
962 _err = SetControlID(_self->ob_itself, |
|
963 &inID); |
|
964 if (_err != noErr) return PyMac_Error(_err); |
|
965 Py_INCREF(Py_None); |
|
966 _res = Py_None; |
|
967 return _res; |
|
968 } |
|
969 |
|
970 static PyObject *CtlObj_GetControlID(ControlObject *_self, PyObject *_args) |
|
971 { |
|
972 PyObject *_res = NULL; |
|
973 OSStatus _err; |
|
974 ControlID outID; |
|
975 #ifndef GetControlID |
|
976 PyMac_PRECHECK(GetControlID); |
|
977 #endif |
|
978 if (!PyArg_ParseTuple(_args, "")) |
|
979 return NULL; |
|
980 _err = GetControlID(_self->ob_itself, |
|
981 &outID); |
|
982 if (_err != noErr) return PyMac_Error(_err); |
|
983 _res = Py_BuildValue("O&", |
|
984 PyControlID_New, &outID); |
|
985 return _res; |
|
986 } |
|
987 |
|
988 static PyObject *CtlObj_SetControlCommandID(ControlObject *_self, PyObject *_args) |
|
989 { |
|
990 PyObject *_res = NULL; |
|
991 OSStatus _err; |
|
992 UInt32 inCommandID; |
|
993 #ifndef SetControlCommandID |
|
994 PyMac_PRECHECK(SetControlCommandID); |
|
995 #endif |
|
996 if (!PyArg_ParseTuple(_args, "l", |
|
997 &inCommandID)) |
|
998 return NULL; |
|
999 _err = SetControlCommandID(_self->ob_itself, |
|
1000 inCommandID); |
|
1001 if (_err != noErr) return PyMac_Error(_err); |
|
1002 Py_INCREF(Py_None); |
|
1003 _res = Py_None; |
|
1004 return _res; |
|
1005 } |
|
1006 |
|
1007 static PyObject *CtlObj_GetControlCommandID(ControlObject *_self, PyObject *_args) |
|
1008 { |
|
1009 PyObject *_res = NULL; |
|
1010 OSStatus _err; |
|
1011 UInt32 outCommandID; |
|
1012 #ifndef GetControlCommandID |
|
1013 PyMac_PRECHECK(GetControlCommandID); |
|
1014 #endif |
|
1015 if (!PyArg_ParseTuple(_args, "")) |
|
1016 return NULL; |
|
1017 _err = GetControlCommandID(_self->ob_itself, |
|
1018 &outCommandID); |
|
1019 if (_err != noErr) return PyMac_Error(_err); |
|
1020 _res = Py_BuildValue("l", |
|
1021 outCommandID); |
|
1022 return _res; |
|
1023 } |
|
1024 |
|
1025 static PyObject *CtlObj_RemoveControlProperty(ControlObject *_self, PyObject *_args) |
|
1026 { |
|
1027 PyObject *_res = NULL; |
|
1028 OSStatus _err; |
|
1029 OSType propertyCreator; |
|
1030 OSType propertyTag; |
|
1031 #ifndef RemoveControlProperty |
|
1032 PyMac_PRECHECK(RemoveControlProperty); |
|
1033 #endif |
|
1034 if (!PyArg_ParseTuple(_args, "O&O&", |
|
1035 PyMac_GetOSType, &propertyCreator, |
|
1036 PyMac_GetOSType, &propertyTag)) |
|
1037 return NULL; |
|
1038 _err = RemoveControlProperty(_self->ob_itself, |
|
1039 propertyCreator, |
|
1040 propertyTag); |
|
1041 if (_err != noErr) return PyMac_Error(_err); |
|
1042 Py_INCREF(Py_None); |
|
1043 _res = Py_None; |
|
1044 return _res; |
|
1045 } |
|
1046 |
|
1047 static PyObject *CtlObj_GetControlPropertyAttributes(ControlObject *_self, PyObject *_args) |
|
1048 { |
|
1049 PyObject *_res = NULL; |
|
1050 OSStatus _err; |
|
1051 OSType propertyCreator; |
|
1052 OSType propertyTag; |
|
1053 UInt32 attributes; |
|
1054 #ifndef GetControlPropertyAttributes |
|
1055 PyMac_PRECHECK(GetControlPropertyAttributes); |
|
1056 #endif |
|
1057 if (!PyArg_ParseTuple(_args, "O&O&", |
|
1058 PyMac_GetOSType, &propertyCreator, |
|
1059 PyMac_GetOSType, &propertyTag)) |
|
1060 return NULL; |
|
1061 _err = GetControlPropertyAttributes(_self->ob_itself, |
|
1062 propertyCreator, |
|
1063 propertyTag, |
|
1064 &attributes); |
|
1065 if (_err != noErr) return PyMac_Error(_err); |
|
1066 _res = Py_BuildValue("l", |
|
1067 attributes); |
|
1068 return _res; |
|
1069 } |
|
1070 |
|
1071 static PyObject *CtlObj_ChangeControlPropertyAttributes(ControlObject *_self, PyObject *_args) |
|
1072 { |
|
1073 PyObject *_res = NULL; |
|
1074 OSStatus _err; |
|
1075 OSType propertyCreator; |
|
1076 OSType propertyTag; |
|
1077 UInt32 attributesToSet; |
|
1078 UInt32 attributesToClear; |
|
1079 #ifndef ChangeControlPropertyAttributes |
|
1080 PyMac_PRECHECK(ChangeControlPropertyAttributes); |
|
1081 #endif |
|
1082 if (!PyArg_ParseTuple(_args, "O&O&ll", |
|
1083 PyMac_GetOSType, &propertyCreator, |
|
1084 PyMac_GetOSType, &propertyTag, |
|
1085 &attributesToSet, |
|
1086 &attributesToClear)) |
|
1087 return NULL; |
|
1088 _err = ChangeControlPropertyAttributes(_self->ob_itself, |
|
1089 propertyCreator, |
|
1090 propertyTag, |
|
1091 attributesToSet, |
|
1092 attributesToClear); |
|
1093 if (_err != noErr) return PyMac_Error(_err); |
|
1094 Py_INCREF(Py_None); |
|
1095 _res = Py_None; |
|
1096 return _res; |
|
1097 } |
|
1098 |
|
1099 static PyObject *CtlObj_GetControlRegion(ControlObject *_self, PyObject *_args) |
|
1100 { |
|
1101 PyObject *_res = NULL; |
|
1102 OSStatus _err; |
|
1103 ControlPartCode inPart; |
|
1104 RgnHandle outRegion; |
|
1105 #ifndef GetControlRegion |
|
1106 PyMac_PRECHECK(GetControlRegion); |
|
1107 #endif |
|
1108 if (!PyArg_ParseTuple(_args, "hO&", |
|
1109 &inPart, |
|
1110 ResObj_Convert, &outRegion)) |
|
1111 return NULL; |
|
1112 _err = GetControlRegion(_self->ob_itself, |
|
1113 inPart, |
|
1114 outRegion); |
|
1115 if (_err != noErr) return PyMac_Error(_err); |
|
1116 Py_INCREF(Py_None); |
|
1117 _res = Py_None; |
|
1118 return _res; |
|
1119 } |
|
1120 |
|
1121 static PyObject *CtlObj_GetControlVariant(ControlObject *_self, PyObject *_args) |
|
1122 { |
|
1123 PyObject *_res = NULL; |
|
1124 ControlVariant _rv; |
|
1125 #ifndef GetControlVariant |
|
1126 PyMac_PRECHECK(GetControlVariant); |
|
1127 #endif |
|
1128 if (!PyArg_ParseTuple(_args, "")) |
|
1129 return NULL; |
|
1130 _rv = GetControlVariant(_self->ob_itself); |
|
1131 _res = Py_BuildValue("h", |
|
1132 _rv); |
|
1133 return _res; |
|
1134 } |
|
1135 |
|
1136 static PyObject *CtlObj_SetControlAction(ControlObject *_self, PyObject *_args) |
|
1137 { |
|
1138 PyObject *_res = NULL; |
|
1139 PyObject* actionProc; |
|
1140 UniversalProcPtr c_callback; |
|
1141 #ifndef SetControlAction |
|
1142 PyMac_PRECHECK(SetControlAction); |
|
1143 #endif |
|
1144 if (!PyArg_ParseTuple(_args, "O", |
|
1145 &actionProc)) |
|
1146 return NULL; |
|
1147 SetControlAction(_self->ob_itself, |
|
1148 myactionproc_upp); |
|
1149 Py_INCREF(Py_None); |
|
1150 _res = Py_None; |
|
1151 setcallback((PyObject*)_self, kMyControlActionProcTag, actionProc, &c_callback); |
|
1152 return _res; |
|
1153 } |
|
1154 |
|
1155 static PyObject *CtlObj_SetControlReference(ControlObject *_self, PyObject *_args) |
|
1156 { |
|
1157 PyObject *_res = NULL; |
|
1158 SInt32 data; |
|
1159 #ifndef SetControlReference |
|
1160 PyMac_PRECHECK(SetControlReference); |
|
1161 #endif |
|
1162 if (!PyArg_ParseTuple(_args, "l", |
|
1163 &data)) |
|
1164 return NULL; |
|
1165 SetControlReference(_self->ob_itself, |
|
1166 data); |
|
1167 Py_INCREF(Py_None); |
|
1168 _res = Py_None; |
|
1169 return _res; |
|
1170 } |
|
1171 |
|
1172 static PyObject *CtlObj_GetControlReference(ControlObject *_self, PyObject *_args) |
|
1173 { |
|
1174 PyObject *_res = NULL; |
|
1175 SInt32 _rv; |
|
1176 #ifndef GetControlReference |
|
1177 PyMac_PRECHECK(GetControlReference); |
|
1178 #endif |
|
1179 if (!PyArg_ParseTuple(_args, "")) |
|
1180 return NULL; |
|
1181 _rv = GetControlReference(_self->ob_itself); |
|
1182 _res = Py_BuildValue("l", |
|
1183 _rv); |
|
1184 return _res; |
|
1185 } |
|
1186 |
|
1187 static PyObject *CtlObj_EmbedControl(ControlObject *_self, PyObject *_args) |
|
1188 { |
|
1189 PyObject *_res = NULL; |
|
1190 OSErr _err; |
|
1191 ControlHandle inContainer; |
|
1192 #ifndef EmbedControl |
|
1193 PyMac_PRECHECK(EmbedControl); |
|
1194 #endif |
|
1195 if (!PyArg_ParseTuple(_args, "O&", |
|
1196 CtlObj_Convert, &inContainer)) |
|
1197 return NULL; |
|
1198 _err = EmbedControl(_self->ob_itself, |
|
1199 inContainer); |
|
1200 if (_err != noErr) return PyMac_Error(_err); |
|
1201 Py_INCREF(Py_None); |
|
1202 _res = Py_None; |
|
1203 return _res; |
|
1204 } |
|
1205 |
|
1206 static PyObject *CtlObj_AutoEmbedControl(ControlObject *_self, PyObject *_args) |
|
1207 { |
|
1208 PyObject *_res = NULL; |
|
1209 OSErr _err; |
|
1210 WindowPtr inWindow; |
|
1211 #ifndef AutoEmbedControl |
|
1212 PyMac_PRECHECK(AutoEmbedControl); |
|
1213 #endif |
|
1214 if (!PyArg_ParseTuple(_args, "O&", |
|
1215 WinObj_Convert, &inWindow)) |
|
1216 return NULL; |
|
1217 _err = AutoEmbedControl(_self->ob_itself, |
|
1218 inWindow); |
|
1219 if (_err != noErr) return PyMac_Error(_err); |
|
1220 Py_INCREF(Py_None); |
|
1221 _res = Py_None; |
|
1222 return _res; |
|
1223 } |
|
1224 |
|
1225 static PyObject *CtlObj_GetSuperControl(ControlObject *_self, PyObject *_args) |
|
1226 { |
|
1227 PyObject *_res = NULL; |
|
1228 OSErr _err; |
|
1229 ControlHandle outParent; |
|
1230 #ifndef GetSuperControl |
|
1231 PyMac_PRECHECK(GetSuperControl); |
|
1232 #endif |
|
1233 if (!PyArg_ParseTuple(_args, "")) |
|
1234 return NULL; |
|
1235 _err = GetSuperControl(_self->ob_itself, |
|
1236 &outParent); |
|
1237 if (_err != noErr) return PyMac_Error(_err); |
|
1238 _res = Py_BuildValue("O&", |
|
1239 CtlObj_WhichControl, outParent); |
|
1240 return _res; |
|
1241 } |
|
1242 |
|
1243 static PyObject *CtlObj_CountSubControls(ControlObject *_self, PyObject *_args) |
|
1244 { |
|
1245 PyObject *_res = NULL; |
|
1246 OSErr _err; |
|
1247 UInt16 outNumChildren; |
|
1248 #ifndef CountSubControls |
|
1249 PyMac_PRECHECK(CountSubControls); |
|
1250 #endif |
|
1251 if (!PyArg_ParseTuple(_args, "")) |
|
1252 return NULL; |
|
1253 _err = CountSubControls(_self->ob_itself, |
|
1254 &outNumChildren); |
|
1255 if (_err != noErr) return PyMac_Error(_err); |
|
1256 _res = Py_BuildValue("H", |
|
1257 outNumChildren); |
|
1258 return _res; |
|
1259 } |
|
1260 |
|
1261 static PyObject *CtlObj_GetIndexedSubControl(ControlObject *_self, PyObject *_args) |
|
1262 { |
|
1263 PyObject *_res = NULL; |
|
1264 OSErr _err; |
|
1265 UInt16 inIndex; |
|
1266 ControlHandle outSubControl; |
|
1267 #ifndef GetIndexedSubControl |
|
1268 PyMac_PRECHECK(GetIndexedSubControl); |
|
1269 #endif |
|
1270 if (!PyArg_ParseTuple(_args, "H", |
|
1271 &inIndex)) |
|
1272 return NULL; |
|
1273 _err = GetIndexedSubControl(_self->ob_itself, |
|
1274 inIndex, |
|
1275 &outSubControl); |
|
1276 if (_err != noErr) return PyMac_Error(_err); |
|
1277 _res = Py_BuildValue("O&", |
|
1278 CtlObj_WhichControl, outSubControl); |
|
1279 return _res; |
|
1280 } |
|
1281 |
|
1282 static PyObject *CtlObj_SetControlSupervisor(ControlObject *_self, PyObject *_args) |
|
1283 { |
|
1284 PyObject *_res = NULL; |
|
1285 OSErr _err; |
|
1286 ControlHandle inBoss; |
|
1287 #ifndef SetControlSupervisor |
|
1288 PyMac_PRECHECK(SetControlSupervisor); |
|
1289 #endif |
|
1290 if (!PyArg_ParseTuple(_args, "O&", |
|
1291 CtlObj_Convert, &inBoss)) |
|
1292 return NULL; |
|
1293 _err = SetControlSupervisor(_self->ob_itself, |
|
1294 inBoss); |
|
1295 if (_err != noErr) return PyMac_Error(_err); |
|
1296 Py_INCREF(Py_None); |
|
1297 _res = Py_None; |
|
1298 return _res; |
|
1299 } |
|
1300 |
|
1301 static PyObject *CtlObj_GetControlFeatures(ControlObject *_self, PyObject *_args) |
|
1302 { |
|
1303 PyObject *_res = NULL; |
|
1304 OSErr _err; |
|
1305 UInt32 outFeatures; |
|
1306 #ifndef GetControlFeatures |
|
1307 PyMac_PRECHECK(GetControlFeatures); |
|
1308 #endif |
|
1309 if (!PyArg_ParseTuple(_args, "")) |
|
1310 return NULL; |
|
1311 _err = GetControlFeatures(_self->ob_itself, |
|
1312 &outFeatures); |
|
1313 if (_err != noErr) return PyMac_Error(_err); |
|
1314 _res = Py_BuildValue("l", |
|
1315 outFeatures); |
|
1316 return _res; |
|
1317 } |
|
1318 |
|
1319 static PyObject *CtlObj_GetControlDataSize(ControlObject *_self, PyObject *_args) |
|
1320 { |
|
1321 PyObject *_res = NULL; |
|
1322 OSErr _err; |
|
1323 ControlPartCode inPart; |
|
1324 ResType inTagName; |
|
1325 Size outMaxSize; |
|
1326 #ifndef GetControlDataSize |
|
1327 PyMac_PRECHECK(GetControlDataSize); |
|
1328 #endif |
|
1329 if (!PyArg_ParseTuple(_args, "hO&", |
|
1330 &inPart, |
|
1331 PyMac_GetOSType, &inTagName)) |
|
1332 return NULL; |
|
1333 _err = GetControlDataSize(_self->ob_itself, |
|
1334 inPart, |
|
1335 inTagName, |
|
1336 &outMaxSize); |
|
1337 if (_err != noErr) return PyMac_Error(_err); |
|
1338 _res = Py_BuildValue("l", |
|
1339 outMaxSize); |
|
1340 return _res; |
|
1341 } |
|
1342 |
|
1343 static PyObject *CtlObj_HandleControlDragTracking(ControlObject *_self, PyObject *_args) |
|
1344 { |
|
1345 PyObject *_res = NULL; |
|
1346 OSStatus _err; |
|
1347 DragTrackingMessage inMessage; |
|
1348 DragReference inDrag; |
|
1349 Boolean outLikesDrag; |
|
1350 #ifndef HandleControlDragTracking |
|
1351 PyMac_PRECHECK(HandleControlDragTracking); |
|
1352 #endif |
|
1353 if (!PyArg_ParseTuple(_args, "hO&", |
|
1354 &inMessage, |
|
1355 DragObj_Convert, &inDrag)) |
|
1356 return NULL; |
|
1357 _err = HandleControlDragTracking(_self->ob_itself, |
|
1358 inMessage, |
|
1359 inDrag, |
|
1360 &outLikesDrag); |
|
1361 if (_err != noErr) return PyMac_Error(_err); |
|
1362 _res = Py_BuildValue("b", |
|
1363 outLikesDrag); |
|
1364 return _res; |
|
1365 } |
|
1366 |
|
1367 static PyObject *CtlObj_HandleControlDragReceive(ControlObject *_self, PyObject *_args) |
|
1368 { |
|
1369 PyObject *_res = NULL; |
|
1370 OSStatus _err; |
|
1371 DragReference inDrag; |
|
1372 #ifndef HandleControlDragReceive |
|
1373 PyMac_PRECHECK(HandleControlDragReceive); |
|
1374 #endif |
|
1375 if (!PyArg_ParseTuple(_args, "O&", |
|
1376 DragObj_Convert, &inDrag)) |
|
1377 return NULL; |
|
1378 _err = HandleControlDragReceive(_self->ob_itself, |
|
1379 inDrag); |
|
1380 if (_err != noErr) return PyMac_Error(_err); |
|
1381 Py_INCREF(Py_None); |
|
1382 _res = Py_None; |
|
1383 return _res; |
|
1384 } |
|
1385 |
|
1386 static PyObject *CtlObj_SetControlDragTrackingEnabled(ControlObject *_self, PyObject *_args) |
|
1387 { |
|
1388 PyObject *_res = NULL; |
|
1389 OSStatus _err; |
|
1390 Boolean inTracks; |
|
1391 #ifndef SetControlDragTrackingEnabled |
|
1392 PyMac_PRECHECK(SetControlDragTrackingEnabled); |
|
1393 #endif |
|
1394 if (!PyArg_ParseTuple(_args, "b", |
|
1395 &inTracks)) |
|
1396 return NULL; |
|
1397 _err = SetControlDragTrackingEnabled(_self->ob_itself, |
|
1398 inTracks); |
|
1399 if (_err != noErr) return PyMac_Error(_err); |
|
1400 Py_INCREF(Py_None); |
|
1401 _res = Py_None; |
|
1402 return _res; |
|
1403 } |
|
1404 |
|
1405 static PyObject *CtlObj_IsControlDragTrackingEnabled(ControlObject *_self, PyObject *_args) |
|
1406 { |
|
1407 PyObject *_res = NULL; |
|
1408 OSStatus _err; |
|
1409 Boolean outTracks; |
|
1410 #ifndef IsControlDragTrackingEnabled |
|
1411 PyMac_PRECHECK(IsControlDragTrackingEnabled); |
|
1412 #endif |
|
1413 if (!PyArg_ParseTuple(_args, "")) |
|
1414 return NULL; |
|
1415 _err = IsControlDragTrackingEnabled(_self->ob_itself, |
|
1416 &outTracks); |
|
1417 if (_err != noErr) return PyMac_Error(_err); |
|
1418 _res = Py_BuildValue("b", |
|
1419 outTracks); |
|
1420 return _res; |
|
1421 } |
|
1422 |
|
1423 static PyObject *CtlObj_GetControlBounds(ControlObject *_self, PyObject *_args) |
|
1424 { |
|
1425 PyObject *_res = NULL; |
|
1426 Rect bounds; |
|
1427 #ifndef GetControlBounds |
|
1428 PyMac_PRECHECK(GetControlBounds); |
|
1429 #endif |
|
1430 if (!PyArg_ParseTuple(_args, "")) |
|
1431 return NULL; |
|
1432 GetControlBounds(_self->ob_itself, |
|
1433 &bounds); |
|
1434 _res = Py_BuildValue("O&", |
|
1435 PyMac_BuildRect, &bounds); |
|
1436 return _res; |
|
1437 } |
|
1438 |
|
1439 static PyObject *CtlObj_IsControlHilited(ControlObject *_self, PyObject *_args) |
|
1440 { |
|
1441 PyObject *_res = NULL; |
|
1442 Boolean _rv; |
|
1443 #ifndef IsControlHilited |
|
1444 PyMac_PRECHECK(IsControlHilited); |
|
1445 #endif |
|
1446 if (!PyArg_ParseTuple(_args, "")) |
|
1447 return NULL; |
|
1448 _rv = IsControlHilited(_self->ob_itself); |
|
1449 _res = Py_BuildValue("b", |
|
1450 _rv); |
|
1451 return _res; |
|
1452 } |
|
1453 |
|
1454 static PyObject *CtlObj_GetControlHilite(ControlObject *_self, PyObject *_args) |
|
1455 { |
|
1456 PyObject *_res = NULL; |
|
1457 UInt16 _rv; |
|
1458 #ifndef GetControlHilite |
|
1459 PyMac_PRECHECK(GetControlHilite); |
|
1460 #endif |
|
1461 if (!PyArg_ParseTuple(_args, "")) |
|
1462 return NULL; |
|
1463 _rv = GetControlHilite(_self->ob_itself); |
|
1464 _res = Py_BuildValue("H", |
|
1465 _rv); |
|
1466 return _res; |
|
1467 } |
|
1468 |
|
1469 static PyObject *CtlObj_GetControlOwner(ControlObject *_self, PyObject *_args) |
|
1470 { |
|
1471 PyObject *_res = NULL; |
|
1472 WindowPtr _rv; |
|
1473 #ifndef GetControlOwner |
|
1474 PyMac_PRECHECK(GetControlOwner); |
|
1475 #endif |
|
1476 if (!PyArg_ParseTuple(_args, "")) |
|
1477 return NULL; |
|
1478 _rv = GetControlOwner(_self->ob_itself); |
|
1479 _res = Py_BuildValue("O&", |
|
1480 WinObj_New, _rv); |
|
1481 return _res; |
|
1482 } |
|
1483 |
|
1484 static PyObject *CtlObj_GetControlDataHandle(ControlObject *_self, PyObject *_args) |
|
1485 { |
|
1486 PyObject *_res = NULL; |
|
1487 Handle _rv; |
|
1488 #ifndef GetControlDataHandle |
|
1489 PyMac_PRECHECK(GetControlDataHandle); |
|
1490 #endif |
|
1491 if (!PyArg_ParseTuple(_args, "")) |
|
1492 return NULL; |
|
1493 _rv = GetControlDataHandle(_self->ob_itself); |
|
1494 _res = Py_BuildValue("O&", |
|
1495 ResObj_New, _rv); |
|
1496 return _res; |
|
1497 } |
|
1498 |
|
1499 static PyObject *CtlObj_GetControlPopupMenuHandle(ControlObject *_self, PyObject *_args) |
|
1500 { |
|
1501 PyObject *_res = NULL; |
|
1502 MenuHandle _rv; |
|
1503 #ifndef GetControlPopupMenuHandle |
|
1504 PyMac_PRECHECK(GetControlPopupMenuHandle); |
|
1505 #endif |
|
1506 if (!PyArg_ParseTuple(_args, "")) |
|
1507 return NULL; |
|
1508 _rv = GetControlPopupMenuHandle(_self->ob_itself); |
|
1509 _res = Py_BuildValue("O&", |
|
1510 MenuObj_New, _rv); |
|
1511 return _res; |
|
1512 } |
|
1513 |
|
1514 static PyObject *CtlObj_GetControlPopupMenuID(ControlObject *_self, PyObject *_args) |
|
1515 { |
|
1516 PyObject *_res = NULL; |
|
1517 short _rv; |
|
1518 #ifndef GetControlPopupMenuID |
|
1519 PyMac_PRECHECK(GetControlPopupMenuID); |
|
1520 #endif |
|
1521 if (!PyArg_ParseTuple(_args, "")) |
|
1522 return NULL; |
|
1523 _rv = GetControlPopupMenuID(_self->ob_itself); |
|
1524 _res = Py_BuildValue("h", |
|
1525 _rv); |
|
1526 return _res; |
|
1527 } |
|
1528 |
|
1529 static PyObject *CtlObj_SetControlDataHandle(ControlObject *_self, PyObject *_args) |
|
1530 { |
|
1531 PyObject *_res = NULL; |
|
1532 Handle dataHandle; |
|
1533 #ifndef SetControlDataHandle |
|
1534 PyMac_PRECHECK(SetControlDataHandle); |
|
1535 #endif |
|
1536 if (!PyArg_ParseTuple(_args, "O&", |
|
1537 ResObj_Convert, &dataHandle)) |
|
1538 return NULL; |
|
1539 SetControlDataHandle(_self->ob_itself, |
|
1540 dataHandle); |
|
1541 Py_INCREF(Py_None); |
|
1542 _res = Py_None; |
|
1543 return _res; |
|
1544 } |
|
1545 |
|
1546 static PyObject *CtlObj_SetControlBounds(ControlObject *_self, PyObject *_args) |
|
1547 { |
|
1548 PyObject *_res = NULL; |
|
1549 Rect bounds; |
|
1550 #ifndef SetControlBounds |
|
1551 PyMac_PRECHECK(SetControlBounds); |
|
1552 #endif |
|
1553 if (!PyArg_ParseTuple(_args, "O&", |
|
1554 PyMac_GetRect, &bounds)) |
|
1555 return NULL; |
|
1556 SetControlBounds(_self->ob_itself, |
|
1557 &bounds); |
|
1558 Py_INCREF(Py_None); |
|
1559 _res = Py_None; |
|
1560 return _res; |
|
1561 } |
|
1562 |
|
1563 static PyObject *CtlObj_SetControlPopupMenuHandle(ControlObject *_self, PyObject *_args) |
|
1564 { |
|
1565 PyObject *_res = NULL; |
|
1566 MenuHandle popupMenu; |
|
1567 #ifndef SetControlPopupMenuHandle |
|
1568 PyMac_PRECHECK(SetControlPopupMenuHandle); |
|
1569 #endif |
|
1570 if (!PyArg_ParseTuple(_args, "O&", |
|
1571 MenuObj_Convert, &popupMenu)) |
|
1572 return NULL; |
|
1573 SetControlPopupMenuHandle(_self->ob_itself, |
|
1574 popupMenu); |
|
1575 Py_INCREF(Py_None); |
|
1576 _res = Py_None; |
|
1577 return _res; |
|
1578 } |
|
1579 |
|
1580 static PyObject *CtlObj_SetControlPopupMenuID(ControlObject *_self, PyObject *_args) |
|
1581 { |
|
1582 PyObject *_res = NULL; |
|
1583 short menuID; |
|
1584 #ifndef SetControlPopupMenuID |
|
1585 PyMac_PRECHECK(SetControlPopupMenuID); |
|
1586 #endif |
|
1587 if (!PyArg_ParseTuple(_args, "h", |
|
1588 &menuID)) |
|
1589 return NULL; |
|
1590 SetControlPopupMenuID(_self->ob_itself, |
|
1591 menuID); |
|
1592 Py_INCREF(Py_None); |
|
1593 _res = Py_None; |
|
1594 return _res; |
|
1595 } |
|
1596 |
|
1597 static PyObject *CtlObj_GetBevelButtonMenuValue(ControlObject *_self, PyObject *_args) |
|
1598 { |
|
1599 PyObject *_res = NULL; |
|
1600 OSErr _err; |
|
1601 SInt16 outValue; |
|
1602 #ifndef GetBevelButtonMenuValue |
|
1603 PyMac_PRECHECK(GetBevelButtonMenuValue); |
|
1604 #endif |
|
1605 if (!PyArg_ParseTuple(_args, "")) |
|
1606 return NULL; |
|
1607 _err = GetBevelButtonMenuValue(_self->ob_itself, |
|
1608 &outValue); |
|
1609 if (_err != noErr) return PyMac_Error(_err); |
|
1610 _res = Py_BuildValue("h", |
|
1611 outValue); |
|
1612 return _res; |
|
1613 } |
|
1614 |
|
1615 static PyObject *CtlObj_SetBevelButtonMenuValue(ControlObject *_self, PyObject *_args) |
|
1616 { |
|
1617 PyObject *_res = NULL; |
|
1618 OSErr _err; |
|
1619 SInt16 inValue; |
|
1620 #ifndef SetBevelButtonMenuValue |
|
1621 PyMac_PRECHECK(SetBevelButtonMenuValue); |
|
1622 #endif |
|
1623 if (!PyArg_ParseTuple(_args, "h", |
|
1624 &inValue)) |
|
1625 return NULL; |
|
1626 _err = SetBevelButtonMenuValue(_self->ob_itself, |
|
1627 inValue); |
|
1628 if (_err != noErr) return PyMac_Error(_err); |
|
1629 Py_INCREF(Py_None); |
|
1630 _res = Py_None; |
|
1631 return _res; |
|
1632 } |
|
1633 |
|
1634 static PyObject *CtlObj_GetBevelButtonMenuHandle(ControlObject *_self, PyObject *_args) |
|
1635 { |
|
1636 PyObject *_res = NULL; |
|
1637 OSErr _err; |
|
1638 MenuHandle outHandle; |
|
1639 #ifndef GetBevelButtonMenuHandle |
|
1640 PyMac_PRECHECK(GetBevelButtonMenuHandle); |
|
1641 #endif |
|
1642 if (!PyArg_ParseTuple(_args, "")) |
|
1643 return NULL; |
|
1644 _err = GetBevelButtonMenuHandle(_self->ob_itself, |
|
1645 &outHandle); |
|
1646 if (_err != noErr) return PyMac_Error(_err); |
|
1647 _res = Py_BuildValue("O&", |
|
1648 MenuObj_New, outHandle); |
|
1649 return _res; |
|
1650 } |
|
1651 |
|
1652 static PyObject *CtlObj_SetBevelButtonContentInfo(ControlObject *_self, PyObject *_args) |
|
1653 { |
|
1654 PyObject *_res = NULL; |
|
1655 OSErr _err; |
|
1656 ControlButtonContentInfo inContent; |
|
1657 #ifndef SetBevelButtonContentInfo |
|
1658 PyMac_PRECHECK(SetBevelButtonContentInfo); |
|
1659 #endif |
|
1660 if (!PyArg_ParseTuple(_args, "O&", |
|
1661 ControlButtonContentInfo_Convert, &inContent)) |
|
1662 return NULL; |
|
1663 _err = SetBevelButtonContentInfo(_self->ob_itself, |
|
1664 &inContent); |
|
1665 if (_err != noErr) return PyMac_Error(_err); |
|
1666 Py_INCREF(Py_None); |
|
1667 _res = Py_None; |
|
1668 return _res; |
|
1669 } |
|
1670 |
|
1671 static PyObject *CtlObj_SetBevelButtonTransform(ControlObject *_self, PyObject *_args) |
|
1672 { |
|
1673 PyObject *_res = NULL; |
|
1674 OSErr _err; |
|
1675 IconTransformType transform; |
|
1676 #ifndef SetBevelButtonTransform |
|
1677 PyMac_PRECHECK(SetBevelButtonTransform); |
|
1678 #endif |
|
1679 if (!PyArg_ParseTuple(_args, "h", |
|
1680 &transform)) |
|
1681 return NULL; |
|
1682 _err = SetBevelButtonTransform(_self->ob_itself, |
|
1683 transform); |
|
1684 if (_err != noErr) return PyMac_Error(_err); |
|
1685 Py_INCREF(Py_None); |
|
1686 _res = Py_None; |
|
1687 return _res; |
|
1688 } |
|
1689 |
|
1690 static PyObject *CtlObj_SetDisclosureTriangleLastValue(ControlObject *_self, PyObject *_args) |
|
1691 { |
|
1692 PyObject *_res = NULL; |
|
1693 OSErr _err; |
|
1694 SInt16 inValue; |
|
1695 #ifndef SetDisclosureTriangleLastValue |
|
1696 PyMac_PRECHECK(SetDisclosureTriangleLastValue); |
|
1697 #endif |
|
1698 if (!PyArg_ParseTuple(_args, "h", |
|
1699 &inValue)) |
|
1700 return NULL; |
|
1701 _err = SetDisclosureTriangleLastValue(_self->ob_itself, |
|
1702 inValue); |
|
1703 if (_err != noErr) return PyMac_Error(_err); |
|
1704 Py_INCREF(Py_None); |
|
1705 _res = Py_None; |
|
1706 return _res; |
|
1707 } |
|
1708 |
|
1709 static PyObject *CtlObj_GetTabContentRect(ControlObject *_self, PyObject *_args) |
|
1710 { |
|
1711 PyObject *_res = NULL; |
|
1712 OSErr _err; |
|
1713 Rect outContentRect; |
|
1714 #ifndef GetTabContentRect |
|
1715 PyMac_PRECHECK(GetTabContentRect); |
|
1716 #endif |
|
1717 if (!PyArg_ParseTuple(_args, "")) |
|
1718 return NULL; |
|
1719 _err = GetTabContentRect(_self->ob_itself, |
|
1720 &outContentRect); |
|
1721 if (_err != noErr) return PyMac_Error(_err); |
|
1722 _res = Py_BuildValue("O&", |
|
1723 PyMac_BuildRect, &outContentRect); |
|
1724 return _res; |
|
1725 } |
|
1726 |
|
1727 static PyObject *CtlObj_SetTabEnabled(ControlObject *_self, PyObject *_args) |
|
1728 { |
|
1729 PyObject *_res = NULL; |
|
1730 OSErr _err; |
|
1731 SInt16 inTabToHilite; |
|
1732 Boolean inEnabled; |
|
1733 #ifndef SetTabEnabled |
|
1734 PyMac_PRECHECK(SetTabEnabled); |
|
1735 #endif |
|
1736 if (!PyArg_ParseTuple(_args, "hb", |
|
1737 &inTabToHilite, |
|
1738 &inEnabled)) |
|
1739 return NULL; |
|
1740 _err = SetTabEnabled(_self->ob_itself, |
|
1741 inTabToHilite, |
|
1742 inEnabled); |
|
1743 if (_err != noErr) return PyMac_Error(_err); |
|
1744 Py_INCREF(Py_None); |
|
1745 _res = Py_None; |
|
1746 return _res; |
|
1747 } |
|
1748 |
|
1749 static PyObject *CtlObj_SetImageWellContentInfo(ControlObject *_self, PyObject *_args) |
|
1750 { |
|
1751 PyObject *_res = NULL; |
|
1752 OSErr _err; |
|
1753 ControlButtonContentInfo inContent; |
|
1754 #ifndef SetImageWellContentInfo |
|
1755 PyMac_PRECHECK(SetImageWellContentInfo); |
|
1756 #endif |
|
1757 if (!PyArg_ParseTuple(_args, "O&", |
|
1758 ControlButtonContentInfo_Convert, &inContent)) |
|
1759 return NULL; |
|
1760 _err = SetImageWellContentInfo(_self->ob_itself, |
|
1761 &inContent); |
|
1762 if (_err != noErr) return PyMac_Error(_err); |
|
1763 Py_INCREF(Py_None); |
|
1764 _res = Py_None; |
|
1765 return _res; |
|
1766 } |
|
1767 |
|
1768 static PyObject *CtlObj_SetImageWellTransform(ControlObject *_self, PyObject *_args) |
|
1769 { |
|
1770 PyObject *_res = NULL; |
|
1771 OSErr _err; |
|
1772 IconTransformType inTransform; |
|
1773 #ifndef SetImageWellTransform |
|
1774 PyMac_PRECHECK(SetImageWellTransform); |
|
1775 #endif |
|
1776 if (!PyArg_ParseTuple(_args, "h", |
|
1777 &inTransform)) |
|
1778 return NULL; |
|
1779 _err = SetImageWellTransform(_self->ob_itself, |
|
1780 inTransform); |
|
1781 if (_err != noErr) return PyMac_Error(_err); |
|
1782 Py_INCREF(Py_None); |
|
1783 _res = Py_None; |
|
1784 return _res; |
|
1785 } |
|
1786 |
|
1787 static PyObject *CtlObj_GetDataBrowserViewStyle(ControlObject *_self, PyObject *_args) |
|
1788 { |
|
1789 PyObject *_res = NULL; |
|
1790 OSStatus _err; |
|
1791 OSType style; |
|
1792 #ifndef GetDataBrowserViewStyle |
|
1793 PyMac_PRECHECK(GetDataBrowserViewStyle); |
|
1794 #endif |
|
1795 if (!PyArg_ParseTuple(_args, "")) |
|
1796 return NULL; |
|
1797 _err = GetDataBrowserViewStyle(_self->ob_itself, |
|
1798 &style); |
|
1799 if (_err != noErr) return PyMac_Error(_err); |
|
1800 _res = Py_BuildValue("O&", |
|
1801 PyMac_BuildOSType, style); |
|
1802 return _res; |
|
1803 } |
|
1804 |
|
1805 static PyObject *CtlObj_SetDataBrowserViewStyle(ControlObject *_self, PyObject *_args) |
|
1806 { |
|
1807 PyObject *_res = NULL; |
|
1808 OSStatus _err; |
|
1809 OSType style; |
|
1810 #ifndef SetDataBrowserViewStyle |
|
1811 PyMac_PRECHECK(SetDataBrowserViewStyle); |
|
1812 #endif |
|
1813 if (!PyArg_ParseTuple(_args, "O&", |
|
1814 PyMac_GetOSType, &style)) |
|
1815 return NULL; |
|
1816 _err = SetDataBrowserViewStyle(_self->ob_itself, |
|
1817 style); |
|
1818 if (_err != noErr) return PyMac_Error(_err); |
|
1819 Py_INCREF(Py_None); |
|
1820 _res = Py_None; |
|
1821 return _res; |
|
1822 } |
|
1823 |
|
1824 static PyObject *CtlObj_EnableDataBrowserEditCommand(ControlObject *_self, PyObject *_args) |
|
1825 { |
|
1826 PyObject *_res = NULL; |
|
1827 Boolean _rv; |
|
1828 UInt32 command; |
|
1829 #ifndef EnableDataBrowserEditCommand |
|
1830 PyMac_PRECHECK(EnableDataBrowserEditCommand); |
|
1831 #endif |
|
1832 if (!PyArg_ParseTuple(_args, "l", |
|
1833 &command)) |
|
1834 return NULL; |
|
1835 _rv = EnableDataBrowserEditCommand(_self->ob_itself, |
|
1836 command); |
|
1837 _res = Py_BuildValue("b", |
|
1838 _rv); |
|
1839 return _res; |
|
1840 } |
|
1841 |
|
1842 static PyObject *CtlObj_ExecuteDataBrowserEditCommand(ControlObject *_self, PyObject *_args) |
|
1843 { |
|
1844 PyObject *_res = NULL; |
|
1845 OSStatus _err; |
|
1846 UInt32 command; |
|
1847 #ifndef ExecuteDataBrowserEditCommand |
|
1848 PyMac_PRECHECK(ExecuteDataBrowserEditCommand); |
|
1849 #endif |
|
1850 if (!PyArg_ParseTuple(_args, "l", |
|
1851 &command)) |
|
1852 return NULL; |
|
1853 _err = ExecuteDataBrowserEditCommand(_self->ob_itself, |
|
1854 command); |
|
1855 if (_err != noErr) return PyMac_Error(_err); |
|
1856 Py_INCREF(Py_None); |
|
1857 _res = Py_None; |
|
1858 return _res; |
|
1859 } |
|
1860 |
|
1861 static PyObject *CtlObj_GetDataBrowserSelectionAnchor(ControlObject *_self, PyObject *_args) |
|
1862 { |
|
1863 PyObject *_res = NULL; |
|
1864 OSStatus _err; |
|
1865 UInt32 first; |
|
1866 UInt32 last; |
|
1867 #ifndef GetDataBrowserSelectionAnchor |
|
1868 PyMac_PRECHECK(GetDataBrowserSelectionAnchor); |
|
1869 #endif |
|
1870 if (!PyArg_ParseTuple(_args, "")) |
|
1871 return NULL; |
|
1872 _err = GetDataBrowserSelectionAnchor(_self->ob_itself, |
|
1873 &first, |
|
1874 &last); |
|
1875 if (_err != noErr) return PyMac_Error(_err); |
|
1876 _res = Py_BuildValue("ll", |
|
1877 first, |
|
1878 last); |
|
1879 return _res; |
|
1880 } |
|
1881 |
|
1882 static PyObject *CtlObj_MoveDataBrowserSelectionAnchor(ControlObject *_self, PyObject *_args) |
|
1883 { |
|
1884 PyObject *_res = NULL; |
|
1885 OSStatus _err; |
|
1886 UInt32 direction; |
|
1887 Boolean extendSelection; |
|
1888 #ifndef MoveDataBrowserSelectionAnchor |
|
1889 PyMac_PRECHECK(MoveDataBrowserSelectionAnchor); |
|
1890 #endif |
|
1891 if (!PyArg_ParseTuple(_args, "lb", |
|
1892 &direction, |
|
1893 &extendSelection)) |
|
1894 return NULL; |
|
1895 _err = MoveDataBrowserSelectionAnchor(_self->ob_itself, |
|
1896 direction, |
|
1897 extendSelection); |
|
1898 if (_err != noErr) return PyMac_Error(_err); |
|
1899 Py_INCREF(Py_None); |
|
1900 _res = Py_None; |
|
1901 return _res; |
|
1902 } |
|
1903 |
|
1904 static PyObject *CtlObj_OpenDataBrowserContainer(ControlObject *_self, PyObject *_args) |
|
1905 { |
|
1906 PyObject *_res = NULL; |
|
1907 OSStatus _err; |
|
1908 UInt32 container; |
|
1909 #ifndef OpenDataBrowserContainer |
|
1910 PyMac_PRECHECK(OpenDataBrowserContainer); |
|
1911 #endif |
|
1912 if (!PyArg_ParseTuple(_args, "l", |
|
1913 &container)) |
|
1914 return NULL; |
|
1915 _err = OpenDataBrowserContainer(_self->ob_itself, |
|
1916 container); |
|
1917 if (_err != noErr) return PyMac_Error(_err); |
|
1918 Py_INCREF(Py_None); |
|
1919 _res = Py_None; |
|
1920 return _res; |
|
1921 } |
|
1922 |
|
1923 static PyObject *CtlObj_CloseDataBrowserContainer(ControlObject *_self, PyObject *_args) |
|
1924 { |
|
1925 PyObject *_res = NULL; |
|
1926 OSStatus _err; |
|
1927 UInt32 container; |
|
1928 #ifndef CloseDataBrowserContainer |
|
1929 PyMac_PRECHECK(CloseDataBrowserContainer); |
|
1930 #endif |
|
1931 if (!PyArg_ParseTuple(_args, "l", |
|
1932 &container)) |
|
1933 return NULL; |
|
1934 _err = CloseDataBrowserContainer(_self->ob_itself, |
|
1935 container); |
|
1936 if (_err != noErr) return PyMac_Error(_err); |
|
1937 Py_INCREF(Py_None); |
|
1938 _res = Py_None; |
|
1939 return _res; |
|
1940 } |
|
1941 |
|
1942 static PyObject *CtlObj_SortDataBrowserContainer(ControlObject *_self, PyObject *_args) |
|
1943 { |
|
1944 PyObject *_res = NULL; |
|
1945 OSStatus _err; |
|
1946 UInt32 container; |
|
1947 Boolean sortChildren; |
|
1948 #ifndef SortDataBrowserContainer |
|
1949 PyMac_PRECHECK(SortDataBrowserContainer); |
|
1950 #endif |
|
1951 if (!PyArg_ParseTuple(_args, "lb", |
|
1952 &container, |
|
1953 &sortChildren)) |
|
1954 return NULL; |
|
1955 _err = SortDataBrowserContainer(_self->ob_itself, |
|
1956 container, |
|
1957 sortChildren); |
|
1958 if (_err != noErr) return PyMac_Error(_err); |
|
1959 Py_INCREF(Py_None); |
|
1960 _res = Py_None; |
|
1961 return _res; |
|
1962 } |
|
1963 |
|
1964 static PyObject *CtlObj_GetDataBrowserItems(ControlObject *_self, PyObject *_args) |
|
1965 { |
|
1966 PyObject *_res = NULL; |
|
1967 OSStatus _err; |
|
1968 UInt32 container; |
|
1969 Boolean recurse; |
|
1970 UInt32 state; |
|
1971 Handle items; |
|
1972 #ifndef GetDataBrowserItems |
|
1973 PyMac_PRECHECK(GetDataBrowserItems); |
|
1974 #endif |
|
1975 if (!PyArg_ParseTuple(_args, "lblO&", |
|
1976 &container, |
|
1977 &recurse, |
|
1978 &state, |
|
1979 ResObj_Convert, &items)) |
|
1980 return NULL; |
|
1981 _err = GetDataBrowserItems(_self->ob_itself, |
|
1982 container, |
|
1983 recurse, |
|
1984 state, |
|
1985 items); |
|
1986 if (_err != noErr) return PyMac_Error(_err); |
|
1987 Py_INCREF(Py_None); |
|
1988 _res = Py_None; |
|
1989 return _res; |
|
1990 } |
|
1991 |
|
1992 static PyObject *CtlObj_GetDataBrowserItemCount(ControlObject *_self, PyObject *_args) |
|
1993 { |
|
1994 PyObject *_res = NULL; |
|
1995 OSStatus _err; |
|
1996 UInt32 container; |
|
1997 Boolean recurse; |
|
1998 UInt32 state; |
|
1999 UInt32 numItems; |
|
2000 #ifndef GetDataBrowserItemCount |
|
2001 PyMac_PRECHECK(GetDataBrowserItemCount); |
|
2002 #endif |
|
2003 if (!PyArg_ParseTuple(_args, "lbl", |
|
2004 &container, |
|
2005 &recurse, |
|
2006 &state)) |
|
2007 return NULL; |
|
2008 _err = GetDataBrowserItemCount(_self->ob_itself, |
|
2009 container, |
|
2010 recurse, |
|
2011 state, |
|
2012 &numItems); |
|
2013 if (_err != noErr) return PyMac_Error(_err); |
|
2014 _res = Py_BuildValue("l", |
|
2015 numItems); |
|
2016 return _res; |
|
2017 } |
|
2018 |
|
2019 static PyObject *CtlObj_IsDataBrowserItemSelected(ControlObject *_self, PyObject *_args) |
|
2020 { |
|
2021 PyObject *_res = NULL; |
|
2022 Boolean _rv; |
|
2023 UInt32 item; |
|
2024 #ifndef IsDataBrowserItemSelected |
|
2025 PyMac_PRECHECK(IsDataBrowserItemSelected); |
|
2026 #endif |
|
2027 if (!PyArg_ParseTuple(_args, "l", |
|
2028 &item)) |
|
2029 return NULL; |
|
2030 _rv = IsDataBrowserItemSelected(_self->ob_itself, |
|
2031 item); |
|
2032 _res = Py_BuildValue("b", |
|
2033 _rv); |
|
2034 return _res; |
|
2035 } |
|
2036 |
|
2037 static PyObject *CtlObj_GetDataBrowserItemState(ControlObject *_self, PyObject *_args) |
|
2038 { |
|
2039 PyObject *_res = NULL; |
|
2040 OSStatus _err; |
|
2041 UInt32 item; |
|
2042 UInt32 state; |
|
2043 #ifndef GetDataBrowserItemState |
|
2044 PyMac_PRECHECK(GetDataBrowserItemState); |
|
2045 #endif |
|
2046 if (!PyArg_ParseTuple(_args, "l", |
|
2047 &item)) |
|
2048 return NULL; |
|
2049 _err = GetDataBrowserItemState(_self->ob_itself, |
|
2050 item, |
|
2051 &state); |
|
2052 if (_err != noErr) return PyMac_Error(_err); |
|
2053 _res = Py_BuildValue("l", |
|
2054 state); |
|
2055 return _res; |
|
2056 } |
|
2057 |
|
2058 static PyObject *CtlObj_RevealDataBrowserItem(ControlObject *_self, PyObject *_args) |
|
2059 { |
|
2060 PyObject *_res = NULL; |
|
2061 OSStatus _err; |
|
2062 UInt32 item; |
|
2063 UInt32 propertyID; |
|
2064 UInt8 options; |
|
2065 #ifndef RevealDataBrowserItem |
|
2066 PyMac_PRECHECK(RevealDataBrowserItem); |
|
2067 #endif |
|
2068 if (!PyArg_ParseTuple(_args, "llb", |
|
2069 &item, |
|
2070 &propertyID, |
|
2071 &options)) |
|
2072 return NULL; |
|
2073 _err = RevealDataBrowserItem(_self->ob_itself, |
|
2074 item, |
|
2075 propertyID, |
|
2076 options); |
|
2077 if (_err != noErr) return PyMac_Error(_err); |
|
2078 Py_INCREF(Py_None); |
|
2079 _res = Py_None; |
|
2080 return _res; |
|
2081 } |
|
2082 |
|
2083 static PyObject *CtlObj_SetDataBrowserActiveItems(ControlObject *_self, PyObject *_args) |
|
2084 { |
|
2085 PyObject *_res = NULL; |
|
2086 OSStatus _err; |
|
2087 Boolean active; |
|
2088 #ifndef SetDataBrowserActiveItems |
|
2089 PyMac_PRECHECK(SetDataBrowserActiveItems); |
|
2090 #endif |
|
2091 if (!PyArg_ParseTuple(_args, "b", |
|
2092 &active)) |
|
2093 return NULL; |
|
2094 _err = SetDataBrowserActiveItems(_self->ob_itself, |
|
2095 active); |
|
2096 if (_err != noErr) return PyMac_Error(_err); |
|
2097 Py_INCREF(Py_None); |
|
2098 _res = Py_None; |
|
2099 return _res; |
|
2100 } |
|
2101 |
|
2102 static PyObject *CtlObj_GetDataBrowserActiveItems(ControlObject *_self, PyObject *_args) |
|
2103 { |
|
2104 PyObject *_res = NULL; |
|
2105 OSStatus _err; |
|
2106 Boolean active; |
|
2107 #ifndef GetDataBrowserActiveItems |
|
2108 PyMac_PRECHECK(GetDataBrowserActiveItems); |
|
2109 #endif |
|
2110 if (!PyArg_ParseTuple(_args, "")) |
|
2111 return NULL; |
|
2112 _err = GetDataBrowserActiveItems(_self->ob_itself, |
|
2113 &active); |
|
2114 if (_err != noErr) return PyMac_Error(_err); |
|
2115 _res = Py_BuildValue("b", |
|
2116 active); |
|
2117 return _res; |
|
2118 } |
|
2119 |
|
2120 static PyObject *CtlObj_SetDataBrowserScrollBarInset(ControlObject *_self, PyObject *_args) |
|
2121 { |
|
2122 PyObject *_res = NULL; |
|
2123 OSStatus _err; |
|
2124 Rect insetRect; |
|
2125 #ifndef SetDataBrowserScrollBarInset |
|
2126 PyMac_PRECHECK(SetDataBrowserScrollBarInset); |
|
2127 #endif |
|
2128 if (!PyArg_ParseTuple(_args, "")) |
|
2129 return NULL; |
|
2130 _err = SetDataBrowserScrollBarInset(_self->ob_itself, |
|
2131 &insetRect); |
|
2132 if (_err != noErr) return PyMac_Error(_err); |
|
2133 _res = Py_BuildValue("O&", |
|
2134 PyMac_BuildRect, &insetRect); |
|
2135 return _res; |
|
2136 } |
|
2137 |
|
2138 static PyObject *CtlObj_GetDataBrowserScrollBarInset(ControlObject *_self, PyObject *_args) |
|
2139 { |
|
2140 PyObject *_res = NULL; |
|
2141 OSStatus _err; |
|
2142 Rect insetRect; |
|
2143 #ifndef GetDataBrowserScrollBarInset |
|
2144 PyMac_PRECHECK(GetDataBrowserScrollBarInset); |
|
2145 #endif |
|
2146 if (!PyArg_ParseTuple(_args, "")) |
|
2147 return NULL; |
|
2148 _err = GetDataBrowserScrollBarInset(_self->ob_itself, |
|
2149 &insetRect); |
|
2150 if (_err != noErr) return PyMac_Error(_err); |
|
2151 _res = Py_BuildValue("O&", |
|
2152 PyMac_BuildRect, &insetRect); |
|
2153 return _res; |
|
2154 } |
|
2155 |
|
2156 static PyObject *CtlObj_SetDataBrowserTarget(ControlObject *_self, PyObject *_args) |
|
2157 { |
|
2158 PyObject *_res = NULL; |
|
2159 OSStatus _err; |
|
2160 UInt32 target; |
|
2161 #ifndef SetDataBrowserTarget |
|
2162 PyMac_PRECHECK(SetDataBrowserTarget); |
|
2163 #endif |
|
2164 if (!PyArg_ParseTuple(_args, "l", |
|
2165 &target)) |
|
2166 return NULL; |
|
2167 _err = SetDataBrowserTarget(_self->ob_itself, |
|
2168 target); |
|
2169 if (_err != noErr) return PyMac_Error(_err); |
|
2170 Py_INCREF(Py_None); |
|
2171 _res = Py_None; |
|
2172 return _res; |
|
2173 } |
|
2174 |
|
2175 static PyObject *CtlObj_GetDataBrowserTarget(ControlObject *_self, PyObject *_args) |
|
2176 { |
|
2177 PyObject *_res = NULL; |
|
2178 OSStatus _err; |
|
2179 UInt32 target; |
|
2180 #ifndef GetDataBrowserTarget |
|
2181 PyMac_PRECHECK(GetDataBrowserTarget); |
|
2182 #endif |
|
2183 if (!PyArg_ParseTuple(_args, "")) |
|
2184 return NULL; |
|
2185 _err = GetDataBrowserTarget(_self->ob_itself, |
|
2186 &target); |
|
2187 if (_err != noErr) return PyMac_Error(_err); |
|
2188 _res = Py_BuildValue("l", |
|
2189 target); |
|
2190 return _res; |
|
2191 } |
|
2192 |
|
2193 static PyObject *CtlObj_SetDataBrowserSortOrder(ControlObject *_self, PyObject *_args) |
|
2194 { |
|
2195 PyObject *_res = NULL; |
|
2196 OSStatus _err; |
|
2197 UInt16 order; |
|
2198 #ifndef SetDataBrowserSortOrder |
|
2199 PyMac_PRECHECK(SetDataBrowserSortOrder); |
|
2200 #endif |
|
2201 if (!PyArg_ParseTuple(_args, "H", |
|
2202 &order)) |
|
2203 return NULL; |
|
2204 _err = SetDataBrowserSortOrder(_self->ob_itself, |
|
2205 order); |
|
2206 if (_err != noErr) return PyMac_Error(_err); |
|
2207 Py_INCREF(Py_None); |
|
2208 _res = Py_None; |
|
2209 return _res; |
|
2210 } |
|
2211 |
|
2212 static PyObject *CtlObj_GetDataBrowserSortOrder(ControlObject *_self, PyObject *_args) |
|
2213 { |
|
2214 PyObject *_res = NULL; |
|
2215 OSStatus _err; |
|
2216 UInt16 order; |
|
2217 #ifndef GetDataBrowserSortOrder |
|
2218 PyMac_PRECHECK(GetDataBrowserSortOrder); |
|
2219 #endif |
|
2220 if (!PyArg_ParseTuple(_args, "")) |
|
2221 return NULL; |
|
2222 _err = GetDataBrowserSortOrder(_self->ob_itself, |
|
2223 &order); |
|
2224 if (_err != noErr) return PyMac_Error(_err); |
|
2225 _res = Py_BuildValue("H", |
|
2226 order); |
|
2227 return _res; |
|
2228 } |
|
2229 |
|
2230 static PyObject *CtlObj_SetDataBrowserScrollPosition(ControlObject *_self, PyObject *_args) |
|
2231 { |
|
2232 PyObject *_res = NULL; |
|
2233 OSStatus _err; |
|
2234 UInt32 top; |
|
2235 UInt32 left; |
|
2236 #ifndef SetDataBrowserScrollPosition |
|
2237 PyMac_PRECHECK(SetDataBrowserScrollPosition); |
|
2238 #endif |
|
2239 if (!PyArg_ParseTuple(_args, "ll", |
|
2240 &top, |
|
2241 &left)) |
|
2242 return NULL; |
|
2243 _err = SetDataBrowserScrollPosition(_self->ob_itself, |
|
2244 top, |
|
2245 left); |
|
2246 if (_err != noErr) return PyMac_Error(_err); |
|
2247 Py_INCREF(Py_None); |
|
2248 _res = Py_None; |
|
2249 return _res; |
|
2250 } |
|
2251 |
|
2252 static PyObject *CtlObj_GetDataBrowserScrollPosition(ControlObject *_self, PyObject *_args) |
|
2253 { |
|
2254 PyObject *_res = NULL; |
|
2255 OSStatus _err; |
|
2256 UInt32 top; |
|
2257 UInt32 left; |
|
2258 #ifndef GetDataBrowserScrollPosition |
|
2259 PyMac_PRECHECK(GetDataBrowserScrollPosition); |
|
2260 #endif |
|
2261 if (!PyArg_ParseTuple(_args, "")) |
|
2262 return NULL; |
|
2263 _err = GetDataBrowserScrollPosition(_self->ob_itself, |
|
2264 &top, |
|
2265 &left); |
|
2266 if (_err != noErr) return PyMac_Error(_err); |
|
2267 _res = Py_BuildValue("ll", |
|
2268 top, |
|
2269 left); |
|
2270 return _res; |
|
2271 } |
|
2272 |
|
2273 static PyObject *CtlObj_SetDataBrowserHasScrollBars(ControlObject *_self, PyObject *_args) |
|
2274 { |
|
2275 PyObject *_res = NULL; |
|
2276 OSStatus _err; |
|
2277 Boolean horiz; |
|
2278 Boolean vert; |
|
2279 #ifndef SetDataBrowserHasScrollBars |
|
2280 PyMac_PRECHECK(SetDataBrowserHasScrollBars); |
|
2281 #endif |
|
2282 if (!PyArg_ParseTuple(_args, "bb", |
|
2283 &horiz, |
|
2284 &vert)) |
|
2285 return NULL; |
|
2286 _err = SetDataBrowserHasScrollBars(_self->ob_itself, |
|
2287 horiz, |
|
2288 vert); |
|
2289 if (_err != noErr) return PyMac_Error(_err); |
|
2290 Py_INCREF(Py_None); |
|
2291 _res = Py_None; |
|
2292 return _res; |
|
2293 } |
|
2294 |
|
2295 static PyObject *CtlObj_GetDataBrowserHasScrollBars(ControlObject *_self, PyObject *_args) |
|
2296 { |
|
2297 PyObject *_res = NULL; |
|
2298 OSStatus _err; |
|
2299 Boolean horiz; |
|
2300 Boolean vert; |
|
2301 #ifndef GetDataBrowserHasScrollBars |
|
2302 PyMac_PRECHECK(GetDataBrowserHasScrollBars); |
|
2303 #endif |
|
2304 if (!PyArg_ParseTuple(_args, "")) |
|
2305 return NULL; |
|
2306 _err = GetDataBrowserHasScrollBars(_self->ob_itself, |
|
2307 &horiz, |
|
2308 &vert); |
|
2309 if (_err != noErr) return PyMac_Error(_err); |
|
2310 _res = Py_BuildValue("bb", |
|
2311 horiz, |
|
2312 vert); |
|
2313 return _res; |
|
2314 } |
|
2315 |
|
2316 static PyObject *CtlObj_SetDataBrowserSortProperty(ControlObject *_self, PyObject *_args) |
|
2317 { |
|
2318 PyObject *_res = NULL; |
|
2319 OSStatus _err; |
|
2320 UInt32 property; |
|
2321 #ifndef SetDataBrowserSortProperty |
|
2322 PyMac_PRECHECK(SetDataBrowserSortProperty); |
|
2323 #endif |
|
2324 if (!PyArg_ParseTuple(_args, "l", |
|
2325 &property)) |
|
2326 return NULL; |
|
2327 _err = SetDataBrowserSortProperty(_self->ob_itself, |
|
2328 property); |
|
2329 if (_err != noErr) return PyMac_Error(_err); |
|
2330 Py_INCREF(Py_None); |
|
2331 _res = Py_None; |
|
2332 return _res; |
|
2333 } |
|
2334 |
|
2335 static PyObject *CtlObj_GetDataBrowserSortProperty(ControlObject *_self, PyObject *_args) |
|
2336 { |
|
2337 PyObject *_res = NULL; |
|
2338 OSStatus _err; |
|
2339 UInt32 property; |
|
2340 #ifndef GetDataBrowserSortProperty |
|
2341 PyMac_PRECHECK(GetDataBrowserSortProperty); |
|
2342 #endif |
|
2343 if (!PyArg_ParseTuple(_args, "")) |
|
2344 return NULL; |
|
2345 _err = GetDataBrowserSortProperty(_self->ob_itself, |
|
2346 &property); |
|
2347 if (_err != noErr) return PyMac_Error(_err); |
|
2348 _res = Py_BuildValue("l", |
|
2349 property); |
|
2350 return _res; |
|
2351 } |
|
2352 |
|
2353 static PyObject *CtlObj_SetDataBrowserSelectionFlags(ControlObject *_self, PyObject *_args) |
|
2354 { |
|
2355 PyObject *_res = NULL; |
|
2356 OSStatus _err; |
|
2357 UInt32 selectionFlags; |
|
2358 #ifndef SetDataBrowserSelectionFlags |
|
2359 PyMac_PRECHECK(SetDataBrowserSelectionFlags); |
|
2360 #endif |
|
2361 if (!PyArg_ParseTuple(_args, "l", |
|
2362 &selectionFlags)) |
|
2363 return NULL; |
|
2364 _err = SetDataBrowserSelectionFlags(_self->ob_itself, |
|
2365 selectionFlags); |
|
2366 if (_err != noErr) return PyMac_Error(_err); |
|
2367 Py_INCREF(Py_None); |
|
2368 _res = Py_None; |
|
2369 return _res; |
|
2370 } |
|
2371 |
|
2372 static PyObject *CtlObj_GetDataBrowserSelectionFlags(ControlObject *_self, PyObject *_args) |
|
2373 { |
|
2374 PyObject *_res = NULL; |
|
2375 OSStatus _err; |
|
2376 UInt32 selectionFlags; |
|
2377 #ifndef GetDataBrowserSelectionFlags |
|
2378 PyMac_PRECHECK(GetDataBrowserSelectionFlags); |
|
2379 #endif |
|
2380 if (!PyArg_ParseTuple(_args, "")) |
|
2381 return NULL; |
|
2382 _err = GetDataBrowserSelectionFlags(_self->ob_itself, |
|
2383 &selectionFlags); |
|
2384 if (_err != noErr) return PyMac_Error(_err); |
|
2385 _res = Py_BuildValue("l", |
|
2386 selectionFlags); |
|
2387 return _res; |
|
2388 } |
|
2389 |
|
2390 static PyObject *CtlObj_SetDataBrowserPropertyFlags(ControlObject *_self, PyObject *_args) |
|
2391 { |
|
2392 PyObject *_res = NULL; |
|
2393 OSStatus _err; |
|
2394 UInt32 property; |
|
2395 UInt32 flags; |
|
2396 #ifndef SetDataBrowserPropertyFlags |
|
2397 PyMac_PRECHECK(SetDataBrowserPropertyFlags); |
|
2398 #endif |
|
2399 if (!PyArg_ParseTuple(_args, "ll", |
|
2400 &property, |
|
2401 &flags)) |
|
2402 return NULL; |
|
2403 _err = SetDataBrowserPropertyFlags(_self->ob_itself, |
|
2404 property, |
|
2405 flags); |
|
2406 if (_err != noErr) return PyMac_Error(_err); |
|
2407 Py_INCREF(Py_None); |
|
2408 _res = Py_None; |
|
2409 return _res; |
|
2410 } |
|
2411 |
|
2412 static PyObject *CtlObj_GetDataBrowserPropertyFlags(ControlObject *_self, PyObject *_args) |
|
2413 { |
|
2414 PyObject *_res = NULL; |
|
2415 OSStatus _err; |
|
2416 UInt32 property; |
|
2417 UInt32 flags; |
|
2418 #ifndef GetDataBrowserPropertyFlags |
|
2419 PyMac_PRECHECK(GetDataBrowserPropertyFlags); |
|
2420 #endif |
|
2421 if (!PyArg_ParseTuple(_args, "l", |
|
2422 &property)) |
|
2423 return NULL; |
|
2424 _err = GetDataBrowserPropertyFlags(_self->ob_itself, |
|
2425 property, |
|
2426 &flags); |
|
2427 if (_err != noErr) return PyMac_Error(_err); |
|
2428 _res = Py_BuildValue("l", |
|
2429 flags); |
|
2430 return _res; |
|
2431 } |
|
2432 |
|
2433 static PyObject *CtlObj_SetDataBrowserEditText(ControlObject *_self, PyObject *_args) |
|
2434 { |
|
2435 PyObject *_res = NULL; |
|
2436 OSStatus _err; |
|
2437 CFStringRef text; |
|
2438 #ifndef SetDataBrowserEditText |
|
2439 PyMac_PRECHECK(SetDataBrowserEditText); |
|
2440 #endif |
|
2441 if (!PyArg_ParseTuple(_args, "O&", |
|
2442 CFStringRefObj_Convert, &text)) |
|
2443 return NULL; |
|
2444 _err = SetDataBrowserEditText(_self->ob_itself, |
|
2445 text); |
|
2446 if (_err != noErr) return PyMac_Error(_err); |
|
2447 Py_INCREF(Py_None); |
|
2448 _res = Py_None; |
|
2449 return _res; |
|
2450 } |
|
2451 |
|
2452 static PyObject *CtlObj_CopyDataBrowserEditText(ControlObject *_self, PyObject *_args) |
|
2453 { |
|
2454 PyObject *_res = NULL; |
|
2455 OSStatus _err; |
|
2456 CFStringRef text; |
|
2457 #ifndef CopyDataBrowserEditText |
|
2458 PyMac_PRECHECK(CopyDataBrowserEditText); |
|
2459 #endif |
|
2460 if (!PyArg_ParseTuple(_args, "")) |
|
2461 return NULL; |
|
2462 _err = CopyDataBrowserEditText(_self->ob_itself, |
|
2463 &text); |
|
2464 if (_err != noErr) return PyMac_Error(_err); |
|
2465 _res = Py_BuildValue("O&", |
|
2466 CFStringRefObj_New, text); |
|
2467 return _res; |
|
2468 } |
|
2469 |
|
2470 static PyObject *CtlObj_GetDataBrowserEditText(ControlObject *_self, PyObject *_args) |
|
2471 { |
|
2472 PyObject *_res = NULL; |
|
2473 OSStatus _err; |
|
2474 CFMutableStringRef text; |
|
2475 #ifndef GetDataBrowserEditText |
|
2476 PyMac_PRECHECK(GetDataBrowserEditText); |
|
2477 #endif |
|
2478 if (!PyArg_ParseTuple(_args, "O&", |
|
2479 CFMutableStringRefObj_Convert, &text)) |
|
2480 return NULL; |
|
2481 _err = GetDataBrowserEditText(_self->ob_itself, |
|
2482 text); |
|
2483 if (_err != noErr) return PyMac_Error(_err); |
|
2484 Py_INCREF(Py_None); |
|
2485 _res = Py_None; |
|
2486 return _res; |
|
2487 } |
|
2488 |
|
2489 static PyObject *CtlObj_SetDataBrowserEditItem(ControlObject *_self, PyObject *_args) |
|
2490 { |
|
2491 PyObject *_res = NULL; |
|
2492 OSStatus _err; |
|
2493 UInt32 item; |
|
2494 UInt32 property; |
|
2495 #ifndef SetDataBrowserEditItem |
|
2496 PyMac_PRECHECK(SetDataBrowserEditItem); |
|
2497 #endif |
|
2498 if (!PyArg_ParseTuple(_args, "ll", |
|
2499 &item, |
|
2500 &property)) |
|
2501 return NULL; |
|
2502 _err = SetDataBrowserEditItem(_self->ob_itself, |
|
2503 item, |
|
2504 property); |
|
2505 if (_err != noErr) return PyMac_Error(_err); |
|
2506 Py_INCREF(Py_None); |
|
2507 _res = Py_None; |
|
2508 return _res; |
|
2509 } |
|
2510 |
|
2511 static PyObject *CtlObj_GetDataBrowserEditItem(ControlObject *_self, PyObject *_args) |
|
2512 { |
|
2513 PyObject *_res = NULL; |
|
2514 OSStatus _err; |
|
2515 UInt32 item; |
|
2516 UInt32 property; |
|
2517 #ifndef GetDataBrowserEditItem |
|
2518 PyMac_PRECHECK(GetDataBrowserEditItem); |
|
2519 #endif |
|
2520 if (!PyArg_ParseTuple(_args, "")) |
|
2521 return NULL; |
|
2522 _err = GetDataBrowserEditItem(_self->ob_itself, |
|
2523 &item, |
|
2524 &property); |
|
2525 if (_err != noErr) return PyMac_Error(_err); |
|
2526 _res = Py_BuildValue("ll", |
|
2527 item, |
|
2528 property); |
|
2529 return _res; |
|
2530 } |
|
2531 |
|
2532 static PyObject *CtlObj_GetDataBrowserItemPartBounds(ControlObject *_self, PyObject *_args) |
|
2533 { |
|
2534 PyObject *_res = NULL; |
|
2535 OSStatus _err; |
|
2536 UInt32 item; |
|
2537 UInt32 property; |
|
2538 OSType part; |
|
2539 Rect bounds; |
|
2540 #ifndef GetDataBrowserItemPartBounds |
|
2541 PyMac_PRECHECK(GetDataBrowserItemPartBounds); |
|
2542 #endif |
|
2543 if (!PyArg_ParseTuple(_args, "llO&", |
|
2544 &item, |
|
2545 &property, |
|
2546 PyMac_GetOSType, &part)) |
|
2547 return NULL; |
|
2548 _err = GetDataBrowserItemPartBounds(_self->ob_itself, |
|
2549 item, |
|
2550 property, |
|
2551 part, |
|
2552 &bounds); |
|
2553 if (_err != noErr) return PyMac_Error(_err); |
|
2554 _res = Py_BuildValue("O&", |
|
2555 PyMac_BuildRect, &bounds); |
|
2556 return _res; |
|
2557 } |
|
2558 |
|
2559 static PyObject *CtlObj_RemoveDataBrowserTableViewColumn(ControlObject *_self, PyObject *_args) |
|
2560 { |
|
2561 PyObject *_res = NULL; |
|
2562 OSStatus _err; |
|
2563 UInt32 column; |
|
2564 #ifndef RemoveDataBrowserTableViewColumn |
|
2565 PyMac_PRECHECK(RemoveDataBrowserTableViewColumn); |
|
2566 #endif |
|
2567 if (!PyArg_ParseTuple(_args, "l", |
|
2568 &column)) |
|
2569 return NULL; |
|
2570 _err = RemoveDataBrowserTableViewColumn(_self->ob_itself, |
|
2571 column); |
|
2572 if (_err != noErr) return PyMac_Error(_err); |
|
2573 Py_INCREF(Py_None); |
|
2574 _res = Py_None; |
|
2575 return _res; |
|
2576 } |
|
2577 |
|
2578 static PyObject *CtlObj_GetDataBrowserTableViewColumnCount(ControlObject *_self, PyObject *_args) |
|
2579 { |
|
2580 PyObject *_res = NULL; |
|
2581 OSStatus _err; |
|
2582 UInt32 numColumns; |
|
2583 #ifndef GetDataBrowserTableViewColumnCount |
|
2584 PyMac_PRECHECK(GetDataBrowserTableViewColumnCount); |
|
2585 #endif |
|
2586 if (!PyArg_ParseTuple(_args, "")) |
|
2587 return NULL; |
|
2588 _err = GetDataBrowserTableViewColumnCount(_self->ob_itself, |
|
2589 &numColumns); |
|
2590 if (_err != noErr) return PyMac_Error(_err); |
|
2591 _res = Py_BuildValue("l", |
|
2592 numColumns); |
|
2593 return _res; |
|
2594 } |
|
2595 |
|
2596 static PyObject *CtlObj_SetDataBrowserTableViewHiliteStyle(ControlObject *_self, PyObject *_args) |
|
2597 { |
|
2598 PyObject *_res = NULL; |
|
2599 OSStatus _err; |
|
2600 UInt32 hiliteStyle; |
|
2601 #ifndef SetDataBrowserTableViewHiliteStyle |
|
2602 PyMac_PRECHECK(SetDataBrowserTableViewHiliteStyle); |
|
2603 #endif |
|
2604 if (!PyArg_ParseTuple(_args, "l", |
|
2605 &hiliteStyle)) |
|
2606 return NULL; |
|
2607 _err = SetDataBrowserTableViewHiliteStyle(_self->ob_itself, |
|
2608 hiliteStyle); |
|
2609 if (_err != noErr) return PyMac_Error(_err); |
|
2610 Py_INCREF(Py_None); |
|
2611 _res = Py_None; |
|
2612 return _res; |
|
2613 } |
|
2614 |
|
2615 static PyObject *CtlObj_GetDataBrowserTableViewHiliteStyle(ControlObject *_self, PyObject *_args) |
|
2616 { |
|
2617 PyObject *_res = NULL; |
|
2618 OSStatus _err; |
|
2619 UInt32 hiliteStyle; |
|
2620 #ifndef GetDataBrowserTableViewHiliteStyle |
|
2621 PyMac_PRECHECK(GetDataBrowserTableViewHiliteStyle); |
|
2622 #endif |
|
2623 if (!PyArg_ParseTuple(_args, "")) |
|
2624 return NULL; |
|
2625 _err = GetDataBrowserTableViewHiliteStyle(_self->ob_itself, |
|
2626 &hiliteStyle); |
|
2627 if (_err != noErr) return PyMac_Error(_err); |
|
2628 _res = Py_BuildValue("l", |
|
2629 hiliteStyle); |
|
2630 return _res; |
|
2631 } |
|
2632 |
|
2633 static PyObject *CtlObj_SetDataBrowserTableViewRowHeight(ControlObject *_self, PyObject *_args) |
|
2634 { |
|
2635 PyObject *_res = NULL; |
|
2636 OSStatus _err; |
|
2637 UInt16 height; |
|
2638 #ifndef SetDataBrowserTableViewRowHeight |
|
2639 PyMac_PRECHECK(SetDataBrowserTableViewRowHeight); |
|
2640 #endif |
|
2641 if (!PyArg_ParseTuple(_args, "H", |
|
2642 &height)) |
|
2643 return NULL; |
|
2644 _err = SetDataBrowserTableViewRowHeight(_self->ob_itself, |
|
2645 height); |
|
2646 if (_err != noErr) return PyMac_Error(_err); |
|
2647 Py_INCREF(Py_None); |
|
2648 _res = Py_None; |
|
2649 return _res; |
|
2650 } |
|
2651 |
|
2652 static PyObject *CtlObj_GetDataBrowserTableViewRowHeight(ControlObject *_self, PyObject *_args) |
|
2653 { |
|
2654 PyObject *_res = NULL; |
|
2655 OSStatus _err; |
|
2656 UInt16 height; |
|
2657 #ifndef GetDataBrowserTableViewRowHeight |
|
2658 PyMac_PRECHECK(GetDataBrowserTableViewRowHeight); |
|
2659 #endif |
|
2660 if (!PyArg_ParseTuple(_args, "")) |
|
2661 return NULL; |
|
2662 _err = GetDataBrowserTableViewRowHeight(_self->ob_itself, |
|
2663 &height); |
|
2664 if (_err != noErr) return PyMac_Error(_err); |
|
2665 _res = Py_BuildValue("H", |
|
2666 height); |
|
2667 return _res; |
|
2668 } |
|
2669 |
|
2670 static PyObject *CtlObj_SetDataBrowserTableViewColumnWidth(ControlObject *_self, PyObject *_args) |
|
2671 { |
|
2672 PyObject *_res = NULL; |
|
2673 OSStatus _err; |
|
2674 UInt16 width; |
|
2675 #ifndef SetDataBrowserTableViewColumnWidth |
|
2676 PyMac_PRECHECK(SetDataBrowserTableViewColumnWidth); |
|
2677 #endif |
|
2678 if (!PyArg_ParseTuple(_args, "H", |
|
2679 &width)) |
|
2680 return NULL; |
|
2681 _err = SetDataBrowserTableViewColumnWidth(_self->ob_itself, |
|
2682 width); |
|
2683 if (_err != noErr) return PyMac_Error(_err); |
|
2684 Py_INCREF(Py_None); |
|
2685 _res = Py_None; |
|
2686 return _res; |
|
2687 } |
|
2688 |
|
2689 static PyObject *CtlObj_GetDataBrowserTableViewColumnWidth(ControlObject *_self, PyObject *_args) |
|
2690 { |
|
2691 PyObject *_res = NULL; |
|
2692 OSStatus _err; |
|
2693 UInt16 width; |
|
2694 #ifndef GetDataBrowserTableViewColumnWidth |
|
2695 PyMac_PRECHECK(GetDataBrowserTableViewColumnWidth); |
|
2696 #endif |
|
2697 if (!PyArg_ParseTuple(_args, "")) |
|
2698 return NULL; |
|
2699 _err = GetDataBrowserTableViewColumnWidth(_self->ob_itself, |
|
2700 &width); |
|
2701 if (_err != noErr) return PyMac_Error(_err); |
|
2702 _res = Py_BuildValue("H", |
|
2703 width); |
|
2704 return _res; |
|
2705 } |
|
2706 |
|
2707 static PyObject *CtlObj_SetDataBrowserTableViewItemRowHeight(ControlObject *_self, PyObject *_args) |
|
2708 { |
|
2709 PyObject *_res = NULL; |
|
2710 OSStatus _err; |
|
2711 UInt32 item; |
|
2712 UInt16 height; |
|
2713 #ifndef SetDataBrowserTableViewItemRowHeight |
|
2714 PyMac_PRECHECK(SetDataBrowserTableViewItemRowHeight); |
|
2715 #endif |
|
2716 if (!PyArg_ParseTuple(_args, "lH", |
|
2717 &item, |
|
2718 &height)) |
|
2719 return NULL; |
|
2720 _err = SetDataBrowserTableViewItemRowHeight(_self->ob_itself, |
|
2721 item, |
|
2722 height); |
|
2723 if (_err != noErr) return PyMac_Error(_err); |
|
2724 Py_INCREF(Py_None); |
|
2725 _res = Py_None; |
|
2726 return _res; |
|
2727 } |
|
2728 |
|
2729 static PyObject *CtlObj_GetDataBrowserTableViewItemRowHeight(ControlObject *_self, PyObject *_args) |
|
2730 { |
|
2731 PyObject *_res = NULL; |
|
2732 OSStatus _err; |
|
2733 UInt32 item; |
|
2734 UInt16 height; |
|
2735 #ifndef GetDataBrowserTableViewItemRowHeight |
|
2736 PyMac_PRECHECK(GetDataBrowserTableViewItemRowHeight); |
|
2737 #endif |
|
2738 if (!PyArg_ParseTuple(_args, "l", |
|
2739 &item)) |
|
2740 return NULL; |
|
2741 _err = GetDataBrowserTableViewItemRowHeight(_self->ob_itself, |
|
2742 item, |
|
2743 &height); |
|
2744 if (_err != noErr) return PyMac_Error(_err); |
|
2745 _res = Py_BuildValue("H", |
|
2746 height); |
|
2747 return _res; |
|
2748 } |
|
2749 |
|
2750 static PyObject *CtlObj_SetDataBrowserTableViewNamedColumnWidth(ControlObject *_self, PyObject *_args) |
|
2751 { |
|
2752 PyObject *_res = NULL; |
|
2753 OSStatus _err; |
|
2754 UInt32 column; |
|
2755 UInt16 width; |
|
2756 #ifndef SetDataBrowserTableViewNamedColumnWidth |
|
2757 PyMac_PRECHECK(SetDataBrowserTableViewNamedColumnWidth); |
|
2758 #endif |
|
2759 if (!PyArg_ParseTuple(_args, "lH", |
|
2760 &column, |
|
2761 &width)) |
|
2762 return NULL; |
|
2763 _err = SetDataBrowserTableViewNamedColumnWidth(_self->ob_itself, |
|
2764 column, |
|
2765 width); |
|
2766 if (_err != noErr) return PyMac_Error(_err); |
|
2767 Py_INCREF(Py_None); |
|
2768 _res = Py_None; |
|
2769 return _res; |
|
2770 } |
|
2771 |
|
2772 static PyObject *CtlObj_GetDataBrowserTableViewNamedColumnWidth(ControlObject *_self, PyObject *_args) |
|
2773 { |
|
2774 PyObject *_res = NULL; |
|
2775 OSStatus _err; |
|
2776 UInt32 column; |
|
2777 UInt16 width; |
|
2778 #ifndef GetDataBrowserTableViewNamedColumnWidth |
|
2779 PyMac_PRECHECK(GetDataBrowserTableViewNamedColumnWidth); |
|
2780 #endif |
|
2781 if (!PyArg_ParseTuple(_args, "l", |
|
2782 &column)) |
|
2783 return NULL; |
|
2784 _err = GetDataBrowserTableViewNamedColumnWidth(_self->ob_itself, |
|
2785 column, |
|
2786 &width); |
|
2787 if (_err != noErr) return PyMac_Error(_err); |
|
2788 _res = Py_BuildValue("H", |
|
2789 width); |
|
2790 return _res; |
|
2791 } |
|
2792 |
|
2793 static PyObject *CtlObj_SetDataBrowserTableViewGeometry(ControlObject *_self, PyObject *_args) |
|
2794 { |
|
2795 PyObject *_res = NULL; |
|
2796 OSStatus _err; |
|
2797 Boolean variableWidthColumns; |
|
2798 Boolean variableHeightRows; |
|
2799 #ifndef SetDataBrowserTableViewGeometry |
|
2800 PyMac_PRECHECK(SetDataBrowserTableViewGeometry); |
|
2801 #endif |
|
2802 if (!PyArg_ParseTuple(_args, "bb", |
|
2803 &variableWidthColumns, |
|
2804 &variableHeightRows)) |
|
2805 return NULL; |
|
2806 _err = SetDataBrowserTableViewGeometry(_self->ob_itself, |
|
2807 variableWidthColumns, |
|
2808 variableHeightRows); |
|
2809 if (_err != noErr) return PyMac_Error(_err); |
|
2810 Py_INCREF(Py_None); |
|
2811 _res = Py_None; |
|
2812 return _res; |
|
2813 } |
|
2814 |
|
2815 static PyObject *CtlObj_GetDataBrowserTableViewGeometry(ControlObject *_self, PyObject *_args) |
|
2816 { |
|
2817 PyObject *_res = NULL; |
|
2818 OSStatus _err; |
|
2819 Boolean variableWidthColumns; |
|
2820 Boolean variableHeightRows; |
|
2821 #ifndef GetDataBrowserTableViewGeometry |
|
2822 PyMac_PRECHECK(GetDataBrowserTableViewGeometry); |
|
2823 #endif |
|
2824 if (!PyArg_ParseTuple(_args, "")) |
|
2825 return NULL; |
|
2826 _err = GetDataBrowserTableViewGeometry(_self->ob_itself, |
|
2827 &variableWidthColumns, |
|
2828 &variableHeightRows); |
|
2829 if (_err != noErr) return PyMac_Error(_err); |
|
2830 _res = Py_BuildValue("bb", |
|
2831 variableWidthColumns, |
|
2832 variableHeightRows); |
|
2833 return _res; |
|
2834 } |
|
2835 |
|
2836 static PyObject *CtlObj_GetDataBrowserTableViewItemID(ControlObject *_self, PyObject *_args) |
|
2837 { |
|
2838 PyObject *_res = NULL; |
|
2839 OSStatus _err; |
|
2840 UInt32 row; |
|
2841 UInt32 item; |
|
2842 #ifndef GetDataBrowserTableViewItemID |
|
2843 PyMac_PRECHECK(GetDataBrowserTableViewItemID); |
|
2844 #endif |
|
2845 if (!PyArg_ParseTuple(_args, "l", |
|
2846 &row)) |
|
2847 return NULL; |
|
2848 _err = GetDataBrowserTableViewItemID(_self->ob_itself, |
|
2849 row, |
|
2850 &item); |
|
2851 if (_err != noErr) return PyMac_Error(_err); |
|
2852 _res = Py_BuildValue("l", |
|
2853 item); |
|
2854 return _res; |
|
2855 } |
|
2856 |
|
2857 static PyObject *CtlObj_SetDataBrowserTableViewItemRow(ControlObject *_self, PyObject *_args) |
|
2858 { |
|
2859 PyObject *_res = NULL; |
|
2860 OSStatus _err; |
|
2861 UInt32 item; |
|
2862 UInt32 row; |
|
2863 #ifndef SetDataBrowserTableViewItemRow |
|
2864 PyMac_PRECHECK(SetDataBrowserTableViewItemRow); |
|
2865 #endif |
|
2866 if (!PyArg_ParseTuple(_args, "ll", |
|
2867 &item, |
|
2868 &row)) |
|
2869 return NULL; |
|
2870 _err = SetDataBrowserTableViewItemRow(_self->ob_itself, |
|
2871 item, |
|
2872 row); |
|
2873 if (_err != noErr) return PyMac_Error(_err); |
|
2874 Py_INCREF(Py_None); |
|
2875 _res = Py_None; |
|
2876 return _res; |
|
2877 } |
|
2878 |
|
2879 static PyObject *CtlObj_GetDataBrowserTableViewItemRow(ControlObject *_self, PyObject *_args) |
|
2880 { |
|
2881 PyObject *_res = NULL; |
|
2882 OSStatus _err; |
|
2883 UInt32 item; |
|
2884 UInt32 row; |
|
2885 #ifndef GetDataBrowserTableViewItemRow |
|
2886 PyMac_PRECHECK(GetDataBrowserTableViewItemRow); |
|
2887 #endif |
|
2888 if (!PyArg_ParseTuple(_args, "l", |
|
2889 &item)) |
|
2890 return NULL; |
|
2891 _err = GetDataBrowserTableViewItemRow(_self->ob_itself, |
|
2892 item, |
|
2893 &row); |
|
2894 if (_err != noErr) return PyMac_Error(_err); |
|
2895 _res = Py_BuildValue("l", |
|
2896 row); |
|
2897 return _res; |
|
2898 } |
|
2899 |
|
2900 static PyObject *CtlObj_SetDataBrowserTableViewColumnPosition(ControlObject *_self, PyObject *_args) |
|
2901 { |
|
2902 PyObject *_res = NULL; |
|
2903 OSStatus _err; |
|
2904 UInt32 column; |
|
2905 UInt32 position; |
|
2906 #ifndef SetDataBrowserTableViewColumnPosition |
|
2907 PyMac_PRECHECK(SetDataBrowserTableViewColumnPosition); |
|
2908 #endif |
|
2909 if (!PyArg_ParseTuple(_args, "ll", |
|
2910 &column, |
|
2911 &position)) |
|
2912 return NULL; |
|
2913 _err = SetDataBrowserTableViewColumnPosition(_self->ob_itself, |
|
2914 column, |
|
2915 position); |
|
2916 if (_err != noErr) return PyMac_Error(_err); |
|
2917 Py_INCREF(Py_None); |
|
2918 _res = Py_None; |
|
2919 return _res; |
|
2920 } |
|
2921 |
|
2922 static PyObject *CtlObj_GetDataBrowserTableViewColumnPosition(ControlObject *_self, PyObject *_args) |
|
2923 { |
|
2924 PyObject *_res = NULL; |
|
2925 OSStatus _err; |
|
2926 UInt32 column; |
|
2927 UInt32 position; |
|
2928 #ifndef GetDataBrowserTableViewColumnPosition |
|
2929 PyMac_PRECHECK(GetDataBrowserTableViewColumnPosition); |
|
2930 #endif |
|
2931 if (!PyArg_ParseTuple(_args, "l", |
|
2932 &column)) |
|
2933 return NULL; |
|
2934 _err = GetDataBrowserTableViewColumnPosition(_self->ob_itself, |
|
2935 column, |
|
2936 &position); |
|
2937 if (_err != noErr) return PyMac_Error(_err); |
|
2938 _res = Py_BuildValue("l", |
|
2939 position); |
|
2940 return _res; |
|
2941 } |
|
2942 |
|
2943 static PyObject *CtlObj_GetDataBrowserTableViewColumnProperty(ControlObject *_self, PyObject *_args) |
|
2944 { |
|
2945 PyObject *_res = NULL; |
|
2946 OSStatus _err; |
|
2947 UInt32 column; |
|
2948 UInt32 property; |
|
2949 #ifndef GetDataBrowserTableViewColumnProperty |
|
2950 PyMac_PRECHECK(GetDataBrowserTableViewColumnProperty); |
|
2951 #endif |
|
2952 if (!PyArg_ParseTuple(_args, "l", |
|
2953 &column)) |
|
2954 return NULL; |
|
2955 _err = GetDataBrowserTableViewColumnProperty(_self->ob_itself, |
|
2956 column, |
|
2957 &property); |
|
2958 if (_err != noErr) return PyMac_Error(_err); |
|
2959 _res = Py_BuildValue("l", |
|
2960 property); |
|
2961 return _res; |
|
2962 } |
|
2963 |
|
2964 static PyObject *CtlObj_AutoSizeDataBrowserListViewColumns(ControlObject *_self, PyObject *_args) |
|
2965 { |
|
2966 PyObject *_res = NULL; |
|
2967 OSStatus _err; |
|
2968 #ifndef AutoSizeDataBrowserListViewColumns |
|
2969 PyMac_PRECHECK(AutoSizeDataBrowserListViewColumns); |
|
2970 #endif |
|
2971 if (!PyArg_ParseTuple(_args, "")) |
|
2972 return NULL; |
|
2973 _err = AutoSizeDataBrowserListViewColumns(_self->ob_itself); |
|
2974 if (_err != noErr) return PyMac_Error(_err); |
|
2975 Py_INCREF(Py_None); |
|
2976 _res = Py_None; |
|
2977 return _res; |
|
2978 } |
|
2979 |
|
2980 static PyObject *CtlObj_AddDataBrowserListViewColumn(ControlObject *_self, PyObject *_args) |
|
2981 { |
|
2982 PyObject *_res = NULL; |
|
2983 OSStatus _err; |
|
2984 DataBrowserListViewColumnDesc columnDesc; |
|
2985 UInt32 position; |
|
2986 #ifndef AddDataBrowserListViewColumn |
|
2987 PyMac_PRECHECK(AddDataBrowserListViewColumn); |
|
2988 #endif |
|
2989 if (!PyArg_ParseTuple(_args, "O&l", |
|
2990 DataBrowserListViewColumnDesc_Convert, &columnDesc, |
|
2991 &position)) |
|
2992 return NULL; |
|
2993 _err = AddDataBrowserListViewColumn(_self->ob_itself, |
|
2994 &columnDesc, |
|
2995 position); |
|
2996 if (_err != noErr) return PyMac_Error(_err); |
|
2997 Py_INCREF(Py_None); |
|
2998 _res = Py_None; |
|
2999 return _res; |
|
3000 } |
|
3001 |
|
3002 static PyObject *CtlObj_SetDataBrowserListViewHeaderBtnHeight(ControlObject *_self, PyObject *_args) |
|
3003 { |
|
3004 PyObject *_res = NULL; |
|
3005 OSStatus _err; |
|
3006 UInt16 height; |
|
3007 #ifndef SetDataBrowserListViewHeaderBtnHeight |
|
3008 PyMac_PRECHECK(SetDataBrowserListViewHeaderBtnHeight); |
|
3009 #endif |
|
3010 if (!PyArg_ParseTuple(_args, "H", |
|
3011 &height)) |
|
3012 return NULL; |
|
3013 _err = SetDataBrowserListViewHeaderBtnHeight(_self->ob_itself, |
|
3014 height); |
|
3015 if (_err != noErr) return PyMac_Error(_err); |
|
3016 Py_INCREF(Py_None); |
|
3017 _res = Py_None; |
|
3018 return _res; |
|
3019 } |
|
3020 |
|
3021 static PyObject *CtlObj_GetDataBrowserListViewHeaderBtnHeight(ControlObject *_self, PyObject *_args) |
|
3022 { |
|
3023 PyObject *_res = NULL; |
|
3024 OSStatus _err; |
|
3025 UInt16 height; |
|
3026 #ifndef GetDataBrowserListViewHeaderBtnHeight |
|
3027 PyMac_PRECHECK(GetDataBrowserListViewHeaderBtnHeight); |
|
3028 #endif |
|
3029 if (!PyArg_ParseTuple(_args, "")) |
|
3030 return NULL; |
|
3031 _err = GetDataBrowserListViewHeaderBtnHeight(_self->ob_itself, |
|
3032 &height); |
|
3033 if (_err != noErr) return PyMac_Error(_err); |
|
3034 _res = Py_BuildValue("H", |
|
3035 height); |
|
3036 return _res; |
|
3037 } |
|
3038 |
|
3039 static PyObject *CtlObj_SetDataBrowserListViewUsePlainBackground(ControlObject *_self, PyObject *_args) |
|
3040 { |
|
3041 PyObject *_res = NULL; |
|
3042 OSStatus _err; |
|
3043 Boolean usePlainBackground; |
|
3044 #ifndef SetDataBrowserListViewUsePlainBackground |
|
3045 PyMac_PRECHECK(SetDataBrowserListViewUsePlainBackground); |
|
3046 #endif |
|
3047 if (!PyArg_ParseTuple(_args, "b", |
|
3048 &usePlainBackground)) |
|
3049 return NULL; |
|
3050 _err = SetDataBrowserListViewUsePlainBackground(_self->ob_itself, |
|
3051 usePlainBackground); |
|
3052 if (_err != noErr) return PyMac_Error(_err); |
|
3053 Py_INCREF(Py_None); |
|
3054 _res = Py_None; |
|
3055 return _res; |
|
3056 } |
|
3057 |
|
3058 static PyObject *CtlObj_GetDataBrowserListViewUsePlainBackground(ControlObject *_self, PyObject *_args) |
|
3059 { |
|
3060 PyObject *_res = NULL; |
|
3061 OSStatus _err; |
|
3062 Boolean usePlainBackground; |
|
3063 #ifndef GetDataBrowserListViewUsePlainBackground |
|
3064 PyMac_PRECHECK(GetDataBrowserListViewUsePlainBackground); |
|
3065 #endif |
|
3066 if (!PyArg_ParseTuple(_args, "")) |
|
3067 return NULL; |
|
3068 _err = GetDataBrowserListViewUsePlainBackground(_self->ob_itself, |
|
3069 &usePlainBackground); |
|
3070 if (_err != noErr) return PyMac_Error(_err); |
|
3071 _res = Py_BuildValue("b", |
|
3072 usePlainBackground); |
|
3073 return _res; |
|
3074 } |
|
3075 |
|
3076 static PyObject *CtlObj_SetDataBrowserListViewDisclosureColumn(ControlObject *_self, PyObject *_args) |
|
3077 { |
|
3078 PyObject *_res = NULL; |
|
3079 OSStatus _err; |
|
3080 UInt32 column; |
|
3081 Boolean expandableRows; |
|
3082 #ifndef SetDataBrowserListViewDisclosureColumn |
|
3083 PyMac_PRECHECK(SetDataBrowserListViewDisclosureColumn); |
|
3084 #endif |
|
3085 if (!PyArg_ParseTuple(_args, "lb", |
|
3086 &column, |
|
3087 &expandableRows)) |
|
3088 return NULL; |
|
3089 _err = SetDataBrowserListViewDisclosureColumn(_self->ob_itself, |
|
3090 column, |
|
3091 expandableRows); |
|
3092 if (_err != noErr) return PyMac_Error(_err); |
|
3093 Py_INCREF(Py_None); |
|
3094 _res = Py_None; |
|
3095 return _res; |
|
3096 } |
|
3097 |
|
3098 static PyObject *CtlObj_GetDataBrowserListViewDisclosureColumn(ControlObject *_self, PyObject *_args) |
|
3099 { |
|
3100 PyObject *_res = NULL; |
|
3101 OSStatus _err; |
|
3102 UInt32 column; |
|
3103 Boolean expandableRows; |
|
3104 #ifndef GetDataBrowserListViewDisclosureColumn |
|
3105 PyMac_PRECHECK(GetDataBrowserListViewDisclosureColumn); |
|
3106 #endif |
|
3107 if (!PyArg_ParseTuple(_args, "")) |
|
3108 return NULL; |
|
3109 _err = GetDataBrowserListViewDisclosureColumn(_self->ob_itself, |
|
3110 &column, |
|
3111 &expandableRows); |
|
3112 if (_err != noErr) return PyMac_Error(_err); |
|
3113 _res = Py_BuildValue("lb", |
|
3114 column, |
|
3115 expandableRows); |
|
3116 return _res; |
|
3117 } |
|
3118 |
|
3119 static PyObject *CtlObj_GetDataBrowserColumnViewPath(ControlObject *_self, PyObject *_args) |
|
3120 { |
|
3121 PyObject *_res = NULL; |
|
3122 OSStatus _err; |
|
3123 Handle path; |
|
3124 #ifndef GetDataBrowserColumnViewPath |
|
3125 PyMac_PRECHECK(GetDataBrowserColumnViewPath); |
|
3126 #endif |
|
3127 if (!PyArg_ParseTuple(_args, "O&", |
|
3128 ResObj_Convert, &path)) |
|
3129 return NULL; |
|
3130 _err = GetDataBrowserColumnViewPath(_self->ob_itself, |
|
3131 path); |
|
3132 if (_err != noErr) return PyMac_Error(_err); |
|
3133 Py_INCREF(Py_None); |
|
3134 _res = Py_None; |
|
3135 return _res; |
|
3136 } |
|
3137 |
|
3138 static PyObject *CtlObj_GetDataBrowserColumnViewPathLength(ControlObject *_self, PyObject *_args) |
|
3139 { |
|
3140 PyObject *_res = NULL; |
|
3141 OSStatus _err; |
|
3142 UInt32 pathLength; |
|
3143 #ifndef GetDataBrowserColumnViewPathLength |
|
3144 PyMac_PRECHECK(GetDataBrowserColumnViewPathLength); |
|
3145 #endif |
|
3146 if (!PyArg_ParseTuple(_args, "")) |
|
3147 return NULL; |
|
3148 _err = GetDataBrowserColumnViewPathLength(_self->ob_itself, |
|
3149 &pathLength); |
|
3150 if (_err != noErr) return PyMac_Error(_err); |
|
3151 _res = Py_BuildValue("l", |
|
3152 pathLength); |
|
3153 return _res; |
|
3154 } |
|
3155 |
|
3156 static PyObject *CtlObj_SetDataBrowserColumnViewDisplayType(ControlObject *_self, PyObject *_args) |
|
3157 { |
|
3158 PyObject *_res = NULL; |
|
3159 OSStatus _err; |
|
3160 OSType propertyType; |
|
3161 #ifndef SetDataBrowserColumnViewDisplayType |
|
3162 PyMac_PRECHECK(SetDataBrowserColumnViewDisplayType); |
|
3163 #endif |
|
3164 if (!PyArg_ParseTuple(_args, "O&", |
|
3165 PyMac_GetOSType, &propertyType)) |
|
3166 return NULL; |
|
3167 _err = SetDataBrowserColumnViewDisplayType(_self->ob_itself, |
|
3168 propertyType); |
|
3169 if (_err != noErr) return PyMac_Error(_err); |
|
3170 Py_INCREF(Py_None); |
|
3171 _res = Py_None; |
|
3172 return _res; |
|
3173 } |
|
3174 |
|
3175 static PyObject *CtlObj_GetDataBrowserColumnViewDisplayType(ControlObject *_self, PyObject *_args) |
|
3176 { |
|
3177 PyObject *_res = NULL; |
|
3178 OSStatus _err; |
|
3179 OSType propertyType; |
|
3180 #ifndef GetDataBrowserColumnViewDisplayType |
|
3181 PyMac_PRECHECK(GetDataBrowserColumnViewDisplayType); |
|
3182 #endif |
|
3183 if (!PyArg_ParseTuple(_args, "")) |
|
3184 return NULL; |
|
3185 _err = GetDataBrowserColumnViewDisplayType(_self->ob_itself, |
|
3186 &propertyType); |
|
3187 if (_err != noErr) return PyMac_Error(_err); |
|
3188 _res = Py_BuildValue("O&", |
|
3189 PyMac_BuildOSType, propertyType); |
|
3190 return _res; |
|
3191 } |
|
3192 |
|
3193 static PyObject *CtlObj_as_Resource(ControlObject *_self, PyObject *_args) |
|
3194 { |
|
3195 PyObject *_res = NULL; |
|
3196 Handle _rv; |
|
3197 #ifndef as_Resource |
|
3198 PyMac_PRECHECK(as_Resource); |
|
3199 #endif |
|
3200 if (!PyArg_ParseTuple(_args, "")) |
|
3201 return NULL; |
|
3202 _rv = as_Resource(_self->ob_itself); |
|
3203 _res = Py_BuildValue("O&", |
|
3204 ResObj_New, _rv); |
|
3205 return _res; |
|
3206 } |
|
3207 |
|
3208 static PyObject *CtlObj_GetControlRect(ControlObject *_self, PyObject *_args) |
|
3209 { |
|
3210 PyObject *_res = NULL; |
|
3211 Rect rect; |
|
3212 #ifndef GetControlRect |
|
3213 PyMac_PRECHECK(GetControlRect); |
|
3214 #endif |
|
3215 if (!PyArg_ParseTuple(_args, "")) |
|
3216 return NULL; |
|
3217 GetControlRect(_self->ob_itself, |
|
3218 &rect); |
|
3219 _res = Py_BuildValue("O&", |
|
3220 PyMac_BuildRect, &rect); |
|
3221 return _res; |
|
3222 } |
|
3223 |
|
3224 static PyObject *CtlObj_DisposeControl(ControlObject *_self, PyObject *_args) |
|
3225 { |
|
3226 PyObject *_res = NULL; |
|
3227 |
|
3228 if (!PyArg_ParseTuple(_args, "")) |
|
3229 return NULL; |
|
3230 if ( _self->ob_itself ) { |
|
3231 SetControlReference(_self->ob_itself, (long)0); /* Make it forget about us */ |
|
3232 DisposeControl(_self->ob_itself); |
|
3233 _self->ob_itself = NULL; |
|
3234 } |
|
3235 Py_INCREF(Py_None); |
|
3236 _res = Py_None; |
|
3237 return _res; |
|
3238 |
|
3239 } |
|
3240 |
|
3241 static PyObject *CtlObj_TrackControl(ControlObject *_self, PyObject *_args) |
|
3242 { |
|
3243 PyObject *_res = NULL; |
|
3244 |
|
3245 ControlPartCode _rv; |
|
3246 Point startPoint; |
|
3247 ControlActionUPP upp = 0; |
|
3248 PyObject *callback = 0; |
|
3249 |
|
3250 if (!PyArg_ParseTuple(_args, "O&|O", |
|
3251 PyMac_GetPoint, &startPoint, &callback)) |
|
3252 return NULL; |
|
3253 if (callback && callback != Py_None) { |
|
3254 if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1) |
|
3255 upp = (ControlActionUPP)-1; |
|
3256 else { |
|
3257 settrackfunc(callback); |
|
3258 upp = mytracker_upp; |
|
3259 } |
|
3260 } |
|
3261 _rv = TrackControl(_self->ob_itself, |
|
3262 startPoint, |
|
3263 upp); |
|
3264 clrtrackfunc(); |
|
3265 _res = Py_BuildValue("h", |
|
3266 _rv); |
|
3267 return _res; |
|
3268 |
|
3269 } |
|
3270 |
|
3271 static PyObject *CtlObj_HandleControlClick(ControlObject *_self, PyObject *_args) |
|
3272 { |
|
3273 PyObject *_res = NULL; |
|
3274 |
|
3275 ControlPartCode _rv; |
|
3276 Point startPoint; |
|
3277 SInt16 modifiers; |
|
3278 ControlActionUPP upp = 0; |
|
3279 PyObject *callback = 0; |
|
3280 |
|
3281 if (!PyArg_ParseTuple(_args, "O&h|O", |
|
3282 PyMac_GetPoint, &startPoint, |
|
3283 &modifiers, |
|
3284 &callback)) |
|
3285 return NULL; |
|
3286 if (callback && callback != Py_None) { |
|
3287 if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1) |
|
3288 upp = (ControlActionUPP)-1; |
|
3289 else { |
|
3290 settrackfunc(callback); |
|
3291 upp = mytracker_upp; |
|
3292 } |
|
3293 } |
|
3294 _rv = HandleControlClick(_self->ob_itself, |
|
3295 startPoint, |
|
3296 modifiers, |
|
3297 upp); |
|
3298 clrtrackfunc(); |
|
3299 _res = Py_BuildValue("h", |
|
3300 _rv); |
|
3301 return _res; |
|
3302 |
|
3303 } |
|
3304 |
|
3305 static PyObject *CtlObj_SetControlData(ControlObject *_self, PyObject *_args) |
|
3306 { |
|
3307 PyObject *_res = NULL; |
|
3308 |
|
3309 OSErr _err; |
|
3310 ControlPartCode inPart; |
|
3311 ResType inTagName; |
|
3312 Size bufferSize; |
|
3313 Ptr buffer; |
|
3314 |
|
3315 if (!PyArg_ParseTuple(_args, "hO&s#", |
|
3316 &inPart, |
|
3317 PyMac_GetOSType, &inTagName, |
|
3318 &buffer, &bufferSize)) |
|
3319 return NULL; |
|
3320 |
|
3321 _err = SetControlData(_self->ob_itself, |
|
3322 inPart, |
|
3323 inTagName, |
|
3324 bufferSize, |
|
3325 buffer); |
|
3326 |
|
3327 if (_err != noErr) |
|
3328 return PyMac_Error(_err); |
|
3329 _res = Py_None; |
|
3330 return _res; |
|
3331 |
|
3332 } |
|
3333 |
|
3334 static PyObject *CtlObj_GetControlData(ControlObject *_self, PyObject *_args) |
|
3335 { |
|
3336 PyObject *_res = NULL; |
|
3337 |
|
3338 OSErr _err; |
|
3339 ControlPartCode inPart; |
|
3340 ResType inTagName; |
|
3341 Size bufferSize; |
|
3342 Ptr buffer; |
|
3343 Size outSize; |
|
3344 |
|
3345 if (!PyArg_ParseTuple(_args, "hO&", |
|
3346 &inPart, |
|
3347 PyMac_GetOSType, &inTagName)) |
|
3348 return NULL; |
|
3349 |
|
3350 /* allocate a buffer for the data */ |
|
3351 _err = GetControlDataSize(_self->ob_itself, |
|
3352 inPart, |
|
3353 inTagName, |
|
3354 &bufferSize); |
|
3355 if (_err != noErr) |
|
3356 return PyMac_Error(_err); |
|
3357 buffer = PyMem_NEW(char, bufferSize); |
|
3358 if (buffer == NULL) |
|
3359 return PyErr_NoMemory(); |
|
3360 |
|
3361 _err = GetControlData(_self->ob_itself, |
|
3362 inPart, |
|
3363 inTagName, |
|
3364 bufferSize, |
|
3365 buffer, |
|
3366 &outSize); |
|
3367 |
|
3368 if (_err != noErr) { |
|
3369 PyMem_DEL(buffer); |
|
3370 return PyMac_Error(_err); |
|
3371 } |
|
3372 _res = Py_BuildValue("s#", buffer, outSize); |
|
3373 PyMem_DEL(buffer); |
|
3374 return _res; |
|
3375 |
|
3376 } |
|
3377 |
|
3378 static PyObject *CtlObj_SetControlData_Handle(ControlObject *_self, PyObject *_args) |
|
3379 { |
|
3380 PyObject *_res = NULL; |
|
3381 |
|
3382 OSErr _err; |
|
3383 ControlPartCode inPart; |
|
3384 ResType inTagName; |
|
3385 Handle buffer; |
|
3386 |
|
3387 if (!PyArg_ParseTuple(_args, "hO&O&", |
|
3388 &inPart, |
|
3389 PyMac_GetOSType, &inTagName, |
|
3390 OptResObj_Convert, &buffer)) |
|
3391 return NULL; |
|
3392 |
|
3393 _err = SetControlData(_self->ob_itself, |
|
3394 inPart, |
|
3395 inTagName, |
|
3396 sizeof(buffer), |
|
3397 (Ptr)&buffer); |
|
3398 |
|
3399 if (_err != noErr) |
|
3400 return PyMac_Error(_err); |
|
3401 _res = Py_None; |
|
3402 return _res; |
|
3403 |
|
3404 } |
|
3405 |
|
3406 static PyObject *CtlObj_GetControlData_Handle(ControlObject *_self, PyObject *_args) |
|
3407 { |
|
3408 PyObject *_res = NULL; |
|
3409 |
|
3410 OSErr _err; |
|
3411 ControlPartCode inPart; |
|
3412 ResType inTagName; |
|
3413 Size bufferSize; |
|
3414 Handle hdl; |
|
3415 |
|
3416 if (!PyArg_ParseTuple(_args, "hO&", |
|
3417 &inPart, |
|
3418 PyMac_GetOSType, &inTagName)) |
|
3419 return NULL; |
|
3420 |
|
3421 /* Check it is handle-sized */ |
|
3422 _err = GetControlDataSize(_self->ob_itself, |
|
3423 inPart, |
|
3424 inTagName, |
|
3425 &bufferSize); |
|
3426 if (_err != noErr) |
|
3427 return PyMac_Error(_err); |
|
3428 if (bufferSize != sizeof(Handle)) { |
|
3429 PyErr_SetString(Ctl_Error, "GetControlDataSize() != sizeof(Handle)"); |
|
3430 return NULL; |
|
3431 } |
|
3432 |
|
3433 _err = GetControlData(_self->ob_itself, |
|
3434 inPart, |
|
3435 inTagName, |
|
3436 sizeof(Handle), |
|
3437 (Ptr)&hdl, |
|
3438 &bufferSize); |
|
3439 |
|
3440 if (_err != noErr) { |
|
3441 return PyMac_Error(_err); |
|
3442 } |
|
3443 _res = Py_BuildValue("O&", OptResObj_New, hdl); |
|
3444 return _res; |
|
3445 |
|
3446 } |
|
3447 |
|
3448 static PyObject *CtlObj_SetControlData_Callback(ControlObject *_self, PyObject *_args) |
|
3449 { |
|
3450 PyObject *_res = NULL; |
|
3451 |
|
3452 OSErr _err; |
|
3453 ControlPartCode inPart; |
|
3454 ResType inTagName; |
|
3455 PyObject *callback; |
|
3456 UniversalProcPtr c_callback; |
|
3457 |
|
3458 if (!PyArg_ParseTuple(_args, "hO&O", |
|
3459 &inPart, |
|
3460 PyMac_GetOSType, &inTagName, |
|
3461 &callback)) |
|
3462 return NULL; |
|
3463 |
|
3464 if ( setcallback((PyObject *)_self, inTagName, callback, &c_callback) < 0 ) |
|
3465 return NULL; |
|
3466 _err = SetControlData(_self->ob_itself, |
|
3467 inPart, |
|
3468 inTagName, |
|
3469 sizeof(c_callback), |
|
3470 (Ptr)&c_callback); |
|
3471 |
|
3472 if (_err != noErr) |
|
3473 return PyMac_Error(_err); |
|
3474 _res = Py_None; |
|
3475 return _res; |
|
3476 |
|
3477 } |
|
3478 |
|
3479 static PyMethodDef CtlObj_methods[] = { |
|
3480 {"HiliteControl", (PyCFunction)CtlObj_HiliteControl, 1, |
|
3481 PyDoc_STR("(ControlPartCode hiliteState) -> None")}, |
|
3482 {"ShowControl", (PyCFunction)CtlObj_ShowControl, 1, |
|
3483 PyDoc_STR("() -> None")}, |
|
3484 {"HideControl", (PyCFunction)CtlObj_HideControl, 1, |
|
3485 PyDoc_STR("() -> None")}, |
|
3486 {"IsControlActive", (PyCFunction)CtlObj_IsControlActive, 1, |
|
3487 PyDoc_STR("() -> (Boolean _rv)")}, |
|
3488 {"IsControlVisible", (PyCFunction)CtlObj_IsControlVisible, 1, |
|
3489 PyDoc_STR("() -> (Boolean _rv)")}, |
|
3490 {"ActivateControl", (PyCFunction)CtlObj_ActivateControl, 1, |
|
3491 PyDoc_STR("() -> None")}, |
|
3492 {"DeactivateControl", (PyCFunction)CtlObj_DeactivateControl, 1, |
|
3493 PyDoc_STR("() -> None")}, |
|
3494 {"SetControlVisibility", (PyCFunction)CtlObj_SetControlVisibility, 1, |
|
3495 PyDoc_STR("(Boolean inIsVisible, Boolean inDoDraw) -> None")}, |
|
3496 {"IsControlEnabled", (PyCFunction)CtlObj_IsControlEnabled, 1, |
|
3497 PyDoc_STR("() -> (Boolean _rv)")}, |
|
3498 {"EnableControl", (PyCFunction)CtlObj_EnableControl, 1, |
|
3499 PyDoc_STR("() -> None")}, |
|
3500 {"DisableControl", (PyCFunction)CtlObj_DisableControl, 1, |
|
3501 PyDoc_STR("() -> None")}, |
|
3502 {"Draw1Control", (PyCFunction)CtlObj_Draw1Control, 1, |
|
3503 PyDoc_STR("() -> None")}, |
|
3504 {"GetBestControlRect", (PyCFunction)CtlObj_GetBestControlRect, 1, |
|
3505 PyDoc_STR("() -> (Rect outRect, SInt16 outBaseLineOffset)")}, |
|
3506 {"SetControlFontStyle", (PyCFunction)CtlObj_SetControlFontStyle, 1, |
|
3507 PyDoc_STR("(ControlFontStyleRec inStyle) -> None")}, |
|
3508 {"DrawControlInCurrentPort", (PyCFunction)CtlObj_DrawControlInCurrentPort, 1, |
|
3509 PyDoc_STR("() -> None")}, |
|
3510 {"SetUpControlBackground", (PyCFunction)CtlObj_SetUpControlBackground, 1, |
|
3511 PyDoc_STR("(SInt16 inDepth, Boolean inIsColorDevice) -> None")}, |
|
3512 {"SetUpControlTextColor", (PyCFunction)CtlObj_SetUpControlTextColor, 1, |
|
3513 PyDoc_STR("(SInt16 inDepth, Boolean inIsColorDevice) -> None")}, |
|
3514 {"DragControl", (PyCFunction)CtlObj_DragControl, 1, |
|
3515 PyDoc_STR("(Point startPoint, Rect limitRect, Rect slopRect, DragConstraint axis) -> None")}, |
|
3516 {"TestControl", (PyCFunction)CtlObj_TestControl, 1, |
|
3517 PyDoc_STR("(Point testPoint) -> (ControlPartCode _rv)")}, |
|
3518 {"HandleControlContextualMenuClick", (PyCFunction)CtlObj_HandleControlContextualMenuClick, 1, |
|
3519 PyDoc_STR("(Point inWhere) -> (Boolean menuDisplayed)")}, |
|
3520 {"GetControlClickActivation", (PyCFunction)CtlObj_GetControlClickActivation, 1, |
|
3521 PyDoc_STR("(Point inWhere, EventModifiers inModifiers) -> (ClickActivationResult outResult)")}, |
|
3522 {"HandleControlKey", (PyCFunction)CtlObj_HandleControlKey, 1, |
|
3523 PyDoc_STR("(SInt16 inKeyCode, SInt16 inCharCode, EventModifiers inModifiers) -> (ControlPartCode _rv)")}, |
|
3524 {"HandleControlSetCursor", (PyCFunction)CtlObj_HandleControlSetCursor, 1, |
|
3525 PyDoc_STR("(Point localPoint, EventModifiers modifiers) -> (Boolean cursorWasSet)")}, |
|
3526 {"MoveControl", (PyCFunction)CtlObj_MoveControl, 1, |
|
3527 PyDoc_STR("(SInt16 h, SInt16 v) -> None")}, |
|
3528 {"SizeControl", (PyCFunction)CtlObj_SizeControl, 1, |
|
3529 PyDoc_STR("(SInt16 w, SInt16 h) -> None")}, |
|
3530 {"SetControlTitle", (PyCFunction)CtlObj_SetControlTitle, 1, |
|
3531 PyDoc_STR("(Str255 title) -> None")}, |
|
3532 {"GetControlTitle", (PyCFunction)CtlObj_GetControlTitle, 1, |
|
3533 PyDoc_STR("() -> (Str255 title)")}, |
|
3534 {"SetControlTitleWithCFString", (PyCFunction)CtlObj_SetControlTitleWithCFString, 1, |
|
3535 PyDoc_STR("(CFStringRef inString) -> None")}, |
|
3536 {"CopyControlTitleAsCFString", (PyCFunction)CtlObj_CopyControlTitleAsCFString, 1, |
|
3537 PyDoc_STR("() -> (CFStringRef outString)")}, |
|
3538 {"GetControlValue", (PyCFunction)CtlObj_GetControlValue, 1, |
|
3539 PyDoc_STR("() -> (SInt16 _rv)")}, |
|
3540 {"SetControlValue", (PyCFunction)CtlObj_SetControlValue, 1, |
|
3541 PyDoc_STR("(SInt16 newValue) -> None")}, |
|
3542 {"GetControlMinimum", (PyCFunction)CtlObj_GetControlMinimum, 1, |
|
3543 PyDoc_STR("() -> (SInt16 _rv)")}, |
|
3544 {"SetControlMinimum", (PyCFunction)CtlObj_SetControlMinimum, 1, |
|
3545 PyDoc_STR("(SInt16 newMinimum) -> None")}, |
|
3546 {"GetControlMaximum", (PyCFunction)CtlObj_GetControlMaximum, 1, |
|
3547 PyDoc_STR("() -> (SInt16 _rv)")}, |
|
3548 {"SetControlMaximum", (PyCFunction)CtlObj_SetControlMaximum, 1, |
|
3549 PyDoc_STR("(SInt16 newMaximum) -> None")}, |
|
3550 {"GetControlViewSize", (PyCFunction)CtlObj_GetControlViewSize, 1, |
|
3551 PyDoc_STR("() -> (SInt32 _rv)")}, |
|
3552 {"SetControlViewSize", (PyCFunction)CtlObj_SetControlViewSize, 1, |
|
3553 PyDoc_STR("(SInt32 newViewSize) -> None")}, |
|
3554 {"GetControl32BitValue", (PyCFunction)CtlObj_GetControl32BitValue, 1, |
|
3555 PyDoc_STR("() -> (SInt32 _rv)")}, |
|
3556 {"SetControl32BitValue", (PyCFunction)CtlObj_SetControl32BitValue, 1, |
|
3557 PyDoc_STR("(SInt32 newValue) -> None")}, |
|
3558 {"GetControl32BitMaximum", (PyCFunction)CtlObj_GetControl32BitMaximum, 1, |
|
3559 PyDoc_STR("() -> (SInt32 _rv)")}, |
|
3560 {"SetControl32BitMaximum", (PyCFunction)CtlObj_SetControl32BitMaximum, 1, |
|
3561 PyDoc_STR("(SInt32 newMaximum) -> None")}, |
|
3562 {"GetControl32BitMinimum", (PyCFunction)CtlObj_GetControl32BitMinimum, 1, |
|
3563 PyDoc_STR("() -> (SInt32 _rv)")}, |
|
3564 {"SetControl32BitMinimum", (PyCFunction)CtlObj_SetControl32BitMinimum, 1, |
|
3565 PyDoc_STR("(SInt32 newMinimum) -> None")}, |
|
3566 {"IsValidControlHandle", (PyCFunction)CtlObj_IsValidControlHandle, 1, |
|
3567 PyDoc_STR("() -> (Boolean _rv)")}, |
|
3568 {"SetControlID", (PyCFunction)CtlObj_SetControlID, 1, |
|
3569 PyDoc_STR("(ControlID inID) -> None")}, |
|
3570 {"GetControlID", (PyCFunction)CtlObj_GetControlID, 1, |
|
3571 PyDoc_STR("() -> (ControlID outID)")}, |
|
3572 {"SetControlCommandID", (PyCFunction)CtlObj_SetControlCommandID, 1, |
|
3573 PyDoc_STR("(UInt32 inCommandID) -> None")}, |
|
3574 {"GetControlCommandID", (PyCFunction)CtlObj_GetControlCommandID, 1, |
|
3575 PyDoc_STR("() -> (UInt32 outCommandID)")}, |
|
3576 {"RemoveControlProperty", (PyCFunction)CtlObj_RemoveControlProperty, 1, |
|
3577 PyDoc_STR("(OSType propertyCreator, OSType propertyTag) -> None")}, |
|
3578 {"GetControlPropertyAttributes", (PyCFunction)CtlObj_GetControlPropertyAttributes, 1, |
|
3579 PyDoc_STR("(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")}, |
|
3580 {"ChangeControlPropertyAttributes", (PyCFunction)CtlObj_ChangeControlPropertyAttributes, 1, |
|
3581 PyDoc_STR("(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")}, |
|
3582 {"GetControlRegion", (PyCFunction)CtlObj_GetControlRegion, 1, |
|
3583 PyDoc_STR("(ControlPartCode inPart, RgnHandle outRegion) -> None")}, |
|
3584 {"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1, |
|
3585 PyDoc_STR("() -> (ControlVariant _rv)")}, |
|
3586 {"SetControlAction", (PyCFunction)CtlObj_SetControlAction, 1, |
|
3587 PyDoc_STR("(PyObject* actionProc) -> None")}, |
|
3588 {"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1, |
|
3589 PyDoc_STR("(SInt32 data) -> None")}, |
|
3590 {"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1, |
|
3591 PyDoc_STR("() -> (SInt32 _rv)")}, |
|
3592 {"EmbedControl", (PyCFunction)CtlObj_EmbedControl, 1, |
|
3593 PyDoc_STR("(ControlHandle inContainer) -> None")}, |
|
3594 {"AutoEmbedControl", (PyCFunction)CtlObj_AutoEmbedControl, 1, |
|
3595 PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|
3596 {"GetSuperControl", (PyCFunction)CtlObj_GetSuperControl, 1, |
|
3597 PyDoc_STR("() -> (ControlHandle outParent)")}, |
|
3598 {"CountSubControls", (PyCFunction)CtlObj_CountSubControls, 1, |
|
3599 PyDoc_STR("() -> (UInt16 outNumChildren)")}, |
|
3600 {"GetIndexedSubControl", (PyCFunction)CtlObj_GetIndexedSubControl, 1, |
|
3601 PyDoc_STR("(UInt16 inIndex) -> (ControlHandle outSubControl)")}, |
|
3602 {"SetControlSupervisor", (PyCFunction)CtlObj_SetControlSupervisor, 1, |
|
3603 PyDoc_STR("(ControlHandle inBoss) -> None")}, |
|
3604 {"GetControlFeatures", (PyCFunction)CtlObj_GetControlFeatures, 1, |
|
3605 PyDoc_STR("() -> (UInt32 outFeatures)")}, |
|
3606 {"GetControlDataSize", (PyCFunction)CtlObj_GetControlDataSize, 1, |
|
3607 PyDoc_STR("(ControlPartCode inPart, ResType inTagName) -> (Size outMaxSize)")}, |
|
3608 {"HandleControlDragTracking", (PyCFunction)CtlObj_HandleControlDragTracking, 1, |
|
3609 PyDoc_STR("(DragTrackingMessage inMessage, DragReference inDrag) -> (Boolean outLikesDrag)")}, |
|
3610 {"HandleControlDragReceive", (PyCFunction)CtlObj_HandleControlDragReceive, 1, |
|
3611 PyDoc_STR("(DragReference inDrag) -> None")}, |
|
3612 {"SetControlDragTrackingEnabled", (PyCFunction)CtlObj_SetControlDragTrackingEnabled, 1, |
|
3613 PyDoc_STR("(Boolean inTracks) -> None")}, |
|
3614 {"IsControlDragTrackingEnabled", (PyCFunction)CtlObj_IsControlDragTrackingEnabled, 1, |
|
3615 PyDoc_STR("() -> (Boolean outTracks)")}, |
|
3616 {"GetControlBounds", (PyCFunction)CtlObj_GetControlBounds, 1, |
|
3617 PyDoc_STR("() -> (Rect bounds)")}, |
|
3618 {"IsControlHilited", (PyCFunction)CtlObj_IsControlHilited, 1, |
|
3619 PyDoc_STR("() -> (Boolean _rv)")}, |
|
3620 {"GetControlHilite", (PyCFunction)CtlObj_GetControlHilite, 1, |
|
3621 PyDoc_STR("() -> (UInt16 _rv)")}, |
|
3622 {"GetControlOwner", (PyCFunction)CtlObj_GetControlOwner, 1, |
|
3623 PyDoc_STR("() -> (WindowPtr _rv)")}, |
|
3624 {"GetControlDataHandle", (PyCFunction)CtlObj_GetControlDataHandle, 1, |
|
3625 PyDoc_STR("() -> (Handle _rv)")}, |
|
3626 {"GetControlPopupMenuHandle", (PyCFunction)CtlObj_GetControlPopupMenuHandle, 1, |
|
3627 PyDoc_STR("() -> (MenuHandle _rv)")}, |
|
3628 {"GetControlPopupMenuID", (PyCFunction)CtlObj_GetControlPopupMenuID, 1, |
|
3629 PyDoc_STR("() -> (short _rv)")}, |
|
3630 {"SetControlDataHandle", (PyCFunction)CtlObj_SetControlDataHandle, 1, |
|
3631 PyDoc_STR("(Handle dataHandle) -> None")}, |
|
3632 {"SetControlBounds", (PyCFunction)CtlObj_SetControlBounds, 1, |
|
3633 PyDoc_STR("(Rect bounds) -> None")}, |
|
3634 {"SetControlPopupMenuHandle", (PyCFunction)CtlObj_SetControlPopupMenuHandle, 1, |
|
3635 PyDoc_STR("(MenuHandle popupMenu) -> None")}, |
|
3636 {"SetControlPopupMenuID", (PyCFunction)CtlObj_SetControlPopupMenuID, 1, |
|
3637 PyDoc_STR("(short menuID) -> None")}, |
|
3638 {"GetBevelButtonMenuValue", (PyCFunction)CtlObj_GetBevelButtonMenuValue, 1, |
|
3639 PyDoc_STR("() -> (SInt16 outValue)")}, |
|
3640 {"SetBevelButtonMenuValue", (PyCFunction)CtlObj_SetBevelButtonMenuValue, 1, |
|
3641 PyDoc_STR("(SInt16 inValue) -> None")}, |
|
3642 {"GetBevelButtonMenuHandle", (PyCFunction)CtlObj_GetBevelButtonMenuHandle, 1, |
|
3643 PyDoc_STR("() -> (MenuHandle outHandle)")}, |
|
3644 {"SetBevelButtonContentInfo", (PyCFunction)CtlObj_SetBevelButtonContentInfo, 1, |
|
3645 PyDoc_STR("(ControlButtonContentInfo inContent) -> None")}, |
|
3646 {"SetBevelButtonTransform", (PyCFunction)CtlObj_SetBevelButtonTransform, 1, |
|
3647 PyDoc_STR("(IconTransformType transform) -> None")}, |
|
3648 {"SetDisclosureTriangleLastValue", (PyCFunction)CtlObj_SetDisclosureTriangleLastValue, 1, |
|
3649 PyDoc_STR("(SInt16 inValue) -> None")}, |
|
3650 {"GetTabContentRect", (PyCFunction)CtlObj_GetTabContentRect, 1, |
|
3651 PyDoc_STR("() -> (Rect outContentRect)")}, |
|
3652 {"SetTabEnabled", (PyCFunction)CtlObj_SetTabEnabled, 1, |
|
3653 PyDoc_STR("(SInt16 inTabToHilite, Boolean inEnabled) -> None")}, |
|
3654 {"SetImageWellContentInfo", (PyCFunction)CtlObj_SetImageWellContentInfo, 1, |
|
3655 PyDoc_STR("(ControlButtonContentInfo inContent) -> None")}, |
|
3656 {"SetImageWellTransform", (PyCFunction)CtlObj_SetImageWellTransform, 1, |
|
3657 PyDoc_STR("(IconTransformType inTransform) -> None")}, |
|
3658 {"GetDataBrowserViewStyle", (PyCFunction)CtlObj_GetDataBrowserViewStyle, 1, |
|
3659 PyDoc_STR("() -> (OSType style)")}, |
|
3660 {"SetDataBrowserViewStyle", (PyCFunction)CtlObj_SetDataBrowserViewStyle, 1, |
|
3661 PyDoc_STR("(OSType style) -> None")}, |
|
3662 {"EnableDataBrowserEditCommand", (PyCFunction)CtlObj_EnableDataBrowserEditCommand, 1, |
|
3663 PyDoc_STR("(UInt32 command) -> (Boolean _rv)")}, |
|
3664 {"ExecuteDataBrowserEditCommand", (PyCFunction)CtlObj_ExecuteDataBrowserEditCommand, 1, |
|
3665 PyDoc_STR("(UInt32 command) -> None")}, |
|
3666 {"GetDataBrowserSelectionAnchor", (PyCFunction)CtlObj_GetDataBrowserSelectionAnchor, 1, |
|
3667 PyDoc_STR("() -> (UInt32 first, UInt32 last)")}, |
|
3668 {"MoveDataBrowserSelectionAnchor", (PyCFunction)CtlObj_MoveDataBrowserSelectionAnchor, 1, |
|
3669 PyDoc_STR("(UInt32 direction, Boolean extendSelection) -> None")}, |
|
3670 {"OpenDataBrowserContainer", (PyCFunction)CtlObj_OpenDataBrowserContainer, 1, |
|
3671 PyDoc_STR("(UInt32 container) -> None")}, |
|
3672 {"CloseDataBrowserContainer", (PyCFunction)CtlObj_CloseDataBrowserContainer, 1, |
|
3673 PyDoc_STR("(UInt32 container) -> None")}, |
|
3674 {"SortDataBrowserContainer", (PyCFunction)CtlObj_SortDataBrowserContainer, 1, |
|
3675 PyDoc_STR("(UInt32 container, Boolean sortChildren) -> None")}, |
|
3676 {"GetDataBrowserItems", (PyCFunction)CtlObj_GetDataBrowserItems, 1, |
|
3677 PyDoc_STR("(UInt32 container, Boolean recurse, UInt32 state, Handle items) -> None")}, |
|
3678 {"GetDataBrowserItemCount", (PyCFunction)CtlObj_GetDataBrowserItemCount, 1, |
|
3679 PyDoc_STR("(UInt32 container, Boolean recurse, UInt32 state) -> (UInt32 numItems)")}, |
|
3680 {"IsDataBrowserItemSelected", (PyCFunction)CtlObj_IsDataBrowserItemSelected, 1, |
|
3681 PyDoc_STR("(UInt32 item) -> (Boolean _rv)")}, |
|
3682 {"GetDataBrowserItemState", (PyCFunction)CtlObj_GetDataBrowserItemState, 1, |
|
3683 PyDoc_STR("(UInt32 item) -> (UInt32 state)")}, |
|
3684 {"RevealDataBrowserItem", (PyCFunction)CtlObj_RevealDataBrowserItem, 1, |
|
3685 PyDoc_STR("(UInt32 item, UInt32 propertyID, UInt8 options) -> None")}, |
|
3686 {"SetDataBrowserActiveItems", (PyCFunction)CtlObj_SetDataBrowserActiveItems, 1, |
|
3687 PyDoc_STR("(Boolean active) -> None")}, |
|
3688 {"GetDataBrowserActiveItems", (PyCFunction)CtlObj_GetDataBrowserActiveItems, 1, |
|
3689 PyDoc_STR("() -> (Boolean active)")}, |
|
3690 {"SetDataBrowserScrollBarInset", (PyCFunction)CtlObj_SetDataBrowserScrollBarInset, 1, |
|
3691 PyDoc_STR("() -> (Rect insetRect)")}, |
|
3692 {"GetDataBrowserScrollBarInset", (PyCFunction)CtlObj_GetDataBrowserScrollBarInset, 1, |
|
3693 PyDoc_STR("() -> (Rect insetRect)")}, |
|
3694 {"SetDataBrowserTarget", (PyCFunction)CtlObj_SetDataBrowserTarget, 1, |
|
3695 PyDoc_STR("(UInt32 target) -> None")}, |
|
3696 {"GetDataBrowserTarget", (PyCFunction)CtlObj_GetDataBrowserTarget, 1, |
|
3697 PyDoc_STR("() -> (UInt32 target)")}, |
|
3698 {"SetDataBrowserSortOrder", (PyCFunction)CtlObj_SetDataBrowserSortOrder, 1, |
|
3699 PyDoc_STR("(UInt16 order) -> None")}, |
|
3700 {"GetDataBrowserSortOrder", (PyCFunction)CtlObj_GetDataBrowserSortOrder, 1, |
|
3701 PyDoc_STR("() -> (UInt16 order)")}, |
|
3702 {"SetDataBrowserScrollPosition", (PyCFunction)CtlObj_SetDataBrowserScrollPosition, 1, |
|
3703 PyDoc_STR("(UInt32 top, UInt32 left) -> None")}, |
|
3704 {"GetDataBrowserScrollPosition", (PyCFunction)CtlObj_GetDataBrowserScrollPosition, 1, |
|
3705 PyDoc_STR("() -> (UInt32 top, UInt32 left)")}, |
|
3706 {"SetDataBrowserHasScrollBars", (PyCFunction)CtlObj_SetDataBrowserHasScrollBars, 1, |
|
3707 PyDoc_STR("(Boolean horiz, Boolean vert) -> None")}, |
|
3708 {"GetDataBrowserHasScrollBars", (PyCFunction)CtlObj_GetDataBrowserHasScrollBars, 1, |
|
3709 PyDoc_STR("() -> (Boolean horiz, Boolean vert)")}, |
|
3710 {"SetDataBrowserSortProperty", (PyCFunction)CtlObj_SetDataBrowserSortProperty, 1, |
|
3711 PyDoc_STR("(UInt32 property) -> None")}, |
|
3712 {"GetDataBrowserSortProperty", (PyCFunction)CtlObj_GetDataBrowserSortProperty, 1, |
|
3713 PyDoc_STR("() -> (UInt32 property)")}, |
|
3714 {"SetDataBrowserSelectionFlags", (PyCFunction)CtlObj_SetDataBrowserSelectionFlags, 1, |
|
3715 PyDoc_STR("(UInt32 selectionFlags) -> None")}, |
|
3716 {"GetDataBrowserSelectionFlags", (PyCFunction)CtlObj_GetDataBrowserSelectionFlags, 1, |
|
3717 PyDoc_STR("() -> (UInt32 selectionFlags)")}, |
|
3718 {"SetDataBrowserPropertyFlags", (PyCFunction)CtlObj_SetDataBrowserPropertyFlags, 1, |
|
3719 PyDoc_STR("(UInt32 property, UInt32 flags) -> None")}, |
|
3720 {"GetDataBrowserPropertyFlags", (PyCFunction)CtlObj_GetDataBrowserPropertyFlags, 1, |
|
3721 PyDoc_STR("(UInt32 property) -> (UInt32 flags)")}, |
|
3722 {"SetDataBrowserEditText", (PyCFunction)CtlObj_SetDataBrowserEditText, 1, |
|
3723 PyDoc_STR("(CFStringRef text) -> None")}, |
|
3724 {"CopyDataBrowserEditText", (PyCFunction)CtlObj_CopyDataBrowserEditText, 1, |
|
3725 PyDoc_STR("() -> (CFStringRef text)")}, |
|
3726 {"GetDataBrowserEditText", (PyCFunction)CtlObj_GetDataBrowserEditText, 1, |
|
3727 PyDoc_STR("(CFMutableStringRef text) -> None")}, |
|
3728 {"SetDataBrowserEditItem", (PyCFunction)CtlObj_SetDataBrowserEditItem, 1, |
|
3729 PyDoc_STR("(UInt32 item, UInt32 property) -> None")}, |
|
3730 {"GetDataBrowserEditItem", (PyCFunction)CtlObj_GetDataBrowserEditItem, 1, |
|
3731 PyDoc_STR("() -> (UInt32 item, UInt32 property)")}, |
|
3732 {"GetDataBrowserItemPartBounds", (PyCFunction)CtlObj_GetDataBrowserItemPartBounds, 1, |
|
3733 PyDoc_STR("(UInt32 item, UInt32 property, OSType part) -> (Rect bounds)")}, |
|
3734 {"RemoveDataBrowserTableViewColumn", (PyCFunction)CtlObj_RemoveDataBrowserTableViewColumn, 1, |
|
3735 PyDoc_STR("(UInt32 column) -> None")}, |
|
3736 {"GetDataBrowserTableViewColumnCount", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnCount, 1, |
|
3737 PyDoc_STR("() -> (UInt32 numColumns)")}, |
|
3738 {"SetDataBrowserTableViewHiliteStyle", (PyCFunction)CtlObj_SetDataBrowserTableViewHiliteStyle, 1, |
|
3739 PyDoc_STR("(UInt32 hiliteStyle) -> None")}, |
|
3740 {"GetDataBrowserTableViewHiliteStyle", (PyCFunction)CtlObj_GetDataBrowserTableViewHiliteStyle, 1, |
|
3741 PyDoc_STR("() -> (UInt32 hiliteStyle)")}, |
|
3742 {"SetDataBrowserTableViewRowHeight", (PyCFunction)CtlObj_SetDataBrowserTableViewRowHeight, 1, |
|
3743 PyDoc_STR("(UInt16 height) -> None")}, |
|
3744 {"GetDataBrowserTableViewRowHeight", (PyCFunction)CtlObj_GetDataBrowserTableViewRowHeight, 1, |
|
3745 PyDoc_STR("() -> (UInt16 height)")}, |
|
3746 {"SetDataBrowserTableViewColumnWidth", (PyCFunction)CtlObj_SetDataBrowserTableViewColumnWidth, 1, |
|
3747 PyDoc_STR("(UInt16 width) -> None")}, |
|
3748 {"GetDataBrowserTableViewColumnWidth", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnWidth, 1, |
|
3749 PyDoc_STR("() -> (UInt16 width)")}, |
|
3750 {"SetDataBrowserTableViewItemRowHeight", (PyCFunction)CtlObj_SetDataBrowserTableViewItemRowHeight, 1, |
|
3751 PyDoc_STR("(UInt32 item, UInt16 height) -> None")}, |
|
3752 {"GetDataBrowserTableViewItemRowHeight", (PyCFunction)CtlObj_GetDataBrowserTableViewItemRowHeight, 1, |
|
3753 PyDoc_STR("(UInt32 item) -> (UInt16 height)")}, |
|
3754 {"SetDataBrowserTableViewNamedColumnWidth", (PyCFunction)CtlObj_SetDataBrowserTableViewNamedColumnWidth, 1, |
|
3755 PyDoc_STR("(UInt32 column, UInt16 width) -> None")}, |
|
3756 {"GetDataBrowserTableViewNamedColumnWidth", (PyCFunction)CtlObj_GetDataBrowserTableViewNamedColumnWidth, 1, |
|
3757 PyDoc_STR("(UInt32 column) -> (UInt16 width)")}, |
|
3758 {"SetDataBrowserTableViewGeometry", (PyCFunction)CtlObj_SetDataBrowserTableViewGeometry, 1, |
|
3759 PyDoc_STR("(Boolean variableWidthColumns, Boolean variableHeightRows) -> None")}, |
|
3760 {"GetDataBrowserTableViewGeometry", (PyCFunction)CtlObj_GetDataBrowserTableViewGeometry, 1, |
|
3761 PyDoc_STR("() -> (Boolean variableWidthColumns, Boolean variableHeightRows)")}, |
|
3762 {"GetDataBrowserTableViewItemID", (PyCFunction)CtlObj_GetDataBrowserTableViewItemID, 1, |
|
3763 PyDoc_STR("(UInt32 row) -> (UInt32 item)")}, |
|
3764 {"SetDataBrowserTableViewItemRow", (PyCFunction)CtlObj_SetDataBrowserTableViewItemRow, 1, |
|
3765 PyDoc_STR("(UInt32 item, UInt32 row) -> None")}, |
|
3766 {"GetDataBrowserTableViewItemRow", (PyCFunction)CtlObj_GetDataBrowserTableViewItemRow, 1, |
|
3767 PyDoc_STR("(UInt32 item) -> (UInt32 row)")}, |
|
3768 {"SetDataBrowserTableViewColumnPosition", (PyCFunction)CtlObj_SetDataBrowserTableViewColumnPosition, 1, |
|
3769 PyDoc_STR("(UInt32 column, UInt32 position) -> None")}, |
|
3770 {"GetDataBrowserTableViewColumnPosition", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnPosition, 1, |
|
3771 PyDoc_STR("(UInt32 column) -> (UInt32 position)")}, |
|
3772 {"GetDataBrowserTableViewColumnProperty", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnProperty, 1, |
|
3773 PyDoc_STR("(UInt32 column) -> (UInt32 property)")}, |
|
3774 {"AutoSizeDataBrowserListViewColumns", (PyCFunction)CtlObj_AutoSizeDataBrowserListViewColumns, 1, |
|
3775 PyDoc_STR("() -> None")}, |
|
3776 {"AddDataBrowserListViewColumn", (PyCFunction)CtlObj_AddDataBrowserListViewColumn, 1, |
|
3777 PyDoc_STR("(DataBrowserListViewColumnDesc columnDesc, UInt32 position) -> None")}, |
|
3778 {"SetDataBrowserListViewHeaderBtnHeight", (PyCFunction)CtlObj_SetDataBrowserListViewHeaderBtnHeight, 1, |
|
3779 PyDoc_STR("(UInt16 height) -> None")}, |
|
3780 {"GetDataBrowserListViewHeaderBtnHeight", (PyCFunction)CtlObj_GetDataBrowserListViewHeaderBtnHeight, 1, |
|
3781 PyDoc_STR("() -> (UInt16 height)")}, |
|
3782 {"SetDataBrowserListViewUsePlainBackground", (PyCFunction)CtlObj_SetDataBrowserListViewUsePlainBackground, 1, |
|
3783 PyDoc_STR("(Boolean usePlainBackground) -> None")}, |
|
3784 {"GetDataBrowserListViewUsePlainBackground", (PyCFunction)CtlObj_GetDataBrowserListViewUsePlainBackground, 1, |
|
3785 PyDoc_STR("() -> (Boolean usePlainBackground)")}, |
|
3786 {"SetDataBrowserListViewDisclosureColumn", (PyCFunction)CtlObj_SetDataBrowserListViewDisclosureColumn, 1, |
|
3787 PyDoc_STR("(UInt32 column, Boolean expandableRows) -> None")}, |
|
3788 {"GetDataBrowserListViewDisclosureColumn", (PyCFunction)CtlObj_GetDataBrowserListViewDisclosureColumn, 1, |
|
3789 PyDoc_STR("() -> (UInt32 column, Boolean expandableRows)")}, |
|
3790 {"GetDataBrowserColumnViewPath", (PyCFunction)CtlObj_GetDataBrowserColumnViewPath, 1, |
|
3791 PyDoc_STR("(Handle path) -> None")}, |
|
3792 {"GetDataBrowserColumnViewPathLength", (PyCFunction)CtlObj_GetDataBrowserColumnViewPathLength, 1, |
|
3793 PyDoc_STR("() -> (UInt32 pathLength)")}, |
|
3794 {"SetDataBrowserColumnViewDisplayType", (PyCFunction)CtlObj_SetDataBrowserColumnViewDisplayType, 1, |
|
3795 PyDoc_STR("(OSType propertyType) -> None")}, |
|
3796 {"GetDataBrowserColumnViewDisplayType", (PyCFunction)CtlObj_GetDataBrowserColumnViewDisplayType, 1, |
|
3797 PyDoc_STR("() -> (OSType propertyType)")}, |
|
3798 {"as_Resource", (PyCFunction)CtlObj_as_Resource, 1, |
|
3799 PyDoc_STR("() -> (Handle _rv)")}, |
|
3800 {"GetControlRect", (PyCFunction)CtlObj_GetControlRect, 1, |
|
3801 PyDoc_STR("() -> (Rect rect)")}, |
|
3802 {"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1, |
|
3803 PyDoc_STR("() -> None")}, |
|
3804 {"TrackControl", (PyCFunction)CtlObj_TrackControl, 1, |
|
3805 PyDoc_STR("(Point startPoint [,trackercallback]) -> (ControlPartCode _rv)")}, |
|
3806 {"HandleControlClick", (PyCFunction)CtlObj_HandleControlClick, 1, |
|
3807 PyDoc_STR("(Point startPoint, Integer modifiers, [,trackercallback]) -> (ControlPartCode _rv)")}, |
|
3808 {"SetControlData", (PyCFunction)CtlObj_SetControlData, 1, |
|
3809 PyDoc_STR("(stuff) -> None")}, |
|
3810 {"GetControlData", (PyCFunction)CtlObj_GetControlData, 1, |
|
3811 PyDoc_STR("(part, type) -> String")}, |
|
3812 {"SetControlData_Handle", (PyCFunction)CtlObj_SetControlData_Handle, 1, |
|
3813 PyDoc_STR("(ResObj) -> None")}, |
|
3814 {"GetControlData_Handle", (PyCFunction)CtlObj_GetControlData_Handle, 1, |
|
3815 PyDoc_STR("(part, type) -> ResObj")}, |
|
3816 {"SetControlData_Callback", (PyCFunction)CtlObj_SetControlData_Callback, 1, |
|
3817 PyDoc_STR("(callbackfunc) -> None")}, |
|
3818 {NULL, NULL, 0} |
|
3819 }; |
|
3820 |
|
3821 #define CtlObj_getsetlist NULL |
|
3822 |
|
3823 |
|
3824 static int CtlObj_compare(ControlObject *self, ControlObject *other) |
|
3825 { |
|
3826 unsigned long v, w; |
|
3827 |
|
3828 if (!CtlObj_Check((PyObject *)other)) |
|
3829 { |
|
3830 v=(unsigned long)self; |
|
3831 w=(unsigned long)other; |
|
3832 } |
|
3833 else |
|
3834 { |
|
3835 v=(unsigned long)self->ob_itself; |
|
3836 w=(unsigned long)other->ob_itself; |
|
3837 } |
|
3838 if( v < w ) return -1; |
|
3839 if( v > w ) return 1; |
|
3840 return 0; |
|
3841 } |
|
3842 |
|
3843 #define CtlObj_repr NULL |
|
3844 |
|
3845 static long CtlObj_hash(ControlObject *self) |
|
3846 { |
|
3847 return (long)self->ob_itself; |
|
3848 } |
|
3849 #define CtlObj_tp_init 0 |
|
3850 |
|
3851 #define CtlObj_tp_alloc PyType_GenericAlloc |
|
3852 |
|
3853 static PyObject *CtlObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds) |
|
3854 { |
|
3855 PyObject *_self; |
|
3856 ControlHandle itself; |
|
3857 char *kw[] = {"itself", 0}; |
|
3858 |
|
3859 if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CtlObj_Convert, &itself)) return NULL; |
|
3860 if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL; |
|
3861 ((ControlObject *)_self)->ob_itself = itself; |
|
3862 return _self; |
|
3863 } |
|
3864 |
|
3865 #define CtlObj_tp_free PyObject_Del |
|
3866 |
|
3867 |
|
3868 PyTypeObject Control_Type = { |
|
3869 PyObject_HEAD_INIT(NULL) |
|
3870 0, /*ob_size*/ |
|
3871 "_Ctl.Control", /*tp_name*/ |
|
3872 sizeof(ControlObject), /*tp_basicsize*/ |
|
3873 0, /*tp_itemsize*/ |
|
3874 /* methods */ |
|
3875 (destructor) CtlObj_dealloc, /*tp_dealloc*/ |
|
3876 0, /*tp_print*/ |
|
3877 (getattrfunc)0, /*tp_getattr*/ |
|
3878 (setattrfunc)0, /*tp_setattr*/ |
|
3879 (cmpfunc) CtlObj_compare, /*tp_compare*/ |
|
3880 (reprfunc) CtlObj_repr, /*tp_repr*/ |
|
3881 (PyNumberMethods *)0, /* tp_as_number */ |
|
3882 (PySequenceMethods *)0, /* tp_as_sequence */ |
|
3883 (PyMappingMethods *)0, /* tp_as_mapping */ |
|
3884 (hashfunc) CtlObj_hash, /*tp_hash*/ |
|
3885 0, /*tp_call*/ |
|
3886 0, /*tp_str*/ |
|
3887 PyObject_GenericGetAttr, /*tp_getattro*/ |
|
3888 PyObject_GenericSetAttr, /*tp_setattro */ |
|
3889 0, /*tp_as_buffer*/ |
|
3890 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|
3891 0, /*tp_doc*/ |
|
3892 0, /*tp_traverse*/ |
|
3893 0, /*tp_clear*/ |
|
3894 0, /*tp_richcompare*/ |
|
3895 0, /*tp_weaklistoffset*/ |
|
3896 0, /*tp_iter*/ |
|
3897 0, /*tp_iternext*/ |
|
3898 CtlObj_methods, /* tp_methods */ |
|
3899 0, /*tp_members*/ |
|
3900 CtlObj_getsetlist, /*tp_getset*/ |
|
3901 0, /*tp_base*/ |
|
3902 0, /*tp_dict*/ |
|
3903 0, /*tp_descr_get*/ |
|
3904 0, /*tp_descr_set*/ |
|
3905 0, /*tp_dictoffset*/ |
|
3906 CtlObj_tp_init, /* tp_init */ |
|
3907 CtlObj_tp_alloc, /* tp_alloc */ |
|
3908 CtlObj_tp_new, /* tp_new */ |
|
3909 CtlObj_tp_free, /* tp_free */ |
|
3910 }; |
|
3911 |
|
3912 /* -------------------- End object type Control --------------------- */ |
|
3913 |
|
3914 |
|
3915 static PyObject *Ctl_NewControl(PyObject *_self, PyObject *_args) |
|
3916 { |
|
3917 PyObject *_res = NULL; |
|
3918 ControlHandle _rv; |
|
3919 WindowPtr owningWindow; |
|
3920 Rect boundsRect; |
|
3921 Str255 controlTitle; |
|
3922 Boolean initiallyVisible; |
|
3923 SInt16 initialValue; |
|
3924 SInt16 minimumValue; |
|
3925 SInt16 maximumValue; |
|
3926 SInt16 procID; |
|
3927 SInt32 controlReference; |
|
3928 #ifndef NewControl |
|
3929 PyMac_PRECHECK(NewControl); |
|
3930 #endif |
|
3931 if (!PyArg_ParseTuple(_args, "O&O&O&bhhhhl", |
|
3932 WinObj_Convert, &owningWindow, |
|
3933 PyMac_GetRect, &boundsRect, |
|
3934 PyMac_GetStr255, controlTitle, |
|
3935 &initiallyVisible, |
|
3936 &initialValue, |
|
3937 &minimumValue, |
|
3938 &maximumValue, |
|
3939 &procID, |
|
3940 &controlReference)) |
|
3941 return NULL; |
|
3942 _rv = NewControl(owningWindow, |
|
3943 &boundsRect, |
|
3944 controlTitle, |
|
3945 initiallyVisible, |
|
3946 initialValue, |
|
3947 minimumValue, |
|
3948 maximumValue, |
|
3949 procID, |
|
3950 controlReference); |
|
3951 _res = Py_BuildValue("O&", |
|
3952 CtlObj_New, _rv); |
|
3953 return _res; |
|
3954 } |
|
3955 |
|
3956 static PyObject *Ctl_GetNewControl(PyObject *_self, PyObject *_args) |
|
3957 { |
|
3958 PyObject *_res = NULL; |
|
3959 ControlHandle _rv; |
|
3960 SInt16 resourceID; |
|
3961 WindowPtr owningWindow; |
|
3962 #ifndef GetNewControl |
|
3963 PyMac_PRECHECK(GetNewControl); |
|
3964 #endif |
|
3965 if (!PyArg_ParseTuple(_args, "hO&", |
|
3966 &resourceID, |
|
3967 WinObj_Convert, &owningWindow)) |
|
3968 return NULL; |
|
3969 _rv = GetNewControl(resourceID, |
|
3970 owningWindow); |
|
3971 _res = Py_BuildValue("O&", |
|
3972 CtlObj_New, _rv); |
|
3973 return _res; |
|
3974 } |
|
3975 |
|
3976 static PyObject *Ctl_DrawControls(PyObject *_self, PyObject *_args) |
|
3977 { |
|
3978 PyObject *_res = NULL; |
|
3979 WindowPtr theWindow; |
|
3980 #ifndef DrawControls |
|
3981 PyMac_PRECHECK(DrawControls); |
|
3982 #endif |
|
3983 if (!PyArg_ParseTuple(_args, "O&", |
|
3984 WinObj_Convert, &theWindow)) |
|
3985 return NULL; |
|
3986 DrawControls(theWindow); |
|
3987 Py_INCREF(Py_None); |
|
3988 _res = Py_None; |
|
3989 return _res; |
|
3990 } |
|
3991 |
|
3992 static PyObject *Ctl_UpdateControls(PyObject *_self, PyObject *_args) |
|
3993 { |
|
3994 PyObject *_res = NULL; |
|
3995 WindowPtr inWindow; |
|
3996 RgnHandle inUpdateRegion; |
|
3997 #ifndef UpdateControls |
|
3998 PyMac_PRECHECK(UpdateControls); |
|
3999 #endif |
|
4000 if (!PyArg_ParseTuple(_args, "O&O&", |
|
4001 WinObj_Convert, &inWindow, |
|
4002 ResObj_Convert, &inUpdateRegion)) |
|
4003 return NULL; |
|
4004 UpdateControls(inWindow, |
|
4005 inUpdateRegion); |
|
4006 Py_INCREF(Py_None); |
|
4007 _res = Py_None; |
|
4008 return _res; |
|
4009 } |
|
4010 |
|
4011 static PyObject *Ctl_FindControl(PyObject *_self, PyObject *_args) |
|
4012 { |
|
4013 PyObject *_res = NULL; |
|
4014 ControlPartCode _rv; |
|
4015 Point testPoint; |
|
4016 WindowPtr theWindow; |
|
4017 ControlHandle theControl; |
|
4018 #ifndef FindControl |
|
4019 PyMac_PRECHECK(FindControl); |
|
4020 #endif |
|
4021 if (!PyArg_ParseTuple(_args, "O&O&", |
|
4022 PyMac_GetPoint, &testPoint, |
|
4023 WinObj_Convert, &theWindow)) |
|
4024 return NULL; |
|
4025 _rv = FindControl(testPoint, |
|
4026 theWindow, |
|
4027 &theControl); |
|
4028 _res = Py_BuildValue("hO&", |
|
4029 _rv, |
|
4030 CtlObj_WhichControl, theControl); |
|
4031 return _res; |
|
4032 } |
|
4033 |
|
4034 static PyObject *Ctl_IdleControls(PyObject *_self, PyObject *_args) |
|
4035 { |
|
4036 PyObject *_res = NULL; |
|
4037 WindowPtr inWindow; |
|
4038 #ifndef IdleControls |
|
4039 PyMac_PRECHECK(IdleControls); |
|
4040 #endif |
|
4041 if (!PyArg_ParseTuple(_args, "O&", |
|
4042 WinObj_Convert, &inWindow)) |
|
4043 return NULL; |
|
4044 IdleControls(inWindow); |
|
4045 Py_INCREF(Py_None); |
|
4046 _res = Py_None; |
|
4047 return _res; |
|
4048 } |
|
4049 |
|
4050 static PyObject *Ctl_GetControlByID(PyObject *_self, PyObject *_args) |
|
4051 { |
|
4052 PyObject *_res = NULL; |
|
4053 OSStatus _err; |
|
4054 WindowPtr inWindow; |
|
4055 ControlID inID; |
|
4056 ControlHandle outControl; |
|
4057 #ifndef GetControlByID |
|
4058 PyMac_PRECHECK(GetControlByID); |
|
4059 #endif |
|
4060 if (!PyArg_ParseTuple(_args, "O&O&", |
|
4061 WinObj_Convert, &inWindow, |
|
4062 PyControlID_Convert, &inID)) |
|
4063 return NULL; |
|
4064 _err = GetControlByID(inWindow, |
|
4065 &inID, |
|
4066 &outControl); |
|
4067 if (_err != noErr) return PyMac_Error(_err); |
|
4068 _res = Py_BuildValue("O&", |
|
4069 CtlObj_WhichControl, outControl); |
|
4070 return _res; |
|
4071 } |
|
4072 |
|
4073 static PyObject *Ctl_DumpControlHierarchy(PyObject *_self, PyObject *_args) |
|
4074 { |
|
4075 PyObject *_res = NULL; |
|
4076 OSErr _err; |
|
4077 WindowPtr inWindow; |
|
4078 FSSpec inDumpFile; |
|
4079 #ifndef DumpControlHierarchy |
|
4080 PyMac_PRECHECK(DumpControlHierarchy); |
|
4081 #endif |
|
4082 if (!PyArg_ParseTuple(_args, "O&O&", |
|
4083 WinObj_Convert, &inWindow, |
|
4084 PyMac_GetFSSpec, &inDumpFile)) |
|
4085 return NULL; |
|
4086 _err = DumpControlHierarchy(inWindow, |
|
4087 &inDumpFile); |
|
4088 if (_err != noErr) return PyMac_Error(_err); |
|
4089 Py_INCREF(Py_None); |
|
4090 _res = Py_None; |
|
4091 return _res; |
|
4092 } |
|
4093 |
|
4094 static PyObject *Ctl_CreateRootControl(PyObject *_self, PyObject *_args) |
|
4095 { |
|
4096 PyObject *_res = NULL; |
|
4097 OSErr _err; |
|
4098 WindowPtr inWindow; |
|
4099 ControlHandle outControl; |
|
4100 #ifndef CreateRootControl |
|
4101 PyMac_PRECHECK(CreateRootControl); |
|
4102 #endif |
|
4103 if (!PyArg_ParseTuple(_args, "O&", |
|
4104 WinObj_Convert, &inWindow)) |
|
4105 return NULL; |
|
4106 _err = CreateRootControl(inWindow, |
|
4107 &outControl); |
|
4108 if (_err != noErr) return PyMac_Error(_err); |
|
4109 _res = Py_BuildValue("O&", |
|
4110 CtlObj_New, outControl); |
|
4111 return _res; |
|
4112 } |
|
4113 |
|
4114 static PyObject *Ctl_GetRootControl(PyObject *_self, PyObject *_args) |
|
4115 { |
|
4116 PyObject *_res = NULL; |
|
4117 OSErr _err; |
|
4118 WindowPtr inWindow; |
|
4119 ControlHandle outControl; |
|
4120 #ifndef GetRootControl |
|
4121 PyMac_PRECHECK(GetRootControl); |
|
4122 #endif |
|
4123 if (!PyArg_ParseTuple(_args, "O&", |
|
4124 WinObj_Convert, &inWindow)) |
|
4125 return NULL; |
|
4126 _err = GetRootControl(inWindow, |
|
4127 &outControl); |
|
4128 if (_err != noErr) return PyMac_Error(_err); |
|
4129 _res = Py_BuildValue("O&", |
|
4130 CtlObj_WhichControl, outControl); |
|
4131 return _res; |
|
4132 } |
|
4133 |
|
4134 static PyObject *Ctl_GetKeyboardFocus(PyObject *_self, PyObject *_args) |
|
4135 { |
|
4136 PyObject *_res = NULL; |
|
4137 OSErr _err; |
|
4138 WindowPtr inWindow; |
|
4139 ControlHandle outControl; |
|
4140 #ifndef GetKeyboardFocus |
|
4141 PyMac_PRECHECK(GetKeyboardFocus); |
|
4142 #endif |
|
4143 if (!PyArg_ParseTuple(_args, "O&", |
|
4144 WinObj_Convert, &inWindow)) |
|
4145 return NULL; |
|
4146 _err = GetKeyboardFocus(inWindow, |
|
4147 &outControl); |
|
4148 if (_err != noErr) return PyMac_Error(_err); |
|
4149 _res = Py_BuildValue("O&", |
|
4150 CtlObj_WhichControl, outControl); |
|
4151 return _res; |
|
4152 } |
|
4153 |
|
4154 static PyObject *Ctl_SetKeyboardFocus(PyObject *_self, PyObject *_args) |
|
4155 { |
|
4156 PyObject *_res = NULL; |
|
4157 OSErr _err; |
|
4158 WindowPtr inWindow; |
|
4159 ControlHandle inControl; |
|
4160 ControlFocusPart inPart; |
|
4161 #ifndef SetKeyboardFocus |
|
4162 PyMac_PRECHECK(SetKeyboardFocus); |
|
4163 #endif |
|
4164 if (!PyArg_ParseTuple(_args, "O&O&h", |
|
4165 WinObj_Convert, &inWindow, |
|
4166 CtlObj_Convert, &inControl, |
|
4167 &inPart)) |
|
4168 return NULL; |
|
4169 _err = SetKeyboardFocus(inWindow, |
|
4170 inControl, |
|
4171 inPart); |
|
4172 if (_err != noErr) return PyMac_Error(_err); |
|
4173 Py_INCREF(Py_None); |
|
4174 _res = Py_None; |
|
4175 return _res; |
|
4176 } |
|
4177 |
|
4178 static PyObject *Ctl_AdvanceKeyboardFocus(PyObject *_self, PyObject *_args) |
|
4179 { |
|
4180 PyObject *_res = NULL; |
|
4181 OSErr _err; |
|
4182 WindowPtr inWindow; |
|
4183 #ifndef AdvanceKeyboardFocus |
|
4184 PyMac_PRECHECK(AdvanceKeyboardFocus); |
|
4185 #endif |
|
4186 if (!PyArg_ParseTuple(_args, "O&", |
|
4187 WinObj_Convert, &inWindow)) |
|
4188 return NULL; |
|
4189 _err = AdvanceKeyboardFocus(inWindow); |
|
4190 if (_err != noErr) return PyMac_Error(_err); |
|
4191 Py_INCREF(Py_None); |
|
4192 _res = Py_None; |
|
4193 return _res; |
|
4194 } |
|
4195 |
|
4196 static PyObject *Ctl_ReverseKeyboardFocus(PyObject *_self, PyObject *_args) |
|
4197 { |
|
4198 PyObject *_res = NULL; |
|
4199 OSErr _err; |
|
4200 WindowPtr inWindow; |
|
4201 #ifndef ReverseKeyboardFocus |
|
4202 PyMac_PRECHECK(ReverseKeyboardFocus); |
|
4203 #endif |
|
4204 if (!PyArg_ParseTuple(_args, "O&", |
|
4205 WinObj_Convert, &inWindow)) |
|
4206 return NULL; |
|
4207 _err = ReverseKeyboardFocus(inWindow); |
|
4208 if (_err != noErr) return PyMac_Error(_err); |
|
4209 Py_INCREF(Py_None); |
|
4210 _res = Py_None; |
|
4211 return _res; |
|
4212 } |
|
4213 |
|
4214 static PyObject *Ctl_ClearKeyboardFocus(PyObject *_self, PyObject *_args) |
|
4215 { |
|
4216 PyObject *_res = NULL; |
|
4217 OSErr _err; |
|
4218 WindowPtr inWindow; |
|
4219 #ifndef ClearKeyboardFocus |
|
4220 PyMac_PRECHECK(ClearKeyboardFocus); |
|
4221 #endif |
|
4222 if (!PyArg_ParseTuple(_args, "O&", |
|
4223 WinObj_Convert, &inWindow)) |
|
4224 return NULL; |
|
4225 _err = ClearKeyboardFocus(inWindow); |
|
4226 if (_err != noErr) return PyMac_Error(_err); |
|
4227 Py_INCREF(Py_None); |
|
4228 _res = Py_None; |
|
4229 return _res; |
|
4230 } |
|
4231 |
|
4232 static PyObject *Ctl_SetAutomaticControlDragTrackingEnabledForWindow(PyObject *_self, PyObject *_args) |
|
4233 { |
|
4234 PyObject *_res = NULL; |
|
4235 OSStatus _err; |
|
4236 WindowPtr inWindow; |
|
4237 Boolean inTracks; |
|
4238 #ifndef SetAutomaticControlDragTrackingEnabledForWindow |
|
4239 PyMac_PRECHECK(SetAutomaticControlDragTrackingEnabledForWindow); |
|
4240 #endif |
|
4241 if (!PyArg_ParseTuple(_args, "O&b", |
|
4242 WinObj_Convert, &inWindow, |
|
4243 &inTracks)) |
|
4244 return NULL; |
|
4245 _err = SetAutomaticControlDragTrackingEnabledForWindow(inWindow, |
|
4246 inTracks); |
|
4247 if (_err != noErr) return PyMac_Error(_err); |
|
4248 Py_INCREF(Py_None); |
|
4249 _res = Py_None; |
|
4250 return _res; |
|
4251 } |
|
4252 |
|
4253 static PyObject *Ctl_IsAutomaticControlDragTrackingEnabledForWindow(PyObject *_self, PyObject *_args) |
|
4254 { |
|
4255 PyObject *_res = NULL; |
|
4256 OSStatus _err; |
|
4257 WindowPtr inWindow; |
|
4258 Boolean outTracks; |
|
4259 #ifndef IsAutomaticControlDragTrackingEnabledForWindow |
|
4260 PyMac_PRECHECK(IsAutomaticControlDragTrackingEnabledForWindow); |
|
4261 #endif |
|
4262 if (!PyArg_ParseTuple(_args, "O&", |
|
4263 WinObj_Convert, &inWindow)) |
|
4264 return NULL; |
|
4265 _err = IsAutomaticControlDragTrackingEnabledForWindow(inWindow, |
|
4266 &outTracks); |
|
4267 if (_err != noErr) return PyMac_Error(_err); |
|
4268 _res = Py_BuildValue("b", |
|
4269 outTracks); |
|
4270 return _res; |
|
4271 } |
|
4272 |
|
4273 static PyObject *Ctl_CreateBevelButtonControl(PyObject *_self, PyObject *_args) |
|
4274 { |
|
4275 PyObject *_res = NULL; |
|
4276 OSStatus _err; |
|
4277 WindowPtr window; |
|
4278 Rect boundsRect; |
|
4279 CFStringRef title; |
|
4280 UInt16 thickness; |
|
4281 UInt16 behavior; |
|
4282 ControlButtonContentInfo info; |
|
4283 SInt16 menuID; |
|
4284 UInt16 menuBehavior; |
|
4285 UInt16 menuPlacement; |
|
4286 ControlHandle outControl; |
|
4287 #ifndef CreateBevelButtonControl |
|
4288 PyMac_PRECHECK(CreateBevelButtonControl); |
|
4289 #endif |
|
4290 if (!PyArg_ParseTuple(_args, "O&O&O&HHO&hHH", |
|
4291 WinObj_Convert, &window, |
|
4292 PyMac_GetRect, &boundsRect, |
|
4293 CFStringRefObj_Convert, &title, |
|
4294 &thickness, |
|
4295 &behavior, |
|
4296 ControlButtonContentInfo_Convert, &info, |
|
4297 &menuID, |
|
4298 &menuBehavior, |
|
4299 &menuPlacement)) |
|
4300 return NULL; |
|
4301 _err = CreateBevelButtonControl(window, |
|
4302 &boundsRect, |
|
4303 title, |
|
4304 thickness, |
|
4305 behavior, |
|
4306 &info, |
|
4307 menuID, |
|
4308 menuBehavior, |
|
4309 menuPlacement, |
|
4310 &outControl); |
|
4311 if (_err != noErr) return PyMac_Error(_err); |
|
4312 _res = Py_BuildValue("O&", |
|
4313 CtlObj_New, outControl); |
|
4314 return _res; |
|
4315 } |
|
4316 |
|
4317 static PyObject *Ctl_CreateSliderControl(PyObject *_self, PyObject *_args) |
|
4318 { |
|
4319 PyObject *_res = NULL; |
|
4320 OSStatus _err; |
|
4321 WindowPtr window; |
|
4322 Rect boundsRect; |
|
4323 SInt32 value; |
|
4324 SInt32 minimum; |
|
4325 SInt32 maximum; |
|
4326 UInt16 orientation; |
|
4327 UInt16 numTickMarks; |
|
4328 Boolean liveTracking; |
|
4329 PyObject* liveTrackingProc; |
|
4330 UniversalProcPtr c_callback; |
|
4331 ControlHandle outControl; |
|
4332 #ifndef CreateSliderControl |
|
4333 PyMac_PRECHECK(CreateSliderControl); |
|
4334 #endif |
|
4335 if (!PyArg_ParseTuple(_args, "O&O&lllHHbO", |
|
4336 WinObj_Convert, &window, |
|
4337 PyMac_GetRect, &boundsRect, |
|
4338 &value, |
|
4339 &minimum, |
|
4340 &maximum, |
|
4341 &orientation, |
|
4342 &numTickMarks, |
|
4343 &liveTracking, |
|
4344 &liveTrackingProc)) |
|
4345 return NULL; |
|
4346 _err = CreateSliderControl(window, |
|
4347 &boundsRect, |
|
4348 value, |
|
4349 minimum, |
|
4350 maximum, |
|
4351 orientation, |
|
4352 numTickMarks, |
|
4353 liveTracking, |
|
4354 myactionproc_upp, |
|
4355 &outControl); |
|
4356 if (_err != noErr) return PyMac_Error(_err); |
|
4357 _res = Py_BuildValue("O&", |
|
4358 CtlObj_New, outControl); |
|
4359 setcallback(_res, kMyControlActionProcTag, liveTrackingProc, &c_callback); |
|
4360 return _res; |
|
4361 } |
|
4362 |
|
4363 static PyObject *Ctl_CreateDisclosureTriangleControl(PyObject *_self, PyObject *_args) |
|
4364 { |
|
4365 PyObject *_res = NULL; |
|
4366 OSStatus _err; |
|
4367 WindowPtr inWindow; |
|
4368 Rect inBoundsRect; |
|
4369 UInt16 inOrientation; |
|
4370 CFStringRef inTitle; |
|
4371 SInt32 inInitialValue; |
|
4372 Boolean inDrawTitle; |
|
4373 Boolean inAutoToggles; |
|
4374 ControlHandle outControl; |
|
4375 #ifndef CreateDisclosureTriangleControl |
|
4376 PyMac_PRECHECK(CreateDisclosureTriangleControl); |
|
4377 #endif |
|
4378 if (!PyArg_ParseTuple(_args, "O&O&HO&lbb", |
|
4379 WinObj_Convert, &inWindow, |
|
4380 PyMac_GetRect, &inBoundsRect, |
|
4381 &inOrientation, |
|
4382 CFStringRefObj_Convert, &inTitle, |
|
4383 &inInitialValue, |
|
4384 &inDrawTitle, |
|
4385 &inAutoToggles)) |
|
4386 return NULL; |
|
4387 _err = CreateDisclosureTriangleControl(inWindow, |
|
4388 &inBoundsRect, |
|
4389 inOrientation, |
|
4390 inTitle, |
|
4391 inInitialValue, |
|
4392 inDrawTitle, |
|
4393 inAutoToggles, |
|
4394 &outControl); |
|
4395 if (_err != noErr) return PyMac_Error(_err); |
|
4396 _res = Py_BuildValue("O&", |
|
4397 CtlObj_New, outControl); |
|
4398 return _res; |
|
4399 } |
|
4400 |
|
4401 static PyObject *Ctl_CreateProgressBarControl(PyObject *_self, PyObject *_args) |
|
4402 { |
|
4403 PyObject *_res = NULL; |
|
4404 OSStatus _err; |
|
4405 WindowPtr window; |
|
4406 Rect boundsRect; |
|
4407 SInt32 value; |
|
4408 SInt32 minimum; |
|
4409 SInt32 maximum; |
|
4410 Boolean indeterminate; |
|
4411 ControlHandle outControl; |
|
4412 #ifndef CreateProgressBarControl |
|
4413 PyMac_PRECHECK(CreateProgressBarControl); |
|
4414 #endif |
|
4415 if (!PyArg_ParseTuple(_args, "O&O&lllb", |
|
4416 WinObj_Convert, &window, |
|
4417 PyMac_GetRect, &boundsRect, |
|
4418 &value, |
|
4419 &minimum, |
|
4420 &maximum, |
|
4421 &indeterminate)) |
|
4422 return NULL; |
|
4423 _err = CreateProgressBarControl(window, |
|
4424 &boundsRect, |
|
4425 value, |
|
4426 minimum, |
|
4427 maximum, |
|
4428 indeterminate, |
|
4429 &outControl); |
|
4430 if (_err != noErr) return PyMac_Error(_err); |
|
4431 _res = Py_BuildValue("O&", |
|
4432 CtlObj_New, outControl); |
|
4433 return _res; |
|
4434 } |
|
4435 |
|
4436 static PyObject *Ctl_CreateRelevanceBarControl(PyObject *_self, PyObject *_args) |
|
4437 { |
|
4438 PyObject *_res = NULL; |
|
4439 OSStatus _err; |
|
4440 WindowPtr window; |
|
4441 Rect boundsRect; |
|
4442 SInt32 value; |
|
4443 SInt32 minimum; |
|
4444 SInt32 maximum; |
|
4445 ControlHandle outControl; |
|
4446 #ifndef CreateRelevanceBarControl |
|
4447 PyMac_PRECHECK(CreateRelevanceBarControl); |
|
4448 #endif |
|
4449 if (!PyArg_ParseTuple(_args, "O&O&lll", |
|
4450 WinObj_Convert, &window, |
|
4451 PyMac_GetRect, &boundsRect, |
|
4452 &value, |
|
4453 &minimum, |
|
4454 &maximum)) |
|
4455 return NULL; |
|
4456 _err = CreateRelevanceBarControl(window, |
|
4457 &boundsRect, |
|
4458 value, |
|
4459 minimum, |
|
4460 maximum, |
|
4461 &outControl); |
|
4462 if (_err != noErr) return PyMac_Error(_err); |
|
4463 _res = Py_BuildValue("O&", |
|
4464 CtlObj_New, outControl); |
|
4465 return _res; |
|
4466 } |
|
4467 |
|
4468 static PyObject *Ctl_CreateLittleArrowsControl(PyObject *_self, PyObject *_args) |
|
4469 { |
|
4470 PyObject *_res = NULL; |
|
4471 OSStatus _err; |
|
4472 WindowPtr window; |
|
4473 Rect boundsRect; |
|
4474 SInt32 value; |
|
4475 SInt32 minimum; |
|
4476 SInt32 maximum; |
|
4477 SInt32 increment; |
|
4478 ControlHandle outControl; |
|
4479 #ifndef CreateLittleArrowsControl |
|
4480 PyMac_PRECHECK(CreateLittleArrowsControl); |
|
4481 #endif |
|
4482 if (!PyArg_ParseTuple(_args, "O&O&llll", |
|
4483 WinObj_Convert, &window, |
|
4484 PyMac_GetRect, &boundsRect, |
|
4485 &value, |
|
4486 &minimum, |
|
4487 &maximum, |
|
4488 &increment)) |
|
4489 return NULL; |
|
4490 _err = CreateLittleArrowsControl(window, |
|
4491 &boundsRect, |
|
4492 value, |
|
4493 minimum, |
|
4494 maximum, |
|
4495 increment, |
|
4496 &outControl); |
|
4497 if (_err != noErr) return PyMac_Error(_err); |
|
4498 _res = Py_BuildValue("O&", |
|
4499 CtlObj_New, outControl); |
|
4500 return _res; |
|
4501 } |
|
4502 |
|
4503 static PyObject *Ctl_CreateChasingArrowsControl(PyObject *_self, PyObject *_args) |
|
4504 { |
|
4505 PyObject *_res = NULL; |
|
4506 OSStatus _err; |
|
4507 WindowPtr window; |
|
4508 Rect boundsRect; |
|
4509 ControlHandle outControl; |
|
4510 #ifndef CreateChasingArrowsControl |
|
4511 PyMac_PRECHECK(CreateChasingArrowsControl); |
|
4512 #endif |
|
4513 if (!PyArg_ParseTuple(_args, "O&O&", |
|
4514 WinObj_Convert, &window, |
|
4515 PyMac_GetRect, &boundsRect)) |
|
4516 return NULL; |
|
4517 _err = CreateChasingArrowsControl(window, |
|
4518 &boundsRect, |
|
4519 &outControl); |
|
4520 if (_err != noErr) return PyMac_Error(_err); |
|
4521 _res = Py_BuildValue("O&", |
|
4522 CtlObj_New, outControl); |
|
4523 return _res; |
|
4524 } |
|
4525 |
|
4526 static PyObject *Ctl_CreateSeparatorControl(PyObject *_self, PyObject *_args) |
|
4527 { |
|
4528 PyObject *_res = NULL; |
|
4529 OSStatus _err; |
|
4530 WindowPtr window; |
|
4531 Rect boundsRect; |
|
4532 ControlHandle outControl; |
|
4533 #ifndef CreateSeparatorControl |
|
4534 PyMac_PRECHECK(CreateSeparatorControl); |
|
4535 #endif |
|
4536 if (!PyArg_ParseTuple(_args, "O&O&", |
|
4537 WinObj_Convert, &window, |
|
4538 PyMac_GetRect, &boundsRect)) |
|
4539 return NULL; |
|
4540 _err = CreateSeparatorControl(window, |
|
4541 &boundsRect, |
|
4542 &outControl); |
|
4543 if (_err != noErr) return PyMac_Error(_err); |
|
4544 _res = Py_BuildValue("O&", |
|
4545 CtlObj_New, outControl); |
|
4546 return _res; |
|
4547 } |
|
4548 |
|
4549 static PyObject *Ctl_CreateGroupBoxControl(PyObject *_self, PyObject *_args) |
|
4550 { |
|
4551 PyObject *_res = NULL; |
|
4552 OSStatus _err; |
|
4553 WindowPtr window; |
|
4554 Rect boundsRect; |
|
4555 CFStringRef title; |
|
4556 Boolean primary; |
|
4557 ControlHandle outControl; |
|
4558 #ifndef CreateGroupBoxControl |
|
4559 PyMac_PRECHECK(CreateGroupBoxControl); |
|
4560 #endif |
|
4561 if (!PyArg_ParseTuple(_args, "O&O&O&b", |
|
4562 WinObj_Convert, &window, |
|
4563 PyMac_GetRect, &boundsRect, |
|
4564 CFStringRefObj_Convert, &title, |
|
4565 &primary)) |
|
4566 return NULL; |
|
4567 _err = CreateGroupBoxControl(window, |
|
4568 &boundsRect, |
|
4569 title, |
|
4570 primary, |
|
4571 &outControl); |
|
4572 if (_err != noErr) return PyMac_Error(_err); |
|
4573 _res = Py_BuildValue("O&", |
|
4574 CtlObj_New, outControl); |
|
4575 return _res; |
|
4576 } |
|
4577 |
|
4578 static PyObject *Ctl_CreateCheckGroupBoxControl(PyObject *_self, PyObject *_args) |
|
4579 { |
|
4580 PyObject *_res = NULL; |
|
4581 OSStatus _err; |
|
4582 WindowPtr window; |
|
4583 Rect boundsRect; |
|
4584 CFStringRef title; |
|
4585 SInt32 initialValue; |
|
4586 Boolean primary; |
|
4587 Boolean autoToggle; |
|
4588 ControlHandle outControl; |
|
4589 #ifndef CreateCheckGroupBoxControl |
|
4590 PyMac_PRECHECK(CreateCheckGroupBoxControl); |
|
4591 #endif |
|
4592 if (!PyArg_ParseTuple(_args, "O&O&O&lbb", |
|
4593 WinObj_Convert, &window, |
|
4594 PyMac_GetRect, &boundsRect, |
|
4595 CFStringRefObj_Convert, &title, |
|
4596 &initialValue, |
|
4597 &primary, |
|
4598 &autoToggle)) |
|
4599 return NULL; |
|
4600 _err = CreateCheckGroupBoxControl(window, |
|
4601 &boundsRect, |
|
4602 title, |
|
4603 initialValue, |
|
4604 primary, |
|
4605 autoToggle, |
|
4606 &outControl); |
|
4607 if (_err != noErr) return PyMac_Error(_err); |
|
4608 _res = Py_BuildValue("O&", |
|
4609 CtlObj_New, outControl); |
|
4610 return _res; |
|
4611 } |
|
4612 |
|
4613 static PyObject *Ctl_CreatePopupGroupBoxControl(PyObject *_self, PyObject *_args) |
|
4614 { |
|
4615 PyObject *_res = NULL; |
|
4616 OSStatus _err; |
|
4617 WindowPtr window; |
|
4618 Rect boundsRect; |
|
4619 CFStringRef title; |
|
4620 Boolean primary; |
|
4621 SInt16 menuID; |
|
4622 Boolean variableWidth; |
|
4623 SInt16 titleWidth; |
|
4624 SInt16 titleJustification; |
|
4625 Style titleStyle; |
|
4626 ControlHandle outControl; |
|
4627 #ifndef CreatePopupGroupBoxControl |
|
4628 PyMac_PRECHECK(CreatePopupGroupBoxControl); |
|
4629 #endif |
|
4630 if (!PyArg_ParseTuple(_args, "O&O&O&bhbhhb", |
|
4631 WinObj_Convert, &window, |
|
4632 PyMac_GetRect, &boundsRect, |
|
4633 CFStringRefObj_Convert, &title, |
|
4634 &primary, |
|
4635 &menuID, |
|
4636 &variableWidth, |
|
4637 &titleWidth, |
|
4638 &titleJustification, |
|
4639 &titleStyle)) |
|
4640 return NULL; |
|
4641 _err = CreatePopupGroupBoxControl(window, |
|
4642 &boundsRect, |
|
4643 title, |
|
4644 primary, |
|
4645 menuID, |
|
4646 variableWidth, |
|
4647 titleWidth, |
|
4648 titleJustification, |
|
4649 titleStyle, |
|
4650 &outControl); |
|
4651 if (_err != noErr) return PyMac_Error(_err); |
|
4652 _res = Py_BuildValue("O&", |
|
4653 CtlObj_New, outControl); |
|
4654 return _res; |
|
4655 } |
|
4656 |
|
4657 static PyObject *Ctl_CreateImageWellControl(PyObject *_self, PyObject *_args) |
|
4658 { |
|
4659 PyObject *_res = NULL; |
|
4660 OSStatus _err; |
|
4661 WindowPtr window; |
|
4662 Rect boundsRect; |
|
4663 ControlButtonContentInfo info; |
|
4664 ControlHandle outControl; |
|
4665 #ifndef CreateImageWellControl |
|
4666 PyMac_PRECHECK(CreateImageWellControl); |
|
4667 #endif |
|
4668 if (!PyArg_ParseTuple(_args, "O&O&O&", |
|
4669 WinObj_Convert, &window, |
|
4670 PyMac_GetRect, &boundsRect, |
|
4671 ControlButtonContentInfo_Convert, &info)) |
|
4672 return NULL; |
|
4673 _err = CreateImageWellControl(window, |
|
4674 &boundsRect, |
|
4675 &info, |
|
4676 &outControl); |
|
4677 if (_err != noErr) return PyMac_Error(_err); |
|
4678 _res = Py_BuildValue("O&", |
|
4679 CtlObj_New, outControl); |
|
4680 return _res; |
|
4681 } |
|
4682 |
|
4683 static PyObject *Ctl_CreatePopupArrowControl(PyObject *_self, PyObject *_args) |
|
4684 { |
|
4685 PyObject *_res = NULL; |
|
4686 OSStatus _err; |
|
4687 WindowPtr window; |
|
4688 Rect boundsRect; |
|
4689 UInt16 orientation; |
|
4690 UInt16 size; |
|
4691 ControlHandle outControl; |
|
4692 #ifndef CreatePopupArrowControl |
|
4693 PyMac_PRECHECK(CreatePopupArrowControl); |
|
4694 #endif |
|
4695 if (!PyArg_ParseTuple(_args, "O&O&HH", |
|
4696 WinObj_Convert, &window, |
|
4697 PyMac_GetRect, &boundsRect, |
|
4698 &orientation, |
|
4699 &size)) |
|
4700 return NULL; |
|
4701 _err = CreatePopupArrowControl(window, |
|
4702 &boundsRect, |
|
4703 orientation, |
|
4704 size, |
|
4705 &outControl); |
|
4706 if (_err != noErr) return PyMac_Error(_err); |
|
4707 _res = Py_BuildValue("O&", |
|
4708 CtlObj_New, outControl); |
|
4709 return _res; |
|
4710 } |
|
4711 |
|
4712 static PyObject *Ctl_CreatePlacardControl(PyObject *_self, PyObject *_args) |
|
4713 { |
|
4714 PyObject *_res = NULL; |
|
4715 OSStatus _err; |
|
4716 WindowPtr window; |
|
4717 Rect boundsRect; |
|
4718 ControlHandle outControl; |
|
4719 #ifndef CreatePlacardControl |
|
4720 PyMac_PRECHECK(CreatePlacardControl); |
|
4721 #endif |
|
4722 if (!PyArg_ParseTuple(_args, "O&O&", |
|
4723 WinObj_Convert, &window, |
|
4724 PyMac_GetRect, &boundsRect)) |
|
4725 return NULL; |
|
4726 _err = CreatePlacardControl(window, |
|
4727 &boundsRect, |
|
4728 &outControl); |
|
4729 if (_err != noErr) return PyMac_Error(_err); |
|
4730 _res = Py_BuildValue("O&", |
|
4731 CtlObj_New, outControl); |
|
4732 return _res; |
|
4733 } |
|
4734 |
|
4735 static PyObject *Ctl_CreateClockControl(PyObject *_self, PyObject *_args) |
|
4736 { |
|
4737 PyObject *_res = NULL; |
|
4738 OSStatus _err; |
|
4739 WindowPtr window; |
|
4740 Rect boundsRect; |
|
4741 UInt16 clockType; |
|
4742 UInt32 clockFlags; |
|
4743 ControlHandle outControl; |
|
4744 #ifndef CreateClockControl |
|
4745 PyMac_PRECHECK(CreateClockControl); |
|
4746 #endif |
|
4747 if (!PyArg_ParseTuple(_args, "O&O&Hl", |
|
4748 WinObj_Convert, &window, |
|
4749 PyMac_GetRect, &boundsRect, |
|
4750 &clockType, |
|
4751 &clockFlags)) |
|
4752 return NULL; |
|
4753 _err = CreateClockControl(window, |
|
4754 &boundsRect, |
|
4755 clockType, |
|
4756 clockFlags, |
|
4757 &outControl); |
|
4758 if (_err != noErr) return PyMac_Error(_err); |
|
4759 _res = Py_BuildValue("O&", |
|
4760 CtlObj_New, outControl); |
|
4761 return _res; |
|
4762 } |
|
4763 |
|
4764 static PyObject *Ctl_CreateUserPaneControl(PyObject *_self, PyObject *_args) |
|
4765 { |
|
4766 PyObject *_res = NULL; |
|
4767 OSStatus _err; |
|
4768 WindowPtr window; |
|
4769 Rect boundsRect; |
|
4770 UInt32 features; |
|
4771 ControlHandle outControl; |
|
4772 #ifndef CreateUserPaneControl |
|
4773 PyMac_PRECHECK(CreateUserPaneControl); |
|
4774 #endif |
|
4775 if (!PyArg_ParseTuple(_args, "O&O&l", |
|
4776 WinObj_Convert, &window, |
|
4777 PyMac_GetRect, &boundsRect, |
|
4778 &features)) |
|
4779 return NULL; |
|
4780 _err = CreateUserPaneControl(window, |
|
4781 &boundsRect, |
|
4782 features, |
|
4783 &outControl); |
|
4784 if (_err != noErr) return PyMac_Error(_err); |
|
4785 _res = Py_BuildValue("O&", |
|
4786 CtlObj_New, outControl); |
|
4787 return _res; |
|
4788 } |
|
4789 |
|
4790 static PyObject *Ctl_CreateEditTextControl(PyObject *_self, PyObject *_args) |
|
4791 { |
|
4792 PyObject *_res = NULL; |
|
4793 OSStatus _err; |
|
4794 WindowPtr window; |
|
4795 Rect boundsRect; |
|
4796 CFStringRef text; |
|
4797 Boolean isPassword; |
|
4798 Boolean useInlineInput; |
|
4799 ControlFontStyleRec style; |
|
4800 ControlHandle outControl; |
|
4801 #ifndef CreateEditTextControl |
|
4802 PyMac_PRECHECK(CreateEditTextControl); |
|
4803 #endif |
|
4804 if (!PyArg_ParseTuple(_args, "O&O&O&bbO&", |
|
4805 WinObj_Convert, &window, |
|
4806 PyMac_GetRect, &boundsRect, |
|
4807 CFStringRefObj_Convert, &text, |
|
4808 &isPassword, |
|
4809 &useInlineInput, |
|
4810 ControlFontStyle_Convert, &style)) |
|
4811 return NULL; |
|
4812 _err = CreateEditTextControl(window, |
|
4813 &boundsRect, |
|
4814 text, |
|
4815 isPassword, |
|
4816 useInlineInput, |
|
4817 &style, |
|
4818 &outControl); |
|
4819 if (_err != noErr) return PyMac_Error(_err); |
|
4820 _res = Py_BuildValue("O&", |
|
4821 CtlObj_New, outControl); |
|
4822 return _res; |
|
4823 } |
|
4824 |
|
4825 static PyObject *Ctl_CreateStaticTextControl(PyObject *_self, PyObject *_args) |
|
4826 { |
|
4827 PyObject *_res = NULL; |
|
4828 OSStatus _err; |
|
4829 WindowPtr window; |
|
4830 Rect boundsRect; |
|
4831 CFStringRef text; |
|
4832 ControlFontStyleRec style; |
|
4833 ControlHandle outControl; |
|
4834 #ifndef CreateStaticTextControl |
|
4835 PyMac_PRECHECK(CreateStaticTextControl); |
|
4836 #endif |
|
4837 if (!PyArg_ParseTuple(_args, "O&O&O&O&", |
|
4838 WinObj_Convert, &window, |
|
4839 PyMac_GetRect, &boundsRect, |
|
4840 CFStringRefObj_Convert, &text, |
|
4841 ControlFontStyle_Convert, &style)) |
|
4842 return NULL; |
|
4843 _err = CreateStaticTextControl(window, |
|
4844 &boundsRect, |
|
4845 text, |
|
4846 &style, |
|
4847 &outControl); |
|
4848 if (_err != noErr) return PyMac_Error(_err); |
|
4849 _res = Py_BuildValue("O&", |
|
4850 CtlObj_New, outControl); |
|
4851 return _res; |
|
4852 } |
|
4853 |
|
4854 static PyObject *Ctl_CreatePictureControl(PyObject *_self, PyObject *_args) |
|
4855 { |
|
4856 PyObject *_res = NULL; |
|
4857 OSStatus _err; |
|
4858 WindowPtr window; |
|
4859 Rect boundsRect; |
|
4860 ControlButtonContentInfo content; |
|
4861 Boolean dontTrack; |
|
4862 ControlHandle outControl; |
|
4863 #ifndef CreatePictureControl |
|
4864 PyMac_PRECHECK(CreatePictureControl); |
|
4865 #endif |
|
4866 if (!PyArg_ParseTuple(_args, "O&O&O&b", |
|
4867 WinObj_Convert, &window, |
|
4868 PyMac_GetRect, &boundsRect, |
|
4869 ControlButtonContentInfo_Convert, &content, |
|
4870 &dontTrack)) |
|
4871 return NULL; |
|
4872 _err = CreatePictureControl(window, |
|
4873 &boundsRect, |
|
4874 &content, |
|
4875 dontTrack, |
|
4876 &outControl); |
|
4877 if (_err != noErr) return PyMac_Error(_err); |
|
4878 _res = Py_BuildValue("O&", |
|
4879 CtlObj_New, outControl); |
|
4880 return _res; |
|
4881 } |
|
4882 |
|
4883 static PyObject *Ctl_CreateIconControl(PyObject *_self, PyObject *_args) |
|
4884 { |
|
4885 PyObject *_res = NULL; |
|
4886 OSStatus _err; |
|
4887 WindowPtr inWindow; |
|
4888 Rect inBoundsRect; |
|
4889 ControlButtonContentInfo inIconContent; |
|
4890 Boolean inDontTrack; |
|
4891 ControlHandle outControl; |
|
4892 #ifndef CreateIconControl |
|
4893 PyMac_PRECHECK(CreateIconControl); |
|
4894 #endif |
|
4895 if (!PyArg_ParseTuple(_args, "O&O&O&b", |
|
4896 WinObj_Convert, &inWindow, |
|
4897 PyMac_GetRect, &inBoundsRect, |
|
4898 ControlButtonContentInfo_Convert, &inIconContent, |
|
4899 &inDontTrack)) |
|
4900 return NULL; |
|
4901 _err = CreateIconControl(inWindow, |
|
4902 &inBoundsRect, |
|
4903 &inIconContent, |
|
4904 inDontTrack, |
|
4905 &outControl); |
|
4906 if (_err != noErr) return PyMac_Error(_err); |
|
4907 _res = Py_BuildValue("O&", |
|
4908 CtlObj_New, outControl); |
|
4909 return _res; |
|
4910 } |
|
4911 |
|
4912 static PyObject *Ctl_CreateWindowHeaderControl(PyObject *_self, PyObject *_args) |
|
4913 { |
|
4914 PyObject *_res = NULL; |
|
4915 OSStatus _err; |
|
4916 WindowPtr window; |
|
4917 Rect boundsRect; |
|
4918 Boolean isListHeader; |
|
4919 ControlHandle outControl; |
|
4920 #ifndef CreateWindowHeaderControl |
|
4921 PyMac_PRECHECK(CreateWindowHeaderControl); |
|
4922 #endif |
|
4923 if (!PyArg_ParseTuple(_args, "O&O&b", |
|
4924 WinObj_Convert, &window, |
|
4925 PyMac_GetRect, &boundsRect, |
|
4926 &isListHeader)) |
|
4927 return NULL; |
|
4928 _err = CreateWindowHeaderControl(window, |
|
4929 &boundsRect, |
|
4930 isListHeader, |
|
4931 &outControl); |
|
4932 if (_err != noErr) return PyMac_Error(_err); |
|
4933 _res = Py_BuildValue("O&", |
|
4934 CtlObj_New, outControl); |
|
4935 return _res; |
|
4936 } |
|
4937 |
|
4938 static PyObject *Ctl_CreatePushButtonControl(PyObject *_self, PyObject *_args) |
|
4939 { |
|
4940 PyObject *_res = NULL; |
|
4941 OSStatus _err; |
|
4942 WindowPtr window; |
|
4943 Rect boundsRect; |
|
4944 CFStringRef title; |
|
4945 ControlHandle outControl; |
|
4946 #ifndef CreatePushButtonControl |
|
4947 PyMac_PRECHECK(CreatePushButtonControl); |
|
4948 #endif |
|
4949 if (!PyArg_ParseTuple(_args, "O&O&O&", |
|
4950 WinObj_Convert, &window, |
|
4951 PyMac_GetRect, &boundsRect, |
|
4952 CFStringRefObj_Convert, &title)) |
|
4953 return NULL; |
|
4954 _err = CreatePushButtonControl(window, |
|
4955 &boundsRect, |
|
4956 title, |
|
4957 &outControl); |
|
4958 if (_err != noErr) return PyMac_Error(_err); |
|
4959 _res = Py_BuildValue("O&", |
|
4960 CtlObj_New, outControl); |
|
4961 return _res; |
|
4962 } |
|
4963 |
|
4964 static PyObject *Ctl_CreatePushButtonWithIconControl(PyObject *_self, PyObject *_args) |
|
4965 { |
|
4966 PyObject *_res = NULL; |
|
4967 OSStatus _err; |
|
4968 WindowPtr window; |
|
4969 Rect boundsRect; |
|
4970 CFStringRef title; |
|
4971 ControlButtonContentInfo icon; |
|
4972 UInt16 iconAlignment; |
|
4973 ControlHandle outControl; |
|
4974 #ifndef CreatePushButtonWithIconControl |
|
4975 PyMac_PRECHECK(CreatePushButtonWithIconControl); |
|
4976 #endif |
|
4977 if (!PyArg_ParseTuple(_args, "O&O&O&O&H", |
|
4978 WinObj_Convert, &window, |
|
4979 PyMac_GetRect, &boundsRect, |
|
4980 CFStringRefObj_Convert, &title, |
|
4981 ControlButtonContentInfo_Convert, &icon, |
|
4982 &iconAlignment)) |
|
4983 return NULL; |
|
4984 _err = CreatePushButtonWithIconControl(window, |
|
4985 &boundsRect, |
|
4986 title, |
|
4987 &icon, |
|
4988 iconAlignment, |
|
4989 &outControl); |
|
4990 if (_err != noErr) return PyMac_Error(_err); |
|
4991 _res = Py_BuildValue("O&", |
|
4992 CtlObj_New, outControl); |
|
4993 return _res; |
|
4994 } |
|
4995 |
|
4996 static PyObject *Ctl_CreateRadioButtonControl(PyObject *_self, PyObject *_args) |
|
4997 { |
|
4998 PyObject *_res = NULL; |
|
4999 OSStatus _err; |
|
5000 WindowPtr window; |
|
5001 Rect boundsRect; |
|
5002 CFStringRef title; |
|
5003 SInt32 initialValue; |
|
5004 Boolean autoToggle; |
|
5005 ControlHandle outControl; |
|
5006 #ifndef CreateRadioButtonControl |
|
5007 PyMac_PRECHECK(CreateRadioButtonControl); |
|
5008 #endif |
|
5009 if (!PyArg_ParseTuple(_args, "O&O&O&lb", |
|
5010 WinObj_Convert, &window, |
|
5011 PyMac_GetRect, &boundsRect, |
|
5012 CFStringRefObj_Convert, &title, |
|
5013 &initialValue, |
|
5014 &autoToggle)) |
|
5015 return NULL; |
|
5016 _err = CreateRadioButtonControl(window, |
|
5017 &boundsRect, |
|
5018 title, |
|
5019 initialValue, |
|
5020 autoToggle, |
|
5021 &outControl); |
|
5022 if (_err != noErr) return PyMac_Error(_err); |
|
5023 _res = Py_BuildValue("O&", |
|
5024 CtlObj_New, outControl); |
|
5025 return _res; |
|
5026 } |
|
5027 |
|
5028 static PyObject *Ctl_CreateCheckBoxControl(PyObject *_self, PyObject *_args) |
|
5029 { |
|
5030 PyObject *_res = NULL; |
|
5031 OSStatus _err; |
|
5032 WindowPtr window; |
|
5033 Rect boundsRect; |
|
5034 CFStringRef title; |
|
5035 SInt32 initialValue; |
|
5036 Boolean autoToggle; |
|
5037 ControlHandle outControl; |
|
5038 #ifndef CreateCheckBoxControl |
|
5039 PyMac_PRECHECK(CreateCheckBoxControl); |
|
5040 #endif |
|
5041 if (!PyArg_ParseTuple(_args, "O&O&O&lb", |
|
5042 WinObj_Convert, &window, |
|
5043 PyMac_GetRect, &boundsRect, |
|
5044 CFStringRefObj_Convert, &title, |
|
5045 &initialValue, |
|
5046 &autoToggle)) |
|
5047 return NULL; |
|
5048 _err = CreateCheckBoxControl(window, |
|
5049 &boundsRect, |
|
5050 title, |
|
5051 initialValue, |
|
5052 autoToggle, |
|
5053 &outControl); |
|
5054 if (_err != noErr) return PyMac_Error(_err); |
|
5055 _res = Py_BuildValue("O&", |
|
5056 CtlObj_New, outControl); |
|
5057 return _res; |
|
5058 } |
|
5059 |
|
5060 static PyObject *Ctl_CreateScrollBarControl(PyObject *_self, PyObject *_args) |
|
5061 { |
|
5062 PyObject *_res = NULL; |
|
5063 OSStatus _err; |
|
5064 WindowPtr window; |
|
5065 Rect boundsRect; |
|
5066 SInt32 value; |
|
5067 SInt32 minimum; |
|
5068 SInt32 maximum; |
|
5069 SInt32 viewSize; |
|
5070 Boolean liveTracking; |
|
5071 PyObject* liveTrackingProc; |
|
5072 UniversalProcPtr c_callback; |
|
5073 ControlHandle outControl; |
|
5074 #ifndef CreateScrollBarControl |
|
5075 PyMac_PRECHECK(CreateScrollBarControl); |
|
5076 #endif |
|
5077 if (!PyArg_ParseTuple(_args, "O&O&llllbO", |
|
5078 WinObj_Convert, &window, |
|
5079 PyMac_GetRect, &boundsRect, |
|
5080 &value, |
|
5081 &minimum, |
|
5082 &maximum, |
|
5083 &viewSize, |
|
5084 &liveTracking, |
|
5085 &liveTrackingProc)) |
|
5086 return NULL; |
|
5087 _err = CreateScrollBarControl(window, |
|
5088 &boundsRect, |
|
5089 value, |
|
5090 minimum, |
|
5091 maximum, |
|
5092 viewSize, |
|
5093 liveTracking, |
|
5094 myactionproc_upp, |
|
5095 &outControl); |
|
5096 if (_err != noErr) return PyMac_Error(_err); |
|
5097 _res = Py_BuildValue("O&", |
|
5098 CtlObj_New, outControl); |
|
5099 setcallback(_res, kMyControlActionProcTag, liveTrackingProc, &c_callback); |
|
5100 return _res; |
|
5101 } |
|
5102 |
|
5103 static PyObject *Ctl_CreatePopupButtonControl(PyObject *_self, PyObject *_args) |
|
5104 { |
|
5105 PyObject *_res = NULL; |
|
5106 OSStatus _err; |
|
5107 WindowPtr window; |
|
5108 Rect boundsRect; |
|
5109 CFStringRef title; |
|
5110 SInt16 menuID; |
|
5111 Boolean variableWidth; |
|
5112 SInt16 titleWidth; |
|
5113 SInt16 titleJustification; |
|
5114 Style titleStyle; |
|
5115 ControlHandle outControl; |
|
5116 #ifndef CreatePopupButtonControl |
|
5117 PyMac_PRECHECK(CreatePopupButtonControl); |
|
5118 #endif |
|
5119 if (!PyArg_ParseTuple(_args, "O&O&O&hbhhb", |
|
5120 WinObj_Convert, &window, |
|
5121 PyMac_GetRect, &boundsRect, |
|
5122 CFStringRefObj_Convert, &title, |
|
5123 &menuID, |
|
5124 &variableWidth, |
|
5125 &titleWidth, |
|
5126 &titleJustification, |
|
5127 &titleStyle)) |
|
5128 return NULL; |
|
5129 _err = CreatePopupButtonControl(window, |
|
5130 &boundsRect, |
|
5131 title, |
|
5132 menuID, |
|
5133 variableWidth, |
|
5134 titleWidth, |
|
5135 titleJustification, |
|
5136 titleStyle, |
|
5137 &outControl); |
|
5138 if (_err != noErr) return PyMac_Error(_err); |
|
5139 _res = Py_BuildValue("O&", |
|
5140 CtlObj_New, outControl); |
|
5141 return _res; |
|
5142 } |
|
5143 |
|
5144 static PyObject *Ctl_CreateRadioGroupControl(PyObject *_self, PyObject *_args) |
|
5145 { |
|
5146 PyObject *_res = NULL; |
|
5147 OSStatus _err; |
|
5148 WindowPtr window; |
|
5149 Rect boundsRect; |
|
5150 ControlHandle outControl; |
|
5151 #ifndef CreateRadioGroupControl |
|
5152 PyMac_PRECHECK(CreateRadioGroupControl); |
|
5153 #endif |
|
5154 if (!PyArg_ParseTuple(_args, "O&O&", |
|
5155 WinObj_Convert, &window, |
|
5156 PyMac_GetRect, &boundsRect)) |
|
5157 return NULL; |
|
5158 _err = CreateRadioGroupControl(window, |
|
5159 &boundsRect, |
|
5160 &outControl); |
|
5161 if (_err != noErr) return PyMac_Error(_err); |
|
5162 _res = Py_BuildValue("O&", |
|
5163 CtlObj_New, outControl); |
|
5164 return _res; |
|
5165 } |
|
5166 |
|
5167 static PyObject *Ctl_CreateScrollingTextBoxControl(PyObject *_self, PyObject *_args) |
|
5168 { |
|
5169 PyObject *_res = NULL; |
|
5170 OSStatus _err; |
|
5171 WindowPtr window; |
|
5172 Rect boundsRect; |
|
5173 SInt16 contentResID; |
|
5174 Boolean autoScroll; |
|
5175 UInt32 delayBeforeAutoScroll; |
|
5176 UInt32 delayBetweenAutoScroll; |
|
5177 UInt16 autoScrollAmount; |
|
5178 ControlHandle outControl; |
|
5179 #ifndef CreateScrollingTextBoxControl |
|
5180 PyMac_PRECHECK(CreateScrollingTextBoxControl); |
|
5181 #endif |
|
5182 if (!PyArg_ParseTuple(_args, "O&O&hbllH", |
|
5183 WinObj_Convert, &window, |
|
5184 PyMac_GetRect, &boundsRect, |
|
5185 &contentResID, |
|
5186 &autoScroll, |
|
5187 &delayBeforeAutoScroll, |
|
5188 &delayBetweenAutoScroll, |
|
5189 &autoScrollAmount)) |
|
5190 return NULL; |
|
5191 _err = CreateScrollingTextBoxControl(window, |
|
5192 &boundsRect, |
|
5193 contentResID, |
|
5194 autoScroll, |
|
5195 delayBeforeAutoScroll, |
|
5196 delayBetweenAutoScroll, |
|
5197 autoScrollAmount, |
|
5198 &outControl); |
|
5199 if (_err != noErr) return PyMac_Error(_err); |
|
5200 _res = Py_BuildValue("O&", |
|
5201 CtlObj_New, outControl); |
|
5202 return _res; |
|
5203 } |
|
5204 |
|
5205 static PyObject *Ctl_CreateDisclosureButtonControl(PyObject *_self, PyObject *_args) |
|
5206 { |
|
5207 PyObject *_res = NULL; |
|
5208 OSStatus _err; |
|
5209 WindowPtr inWindow; |
|
5210 Rect inBoundsRect; |
|
5211 SInt32 inValue; |
|
5212 Boolean inAutoToggles; |
|
5213 ControlHandle outControl; |
|
5214 #ifndef CreateDisclosureButtonControl |
|
5215 PyMac_PRECHECK(CreateDisclosureButtonControl); |
|
5216 #endif |
|
5217 if (!PyArg_ParseTuple(_args, "O&O&lb", |
|
5218 WinObj_Convert, &inWindow, |
|
5219 PyMac_GetRect, &inBoundsRect, |
|
5220 &inValue, |
|
5221 &inAutoToggles)) |
|
5222 return NULL; |
|
5223 _err = CreateDisclosureButtonControl(inWindow, |
|
5224 &inBoundsRect, |
|
5225 inValue, |
|
5226 inAutoToggles, |
|
5227 &outControl); |
|
5228 if (_err != noErr) return PyMac_Error(_err); |
|
5229 _res = Py_BuildValue("O&", |
|
5230 CtlObj_New, outControl); |
|
5231 return _res; |
|
5232 } |
|
5233 |
|
5234 static PyObject *Ctl_CreateRoundButtonControl(PyObject *_self, PyObject *_args) |
|
5235 { |
|
5236 PyObject *_res = NULL; |
|
5237 OSStatus _err; |
|
5238 WindowPtr inWindow; |
|
5239 Rect inBoundsRect; |
|
5240 SInt16 inSize; |
|
5241 ControlButtonContentInfo inContent; |
|
5242 ControlHandle outControl; |
|
5243 #ifndef CreateRoundButtonControl |
|
5244 PyMac_PRECHECK(CreateRoundButtonControl); |
|
5245 #endif |
|
5246 if (!PyArg_ParseTuple(_args, "O&O&hO&", |
|
5247 WinObj_Convert, &inWindow, |
|
5248 PyMac_GetRect, &inBoundsRect, |
|
5249 &inSize, |
|
5250 ControlButtonContentInfo_Convert, &inContent)) |
|
5251 return NULL; |
|
5252 _err = CreateRoundButtonControl(inWindow, |
|
5253 &inBoundsRect, |
|
5254 inSize, |
|
5255 &inContent, |
|
5256 &outControl); |
|
5257 if (_err != noErr) return PyMac_Error(_err); |
|
5258 _res = Py_BuildValue("O&", |
|
5259 CtlObj_New, outControl); |
|
5260 return _res; |
|
5261 } |
|
5262 |
|
5263 static PyObject *Ctl_CreateDataBrowserControl(PyObject *_self, PyObject *_args) |
|
5264 { |
|
5265 PyObject *_res = NULL; |
|
5266 OSStatus _err; |
|
5267 WindowPtr window; |
|
5268 Rect boundsRect; |
|
5269 OSType style; |
|
5270 ControlHandle outControl; |
|
5271 #ifndef CreateDataBrowserControl |
|
5272 PyMac_PRECHECK(CreateDataBrowserControl); |
|
5273 #endif |
|
5274 if (!PyArg_ParseTuple(_args, "O&O&O&", |
|
5275 WinObj_Convert, &window, |
|
5276 PyMac_GetRect, &boundsRect, |
|
5277 PyMac_GetOSType, &style)) |
|
5278 return NULL; |
|
5279 _err = CreateDataBrowserControl(window, |
|
5280 &boundsRect, |
|
5281 style, |
|
5282 &outControl); |
|
5283 if (_err != noErr) return PyMac_Error(_err); |
|
5284 _res = Py_BuildValue("O&", |
|
5285 CtlObj_New, outControl); |
|
5286 return _res; |
|
5287 } |
|
5288 |
|
5289 static PyObject *Ctl_CreateEditUnicodeTextControl(PyObject *_self, PyObject *_args) |
|
5290 { |
|
5291 PyObject *_res = NULL; |
|
5292 OSStatus _err; |
|
5293 WindowPtr window; |
|
5294 Rect boundsRect; |
|
5295 CFStringRef text; |
|
5296 Boolean isPassword; |
|
5297 ControlFontStyleRec style; |
|
5298 ControlHandle outControl; |
|
5299 #ifndef CreateEditUnicodeTextControl |
|
5300 PyMac_PRECHECK(CreateEditUnicodeTextControl); |
|
5301 #endif |
|
5302 if (!PyArg_ParseTuple(_args, "O&O&O&bO&", |
|
5303 WinObj_Convert, &window, |
|
5304 PyMac_GetRect, &boundsRect, |
|
5305 CFStringRefObj_Convert, &text, |
|
5306 &isPassword, |
|
5307 ControlFontStyle_Convert, &style)) |
|
5308 return NULL; |
|
5309 _err = CreateEditUnicodeTextControl(window, |
|
5310 &boundsRect, |
|
5311 text, |
|
5312 isPassword, |
|
5313 &style, |
|
5314 &outControl); |
|
5315 if (_err != noErr) return PyMac_Error(_err); |
|
5316 _res = Py_BuildValue("O&", |
|
5317 CtlObj_New, outControl); |
|
5318 return _res; |
|
5319 } |
|
5320 |
|
5321 static PyObject *Ctl_FindControlUnderMouse(PyObject *_self, PyObject *_args) |
|
5322 { |
|
5323 PyObject *_res = NULL; |
|
5324 ControlHandle _rv; |
|
5325 Point inWhere; |
|
5326 WindowPtr inWindow; |
|
5327 SInt16 outPart; |
|
5328 #ifndef FindControlUnderMouse |
|
5329 PyMac_PRECHECK(FindControlUnderMouse); |
|
5330 #endif |
|
5331 if (!PyArg_ParseTuple(_args, "O&O&", |
|
5332 PyMac_GetPoint, &inWhere, |
|
5333 WinObj_Convert, &inWindow)) |
|
5334 return NULL; |
|
5335 _rv = FindControlUnderMouse(inWhere, |
|
5336 inWindow, |
|
5337 &outPart); |
|
5338 _res = Py_BuildValue("O&h", |
|
5339 CtlObj_WhichControl, _rv, |
|
5340 outPart); |
|
5341 return _res; |
|
5342 } |
|
5343 |
|
5344 static PyObject *Ctl_as_Control(PyObject *_self, PyObject *_args) |
|
5345 { |
|
5346 PyObject *_res = NULL; |
|
5347 ControlHandle _rv; |
|
5348 Handle h; |
|
5349 #ifndef as_Control |
|
5350 PyMac_PRECHECK(as_Control); |
|
5351 #endif |
|
5352 if (!PyArg_ParseTuple(_args, "O&", |
|
5353 ResObj_Convert, &h)) |
|
5354 return NULL; |
|
5355 _rv = as_Control(h); |
|
5356 _res = Py_BuildValue("O&", |
|
5357 CtlObj_New, _rv); |
|
5358 return _res; |
|
5359 } |
|
5360 |
|
5361 static PyObject *Ctl_CreateTabsControl(PyObject *_self, PyObject *_args) |
|
5362 { |
|
5363 PyObject *_res = NULL; |
|
5364 OSStatus _err; |
|
5365 WindowPtr window; |
|
5366 Rect boundsRect; |
|
5367 UInt16 size; |
|
5368 UInt16 direction; |
|
5369 int i; |
|
5370 UInt16 numTabs; |
|
5371 ControlTabEntry tabArray[MAXTABS]; |
|
5372 ControlHandle outControl; |
|
5373 PyObject *tabArrayObj, *tabEntry; |
|
5374 |
|
5375 #ifndef CreateTabsControl |
|
5376 PyMac_PRECHECK(CreateTabsControl); |
|
5377 #endif |
|
5378 if (!PyArg_ParseTuple(_args, "O&O&HHO", |
|
5379 WinObj_Convert, &window, |
|
5380 PyMac_GetRect, &boundsRect, |
|
5381 &size, |
|
5382 &direction, |
|
5383 &tabArrayObj)) |
|
5384 return NULL; |
|
5385 |
|
5386 i = PySequence_Length(tabArrayObj); |
|
5387 if (i == -1) |
|
5388 return NULL; |
|
5389 if (i > MAXTABS) { |
|
5390 PyErr_SetString(Ctl_Error, "Too many tabs"); |
|
5391 return NULL; |
|
5392 } |
|
5393 numTabs = i; |
|
5394 for (i=0; i<numTabs; i++) { |
|
5395 tabEntry = PySequence_GetItem(tabArrayObj, i); |
|
5396 if (tabEntry == NULL) |
|
5397 return NULL; |
|
5398 if (!PyArg_Parse(tabEntry, "(O&O&B)", |
|
5399 ControlButtonContentInfo_Convert, &tabArray[i].icon, |
|
5400 CFStringRefObj_Convert, &tabArray[i].name, |
|
5401 &tabArray[i].enabled |
|
5402 )) |
|
5403 return NULL; |
|
5404 } |
|
5405 |
|
5406 _err = CreateTabsControl(window, |
|
5407 &boundsRect, |
|
5408 size, |
|
5409 direction, |
|
5410 numTabs, |
|
5411 tabArray, |
|
5412 &outControl); |
|
5413 if (_err != noErr) return PyMac_Error(_err); |
|
5414 _res = Py_BuildValue("O&", |
|
5415 CtlObj_New, outControl); |
|
5416 return _res; |
|
5417 } |
|
5418 |
|
5419 static PyMethodDef Ctl_methods[] = { |
|
5420 {"NewControl", (PyCFunction)Ctl_NewControl, 1, |
|
5421 PyDoc_STR("(WindowPtr owningWindow, Rect boundsRect, Str255 controlTitle, Boolean initiallyVisible, SInt16 initialValue, SInt16 minimumValue, SInt16 maximumValue, SInt16 procID, SInt32 controlReference) -> (ControlHandle _rv)")}, |
|
5422 {"GetNewControl", (PyCFunction)Ctl_GetNewControl, 1, |
|
5423 PyDoc_STR("(SInt16 resourceID, WindowPtr owningWindow) -> (ControlHandle _rv)")}, |
|
5424 {"DrawControls", (PyCFunction)Ctl_DrawControls, 1, |
|
5425 PyDoc_STR("(WindowPtr theWindow) -> None")}, |
|
5426 {"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1, |
|
5427 PyDoc_STR("(WindowPtr inWindow, RgnHandle inUpdateRegion) -> None")}, |
|
5428 {"FindControl", (PyCFunction)Ctl_FindControl, 1, |
|
5429 PyDoc_STR("(Point testPoint, WindowPtr theWindow) -> (ControlPartCode _rv, ControlHandle theControl)")}, |
|
5430 {"IdleControls", (PyCFunction)Ctl_IdleControls, 1, |
|
5431 PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|
5432 {"GetControlByID", (PyCFunction)Ctl_GetControlByID, 1, |
|
5433 PyDoc_STR("(WindowPtr inWindow, ControlID inID) -> (ControlHandle outControl)")}, |
|
5434 {"DumpControlHierarchy", (PyCFunction)Ctl_DumpControlHierarchy, 1, |
|
5435 PyDoc_STR("(WindowPtr inWindow, FSSpec inDumpFile) -> None")}, |
|
5436 {"CreateRootControl", (PyCFunction)Ctl_CreateRootControl, 1, |
|
5437 PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, |
|
5438 {"GetRootControl", (PyCFunction)Ctl_GetRootControl, 1, |
|
5439 PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, |
|
5440 {"GetKeyboardFocus", (PyCFunction)Ctl_GetKeyboardFocus, 1, |
|
5441 PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, |
|
5442 {"SetKeyboardFocus", (PyCFunction)Ctl_SetKeyboardFocus, 1, |
|
5443 PyDoc_STR("(WindowPtr inWindow, ControlHandle inControl, ControlFocusPart inPart) -> None")}, |
|
5444 {"AdvanceKeyboardFocus", (PyCFunction)Ctl_AdvanceKeyboardFocus, 1, |
|
5445 PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|
5446 {"ReverseKeyboardFocus", (PyCFunction)Ctl_ReverseKeyboardFocus, 1, |
|
5447 PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|
5448 {"ClearKeyboardFocus", (PyCFunction)Ctl_ClearKeyboardFocus, 1, |
|
5449 PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|
5450 {"SetAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_SetAutomaticControlDragTrackingEnabledForWindow, 1, |
|
5451 PyDoc_STR("(WindowPtr inWindow, Boolean inTracks) -> None")}, |
|
5452 {"IsAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_IsAutomaticControlDragTrackingEnabledForWindow, 1, |
|
5453 PyDoc_STR("(WindowPtr inWindow) -> (Boolean outTracks)")}, |
|
5454 {"CreateBevelButtonControl", (PyCFunction)Ctl_CreateBevelButtonControl, 1, |
|
5455 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, UInt16 thickness, UInt16 behavior, ControlButtonContentInfo info, SInt16 menuID, UInt16 menuBehavior, UInt16 menuPlacement) -> (ControlHandle outControl)")}, |
|
5456 {"CreateSliderControl", (PyCFunction)Ctl_CreateSliderControl, 1, |
|
5457 PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, UInt16 orientation, UInt16 numTickMarks, Boolean liveTracking, PyObject* liveTrackingProc) -> (ControlHandle outControl)")}, |
|
5458 {"CreateDisclosureTriangleControl", (PyCFunction)Ctl_CreateDisclosureTriangleControl, 1, |
|
5459 PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, UInt16 inOrientation, CFStringRef inTitle, SInt32 inInitialValue, Boolean inDrawTitle, Boolean inAutoToggles) -> (ControlHandle outControl)")}, |
|
5460 {"CreateProgressBarControl", (PyCFunction)Ctl_CreateProgressBarControl, 1, |
|
5461 PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, Boolean indeterminate) -> (ControlHandle outControl)")}, |
|
5462 {"CreateRelevanceBarControl", (PyCFunction)Ctl_CreateRelevanceBarControl, 1, |
|
5463 PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum) -> (ControlHandle outControl)")}, |
|
5464 {"CreateLittleArrowsControl", (PyCFunction)Ctl_CreateLittleArrowsControl, 1, |
|
5465 PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 increment) -> (ControlHandle outControl)")}, |
|
5466 {"CreateChasingArrowsControl", (PyCFunction)Ctl_CreateChasingArrowsControl, 1, |
|
5467 PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")}, |
|
5468 {"CreateSeparatorControl", (PyCFunction)Ctl_CreateSeparatorControl, 1, |
|
5469 PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")}, |
|
5470 {"CreateGroupBoxControl", (PyCFunction)Ctl_CreateGroupBoxControl, 1, |
|
5471 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, Boolean primary) -> (ControlHandle outControl)")}, |
|
5472 {"CreateCheckGroupBoxControl", (PyCFunction)Ctl_CreateCheckGroupBoxControl, 1, |
|
5473 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean primary, Boolean autoToggle) -> (ControlHandle outControl)")}, |
|
5474 {"CreatePopupGroupBoxControl", (PyCFunction)Ctl_CreatePopupGroupBoxControl, 1, |
|
5475 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, Boolean primary, SInt16 menuID, Boolean variableWidth, SInt16 titleWidth, SInt16 titleJustification, Style titleStyle) -> (ControlHandle outControl)")}, |
|
5476 {"CreateImageWellControl", (PyCFunction)Ctl_CreateImageWellControl, 1, |
|
5477 PyDoc_STR("(WindowPtr window, Rect boundsRect, ControlButtonContentInfo info) -> (ControlHandle outControl)")}, |
|
5478 {"CreatePopupArrowControl", (PyCFunction)Ctl_CreatePopupArrowControl, 1, |
|
5479 PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 orientation, UInt16 size) -> (ControlHandle outControl)")}, |
|
5480 {"CreatePlacardControl", (PyCFunction)Ctl_CreatePlacardControl, 1, |
|
5481 PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")}, |
|
5482 {"CreateClockControl", (PyCFunction)Ctl_CreateClockControl, 1, |
|
5483 PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 clockType, UInt32 clockFlags) -> (ControlHandle outControl)")}, |
|
5484 {"CreateUserPaneControl", (PyCFunction)Ctl_CreateUserPaneControl, 1, |
|
5485 PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt32 features) -> (ControlHandle outControl)")}, |
|
5486 {"CreateEditTextControl", (PyCFunction)Ctl_CreateEditTextControl, 1, |
|
5487 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, Boolean useInlineInput, ControlFontStyleRec style) -> (ControlHandle outControl)")}, |
|
5488 {"CreateStaticTextControl", (PyCFunction)Ctl_CreateStaticTextControl, 1, |
|
5489 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, ControlFontStyleRec style) -> (ControlHandle outControl)")}, |
|
5490 {"CreatePictureControl", (PyCFunction)Ctl_CreatePictureControl, 1, |
|
5491 PyDoc_STR("(WindowPtr window, Rect boundsRect, ControlButtonContentInfo content, Boolean dontTrack) -> (ControlHandle outControl)")}, |
|
5492 {"CreateIconControl", (PyCFunction)Ctl_CreateIconControl, 1, |
|
5493 PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, ControlButtonContentInfo inIconContent, Boolean inDontTrack) -> (ControlHandle outControl)")}, |
|
5494 {"CreateWindowHeaderControl", (PyCFunction)Ctl_CreateWindowHeaderControl, 1, |
|
5495 PyDoc_STR("(WindowPtr window, Rect boundsRect, Boolean isListHeader) -> (ControlHandle outControl)")}, |
|
5496 {"CreatePushButtonControl", (PyCFunction)Ctl_CreatePushButtonControl, 1, |
|
5497 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title) -> (ControlHandle outControl)")}, |
|
5498 {"CreatePushButtonWithIconControl", (PyCFunction)Ctl_CreatePushButtonWithIconControl, 1, |
|
5499 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, ControlButtonContentInfo icon, UInt16 iconAlignment) -> (ControlHandle outControl)")}, |
|
5500 {"CreateRadioButtonControl", (PyCFunction)Ctl_CreateRadioButtonControl, 1, |
|
5501 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean autoToggle) -> (ControlHandle outControl)")}, |
|
5502 {"CreateCheckBoxControl", (PyCFunction)Ctl_CreateCheckBoxControl, 1, |
|
5503 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean autoToggle) -> (ControlHandle outControl)")}, |
|
5504 {"CreateScrollBarControl", (PyCFunction)Ctl_CreateScrollBarControl, 1, |
|
5505 PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 viewSize, Boolean liveTracking, PyObject* liveTrackingProc) -> (ControlHandle outControl)")}, |
|
5506 {"CreatePopupButtonControl", (PyCFunction)Ctl_CreatePopupButtonControl, 1, |
|
5507 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt16 menuID, Boolean variableWidth, SInt16 titleWidth, SInt16 titleJustification, Style titleStyle) -> (ControlHandle outControl)")}, |
|
5508 {"CreateRadioGroupControl", (PyCFunction)Ctl_CreateRadioGroupControl, 1, |
|
5509 PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")}, |
|
5510 {"CreateScrollingTextBoxControl", (PyCFunction)Ctl_CreateScrollingTextBoxControl, 1, |
|
5511 PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt16 contentResID, Boolean autoScroll, UInt32 delayBeforeAutoScroll, UInt32 delayBetweenAutoScroll, UInt16 autoScrollAmount) -> (ControlHandle outControl)")}, |
|
5512 {"CreateDisclosureButtonControl", (PyCFunction)Ctl_CreateDisclosureButtonControl, 1, |
|
5513 PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, SInt32 inValue, Boolean inAutoToggles) -> (ControlHandle outControl)")}, |
|
5514 {"CreateRoundButtonControl", (PyCFunction)Ctl_CreateRoundButtonControl, 1, |
|
5515 PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, SInt16 inSize, ControlButtonContentInfo inContent) -> (ControlHandle outControl)")}, |
|
5516 {"CreateDataBrowserControl", (PyCFunction)Ctl_CreateDataBrowserControl, 1, |
|
5517 PyDoc_STR("(WindowPtr window, Rect boundsRect, OSType style) -> (ControlHandle outControl)")}, |
|
5518 {"CreateEditUnicodeTextControl", (PyCFunction)Ctl_CreateEditUnicodeTextControl, 1, |
|
5519 PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, ControlFontStyleRec style) -> (ControlHandle outControl)")}, |
|
5520 {"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1, |
|
5521 PyDoc_STR("(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)")}, |
|
5522 {"as_Control", (PyCFunction)Ctl_as_Control, 1, |
|
5523 PyDoc_STR("(Handle h) -> (ControlHandle _rv)")}, |
|
5524 {"CreateTabsControl", (PyCFunction)Ctl_CreateTabsControl, 1, |
|
5525 PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 size, UInt16 direction, ControlTabEntry tabArray) -> (ControlHandle outControl)")}, |
|
5526 {NULL, NULL, 0} |
|
5527 }; |
|
5528 |
|
5529 |
|
5530 |
|
5531 static PyObject * |
|
5532 CtlObj_NewUnmanaged(ControlHandle itself) |
|
5533 { |
|
5534 ControlObject *it; |
|
5535 if (itself == NULL) return PyMac_Error(resNotFound); |
|
5536 it = PyObject_NEW(ControlObject, &Control_Type); |
|
5537 if (it == NULL) return NULL; |
|
5538 it->ob_itself = itself; |
|
5539 it->ob_callbackdict = NULL; |
|
5540 return (PyObject *)it; |
|
5541 } |
|
5542 |
|
5543 static PyObject * |
|
5544 CtlObj_WhichControl(ControlHandle c) |
|
5545 { |
|
5546 PyObject *it; |
|
5547 |
|
5548 if (c == NULL) |
|
5549 it = Py_None; |
|
5550 else { |
|
5551 it = (PyObject *) GetControlReference(c); |
|
5552 /* |
|
5553 ** If the refcon is zero or doesn't point back to the Python object |
|
5554 ** the control is not ours. Return a temporary object. |
|
5555 */ |
|
5556 if (it == NULL || ((ControlObject *)it)->ob_itself != c) |
|
5557 return CtlObj_NewUnmanaged(c); |
|
5558 } |
|
5559 Py_INCREF(it); |
|
5560 return it; |
|
5561 } |
|
5562 |
|
5563 static int |
|
5564 settrackfunc(PyObject *obj) |
|
5565 { |
|
5566 if (tracker) { |
|
5567 PyErr_SetString(Ctl_Error, "Tracker function in use"); |
|
5568 return 0; |
|
5569 } |
|
5570 tracker = obj; |
|
5571 Py_INCREF(tracker); |
|
5572 return 1; |
|
5573 } |
|
5574 |
|
5575 static void |
|
5576 clrtrackfunc(void) |
|
5577 { |
|
5578 Py_XDECREF(tracker); |
|
5579 tracker = 0; |
|
5580 } |
|
5581 |
|
5582 static pascal void |
|
5583 mytracker(ControlHandle ctl, short part) |
|
5584 { |
|
5585 PyObject *args, *rv=0; |
|
5586 |
|
5587 args = Py_BuildValue("(O&i)", CtlObj_WhichControl, ctl, (int)part); |
|
5588 if (args && tracker) { |
|
5589 rv = PyEval_CallObject(tracker, args); |
|
5590 Py_DECREF(args); |
|
5591 } |
|
5592 if (rv) |
|
5593 Py_DECREF(rv); |
|
5594 else { |
|
5595 PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\n"); |
|
5596 PyErr_Print(); |
|
5597 } |
|
5598 } |
|
5599 |
|
5600 static int |
|
5601 setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr *uppp) |
|
5602 { |
|
5603 ControlObject *self = (ControlObject *)myself; |
|
5604 char keybuf[9]; |
|
5605 |
|
5606 if ( which == kMyControlActionProcTag ) |
|
5607 *uppp = (UniversalProcPtr)myactionproc_upp; |
|
5608 else if ( which == kControlUserPaneKeyDownProcTag ) |
|
5609 *uppp = (UniversalProcPtr)mykeydownproc_upp; |
|
5610 else if ( which == kControlUserPaneFocusProcTag ) |
|
5611 *uppp = (UniversalProcPtr)myfocusproc_upp; |
|
5612 else if ( which == kControlUserPaneDrawProcTag ) |
|
5613 *uppp = (UniversalProcPtr)mydrawproc_upp; |
|
5614 else if ( which == kControlUserPaneIdleProcTag ) |
|
5615 *uppp = (UniversalProcPtr)myidleproc_upp; |
|
5616 else if ( which == kControlUserPaneHitTestProcTag ) |
|
5617 *uppp = (UniversalProcPtr)myhittestproc_upp; |
|
5618 else if ( which == kControlUserPaneTrackingProcTag ) |
|
5619 *uppp = (UniversalProcPtr)mytrackingproc_upp; |
|
5620 else |
|
5621 return -1; |
|
5622 /* Only now do we test for clearing of the callback: */ |
|
5623 if ( callback == Py_None ) |
|
5624 *uppp = NULL; |
|
5625 /* Create the dict if it doesn't exist yet (so we don't get such a dict for every control) */ |
|
5626 if ( self->ob_callbackdict == NULL ) |
|
5627 if ( (self->ob_callbackdict = PyDict_New()) == NULL ) |
|
5628 return -1; |
|
5629 /* And store the Python callback */ |
|
5630 sprintf(keybuf, "%x", (unsigned)which); |
|
5631 if (PyDict_SetItemString(self->ob_callbackdict, keybuf, callback) < 0) |
|
5632 return -1; |
|
5633 return 0; |
|
5634 } |
|
5635 |
|
5636 static PyObject * |
|
5637 callcallback(ControlObject *self, OSType which, PyObject *arglist) |
|
5638 { |
|
5639 char keybuf[9]; |
|
5640 PyObject *func, *rv; |
|
5641 |
|
5642 sprintf(keybuf, "%x", (unsigned)which); |
|
5643 if ( self->ob_callbackdict == NULL || |
|
5644 (func = PyDict_GetItemString(self->ob_callbackdict, keybuf)) == NULL ) { |
|
5645 PySys_WriteStderr("Control callback %x without callback object\n", (unsigned)which); |
|
5646 return NULL; |
|
5647 } |
|
5648 rv = PyEval_CallObject(func, arglist); |
|
5649 if ( rv == NULL ) { |
|
5650 PySys_WriteStderr("Exception in control callback %x handler\n", (unsigned)which); |
|
5651 PyErr_Print(); |
|
5652 } |
|
5653 return rv; |
|
5654 } |
|
5655 |
|
5656 static pascal void |
|
5657 myactionproc(ControlHandle control, SInt16 part) |
|
5658 { |
|
5659 ControlObject *ctl_obj; |
|
5660 PyObject *arglist, *rv; |
|
5661 |
|
5662 ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|
5663 arglist = Py_BuildValue("Oh", ctl_obj, part); |
|
5664 rv = callcallback(ctl_obj, kMyControlActionProcTag, arglist); |
|
5665 Py_XDECREF(arglist); |
|
5666 Py_XDECREF(rv); |
|
5667 } |
|
5668 |
|
5669 static pascal ControlPartCode |
|
5670 mykeydownproc(ControlHandle control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers) |
|
5671 { |
|
5672 ControlObject *ctl_obj; |
|
5673 PyObject *arglist, *rv; |
|
5674 short c_rv = 0; |
|
5675 |
|
5676 ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|
5677 arglist = Py_BuildValue("Ohhh", ctl_obj, keyCode, charCode, modifiers); |
|
5678 rv = callcallback(ctl_obj, kControlUserPaneKeyDownProcTag, arglist); |
|
5679 Py_XDECREF(arglist); |
|
5680 if ( rv ) |
|
5681 if (!PyArg_Parse(rv, "h", &c_rv)) |
|
5682 PyErr_Clear(); |
|
5683 Py_XDECREF(rv); |
|
5684 return (ControlPartCode)c_rv; |
|
5685 } |
|
5686 |
|
5687 static pascal ControlPartCode |
|
5688 myfocusproc(ControlHandle control, ControlPartCode part) |
|
5689 { |
|
5690 ControlObject *ctl_obj; |
|
5691 PyObject *arglist, *rv; |
|
5692 short c_rv = kControlFocusNoPart; |
|
5693 |
|
5694 ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|
5695 arglist = Py_BuildValue("Oh", ctl_obj, part); |
|
5696 rv = callcallback(ctl_obj, kControlUserPaneFocusProcTag, arglist); |
|
5697 Py_XDECREF(arglist); |
|
5698 if ( rv ) |
|
5699 if (!PyArg_Parse(rv, "h", &c_rv)) |
|
5700 PyErr_Clear(); |
|
5701 Py_XDECREF(rv); |
|
5702 return (ControlPartCode)c_rv; |
|
5703 } |
|
5704 |
|
5705 static pascal void |
|
5706 mydrawproc(ControlHandle control, SInt16 part) |
|
5707 { |
|
5708 ControlObject *ctl_obj; |
|
5709 PyObject *arglist, *rv; |
|
5710 |
|
5711 ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|
5712 arglist = Py_BuildValue("Oh", ctl_obj, part); |
|
5713 rv = callcallback(ctl_obj, kControlUserPaneDrawProcTag, arglist); |
|
5714 Py_XDECREF(arglist); |
|
5715 Py_XDECREF(rv); |
|
5716 } |
|
5717 |
|
5718 static pascal void |
|
5719 myidleproc(ControlHandle control) |
|
5720 { |
|
5721 ControlObject *ctl_obj; |
|
5722 PyObject *arglist, *rv; |
|
5723 |
|
5724 ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|
5725 arglist = Py_BuildValue("O", ctl_obj); |
|
5726 rv = callcallback(ctl_obj, kControlUserPaneIdleProcTag, arglist); |
|
5727 Py_XDECREF(arglist); |
|
5728 Py_XDECREF(rv); |
|
5729 } |
|
5730 |
|
5731 static pascal ControlPartCode |
|
5732 myhittestproc(ControlHandle control, Point where) |
|
5733 { |
|
5734 ControlObject *ctl_obj; |
|
5735 PyObject *arglist, *rv; |
|
5736 short c_rv = -1; |
|
5737 |
|
5738 ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|
5739 arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, where); |
|
5740 rv = callcallback(ctl_obj, kControlUserPaneHitTestProcTag, arglist); |
|
5741 Py_XDECREF(arglist); |
|
5742 /* Ignore errors, nothing we can do about them */ |
|
5743 if ( rv ) |
|
5744 if (!PyArg_Parse(rv, "h", &c_rv)) |
|
5745 PyErr_Clear(); |
|
5746 Py_XDECREF(rv); |
|
5747 return (ControlPartCode)c_rv; |
|
5748 } |
|
5749 |
|
5750 static pascal ControlPartCode |
|
5751 mytrackingproc(ControlHandle control, Point startPt, ControlActionUPP actionProc) |
|
5752 { |
|
5753 ControlObject *ctl_obj; |
|
5754 PyObject *arglist, *rv; |
|
5755 short c_rv = -1; |
|
5756 |
|
5757 ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|
5758 /* We cannot pass the actionProc without lots of work */ |
|
5759 arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, startPt); |
|
5760 rv = callcallback(ctl_obj, kControlUserPaneTrackingProcTag, arglist); |
|
5761 Py_XDECREF(arglist); |
|
5762 if ( rv ) |
|
5763 if (!PyArg_Parse(rv, "h", &c_rv)) |
|
5764 PyErr_Clear(); |
|
5765 Py_XDECREF(rv); |
|
5766 return (ControlPartCode)c_rv; |
|
5767 } |
|
5768 |
|
5769 #else /* __LP64__ */ |
|
5770 |
|
5771 static PyMethodDef Ctl_methods[] = { |
|
5772 {NULL, NULL, 0} |
|
5773 }; |
|
5774 |
|
5775 #endif /* __LP64__ */ |
|
5776 |
|
5777 void init_Ctl(void) |
|
5778 { |
|
5779 PyObject *m; |
|
5780 |
|
5781 #ifndef __LP64__ |
|
5782 PyObject *d; |
|
5783 |
|
5784 mytracker_upp = NewControlActionUPP(mytracker); |
|
5785 myactionproc_upp = NewControlActionUPP(myactionproc); |
|
5786 mykeydownproc_upp = NewControlUserPaneKeyDownUPP(mykeydownproc); |
|
5787 myfocusproc_upp = NewControlUserPaneFocusUPP(myfocusproc); |
|
5788 mydrawproc_upp = NewControlUserPaneDrawUPP(mydrawproc); |
|
5789 myidleproc_upp = NewControlUserPaneIdleUPP(myidleproc); |
|
5790 myhittestproc_upp = NewControlUserPaneHitTestUPP(myhittestproc); |
|
5791 mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc); |
|
5792 PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New); |
|
5793 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert); |
|
5794 #endif /* !__LP64__ */ |
|
5795 |
|
5796 m = Py_InitModule("_Ctl", Ctl_methods); |
|
5797 |
|
5798 #ifndef __LP64__ |
|
5799 d = PyModule_GetDict(m); |
|
5800 Ctl_Error = PyMac_GetOSErrException(); |
|
5801 if (Ctl_Error == NULL || |
|
5802 PyDict_SetItemString(d, "Error", Ctl_Error) != 0) |
|
5803 return; |
|
5804 Control_Type.ob_type = &PyType_Type; |
|
5805 if (PyType_Ready(&Control_Type) < 0) return; |
|
5806 Py_INCREF(&Control_Type); |
|
5807 PyModule_AddObject(m, "Control", (PyObject *)&Control_Type); |
|
5808 /* Backward-compatible name */ |
|
5809 Py_INCREF(&Control_Type); |
|
5810 PyModule_AddObject(m, "ControlType", (PyObject *)&Control_Type); |
|
5811 #endif /* !__LP64__ */ |
|
5812 } |
|
5813 |
|
5814 /* ======================== End module _Ctl ========================= */ |
|
5815 |