Home | History | Annotate | Download | only in app
      1 
      2 /* ========================== Module _App =========================== */
      3 
      4 #include "Python.h"
      5 #include "pymactoolbox.h"
      6 
      7 #if APPLE_SUPPORTS_QUICKTIME
      8     /* Carbon GUI stuff, not available in 64-bit mode */
      9 
     10 /* Macro to test whether a weak-loaded CFM function exists */
     11 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
     12     PyErr_SetString(PyExc_NotImplementedError, \
     13     "Not available in this shared library/OS version"); \
     14     return NULL; \
     15     }} while(0)
     16 
     17 
     18 #include <Carbon/Carbon.h>
     19 
     20 
     21 static int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
     22 {
     23     return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment);
     24 }
     25 
     26 
     27 static PyObject *App_Error;
     28 
     29 /* ----------------- Object type ThemeDrawingState ------------------ */
     30 
     31 PyTypeObject ThemeDrawingState_Type;
     32 
     33 #define ThemeDrawingStateObj_Check(x) ((x)->ob_type == &ThemeDrawingState_Type || PyObject_TypeCheck((x), &ThemeDrawingState_Type))
     34 
     35 typedef struct ThemeDrawingStateObject {
     36     PyObject_HEAD
     37     ThemeDrawingState ob_itself;
     38 } ThemeDrawingStateObject;
     39 
     40 PyObject *ThemeDrawingStateObj_New(ThemeDrawingState itself)
     41 {
     42     ThemeDrawingStateObject *it;
     43     it = PyObject_NEW(ThemeDrawingStateObject, &ThemeDrawingState_Type);
     44     if (it == NULL) return NULL;
     45     it->ob_itself = itself;
     46     return (PyObject *)it;
     47 }
     48 
     49 int ThemeDrawingStateObj_Convert(PyObject *v, ThemeDrawingState *p_itself)
     50 {
     51     if (!ThemeDrawingStateObj_Check(v))
     52     {
     53         PyErr_SetString(PyExc_TypeError, "ThemeDrawingState required");
     54         return 0;
     55     }
     56     *p_itself = ((ThemeDrawingStateObject *)v)->ob_itself;
     57     return 1;
     58 }
     59 
     60 static void ThemeDrawingStateObj_dealloc(ThemeDrawingStateObject *self)
     61 {
     62     /* Cleanup of self->ob_itself goes here */
     63     self->ob_type->tp_free((PyObject *)self);
     64 }
     65 
     66 static PyObject *ThemeDrawingStateObj_SetThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args)
     67 {
     68     PyObject *_res = NULL;
     69     OSStatus _rv;
     70     Boolean inDisposeNow;
     71 #ifndef SetThemeDrawingState
     72     PyMac_PRECHECK(SetThemeDrawingState);
     73 #endif
     74     if (!PyArg_ParseTuple(_args, "b",
     75                           &inDisposeNow))
     76         return NULL;
     77     _rv = SetThemeDrawingState(_self->ob_itself,
     78                                inDisposeNow);
     79     _res = Py_BuildValue("l",
     80                          _rv);
     81     return _res;
     82 }
     83 
     84 static PyObject *ThemeDrawingStateObj_DisposeThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args)
     85 {
     86     PyObject *_res = NULL;
     87     OSStatus _rv;
     88 #ifndef DisposeThemeDrawingState
     89     PyMac_PRECHECK(DisposeThemeDrawingState);
     90 #endif
     91     if (!PyArg_ParseTuple(_args, ""))
     92         return NULL;
     93     _rv = DisposeThemeDrawingState(_self->ob_itself);
     94     _res = Py_BuildValue("l",
     95                          _rv);
     96     return _res;
     97 }
     98 
     99 static PyMethodDef ThemeDrawingStateObj_methods[] = {
    100     {"SetThemeDrawingState", (PyCFunction)ThemeDrawingStateObj_SetThemeDrawingState, 1,
    101      PyDoc_STR("(Boolean inDisposeNow) -> (OSStatus _rv)")},
    102     {"DisposeThemeDrawingState", (PyCFunction)ThemeDrawingStateObj_DisposeThemeDrawingState, 1,
    103      PyDoc_STR("() -> (OSStatus _rv)")},
    104     {NULL, NULL, 0}
    105 };
    106 
    107 #define ThemeDrawingStateObj_getsetlist NULL
    108 
    109 
    110 #define ThemeDrawingStateObj_compare NULL
    111 
    112 #define ThemeDrawingStateObj_repr NULL
    113 
    114 #define ThemeDrawingStateObj_hash NULL
    115 #define ThemeDrawingStateObj_tp_init 0
    116 
    117 #define ThemeDrawingStateObj_tp_alloc PyType_GenericAlloc
    118 
    119 static PyObject *ThemeDrawingStateObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
    120 {
    121     PyObject *_self;
    122     ThemeDrawingState itself;
    123     char *kw[] = {"itself", 0};
    124 
    125     if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ThemeDrawingStateObj_Convert, &itself)) return NULL;
    126     if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL;
    127     ((ThemeDrawingStateObject *)_self)->ob_itself = itself;
    128     return _self;
    129 }
    130 
    131 #define ThemeDrawingStateObj_tp_free PyObject_Del
    132 
    133 
    134 PyTypeObject ThemeDrawingState_Type = {
    135     PyObject_HEAD_INIT(NULL)
    136     0, /*ob_size*/
    137     "_App.ThemeDrawingState", /*tp_name*/
    138     sizeof(ThemeDrawingStateObject), /*tp_basicsize*/
    139     0, /*tp_itemsize*/
    140     /* methods */
    141     (destructor) ThemeDrawingStateObj_dealloc, /*tp_dealloc*/
    142     0, /*tp_print*/
    143     (getattrfunc)0, /*tp_getattr*/
    144     (setattrfunc)0, /*tp_setattr*/
    145     (cmpfunc) ThemeDrawingStateObj_compare, /*tp_compare*/
    146     (reprfunc) ThemeDrawingStateObj_repr, /*tp_repr*/
    147     (PyNumberMethods *)0, /* tp_as_number */
    148     (PySequenceMethods *)0, /* tp_as_sequence */
    149     (PyMappingMethods *)0, /* tp_as_mapping */
    150     (hashfunc) ThemeDrawingStateObj_hash, /*tp_hash*/
    151     0, /*tp_call*/
    152     0, /*tp_str*/
    153     PyObject_GenericGetAttr, /*tp_getattro*/
    154     PyObject_GenericSetAttr, /*tp_setattro */
    155     0, /*tp_as_buffer*/
    156     Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
    157     0, /*tp_doc*/
    158     0, /*tp_traverse*/
    159     0, /*tp_clear*/
    160     0, /*tp_richcompare*/
    161     0, /*tp_weaklistoffset*/
    162     0, /*tp_iter*/
    163     0, /*tp_iternext*/
    164     ThemeDrawingStateObj_methods, /* tp_methods */
    165     0, /*tp_members*/
    166     ThemeDrawingStateObj_getsetlist, /*tp_getset*/
    167     0, /*tp_base*/
    168     0, /*tp_dict*/
    169     0, /*tp_descr_get*/
    170     0, /*tp_descr_set*/
    171     0, /*tp_dictoffset*/
    172     ThemeDrawingStateObj_tp_init, /* tp_init */
    173     ThemeDrawingStateObj_tp_alloc, /* tp_alloc */
    174     ThemeDrawingStateObj_tp_new, /* tp_new */
    175     ThemeDrawingStateObj_tp_free, /* tp_free */
    176 };
    177 
    178 /* --------------- End object type ThemeDrawingState ---------------- */
    179 
    180 
    181 static PyObject *App_RegisterAppearanceClient(PyObject *_self, PyObject *_args)
    182 {
    183     PyObject *_res = NULL;
    184     OSStatus _err;
    185 #ifndef RegisterAppearanceClient
    186     PyMac_PRECHECK(RegisterAppearanceClient);
    187 #endif
    188     if (!PyArg_ParseTuple(_args, ""))
    189         return NULL;
    190     _err = RegisterAppearanceClient();
    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_UnregisterAppearanceClient(PyObject *_self, PyObject *_args)
    198 {
    199     PyObject *_res = NULL;
    200     OSStatus _err;
    201 #ifndef UnregisterAppearanceClient
    202     PyMac_PRECHECK(UnregisterAppearanceClient);
    203 #endif
    204     if (!PyArg_ParseTuple(_args, ""))
    205         return NULL;
    206     _err = UnregisterAppearanceClient();
    207     if (_err != noErr) return PyMac_Error(_err);
    208     Py_INCREF(Py_None);
    209     _res = Py_None;
    210     return _res;
    211 }
    212 
    213 static PyObject *App_SetThemePen(PyObject *_self, PyObject *_args)
    214 {
    215     PyObject *_res = NULL;
    216     OSStatus _err;
    217     ThemeBrush inBrush;
    218     SInt16 inDepth;
    219     Boolean inIsColorDevice;
    220 #ifndef SetThemePen
    221     PyMac_PRECHECK(SetThemePen);
    222 #endif
    223     if (!PyArg_ParseTuple(_args, "hhb",
    224                           &inBrush,
    225                           &inDepth,
    226                           &inIsColorDevice))
    227         return NULL;
    228     _err = SetThemePen(inBrush,
    229                        inDepth,
    230                        inIsColorDevice);
    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_SetThemeBackground(PyObject *_self, PyObject *_args)
    238 {
    239     PyObject *_res = NULL;
    240     OSStatus _err;
    241     ThemeBrush inBrush;
    242     SInt16 inDepth;
    243     Boolean inIsColorDevice;
    244 #ifndef SetThemeBackground
    245     PyMac_PRECHECK(SetThemeBackground);
    246 #endif
    247     if (!PyArg_ParseTuple(_args, "hhb",
    248                           &inBrush,
    249                           &inDepth,
    250                           &inIsColorDevice))
    251         return NULL;
    252     _err = SetThemeBackground(inBrush,
    253                               inDepth,
    254                               inIsColorDevice);
    255     if (_err != noErr) return PyMac_Error(_err);
    256     Py_INCREF(Py_None);
    257     _res = Py_None;
    258     return _res;
    259 }
    260 
    261 static PyObject *App_SetThemeTextColor(PyObject *_self, PyObject *_args)
    262 {
    263     PyObject *_res = NULL;
    264     OSStatus _err;
    265     ThemeTextColor inColor;
    266     SInt16 inDepth;
    267     Boolean inIsColorDevice;
    268 #ifndef SetThemeTextColor
    269     PyMac_PRECHECK(SetThemeTextColor);
    270 #endif
    271     if (!PyArg_ParseTuple(_args, "hhb",
    272                           &inColor,
    273                           &inDepth,
    274                           &inIsColorDevice))
    275         return NULL;
    276     _err = SetThemeTextColor(inColor,
    277                              inDepth,
    278                              inIsColorDevice);
    279     if (_err != noErr) return PyMac_Error(_err);
    280     Py_INCREF(Py_None);
    281     _res = Py_None;
    282     return _res;
    283 }
    284 
    285 static PyObject *App_SetThemeWindowBackground(PyObject *_self, PyObject *_args)
    286 {
    287     PyObject *_res = NULL;
    288     OSStatus _err;
    289     WindowPtr inWindow;
    290     ThemeBrush inBrush;
    291     Boolean inUpdate;
    292 #ifndef SetThemeWindowBackground
    293     PyMac_PRECHECK(SetThemeWindowBackground);
    294 #endif
    295     if (!PyArg_ParseTuple(_args, "O&hb",
    296                           WinObj_Convert, &inWindow,
    297                           &inBrush,
    298                           &inUpdate))
    299         return NULL;
    300     _err = SetThemeWindowBackground(inWindow,
    301                                     inBrush,
    302                                     inUpdate);
    303     if (_err != noErr) return PyMac_Error(_err);
    304     Py_INCREF(Py_None);
    305     _res = Py_None;
    306     return _res;
    307 }
    308 
    309 static PyObject *App_DrawThemeWindowHeader(PyObject *_self, PyObject *_args)
    310 {
    311     PyObject *_res = NULL;
    312     OSStatus _err;
    313     Rect inRect;
    314     ThemeDrawState inState;
    315 #ifndef DrawThemeWindowHeader
    316     PyMac_PRECHECK(DrawThemeWindowHeader);
    317 #endif
    318     if (!PyArg_ParseTuple(_args, "O&l",
    319                           PyMac_GetRect, &inRect,
    320                           &inState))
    321         return NULL;
    322     _err = DrawThemeWindowHeader(&inRect,
    323                                  inState);
    324     if (_err != noErr) return PyMac_Error(_err);
    325     Py_INCREF(Py_None);
    326     _res = Py_None;
    327     return _res;
    328 }
    329 
    330 static PyObject *App_DrawThemeWindowListViewHeader(PyObject *_self, PyObject *_args)
    331 {
    332     PyObject *_res = NULL;
    333     OSStatus _err;
    334     Rect inRect;
    335     ThemeDrawState inState;
    336 #ifndef DrawThemeWindowListViewHeader
    337     PyMac_PRECHECK(DrawThemeWindowListViewHeader);
    338 #endif
    339     if (!PyArg_ParseTuple(_args, "O&l",
    340                           PyMac_GetRect, &inRect,
    341                           &inState))
    342         return NULL;
    343     _err = DrawThemeWindowListViewHeader(&inRect,
    344                                          inState);
    345     if (_err != noErr) return PyMac_Error(_err);
    346     Py_INCREF(Py_None);
    347     _res = Py_None;
    348     return _res;
    349 }
    350 
    351 static PyObject *App_DrawThemePlacard(PyObject *_self, PyObject *_args)
    352 {
    353     PyObject *_res = NULL;
    354     OSStatus _err;
    355     Rect inRect;
    356     ThemeDrawState inState;
    357 #ifndef DrawThemePlacard
    358     PyMac_PRECHECK(DrawThemePlacard);
    359 #endif
    360     if (!PyArg_ParseTuple(_args, "O&l",
    361                           PyMac_GetRect, &inRect,
    362                           &inState))
    363         return NULL;
    364     _err = DrawThemePlacard(&inRect,
    365                             inState);
    366     if (_err != noErr) return PyMac_Error(_err);
    367     Py_INCREF(Py_None);
    368     _res = Py_None;
    369     return _res;
    370 }
    371 
    372 static PyObject *App_DrawThemeEditTextFrame(PyObject *_self, PyObject *_args)
    373 {
    374     PyObject *_res = NULL;
    375     OSStatus _err;
    376     Rect inRect;
    377     ThemeDrawState inState;
    378 #ifndef DrawThemeEditTextFrame
    379     PyMac_PRECHECK(DrawThemeEditTextFrame);
    380 #endif
    381     if (!PyArg_ParseTuple(_args, "O&l",
    382                           PyMac_GetRect, &inRect,
    383                           &inState))
    384         return NULL;
    385     _err = DrawThemeEditTextFrame(&inRect,
    386                                   inState);
    387     if (_err != noErr) return PyMac_Error(_err);
    388     Py_INCREF(Py_None);
    389     _res = Py_None;
    390     return _res;
    391 }
    392 
    393 static PyObject *App_DrawThemeListBoxFrame(PyObject *_self, PyObject *_args)
    394 {
    395     PyObject *_res = NULL;
    396     OSStatus _err;
    397     Rect inRect;
    398     ThemeDrawState inState;
    399 #ifndef DrawThemeListBoxFrame
    400     PyMac_PRECHECK(DrawThemeListBoxFrame);
    401 #endif
    402     if (!PyArg_ParseTuple(_args, "O&l",
    403                           PyMac_GetRect, &inRect,
    404                           &inState))
    405         return NULL;
    406     _err = DrawThemeListBoxFrame(&inRect,
    407                                  inState);
    408     if (_err != noErr) return PyMac_Error(_err);
    409     Py_INCREF(Py_None);
    410     _res = Py_None;
    411     return _res;
    412 }
    413 
    414 static PyObject *App_DrawThemeFocusRect(PyObject *_self, PyObject *_args)
    415 {
    416     PyObject *_res = NULL;
    417     OSStatus _err;
    418     Rect inRect;
    419     Boolean inHasFocus;
    420 #ifndef DrawThemeFocusRect
    421     PyMac_PRECHECK(DrawThemeFocusRect);
    422 #endif
    423     if (!PyArg_ParseTuple(_args, "O&b",
    424                           PyMac_GetRect, &inRect,
    425                           &inHasFocus))
    426         return NULL;
    427     _err = DrawThemeFocusRect(&inRect,
    428                               inHasFocus);
    429     if (_err != noErr) return PyMac_Error(_err);
    430     Py_INCREF(Py_None);
    431     _res = Py_None;
    432     return _res;
    433 }
    434 
    435 static PyObject *App_DrawThemePrimaryGroup(PyObject *_self, PyObject *_args)
    436 {
    437     PyObject *_res = NULL;
    438     OSStatus _err;
    439     Rect inRect;
    440     ThemeDrawState inState;
    441 #ifndef DrawThemePrimaryGroup
    442     PyMac_PRECHECK(DrawThemePrimaryGroup);
    443 #endif
    444     if (!PyArg_ParseTuple(_args, "O&l",
    445                           PyMac_GetRect, &inRect,
    446                           &inState))
    447         return NULL;
    448     _err = DrawThemePrimaryGroup(&inRect,
    449                                  inState);
    450     if (_err != noErr) return PyMac_Error(_err);
    451     Py_INCREF(Py_None);
    452     _res = Py_None;
    453     return _res;
    454 }
    455 
    456 static PyObject *App_DrawThemeSecondaryGroup(PyObject *_self, PyObject *_args)
    457 {
    458     PyObject *_res = NULL;
    459     OSStatus _err;
    460     Rect inRect;
    461     ThemeDrawState inState;
    462 #ifndef DrawThemeSecondaryGroup
    463     PyMac_PRECHECK(DrawThemeSecondaryGroup);
    464 #endif
    465     if (!PyArg_ParseTuple(_args, "O&l",
    466                           PyMac_GetRect, &inRect,
    467                           &inState))
    468         return NULL;
    469     _err = DrawThemeSecondaryGroup(&inRect,
    470                                    inState);
    471     if (_err != noErr) return PyMac_Error(_err);
    472     Py_INCREF(Py_None);
    473     _res = Py_None;
    474     return _res;
    475 }
    476 
    477 static PyObject *App_DrawThemeSeparator(PyObject *_self, PyObject *_args)
    478 {
    479     PyObject *_res = NULL;
    480     OSStatus _err;
    481     Rect inRect;
    482     ThemeDrawState inState;
    483 #ifndef DrawThemeSeparator
    484     PyMac_PRECHECK(DrawThemeSeparator);
    485 #endif
    486     if (!PyArg_ParseTuple(_args, "O&l",
    487                           PyMac_GetRect, &inRect,
    488                           &inState))
    489         return NULL;
    490     _err = DrawThemeSeparator(&inRect,
    491                               inState);
    492     if (_err != noErr) return PyMac_Error(_err);
    493     Py_INCREF(Py_None);
    494     _res = Py_None;
    495     return _res;
    496 }
    497 
    498 static PyObject *App_DrawThemeModelessDialogFrame(PyObject *_self, PyObject *_args)
    499 {
    500     PyObject *_res = NULL;
    501     OSStatus _err;
    502     Rect inRect;
    503     ThemeDrawState inState;
    504 #ifndef DrawThemeModelessDialogFrame
    505     PyMac_PRECHECK(DrawThemeModelessDialogFrame);
    506 #endif
    507     if (!PyArg_ParseTuple(_args, "O&l",
    508                           PyMac_GetRect, &inRect,
    509                           &inState))
    510         return NULL;
    511     _err = DrawThemeModelessDialogFrame(&inRect,
    512                                         inState);
    513     if (_err != noErr) return PyMac_Error(_err);
    514     Py_INCREF(Py_None);
    515     _res = Py_None;
    516     return _res;
    517 }
    518 
    519 static PyObject *App_DrawThemeGenericWell(PyObject *_self, PyObject *_args)
    520 {
    521     PyObject *_res = NULL;
    522     OSStatus _err;
    523     Rect inRect;
    524     ThemeDrawState inState;
    525     Boolean inFillCenter;
    526 #ifndef DrawThemeGenericWell
    527     PyMac_PRECHECK(DrawThemeGenericWell);
    528 #endif
    529     if (!PyArg_ParseTuple(_args, "O&lb",
    530                           PyMac_GetRect, &inRect,
    531                           &inState,
    532                           &inFillCenter))
    533         return NULL;
    534     _err = DrawThemeGenericWell(&inRect,
    535                                 inState,
    536                                 inFillCenter);
    537     if (_err != noErr) return PyMac_Error(_err);
    538     Py_INCREF(Py_None);
    539     _res = Py_None;
    540     return _res;
    541 }
    542 
    543 static PyObject *App_DrawThemeFocusRegion(PyObject *_self, PyObject *_args)
    544 {
    545     PyObject *_res = NULL;
    546     OSStatus _err;
    547     Boolean inHasFocus;
    548 #ifndef DrawThemeFocusRegion
    549     PyMac_PRECHECK(DrawThemeFocusRegion);
    550 #endif
    551     if (!PyArg_ParseTuple(_args, "b",
    552                           &inHasFocus))
    553         return NULL;
    554     _err = DrawThemeFocusRegion((RgnHandle)0,
    555                                 inHasFocus);
    556     if (_err != noErr) return PyMac_Error(_err);
    557     Py_INCREF(Py_None);
    558     _res = Py_None;
    559     return _res;
    560 }
    561 
    562 static PyObject *App_IsThemeInColor(PyObject *_self, PyObject *_args)
    563 {
    564     PyObject *_res = NULL;
    565     Boolean _rv;
    566     SInt16 inDepth;
    567     Boolean inIsColorDevice;
    568 #ifndef IsThemeInColor
    569     PyMac_PRECHECK(IsThemeInColor);
    570 #endif
    571     if (!PyArg_ParseTuple(_args, "hb",
    572                           &inDepth,
    573                           &inIsColorDevice))
    574         return NULL;
    575     _rv = IsThemeInColor(inDepth,
    576                          inIsColorDevice);
    577     _res = Py_BuildValue("b",
    578                          _rv);
    579     return _res;
    580 }
    581 
    582 static PyObject *App_GetThemeAccentColors(PyObject *_self, PyObject *_args)
    583 {
    584     PyObject *_res = NULL;
    585     OSStatus _err;
    586     CTabHandle outColors;
    587 #ifndef GetThemeAccentColors
    588     PyMac_PRECHECK(GetThemeAccentColors);
    589 #endif
    590     if (!PyArg_ParseTuple(_args, ""))
    591         return NULL;
    592     _err = GetThemeAccentColors(&outColors);
    593     if (_err != noErr) return PyMac_Error(_err);
    594     _res = Py_BuildValue("O&",
    595                          ResObj_New, outColors);
    596     return _res;
    597 }
    598 
    599 static PyObject *App_DrawThemeMenuBarBackground(PyObject *_self, PyObject *_args)
    600 {
    601     PyObject *_res = NULL;
    602     OSStatus _err;
    603     Rect inBounds;
    604     ThemeMenuBarState inState;
    605     UInt32 inAttributes;
    606 #ifndef DrawThemeMenuBarBackground
    607     PyMac_PRECHECK(DrawThemeMenuBarBackground);
    608 #endif
    609     if (!PyArg_ParseTuple(_args, "O&Hl",
    610                           PyMac_GetRect, &inBounds,
    611                           &inState,
    612                           &inAttributes))
    613         return NULL;
    614     _err = DrawThemeMenuBarBackground(&inBounds,
    615                                       inState,
    616                                       inAttributes);
    617     if (_err != noErr) return PyMac_Error(_err);
    618     Py_INCREF(Py_None);
    619     _res = Py_None;
    620     return _res;
    621 }
    622 
    623 static PyObject *App_GetThemeMenuBarHeight(PyObject *_self, PyObject *_args)
    624 {
    625     PyObject *_res = NULL;
    626     OSStatus _err;
    627     SInt16 outHeight;
    628 #ifndef GetThemeMenuBarHeight
    629     PyMac_PRECHECK(GetThemeMenuBarHeight);
    630 #endif
    631     if (!PyArg_ParseTuple(_args, ""))
    632         return NULL;
    633     _err = GetThemeMenuBarHeight(&outHeight);
    634     if (_err != noErr) return PyMac_Error(_err);
    635     _res = Py_BuildValue("h",
    636                          outHeight);
    637     return _res;
    638 }
    639 
    640 static PyObject *App_DrawThemeMenuBackground(PyObject *_self, PyObject *_args)
    641 {
    642     PyObject *_res = NULL;
    643     OSStatus _err;
    644     Rect inMenuRect;
    645     ThemeMenuType inMenuType;
    646 #ifndef DrawThemeMenuBackground
    647     PyMac_PRECHECK(DrawThemeMenuBackground);
    648 #endif
    649     if (!PyArg_ParseTuple(_args, "O&H",
    650                           PyMac_GetRect, &inMenuRect,
    651                           &inMenuType))
    652         return NULL;
    653     _err = DrawThemeMenuBackground(&inMenuRect,
    654                                    inMenuType);
    655     if (_err != noErr) return PyMac_Error(_err);
    656     Py_INCREF(Py_None);
    657     _res = Py_None;
    658     return _res;
    659 }
    660 
    661 static PyObject *App_GetThemeMenuBackgroundRegion(PyObject *_self, PyObject *_args)
    662 {
    663     PyObject *_res = NULL;
    664     OSStatus _err;
    665     Rect inMenuRect;
    666     ThemeMenuType menuType;
    667 #ifndef GetThemeMenuBackgroundRegion
    668     PyMac_PRECHECK(GetThemeMenuBackgroundRegion);
    669 #endif
    670     if (!PyArg_ParseTuple(_args, "O&H",
    671                           PyMac_GetRect, &inMenuRect,
    672                           &menuType))
    673         return NULL;
    674     _err = GetThemeMenuBackgroundRegion(&inMenuRect,
    675                                         menuType,
    676                                         (RgnHandle)0);
    677     if (_err != noErr) return PyMac_Error(_err);
    678     Py_INCREF(Py_None);
    679     _res = Py_None;
    680     return _res;
    681 }
    682 
    683 static PyObject *App_DrawThemeMenuSeparator(PyObject *_self, PyObject *_args)
    684 {
    685     PyObject *_res = NULL;
    686     OSStatus _err;
    687     Rect inItemRect;
    688 #ifndef DrawThemeMenuSeparator
    689     PyMac_PRECHECK(DrawThemeMenuSeparator);
    690 #endif
    691     if (!PyArg_ParseTuple(_args, "O&",
    692                           PyMac_GetRect, &inItemRect))
    693         return NULL;
    694     _err = DrawThemeMenuSeparator(&inItemRect);
    695     if (_err != noErr) return PyMac_Error(_err);
    696     Py_INCREF(Py_None);
    697     _res = Py_None;
    698     return _res;
    699 }
    700 
    701 static PyObject *App_GetThemeMenuSeparatorHeight(PyObject *_self, PyObject *_args)
    702 {
    703     PyObject *_res = NULL;
    704     OSStatus _err;
    705     SInt16 outHeight;
    706 #ifndef GetThemeMenuSeparatorHeight
    707     PyMac_PRECHECK(GetThemeMenuSeparatorHeight);
    708 #endif
    709     if (!PyArg_ParseTuple(_args, ""))
    710         return NULL;
    711     _err = GetThemeMenuSeparatorHeight(&outHeight);
    712     if (_err != noErr) return PyMac_Error(_err);
    713     _res = Py_BuildValue("h",
    714                          outHeight);
    715     return _res;
    716 }
    717 
    718 static PyObject *App_GetThemeMenuItemExtra(PyObject *_self, PyObject *_args)
    719 {
    720     PyObject *_res = NULL;
    721     OSStatus _err;
    722     ThemeMenuItemType inItemType;
    723     SInt16 outHeight;
    724     SInt16 outWidth;
    725 #ifndef GetThemeMenuItemExtra
    726     PyMac_PRECHECK(GetThemeMenuItemExtra);
    727 #endif
    728     if (!PyArg_ParseTuple(_args, "H",
    729                           &inItemType))
    730         return NULL;
    731     _err = GetThemeMenuItemExtra(inItemType,
    732                                  &outHeight,
    733                                  &outWidth);
    734     if (_err != noErr) return PyMac_Error(_err);
    735     _res = Py_BuildValue("hh",
    736                          outHeight,
    737                          outWidth);
    738     return _res;
    739 }
    740 
    741 static PyObject *App_GetThemeMenuTitleExtra(PyObject *_self, PyObject *_args)
    742 {
    743     PyObject *_res = NULL;
    744     OSStatus _err;
    745     SInt16 outWidth;
    746     Boolean inIsSquished;
    747 #ifndef GetThemeMenuTitleExtra
    748     PyMac_PRECHECK(GetThemeMenuTitleExtra);
    749 #endif
    750     if (!PyArg_ParseTuple(_args, "b",
    751                           &inIsSquished))
    752         return NULL;
    753     _err = GetThemeMenuTitleExtra(&outWidth,
    754                                   inIsSquished);
    755     if (_err != noErr) return PyMac_Error(_err);
    756     _res = Py_BuildValue("h",
    757                          outWidth);
    758     return _res;
    759 }
    760 
    761 static PyObject *App_DrawThemeTabPane(PyObject *_self, PyObject *_args)
    762 {
    763     PyObject *_res = NULL;
    764     OSStatus _err;
    765     Rect inRect;
    766     ThemeDrawState inState;
    767 #ifndef DrawThemeTabPane
    768     PyMac_PRECHECK(DrawThemeTabPane);
    769 #endif
    770     if (!PyArg_ParseTuple(_args, "O&l",
    771                           PyMac_GetRect, &inRect,
    772                           &inState))
    773         return NULL;
    774     _err = DrawThemeTabPane(&inRect,
    775                             inState);
    776     if (_err != noErr) return PyMac_Error(_err);
    777     Py_INCREF(Py_None);
    778     _res = Py_None;
    779     return _res;
    780 }
    781 
    782 static PyObject *App_GetThemeTabRegion(PyObject *_self, PyObject *_args)
    783 {
    784     PyObject *_res = NULL;
    785     OSStatus _err;
    786     Rect inRect;
    787     ThemeTabStyle inStyle;
    788     ThemeTabDirection inDirection;
    789 #ifndef GetThemeTabRegion
    790     PyMac_PRECHECK(GetThemeTabRegion);
    791 #endif
    792     if (!PyArg_ParseTuple(_args, "O&HH",
    793                           PyMac_GetRect, &inRect,
    794                           &inStyle,
    795                           &inDirection))
    796         return NULL;
    797     _err = GetThemeTabRegion(&inRect,
    798                              inStyle,
    799                              inDirection,
    800                              (RgnHandle)0);
    801     if (_err != noErr) return PyMac_Error(_err);
    802     Py_INCREF(Py_None);
    803     _res = Py_None;
    804     return _res;
    805 }
    806 
    807 static PyObject *App_SetThemeCursor(PyObject *_self, PyObject *_args)
    808 {
    809     PyObject *_res = NULL;
    810     OSStatus _err;
    811     ThemeCursor inCursor;
    812 #ifndef SetThemeCursor
    813     PyMac_PRECHECK(SetThemeCursor);
    814 #endif
    815     if (!PyArg_ParseTuple(_args, "l",
    816                           &inCursor))
    817         return NULL;
    818     _err = SetThemeCursor(inCursor);
    819     if (_err != noErr) return PyMac_Error(_err);
    820     Py_INCREF(Py_None);
    821     _res = Py_None;
    822     return _res;
    823 }
    824 
    825 static PyObject *App_SetAnimatedThemeCursor(PyObject *_self, PyObject *_args)
    826 {
    827     PyObject *_res = NULL;
    828     OSStatus _err;
    829     ThemeCursor inCursor;
    830     UInt32 inAnimationStep;
    831 #ifndef SetAnimatedThemeCursor
    832     PyMac_PRECHECK(SetAnimatedThemeCursor);
    833 #endif
    834     if (!PyArg_ParseTuple(_args, "ll",
    835                           &inCursor,
    836                           &inAnimationStep))
    837         return NULL;
    838     _err = SetAnimatedThemeCursor(inCursor,
    839                                   inAnimationStep);
    840     if (_err != noErr) return PyMac_Error(_err);
    841     Py_INCREF(Py_None);
    842     _res = Py_None;
    843     return _res;
    844 }
    845 
    846 static PyObject *App_GetThemeScrollBarThumbStyle(PyObject *_self, PyObject *_args)
    847 {
    848     PyObject *_res = NULL;
    849     OSStatus _err;
    850     ThemeScrollBarThumbStyle outStyle;
    851 #ifndef GetThemeScrollBarThumbStyle
    852     PyMac_PRECHECK(GetThemeScrollBarThumbStyle);
    853 #endif
    854     if (!PyArg_ParseTuple(_args, ""))
    855         return NULL;
    856     _err = GetThemeScrollBarThumbStyle(&outStyle);
    857     if (_err != noErr) return PyMac_Error(_err);
    858     _res = Py_BuildValue("H",
    859                          outStyle);
    860     return _res;
    861 }
    862 
    863 static PyObject *App_GetThemeScrollBarArrowStyle(PyObject *_self, PyObject *_args)
    864 {
    865     PyObject *_res = NULL;
    866     OSStatus _err;
    867     ThemeScrollBarArrowStyle outStyle;
    868 #ifndef GetThemeScrollBarArrowStyle
    869     PyMac_PRECHECK(GetThemeScrollBarArrowStyle);
    870 #endif
    871     if (!PyArg_ParseTuple(_args, ""))
    872         return NULL;
    873     _err = GetThemeScrollBarArrowStyle(&outStyle);
    874     if (_err != noErr) return PyMac_Error(_err);
    875     _res = Py_BuildValue("H",
    876                          outStyle);
    877     return _res;
    878 }
    879 
    880 static PyObject *App_GetThemeCheckBoxStyle(PyObject *_self, PyObject *_args)
    881 {
    882     PyObject *_res = NULL;
    883     OSStatus _err;
    884     ThemeCheckBoxStyle outStyle;
    885 #ifndef GetThemeCheckBoxStyle
    886     PyMac_PRECHECK(GetThemeCheckBoxStyle);
    887 #endif
    888     if (!PyArg_ParseTuple(_args, ""))
    889         return NULL;
    890     _err = GetThemeCheckBoxStyle(&outStyle);
    891     if (_err != noErr) return PyMac_Error(_err);
    892     _res = Py_BuildValue("H",
    893                          outStyle);
    894     return _res;
    895 }
    896 
    897 static PyObject *App_UseThemeFont(PyObject *_self, PyObject *_args)
    898 {
    899     PyObject *_res = NULL;
    900     OSStatus _err;
    901     ThemeFontID inFontID;
    902     ScriptCode inScript;
    903 #ifndef UseThemeFont
    904     PyMac_PRECHECK(UseThemeFont);
    905 #endif
    906     if (!PyArg_ParseTuple(_args, "Hh",
    907                           &inFontID,
    908                           &inScript))
    909         return NULL;
    910     _err = UseThemeFont(inFontID,
    911                         inScript);
    912     if (_err != noErr) return PyMac_Error(_err);
    913     Py_INCREF(Py_None);
    914     _res = Py_None;
    915     return _res;
    916 }
    917 
    918 static PyObject *App_DrawThemeTextBox(PyObject *_self, PyObject *_args)
    919 {
    920     PyObject *_res = NULL;
    921     OSStatus _err;
    922     CFStringRef inString;
    923     ThemeFontID inFontID;
    924     ThemeDrawState inState;
    925     Boolean inWrapToWidth;
    926     Rect inBoundingBox;
    927     SInt16 inJust;
    928 #ifndef DrawThemeTextBox
    929     PyMac_PRECHECK(DrawThemeTextBox);
    930 #endif
    931     if (!PyArg_ParseTuple(_args, "O&HlbO&h",
    932                           CFStringRefObj_Convert, &inString,
    933                           &inFontID,
    934                           &inState,
    935                           &inWrapToWidth,
    936                           PyMac_GetRect, &inBoundingBox,
    937                           &inJust))
    938         return NULL;
    939     _err = DrawThemeTextBox(inString,
    940                             inFontID,
    941                             inState,
    942                             inWrapToWidth,
    943                             &inBoundingBox,
    944                             inJust,
    945                             NULL);
    946     if (_err != noErr) return PyMac_Error(_err);
    947     Py_INCREF(Py_None);
    948     _res = Py_None;
    949     return _res;
    950 }
    951 
    952 static PyObject *App_TruncateThemeText(PyObject *_self, PyObject *_args)
    953 {
    954     PyObject *_res = NULL;
    955     OSStatus _err;
    956     CFMutableStringRef inString;
    957     ThemeFontID inFontID;
    958     ThemeDrawState inState;
    959     SInt16 inPixelWidthLimit;
    960     TruncCode inTruncWhere;
    961     Boolean outTruncated;
    962 #ifndef TruncateThemeText
    963     PyMac_PRECHECK(TruncateThemeText);
    964 #endif
    965     if (!PyArg_ParseTuple(_args, "O&Hlhh",
    966                           CFMutableStringRefObj_Convert, &inString,
    967                           &inFontID,
    968                           &inState,
    969                           &inPixelWidthLimit,
    970                           &inTruncWhere))
    971         return NULL;
    972     _err = TruncateThemeText(inString,
    973                              inFontID,
    974                              inState,
    975                              inPixelWidthLimit,
    976                              inTruncWhere,
    977                              &outTruncated);
    978     if (_err != noErr) return PyMac_Error(_err);
    979     _res = Py_BuildValue("b",
    980                          outTruncated);
    981     return _res;
    982 }
    983 
    984 static PyObject *App_GetThemeTextDimensions(PyObject *_self, PyObject *_args)
    985 {
    986     PyObject *_res = NULL;
    987     OSStatus _err;
    988     CFStringRef inString;
    989     ThemeFontID inFontID;
    990     ThemeDrawState inState;
    991     Boolean inWrapToWidth;
    992     Point ioBounds;
    993     SInt16 outBaseline;
    994 #ifndef GetThemeTextDimensions
    995     PyMac_PRECHECK(GetThemeTextDimensions);
    996 #endif
    997     if (!PyArg_ParseTuple(_args, "O&HlbO&",
    998                           CFStringRefObj_Convert, &inString,
    999                           &inFontID,
   1000                           &inState,
   1001                           &inWrapToWidth,
   1002                           PyMac_GetPoint, &ioBounds))
   1003         return NULL;
   1004     _err = GetThemeTextDimensions(inString,
   1005                                   inFontID,
   1006                                   inState,
   1007                                   inWrapToWidth,
   1008                                   &ioBounds,
   1009                                   &outBaseline);
   1010     if (_err != noErr) return PyMac_Error(_err);
   1011     _res = Py_BuildValue("O&h",
   1012                          PyMac_BuildPoint, ioBounds,
   1013                          outBaseline);
   1014     return _res;
   1015 }
   1016 
   1017 static PyObject *App_GetThemeTextShadowOutset(PyObject *_self, PyObject *_args)
   1018 {
   1019     PyObject *_res = NULL;
   1020     OSStatus _err;
   1021     ThemeFontID inFontID;
   1022     ThemeDrawState inState;
   1023     Rect outOutset;
   1024 #ifndef GetThemeTextShadowOutset
   1025     PyMac_PRECHECK(GetThemeTextShadowOutset);
   1026 #endif
   1027     if (!PyArg_ParseTuple(_args, "Hl",
   1028                           &inFontID,
   1029                           &inState))
   1030         return NULL;
   1031     _err = GetThemeTextShadowOutset(inFontID,
   1032                                     inState,
   1033                                     &outOutset);
   1034     if (_err != noErr) return PyMac_Error(_err);
   1035     _res = Py_BuildValue("O&",
   1036                          PyMac_BuildRect, &outOutset);
   1037     return _res;
   1038 }
   1039 
   1040 static PyObject *App_DrawThemeScrollBarArrows(PyObject *_self, PyObject *_args)
   1041 {
   1042     PyObject *_res = NULL;
   1043     OSStatus _err;
   1044     Rect bounds;
   1045     ThemeTrackEnableState enableState;
   1046     ThemeTrackPressState pressState;
   1047     Boolean isHoriz;
   1048     Rect trackBounds;
   1049 #ifndef DrawThemeScrollBarArrows
   1050     PyMac_PRECHECK(DrawThemeScrollBarArrows);
   1051 #endif
   1052     if (!PyArg_ParseTuple(_args, "O&bbb",
   1053                           PyMac_GetRect, &bounds,
   1054                           &enableState,
   1055                           &pressState,
   1056                           &isHoriz))
   1057         return NULL;
   1058     _err = DrawThemeScrollBarArrows(&bounds,
   1059                                     enableState,
   1060                                     pressState,
   1061                                     isHoriz,
   1062                                     &trackBounds);
   1063     if (_err != noErr) return PyMac_Error(_err);
   1064     _res = Py_BuildValue("O&",
   1065                          PyMac_BuildRect, &trackBounds);
   1066     return _res;
   1067 }
   1068 
   1069 static PyObject *App_GetThemeScrollBarTrackRect(PyObject *_self, PyObject *_args)
   1070 {
   1071     PyObject *_res = NULL;
   1072     OSStatus _err;
   1073     Rect bounds;
   1074     ThemeTrackEnableState enableState;
   1075     ThemeTrackPressState pressState;
   1076     Boolean isHoriz;
   1077     Rect trackBounds;
   1078 #ifndef GetThemeScrollBarTrackRect
   1079     PyMac_PRECHECK(GetThemeScrollBarTrackRect);
   1080 #endif
   1081     if (!PyArg_ParseTuple(_args, "O&bbb",
   1082                           PyMac_GetRect, &bounds,
   1083                           &enableState,
   1084                           &pressState,
   1085                           &isHoriz))
   1086         return NULL;
   1087     _err = GetThemeScrollBarTrackRect(&bounds,
   1088                                       enableState,
   1089                                       pressState,
   1090                                       isHoriz,
   1091                                       &trackBounds);
   1092     if (_err != noErr) return PyMac_Error(_err);
   1093     _res = Py_BuildValue("O&",
   1094                          PyMac_BuildRect, &trackBounds);
   1095     return _res;
   1096 }
   1097 
   1098 static PyObject *App_HitTestThemeScrollBarArrows(PyObject *_self, PyObject *_args)
   1099 {
   1100     PyObject *_res = NULL;
   1101     Boolean _rv;
   1102     Rect scrollBarBounds;
   1103     ThemeTrackEnableState enableState;
   1104     ThemeTrackPressState pressState;
   1105     Boolean isHoriz;
   1106     Point ptHit;
   1107     Rect trackBounds;
   1108     ControlPartCode partcode;
   1109 #ifndef HitTestThemeScrollBarArrows
   1110     PyMac_PRECHECK(HitTestThemeScrollBarArrows);
   1111 #endif
   1112     if (!PyArg_ParseTuple(_args, "O&bbbO&",
   1113                           PyMac_GetRect, &scrollBarBounds,
   1114                           &enableState,
   1115                           &pressState,
   1116                           &isHoriz,
   1117                           PyMac_GetPoint, &ptHit))
   1118         return NULL;
   1119     _rv = HitTestThemeScrollBarArrows(&scrollBarBounds,
   1120                                       enableState,
   1121                                       pressState,
   1122                                       isHoriz,
   1123                                       ptHit,
   1124                                       &trackBounds,
   1125                                       &partcode);
   1126     _res = Py_BuildValue("bO&h",
   1127                          _rv,
   1128                          PyMac_BuildRect, &trackBounds,
   1129                          partcode);
   1130     return _res;
   1131 }
   1132 
   1133 static PyObject *App_DrawThemeScrollBarDelimiters(PyObject *_self, PyObject *_args)
   1134 {
   1135     PyObject *_res = NULL;
   1136     OSStatus _err;
   1137     ThemeWindowType flavor;
   1138     Rect inContRect;
   1139     ThemeDrawState state;
   1140     ThemeWindowAttributes attributes;
   1141 #ifndef DrawThemeScrollBarDelimiters
   1142     PyMac_PRECHECK(DrawThemeScrollBarDelimiters);
   1143 #endif
   1144     if (!PyArg_ParseTuple(_args, "HO&ll",
   1145                           &flavor,
   1146                           PyMac_GetRect, &inContRect,
   1147                           &state,
   1148                           &attributes))
   1149         return NULL;
   1150     _err = DrawThemeScrollBarDelimiters(flavor,
   1151                                         &inContRect,
   1152                                         state,
   1153                                         attributes);
   1154     if (_err != noErr) return PyMac_Error(_err);
   1155     Py_INCREF(Py_None);
   1156     _res = Py_None;
   1157     return _res;
   1158 }
   1159 
   1160 static PyObject *App_DrawThemeButton(PyObject *_self, PyObject *_args)
   1161 {
   1162     PyObject *_res = NULL;
   1163     OSStatus _err;
   1164     Rect inBounds;
   1165     UInt16 inKind;
   1166     ThemeButtonDrawInfo inNewInfo;
   1167     ThemeButtonDrawInfo inPrevInfo;
   1168     UInt32 inUserData;
   1169 #ifndef DrawThemeButton
   1170     PyMac_PRECHECK(DrawThemeButton);
   1171 #endif
   1172     if (!PyArg_ParseTuple(_args, "O&HO&O&l",
   1173                           PyMac_GetRect, &inBounds,
   1174                           &inKind,
   1175                           ThemeButtonDrawInfo_Convert, &inNewInfo,
   1176                           ThemeButtonDrawInfo_Convert, &inPrevInfo,
   1177                           &inUserData))
   1178         return NULL;
   1179     _err = DrawThemeButton(&inBounds,
   1180                            inKind,
   1181                            &inNewInfo,
   1182                            &inPrevInfo,
   1183                            NULL,
   1184                            NULL,
   1185                            inUserData);
   1186     if (_err != noErr) return PyMac_Error(_err);
   1187     Py_INCREF(Py_None);
   1188     _res = Py_None;
   1189     return _res;
   1190 }
   1191 
   1192 static PyObject *App_GetThemeButtonRegion(PyObject *_self, PyObject *_args)
   1193 {
   1194     PyObject *_res = NULL;
   1195     OSStatus _err;
   1196     Rect inBounds;
   1197     UInt16 inKind;
   1198     ThemeButtonDrawInfo inNewInfo;
   1199 #ifndef GetThemeButtonRegion
   1200     PyMac_PRECHECK(GetThemeButtonRegion);
   1201 #endif
   1202     if (!PyArg_ParseTuple(_args, "O&HO&",
   1203                           PyMac_GetRect, &inBounds,
   1204                           &inKind,
   1205                           ThemeButtonDrawInfo_Convert, &inNewInfo))
   1206         return NULL;
   1207     _err = GetThemeButtonRegion(&inBounds,
   1208                                 inKind,
   1209                                 &inNewInfo,
   1210                                 (RgnHandle)0);
   1211     if (_err != noErr) return PyMac_Error(_err);
   1212     Py_INCREF(Py_None);
   1213     _res = Py_None;
   1214     return _res;
   1215 }
   1216 
   1217 static PyObject *App_GetThemeButtonContentBounds(PyObject *_self, PyObject *_args)
   1218 {
   1219     PyObject *_res = NULL;
   1220     OSStatus _err;
   1221     Rect inBounds;
   1222     UInt16 inKind;
   1223     ThemeButtonDrawInfo inDrawInfo;
   1224     Rect outBounds;
   1225 #ifndef GetThemeButtonContentBounds
   1226     PyMac_PRECHECK(GetThemeButtonContentBounds);
   1227 #endif
   1228     if (!PyArg_ParseTuple(_args, "O&HO&",
   1229                           PyMac_GetRect, &inBounds,
   1230                           &inKind,
   1231                           ThemeButtonDrawInfo_Convert, &inDrawInfo))
   1232         return NULL;
   1233     _err = GetThemeButtonContentBounds(&inBounds,
   1234                                        inKind,
   1235                                        &inDrawInfo,
   1236                                        &outBounds);
   1237     if (_err != noErr) return PyMac_Error(_err);
   1238     _res = Py_BuildValue("O&",
   1239                          PyMac_BuildRect, &outBounds);
   1240     return _res;
   1241 }
   1242 
   1243 static PyObject *App_GetThemeButtonBackgroundBounds(PyObject *_self, PyObject *_args)
   1244 {
   1245     PyObject *_res = NULL;
   1246     OSStatus _err;
   1247     Rect inBounds;
   1248     UInt16 inKind;
   1249     ThemeButtonDrawInfo inDrawInfo;
   1250     Rect outBounds;
   1251 #ifndef GetThemeButtonBackgroundBounds
   1252     PyMac_PRECHECK(GetThemeButtonBackgroundBounds);
   1253 #endif
   1254     if (!PyArg_ParseTuple(_args, "O&HO&",
   1255                           PyMac_GetRect, &inBounds,
   1256                           &inKind,
   1257                           ThemeButtonDrawInfo_Convert, &inDrawInfo))
   1258         return NULL;
   1259     _err = GetThemeButtonBackgroundBounds(&inBounds,
   1260                                           inKind,
   1261                                           &inDrawInfo,
   1262                                           &outBounds);
   1263     if (_err != noErr) return PyMac_Error(_err);
   1264     _res = Py_BuildValue("O&",
   1265                          PyMac_BuildRect, &outBounds);
   1266     return _res;
   1267 }
   1268 
   1269 static PyObject *App_PlayThemeSound(PyObject *_self, PyObject *_args)
   1270 {
   1271     PyObject *_res = NULL;
   1272     OSStatus _err;
   1273     ThemeSoundKind kind;
   1274 #ifndef PlayThemeSound
   1275     PyMac_PRECHECK(PlayThemeSound);
   1276 #endif
   1277     if (!PyArg_ParseTuple(_args, "O&",
   1278                           PyMac_GetOSType, &kind))
   1279         return NULL;
   1280     _err = PlayThemeSound(kind);
   1281     if (_err != noErr) return PyMac_Error(_err);
   1282     Py_INCREF(Py_None);
   1283     _res = Py_None;
   1284     return _res;
   1285 }
   1286 
   1287 static PyObject *App_BeginThemeDragSound(PyObject *_self, PyObject *_args)
   1288 {
   1289     PyObject *_res = NULL;
   1290     OSStatus _err;
   1291     ThemeDragSoundKind kind;
   1292 #ifndef BeginThemeDragSound
   1293     PyMac_PRECHECK(BeginThemeDragSound);
   1294 #endif
   1295     if (!PyArg_ParseTuple(_args, "O&",
   1296                           PyMac_GetOSType, &kind))
   1297         return NULL;
   1298     _err = BeginThemeDragSound(kind);
   1299     if (_err != noErr) return PyMac_Error(_err);
   1300     Py_INCREF(Py_None);
   1301     _res = Py_None;
   1302     return _res;
   1303 }
   1304 
   1305 static PyObject *App_EndThemeDragSound(PyObject *_self, PyObject *_args)
   1306 {
   1307     PyObject *_res = NULL;
   1308     OSStatus _err;
   1309 #ifndef EndThemeDragSound
   1310     PyMac_PRECHECK(EndThemeDragSound);
   1311 #endif
   1312     if (!PyArg_ParseTuple(_args, ""))
   1313         return NULL;
   1314     _err = EndThemeDragSound();
   1315     if (_err != noErr) return PyMac_Error(_err);
   1316     Py_INCREF(Py_None);
   1317     _res = Py_None;
   1318     return _res;
   1319 }
   1320 
   1321 static PyObject *App_DrawThemeTickMark(PyObject *_self, PyObject *_args)
   1322 {
   1323     PyObject *_res = NULL;
   1324     OSStatus _err;
   1325     Rect bounds;
   1326     ThemeDrawState state;
   1327 #ifndef DrawThemeTickMark
   1328     PyMac_PRECHECK(DrawThemeTickMark);
   1329 #endif
   1330     if (!PyArg_ParseTuple(_args, "O&l",
   1331                           PyMac_GetRect, &bounds,
   1332                           &state))
   1333         return NULL;
   1334     _err = DrawThemeTickMark(&bounds,
   1335                              state);
   1336     if (_err != noErr) return PyMac_Error(_err);
   1337     Py_INCREF(Py_None);
   1338     _res = Py_None;
   1339     return _res;
   1340 }
   1341 
   1342 static PyObject *App_DrawThemeChasingArrows(PyObject *_self, PyObject *_args)
   1343 {
   1344     PyObject *_res = NULL;
   1345     OSStatus _err;
   1346     Rect bounds;
   1347     UInt32 index;
   1348     ThemeDrawState state;
   1349     UInt32 eraseData;
   1350 #ifndef DrawThemeChasingArrows
   1351     PyMac_PRECHECK(DrawThemeChasingArrows);
   1352 #endif
   1353     if (!PyArg_ParseTuple(_args, "O&lll",
   1354                           PyMac_GetRect, &bounds,
   1355                           &index,
   1356                           &state,
   1357                           &eraseData))
   1358         return NULL;
   1359     _err = DrawThemeChasingArrows(&bounds,
   1360                                   index,
   1361                                   state,
   1362                                   NULL,
   1363                                   eraseData);
   1364     if (_err != noErr) return PyMac_Error(_err);
   1365     Py_INCREF(Py_None);
   1366     _res = Py_None;
   1367     return _res;
   1368 }
   1369 
   1370 static PyObject *App_DrawThemePopupArrow(PyObject *_self, PyObject *_args)
   1371 {
   1372     PyObject *_res = NULL;
   1373     OSStatus _err;
   1374     Rect bounds;
   1375     ThemeArrowOrientation orientation;
   1376     ThemePopupArrowSize size;
   1377     ThemeDrawState state;
   1378     UInt32 eraseData;
   1379 #ifndef DrawThemePopupArrow
   1380     PyMac_PRECHECK(DrawThemePopupArrow);
   1381 #endif
   1382     if (!PyArg_ParseTuple(_args, "O&HHll",
   1383                           PyMac_GetRect, &bounds,
   1384                           &orientation,
   1385                           &size,
   1386                           &state,
   1387                           &eraseData))
   1388         return NULL;
   1389     _err = DrawThemePopupArrow(&bounds,
   1390                                orientation,
   1391                                size,
   1392                                state,
   1393                                NULL,
   1394                                eraseData);
   1395     if (_err != noErr) return PyMac_Error(_err);
   1396     Py_INCREF(Py_None);
   1397     _res = Py_None;
   1398     return _res;
   1399 }
   1400 
   1401 static PyObject *App_DrawThemeStandaloneGrowBox(PyObject *_self, PyObject *_args)
   1402 {
   1403     PyObject *_res = NULL;
   1404     OSStatus _err;
   1405     Point origin;
   1406     ThemeGrowDirection growDirection;
   1407     Boolean isSmall;
   1408     ThemeDrawState state;
   1409 #ifndef DrawThemeStandaloneGrowBox
   1410     PyMac_PRECHECK(DrawThemeStandaloneGrowBox);
   1411 #endif
   1412     if (!PyArg_ParseTuple(_args, "O&Hbl",
   1413                           PyMac_GetPoint, &origin,
   1414                           &growDirection,
   1415                           &isSmall,
   1416                           &state))
   1417         return NULL;
   1418     _err = DrawThemeStandaloneGrowBox(origin,
   1419                                       growDirection,
   1420                                       isSmall,
   1421                                       state);
   1422     if (_err != noErr) return PyMac_Error(_err);
   1423     Py_INCREF(Py_None);
   1424     _res = Py_None;
   1425     return _res;
   1426 }
   1427 
   1428 static PyObject *App_DrawThemeStandaloneNoGrowBox(PyObject *_self, PyObject *_args)
   1429 {
   1430     PyObject *_res = NULL;
   1431     OSStatus _err;
   1432     Point origin;
   1433     ThemeGrowDirection growDirection;
   1434     Boolean isSmall;
   1435     ThemeDrawState state;
   1436 #ifndef DrawThemeStandaloneNoGrowBox
   1437     PyMac_PRECHECK(DrawThemeStandaloneNoGrowBox);
   1438 #endif
   1439     if (!PyArg_ParseTuple(_args, "O&Hbl",
   1440                           PyMac_GetPoint, &origin,
   1441                           &growDirection,
   1442                           &isSmall,
   1443                           &state))
   1444         return NULL;
   1445     _err = DrawThemeStandaloneNoGrowBox(origin,
   1446                                         growDirection,
   1447                                         isSmall,
   1448                                         state);
   1449     if (_err != noErr) return PyMac_Error(_err);
   1450     Py_INCREF(Py_None);
   1451     _res = Py_None;
   1452     return _res;
   1453 }
   1454 
   1455 static PyObject *App_GetThemeStandaloneGrowBoxBounds(PyObject *_self, PyObject *_args)
   1456 {
   1457     PyObject *_res = NULL;
   1458     OSStatus _err;
   1459     Point origin;
   1460     ThemeGrowDirection growDirection;
   1461     Boolean isSmall;
   1462     Rect bounds;
   1463 #ifndef GetThemeStandaloneGrowBoxBounds
   1464     PyMac_PRECHECK(GetThemeStandaloneGrowBoxBounds);
   1465 #endif
   1466     if (!PyArg_ParseTuple(_args, "O&Hb",
   1467                           PyMac_GetPoint, &origin,
   1468                           &growDirection,
   1469                           &isSmall))
   1470         return NULL;
   1471     _err = GetThemeStandaloneGrowBoxBounds(origin,
   1472                                            growDirection,
   1473                                            isSmall,
   1474                                            &bounds);
   1475     if (_err != noErr) return PyMac_Error(_err);
   1476     _res = Py_BuildValue("O&",
   1477                          PyMac_BuildRect, &bounds);
   1478     return _res;
   1479 }
   1480 
   1481 static PyObject *App_NormalizeThemeDrawingState(PyObject *_self, PyObject *_args)
   1482 {
   1483     PyObject *_res = NULL;
   1484     OSStatus _err;
   1485 #ifndef NormalizeThemeDrawingState
   1486     PyMac_PRECHECK(NormalizeThemeDrawingState);
   1487 #endif
   1488     if (!PyArg_ParseTuple(_args, ""))
   1489         return NULL;
   1490     _err = NormalizeThemeDrawingState();
   1491     if (_err != noErr) return PyMac_Error(_err);
   1492     Py_INCREF(Py_None);
   1493     _res = Py_None;
   1494     return _res;
   1495 }
   1496 
   1497 static PyObject *App_GetThemeDrawingState(PyObject *_self, PyObject *_args)
   1498 {
   1499     PyObject *_res = NULL;
   1500     OSStatus _err;
   1501     ThemeDrawingState outState;
   1502 #ifndef GetThemeDrawingState
   1503     PyMac_PRECHECK(GetThemeDrawingState);
   1504 #endif
   1505     if (!PyArg_ParseTuple(_args, ""))
   1506         return NULL;
   1507     _err = GetThemeDrawingState(&outState);
   1508     if (_err != noErr) return PyMac_Error(_err);
   1509     _res = Py_BuildValue("O&",
   1510                          ThemeDrawingStateObj_New, outState);
   1511     return _res;
   1512 }
   1513 
   1514 static PyObject *App_ApplyThemeBackground(PyObject *_self, PyObject *_args)
   1515 {
   1516     PyObject *_res = NULL;
   1517     OSStatus _err;
   1518     ThemeBackgroundKind inKind;
   1519     Rect bounds;
   1520     ThemeDrawState inState;
   1521     SInt16 inDepth;
   1522     Boolean inColorDev;
   1523 #ifndef ApplyThemeBackground
   1524     PyMac_PRECHECK(ApplyThemeBackground);
   1525 #endif
   1526     if (!PyArg_ParseTuple(_args, "lO&lhb",
   1527                           &inKind,
   1528                           PyMac_GetRect, &bounds,
   1529                           &inState,
   1530                           &inDepth,
   1531                           &inColorDev))
   1532         return NULL;
   1533     _err = ApplyThemeBackground(inKind,
   1534                                 &bounds,
   1535                                 inState,
   1536                                 inDepth,
   1537                                 inColorDev);
   1538     if (_err != noErr) return PyMac_Error(_err);
   1539     Py_INCREF(Py_None);
   1540     _res = Py_None;
   1541     return _res;
   1542 }
   1543 
   1544 static PyObject *App_SetThemeTextColorForWindow(PyObject *_self, PyObject *_args)
   1545 {
   1546     PyObject *_res = NULL;
   1547     OSStatus _err;
   1548     WindowPtr window;
   1549     Boolean isActive;
   1550     SInt16 depth;
   1551     Boolean isColorDev;
   1552 #ifndef SetThemeTextColorForWindow
   1553     PyMac_PRECHECK(SetThemeTextColorForWindow);
   1554 #endif
   1555     if (!PyArg_ParseTuple(_args, "O&bhb",
   1556                           WinObj_Convert, &window,
   1557                           &isActive,
   1558                           &depth,
   1559                           &isColorDev))
   1560         return NULL;
   1561     _err = SetThemeTextColorForWindow(window,
   1562                                       isActive,
   1563                                       depth,
   1564                                       isColorDev);
   1565     if (_err != noErr) return PyMac_Error(_err);
   1566     Py_INCREF(Py_None);
   1567     _res = Py_None;
   1568     return _res;
   1569 }
   1570 
   1571 static PyObject *App_IsValidAppearanceFileType(PyObject *_self, PyObject *_args)
   1572 {
   1573     PyObject *_res = NULL;
   1574     Boolean _rv;
   1575     OSType fileType;
   1576 #ifndef IsValidAppearanceFileType
   1577     PyMac_PRECHECK(IsValidAppearanceFileType);
   1578 #endif
   1579     if (!PyArg_ParseTuple(_args, "O&",
   1580                           PyMac_GetOSType, &fileType))
   1581         return NULL;
   1582     _rv = IsValidAppearanceFileType(fileType);
   1583     _res = Py_BuildValue("b",
   1584                          _rv);
   1585     return _res;
   1586 }
   1587 
   1588 static PyObject *App_GetThemeBrushAsColor(PyObject *_self, PyObject *_args)
   1589 {
   1590     PyObject *_res = NULL;
   1591     OSStatus _err;
   1592     ThemeBrush inBrush;
   1593     SInt16 inDepth;
   1594     Boolean inColorDev;
   1595     RGBColor outColor;
   1596 #ifndef GetThemeBrushAsColor
   1597     PyMac_PRECHECK(GetThemeBrushAsColor);
   1598 #endif
   1599     if (!PyArg_ParseTuple(_args, "hhb",
   1600                           &inBrush,
   1601                           &inDepth,
   1602                           &inColorDev))
   1603         return NULL;
   1604     _err = GetThemeBrushAsColor(inBrush,
   1605                                 inDepth,
   1606                                 inColorDev,
   1607                                 &outColor);
   1608     if (_err != noErr) return PyMac_Error(_err);
   1609     _res = Py_BuildValue("O&",
   1610                          QdRGB_New, &outColor);
   1611     return _res;
   1612 }
   1613 
   1614 static PyObject *App_GetThemeTextColor(PyObject *_self, PyObject *_args)
   1615 {
   1616     PyObject *_res = NULL;
   1617     OSStatus _err;
   1618     ThemeTextColor inColor;
   1619     SInt16 inDepth;
   1620     Boolean inColorDev;
   1621     RGBColor outColor;
   1622 #ifndef GetThemeTextColor
   1623     PyMac_PRECHECK(GetThemeTextColor);
   1624 #endif
   1625     if (!PyArg_ParseTuple(_args, "hhb",
   1626                           &inColor,
   1627                           &inDepth,
   1628                           &inColorDev))
   1629         return NULL;
   1630     _err = GetThemeTextColor(inColor,
   1631                              inDepth,
   1632                              inColorDev,
   1633                              &outColor);
   1634     if (_err != noErr) return PyMac_Error(_err);
   1635     _res = Py_BuildValue("O&",
   1636                          QdRGB_New, &outColor);
   1637     return _res;
   1638 }
   1639 
   1640 static PyObject *App_GetThemeMetric(PyObject *_self, PyObject *_args)
   1641 {
   1642     PyObject *_res = NULL;
   1643     OSStatus _err;
   1644     ThemeMetric inMetric;
   1645     SInt32 outMetric;
   1646 #ifndef GetThemeMetric
   1647     PyMac_PRECHECK(GetThemeMetric);
   1648 #endif
   1649     if (!PyArg_ParseTuple(_args, "l",
   1650                           &inMetric))
   1651         return NULL;
   1652     _err = GetThemeMetric(inMetric,
   1653                           &outMetric);
   1654     if (_err != noErr) return PyMac_Error(_err);
   1655     _res = Py_BuildValue("l",
   1656                          outMetric);
   1657     return _res;
   1658 }
   1659 
   1660 static PyMethodDef App_methods[] = {
   1661     {"RegisterAppearanceClient", (PyCFunction)App_RegisterAppearanceClient, 1,
   1662      PyDoc_STR("() -> None")},
   1663     {"UnregisterAppearanceClient", (PyCFunction)App_UnregisterAppearanceClient, 1,
   1664      PyDoc_STR("() -> None")},
   1665     {"SetThemePen", (PyCFunction)App_SetThemePen, 1,
   1666      PyDoc_STR("(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None")},
   1667     {"SetThemeBackground", (PyCFunction)App_SetThemeBackground, 1,
   1668      PyDoc_STR("(ThemeBrush inBrush, SInt16 inDepth, Boolean inIsColorDevice) -> None")},
   1669     {"SetThemeTextColor", (PyCFunction)App_SetThemeTextColor, 1,
   1670      PyDoc_STR("(ThemeTextColor inColor, SInt16 inDepth, Boolean inIsColorDevice) -> None")},
   1671     {"SetThemeWindowBackground", (PyCFunction)App_SetThemeWindowBackground, 1,
   1672      PyDoc_STR("(WindowPtr inWindow, ThemeBrush inBrush, Boolean inUpdate) -> None")},
   1673     {"DrawThemeWindowHeader", (PyCFunction)App_DrawThemeWindowHeader, 1,
   1674      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1675     {"DrawThemeWindowListViewHeader", (PyCFunction)App_DrawThemeWindowListViewHeader, 1,
   1676      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1677     {"DrawThemePlacard", (PyCFunction)App_DrawThemePlacard, 1,
   1678      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1679     {"DrawThemeEditTextFrame", (PyCFunction)App_DrawThemeEditTextFrame, 1,
   1680      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1681     {"DrawThemeListBoxFrame", (PyCFunction)App_DrawThemeListBoxFrame, 1,
   1682      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1683     {"DrawThemeFocusRect", (PyCFunction)App_DrawThemeFocusRect, 1,
   1684      PyDoc_STR("(Rect inRect, Boolean inHasFocus) -> None")},
   1685     {"DrawThemePrimaryGroup", (PyCFunction)App_DrawThemePrimaryGroup, 1,
   1686      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1687     {"DrawThemeSecondaryGroup", (PyCFunction)App_DrawThemeSecondaryGroup, 1,
   1688      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1689     {"DrawThemeSeparator", (PyCFunction)App_DrawThemeSeparator, 1,
   1690      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1691     {"DrawThemeModelessDialogFrame", (PyCFunction)App_DrawThemeModelessDialogFrame, 1,
   1692      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1693     {"DrawThemeGenericWell", (PyCFunction)App_DrawThemeGenericWell, 1,
   1694      PyDoc_STR("(Rect inRect, ThemeDrawState inState, Boolean inFillCenter) -> None")},
   1695     {"DrawThemeFocusRegion", (PyCFunction)App_DrawThemeFocusRegion, 1,
   1696      PyDoc_STR("(Boolean inHasFocus) -> None")},
   1697     {"IsThemeInColor", (PyCFunction)App_IsThemeInColor, 1,
   1698      PyDoc_STR("(SInt16 inDepth, Boolean inIsColorDevice) -> (Boolean _rv)")},
   1699     {"GetThemeAccentColors", (PyCFunction)App_GetThemeAccentColors, 1,
   1700      PyDoc_STR("() -> (CTabHandle outColors)")},
   1701     {"DrawThemeMenuBarBackground", (PyCFunction)App_DrawThemeMenuBarBackground, 1,
   1702      PyDoc_STR("(Rect inBounds, ThemeMenuBarState inState, UInt32 inAttributes) -> None")},
   1703     {"GetThemeMenuBarHeight", (PyCFunction)App_GetThemeMenuBarHeight, 1,
   1704      PyDoc_STR("() -> (SInt16 outHeight)")},
   1705     {"DrawThemeMenuBackground", (PyCFunction)App_DrawThemeMenuBackground, 1,
   1706      PyDoc_STR("(Rect inMenuRect, ThemeMenuType inMenuType) -> None")},
   1707     {"GetThemeMenuBackgroundRegion", (PyCFunction)App_GetThemeMenuBackgroundRegion, 1,
   1708      PyDoc_STR("(Rect inMenuRect, ThemeMenuType menuType) -> None")},
   1709     {"DrawThemeMenuSeparator", (PyCFunction)App_DrawThemeMenuSeparator, 1,
   1710      PyDoc_STR("(Rect inItemRect) -> None")},
   1711     {"GetThemeMenuSeparatorHeight", (PyCFunction)App_GetThemeMenuSeparatorHeight, 1,
   1712      PyDoc_STR("() -> (SInt16 outHeight)")},
   1713     {"GetThemeMenuItemExtra", (PyCFunction)App_GetThemeMenuItemExtra, 1,
   1714      PyDoc_STR("(ThemeMenuItemType inItemType) -> (SInt16 outHeight, SInt16 outWidth)")},
   1715     {"GetThemeMenuTitleExtra", (PyCFunction)App_GetThemeMenuTitleExtra, 1,
   1716      PyDoc_STR("(Boolean inIsSquished) -> (SInt16 outWidth)")},
   1717     {"DrawThemeTabPane", (PyCFunction)App_DrawThemeTabPane, 1,
   1718      PyDoc_STR("(Rect inRect, ThemeDrawState inState) -> None")},
   1719     {"GetThemeTabRegion", (PyCFunction)App_GetThemeTabRegion, 1,
   1720      PyDoc_STR("(Rect inRect, ThemeTabStyle inStyle, ThemeTabDirection inDirection) -> None")},
   1721     {"SetThemeCursor", (PyCFunction)App_SetThemeCursor, 1,
   1722      PyDoc_STR("(ThemeCursor inCursor) -> None")},
   1723     {"SetAnimatedThemeCursor", (PyCFunction)App_SetAnimatedThemeCursor, 1,
   1724      PyDoc_STR("(ThemeCursor inCursor, UInt32 inAnimationStep) -> None")},
   1725     {"GetThemeScrollBarThumbStyle", (PyCFunction)App_GetThemeScrollBarThumbStyle, 1,
   1726      PyDoc_STR("() -> (ThemeScrollBarThumbStyle outStyle)")},
   1727     {"GetThemeScrollBarArrowStyle", (PyCFunction)App_GetThemeScrollBarArrowStyle, 1,
   1728      PyDoc_STR("() -> (ThemeScrollBarArrowStyle outStyle)")},
   1729     {"GetThemeCheckBoxStyle", (PyCFunction)App_GetThemeCheckBoxStyle, 1,
   1730      PyDoc_STR("() -> (ThemeCheckBoxStyle outStyle)")},
   1731     {"UseThemeFont", (PyCFunction)App_UseThemeFont, 1,
   1732      PyDoc_STR("(ThemeFontID inFontID, ScriptCode inScript) -> None")},
   1733     {"DrawThemeTextBox", (PyCFunction)App_DrawThemeTextBox, 1,
   1734      PyDoc_STR("(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Rect inBoundingBox, SInt16 inJust) -> None")},
   1735     {"TruncateThemeText", (PyCFunction)App_TruncateThemeText, 1,
   1736      PyDoc_STR("(CFMutableStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, SInt16 inPixelWidthLimit, TruncCode inTruncWhere) -> (Boolean outTruncated)")},
   1737     {"GetThemeTextDimensions", (PyCFunction)App_GetThemeTextDimensions, 1,
   1738      PyDoc_STR("(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth, Point ioBounds) -> (Point ioBounds, SInt16 outBaseline)")},
   1739     {"GetThemeTextShadowOutset", (PyCFunction)App_GetThemeTextShadowOutset, 1,
   1740      PyDoc_STR("(ThemeFontID inFontID, ThemeDrawState inState) -> (Rect outOutset)")},
   1741     {"DrawThemeScrollBarArrows", (PyCFunction)App_DrawThemeScrollBarArrows, 1,
   1742      PyDoc_STR("(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)")},
   1743     {"GetThemeScrollBarTrackRect", (PyCFunction)App_GetThemeScrollBarTrackRect, 1,
   1744      PyDoc_STR("(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)")},
   1745     {"HitTestThemeScrollBarArrows", (PyCFunction)App_HitTestThemeScrollBarArrows, 1,
   1746      PyDoc_STR("(Rect scrollBarBounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz, Point ptHit) -> (Boolean _rv, Rect trackBounds, ControlPartCode partcode)")},
   1747     {"DrawThemeScrollBarDelimiters", (PyCFunction)App_DrawThemeScrollBarDelimiters, 1,
   1748      PyDoc_STR("(ThemeWindowType flavor, Rect inContRect, ThemeDrawState state, ThemeWindowAttributes attributes) -> None")},
   1749     {"DrawThemeButton", (PyCFunction)App_DrawThemeButton, 1,
   1750      PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo, ThemeButtonDrawInfo inPrevInfo, UInt32 inUserData) -> None")},
   1751     {"GetThemeButtonRegion", (PyCFunction)App_GetThemeButtonRegion, 1,
   1752      PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo) -> None")},
   1753     {"GetThemeButtonContentBounds", (PyCFunction)App_GetThemeButtonContentBounds, 1,
   1754      PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)")},
   1755     {"GetThemeButtonBackgroundBounds", (PyCFunction)App_GetThemeButtonBackgroundBounds, 1,
   1756      PyDoc_STR("(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)")},
   1757     {"PlayThemeSound", (PyCFunction)App_PlayThemeSound, 1,
   1758      PyDoc_STR("(ThemeSoundKind kind) -> None")},
   1759     {"BeginThemeDragSound", (PyCFunction)App_BeginThemeDragSound, 1,
   1760      PyDoc_STR("(ThemeDragSoundKind kind) -> None")},
   1761     {"EndThemeDragSound", (PyCFunction)App_EndThemeDragSound, 1,
   1762      PyDoc_STR("() -> None")},
   1763     {"DrawThemeTickMark", (PyCFunction)App_DrawThemeTickMark, 1,
   1764      PyDoc_STR("(Rect bounds, ThemeDrawState state) -> None")},
   1765     {"DrawThemeChasingArrows", (PyCFunction)App_DrawThemeChasingArrows, 1,
   1766      PyDoc_STR("(Rect bounds, UInt32 index, ThemeDrawState state, UInt32 eraseData) -> None")},
   1767     {"DrawThemePopupArrow", (PyCFunction)App_DrawThemePopupArrow, 1,
   1768      PyDoc_STR("(Rect bounds, ThemeArrowOrientation orientation, ThemePopupArrowSize size, ThemeDrawState state, UInt32 eraseData) -> None")},
   1769     {"DrawThemeStandaloneGrowBox", (PyCFunction)App_DrawThemeStandaloneGrowBox, 1,
   1770      PyDoc_STR("(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None")},
   1771     {"DrawThemeStandaloneNoGrowBox", (PyCFunction)App_DrawThemeStandaloneNoGrowBox, 1,
   1772      PyDoc_STR("(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None")},
   1773     {"GetThemeStandaloneGrowBoxBounds", (PyCFunction)App_GetThemeStandaloneGrowBoxBounds, 1,
   1774      PyDoc_STR("(Point origin, ThemeGrowDirection growDirection, Boolean isSmall) -> (Rect bounds)")},
   1775     {"NormalizeThemeDrawingState", (PyCFunction)App_NormalizeThemeDrawingState, 1,
   1776      PyDoc_STR("() -> None")},
   1777     {"GetThemeDrawingState", (PyCFunction)App_GetThemeDrawingState, 1,
   1778      PyDoc_STR("() -> (ThemeDrawingState outState)")},
   1779     {"ApplyThemeBackground", (PyCFunction)App_ApplyThemeBackground, 1,
   1780      PyDoc_STR("(ThemeBackgroundKind inKind, Rect bounds, ThemeDrawState inState, SInt16 inDepth, Boolean inColorDev) -> None")},
   1781     {"SetThemeTextColorForWindow", (PyCFunction)App_SetThemeTextColorForWindow, 1,
   1782      PyDoc_STR("(WindowPtr window, Boolean isActive, SInt16 depth, Boolean isColorDev) -> None")},
   1783     {"IsValidAppearanceFileType", (PyCFunction)App_IsValidAppearanceFileType, 1,
   1784      PyDoc_STR("(OSType fileType) -> (Boolean _rv)")},
   1785     {"GetThemeBrushAsColor", (PyCFunction)App_GetThemeBrushAsColor, 1,
   1786      PyDoc_STR("(ThemeBrush inBrush, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)")},
   1787     {"GetThemeTextColor", (PyCFunction)App_GetThemeTextColor, 1,
   1788      PyDoc_STR("(ThemeTextColor inColor, SInt16 inDepth, Boolean inColorDev) -> (RGBColor outColor)")},
   1789     {"GetThemeMetric", (PyCFunction)App_GetThemeMetric, 1,
   1790      PyDoc_STR("(ThemeMetric inMetric) -> (SInt32 outMetric)")},
   1791     {NULL, NULL, 0}
   1792 };
   1793 
   1794 
   1795 #else   /* __LP64__ */
   1796 
   1797 static PyMethodDef App_methods[] = {
   1798     {NULL, NULL, 0}
   1799 };
   1800 
   1801 #endif /* __LP64__ */
   1802 
   1803 
   1804 void init_App(void)
   1805 {
   1806     PyObject *m;
   1807 #if APPLE_SUPPORTS_QUICKTIME
   1808     PyObject *d;
   1809 #endif /* APPLE_SUPPORTS_QUICKTIME */
   1810 
   1811 
   1812     m = Py_InitModule("_App", App_methods);
   1813 #if APPLE_SUPPORTS_QUICKTIME
   1814     d = PyModule_GetDict(m);
   1815     App_Error = PyMac_GetOSErrException();
   1816     if (App_Error == NULL ||
   1817         PyDict_SetItemString(d, "Error", App_Error) != 0)
   1818         return;
   1819     ThemeDrawingState_Type.ob_type = &PyType_Type;
   1820     if (PyType_Ready(&ThemeDrawingState_Type) < 0) return;
   1821     Py_INCREF(&ThemeDrawingState_Type);
   1822     PyModule_AddObject(m, "ThemeDrawingState", (PyObject *)&ThemeDrawingState_Type);
   1823     /* Backward-compatible name */
   1824     Py_INCREF(&ThemeDrawingState_Type);
   1825     PyModule_AddObject(m, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type);
   1826 #endif /* APPLE_SUPPORTS_QUICKTIME */
   1827 }
   1828 
   1829 /* ======================== End module _App ========================= */
   1830 
   1831