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