summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/app
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-12-16 20:18:40 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-12-16 20:18:40 (GMT)
commit2168e9d602cffbb6975a11353707a921455c05f7 (patch)
tree4ea57b7032c9f1ed1751fe838623259d43b3f30c /Mac/Modules/app
parentb519638d1ee6715d4c262d804408041d4caf6b5a (diff)
downloadcpython-2168e9d602cffbb6975a11353707a921455c05f7.zip
cpython-2168e9d602cffbb6975a11353707a921455c05f7.tar.gz
cpython-2168e9d602cffbb6975a11353707a921455c05f7.tar.bz2
Adapted for Universal Headers 3.4
Diffstat (limited to 'Mac/Modules/app')
-rw-r--r--Mac/Modules/app/_Appmodule.c102
-rw-r--r--Mac/Modules/app/appscan.py5
-rw-r--r--Mac/Modules/app/appsupport.py3
3 files changed, 110 insertions, 0 deletions
diff --git a/Mac/Modules/app/_Appmodule.c b/Mac/Modules/app/_Appmodule.c
index b70feda..4e9adc2 100644
--- a/Mac/Modules/app/_Appmodule.c
+++ b/Mac/Modules/app/_Appmodule.c
@@ -654,6 +654,93 @@ static PyObject *App_UseThemeFont(PyObject *_self, PyObject *_args)
return _res;
}
+#if TARGET_API_MAC_CARBON
+
+static PyObject *App_TruncateThemeText(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFMutableStringRef inString;
+ ThemeFontID inFontID;
+ ThemeDrawState inState;
+ SInt16 inPixelWidthLimit;
+ TruncCode inTruncWhere;
+ Boolean outTruncated;
+ if (!PyArg_ParseTuple(_args, "O&Hlhh",
+ CFMutableStringRefObj_Convert, &inString,
+ &inFontID,
+ &inState,
+ &inPixelWidthLimit,
+ &inTruncWhere))
+ return NULL;
+ _err = TruncateThemeText(inString,
+ inFontID,
+ inState,
+ inPixelWidthLimit,
+ inTruncWhere,
+ &outTruncated);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("b",
+ outTruncated);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *App_GetThemeTextDimensions(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef inString;
+ ThemeFontID inFontID;
+ ThemeDrawState inState;
+ Boolean inWrapToWidth;
+ Point ioBounds;
+ SInt16 outBaseline;
+ if (!PyArg_ParseTuple(_args, "O&Hlb",
+ CFStringRefObj_Convert, &inString,
+ &inFontID,
+ &inState,
+ &inWrapToWidth))
+ return NULL;
+ _err = GetThemeTextDimensions(inString,
+ inFontID,
+ inState,
+ inWrapToWidth,
+ &ioBounds,
+ &outBaseline);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&h",
+ PyMac_BuildPoint, ioBounds,
+ outBaseline);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_CARBON
+
+static PyObject *App_GetThemeTextShadowOutset(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ ThemeFontID inFontID;
+ ThemeDrawState inState;
+ Rect outOutset;
+ if (!PyArg_ParseTuple(_args, "Hl",
+ &inFontID,
+ &inState))
+ return NULL;
+ _err = GetThemeTextShadowOutset(inFontID,
+ inState,
+ &outOutset);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ PyMac_BuildRect, &outOutset);
+ return _res;
+}
+#endif
+
static PyObject *App_DrawThemeScrollBarArrows(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1111,6 +1198,21 @@ static PyMethodDef App_methods[] = {
"() -> (ThemeCheckBoxStyle outStyle)"},
{"UseThemeFont", (PyCFunction)App_UseThemeFont, 1,
"(ThemeFontID inFontID, ScriptCode inScript) -> None"},
+
+#if TARGET_API_MAC_CARBON
+ {"TruncateThemeText", (PyCFunction)App_TruncateThemeText, 1,
+ "(CFMutableStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, SInt16 inPixelWidthLimit, TruncCode inTruncWhere) -> (Boolean outTruncated)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetThemeTextDimensions", (PyCFunction)App_GetThemeTextDimensions, 1,
+ "(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth) -> (Point ioBounds, SInt16 outBaseline)"},
+#endif
+
+#if TARGET_API_MAC_CARBON
+ {"GetThemeTextShadowOutset", (PyCFunction)App_GetThemeTextShadowOutset, 1,
+ "(ThemeFontID inFontID, ThemeDrawState inState) -> (Rect outOutset)"},
+#endif
{"DrawThemeScrollBarArrows", (PyCFunction)App_DrawThemeScrollBarArrows, 1,
"(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)"},
{"GetThemeScrollBarTrackRect", (PyCFunction)App_GetThemeScrollBarTrackRect, 1,
diff --git a/Mac/Modules/app/appscan.py b/Mac/Modules/app/appscan.py
index 72c2db2..62409c7 100644
--- a/Mac/Modules/app/appscan.py
+++ b/Mac/Modules/app/appscan.py
@@ -48,12 +48,16 @@ class MyScanner(Scanner):
"appearanceBadTextColorIndexErr",
"appearanceThemeHasNoAccents",
"appearanceBadCursorIndexErr",
+ "DrawThemeTextBox", # Funny void* out param
]
def makegreylist(self):
return [
('#if TARGET_API_MAC_CARBON', [
'GetThemeMetric',
+ 'GetThemeTextShadowOutset',
+ 'GetThemeTextDimensions',
+ 'TruncateThemeText',
])]
def makeblacklisttypes(self):
@@ -71,6 +75,7 @@ class MyScanner(Scanner):
"ThemeWindowMetrics_ptr", # ditto
"ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
"Collection", # No interface to collection mgr yet.
+ "BytePtr", # Not yet.
]
def makerepairinstructions(self):
diff --git a/Mac/Modules/app/appsupport.py b/Mac/Modules/app/appsupport.py
index 5cfe29c..a0eff8e 100644
--- a/Mac/Modules/app/appsupport.py
+++ b/Mac/Modules/app/appsupport.py
@@ -67,6 +67,9 @@ ThemeDragSoundKind = OSTypeType("ThemeDragSoundKind")
ThemeBackgroundKind = Type("ThemeBackgroundKind", "l")
ThemeMetric = Type("ThemeMetric", "l")
RGBColor = OpaqueType("RGBColor", "QdRGB")
+CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj")
+CFMutableStringRef = OpaqueByValueType("CFMutableStringRef", "CFMutableStringRefObj")
+TruncCode = Type("TruncCode", "h")
includestuff = includestuff + """
#ifdef WITHOUT_FRAMEWORKS