summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJust van Rossum <just@letterror.com>2001-12-18 20:15:27 (GMT)
committerJust van Rossum <just@letterror.com>2001-12-18 20:15:27 (GMT)
commit7eb48e3283fa3e8622889bc50545bc87e88eaee6 (patch)
tree63ee0518b8711d106b8c2c5062dd2199b5990ced
parentc7cb9ed35f878d6ac31c5b746f8b15abcc3be54d (diff)
downloadcpython-7eb48e3283fa3e8622889bc50545bc87e88eaee6.zip
cpython-7eb48e3283fa3e8622889bc50545bc87e88eaee6.tar.gz
cpython-7eb48e3283fa3e8622889bc50545bc87e88eaee6.tar.bz2
Moved a bunch of routines from "blacklisted" to "graylisted", as they _are_
available in OSX (mach-o) but not in CarbonLib (neither on OSX or OS9).
-rw-r--r--Mac/Modules/ctl/_Ctlmodule.c251
-rw-r--r--Mac/Modules/ctl/ctlscan.py22
2 files changed, 263 insertions, 10 deletions
diff --git a/Mac/Modules/ctl/_Ctlmodule.c b/Mac/Modules/ctl/_Ctlmodule.c
index b2ba986..d15ed90 100644
--- a/Mac/Modules/ctl/_Ctlmodule.c
+++ b/Mac/Modules/ctl/_Ctlmodule.c
@@ -311,6 +311,62 @@ static PyObject *CtlObj_SetControlVisibility(ControlObject *_self, PyObject *_ar
return _res;
}
+#if TARGET_API_MAC_OSX
+
+static PyObject *CtlObj_IsControlEnabled(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+#ifndef IsControlEnabled
+ PyMac_PRECHECK(IsControlEnabled);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsControlEnabled(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_OSX
+
+static PyObject *CtlObj_EnableControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef EnableControl
+ PyMac_PRECHECK(EnableControl);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = EnableControl(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_OSX
+
+static PyObject *CtlObj_DisableControl(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+#ifndef DisableControl
+ PyMac_PRECHECK(DisableControl);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = DisableControl(_self->ob_itself);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+#endif
+
static PyObject *CtlObj_Draw1Control(ControlObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -2615,6 +2671,27 @@ static PyObject *CtlObj_SetDataBrowserEditText(ControlObject *_self, PyObject *_
}
#endif
+#if TARGET_API_MAC_OSX
+
+static PyObject *CtlObj_CopyDataBrowserEditText(ControlObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ CFStringRef text;
+#ifndef CopyDataBrowserEditText
+ PyMac_PRECHECK(CopyDataBrowserEditText);
+#endif
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _err = CopyDataBrowserEditText(_self->ob_itself,
+ &text);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CFStringRefObj_New, text);
+ return _res;
+}
+#endif
+
#if TARGET_API_MAC_CARBON
static PyObject *CtlObj_GetDataBrowserEditText(ControlObject *_self, PyObject *_args)
@@ -3795,6 +3872,21 @@ static PyMethodDef CtlObj_methods[] = {
"() -> None"},
{"SetControlVisibility", (PyCFunction)CtlObj_SetControlVisibility, 1,
"(Boolean inIsVisible, Boolean inDoDraw) -> None"},
+
+#if TARGET_API_MAC_OSX
+ {"IsControlEnabled", (PyCFunction)CtlObj_IsControlEnabled, 1,
+ "() -> (Boolean _rv)"},
+#endif
+
+#if TARGET_API_MAC_OSX
+ {"EnableControl", (PyCFunction)CtlObj_EnableControl, 1,
+ "() -> None"},
+#endif
+
+#if TARGET_API_MAC_OSX
+ {"DisableControl", (PyCFunction)CtlObj_DisableControl, 1,
+ "() -> None"},
+#endif
{"Draw1Control", (PyCFunction)CtlObj_Draw1Control, 1,
"() -> None"},
{"GetBestControlRect", (PyCFunction)CtlObj_GetBestControlRect, 1,
@@ -4209,6 +4301,11 @@ static PyMethodDef CtlObj_methods[] = {
"(CFStringRef text) -> None"},
#endif
+#if TARGET_API_MAC_OSX
+ {"CopyDataBrowserEditText", (PyCFunction)CtlObj_CopyDataBrowserEditText, 1,
+ "() -> (CFStringRef text)"},
+#endif
+
#if TARGET_API_MAC_CARBON
{"GetDataBrowserEditText", (PyCFunction)CtlObj_GetDataBrowserEditText, 1,
"(CFMutableStringRef text) -> None"},
@@ -4971,6 +5068,41 @@ static PyObject *Ctl_CreateProgressBarControl(PyObject *_self, PyObject *_args)
}
#endif
+#if TARGET_API_MAC_OSX
+
+static PyObject *Ctl_CreateRelevanceBarControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ SInt32 value;
+ SInt32 minimum;
+ SInt32 maximum;
+ ControlHandle outControl;
+#ifndef CreateRelevanceBarControl
+ PyMac_PRECHECK(CreateRelevanceBarControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lll",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ &value,
+ &minimum,
+ &maximum))
+ return NULL;
+ _err = CreateRelevanceBarControl(window,
+ &boundsRect,
+ value,
+ minimum,
+ maximum,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+#endif
+
#if TARGET_API_MAC_CARBON
static PyObject *Ctl_CreateLittleArrowsControl(PyObject *_self, PyObject *_args)
@@ -5734,6 +5866,70 @@ static PyObject *Ctl_CreateScrollingTextBoxControl(PyObject *_self, PyObject *_a
}
#endif
+#if TARGET_API_MAC_OSX
+
+static PyObject *Ctl_CreateDisclosureButtonControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ Rect inBoundsRect;
+ SInt32 inValue;
+ Boolean inAutoToggles;
+ ControlHandle outControl;
+#ifndef CreateDisclosureButtonControl
+ PyMac_PRECHECK(CreateDisclosureButtonControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&lb",
+ WinObj_Convert, &inWindow,
+ PyMac_GetRect, &inBoundsRect,
+ &inValue,
+ &inAutoToggles))
+ return NULL;
+ _err = CreateDisclosureButtonControl(inWindow,
+ &inBoundsRect,
+ inValue,
+ inAutoToggles,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+#endif
+
+#if TARGET_API_MAC_OSX
+
+static PyObject *Ctl_CreateRoundButtonControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr inWindow;
+ Rect inBoundsRect;
+ SInt16 inSize;
+ ControlButtonContentInfo inContent;
+ ControlHandle outControl;
+#ifndef CreateRoundButtonControl
+ PyMac_PRECHECK(CreateRoundButtonControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&hO&",
+ WinObj_Convert, &inWindow,
+ PyMac_GetRect, &inBoundsRect,
+ &inSize,
+ ControlButtonContentInfo_Convert, &inContent))
+ return NULL;
+ _err = CreateRoundButtonControl(inWindow,
+ &inBoundsRect,
+ inSize,
+ &inContent,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+#endif
+
#if TARGET_API_MAC_CARBON
static PyObject *Ctl_CreateDataBrowserControl(PyObject *_self, PyObject *_args)
@@ -5763,6 +5959,41 @@ static PyObject *Ctl_CreateDataBrowserControl(PyObject *_self, PyObject *_args)
}
#endif
+#if TARGET_API_MAC_OSX
+
+static PyObject *Ctl_CreateEditUnicodeTextControl(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ OSStatus _err;
+ WindowPtr window;
+ Rect boundsRect;
+ CFStringRef text;
+ Boolean isPassword;
+ ControlFontStyleRec style;
+ ControlHandle outControl;
+#ifndef CreateEditUnicodeTextControl
+ PyMac_PRECHECK(CreateEditUnicodeTextControl);
+#endif
+ if (!PyArg_ParseTuple(_args, "O&O&O&bO&",
+ WinObj_Convert, &window,
+ PyMac_GetRect, &boundsRect,
+ CFStringRefObj_Convert, &text,
+ &isPassword,
+ ControlFontStyle_Convert, &style))
+ return NULL;
+ _err = CreateEditUnicodeTextControl(window,
+ &boundsRect,
+ text,
+ isPassword,
+ &style,
+ &outControl);
+ if (_err != noErr) return PyMac_Error(_err);
+ _res = Py_BuildValue("O&",
+ CtlObj_New, outControl);
+ return _res;
+}
+#endif
+
static PyObject *Ctl_FindControlUnderMouse(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -5924,6 +6155,11 @@ static PyMethodDef Ctl_methods[] = {
"(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, Boolean indeterminate) -> (ControlHandle outControl)"},
#endif
+#if TARGET_API_MAC_OSX
+ {"CreateRelevanceBarControl", (PyCFunction)Ctl_CreateRelevanceBarControl, 1,
+ "(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum) -> (ControlHandle outControl)"},
+#endif
+
#if TARGET_API_MAC_CARBON
{"CreateLittleArrowsControl", (PyCFunction)Ctl_CreateLittleArrowsControl, 1,
"(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 increment) -> (ControlHandle outControl)"},
@@ -6039,10 +6275,25 @@ static PyMethodDef Ctl_methods[] = {
"(WindowPtr window, Rect boundsRect, SInt16 contentResID, Boolean autoScroll, UInt32 delayBeforeAutoScroll, UInt32 delayBetweenAutoScroll, UInt16 autoScrollAmount) -> (ControlHandle outControl)"},
#endif
+#if TARGET_API_MAC_OSX
+ {"CreateDisclosureButtonControl", (PyCFunction)Ctl_CreateDisclosureButtonControl, 1,
+ "(WindowPtr inWindow, Rect inBoundsRect, SInt32 inValue, Boolean inAutoToggles) -> (ControlHandle outControl)"},
+#endif
+
+#if TARGET_API_MAC_OSX
+ {"CreateRoundButtonControl", (PyCFunction)Ctl_CreateRoundButtonControl, 1,
+ "(WindowPtr inWindow, Rect inBoundsRect, SInt16 inSize, ControlButtonContentInfo inContent) -> (ControlHandle outControl)"},
+#endif
+
#if TARGET_API_MAC_CARBON
{"CreateDataBrowserControl", (PyCFunction)Ctl_CreateDataBrowserControl, 1,
"(WindowPtr window, Rect boundsRect, OSType style) -> (ControlHandle outControl)"},
#endif
+
+#if TARGET_API_MAC_OSX
+ {"CreateEditUnicodeTextControl", (PyCFunction)Ctl_CreateEditUnicodeTextControl, 1,
+ "(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, ControlFontStyleRec style) -> (ControlHandle outControl)"},
+#endif
{"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1,
"(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)"},
{"as_Control", (PyCFunction)Ctl_as_Control, 1,
diff --git a/Mac/Modules/ctl/ctlscan.py b/Mac/Modules/ctl/ctlscan.py
index 70b2866..61f79eb 100644
--- a/Mac/Modules/ctl/ctlscan.py
+++ b/Mac/Modules/ctl/ctlscan.py
@@ -88,15 +88,6 @@ class MyScanner(Scanner):
'GetControlPropertySize',
'SendControlMessage', # Parameter changed from long to void* from UH3.3 to UH3.4
'CreateTabsControl', # wrote manually
- # these are part of Carbon, yet not in CarbonLib; OSX-only
- 'CreateRoundButtonControl',
- 'CreateDisclosureButtonControl',
- 'CreateRelevanceBarControl',
- 'DisableControl',
- 'EnableControl',
- 'IsControlEnabled',
- 'CreateEditUnicodeTextControl',
- 'CopyDataBrowserEditText',
# too lazy for now
'GetImageWellContentInfo',
@@ -252,7 +243,18 @@ class MyScanner(Scanner):
'SetControlBounds',
'SetControlPopupMenuHandle',
'SetControlPopupMenuID',
- ])]
+ ]),
+ ('#if TARGET_API_MAC_OSX', [
+ 'CreateRoundButtonControl',
+ 'CreateDisclosureButtonControl',
+ 'CreateRelevanceBarControl',
+ 'DisableControl',
+ 'EnableControl',
+ 'IsControlEnabled',
+ 'CreateEditUnicodeTextControl',
+ 'CopyDataBrowserEditText',
+ ]),
+ ]
def makeblacklisttypes(self):
return [