summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
diff options
context:
space:
mode:
authorJust van Rossum <just@letterror.com>2002-01-06 23:03:39 (GMT)
committerJust van Rossum <just@letterror.com>2002-01-06 23:03:39 (GMT)
commit6253a114a78a8998677c2a32ec4c449b9e1c723d (patch)
treec3b5a5741c64111c279d63accb1d1f28de8a4376 /Mac/Modules
parentf853be980ee54e8f61fa8d70a7b4724e26ac2035 (diff)
downloadcpython-6253a114a78a8998677c2a32ec4c449b9e1c723d.zip
cpython-6253a114a78a8998677c2a32ec4c449b9e1c723d.tar.gz
cpython-6253a114a78a8998677c2a32ec4c449b9e1c723d.tar.bz2
Added support for DrawThemeButton() and friends.
Diffstat (limited to 'Mac/Modules')
-rw-r--r--Mac/Modules/app/_Appmodule.c169
-rw-r--r--Mac/Modules/app/appscan.py6
-rw-r--r--Mac/Modules/app/appsupport.py14
3 files changed, 186 insertions, 3 deletions
diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c
index 9ce879d..86441e3 100644
--- a/Mac/Modules/app/_Appmodule.c
+++ b/Mac/Modules/app/_Appmodule.c
@@ -27,6 +27,13 @@
#endif
+
+int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
+{
+ return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment);
+}
+
+
static PyObject *App_Error;
/* ----------------- Object type ThemeDrawingState ------------------ */
@@ -996,6 +1003,103 @@ static PyObject *App_DrawThemeScrollBarDelimiters(PyObject *_self, PyObject *_ar
return _res;
}
+static PyObject *App_DrawThemeButton(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ UInt16 inKind;
+ ThemeButtonDrawInfo inNewInfo;
+ ThemeButtonDrawInfo inPrevInfo;
+ UInt32 inUserData;
+ if (!PyArg_ParseTuple(_args, "O&HO&O&l",
+ PyMac_GetRect, &inBounds,
+ &inKind,
+ ThemeButtonDrawInfo_Convert, &inNewInfo,
+ ThemeButtonDrawInfo_Convert, &inPrevInfo,
+ &inUserData))
+ return NULL;
+ _err = DrawThemeButton(&inBounds,
+ inKind,
+ &inNewInfo,
+ &inPrevInfo,
+ NULL,
+ NULL,
+ inUserData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeButtonRegion(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ UInt16 inKind;
+ ThemeButtonDrawInfo inNewInfo;
+ if (!PyArg_ParseTuple(_args, "O&HO&",
+ PyMac_GetRect, &inBounds,
+ &inKind,
+ ThemeButtonDrawInfo_Convert, &inNewInfo))
+ return NULL;
+ _err = GetThemeButtonRegion(&inBounds,
+ inKind,
+ &inNewInfo,
+ (RgnHandle)0);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_GetThemeButtonContentBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ UInt16 inKind;
+ ThemeButtonDrawInfo inDrawInfo;
+ Rect outBounds;
+ if (!PyArg_ParseTuple(_args, "O&HO&",
+ PyMac_GetRect, &inBounds,
+ &inKind,
+ ThemeButtonDrawInfo_Convert, &inDrawInfo))
+ return NULL;
+ _err = GetThemeButtonContentBounds(&inBounds,
+ inKind,
+ &inDrawInfo,
+ &outBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outBounds);
+ return _res;
+}
+
+static PyObject *App_GetThemeButtonBackgroundBounds(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect inBounds;
+ UInt16 inKind;
+ ThemeButtonDrawInfo inDrawInfo;
+ Rect outBounds;
+ if (!PyArg_ParseTuple(_args, "O&HO&",
+ PyMac_GetRect, &inBounds,
+ &inKind,
+ ThemeButtonDrawInfo_Convert, &inDrawInfo))
+ return NULL;
+ _err = GetThemeButtonBackgroundBounds(&inBounds,
+ inKind,
+ &inDrawInfo,
+ &outBounds);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outBounds);
+ return _res;
+}
+
static PyObject *App_PlayThemeSound(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1057,6 +1161,59 @@ static PyObject *App_DrawThemeTickMark(PyObject *_self, PyObject *_args)
return _res;
}
+static PyObject *App_DrawThemeChasingArrows(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ UInt32 index;
+ ThemeDrawState state;
+ UInt32 eraseData;
+ if (!PyArg_ParseTuple(_args, "O&lll",
+ PyMac_GetRect, &bounds,
+ &index,
+ &state,
+ &eraseData))
+ return NULL;
+ _err = DrawThemeChasingArrows(&bounds,
+ index,
+ state,
+ NULL,
+ eraseData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *App_DrawThemePopupArrow(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ Rect bounds;
+ ThemeArrowOrientation orientation;
+ ThemePopupArrowSize size;
+ ThemeDrawState state;
+ UInt32 eraseData;
+ if (!PyArg_ParseTuple(_args, "O&HHll",
+ PyMac_GetRect, &bounds,
+ &orientation,
+ &size,
+ &state,
+ &eraseData))
+ return NULL;
+ _err = DrawThemePopupArrow(&bounds,
+ orientation,
+ size,
+ state,
+ NULL,
+ eraseData);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *App_DrawThemeStandaloneGrowBox(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1387,6 +1544,14 @@ static PyMethodDef App_methods[] = {
"(Rect scrollBarBounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz, Point ptHit) -> (Boolean _rv, Rect trackBounds, ControlPartCode partcode)"},
{"DrawThemeScrollBarDelimiters", (PyCFunction)App_DrawThemeScrollBarDelimiters, 1,
"(ThemeWindowType flavor, Rect inContRect, ThemeDrawState state, ThemeWindowAttributes attributes) -> None"},
+ {"DrawThemeButton", (PyCFunction)App_DrawThemeButton, 1,
+ "(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo, ThemeButtonDrawInfo inPrevInfo, UInt32 inUserData) -> None"},
+ {"GetThemeButtonRegion", (PyCFunction)App_GetThemeButtonRegion, 1,
+ "(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo) -> None"},
+ {"GetThemeButtonContentBounds", (PyCFunction)App_GetThemeButtonContentBounds, 1,
+ "(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)"},
+ {"GetThemeButtonBackgroundBounds", (PyCFunction)App_GetThemeButtonBackgroundBounds, 1,
+ "(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)"},
{"PlayThemeSound", (PyCFunction)App_PlayThemeSound, 1,
"(ThemeSoundKind kind) -> None"},
{"BeginThemeDragSound", (PyCFunction)App_BeginThemeDragSound, 1,
@@ -1395,6 +1560,10 @@ static PyMethodDef App_methods[] = {
"() -> None"},
{"DrawThemeTickMark", (PyCFunction)App_DrawThemeTickMark, 1,
"(Rect bounds, ThemeDrawState state) -> None"},
+ {"DrawThemeChasingArrows", (PyCFunction)App_DrawThemeChasingArrows, 1,
+ "(Rect bounds, UInt32 index, ThemeDrawState state, UInt32 eraseData) -> None"},
+ {"DrawThemePopupArrow", (PyCFunction)App_DrawThemePopupArrow, 1,
+ "(Rect bounds, ThemeArrowOrientation orientation, ThemePopupArrowSize size, ThemeDrawState state, UInt32 eraseData) -> None"},
{"DrawThemeStandaloneGrowBox", (PyCFunction)App_DrawThemeStandaloneGrowBox, 1,
"(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None"},
{"DrawThemeStandaloneNoGrowBox", (PyCFunction)App_DrawThemeStandaloneNoGrowBox, 1,
diff --git a/Mac/Modules/app/appscan.py b/Mac/Modules/app/appscan.py
index c7fea17..fe6b30d 100644
--- a/Mac/Modules/app/appscan.py
+++ b/Mac/Modules/app/appscan.py
@@ -66,12 +66,12 @@ class MyScanner(Scanner):
"MenuItemDrawingUPP",
"ThemeIteratorUPP",
"ThemeTabTitleDrawUPP",
- "ThemeEraseUPP",
- "ThemeButtonDrawUPP",
+# "ThemeEraseUPP",
+# "ThemeButtonDrawUPP",
"WindowTitleDrawingUPP",
"ProcessSerialNumber_ptr", # Too much work for now.
"ThemeTrackDrawInfo_ptr", # Too much work
- "ThemeButtonDrawInfo_ptr", # ditto
+# "ThemeButtonDrawInfo_ptr", # ditto
"ThemeWindowMetrics_ptr", # ditto
# "ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
"Collection", # No interface to collection mgr yet.
diff --git a/Mac/Modules/app/appsupport.py b/Mac/Modules/app/appsupport.py
index 3178c4a..4be504a 100644
--- a/Mac/Modules/app/appsupport.py
+++ b/Mac/Modules/app/appsupport.py
@@ -73,6 +73,13 @@ CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj")
CFMutableStringRef = OpaqueByValueType("CFMutableStringRef", "CFMutableStringRefObj")
TruncCode = Type("TruncCode", "h")
+
+ThemeButtonKind = UInt16
+ThemeButtonDrawInfo_ptr = OpaqueType("ThemeButtonDrawInfo", "ThemeButtonDrawInfo")
+ThemeEraseUPP = FakeType("NULL")
+ThemeButtonDrawUPP = FakeType("NULL")
+
+
includestuff = includestuff + """
#ifdef WITHOUT_FRAMEWORKS
#include <Appearance.h>
@@ -80,6 +87,13 @@ includestuff = includestuff + """
#include <Carbon/Carbon.h>
#endif
+
+
+int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
+{
+ return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment);
+}
+
"""
class MyObjectDefinition(GlobalObjectDefinition):