PageRenderTime 1364ms CodeModel.GetById 319ms app.highlight 688ms RepoModel.GetById 210ms app.codeStats 3ms

/Mac/Modules/ctl/_Ctlmodule.c

http://unladen-swallow.googlecode.com/
C | 5815 lines | 5442 code | 345 blank | 28 comment | 653 complexity | c92a74b5bb99169d9775d91ee2505c09 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1
   2/* ========================== Module _Ctl =========================== */
   3
   4#include "Python.h"
   5
   6#ifndef __LP64__
   7
   8
   9#include "pymactoolbox.h"
  10
  11/* Macro to test whether a weak-loaded CFM function exists */
  12#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
  13        PyErr_SetString(PyExc_NotImplementedError, \
  14        "Not available in this shared library/OS version"); \
  15        return NULL; \
  16    }} while(0)
  17
  18
  19#include <Carbon/Carbon.h>
  20
  21#ifdef USE_TOOLBOX_OBJECT_GLUE
  22extern PyObject *_CtlObj_New(ControlHandle);
  23extern int _CtlObj_Convert(PyObject *, ControlHandle *);
  24
  25#define CtlObj_New _CtlObj_New
  26#define CtlObj_Convert _CtlObj_Convert
  27#endif
  28
  29static PyObject *CtlObj_WhichControl(ControlHandle);
  30
  31#define as_Control(h) ((ControlHandle)h)
  32#define as_Resource(ctl) ((Handle)ctl)
  33#define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp)
  34
  35#define MAXTABS 32  /* maximum number of tabs that we support in a tabs control */
  36/*
  37** Parse/generate ControlFontStyleRec records
  38*/
  39#if 0 /* Not needed */
  40static PyObject *
  41ControlFontStyle_New(ControlFontStyleRec *itself)
  42{
  43
  44        return Py_BuildValue("hhhhhhO&O&", itself->flags, itself->font,
  45                itself->size, itself->style, itself->mode, itself->just,
  46                QdRGB_New, &itself->foreColor, QdRGB_New, &itself->backColor);
  47}
  48#endif
  49
  50static int
  51ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
  52{
  53        return PyArg_Parse(v, "(hhhhhhO&O&)", &itself->flags,
  54                &itself->font, &itself->size, &itself->style, &itself->mode,
  55                &itself->just, QdRGB_Convert, &itself->foreColor,
  56                QdRGB_Convert, &itself->backColor);
  57}
  58
  59/*
  60** Parse/generate ControlID records
  61*/
  62static PyObject *
  63PyControlID_New(ControlID *itself)
  64{
  65
  66        return Py_BuildValue("O&l", PyMac_BuildOSType, itself->signature, itself->id);
  67}
  68
  69static int
  70PyControlID_Convert(PyObject *v, ControlID *itself)
  71{
  72        return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id);
  73}
  74
  75/*
  76** generate DataBrowserListViewColumnDesc records
  77*/
  78static int
  79DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself)
  80{
  81        return PyArg_Parse(v, "(lO&l)",
  82                           &itself->propertyID,
  83                           PyMac_GetOSType, &itself->propertyType,
  84                           &itself->propertyFlags);
  85}
  86
  87static int
  88ControlButtonContentInfo_Convert(PyObject *v, ControlButtonContentInfo *itself)
  89{
  90        return PyArg_Parse(v, "(hO&)",
  91                           &itself->contentType,
  92                           OptResObj_Convert, &itself->u.iconSuite);
  93}
  94
  95static int
  96DataBrowserListViewHeaderDesc_Convert(PyObject *v, DataBrowserListViewHeaderDesc *itself)
  97{
  98        itself->version = kDataBrowserListViewLatestHeaderDesc;
  99        return PyArg_Parse(v, "(HHhO&HO&O&)",
 100                           &itself->minimumWidth,
 101                           &itself->maximumWidth,
 102                           &itself->titleOffset,
 103                           CFStringRefObj_Convert, &itself->titleString,
 104                           &itself->initialOrder,
 105                           ControlFontStyle_Convert, &itself->btnFontStyle,
 106                           ControlButtonContentInfo_Convert, &itself->btnContentInfo);
 107}
 108
 109static int
 110DataBrowserListViewColumnDesc_Convert(PyObject *v, DataBrowserListViewColumnDesc *itself)
 111{
 112        return PyArg_Parse(v, "(O&O&)",
 113                           DataBrowserTableViewColumnDesc_Convert, &itself->propertyDesc,
 114                           DataBrowserListViewHeaderDesc_Convert, &itself->headerBtnDesc);
 115}
 116
 117/* TrackControl and HandleControlClick callback support */
 118#define kMyControlActionProcTag 'ACTN'  /* not an official tag, only for internal use */
 119static PyObject *tracker;
 120static ControlActionUPP mytracker_upp;
 121static ControlActionUPP myactionproc_upp;
 122static ControlUserPaneKeyDownUPP mykeydownproc_upp;
 123static ControlUserPaneFocusUPP myfocusproc_upp;
 124static ControlUserPaneDrawUPP mydrawproc_upp;
 125static ControlUserPaneIdleUPP myidleproc_upp;
 126static ControlUserPaneHitTestUPP myhittestproc_upp;
 127static ControlUserPaneTrackingUPP mytrackingproc_upp;
 128
 129static int settrackfunc(PyObject *);    /* forward */
 130static void clrtrackfunc(void); /* forward */
 131static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *);
 132
 133static PyObject *Ctl_Error;
 134
 135/* ---------------------- Object type Control ----------------------- */
 136
 137PyTypeObject Control_Type;
 138
 139#define CtlObj_Check(x) ((x)->ob_type == &Control_Type || PyObject_TypeCheck((x), &Control_Type))
 140
 141typedef struct ControlObject {
 142	PyObject_HEAD
 143	ControlHandle ob_itself;
 144	PyObject *ob_callbackdict;
 145} ControlObject;
 146
 147PyObject *CtlObj_New(ControlHandle itself)
 148{
 149	ControlObject *it;
 150	if (itself == NULL) return PyMac_Error(resNotFound);
 151	it = PyObject_NEW(ControlObject, &Control_Type);
 152	if (it == NULL) return NULL;
 153	it->ob_itself = itself;
 154	SetControlReference(itself, (long)it);
 155	it->ob_callbackdict = NULL;
 156	return (PyObject *)it;
 157}
 158
 159int CtlObj_Convert(PyObject *v, ControlHandle *p_itself)
 160{
 161	if (!CtlObj_Check(v))
 162	{
 163		PyErr_SetString(PyExc_TypeError, "Control required");
 164		return 0;
 165	}
 166	*p_itself = ((ControlObject *)v)->ob_itself;
 167	return 1;
 168}
 169
 170static void CtlObj_dealloc(ControlObject *self)
 171{
 172	Py_XDECREF(self->ob_callbackdict);
 173	if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */
 174	self->ob_type->tp_free((PyObject *)self);
 175}
 176
 177static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args)
 178{
 179	PyObject *_res = NULL;
 180	ControlPartCode hiliteState;
 181#ifndef HiliteControl
 182	PyMac_PRECHECK(HiliteControl);
 183#endif
 184	if (!PyArg_ParseTuple(_args, "h",
 185	                      &hiliteState))
 186		return NULL;
 187	HiliteControl(_self->ob_itself,
 188	              hiliteState);
 189	Py_INCREF(Py_None);
 190	_res = Py_None;
 191	return _res;
 192}
 193
 194static PyObject *CtlObj_ShowControl(ControlObject *_self, PyObject *_args)
 195{
 196	PyObject *_res = NULL;
 197#ifndef ShowControl
 198	PyMac_PRECHECK(ShowControl);
 199#endif
 200	if (!PyArg_ParseTuple(_args, ""))
 201		return NULL;
 202	ShowControl(_self->ob_itself);
 203	Py_INCREF(Py_None);
 204	_res = Py_None;
 205	return _res;
 206}
 207
 208static PyObject *CtlObj_HideControl(ControlObject *_self, PyObject *_args)
 209{
 210	PyObject *_res = NULL;
 211#ifndef HideControl
 212	PyMac_PRECHECK(HideControl);
 213#endif
 214	if (!PyArg_ParseTuple(_args, ""))
 215		return NULL;
 216	HideControl(_self->ob_itself);
 217	Py_INCREF(Py_None);
 218	_res = Py_None;
 219	return _res;
 220}
 221
 222static PyObject *CtlObj_IsControlActive(ControlObject *_self, PyObject *_args)
 223{
 224	PyObject *_res = NULL;
 225	Boolean _rv;
 226#ifndef IsControlActive
 227	PyMac_PRECHECK(IsControlActive);
 228#endif
 229	if (!PyArg_ParseTuple(_args, ""))
 230		return NULL;
 231	_rv = IsControlActive(_self->ob_itself);
 232	_res = Py_BuildValue("b",
 233	                     _rv);
 234	return _res;
 235}
 236
 237static PyObject *CtlObj_IsControlVisible(ControlObject *_self, PyObject *_args)
 238{
 239	PyObject *_res = NULL;
 240	Boolean _rv;
 241#ifndef IsControlVisible
 242	PyMac_PRECHECK(IsControlVisible);
 243#endif
 244	if (!PyArg_ParseTuple(_args, ""))
 245		return NULL;
 246	_rv = IsControlVisible(_self->ob_itself);
 247	_res = Py_BuildValue("b",
 248	                     _rv);
 249	return _res;
 250}
 251
 252static PyObject *CtlObj_ActivateControl(ControlObject *_self, PyObject *_args)
 253{
 254	PyObject *_res = NULL;
 255	OSErr _err;
 256#ifndef ActivateControl
 257	PyMac_PRECHECK(ActivateControl);
 258#endif
 259	if (!PyArg_ParseTuple(_args, ""))
 260		return NULL;
 261	_err = ActivateControl(_self->ob_itself);
 262	if (_err != noErr) return PyMac_Error(_err);
 263	Py_INCREF(Py_None);
 264	_res = Py_None;
 265	return _res;
 266}
 267
 268static PyObject *CtlObj_DeactivateControl(ControlObject *_self, PyObject *_args)
 269{
 270	PyObject *_res = NULL;
 271	OSErr _err;
 272#ifndef DeactivateControl
 273	PyMac_PRECHECK(DeactivateControl);
 274#endif
 275	if (!PyArg_ParseTuple(_args, ""))
 276		return NULL;
 277	_err = DeactivateControl(_self->ob_itself);
 278	if (_err != noErr) return PyMac_Error(_err);
 279	Py_INCREF(Py_None);
 280	_res = Py_None;
 281	return _res;
 282}
 283
 284static PyObject *CtlObj_SetControlVisibility(ControlObject *_self, PyObject *_args)
 285{
 286	PyObject *_res = NULL;
 287	OSErr _err;
 288	Boolean inIsVisible;
 289	Boolean inDoDraw;
 290#ifndef SetControlVisibility
 291	PyMac_PRECHECK(SetControlVisibility);
 292#endif
 293	if (!PyArg_ParseTuple(_args, "bb",
 294	                      &inIsVisible,
 295	                      &inDoDraw))
 296		return NULL;
 297	_err = SetControlVisibility(_self->ob_itself,
 298	                            inIsVisible,
 299	                            inDoDraw);
 300	if (_err != noErr) return PyMac_Error(_err);
 301	Py_INCREF(Py_None);
 302	_res = Py_None;
 303	return _res;
 304}
 305
 306static PyObject *CtlObj_IsControlEnabled(ControlObject *_self, PyObject *_args)
 307{
 308	PyObject *_res = NULL;
 309	Boolean _rv;
 310#ifndef IsControlEnabled
 311	PyMac_PRECHECK(IsControlEnabled);
 312#endif
 313	if (!PyArg_ParseTuple(_args, ""))
 314		return NULL;
 315	_rv = IsControlEnabled(_self->ob_itself);
 316	_res = Py_BuildValue("b",
 317	                     _rv);
 318	return _res;
 319}
 320
 321static PyObject *CtlObj_EnableControl(ControlObject *_self, PyObject *_args)
 322{
 323	PyObject *_res = NULL;
 324	OSStatus _err;
 325#ifndef EnableControl
 326	PyMac_PRECHECK(EnableControl);
 327#endif
 328	if (!PyArg_ParseTuple(_args, ""))
 329		return NULL;
 330	_err = EnableControl(_self->ob_itself);
 331	if (_err != noErr) return PyMac_Error(_err);
 332	Py_INCREF(Py_None);
 333	_res = Py_None;
 334	return _res;
 335}
 336
 337static PyObject *CtlObj_DisableControl(ControlObject *_self, PyObject *_args)
 338{
 339	PyObject *_res = NULL;
 340	OSStatus _err;
 341#ifndef DisableControl
 342	PyMac_PRECHECK(DisableControl);
 343#endif
 344	if (!PyArg_ParseTuple(_args, ""))
 345		return NULL;
 346	_err = DisableControl(_self->ob_itself);
 347	if (_err != noErr) return PyMac_Error(_err);
 348	Py_INCREF(Py_None);
 349	_res = Py_None;
 350	return _res;
 351}
 352
 353static PyObject *CtlObj_Draw1Control(ControlObject *_self, PyObject *_args)
 354{
 355	PyObject *_res = NULL;
 356#ifndef Draw1Control
 357	PyMac_PRECHECK(Draw1Control);
 358#endif
 359	if (!PyArg_ParseTuple(_args, ""))
 360		return NULL;
 361	Draw1Control(_self->ob_itself);
 362	Py_INCREF(Py_None);
 363	_res = Py_None;
 364	return _res;
 365}
 366
 367static PyObject *CtlObj_GetBestControlRect(ControlObject *_self, PyObject *_args)
 368{
 369	PyObject *_res = NULL;
 370	OSErr _err;
 371	Rect outRect;
 372	SInt16 outBaseLineOffset;
 373#ifndef GetBestControlRect
 374	PyMac_PRECHECK(GetBestControlRect);
 375#endif
 376	if (!PyArg_ParseTuple(_args, ""))
 377		return NULL;
 378	_err = GetBestControlRect(_self->ob_itself,
 379	                          &outRect,
 380	                          &outBaseLineOffset);
 381	if (_err != noErr) return PyMac_Error(_err);
 382	_res = Py_BuildValue("O&h",
 383	                     PyMac_BuildRect, &outRect,
 384	                     outBaseLineOffset);
 385	return _res;
 386}
 387
 388static PyObject *CtlObj_SetControlFontStyle(ControlObject *_self, PyObject *_args)
 389{
 390	PyObject *_res = NULL;
 391	OSErr _err;
 392	ControlFontStyleRec inStyle;
 393#ifndef SetControlFontStyle
 394	PyMac_PRECHECK(SetControlFontStyle);
 395#endif
 396	if (!PyArg_ParseTuple(_args, "O&",
 397	                      ControlFontStyle_Convert, &inStyle))
 398		return NULL;
 399	_err = SetControlFontStyle(_self->ob_itself,
 400	                           &inStyle);
 401	if (_err != noErr) return PyMac_Error(_err);
 402	Py_INCREF(Py_None);
 403	_res = Py_None;
 404	return _res;
 405}
 406
 407static PyObject *CtlObj_DrawControlInCurrentPort(ControlObject *_self, PyObject *_args)
 408{
 409	PyObject *_res = NULL;
 410#ifndef DrawControlInCurrentPort
 411	PyMac_PRECHECK(DrawControlInCurrentPort);
 412#endif
 413	if (!PyArg_ParseTuple(_args, ""))
 414		return NULL;
 415	DrawControlInCurrentPort(_self->ob_itself);
 416	Py_INCREF(Py_None);
 417	_res = Py_None;
 418	return _res;
 419}
 420
 421static PyObject *CtlObj_SetUpControlBackground(ControlObject *_self, PyObject *_args)
 422{
 423	PyObject *_res = NULL;
 424	OSErr _err;
 425	SInt16 inDepth;
 426	Boolean inIsColorDevice;
 427#ifndef SetUpControlBackground
 428	PyMac_PRECHECK(SetUpControlBackground);
 429#endif
 430	if (!PyArg_ParseTuple(_args, "hb",
 431	                      &inDepth,
 432	                      &inIsColorDevice))
 433		return NULL;
 434	_err = SetUpControlBackground(_self->ob_itself,
 435	                              inDepth,
 436	                              inIsColorDevice);
 437	if (_err != noErr) return PyMac_Error(_err);
 438	Py_INCREF(Py_None);
 439	_res = Py_None;
 440	return _res;
 441}
 442
 443static PyObject *CtlObj_SetUpControlTextColor(ControlObject *_self, PyObject *_args)
 444{
 445	PyObject *_res = NULL;
 446	OSErr _err;
 447	SInt16 inDepth;
 448	Boolean inIsColorDevice;
 449#ifndef SetUpControlTextColor
 450	PyMac_PRECHECK(SetUpControlTextColor);
 451#endif
 452	if (!PyArg_ParseTuple(_args, "hb",
 453	                      &inDepth,
 454	                      &inIsColorDevice))
 455		return NULL;
 456	_err = SetUpControlTextColor(_self->ob_itself,
 457	                             inDepth,
 458	                             inIsColorDevice);
 459	if (_err != noErr) return PyMac_Error(_err);
 460	Py_INCREF(Py_None);
 461	_res = Py_None;
 462	return _res;
 463}
 464
 465static PyObject *CtlObj_DragControl(ControlObject *_self, PyObject *_args)
 466{
 467	PyObject *_res = NULL;
 468	Point startPoint;
 469	Rect limitRect;
 470	Rect slopRect;
 471	DragConstraint axis;
 472#ifndef DragControl
 473	PyMac_PRECHECK(DragControl);
 474#endif
 475	if (!PyArg_ParseTuple(_args, "O&O&O&H",
 476	                      PyMac_GetPoint, &startPoint,
 477	                      PyMac_GetRect, &limitRect,
 478	                      PyMac_GetRect, &slopRect,
 479	                      &axis))
 480		return NULL;
 481	DragControl(_self->ob_itself,
 482	            startPoint,
 483	            &limitRect,
 484	            &slopRect,
 485	            axis);
 486	Py_INCREF(Py_None);
 487	_res = Py_None;
 488	return _res;
 489}
 490
 491static PyObject *CtlObj_TestControl(ControlObject *_self, PyObject *_args)
 492{
 493	PyObject *_res = NULL;
 494	ControlPartCode _rv;
 495	Point testPoint;
 496#ifndef TestControl
 497	PyMac_PRECHECK(TestControl);
 498#endif
 499	if (!PyArg_ParseTuple(_args, "O&",
 500	                      PyMac_GetPoint, &testPoint))
 501		return NULL;
 502	_rv = TestControl(_self->ob_itself,
 503	                  testPoint);
 504	_res = Py_BuildValue("h",
 505	                     _rv);
 506	return _res;
 507}
 508
 509static PyObject *CtlObj_HandleControlContextualMenuClick(ControlObject *_self, PyObject *_args)
 510{
 511	PyObject *_res = NULL;
 512	OSStatus _err;
 513	Point inWhere;
 514	Boolean menuDisplayed;
 515#ifndef HandleControlContextualMenuClick
 516	PyMac_PRECHECK(HandleControlContextualMenuClick);
 517#endif
 518	if (!PyArg_ParseTuple(_args, "O&",
 519	                      PyMac_GetPoint, &inWhere))
 520		return NULL;
 521	_err = HandleControlContextualMenuClick(_self->ob_itself,
 522	                                        inWhere,
 523	                                        &menuDisplayed);
 524	if (_err != noErr) return PyMac_Error(_err);
 525	_res = Py_BuildValue("b",
 526	                     menuDisplayed);
 527	return _res;
 528}
 529
 530static PyObject *CtlObj_GetControlClickActivation(ControlObject *_self, PyObject *_args)
 531{
 532	PyObject *_res = NULL;
 533	OSStatus _err;
 534	Point inWhere;
 535	EventModifiers inModifiers;
 536	ClickActivationResult outResult;
 537#ifndef GetControlClickActivation
 538	PyMac_PRECHECK(GetControlClickActivation);
 539#endif
 540	if (!PyArg_ParseTuple(_args, "O&H",
 541	                      PyMac_GetPoint, &inWhere,
 542	                      &inModifiers))
 543		return NULL;
 544	_err = GetControlClickActivation(_self->ob_itself,
 545	                                 inWhere,
 546	                                 inModifiers,
 547	                                 &outResult);
 548	if (_err != noErr) return PyMac_Error(_err);
 549	_res = Py_BuildValue("l",
 550	                     outResult);
 551	return _res;
 552}
 553
 554static PyObject *CtlObj_HandleControlKey(ControlObject *_self, PyObject *_args)
 555{
 556	PyObject *_res = NULL;
 557	ControlPartCode _rv;
 558	SInt16 inKeyCode;
 559	SInt16 inCharCode;
 560	EventModifiers inModifiers;
 561#ifndef HandleControlKey
 562	PyMac_PRECHECK(HandleControlKey);
 563#endif
 564	if (!PyArg_ParseTuple(_args, "hhH",
 565	                      &inKeyCode,
 566	                      &inCharCode,
 567	                      &inModifiers))
 568		return NULL;
 569	_rv = HandleControlKey(_self->ob_itself,
 570	                       inKeyCode,
 571	                       inCharCode,
 572	                       inModifiers);
 573	_res = Py_BuildValue("h",
 574	                     _rv);
 575	return _res;
 576}
 577
 578static PyObject *CtlObj_HandleControlSetCursor(ControlObject *_self, PyObject *_args)
 579{
 580	PyObject *_res = NULL;
 581	OSStatus _err;
 582	Point localPoint;
 583	EventModifiers modifiers;
 584	Boolean cursorWasSet;
 585#ifndef HandleControlSetCursor
 586	PyMac_PRECHECK(HandleControlSetCursor);
 587#endif
 588	if (!PyArg_ParseTuple(_args, "O&H",
 589	                      PyMac_GetPoint, &localPoint,
 590	                      &modifiers))
 591		return NULL;
 592	_err = HandleControlSetCursor(_self->ob_itself,
 593	                              localPoint,
 594	                              modifiers,
 595	                              &cursorWasSet);
 596	if (_err != noErr) return PyMac_Error(_err);
 597	_res = Py_BuildValue("b",
 598	                     cursorWasSet);
 599	return _res;
 600}
 601
 602static PyObject *CtlObj_MoveControl(ControlObject *_self, PyObject *_args)
 603{
 604	PyObject *_res = NULL;
 605	SInt16 h;
 606	SInt16 v;
 607#ifndef MoveControl
 608	PyMac_PRECHECK(MoveControl);
 609#endif
 610	if (!PyArg_ParseTuple(_args, "hh",
 611	                      &h,
 612	                      &v))
 613		return NULL;
 614	MoveControl(_self->ob_itself,
 615	            h,
 616	            v);
 617	Py_INCREF(Py_None);
 618	_res = Py_None;
 619	return _res;
 620}
 621
 622static PyObject *CtlObj_SizeControl(ControlObject *_self, PyObject *_args)
 623{
 624	PyObject *_res = NULL;
 625	SInt16 w;
 626	SInt16 h;
 627#ifndef SizeControl
 628	PyMac_PRECHECK(SizeControl);
 629#endif
 630	if (!PyArg_ParseTuple(_args, "hh",
 631	                      &w,
 632	                      &h))
 633		return NULL;
 634	SizeControl(_self->ob_itself,
 635	            w,
 636	            h);
 637	Py_INCREF(Py_None);
 638	_res = Py_None;
 639	return _res;
 640}
 641
 642static PyObject *CtlObj_SetControlTitle(ControlObject *_self, PyObject *_args)
 643{
 644	PyObject *_res = NULL;
 645	Str255 title;
 646#ifndef SetControlTitle
 647	PyMac_PRECHECK(SetControlTitle);
 648#endif
 649	if (!PyArg_ParseTuple(_args, "O&",
 650	                      PyMac_GetStr255, title))
 651		return NULL;
 652	SetControlTitle(_self->ob_itself,
 653	                title);
 654	Py_INCREF(Py_None);
 655	_res = Py_None;
 656	return _res;
 657}
 658
 659static PyObject *CtlObj_GetControlTitle(ControlObject *_self, PyObject *_args)
 660{
 661	PyObject *_res = NULL;
 662	Str255 title;
 663#ifndef GetControlTitle
 664	PyMac_PRECHECK(GetControlTitle);
 665#endif
 666	if (!PyArg_ParseTuple(_args, ""))
 667		return NULL;
 668	GetControlTitle(_self->ob_itself,
 669	                title);
 670	_res = Py_BuildValue("O&",
 671	                     PyMac_BuildStr255, title);
 672	return _res;
 673}
 674
 675static PyObject *CtlObj_SetControlTitleWithCFString(ControlObject *_self, PyObject *_args)
 676{
 677	PyObject *_res = NULL;
 678	OSStatus _err;
 679	CFStringRef inString;
 680#ifndef SetControlTitleWithCFString
 681	PyMac_PRECHECK(SetControlTitleWithCFString);
 682#endif
 683	if (!PyArg_ParseTuple(_args, "O&",
 684	                      CFStringRefObj_Convert, &inString))
 685		return NULL;
 686	_err = SetControlTitleWithCFString(_self->ob_itself,
 687	                                   inString);
 688	if (_err != noErr) return PyMac_Error(_err);
 689	Py_INCREF(Py_None);
 690	_res = Py_None;
 691	return _res;
 692}
 693
 694static PyObject *CtlObj_CopyControlTitleAsCFString(ControlObject *_self, PyObject *_args)
 695{
 696	PyObject *_res = NULL;
 697	OSStatus _err;
 698	CFStringRef outString;
 699#ifndef CopyControlTitleAsCFString
 700	PyMac_PRECHECK(CopyControlTitleAsCFString);
 701#endif
 702	if (!PyArg_ParseTuple(_args, ""))
 703		return NULL;
 704	_err = CopyControlTitleAsCFString(_self->ob_itself,
 705	                                  &outString);
 706	if (_err != noErr) return PyMac_Error(_err);
 707	_res = Py_BuildValue("O&",
 708	                     CFStringRefObj_New, outString);
 709	return _res;
 710}
 711
 712static PyObject *CtlObj_GetControlValue(ControlObject *_self, PyObject *_args)
 713{
 714	PyObject *_res = NULL;
 715	SInt16 _rv;
 716#ifndef GetControlValue
 717	PyMac_PRECHECK(GetControlValue);
 718#endif
 719	if (!PyArg_ParseTuple(_args, ""))
 720		return NULL;
 721	_rv = GetControlValue(_self->ob_itself);
 722	_res = Py_BuildValue("h",
 723	                     _rv);
 724	return _res;
 725}
 726
 727static PyObject *CtlObj_SetControlValue(ControlObject *_self, PyObject *_args)
 728{
 729	PyObject *_res = NULL;
 730	SInt16 newValue;
 731#ifndef SetControlValue
 732	PyMac_PRECHECK(SetControlValue);
 733#endif
 734	if (!PyArg_ParseTuple(_args, "h",
 735	                      &newValue))
 736		return NULL;
 737	SetControlValue(_self->ob_itself,
 738	                newValue);
 739	Py_INCREF(Py_None);
 740	_res = Py_None;
 741	return _res;
 742}
 743
 744static PyObject *CtlObj_GetControlMinimum(ControlObject *_self, PyObject *_args)
 745{
 746	PyObject *_res = NULL;
 747	SInt16 _rv;
 748#ifndef GetControlMinimum
 749	PyMac_PRECHECK(GetControlMinimum);
 750#endif
 751	if (!PyArg_ParseTuple(_args, ""))
 752		return NULL;
 753	_rv = GetControlMinimum(_self->ob_itself);
 754	_res = Py_BuildValue("h",
 755	                     _rv);
 756	return _res;
 757}
 758
 759static PyObject *CtlObj_SetControlMinimum(ControlObject *_self, PyObject *_args)
 760{
 761	PyObject *_res = NULL;
 762	SInt16 newMinimum;
 763#ifndef SetControlMinimum
 764	PyMac_PRECHECK(SetControlMinimum);
 765#endif
 766	if (!PyArg_ParseTuple(_args, "h",
 767	                      &newMinimum))
 768		return NULL;
 769	SetControlMinimum(_self->ob_itself,
 770	                  newMinimum);
 771	Py_INCREF(Py_None);
 772	_res = Py_None;
 773	return _res;
 774}
 775
 776static PyObject *CtlObj_GetControlMaximum(ControlObject *_self, PyObject *_args)
 777{
 778	PyObject *_res = NULL;
 779	SInt16 _rv;
 780#ifndef GetControlMaximum
 781	PyMac_PRECHECK(GetControlMaximum);
 782#endif
 783	if (!PyArg_ParseTuple(_args, ""))
 784		return NULL;
 785	_rv = GetControlMaximum(_self->ob_itself);
 786	_res = Py_BuildValue("h",
 787	                     _rv);
 788	return _res;
 789}
 790
 791static PyObject *CtlObj_SetControlMaximum(ControlObject *_self, PyObject *_args)
 792{
 793	PyObject *_res = NULL;
 794	SInt16 newMaximum;
 795#ifndef SetControlMaximum
 796	PyMac_PRECHECK(SetControlMaximum);
 797#endif
 798	if (!PyArg_ParseTuple(_args, "h",
 799	                      &newMaximum))
 800		return NULL;
 801	SetControlMaximum(_self->ob_itself,
 802	                  newMaximum);
 803	Py_INCREF(Py_None);
 804	_res = Py_None;
 805	return _res;
 806}
 807
 808static PyObject *CtlObj_GetControlViewSize(ControlObject *_self, PyObject *_args)
 809{
 810	PyObject *_res = NULL;
 811	SInt32 _rv;
 812#ifndef GetControlViewSize
 813	PyMac_PRECHECK(GetControlViewSize);
 814#endif
 815	if (!PyArg_ParseTuple(_args, ""))
 816		return NULL;
 817	_rv = GetControlViewSize(_self->ob_itself);
 818	_res = Py_BuildValue("l",
 819	                     _rv);
 820	return _res;
 821}
 822
 823static PyObject *CtlObj_SetControlViewSize(ControlObject *_self, PyObject *_args)
 824{
 825	PyObject *_res = NULL;
 826	SInt32 newViewSize;
 827#ifndef SetControlViewSize
 828	PyMac_PRECHECK(SetControlViewSize);
 829#endif
 830	if (!PyArg_ParseTuple(_args, "l",
 831	                      &newViewSize))
 832		return NULL;
 833	SetControlViewSize(_self->ob_itself,
 834	                   newViewSize);
 835	Py_INCREF(Py_None);
 836	_res = Py_None;
 837	return _res;
 838}
 839
 840static PyObject *CtlObj_GetControl32BitValue(ControlObject *_self, PyObject *_args)
 841{
 842	PyObject *_res = NULL;
 843	SInt32 _rv;
 844#ifndef GetControl32BitValue
 845	PyMac_PRECHECK(GetControl32BitValue);
 846#endif
 847	if (!PyArg_ParseTuple(_args, ""))
 848		return NULL;
 849	_rv = GetControl32BitValue(_self->ob_itself);
 850	_res = Py_BuildValue("l",
 851	                     _rv);
 852	return _res;
 853}
 854
 855static PyObject *CtlObj_SetControl32BitValue(ControlObject *_self, PyObject *_args)
 856{
 857	PyObject *_res = NULL;
 858	SInt32 newValue;
 859#ifndef SetControl32BitValue
 860	PyMac_PRECHECK(SetControl32BitValue);
 861#endif
 862	if (!PyArg_ParseTuple(_args, "l",
 863	                      &newValue))
 864		return NULL;
 865	SetControl32BitValue(_self->ob_itself,
 866	                     newValue);
 867	Py_INCREF(Py_None);
 868	_res = Py_None;
 869	return _res;
 870}
 871
 872static PyObject *CtlObj_GetControl32BitMaximum(ControlObject *_self, PyObject *_args)
 873{
 874	PyObject *_res = NULL;
 875	SInt32 _rv;
 876#ifndef GetControl32BitMaximum
 877	PyMac_PRECHECK(GetControl32BitMaximum);
 878#endif
 879	if (!PyArg_ParseTuple(_args, ""))
 880		return NULL;
 881	_rv = GetControl32BitMaximum(_self->ob_itself);
 882	_res = Py_BuildValue("l",
 883	                     _rv);
 884	return _res;
 885}
 886
 887static PyObject *CtlObj_SetControl32BitMaximum(ControlObject *_self, PyObject *_args)
 888{
 889	PyObject *_res = NULL;
 890	SInt32 newMaximum;
 891#ifndef SetControl32BitMaximum
 892	PyMac_PRECHECK(SetControl32BitMaximum);
 893#endif
 894	if (!PyArg_ParseTuple(_args, "l",
 895	                      &newMaximum))
 896		return NULL;
 897	SetControl32BitMaximum(_self->ob_itself,
 898	                       newMaximum);
 899	Py_INCREF(Py_None);
 900	_res = Py_None;
 901	return _res;
 902}
 903
 904static PyObject *CtlObj_GetControl32BitMinimum(ControlObject *_self, PyObject *_args)
 905{
 906	PyObject *_res = NULL;
 907	SInt32 _rv;
 908#ifndef GetControl32BitMinimum
 909	PyMac_PRECHECK(GetControl32BitMinimum);
 910#endif
 911	if (!PyArg_ParseTuple(_args, ""))
 912		return NULL;
 913	_rv = GetControl32BitMinimum(_self->ob_itself);
 914	_res = Py_BuildValue("l",
 915	                     _rv);
 916	return _res;
 917}
 918
 919static PyObject *CtlObj_SetControl32BitMinimum(ControlObject *_self, PyObject *_args)
 920{
 921	PyObject *_res = NULL;
 922	SInt32 newMinimum;
 923#ifndef SetControl32BitMinimum
 924	PyMac_PRECHECK(SetControl32BitMinimum);
 925#endif
 926	if (!PyArg_ParseTuple(_args, "l",
 927	                      &newMinimum))
 928		return NULL;
 929	SetControl32BitMinimum(_self->ob_itself,
 930	                       newMinimum);
 931	Py_INCREF(Py_None);
 932	_res = Py_None;
 933	return _res;
 934}
 935
 936static PyObject *CtlObj_IsValidControlHandle(ControlObject *_self, PyObject *_args)
 937{
 938	PyObject *_res = NULL;
 939	Boolean _rv;
 940#ifndef IsValidControlHandle
 941	PyMac_PRECHECK(IsValidControlHandle);
 942#endif
 943	if (!PyArg_ParseTuple(_args, ""))
 944		return NULL;
 945	_rv = IsValidControlHandle(_self->ob_itself);
 946	_res = Py_BuildValue("b",
 947	                     _rv);
 948	return _res;
 949}
 950
 951static PyObject *CtlObj_SetControlID(ControlObject *_self, PyObject *_args)
 952{
 953	PyObject *_res = NULL;
 954	OSStatus _err;
 955	ControlID inID;
 956#ifndef SetControlID
 957	PyMac_PRECHECK(SetControlID);
 958#endif
 959	if (!PyArg_ParseTuple(_args, "O&",
 960	                      PyControlID_Convert, &inID))
 961		return NULL;
 962	_err = SetControlID(_self->ob_itself,
 963	                    &inID);
 964	if (_err != noErr) return PyMac_Error(_err);
 965	Py_INCREF(Py_None);
 966	_res = Py_None;
 967	return _res;
 968}
 969
 970static PyObject *CtlObj_GetControlID(ControlObject *_self, PyObject *_args)
 971{
 972	PyObject *_res = NULL;
 973	OSStatus _err;
 974	ControlID outID;
 975#ifndef GetControlID
 976	PyMac_PRECHECK(GetControlID);
 977#endif
 978	if (!PyArg_ParseTuple(_args, ""))
 979		return NULL;
 980	_err = GetControlID(_self->ob_itself,
 981	                    &outID);
 982	if (_err != noErr) return PyMac_Error(_err);
 983	_res = Py_BuildValue("O&",
 984	                     PyControlID_New, &outID);
 985	return _res;
 986}
 987
 988static PyObject *CtlObj_SetControlCommandID(ControlObject *_self, PyObject *_args)
 989{
 990	PyObject *_res = NULL;
 991	OSStatus _err;
 992	UInt32 inCommandID;
 993#ifndef SetControlCommandID
 994	PyMac_PRECHECK(SetControlCommandID);
 995#endif
 996	if (!PyArg_ParseTuple(_args, "l",
 997	                      &inCommandID))
 998		return NULL;
 999	_err = SetControlCommandID(_self->ob_itself,
1000	                           inCommandID);
1001	if (_err != noErr) return PyMac_Error(_err);
1002	Py_INCREF(Py_None);
1003	_res = Py_None;
1004	return _res;
1005}
1006
1007static PyObject *CtlObj_GetControlCommandID(ControlObject *_self, PyObject *_args)
1008{
1009	PyObject *_res = NULL;
1010	OSStatus _err;
1011	UInt32 outCommandID;
1012#ifndef GetControlCommandID
1013	PyMac_PRECHECK(GetControlCommandID);
1014#endif
1015	if (!PyArg_ParseTuple(_args, ""))
1016		return NULL;
1017	_err = GetControlCommandID(_self->ob_itself,
1018	                           &outCommandID);
1019	if (_err != noErr) return PyMac_Error(_err);
1020	_res = Py_BuildValue("l",
1021	                     outCommandID);
1022	return _res;
1023}
1024
1025static PyObject *CtlObj_RemoveControlProperty(ControlObject *_self, PyObject *_args)
1026{
1027	PyObject *_res = NULL;
1028	OSStatus _err;
1029	OSType propertyCreator;
1030	OSType propertyTag;
1031#ifndef RemoveControlProperty
1032	PyMac_PRECHECK(RemoveControlProperty);
1033#endif
1034	if (!PyArg_ParseTuple(_args, "O&O&",
1035	                      PyMac_GetOSType, &propertyCreator,
1036	                      PyMac_GetOSType, &propertyTag))
1037		return NULL;
1038	_err = RemoveControlProperty(_self->ob_itself,
1039	                             propertyCreator,
1040	                             propertyTag);
1041	if (_err != noErr) return PyMac_Error(_err);
1042	Py_INCREF(Py_None);
1043	_res = Py_None;
1044	return _res;
1045}
1046
1047static PyObject *CtlObj_GetControlPropertyAttributes(ControlObject *_self, PyObject *_args)
1048{
1049	PyObject *_res = NULL;
1050	OSStatus _err;
1051	OSType propertyCreator;
1052	OSType propertyTag;
1053	UInt32 attributes;
1054#ifndef GetControlPropertyAttributes
1055	PyMac_PRECHECK(GetControlPropertyAttributes);
1056#endif
1057	if (!PyArg_ParseTuple(_args, "O&O&",
1058	                      PyMac_GetOSType, &propertyCreator,
1059	                      PyMac_GetOSType, &propertyTag))
1060		return NULL;
1061	_err = GetControlPropertyAttributes(_self->ob_itself,
1062	                                    propertyCreator,
1063	                                    propertyTag,
1064	                                    &attributes);
1065	if (_err != noErr) return PyMac_Error(_err);
1066	_res = Py_BuildValue("l",
1067	                     attributes);
1068	return _res;
1069}
1070
1071static PyObject *CtlObj_ChangeControlPropertyAttributes(ControlObject *_self, PyObject *_args)
1072{
1073	PyObject *_res = NULL;
1074	OSStatus _err;
1075	OSType propertyCreator;
1076	OSType propertyTag;
1077	UInt32 attributesToSet;
1078	UInt32 attributesToClear;
1079#ifndef ChangeControlPropertyAttributes
1080	PyMac_PRECHECK(ChangeControlPropertyAttributes);
1081#endif
1082	if (!PyArg_ParseTuple(_args, "O&O&ll",
1083	                      PyMac_GetOSType, &propertyCreator,
1084	                      PyMac_GetOSType, &propertyTag,
1085	                      &attributesToSet,
1086	                      &attributesToClear))
1087		return NULL;
1088	_err = ChangeControlPropertyAttributes(_self->ob_itself,
1089	                                       propertyCreator,
1090	                                       propertyTag,
1091	                                       attributesToSet,
1092	                                       attributesToClear);
1093	if (_err != noErr) return PyMac_Error(_err);
1094	Py_INCREF(Py_None);
1095	_res = Py_None;
1096	return _res;
1097}
1098
1099static PyObject *CtlObj_GetControlRegion(ControlObject *_self, PyObject *_args)
1100{
1101	PyObject *_res = NULL;
1102	OSStatus _err;
1103	ControlPartCode inPart;
1104	RgnHandle outRegion;
1105#ifndef GetControlRegion
1106	PyMac_PRECHECK(GetControlRegion);
1107#endif
1108	if (!PyArg_ParseTuple(_args, "hO&",
1109	                      &inPart,
1110	                      ResObj_Convert, &outRegion))
1111		return NULL;
1112	_err = GetControlRegion(_self->ob_itself,
1113	                        inPart,
1114	                        outRegion);
1115	if (_err != noErr) return PyMac_Error(_err);
1116	Py_INCREF(Py_None);
1117	_res = Py_None;
1118	return _res;
1119}
1120
1121static PyObject *CtlObj_GetControlVariant(ControlObject *_self, PyObject *_args)
1122{
1123	PyObject *_res = NULL;
1124	ControlVariant _rv;
1125#ifndef GetControlVariant
1126	PyMac_PRECHECK(GetControlVariant);
1127#endif
1128	if (!PyArg_ParseTuple(_args, ""))
1129		return NULL;
1130	_rv = GetControlVariant(_self->ob_itself);
1131	_res = Py_BuildValue("h",
1132	                     _rv);
1133	return _res;
1134}
1135
1136static PyObject *CtlObj_SetControlAction(ControlObject *_self, PyObject *_args)
1137{
1138	PyObject *_res = NULL;
1139	PyObject* actionProc;
1140	UniversalProcPtr c_callback;
1141#ifndef SetControlAction
1142	PyMac_PRECHECK(SetControlAction);
1143#endif
1144	if (!PyArg_ParseTuple(_args, "O",
1145	                      &actionProc))
1146		return NULL;
1147	SetControlAction(_self->ob_itself,
1148	                 myactionproc_upp);
1149	Py_INCREF(Py_None);
1150	_res = Py_None;
1151	setcallback((PyObject*)_self, kMyControlActionProcTag, actionProc, &c_callback);
1152	return _res;
1153}
1154
1155static PyObject *CtlObj_SetControlReference(ControlObject *_self, PyObject *_args)
1156{
1157	PyObject *_res = NULL;
1158	SInt32 data;
1159#ifndef SetControlReference
1160	PyMac_PRECHECK(SetControlReference);
1161#endif
1162	if (!PyArg_ParseTuple(_args, "l",
1163	                      &data))
1164		return NULL;
1165	SetControlReference(_self->ob_itself,
1166	                    data);
1167	Py_INCREF(Py_None);
1168	_res = Py_None;
1169	return _res;
1170}
1171
1172static PyObject *CtlObj_GetControlReference(ControlObject *_self, PyObject *_args)
1173{
1174	PyObject *_res = NULL;
1175	SInt32 _rv;
1176#ifndef GetControlReference
1177	PyMac_PRECHECK(GetControlReference);
1178#endif
1179	if (!PyArg_ParseTuple(_args, ""))
1180		return NULL;
1181	_rv = GetControlReference(_self->ob_itself);
1182	_res = Py_BuildValue("l",
1183	                     _rv);
1184	return _res;
1185}
1186
1187static PyObject *CtlObj_EmbedControl(ControlObject *_self, PyObject *_args)
1188{
1189	PyObject *_res = NULL;
1190	OSErr _err;
1191	ControlHandle inContainer;
1192#ifndef EmbedControl
1193	PyMac_PRECHECK(EmbedControl);
1194#endif
1195	if (!PyArg_ParseTuple(_args, "O&",
1196	                      CtlObj_Convert, &inContainer))
1197		return NULL;
1198	_err = EmbedControl(_self->ob_itself,
1199	                    inContainer);
1200	if (_err != noErr) return PyMac_Error(_err);
1201	Py_INCREF(Py_None);
1202	_res = Py_None;
1203	return _res;
1204}
1205
1206static PyObject *CtlObj_AutoEmbedControl(ControlObject *_self, PyObject *_args)
1207{
1208	PyObject *_res = NULL;
1209	OSErr _err;
1210	WindowPtr inWindow;
1211#ifndef AutoEmbedControl
1212	PyMac_PRECHECK(AutoEmbedControl);
1213#endif
1214	if (!PyArg_ParseTuple(_args, "O&",
1215	                      WinObj_Convert, &inWindow))
1216		return NULL;
1217	_err = AutoEmbedControl(_self->ob_itself,
1218	                        inWindow);
1219	if (_err != noErr) return PyMac_Error(_err);
1220	Py_INCREF(Py_None);
1221	_res = Py_None;
1222	return _res;
1223}
1224
1225static PyObject *CtlObj_GetSuperControl(ControlObject *_self, PyObject *_args)
1226{
1227	PyObject *_res = NULL;
1228	OSErr _err;
1229	ControlHandle outParent;
1230#ifndef GetSuperControl
1231	PyMac_PRECHECK(GetSuperControl);
1232#endif
1233	if (!PyArg_ParseTuple(_args, ""))
1234		return NULL;
1235	_err = GetSuperControl(_self->ob_itself,
1236	                       &outParent);
1237	if (_err != noErr) return PyMac_Error(_err);
1238	_res = Py_BuildValue("O&",
1239	                     CtlObj_WhichControl, outParent);
1240	return _res;
1241}
1242
1243static PyObject *CtlObj_CountSubControls(ControlObject *_self, PyObject *_args)
1244{
1245	PyObject *_res = NULL;
1246	OSErr _err;
1247	UInt16 outNumChildren;
1248#ifndef CountSubControls
1249	PyMac_PRECHECK(CountSubControls);
1250#endif
1251	if (!PyArg_ParseTuple(_args, ""))
1252		return NULL;
1253	_err = CountSubControls(_self->ob_itself,
1254	                        &outNumChildren);
1255	if (_err != noErr) return PyMac_Error(_err);
1256	_res = Py_BuildValue("H",
1257	                     outNumChildren);
1258	return _res;
1259}
1260
1261static PyObject *CtlObj_GetIndexedSubControl(ControlObject *_self, PyObject *_args)
1262{
1263	PyObject *_res = NULL;
1264	OSErr _err;
1265	UInt16 inIndex;
1266	ControlHandle outSubControl;
1267#ifndef GetIndexedSubControl
1268	PyMac_PRECHECK(GetIndexedSubControl);
1269#endif
1270	if (!PyArg_ParseTuple(_args, "H",
1271	                      &inIndex))
1272		return NULL;
1273	_err = GetIndexedSubControl(_self->ob_itself,
1274	                            inIndex,
1275	                            &outSubControl);
1276	if (_err != noErr) return PyMac_Error(_err);
1277	_res = Py_BuildValue("O&",
1278	                     CtlObj_WhichControl, outSubControl);
1279	return _res;
1280}
1281
1282static PyObject *CtlObj_SetControlSupervisor(ControlObject *_self, PyObject *_args)
1283{
1284	PyObject *_res = NULL;
1285	OSErr _err;
1286	ControlHandle inBoss;
1287#ifndef SetControlSupervisor
1288	PyMac_PRECHECK(SetControlSupervisor);
1289#endif
1290	if (!PyArg_ParseTuple(_args, "O&",
1291	                      CtlObj_Convert, &inBoss))
1292		return NULL;
1293	_err = SetControlSupervisor(_self->ob_itself,
1294	                            inBoss);
1295	if (_err != noErr) return PyMac_Error(_err);
1296	Py_INCREF(Py_None);
1297	_res = Py_None;
1298	return _res;
1299}
1300
1301static PyObject *CtlObj_GetControlFeatures(ControlObject *_self, PyObject *_args)
1302{
1303	PyObject *_res = NULL;
1304	OSErr _err;
1305	UInt32 outFeatures;
1306#ifndef GetControlFeatures
1307	PyMac_PRECHECK(GetControlFeatures);
1308#endif
1309	if (!PyArg_ParseTuple(_args, ""))
1310		return NULL;
1311	_err = GetControlFeatures(_self->ob_itself,
1312	                          &outFeatures);
1313	if (_err != noErr) return PyMac_Error(_err);
1314	_res = Py_BuildValue("l",
1315	                     outFeatures);
1316	return _res;
1317}
1318
1319static PyObject *CtlObj_GetControlDataSize(ControlObject *_self, PyObject *_args)
1320{
1321	PyObject *_res = NULL;
1322	OSErr _err;
1323	ControlPartCode inPart;
1324	ResType inTagName;
1325	Size outMaxSize;
1326#ifndef GetControlDataSize
1327	PyMac_PRECHECK(GetControlDataSize);
1328#endif
1329	if (!PyArg_ParseTuple(_args, "hO&",
1330	                      &inPart,
1331	                      PyMac_GetOSType, &inTagName))
1332		return NULL;
1333	_err = GetControlDataSize(_self->ob_itself,
1334	                          inPart,
1335	                          inTagName,
1336	                          &outMaxSize);
1337	if (_err != noErr) return PyMac_Error(_err);
1338	_res = Py_BuildValue("l",
1339	                     outMaxSize);
1340	return _res;
1341}
1342
1343static PyObject *CtlObj_HandleControlDragTracking(ControlObject *_self, PyObject *_args)
1344{
1345	PyObject *_res = NULL;
1346	OSStatus _err;
1347	DragTrackingMessage inMessage;
1348	DragReference inDrag;
1349	Boolean outLikesDrag;
1350#ifndef HandleControlDragTracking
1351	PyMac_PRECHECK(HandleControlDragTracking);
1352#endif
1353	if (!PyArg_ParseTuple(_args, "hO&",
1354	                      &inMessage,
1355	                      DragObj_Convert, &inDrag))
1356		return NULL;
1357	_err = HandleControlDragTracking(_self->ob_itself,
1358	                                 inMessage,
1359	                                 inDrag,
1360	                                 &outLikesDrag);
1361	if (_err != noErr) return PyMac_Error(_err);
1362	_res = Py_BuildValue("b",
1363	                     outLikesDrag);
1364	return _res;
1365}
1366
1367static PyObject *CtlObj_HandleControlDragReceive(ControlObject *_self, PyObject *_args)
1368{
1369	PyObject *_res = NULL;
1370	OSStatus _err;
1371	DragReference inDrag;
1372#ifndef HandleControlDragReceive
1373	PyMac_PRECHECK(HandleControlDragReceive);
1374#endif
1375	if (!PyArg_ParseTuple(_args, "O&",
1376	                      DragObj_Convert, &inDrag))
1377		return NULL;
1378	_err = HandleControlDragReceive(_self->ob_itself,
1379	                                inDrag);
1380	if (_err != noErr) return PyMac_Error(_err);
1381	Py_INCREF(Py_None);
1382	_res = Py_None;
1383	return _res;
1384}
1385
1386static PyObject *CtlObj_SetControlDragTrackingEnabled(ControlObject *_self, PyObject *_args)
1387{
1388	PyObject *_res = NULL;
1389	OSStatus _err;
1390	Boolean inTracks;
1391#ifndef SetControlDragTrackingEnabled
1392	PyMac_PRECHECK(SetControlDragTrackingEnabled);
1393#endif
1394	if (!PyArg_ParseTuple(_args, "b",
1395	                      &inTracks))
1396		return NULL;
1397	_err = SetControlDragTrackingEnabled(_self->ob_itself,
1398	                                     inTracks);
1399	if (_err != noErr) return PyMac_Error(_err);
1400	Py_INCREF(Py_None);
1401	_res = Py_None;
1402	return _res;
1403}
1404
1405static PyObject *CtlObj_IsControlDragTrackingEnabled(ControlObject *_self, PyObject *_args)
1406{
1407	PyObject *_res = NULL;
1408	OSStatus _err;
1409	Boolean outTracks;
1410#ifndef IsControlDragTrackingEnabled
1411	PyMac_PRECHECK(IsControlDragTrackingEnabled);
1412#endif
1413	if (!PyArg_ParseTuple(_args, ""))
1414		return NULL;
1415	_err = IsControlDragTrackingEnabled(_self->ob_itself,
1416	                                    &outTracks);
1417	if (_err != noErr) return PyMac_Error(_err);
1418	_res = Py_BuildValue("b",
1419	                     outTracks);
1420	return _res;
1421}
1422
1423static PyObject *CtlObj_GetControlBounds(ControlObject *_self, PyObject *_args)
1424{
1425	PyObject *_res = NULL;
1426	Rect bounds;
1427#ifndef GetControlBounds
1428	PyMac_PRECHECK(GetControlBounds);
1429#endif
1430	if (!PyArg_ParseTuple(_args, ""))
1431		return NULL;
1432	GetControlBounds(_self->ob_itself,
1433	                 &bounds);
1434	_res = Py_BuildValue("O&",
1435	                     PyMac_BuildRect, &bounds);
1436	return _res;
1437}
1438
1439static PyObject *CtlObj_IsControlHilited(ControlObject *_self, PyObject *_args)
1440{
1441	PyObject *_res = NULL;
1442	Boolean _rv;
1443#ifndef IsControlHilited
1444	PyMac_PRECHECK(IsControlHilited);
1445#endif
1446	if (!PyArg_ParseTuple(_args, ""))
1447		return NULL;
1448	_rv = IsControlHilited(_self->ob_itself);
1449	_res = Py_BuildValue("b",
1450	                     _rv);
1451	return _res;
1452}
1453
1454static PyObject *CtlObj_GetControlHilite(ControlObject *_self, PyObject *_args)
1455{
1456	PyObject *_res = NULL;
1457	UInt16 _rv;
1458#ifndef GetControlHilite
1459	PyMac_PRECHECK(GetControlHilite);
1460#endif
1461	if (!PyArg_ParseTuple(_args, ""))
1462		return NULL;
1463	_rv = GetControlHilite(_self->ob_itself);
1464	_res = Py_BuildValue("H",
1465	                     _rv);
1466	return _res;
1467}
1468
1469static PyObject *CtlObj_GetControlOwner(ControlObject *_self, PyObject *_args)
1470{
1471	PyObject *_res = NULL;
1472	WindowPtr _rv;
1473#ifndef GetControlOwner
1474	PyMac_PRECHECK(GetControlOwner);
1475#endif
1476	if (!PyArg_ParseTuple(_args, ""))
1477		return NULL;
1478	_rv = GetControlOwner(_self->ob_itself);
1479	_res = Py_BuildValue("O&",
1480	                     WinObj_New, _rv);
1481	return _res;
1482}
1483
1484static PyObject *CtlObj_GetControlDataHandle(ControlObject *_self, PyObject *_args)
1485{
1486	PyObject *_res = NULL;
1487	Handle _rv;
1488#ifndef GetControlDataHandle
1489	PyMac_PRECHECK(GetControlDataHandle);
1490#endif
1491	if (!PyArg_ParseTuple(_args, ""))
1492		return NULL;
1493	_rv = GetControlDataHandle(_self->ob_itself);
1494	_res = Py_BuildValue("O&",
1495	                     ResObj_New, _rv);
1496	return _res;
1497}
1498
1499static PyObject *CtlObj_GetControlPopupMenuHandle(ControlObject *_self, PyObject *_args)
1500{
1501	PyObject *_res = NULL;
1502	MenuHandle _rv;
1503#ifndef GetControlPopupMenuHandle
1504	PyMac_PRECHECK(GetControlPopupMenuHandle);
1505#endif
1506	if (!PyArg_ParseTuple(_args, ""))
1507		return NULL;
1508	_rv = GetControlPopupMenuHandle(_self->ob_itself);
1509	_res = Py_BuildValue("O&",
1510	                     MenuObj_New, _rv);
1511	return _res;
1512}
1513
1514static PyObject *CtlObj_GetControlPopupMenuID(ControlObject *_self, PyObject *_args)
1515{
1516	PyObject *_res = NULL;
1517	short _rv;
1518#ifndef GetControlPopupMenuID
1519	PyMac_PRECHECK(GetControlPopupMenuID);
1520#endif
1521	if (!PyArg_ParseTuple(_args, ""))
1522		return NULL;
1523	_rv = GetControlPopupMenuID(_self->ob_itself);
1524	_res = Py_BuildValue("h",
1525	                     _rv);
1526	return _res;
1527}
1528
1529static PyObject *CtlObj_SetControlDataHandle(ControlObject *_self, PyObject *_args)
1530{
1531	PyObject *_res = NULL;
1532	Handle dataHandle;
1533#ifndef SetControlDataHandle
1534	PyMac_PRECHECK(SetControlDataHandle);
1535#endif
1536	if (!PyArg_ParseTuple(_args, "O&",
1537	                      ResObj_Convert, &dataHandle))
1538		return NULL;
1539	SetControlDataHandle(_self->ob_itself,
1540	                     dataHandle);
1541	Py_INCREF(Py_None);
1542	_res = Py_None;
1543	return _res;
1544}
1545
1546static PyObject *CtlObj_SetControlBounds(ControlObject *_self, PyObject *_args)
1547{
1548	PyObject *_res = NULL;
1549	Rect bounds;
1550#ifndef SetControlBounds
1551	PyMac_PRECHECK(SetControlBounds);
1552#endif
1553	if (!PyArg_ParseTuple(_args, "O&",
1554	                      PyMac_GetRect, &bounds))
1555		return NULL;
1556	SetControlBounds(_self->ob_itself,
1557	                 &bounds);
1558	Py_INCREF(Py_None);
1559	_res = Py_None;
1560	return _res;
1561}
1562
1563static PyObject *CtlObj_SetControlPopupMenuHandle(ControlObject *_self, PyObject *_args)
1564{
1565	PyObject *_res = NULL;
1566	MenuHandle popupMenu;
1567#ifndef SetControlPopupMenuHandle
1568	PyMac_PRECHECK(SetControlPopupMenuHandle);
1569#endif
1570	if (!PyArg_ParseTuple(_args, "O&",
1571	                      MenuObj_Convert, &popupMenu))
1572		return NULL;
1573	SetControlPopupMenuHandle(_self->ob_itself,
1574	                          popupMenu);
1575	Py_INCREF(Py_None);
1576	_res = Py_None;
1577	return _res;
1578}
1579
1580static PyObject *CtlObj_SetControlPopupMenuID(ControlObject *_self, PyObject *_args)
1581{
1582	PyObject *_res = NULL;
1583	short menuID;
1584#ifndef SetControlPopupMenuID
1585	PyMac_PRECHECK(SetControlPopupMenuID);
1586#endif
1587	if (!PyArg_ParseTuple(_args, "h",
1588	                      &menuID))
1589		return NULL;
1590	SetControlPopupMenuID(_self->ob_itself,
1591	                      menuID);
1592	Py_INCREF(Py_None);
1593	_res = Py_None;
1594	return _res;
1595}
1596
1597static PyObject *CtlObj_GetBevelButtonMenuValue(ControlObject *_self, PyObject *_args)
1598{
1599	PyObject *_res = NULL;
1600	OSErr _err;
1601	SInt16 outValue;
1602#ifndef GetBevelButtonMenuValue
1603	PyMac_PRECHECK(GetBevelButtonMenuValue);
1604#endif
1605	if (!PyArg_ParseTuple(_args, ""))
1606		return NULL;
1607	_err = GetBevelButtonMenuValue(_self->ob_itself,
1608	                               &outValue);
1609	if (_err != noErr) return PyMac_Error(_err);
1610	_res = Py_BuildValue("h",
1611	                     outValue);
1612	return _res;
1613}
1614
1615static PyObject *CtlObj_SetBevelButtonMenuValue(ControlObject *_self, PyObject *_args)
1616{
1617	PyObject *_res = NULL;
1618	OSErr _err;
1619	SInt16 inValue;
1620#ifndef SetBevelButtonMenuValue
1621	PyMac_PRECHECK(SetBevelButtonMenuValue);
1622#endif
1623	if (!PyArg_ParseTuple(_args, "h",
1624	                      &inValue))
1625		return NULL;
1626	_err = SetBevelButtonMenuValue(_self->ob_itself,
1627	                               inValue);
1628	if (_err != noErr) return PyMac_Error(_err);
1629	Py_INCREF(Py_None);
1630	_res = Py_None;
1631	return _res;
1632}
1633
1634static PyObject *CtlObj_GetBevelButtonMenuHandle(ControlObject *_self, PyObject *_args)
1635{
1636	PyObject *_res = NULL;
1637	OSErr _err;
1638	MenuHandle outHandle;
1639#ifndef GetBevelButtonMenuHandle
1640	PyMac_PRECHECK(GetBevelButtonMenuHandle);
1641#endif
1642	if (!PyArg_ParseTuple(_args, ""))
1643		return NULL;
1644	_err = GetBevelButtonMenuHandle(_self->ob_itself,
1645	                                &outHandle);
1646	if (_err != noErr) return PyMac_Error(_err);
1647	_res = Py_BuildValue("O&",
1648	                     MenuObj_New, outHandle);
1649	return _res;
1650}
1651
1652static PyObject *CtlObj_SetBevelButtonContentInfo(ControlObject *_self, PyObject *_args)
1653{
1654	PyObject *_res = NULL;
1655	OSErr _err;
1656	ControlButtonContentInfo inContent;
1657#ifndef SetBevelButtonContentInfo
1658	PyMac_PRECHECK(SetBevelButtonContentInfo);
1659#endif
1660	if (!PyArg_ParseTuple(_args, "O&",
1661	                      ControlButtonContentInfo_Convert, &inContent))
1662		return NULL;
1663	_err = SetBevelButtonContentInfo(_self->ob_itself,
1664	                                 &inContent);
1665	if (_err != noErr) return PyMac_Error(_err);
1666	Py_INCREF(Py_None);
1667	_res = Py_None;
1668	return _res;
1669}
1670
1671static PyObject *CtlObj_SetBevelButtonTransform(ControlObject *_self, PyObject *_args)
1672{
1673	PyObject *_res = NULL;
1674	OSErr _err;
1675	IconTransformType transform;
1676#ifndef SetBevelButtonTransform
1677	PyMac_PRECHECK(SetBevelButtonTransform);
1678#endif
1679	if (!PyArg_ParseTuple(_args, "h",
1680	                      &transform))
1681		return NULL;
1682	_err = SetBevelButtonTransform(_self->ob_itself,
1683	                               transform);
1684	if (_err != noErr) return PyMac_Error(_err);
1685	Py_INCREF(Py_None);
1686	_res = Py_None;
1687	return _res;
1688}
1689
1690static PyObject *CtlObj_SetDisclosureTriangleLastValue(ControlObject *_self, PyObject *_args)
1691{
1692	PyObject *_res = NULL;
1693	OSErr _err;
1694	SInt16 inValue;
1695#ifndef SetDisclosureTriangleLastValue
1696	PyMac_PRECHECK(SetDisclosureTriangleLastValue);
1697#endif
1698	if (!PyArg_ParseTuple(_args, "h",
1699	                      &inValue))
1700		return NULL;
1701	_err = SetDisclosureTriangleLastValue(_self->ob_itself,
1702	                                      inValue);
1703	if (_err != noErr) return PyMac_Error(_err);
1704	Py_INCREF(Py_None);
1705	_res = Py_None;
1706	return _res;
1707}
1708
1709static PyObject *CtlObj_GetTabContentRect(ControlObject *_self, PyObject *_args)
1710{
1711	PyObject *_res = NULL;
1712	OSErr _err;
1713	Rect outContentRect;
1714#ifndef GetTabContentRect
1715	PyMac_PRECHECK(GetTabContentRect);
1716#endif
1717	if (!PyArg_ParseTuple(_args, ""))
1718		return NULL;
1719	_err = GetTabContentRect(_self->ob_itself,
1720	                         &outContentRect);
1721	if (_err != noErr) return PyMac_Error(_err);
1722	_res = Py_BuildValue("O&",
1723	                     PyMac_BuildRect, &outContentRect);
1724	return _res;
1725}
1726
1727static PyObject *CtlObj_SetTabEnabled(ControlObject *_self, PyObject *_args)
1728{
1729	PyObject *_res = NULL;
1730	OSErr _err;
1731	SInt16 inTabToHilite;
1732	Boolean inEnabled;
1733#ifndef SetTabEnabled
1734	PyMac_PRECHECK(SetTabEnabled);
1735#endif
1736	if (!PyArg_ParseTuple(_args, "hb",
1737	                      &inTabToHilite,
1738	                      &inEnabled))
1739		return NULL;
1740	_err = SetTabEnabled(_self->ob_itself,
1741	                     inTabToHilite,
1742	                     inEnabled);
1743	if (_err != noErr) return PyMac_Error(_err);
1744	Py_INCREF(Py_None);
1745	_res = Py_None;
1746	return _res;
1747}
1748
1749static PyObject *CtlObj_SetImageWellContentInfo(ControlObject *_self, PyObject *_args)
1750{
1751	PyObject *_res = NULL;
1752	OSErr _err;
1753	ControlButtonContentInfo inContent;
1754#ifndef SetImageWellContentInfo
1755	PyMac_PRECHECK(SetImageWellContentInfo);
1756#endif
1757	if (!PyArg_ParseTuple(_args, "O&",
1758	                      ControlButtonContentInfo_Convert, &inContent))
1759		return NULL;
1760	_err = SetImageWellContentInfo(_self->ob_itself,
1761	                               &inContent);
1762	if (_err != noErr) return PyMac_Error(_err);
1763	Py_INCREF(Py_None);
1764	_res = Py_None;
1765	return _res;
1766}
1767
1768static PyObject *CtlObj_SetImageWellTransform(ControlObject *_self, PyObject *_args)
1769{
1770	PyObject *_res = NULL;
1771	OSErr _err;
1772	IconTransformType inTransform;
1773#ifndef SetImageWellTransform
1774	PyMac_PRECHECK(SetImageWellTransform);
1775#endif
1776	if (!PyArg_ParseTuple(_args, "h",
1777	                      &inTransform))
1778		return NULL;
1779	_err = SetImageWellTransform(_self->ob_itself,
1780	                             inTransform);
1781	if (_err != noErr) return PyMac_Error(_err);
1782	Py_INCREF(Py_None);
1783	_res = Py_None;
1784	return _res;
1785}
1786
1787static PyObject *CtlObj_GetDataBrowserViewStyle(ControlObject *_self, PyObject *_args)
1788{
1789	PyObject *_res = NULL;
1790	OSStatus _err;
1791	OSType style;
1792#ifndef GetDataBrowserViewStyle
1793	PyMac_PRECHECK(GetDataBrowserViewStyle);
1794#endif
1795	if (!PyArg_ParseTuple(_args, ""))
1796		return NULL;
1797	_err = GetDataBrowserViewStyle(_self->ob_itself,
1798	                               &style);
1799	if (_err != noErr) return PyMac_Error(_err);
1800	_res = Py_BuildValue("O&",
1801	                     PyMac_BuildOSType, style);
1802	return _res;
1803}
1804
1805static PyObject *CtlObj_SetDataBrowserViewStyle(ControlObject *_self, PyObject *_args)
1806{
1807	PyObject *_res = NULL;
1808	OSStatus _err;
1809	OSType style;
1810#ifndef SetDataBrowserViewStyle
1811	PyMac_PRECHECK(SetDataBrowserViewStyle);
1812#endif
1813	if (!PyArg_ParseTuple(_args, "O&",
1814	                      PyMac_GetOSType, &style))
1815		return NULL;
1816	_err = SetDataBrowserViewStyle(_self->ob_itself,
1817	                               style);
1818	if (_err != noErr) return PyMac_Error(_err);
1819	Py_INCREF(Py_None);
1820	_res = Py_None;
1821	return _res;
1822}
1823
1824static PyObject *CtlObj_EnableDataBrowserEditCommand(ControlObject *_self, PyObject *_args)
1825{
1826	PyObject *_res = NULL;
1827	Boolean _rv;
1828	UInt32 command;
1829#ifndef EnableDataBrowserEditCommand
1830	PyMac_PRECHECK(EnableDataBrowserEditCommand);
1831#endif
1832	if (!PyArg_ParseTuple(_args, "l",
1833	                      &command))
1834		return NULL;
1835	_rv = EnableDataBrowserEditCommand(_self->ob_itself,
1836	                                   command);
1837	_res = Py_BuildValue("b",
1838	                     _rv);
1839	return _res;
1840}
1841
1842static PyObject *CtlObj_ExecuteDataBrowserEditCommand(ControlObject *_self, PyObject *_args)
1843{
1844	PyObject *_res = NULL;
1845	OSStatus _err;
1846	UInt32 command;
1847#ifndef ExecuteDataBrowserEditCommand
1848	PyMac_PRECHECK(ExecuteDataBrowserEditCommand);
1849#endif
1850	if (!PyArg_ParseTuple(_args, "l",
1851	                      &command))
1852		return NULL;
1853	_err = ExecuteDataBrowserEditCommand(_self->ob_itself,
1854	                                     command);
1855	if (_err != noErr) return PyMac_Error(_err);
1856	Py_INCREF(Py_None);
1857	_res = Py_None;
1858	return _res;
1859}
1860
1861static PyObject *CtlObj_GetDataBrowserSelectionAnchor(ControlObject *_self, PyObject *_args)
1862{
1863	PyObject *_res = NULL;
1864	OSStatus _err;
1865	UInt32 first;
1866	UInt32 last;
1867#ifndef GetDataBrowserSelectionAnchor
1868	PyMac_PRECHECK(GetDataBrowserSelectionAnchor);
1869#endif
1870	if (!PyArg_ParseTuple(_args, ""))
1871		

Large files files are truncated, but you can click here to view the full file