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