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