Jack Jansen | 50ecb0a | 2001-08-23 14:02:09 +0000 | [diff] [blame^] | 1 | |
| 2 | /* ========================== Module _App =========================== */ |
| 3 | |
| 4 | #include "Python.h" |
| 5 | |
| 6 | |
| 7 | |
| 8 | #include "macglue.h" |
| 9 | #include "pymactoolbox.h" |
| 10 | |
| 11 | /* Macro to test whether a weak-loaded CFM function exists */ |
| 12 | #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ |
| 13 | PyErr_SetString(PyExc_NotImplementedError, \ |
| 14 | "Not available in this shared library/OS version"); \ |
| 15 | return NULL; \ |
| 16 | }} while(0) |
| 17 | |
| 18 | |
| 19 | #ifdef WITHOUT_FRAMEWORKS |
| 20 | #include <Appearance.h> |
| 21 | #else |
| 22 | #include <Carbon/Carbon.h> |
| 23 | #endif |
| 24 | |
| 25 | |
| 26 | static PyObject *App_Error; |
| 27 | |
| 28 | static PyObject *App_RegisterAppearanceClient(PyObject *_self, PyObject *_args) |
| 29 | { |
| 30 | PyObject *_res = NULL; |
| 31 | OSStatus _err; |
| 32 | if (!PyArg_ParseTuple(_args, "")) |
| 33 | return NULL; |
| 34 | _err = RegisterAppearanceClient(); |
| 35 | if (_err != noErr) return PyMac_Error(_err); |
| 36 | Py_INCREF(Py_None); |
| 37 | _res = Py_None; |
| 38 | return _res; |
| 39 | } |
| 40 | |
| 41 | static PyObject *App_UnregisterAppearanceClient(PyObject *_self, PyObject *_args) |
| 42 | { |
| 43 | PyObject *_res = NULL; |
| 44 | OSStatus _err; |
| 45 | if (!PyArg_ParseTuple(_args, "")) |
| 46 | return NULL; |
| 47 | _err = UnregisterAppearanceClient(); |
| 48 | if (_err != noErr) return PyMac_Error(_err); |
| 49 | Py_INCREF(Py_None); |
| 50 | _res = Py_None; |
| 51 | return _res; |
| 52 | } |
| 53 | |
| 54 | static PyObject *App_SetThemePen(PyObject *_self, PyObject *_args) |
| 55 | { |
| 56 | PyObject *_res = NULL; |
| 57 | OSStatus _err; |
| 58 | ThemeBrush inBrush; |
| 59 | SInt16 inDepth; |
| 60 | Boolean inIsColorDevice; |
| 61 | if (!PyArg_ParseTuple(_args, "hhb", |
| 62 | &inBrush, |
| 63 | &inDepth, |
| 64 | &inIsColorDevice)) |
| 65 | return NULL; |
| 66 | _err = SetThemePen(inBrush, |
| 67 | inDepth, |
| 68 | inIsColorDevice); |
| 69 | if (_err != noErr) return PyMac_Error(_err); |
| 70 | Py_INCREF(Py_None); |
| 71 | _res = Py_None; |
| 72 | return _res; |
| 73 | } |
| 74 | |
| 75 | static PyObject *App_SetThemeBackground(PyObject *_self, PyObject *_args) |
| 76 | { |
| 77 | PyObject *_res = NULL; |
| 78 | OSStatus _err; |
| 79 | ThemeBrush inBrush; |
| 80 | SInt16 inDepth; |
| 81 | Boolean inIsColorDevice; |
| 82 | if (!PyArg_ParseTuple(_args, "hhb", |
| 83 | &inBrush, |
| 84 | &inDepth, |
| 85 | &inIsColorDevice)) |
| 86 | return NULL; |
| 87 | _err = SetThemeBackground(inBrush, |
| 88 | inDepth, |
| 89 | inIsColorDevice); |
| 90 | if (_err != noErr) return PyMac_Error(_err); |
| 91 | Py_INCREF(Py_None); |
| 92 | _res = Py_None; |
| 93 | return _res; |
| 94 | } |
| 95 | |
| 96 | static PyObject *App_SetThemeTextColor(PyObject *_self, PyObject *_args) |
| 97 | { |
| 98 | PyObject *_res = NULL; |
| 99 | OSStatus _err; |
| 100 | ThemeTextColor inColor; |
| 101 | SInt16 inDepth; |
| 102 | Boolean inIsColorDevice; |
| 103 | if (!PyArg_ParseTuple(_args, "hhb", |
| 104 | &inColor, |
| 105 | &inDepth, |
| 106 | &inIsColorDevice)) |
| 107 | return NULL; |
| 108 | _err = SetThemeTextColor(inColor, |
| 109 | inDepth, |
| 110 | inIsColorDevice); |
| 111 | if (_err != noErr) return PyMac_Error(_err); |
| 112 | Py_INCREF(Py_None); |
| 113 | _res = Py_None; |
| 114 | return _res; |
| 115 | } |
| 116 | |
| 117 | static PyObject *App_SetThemeWindowBackground(PyObject *_self, PyObject *_args) |
| 118 | { |
| 119 | PyObject *_res = NULL; |
| 120 | OSStatus _err; |
| 121 | WindowPtr inWindow; |
| 122 | ThemeBrush inBrush; |
| 123 | Boolean inUpdate; |
| 124 | if (!PyArg_ParseTuple(_args, "O&hb", |
| 125 | WinObj_Convert, &inWindow, |
| 126 | &inBrush, |
| 127 | &inUpdate)) |
| 128 | return NULL; |
| 129 | _err = SetThemeWindowBackground(inWindow, |
| 130 | inBrush, |
| 131 | inUpdate); |
| 132 | if (_err != noErr) return PyMac_Error(_err); |
| 133 | Py_INCREF(Py_None); |
| 134 | _res = Py_None; |
| 135 | return _res; |
| 136 | } |
| 137 | |
| 138 | static PyObject *App_DrawThemeWindowHeader(PyObject *_self, PyObject *_args) |
| 139 | { |
| 140 | PyObject *_res = NULL; |
| 141 | OSStatus _err; |
| 142 | Rect inRect; |
| 143 | ThemeDrawState inState; |
| 144 | if (!PyArg_ParseTuple(_args, "O&l", |
| 145 | PyMac_GetRect, &inRect, |
| 146 | &inState)) |
| 147 | return NULL; |
| 148 | _err = DrawThemeWindowHeader(&inRect, |
| 149 | inState); |
| 150 | if (_err != noErr) return PyMac_Error(_err); |
| 151 | Py_INCREF(Py_None); |
| 152 | _res = Py_None; |
| 153 | return _res; |
| 154 | } |
| 155 | |
| 156 | static PyObject *App_DrawThemeWindowListViewHeader(PyObject *_self, PyObject *_args) |
| 157 | { |
| 158 | PyObject *_res = NULL; |
| 159 | OSStatus _err; |
| 160 | Rect inRect; |
| 161 | ThemeDrawState inState; |
| 162 | if (!PyArg_ParseTuple(_args, "O&l", |
| 163 | PyMac_GetRect, &inRect, |
| 164 | &inState)) |
| 165 | return NULL; |
| 166 | _err = DrawThemeWindowListViewHeader(&inRect, |
| 167 | inState); |
| 168 | if (_err != noErr) return PyMac_Error(_err); |
| 169 | Py_INCREF(Py_None); |
| 170 | _res = Py_None; |
| 171 | return _res; |
| 172 | } |
| 173 | |
| 174 | static PyObject *App_DrawThemePlacard(PyObject *_self, PyObject *_args) |
| 175 | { |
| 176 | PyObject *_res = NULL; |
| 177 | OSStatus _err; |
| 178 | Rect inRect; |
| 179 | ThemeDrawState inState; |
| 180 | if (!PyArg_ParseTuple(_args, "O&l", |
| 181 | PyMac_GetRect, &inRect, |
| 182 | &inState)) |
| 183 | return NULL; |
| 184 | _err = DrawThemePlacard(&inRect, |
| 185 | inState); |
| 186 | if (_err != noErr) return PyMac_Error(_err); |
| 187 | Py_INCREF(Py_None); |
| 188 | _res = Py_None; |
| 189 | return _res; |
| 190 | } |
| 191 | |
| 192 | static PyObject *App_DrawThemeEditTextFrame(PyObject *_self, PyObject *_args) |
| 193 | { |
| 194 | PyObject *_res = NULL; |
| 195 | OSStatus _err; |
| 196 | Rect inRect; |
| 197 | ThemeDrawState inState; |
| 198 | if (!PyArg_ParseTuple(_args, "O&l", |
| 199 | PyMac_GetRect, &inRect, |
| 200 | &inState)) |
| 201 | return NULL; |
| 202 | _err = DrawThemeEditTextFrame(&inRect, |
| 203 | inState); |
| 204 | if (_err != noErr) return PyMac_Error(_err); |
| 205 | Py_INCREF(Py_None); |
| 206 | _res = Py_None; |
| 207 | return _res; |
| 208 | } |
| 209 | |
| 210 | static PyObject *App_DrawThemeListBoxFrame(PyObject *_self, PyObject *_args) |
| 211 | { |
| 212 | PyObject *_res = NULL; |
| 213 | OSStatus _err; |
| 214 | Rect inRect; |
| 215 | ThemeDrawState inState; |
| 216 | if (!PyArg_ParseTuple(_args, "O&l", |
| 217 | PyMac_GetRect, &inRect, |
| 218 | &inState)) |
| 219 | return NULL; |
| 220 | _err = DrawThemeListBoxFrame(&inRect, |
| 221 | inState); |
| 222 | if (_err != noErr) return PyMac_Error(_err); |
| 223 | Py_INCREF(Py_None); |
| 224 | _res = Py_None; |
| 225 | return _res; |
| 226 | } |
| 227 | |
| 228 | static PyObject *App_DrawThemeFocusRect(PyObject *_self, PyObject *_args) |
| 229 | { |
| 230 | PyObject *_res = NULL; |
| 231 | OSStatus _err; |
| 232 | Rect inRect; |
| 233 | Boolean inHasFocus; |
| 234 | if (!PyArg_ParseTuple(_args, "O&b", |
| 235 | PyMac_GetRect, &inRect, |
| 236 | &inHasFocus)) |
| 237 | return NULL; |
| 238 | _err = DrawThemeFocusRect(&inRect, |
| 239 | inHasFocus); |
| 240 | if (_err != noErr) return PyMac_Error(_err); |
| 241 | Py_INCREF(Py_None); |
| 242 | _res = Py_None; |
| 243 | return _res; |
| 244 | } |
| 245 | |
| 246 | static PyObject *App_DrawThemePrimaryGroup(PyObject *_self, PyObject *_args) |
| 247 | { |
| 248 | PyObject *_res = NULL; |
| 249 | OSStatus _err; |
| 250 | Rect inRect; |
| 251 | ThemeDrawState inState; |
| 252 | if (!PyArg_ParseTuple(_args, "O&l", |
| 253 | PyMac_GetRect, &inRect, |
| 254 | &inState)) |
| 255 | return NULL; |
| 256 | _err = DrawThemePrimaryGroup(&inRect, |
| 257 | inState); |
| 258 | if (_err != noErr) return PyMac_Error(_err); |
| 259 | Py_INCREF(Py_None); |
| 260 | _res = Py_None; |
| 261 | return _res; |
| 262 | } |
| 263 | |
| 264 | static PyObject *App_DrawThemeSecondaryGroup(PyObject *_self, PyObject *_args) |
| 265 | { |
| 266 | PyObject *_res = NULL; |
| 267 | OSStatus _err; |
| 268 | Rect inRect; |
| 269 | ThemeDrawState inState; |
| 270 | if (!PyArg_ParseTuple(_args, "O&l", |
| 271 | PyMac_GetRect, &inRect, |
| 272 | &inState)) |
| 273 | return NULL; |
| 274 | _err = DrawThemeSecondaryGroup(&inRect, |
| 275 | inState); |
| 276 | if (_err != noErr) return PyMac_Error(_err); |
| 277 | Py_INCREF(Py_None); |
| 278 | _res = Py_None; |
| 279 | return _res; |
| 280 | } |
| 281 | |
| 282 | static PyObject *App_DrawThemeSeparator(PyObject *_self, PyObject *_args) |
| 283 | { |
| 284 | PyObject *_res = NULL; |
| 285 | OSStatus _err; |
| 286 | Rect inRect; |
| 287 | ThemeDrawState inState; |
| 288 | if (!PyArg_ParseTuple(_args, "O&l", |
| 289 | PyMac_GetRect, &inRect, |
| 290 | &inState)) |
| 291 | return NULL; |
| 292 | _err = DrawThemeSeparator(&inRect, |
| 293 | inState); |
| 294 | if (_err != noErr) return PyMac_Error(_err); |
| 295 | Py_INCREF(Py_None); |
| 296 | _res = Py_None; |
| 297 | return _res; |
| 298 | } |
| 299 | |
| 300 | static PyObject *App_DrawThemeModelessDialogFrame(PyObject *_self, PyObject *_args) |
| 301 | { |
| 302 | PyObject *_res = NULL; |
| 303 | OSStatus _err; |
| 304 | Rect inRect; |
| 305 | ThemeDrawState inState; |
| 306 | if (!PyArg_ParseTuple(_args, "O&l", |
| 307 | PyMac_GetRect, &inRect, |
| 308 | &inState)) |
| 309 | return NULL; |
| 310 | _err = DrawThemeModelessDialogFrame(&inRect, |
| 311 | inState); |
| 312 | if (_err != noErr) return PyMac_Error(_err); |
| 313 | Py_INCREF(Py_None); |
| 314 | _res = Py_None; |
| 315 | return _res; |
| 316 | } |
| 317 | |
| 318 | static PyObject *App_DrawThemeGenericWell(PyObject *_self, PyObject *_args) |
| 319 | { |
| 320 | PyObject *_res = NULL; |
| 321 | OSStatus _err; |
| 322 | Rect inRect; |
| 323 | ThemeDrawState inState; |
| 324 | Boolean inFillCenter; |
| 325 | if (!PyArg_ParseTuple(_args, "O&lb", |
| 326 | PyMac_GetRect, &inRect, |
| 327 | &inState, |
| 328 | &inFillCenter)) |
| 329 | return NULL; |
| 330 | _err = DrawThemeGenericWell(&inRect, |
| 331 | inState, |
| 332 | inFillCenter); |
| 333 | if (_err != noErr) return PyMac_Error(_err); |
| 334 | Py_INCREF(Py_None); |
| 335 | _res = Py_None; |
| 336 | return _res; |
| 337 | } |
| 338 | |
| 339 | static PyObject *App_DrawThemeFocusRegion(PyObject *_self, PyObject *_args) |
| 340 | { |
| 341 | PyObject *_res = NULL; |
| 342 | OSStatus _err; |
| 343 | Boolean inHasFocus; |
| 344 | if (!PyArg_ParseTuple(_args, "b", |
| 345 | &inHasFocus)) |
| 346 | return NULL; |
| 347 | _err = DrawThemeFocusRegion((RgnHandle)0, |
| 348 | inHasFocus); |
| 349 | if (_err != noErr) return PyMac_Error(_err); |
| 350 | Py_INCREF(Py_None); |
| 351 | _res = Py_None; |
| 352 | return _res; |
| 353 | } |
| 354 | |
| 355 | static PyObject *App_IsThemeInColor(PyObject *_self, PyObject *_args) |
| 356 | { |
| 357 | PyObject *_res = NULL; |
| 358 | Boolean _rv; |
| 359 | SInt16 inDepth; |
| 360 | Boolean inIsColorDevice; |
| 361 | if (!PyArg_ParseTuple(_args, "hb", |
| 362 | &inDepth, |
| 363 | &inIsColorDevice)) |
| 364 | return NULL; |
| 365 | _rv = IsThemeInColor(inDepth, |
| 366 | inIsColorDevice); |
| 367 | _res = Py_BuildValue("b", |
| 368 | _rv); |
| 369 | return _res; |
| 370 | } |
| 371 | |
| 372 | static PyObject *App_GetThemeAccentColors(PyObject *_self, PyObject *_args) |
| 373 | { |
| 374 | PyObject *_res = NULL; |
| 375 | OSStatus _err; |
| 376 | CTabHandle outColors; |
| 377 | if (!PyArg_ParseTuple(_args, "")) |
| 378 | return NULL; |
| 379 | _err = GetThemeAccentColors(&outColors); |
| 380 | if (_err != noErr) return PyMac_Error(_err); |
| 381 | _res = Py_BuildValue("O&", |
| 382 | ResObj_New, outColors); |
| 383 | return _res; |
| 384 | } |
| 385 | |
| 386 | static PyObject *App_DrawThemeMenuBarBackground(PyObject *_self, PyObject *_args) |
| 387 | { |
| 388 | PyObject *_res = NULL; |
| 389 | OSStatus _err; |
| 390 | Rect inBounds; |
| 391 | ThemeMenuBarState inState; |
| 392 | UInt32 inAttributes; |
| 393 | if (!PyArg_ParseTuple(_args, "O&Hl", |
| 394 | PyMac_GetRect, &inBounds, |
| 395 | &inState, |
| 396 | &inAttributes)) |
| 397 | return NULL; |
| 398 | _err = DrawThemeMenuBarBackground(&inBounds, |
| 399 | inState, |
| 400 | inAttributes); |
| 401 | if (_err != noErr) return PyMac_Error(_err); |
| 402 | Py_INCREF(Py_None); |
| 403 | _res = Py_None; |
| 404 | return _res; |
| 405 | } |
| 406 | |
| 407 | static PyObject *App_GetThemeMenuBarHeight(PyObject *_self, PyObject *_args) |
| 408 | { |
| 409 | PyObject *_res = NULL; |
| 410 | OSStatus _err; |
| 411 | SInt16 outHeight; |
| 412 | if (!PyArg_ParseTuple(_args, "")) |
| 413 | return NULL; |
| 414 | _err = GetThemeMenuBarHeight(&outHeight); |
| 415 | if (_err != noErr) return PyMac_Error(_err); |
| 416 | _res = Py_BuildValue("h", |
| 417 | outHeight); |
| 418 | return _res; |
| 419 | } |
| 420 | |
| 421 | static PyObject *App_DrawThemeMenuBackground(PyObject *_self, PyObject *_args) |
| 422 | { |
| 423 | PyObject *_res = NULL; |
| 424 | OSStatus _err; |
| 425 | Rect inMenuRect; |
| 426 | ThemeMenuType inMenuType; |
| 427 | if (!PyArg_ParseTuple(_args, "O&H", |
| 428 | PyMac_GetRect, &inMenuRect, |
| 429 | &inMenuType)) |
| 430 | return NULL; |
| 431 | _err = DrawThemeMenuBackground(&inMenuRect, |
| 432 | inMenuType); |
| 433 | if (_err != noErr) return PyMac_Error(_err); |
| 434 | Py_INCREF(Py_None); |
| 435 | _res = Py_None; |
| 436 | return _res; |
| 437 | } |
| 438 | |
| 439 | static PyObject *App_GetThemeMenuBackgroundRegion(PyObject *_self, PyObject *_args) |
| 440 | { |
| 441 | PyObject *_res = NULL; |
| 442 | OSStatus _err; |
| 443 | Rect inMenuRect; |
| 444 | ThemeMenuType menuType; |
| 445 | if (!PyArg_ParseTuple(_args, "O&H", |
| 446 | PyMac_GetRect, &inMenuRect, |
| 447 | &menuType)) |
| 448 | return NULL; |
| 449 | _err = GetThemeMenuBackgroundRegion(&inMenuRect, |
| 450 | menuType, |
| 451 | (RgnHandle)0); |
| 452 | if (_err != noErr) return PyMac_Error(_err); |
| 453 | Py_INCREF(Py_None); |
| 454 | _res = Py_None; |
| 455 | return _res; |
| 456 | } |
| 457 | |
| 458 | static PyObject *App_DrawThemeMenuSeparator(PyObject *_self, PyObject *_args) |
| 459 | { |
| 460 | PyObject *_res = NULL; |
| 461 | OSStatus _err; |
| 462 | Rect inItemRect; |
| 463 | if (!PyArg_ParseTuple(_args, "O&", |
| 464 | PyMac_GetRect, &inItemRect)) |
| 465 | return NULL; |
| 466 | _err = DrawThemeMenuSeparator(&inItemRect); |
| 467 | if (_err != noErr) return PyMac_Error(_err); |
| 468 | Py_INCREF(Py_None); |
| 469 | _res = Py_None; |
| 470 | return _res; |
| 471 | } |
| 472 | |
| 473 | static PyObject *App_GetThemeMenuSeparatorHeight(PyObject *_self, PyObject *_args) |
| 474 | { |
| 475 | PyObject *_res = NULL; |
| 476 | OSStatus _err; |
| 477 | SInt16 outHeight; |
| 478 | if (!PyArg_ParseTuple(_args, "")) |
| 479 | return NULL; |
| 480 | _err = GetThemeMenuSeparatorHeight(&outHeight); |
| 481 | if (_err != noErr) return PyMac_Error(_err); |
| 482 | _res = Py_BuildValue("h", |
| 483 | outHeight); |
| 484 | return _res; |
| 485 | } |
| 486 | |
| 487 | static PyObject *App_GetThemeMenuItemExtra(PyObject *_self, PyObject *_args) |
| 488 | { |
| 489 | PyObject *_res = NULL; |
| 490 | OSStatus _err; |
| 491 | ThemeMenuItemType inItemType; |
| 492 | SInt16 outHeight; |
| 493 | SInt16 outWidth; |
| 494 | if (!PyArg_ParseTuple(_args, "H", |
| 495 | &inItemType)) |
| 496 | return NULL; |
| 497 | _err = GetThemeMenuItemExtra(inItemType, |
| 498 | &outHeight, |
| 499 | &outWidth); |
| 500 | if (_err != noErr) return PyMac_Error(_err); |
| 501 | _res = Py_BuildValue("hh", |
| 502 | outHeight, |
| 503 | outWidth); |
| 504 | return _res; |
| 505 | } |
| 506 | |
| 507 | static PyObject *App_GetThemeMenuTitleExtra(PyObject *_self, PyObject *_args) |
| 508 | { |
| 509 | PyObject *_res = NULL; |
| 510 | OSStatus _err; |
| 511 | SInt16 outWidth; |
| 512 | Boolean inIsSquished; |
| 513 | if (!PyArg_ParseTuple(_args, "b", |
| 514 | &inIsSquished)) |
| 515 | return NULL; |
| 516 | _err = GetThemeMenuTitleExtra(&outWidth, |
| 517 | inIsSquished); |
| 518 | if (_err != noErr) return PyMac_Error(_err); |
| 519 | _res = Py_BuildValue("h", |
| 520 | outWidth); |
| 521 | return _res; |
| 522 | } |
| 523 | |
| 524 | static PyObject *App_DrawThemeTabPane(PyObject *_self, PyObject *_args) |
| 525 | { |
| 526 | PyObject *_res = NULL; |
| 527 | OSStatus _err; |
| 528 | Rect inRect; |
| 529 | ThemeDrawState inState; |
| 530 | if (!PyArg_ParseTuple(_args, "O&l", |
| 531 | PyMac_GetRect, &inRect, |
| 532 | &inState)) |
| 533 | return NULL; |
| 534 | _err = DrawThemeTabPane(&inRect, |
| 535 | inState); |
| 536 | if (_err != noErr) return PyMac_Error(_err); |
| 537 | Py_INCREF(Py_None); |
| 538 | _res = Py_None; |
| 539 | return _res; |
| 540 | } |
| 541 | |
| 542 | static PyObject *App_GetThemeTabRegion(PyObject *_self, PyObject *_args) |
| 543 | { |
| 544 | PyObject *_res = NULL; |
| 545 | OSStatus _err; |
| 546 | Rect inRect; |
| 547 | ThemeTabStyle inStyle; |
| 548 | ThemeTabDirection inDirection; |
| 549 | if (!PyArg_ParseTuple(_args, "O&HH", |
| 550 | PyMac_GetRect, &inRect, |
| 551 | &inStyle, |
| 552 | &inDirection)) |
| 553 | return NULL; |
| 554 | _err = GetThemeTabRegion(&inRect, |
| 555 | inStyle, |
| 556 | inDirection, |
| 557 | (RgnHandle)0); |
| 558 | if (_err != noErr) return PyMac_Error(_err); |
| 559 | Py_INCREF(Py_None); |
| 560 | _res = Py_None; |
| 561 | return _res; |
| 562 | } |
| 563 | |
| 564 | static PyObject *App_SetThemeCursor(PyObject *_self, PyObject *_args) |
| 565 | { |
| 566 | PyObject *_res = NULL; |
| 567 | OSStatus _err; |
| 568 | ThemeCursor inCursor; |
| 569 | if (!PyArg_ParseTuple(_args, "l", |
| 570 | &inCursor)) |
| 571 | return NULL; |
| 572 | _err = SetThemeCursor(inCursor); |
| 573 | if (_err != noErr) return PyMac_Error(_err); |
| 574 | Py_INCREF(Py_None); |
| 575 | _res = Py_None; |
| 576 | return _res; |
| 577 | } |
| 578 | |
| 579 | static PyObject *App_SetAnimatedThemeCursor(PyObject *_self, PyObject *_args) |
| 580 | { |
| 581 | PyObject *_res = NULL; |
| 582 | OSStatus _err; |
| 583 | ThemeCursor inCursor; |
| 584 | UInt32 inAnimationStep; |
| 585 | if (!PyArg_ParseTuple(_args, "ll", |
| 586 | &inCursor, |
| 587 | &inAnimationStep)) |
| 588 | return NULL; |
| 589 | _err = SetAnimatedThemeCursor(inCursor, |
| 590 | inAnimationStep); |
| 591 | if (_err != noErr) return PyMac_Error(_err); |
| 592 | Py_INCREF(Py_None); |
| 593 | _res = Py_None; |
| 594 | return _res; |
| 595 | } |
| 596 | |
| 597 | static PyObject *App_GetThemeScrollBarThumbStyle(PyObject *_self, PyObject *_args) |
| 598 | { |
| 599 | PyObject *_res = NULL; |
| 600 | OSStatus _err; |
| 601 | ThemeScrollBarThumbStyle outStyle; |
| 602 | if (!PyArg_ParseTuple(_args, "")) |
| 603 | return NULL; |
| 604 | _err = GetThemeScrollBarThumbStyle(&outStyle); |
| 605 | if (_err != noErr) return PyMac_Error(_err); |
| 606 | _res = Py_BuildValue("H", |
| 607 | outStyle); |
| 608 | return _res; |
| 609 | } |
| 610 | |
| 611 | static PyObject *App_GetThemeScrollBarArrowStyle(PyObject *_self, PyObject *_args) |
| 612 | { |
| 613 | PyObject *_res = NULL; |
| 614 | OSStatus _err; |
| 615 | ThemeScrollBarArrowStyle outStyle; |
| 616 | if (!PyArg_ParseTuple(_args, "")) |
| 617 | return NULL; |
| 618 | _err = GetThemeScrollBarArrowStyle(&outStyle); |
| 619 | if (_err != noErr) return PyMac_Error(_err); |
| 620 | _res = Py_BuildValue("H", |
| 621 | outStyle); |
| 622 | return _res; |
| 623 | } |
| 624 | |
| 625 | static PyObject *App_GetThemeCheckBoxStyle(PyObject *_self, PyObject *_args) |
| 626 | { |
| 627 | PyObject *_res = NULL; |
| 628 | OSStatus _err; |
| 629 | ThemeCheckBoxStyle outStyle; |
| 630 | if (!PyArg_ParseTuple(_args, "")) |
| 631 | return NULL; |
| 632 | _err = GetThemeCheckBoxStyle(&outStyle); |
| 633 | if (_err != noErr) return PyMac_Error(_err); |
| 634 | _res = Py_BuildValue("H", |
| 635 | outStyle); |
| 636 | return _res; |
| 637 | } |
| 638 | |
| 639 | static PyObject *App_UseThemeFont(PyObject *_self, PyObject *_args) |
| 640 | { |
| 641 | PyObject *_res = NULL; |
| 642 | OSStatus _err; |
| 643 | ThemeFontID inFontID; |
| 644 | ScriptCode inScript; |
| 645 | if (!PyArg_ParseTuple(_args, "Hh", |
| 646 | &inFontID, |
| 647 | &inScript)) |
| 648 | return NULL; |
| 649 | _err = UseThemeFont(inFontID, |
| 650 | inScript); |
| 651 | if (_err != noErr) return PyMac_Error(_err); |
| 652 | Py_INCREF(Py_None); |
| 653 | _res = Py_None; |
| 654 | return _res; |
| 655 | } |
| 656 | |
| 657 | static PyObject *App_DrawThemeScrollBarArrows(PyObject *_self, PyObject *_args) |
| 658 | { |
| 659 | PyObject *_res = NULL; |
| 660 | OSStatus _err; |
| 661 | Rect bounds; |
| 662 | ThemeTrackEnableState enableState; |
| 663 | ThemeTrackPressState pressState; |
| 664 | Boolean isHoriz; |
| 665 | Rect trackBounds; |
| 666 | if (!PyArg_ParseTuple(_args, "O&bbb", |
| 667 | PyMac_GetRect, &bounds, |
| 668 | &enableState, |
| 669 | &pressState, |
| 670 | &isHoriz)) |
| 671 | return NULL; |
| 672 | _err = DrawThemeScrollBarArrows(&bounds, |
| 673 | enableState, |
| 674 | pressState, |
| 675 | isHoriz, |
| 676 | &trackBounds); |
| 677 | if (_err != noErr) return PyMac_Error(_err); |
| 678 | _res = Py_BuildValue("O&", |
| 679 | PyMac_BuildRect, &trackBounds); |
| 680 | return _res; |
| 681 | } |
| 682 | |
| 683 | static PyObject *App_GetThemeScrollBarTrackRect(PyObject *_self, PyObject *_args) |
| 684 | { |
| 685 | PyObject *_res = NULL; |
| 686 | OSStatus _err; |
| 687 | Rect bounds; |
| 688 | ThemeTrackEnableState enableState; |
| 689 | ThemeTrackPressState pressState; |
| 690 | Boolean isHoriz; |
| 691 | Rect trackBounds; |
| 692 | if (!PyArg_ParseTuple(_args, "O&bbb", |
| 693 | PyMac_GetRect, &bounds, |
| 694 | &enableState, |
| 695 | &pressState, |
| 696 | &isHoriz)) |
| 697 | return NULL; |
| 698 | _err = GetThemeScrollBarTrackRect(&bounds, |
| 699 | enableState, |
| 700 | pressState, |
| 701 | isHoriz, |
| 702 | &trackBounds); |
| 703 | if (_err != noErr) return PyMac_Error(_err); |
| 704 | _res = Py_BuildValue("O&", |
| 705 | PyMac_BuildRect, &trackBounds); |
| 706 | return _res; |
| 707 | } |
| 708 | |
| 709 | static PyObject *App_HitTestThemeScrollBarArrows(PyObject *_self, PyObject *_args) |
| 710 | { |
| 711 | PyObject *_res = NULL; |
| 712 | Boolean _rv; |
| 713 | Rect scrollBarBounds; |
| 714 | ThemeTrackEnableState enableState; |
| 715 | ThemeTrackPressState pressState; |
| 716 | Boolean isHoriz; |
| 717 | Point ptHit; |
| 718 | Rect trackBounds; |
| 719 | ControlPartCode partcode; |
| 720 | if (!PyArg_ParseTuple(_args, "O&bbbO&", |
| 721 | PyMac_GetRect, &scrollBarBounds, |
| 722 | &enableState, |
| 723 | &pressState, |
| 724 | &isHoriz, |
| 725 | PyMac_GetPoint, &ptHit)) |
| 726 | return NULL; |
| 727 | _rv = HitTestThemeScrollBarArrows(&scrollBarBounds, |
| 728 | enableState, |
| 729 | pressState, |
| 730 | isHoriz, |
| 731 | ptHit, |
| 732 | &trackBounds, |
| 733 | &partcode); |
| 734 | _res = Py_BuildValue("bO&h", |
| 735 | _rv, |
| 736 | PyMac_BuildRect, &trackBounds, |
| 737 | partcode); |
| 738 | return _res; |
| 739 | } |
| 740 | |
| 741 | static PyObject *App_DrawThemeScrollBarDelimiters(PyObject *_self, PyObject *_args) |
| 742 | { |
| 743 | PyObject *_res = NULL; |
| 744 | OSStatus _err; |
| 745 | ThemeWindowType flavor; |
| 746 | Rect inContRect; |
| 747 | ThemeDrawState state; |
| 748 | ThemeWindowAttributes attributes; |
| 749 | if (!PyArg_ParseTuple(_args, "HO&ll", |
| 750 | &flavor, |
| 751 | PyMac_GetRect, &inContRect, |
| 752 | &state, |
| 753 | &attributes)) |
| 754 | return NULL; |
| 755 | _err = DrawThemeScrollBarDelimiters(flavor, |
| 756 | &inContRect, |
| 757 | state, |
| 758 | attributes); |
| 759 | if (_err != noErr) return PyMac_Error(_err); |
| 760 | Py_INCREF(Py_None); |
| 761 | _res = Py_None; |
| 762 | return _res; |
| 763 | } |
| 764 | |
| 765 | static PyObject *App_PlayThemeSound(PyObject *_self, PyObject *_args) |
| 766 | { |
| 767 | PyObject *_res = NULL; |
| 768 | OSStatus _err; |
| 769 | ThemeSoundKind kind; |
| 770 | if (!PyArg_ParseTuple(_args, "O&", |
| 771 | PyMac_GetOSType, &kind)) |
| 772 | return NULL; |
| 773 | _err = PlayThemeSound(kind); |
| 774 | if (_err != noErr) return PyMac_Error(_err); |
| 775 | Py_INCREF(Py_None); |
| 776 | _res = Py_None; |
| 777 | return _res; |
| 778 | } |
| 779 | |
| 780 | static PyObject *App_BeginThemeDragSound(PyObject *_self, PyObject *_args) |
| 781 | { |
| 782 | PyObject *_res = NULL; |
| 783 | OSStatus _err; |
| 784 | ThemeDragSoundKind kind; |
| 785 | if (!PyArg_ParseTuple(_args, "O&", |
| 786 | PyMac_GetOSType, &kind)) |
| 787 | return NULL; |
| 788 | _err = BeginThemeDragSound(kind); |
| 789 | if (_err != noErr) return PyMac_Error(_err); |
| 790 | Py_INCREF(Py_None); |
| 791 | _res = Py_None; |
| 792 | return _res; |
| 793 | } |
| 794 | |
| 795 | static PyObject *App_EndThemeDragSound(PyObject *_self, PyObject *_args) |
| 796 | { |
| 797 | PyObject *_res = NULL; |
| 798 | OSStatus _err; |
| 799 | if (!PyArg_ParseTuple(_args, "")) |
| 800 | return NULL; |
| 801 | _err = EndThemeDragSound(); |
| 802 | if (_err != noErr) return PyMac_Error(_err); |
| 803 | Py_INCREF(Py_None); |
| 804 | _res = Py_None; |
| 805 | return _res; |
| 806 | } |
| 807 | |
| 808 | static PyObject *App_DrawThemeTickMark(PyObject *_self, PyObject *_args) |
| 809 | { |
| 810 | PyObject *_res = NULL; |
| 811 | OSStatus _err; |
| 812 | Rect bounds; |
| 813 | ThemeDrawState state; |
| 814 | if (!PyArg_ParseTuple(_args, "O&l", |
| 815 | PyMac_GetRect, &bounds, |
| 816 | &state)) |
| 817 | return NULL; |
| 818 | _err = DrawThemeTickMark(&bounds, |
| 819 | state); |
| 820 | if (_err != noErr) return PyMac_Error(_err); |
| 821 | Py_INCREF(Py_None); |
| 822 | _res = Py_None; |
| 823 | return _res; |
| 824 | } |
| 825 | |
| 826 | static PyObject *App_DrawThemeStandaloneGrowBox(PyObject *_self, PyObject *_args) |
| 827 | { |
| 828 | PyObject *_res = NULL; |
| 829 | OSStatus _err; |
| 830 | Point origin; |
| 831 | ThemeGrowDirection growDirection; |
| 832 | Boolean isSmall; |
| 833 | ThemeDrawState state; |
| 834 | if (!PyArg_ParseTuple(_args, "O&Hbl", |
| 835 | PyMac_GetPoint, &origin, |
| 836 | &growDirection, |
| 837 | &isSmall, |
| 838 | &state)) |
| 839 | return NULL; |
| 840 | _err = DrawThemeStandaloneGrowBox(origin, |
| 841 | growDirection, |
| 842 | isSmall, |
| 843 | state); |
| 844 | if (_err != noErr) return PyMac_Error(_err); |
| 845 | Py_INCREF(Py_None); |
| 846 | _res = Py_None; |
| 847 | return _res; |
| 848 | } |
| 849 | |
| 850 | static PyObject *App_DrawThemeStandaloneNoGrowBox(PyObject *_self, PyObject *_args) |
| 851 | { |
| 852 | PyObject *_res = NULL; |
| 853 | OSStatus _err; |
| 854 | Point origin; |
| 855 | ThemeGrowDirection growDirection; |
| 856 | Boolean isSmall; |
| 857 | ThemeDrawState state; |
| 858 | if (!PyArg_ParseTuple(_args, "O&Hbl", |
| 859 | PyMac_GetPoint, &origin, |
| 860 | &growDirection, |
| 861 | &isSmall, |
| 862 | &state)) |
| 863 | return NULL; |
| 864 | _err = DrawThemeStandaloneNoGrowBox(origin, |
| 865 | growDirection, |
| 866 | isSmall, |
| 867 | state); |
| 868 | if (_err != noErr) return PyMac_Error(_err); |
| 869 | Py_INCREF(Py_None); |
| 870 | _res = Py_None; |
| 871 | return _res; |
| 872 | } |
| 873 | |
| 874 | static PyObject *App_GetThemeStandaloneGrowBoxBounds(PyObject *_self, PyObject *_args) |
| 875 | { |
| 876 | PyObject *_res = NULL; |
| 877 | OSStatus _err; |
| 878 | Point origin; |
| 879 | ThemeGrowDirection growDirection; |
| 880 | Boolean isSmall; |
| 881 | Rect bounds; |
| 882 | if (!PyArg_ParseTuple(_args, "O&Hb", |
| 883 | PyMac_GetPoint, &origin, |
| 884 | &growDirection, |
| 885 | &isSmall)) |
| 886 | return NULL; |
| 887 | _err = GetThemeStandaloneGrowBoxBounds(origin, |
| 888 | growDirection, |
| 889 | isSmall, |
| 890 | &bounds); |
| 891 | if (_err != noErr) return PyMac_Error(_err); |
| 892 | _res = Py_BuildValue("O&", |
| 893 | PyMac_BuildRect, &bounds); |
| 894 | return _res; |
| 895 | } |
| 896 | |
| 897 | static PyObject *App_NormalizeThemeDrawingState(PyObject *_self, PyObject *_args) |
| 898 | { |
| 899 | PyObject *_res = NULL; |
| 900 | OSStatus _err; |
| 901 | if (!PyArg_ParseTuple(_args, "")) |
| 902 | return NULL; |
| 903 | _err = NormalizeThemeDrawingState(); |
| 904 | if (_err != noErr) return PyMac_Error(_err); |
| 905 | Py_INCREF(Py_None); |
| 906 | _res = Py_None; |
| 907 | return _res; |
| 908 | } |
| 909 | |
| 910 | static PyObject *App_ApplyThemeBackground(PyObject *_self, PyObject *_args) |
| 911 | { |
| 912 | PyObject *_res = NULL; |
| 913 | OSStatus _err; |
| 914 | ThemeBackgroundKind inKind; |
| 915 | Rect bounds; |
| 916 | ThemeDrawState inState; |
| 917 | SInt16 inDepth; |
| 918 | Boolean inColorDev; |
| 919 | if (!PyArg_ParseTuple(_args, "lO&lhb", |
| 920 | &inKind, |
| 921 | PyMac_GetRect, &bounds, |
| 922 | &inState, |
| 923 | &inDepth, |
| 924 | &inColorDev)) |
| 925 | return NULL; |
| 926 | _err = ApplyThemeBackground(inKind, |
| 927 | &bounds, |
| 928 | inState, |
| 929 | inDepth, |
| 930 | inColorDev); |
| 931 | if (_err != noErr) return PyMac_Error(_err); |
| 932 | Py_INCREF(Py_None); |
| 933 | _res = Py_None; |
| 934 | return _res; |
| 935 | } |
| 936 | |
| 937 | static PyObject *App_SetThemeTextColorForWindow(PyObject *_self, PyObject *_args) |
| 938 | { |
| 939 | PyObject *_res = NULL; |
| 940 | OSStatus _err; |
| 941 | WindowPtr window; |
| 942 | Boolean isActive; |
| 943 | SInt16 depth; |
| 944 | Boolean isColorDev; |
| 945 | if (!PyArg_ParseTuple(_args, "O&bhb", |
| 946 | WinObj_Convert, &window, |
| 947 | &isActive, |
| 948 | &depth, |
| 949 | &isColorDev)) |
| 950 | return NULL; |
| 951 | _err = SetThemeTextColorForWindow(window, |
| 952 | isActive, |
| 953 | depth, |
| 954 | isColorDev); |
| 955 | if (_err != noErr) return PyMac_Error(_err); |
| 956 | Py_INCREF(Py_None); |
| 957 | _res = Py_None; |
| 958 | return _res; |
| 959 | } |
| 960 | |
| 961 | static PyObject *App_IsValidAppearanceFileType(PyObject *_self, PyObject *_args) |
| 962 | { |
| 963 | PyObject *_res = NULL; |
| 964 | Boolean _rv; |
| 965 | OSType fileType; |
| 966 | if (!PyArg_ParseTuple(_args, "O&", |
| 967 | PyMac_GetOSType, &fileType)) |
| 968 | return NULL; |
| 969 | _rv = IsValidAppearanceFileType(fileType); |
| 970 | _res = Py_BuildValue("b", |
| 971 | _rv); |
| 972 | return _res; |
| 973 | } |
| 974 | |
| 975 | static PyObject *App_GetThemeBrushAsColor(PyObject *_self, PyObject *_args) |
| 976 | { |
| 977 | PyObject *_res = NULL; |
| 978 | OSStatus _err; |
| 979 | ThemeBrush inBrush; |
| 980 | SInt16 inDepth; |
| 981 | Boolean inColorDev; |
| 982 | RGBColor outColor; |
| 983 | if (!PyArg_ParseTuple(_args, "hhb", |
| 984 | &inBrush, |
| 985 | &inDepth, |
| 986 | &inColorDev)) |
| 987 | return NULL; |
| 988 | _err = GetThemeBrushAsColor(inBrush, |
| 989 | inDepth, |
| 990 | inColorDev, |
| 991 | &outColor); |
| 992 | if (_err != noErr) return PyMac_Error(_err); |
| 993 | _res = Py_BuildValue("O&", |
| 994 | QdRGB_New, &outColor); |
| 995 | return _res; |
| 996 | } |
| 997 | |
| 998 | static PyObject *App_GetThemeTextColor(PyObject *_self, PyObject *_args) |
| 999 | { |
| 1000 | PyObject *_res = NULL; |
| 1001 | OSStatus _err; |
| 1002 | ThemeTextColor inColor; |
| 1003 | SInt16 inDepth; |
| 1004 | Boolean inColorDev; |
| 1005 | RGBColor outColor; |
| 1006 | if (!PyArg_ParseTuple(_args, "hhb", |
| 1007 | &inColor, |
| 1008 | &inDepth, |
| 1009 | &inColorDev)) |
| 1010 | return NULL; |
| 1011 | _err = GetThemeTextColor(inColor, |
| 1012 | inDepth, |
| 1013 | inColorDev, |
| 1014 | &outColor); |
| 1015 | if (_err != noErr) return PyMac_Error(_err); |
| 1016 | _res = Py_BuildValue("O&", |
| 1017 | QdRGB_New, &outColor); |
| 1018 | return _res; |
| 1019 | } |
| 1020 | |
| 1021 | #if TARGET_API_MAC_CARBON |
| 1022 | |
| 1023 | static PyObject *App_GetThemeMetric(PyObject *_self, PyObject *_args) |
| 1024 | { |
| 1025 | PyObject *_res = NULL; |
| 1026 | OSStatus _err; |
| 1027 | ThemeMetric inMetric; |
| 1028 | SInt32 outMetric; |
| 1029 | if (!PyArg_ParseTuple(_args, "l", |
| 1030 | &inMetric)) |
| 1031 | return NULL; |
| 1032 | _err = GetThemeMetric(inMetric, |
| 1033 | &outMetric); |
| 1034 | if (_err != noErr) return PyMac_Error(_err); |
| 1035 | _res = Py_BuildValue("l", |
| 1036 | outMetric); |
| 1037 | return _res; |
| 1038 | } |
| 1039 | #endif |
| 1040 | |
| 1041 | static PyMethodDef App_methods[] = { |
| 1042 | {"RegisterAppearanceClient", (PyCFunction)App_RegisterAppearanceClient, 1, |
| 1043 | "() -> None"}, |
| 1044 | {"UnregisterAppearanceClient", (PyCFunction)App_UnregisterAppearanceClient, 1, |
| 1045 | "() -> None"}, |
| 1046 | {"SetThemePen", (PyCFunction)App_SetThemePen, 1, |
| 1047 | "(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None"}, |
| 1048 | {"SetThemeBackground", (PyCFunction)App_SetThemeBackground, 1, |
| 1049 | "(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None"}, |
| 1050 | {"SetThemeTextColor", (PyCFunction)App_SetThemeTextColor, 1, |
| 1051 | "(ThemeTextColor inColor, SInt16 inDepth, Boolean inIsColorDevice) -> None"}, |
| 1052 | {"SetThemeWindowBackground", (PyCFunction)App_SetThemeWindowBackground, 1, |
| 1053 | "(WindowPtr inWindow, ThemeBrush inBrush, Boolean inUpdate) -> None"}, |
| 1054 | {"DrawThemeWindowHeader", (PyCFunction)App_DrawThemeWindowHeader, 1, |
| 1055 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1056 | {"DrawThemeWindowListViewHeader", (PyCFunction)App_DrawThemeWindowListViewHeader, 1, |
| 1057 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1058 | {"DrawThemePlacard", (PyCFunction)App_DrawThemePlacard, 1, |
| 1059 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1060 | {"DrawThemeEditTextFrame", (PyCFunction)App_DrawThemeEditTextFrame, 1, |
| 1061 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1062 | {"DrawThemeListBoxFrame", (PyCFunction)App_DrawThemeListBoxFrame, 1, |
| 1063 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1064 | {"DrawThemeFocusRect", (PyCFunction)App_DrawThemeFocusRect, 1, |
| 1065 | "(Rect inRect, Boolean inHasFocus) -> None"}, |
| 1066 | {"DrawThemePrimaryGroup", (PyCFunction)App_DrawThemePrimaryGroup, 1, |
| 1067 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1068 | {"DrawThemeSecondaryGroup", (PyCFunction)App_DrawThemeSecondaryGroup, 1, |
| 1069 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1070 | {"DrawThemeSeparator", (PyCFunction)App_DrawThemeSeparator, 1, |
| 1071 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1072 | {"DrawThemeModelessDialogFrame", (PyCFunction)App_DrawThemeModelessDialogFrame, 1, |
| 1073 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1074 | {"DrawThemeGenericWell", (PyCFunction)App_DrawThemeGenericWell, 1, |
| 1075 | "(Rect inRect, ThemeDrawState inState, Boolean inFillCenter) -> None"}, |
| 1076 | {"DrawThemeFocusRegion", (PyCFunction)App_DrawThemeFocusRegion, 1, |
| 1077 | "(Boolean inHasFocus) -> None"}, |
| 1078 | {"IsThemeInColor", (PyCFunction)App_IsThemeInColor, 1, |
| 1079 | "(SInt16 inDepth, Boolean inIsColorDevice) -> (Boolean _rv)"}, |
| 1080 | {"GetThemeAccentColors", (PyCFunction)App_GetThemeAccentColors, 1, |
| 1081 | "() -> (CTabHandle outColors)"}, |
| 1082 | {"DrawThemeMenuBarBackground", (PyCFunction)App_DrawThemeMenuBarBackground, 1, |
| 1083 | "(Rect inBounds, ThemeMenuBarState inState, UInt32 inAttributes) -> None"}, |
| 1084 | {"GetThemeMenuBarHeight", (PyCFunction)App_GetThemeMenuBarHeight, 1, |
| 1085 | "() -> (SInt16 outHeight)"}, |
| 1086 | {"DrawThemeMenuBackground", (PyCFunction)App_DrawThemeMenuBackground, 1, |
| 1087 | "(Rect inMenuRect, ThemeMenuType inMenuType) -> None"}, |
| 1088 | {"GetThemeMenuBackgroundRegion", (PyCFunction)App_GetThemeMenuBackgroundRegion, 1, |
| 1089 | "(Rect inMenuRect, ThemeMenuType menuType) -> None"}, |
| 1090 | {"DrawThemeMenuSeparator", (PyCFunction)App_DrawThemeMenuSeparator, 1, |
| 1091 | "(Rect inItemRect) -> None"}, |
| 1092 | {"GetThemeMenuSeparatorHeight", (PyCFunction)App_GetThemeMenuSeparatorHeight, 1, |
| 1093 | "() -> (SInt16 outHeight)"}, |
| 1094 | {"GetThemeMenuItemExtra", (PyCFunction)App_GetThemeMenuItemExtra, 1, |
| 1095 | "(ThemeMenuItemType inItemType) -> (SInt16 outHeight, SInt16 outWidth)"}, |
| 1096 | {"GetThemeMenuTitleExtra", (PyCFunction)App_GetThemeMenuTitleExtra, 1, |
| 1097 | "(Boolean inIsSquished) -> (SInt16 outWidth)"}, |
| 1098 | {"DrawThemeTabPane", (PyCFunction)App_DrawThemeTabPane, 1, |
| 1099 | "(Rect inRect, ThemeDrawState inState) -> None"}, |
| 1100 | {"GetThemeTabRegion", (PyCFunction)App_GetThemeTabRegion, 1, |
| 1101 | "(Rect inRect, ThemeTabStyle inStyle, ThemeTabDirection inDirection) -> None"}, |
| 1102 | {"SetThemeCursor", (PyCFunction)App_SetThemeCursor, 1, |
| 1103 | "(ThemeCursor inCursor) -> None"}, |
| 1104 | {"SetAnimatedThemeCursor", (PyCFunction)App_SetAnimatedThemeCursor, 1, |
| 1105 | "(ThemeCursor inCursor, UInt32 inAnimationStep) -> None"}, |
| 1106 | {"GetThemeScrollBarThumbStyle", (PyCFunction)App_GetThemeScrollBarThumbStyle, 1, |
| 1107 | "() -> (ThemeScrollBarThumbStyle outStyle)"}, |
| 1108 | {"GetThemeScrollBarArrowStyle", (PyCFunction)App_GetThemeScrollBarArrowStyle, 1, |
| 1109 | "() -> (ThemeScrollBarArrowStyle outStyle)"}, |
| 1110 | {"GetThemeCheckBoxStyle", (PyCFunction)App_GetThemeCheckBoxStyle, 1, |
| 1111 | "() -> (ThemeCheckBoxStyle outStyle)"}, |
| 1112 | {"UseThemeFont", (PyCFunction)App_UseThemeFont, 1, |
| 1113 | "(ThemeFontID inFontID, ScriptCode inScript) -> None"}, |
| 1114 | {"DrawThemeScrollBarArrows", (PyCFunction)App_DrawThemeScrollBarArrows, 1, |
| 1115 | "(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)"}, |
| 1116 | {"GetThemeScrollBarTrackRect", (PyCFunction)App_GetThemeScrollBarTrackRect, 1, |
| 1117 | "(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)"}, |
| 1118 | {"HitTestThemeScrollBarArrows", (PyCFunction)App_HitTestThemeScrollBarArrows, 1, |
| 1119 | "(Rect scrollBarBounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz, Point ptHit) -> (Boolean _rv, Rect trackBounds, ControlPartCode partcode)"}, |
| 1120 | {"DrawThemeScrollBarDelimiters", (PyCFunction)App_DrawThemeScrollBarDelimiters, 1, |
| 1121 | "(ThemeWindowType flavor, Rect inContRect, ThemeDrawState state, ThemeWindowAttributes attributes) -> None"}, |
| 1122 | {"PlayThemeSound", (PyCFunction)App_PlayThemeSound, 1, |
| 1123 | "(ThemeSoundKind kind) -> None"}, |
| 1124 | {"BeginThemeDragSound", (PyCFunction)App_BeginThemeDragSound, 1, |
| 1125 | "(ThemeDragSoundKind kind) -> None"}, |
| 1126 | {"EndThemeDragSound", (PyCFunction)App_EndThemeDragSound, 1, |
| 1127 | "() -> None"}, |
| 1128 | {"DrawThemeTickMark", (PyCFunction)App_DrawThemeTickMark, 1, |
| 1129 | "(Rect bounds, ThemeDrawState state) -> None"}, |
| 1130 | {"DrawThemeStandaloneGrowBox", (PyCFunction)App_DrawThemeStandaloneGrowBox, 1, |
| 1131 | "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None"}, |
| 1132 | {"DrawThemeStandaloneNoGrowBox", (PyCFunction)App_DrawThemeStandaloneNoGrowBox, 1, |
| 1133 | "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None"}, |
| 1134 | {"GetThemeStandaloneGrowBoxBounds", (PyCFunction)App_GetThemeStandaloneGrowBoxBounds, 1, |
| 1135 | "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall) -> (Rect bounds)"}, |
| 1136 | {"NormalizeThemeDrawingState", (PyCFunction)App_NormalizeThemeDrawingState, 1, |
| 1137 | "() -> None"}, |
| 1138 | {"ApplyThemeBackground", (PyCFunction)App_ApplyThemeBackground, 1, |
| 1139 | "(ThemeBackgroundKind inKind, Rect bounds, ThemeDrawState inState, SInt16 inDepth, Boolean inColorDev) -> None"}, |
| 1140 | {"SetThemeTextColorForWindow", (PyCFunction)App_SetThemeTextColorForWindow, 1, |
| 1141 | "(WindowPtr window, Boolean isActive, SInt16 depth, Boolean isColorDev) -> None"}, |
| 1142 | {"IsValidAppearanceFileType", (PyCFunction)App_IsValidAppearanceFileType, 1, |
| 1143 | "(OSType fileType) -> (Boolean _rv)"}, |
| 1144 | {"GetThemeBrushAsColor", (PyCFunction)App_GetThemeBrushAsColor, 1, |
| 1145 | "(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"}, |
| 1146 | {"GetThemeTextColor", (PyCFunction)App_GetThemeTextColor, 1, |
| 1147 | "(ThemeTextColor inColor, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)"}, |
| 1148 | |
| 1149 | #if TARGET_API_MAC_CARBON |
| 1150 | {"GetThemeMetric", (PyCFunction)App_GetThemeMetric, 1, |
| 1151 | "(ThemeMetric inMetric) -> (SInt32 outMetric)"}, |
| 1152 | #endif |
| 1153 | {NULL, NULL, 0} |
| 1154 | }; |
| 1155 | |
| 1156 | |
| 1157 | |
| 1158 | |
| 1159 | void init_App(void) |
| 1160 | { |
| 1161 | PyObject *m; |
| 1162 | PyObject *d; |
| 1163 | |
| 1164 | |
| 1165 | |
| 1166 | |
| 1167 | m = Py_InitModule("_App", App_methods); |
| 1168 | d = PyModule_GetDict(m); |
| 1169 | App_Error = PyMac_GetOSErrException(); |
| 1170 | if (App_Error == NULL || |
| 1171 | PyDict_SetItemString(d, "Error", App_Error) != 0) |
| 1172 | return; |
| 1173 | } |
| 1174 | |
| 1175 | /* ======================== End module _App ========================= */ |
| 1176 | |