]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added support for DrawThemeButton() and friends.
authorJust van Rossum <just@letterror.com>
Sun, 6 Jan 2002 23:03:39 +0000 (23:03 +0000)
committerJust van Rossum <just@letterror.com>
Sun, 6 Jan 2002 23:03:39 +0000 (23:03 +0000)
Mac/Modules/app/_Appmodule.c
Mac/Modules/app/appscan.py
Mac/Modules/app/appsupport.py

index 9ce879d52d5e194888e36cc1a9b5e1a175de3b97..86441e341cea6bf1f5f7ed209f9086354004ddae 100644 (file)
 #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,
index c7fea175f705922a7b35f94af4f92d55fd18ef84..fe6b30d840e61b3d09f6d2fbda11d815a03cd20b 100644 (file)
@@ -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.
index 3178c4a02e9c56ae3a6734a22b8f748281d65574..4be504a71015e68acb1efe63cdb4fbacfa155afc 100644 (file)
@@ -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):