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