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