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