/Mac/Modules/ctl/_Ctlmodule.c
http://unladen-swallow.googlecode.com/ · C · 5815 lines · 5442 code · 345 blank · 28 comment · 654 complexity · c92a74b5bb99169d9775d91ee2505c09 MD5 · raw file
Large files are truncated click here to view the full file
- /* ========================== Module _Ctl =========================== */
- #include "Python.h"
- #ifndef __LP64__
- #include "pymactoolbox.h"
- /* Macro to test whether a weak-loaded CFM function exists */
- #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
- PyErr_SetString(PyExc_NotImplementedError, \
- "Not available in this shared library/OS version"); \
- return NULL; \
- }} while(0)
- #include <Carbon/Carbon.h>
- #ifdef USE_TOOLBOX_OBJECT_GLUE
- extern PyObject *_CtlObj_New(ControlHandle);
- extern int _CtlObj_Convert(PyObject *, ControlHandle *);
- #define CtlObj_New _CtlObj_New
- #define CtlObj_Convert _CtlObj_Convert
- #endif
- static PyObject *CtlObj_WhichControl(ControlHandle);
- #define as_Control(h) ((ControlHandle)h)
- #define as_Resource(ctl) ((Handle)ctl)
- #define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp)
- #define MAXTABS 32 /* maximum number of tabs that we support in a tabs control */
- /*
- ** Parse/generate ControlFontStyleRec records
- */
- #if 0 /* Not needed */
- static PyObject *
- ControlFontStyle_New(ControlFontStyleRec *itself)
- {
- return Py_BuildValue("hhhhhhO&O&", itself->flags, itself->font,
- itself->size, itself->style, itself->mode, itself->just,
- QdRGB_New, &itself->foreColor, QdRGB_New, &itself->backColor);
- }
- #endif
- static int
- ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself)
- {
- return PyArg_Parse(v, "(hhhhhhO&O&)", &itself->flags,
- &itself->font, &itself->size, &itself->style, &itself->mode,
- &itself->just, QdRGB_Convert, &itself->foreColor,
- QdRGB_Convert, &itself->backColor);
- }
- /*
- ** Parse/generate ControlID records
- */
- static PyObject *
- PyControlID_New(ControlID *itself)
- {
- return Py_BuildValue("O&l", PyMac_BuildOSType, itself->signature, itself->id);
- }
- static int
- PyControlID_Convert(PyObject *v, ControlID *itself)
- {
- return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id);
- }
- /*
- ** generate DataBrowserListViewColumnDesc records
- */
- static int
- DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself)
- {
- return PyArg_Parse(v, "(lO&l)",
- &itself->propertyID,
- PyMac_GetOSType, &itself->propertyType,
- &itself->propertyFlags);
- }
- static int
- ControlButtonContentInfo_Convert(PyObject *v, ControlButtonContentInfo *itself)
- {
- return PyArg_Parse(v, "(hO&)",
- &itself->contentType,
- OptResObj_Convert, &itself->u.iconSuite);
- }
- static int
- DataBrowserListViewHeaderDesc_Convert(PyObject *v, DataBrowserListViewHeaderDesc *itself)
- {
- itself->version = kDataBrowserListViewLatestHeaderDesc;
- return PyArg_Parse(v, "(HHhO&HO&O&)",
- &itself->minimumWidth,
- &itself->maximumWidth,
- &itself->titleOffset,
- CFStringRefObj_Convert, &itself->titleString,
- &itself->initialOrder,
- ControlFontStyle_Convert, &itself->btnFontStyle,
- ControlButtonContentInfo_Convert, &itself->btnContentInfo);
- }
- static int
- DataBrowserListViewColumnDesc_Convert(PyObject *v, DataBrowserListViewColumnDesc *itself)
- {
- return PyArg_Parse(v, "(O&O&)",
- DataBrowserTableViewColumnDesc_Convert, &itself->propertyDesc,
- DataBrowserListViewHeaderDesc_Convert, &itself->headerBtnDesc);
- }
- /* TrackControl and HandleControlClick callback support */
- #define kMyControlActionProcTag 'ACTN' /* not an official tag, only for internal use */
- static PyObject *tracker;
- static ControlActionUPP mytracker_upp;
- static ControlActionUPP myactionproc_upp;
- static ControlUserPaneKeyDownUPP mykeydownproc_upp;
- static ControlUserPaneFocusUPP myfocusproc_upp;
- static ControlUserPaneDrawUPP mydrawproc_upp;
- static ControlUserPaneIdleUPP myidleproc_upp;
- static ControlUserPaneHitTestUPP myhittestproc_upp;
- static ControlUserPaneTrackingUPP mytrackingproc_upp;
- static int settrackfunc(PyObject *); /* forward */
- static void clrtrackfunc(void); /* forward */
- static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *);
- static PyObject *Ctl_Error;
- /* ---------------------- Object type Control ----------------------- */
- PyTypeObject Control_Type;
- #define CtlObj_Check(x) ((x)->ob_type == &Control_Type || PyObject_TypeCheck((x), &Control_Type))
- typedef struct ControlObject {
- PyObject_HEAD
- ControlHandle ob_itself;
- PyObject *ob_callbackdict;
- } ControlObject;
- PyObject *CtlObj_New(ControlHandle itself)
- {
- ControlObject *it;
- if (itself == NULL) return PyMac_Error(resNotFound);
- it = PyObject_NEW(ControlObject, &Control_Type);
- if (it == NULL) return NULL;
- it->ob_itself = itself;
- SetControlReference(itself, (long)it);
- it->ob_callbackdict = NULL;
- return (PyObject *)it;
- }
- int CtlObj_Convert(PyObject *v, ControlHandle *p_itself)
- {
- if (!CtlObj_Check(v))
- {
- PyErr_SetString(PyExc_TypeError, "Control required");
- return 0;
- }
- *p_itself = ((ControlObject *)v)->ob_itself;
- return 1;
- }
- static void CtlObj_dealloc(ControlObject *self)
- {
- Py_XDECREF(self->ob_callbackdict);
- if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */
- self->ob_type->tp_free((PyObject *)self);
- }
- static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- ControlPartCode hiliteState;
- #ifndef HiliteControl
- PyMac_PRECHECK(HiliteControl);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &hiliteState))
- return NULL;
- HiliteControl(_self->ob_itself,
- hiliteState);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_ShowControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef ShowControl
- PyMac_PRECHECK(ShowControl);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- ShowControl(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_HideControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef HideControl
- PyMac_PRECHECK(HideControl);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- HideControl(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_IsControlActive(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- #ifndef IsControlActive
- PyMac_PRECHECK(IsControlActive);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = IsControlActive(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_IsControlVisible(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- #ifndef IsControlVisible
- PyMac_PRECHECK(IsControlVisible);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = IsControlVisible(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_ActivateControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- #ifndef ActivateControl
- PyMac_PRECHECK(ActivateControl);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = ActivateControl(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_DeactivateControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- #ifndef DeactivateControl
- PyMac_PRECHECK(DeactivateControl);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = DeactivateControl(_self->ob_itself);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetControlVisibility(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- Boolean inIsVisible;
- Boolean inDoDraw;
- #ifndef SetControlVisibility
- PyMac_PRECHECK(SetControlVisibility);
- #endif
- if (!PyArg_ParseTuple(_args, "bb",
- &inIsVisible,
- &inDoDraw))
- return NULL;
- _err = SetControlVisibility(_self->ob_itself,
- inIsVisible,
- inDoDraw);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- 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;
- }
- 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;
- }
- 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;
- }
- static PyObject *CtlObj_Draw1Control(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef Draw1Control
- PyMac_PRECHECK(Draw1Control);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- Draw1Control(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetBestControlRect(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- Rect outRect;
- SInt16 outBaseLineOffset;
- #ifndef GetBestControlRect
- PyMac_PRECHECK(GetBestControlRect);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetBestControlRect(_self->ob_itself,
- &outRect,
- &outBaseLineOffset);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&h",
- PyMac_BuildRect, &outRect,
- outBaseLineOffset);
- return _res;
- }
- static PyObject *CtlObj_SetControlFontStyle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- ControlFontStyleRec inStyle;
- #ifndef SetControlFontStyle
- PyMac_PRECHECK(SetControlFontStyle);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ControlFontStyle_Convert, &inStyle))
- return NULL;
- _err = SetControlFontStyle(_self->ob_itself,
- &inStyle);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_DrawControlInCurrentPort(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- #ifndef DrawControlInCurrentPort
- PyMac_PRECHECK(DrawControlInCurrentPort);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- DrawControlInCurrentPort(_self->ob_itself);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetUpControlBackground(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- SInt16 inDepth;
- Boolean inIsColorDevice;
- #ifndef SetUpControlBackground
- PyMac_PRECHECK(SetUpControlBackground);
- #endif
- if (!PyArg_ParseTuple(_args, "hb",
- &inDepth,
- &inIsColorDevice))
- return NULL;
- _err = SetUpControlBackground(_self->ob_itself,
- inDepth,
- inIsColorDevice);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetUpControlTextColor(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- SInt16 inDepth;
- Boolean inIsColorDevice;
- #ifndef SetUpControlTextColor
- PyMac_PRECHECK(SetUpControlTextColor);
- #endif
- if (!PyArg_ParseTuple(_args, "hb",
- &inDepth,
- &inIsColorDevice))
- return NULL;
- _err = SetUpControlTextColor(_self->ob_itself,
- inDepth,
- inIsColorDevice);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_DragControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Point startPoint;
- Rect limitRect;
- Rect slopRect;
- DragConstraint axis;
- #ifndef DragControl
- PyMac_PRECHECK(DragControl);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&O&H",
- PyMac_GetPoint, &startPoint,
- PyMac_GetRect, &limitRect,
- PyMac_GetRect, &slopRect,
- &axis))
- return NULL;
- DragControl(_self->ob_itself,
- startPoint,
- &limitRect,
- &slopRect,
- axis);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_TestControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- ControlPartCode _rv;
- Point testPoint;
- #ifndef TestControl
- PyMac_PRECHECK(TestControl);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetPoint, &testPoint))
- return NULL;
- _rv = TestControl(_self->ob_itself,
- testPoint);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_HandleControlContextualMenuClick(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Point inWhere;
- Boolean menuDisplayed;
- #ifndef HandleControlContextualMenuClick
- PyMac_PRECHECK(HandleControlContextualMenuClick);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetPoint, &inWhere))
- return NULL;
- _err = HandleControlContextualMenuClick(_self->ob_itself,
- inWhere,
- &menuDisplayed);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("b",
- menuDisplayed);
- return _res;
- }
- static PyObject *CtlObj_GetControlClickActivation(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Point inWhere;
- EventModifiers inModifiers;
- ClickActivationResult outResult;
- #ifndef GetControlClickActivation
- PyMac_PRECHECK(GetControlClickActivation);
- #endif
- if (!PyArg_ParseTuple(_args, "O&H",
- PyMac_GetPoint, &inWhere,
- &inModifiers))
- return NULL;
- _err = GetControlClickActivation(_self->ob_itself,
- inWhere,
- inModifiers,
- &outResult);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outResult);
- return _res;
- }
- static PyObject *CtlObj_HandleControlKey(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- ControlPartCode _rv;
- SInt16 inKeyCode;
- SInt16 inCharCode;
- EventModifiers inModifiers;
- #ifndef HandleControlKey
- PyMac_PRECHECK(HandleControlKey);
- #endif
- if (!PyArg_ParseTuple(_args, "hhH",
- &inKeyCode,
- &inCharCode,
- &inModifiers))
- return NULL;
- _rv = HandleControlKey(_self->ob_itself,
- inKeyCode,
- inCharCode,
- inModifiers);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_HandleControlSetCursor(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Point localPoint;
- EventModifiers modifiers;
- Boolean cursorWasSet;
- #ifndef HandleControlSetCursor
- PyMac_PRECHECK(HandleControlSetCursor);
- #endif
- if (!PyArg_ParseTuple(_args, "O&H",
- PyMac_GetPoint, &localPoint,
- &modifiers))
- return NULL;
- _err = HandleControlSetCursor(_self->ob_itself,
- localPoint,
- modifiers,
- &cursorWasSet);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("b",
- cursorWasSet);
- return _res;
- }
- static PyObject *CtlObj_MoveControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt16 h;
- SInt16 v;
- #ifndef MoveControl
- PyMac_PRECHECK(MoveControl);
- #endif
- if (!PyArg_ParseTuple(_args, "hh",
- &h,
- &v))
- return NULL;
- MoveControl(_self->ob_itself,
- h,
- v);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SizeControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt16 w;
- SInt16 h;
- #ifndef SizeControl
- PyMac_PRECHECK(SizeControl);
- #endif
- if (!PyArg_ParseTuple(_args, "hh",
- &w,
- &h))
- return NULL;
- SizeControl(_self->ob_itself,
- w,
- h);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetControlTitle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Str255 title;
- #ifndef SetControlTitle
- PyMac_PRECHECK(SetControlTitle);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetStr255, title))
- return NULL;
- SetControlTitle(_self->ob_itself,
- title);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlTitle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Str255 title;
- #ifndef GetControlTitle
- PyMac_PRECHECK(GetControlTitle);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- GetControlTitle(_self->ob_itself,
- title);
- _res = Py_BuildValue("O&",
- PyMac_BuildStr255, title);
- return _res;
- }
- static PyObject *CtlObj_SetControlTitleWithCFString(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- CFStringRef inString;
- #ifndef SetControlTitleWithCFString
- PyMac_PRECHECK(SetControlTitleWithCFString);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- CFStringRefObj_Convert, &inString))
- return NULL;
- _err = SetControlTitleWithCFString(_self->ob_itself,
- inString);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_CopyControlTitleAsCFString(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- CFStringRef outString;
- #ifndef CopyControlTitleAsCFString
- PyMac_PRECHECK(CopyControlTitleAsCFString);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = CopyControlTitleAsCFString(_self->ob_itself,
- &outString);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- CFStringRefObj_New, outString);
- return _res;
- }
- static PyObject *CtlObj_GetControlValue(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt16 _rv;
- #ifndef GetControlValue
- PyMac_PRECHECK(GetControlValue);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlValue(_self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControlValue(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt16 newValue;
- #ifndef SetControlValue
- PyMac_PRECHECK(SetControlValue);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &newValue))
- return NULL;
- SetControlValue(_self->ob_itself,
- newValue);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlMinimum(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt16 _rv;
- #ifndef GetControlMinimum
- PyMac_PRECHECK(GetControlMinimum);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlMinimum(_self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControlMinimum(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt16 newMinimum;
- #ifndef SetControlMinimum
- PyMac_PRECHECK(SetControlMinimum);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &newMinimum))
- return NULL;
- SetControlMinimum(_self->ob_itself,
- newMinimum);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlMaximum(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt16 _rv;
- #ifndef GetControlMaximum
- PyMac_PRECHECK(GetControlMaximum);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlMaximum(_self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControlMaximum(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt16 newMaximum;
- #ifndef SetControlMaximum
- PyMac_PRECHECK(SetControlMaximum);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &newMaximum))
- return NULL;
- SetControlMaximum(_self->ob_itself,
- newMaximum);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlViewSize(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 _rv;
- #ifndef GetControlViewSize
- PyMac_PRECHECK(GetControlViewSize);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlViewSize(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControlViewSize(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 newViewSize;
- #ifndef SetControlViewSize
- PyMac_PRECHECK(SetControlViewSize);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &newViewSize))
- return NULL;
- SetControlViewSize(_self->ob_itself,
- newViewSize);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControl32BitValue(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 _rv;
- #ifndef GetControl32BitValue
- PyMac_PRECHECK(GetControl32BitValue);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControl32BitValue(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControl32BitValue(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 newValue;
- #ifndef SetControl32BitValue
- PyMac_PRECHECK(SetControl32BitValue);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &newValue))
- return NULL;
- SetControl32BitValue(_self->ob_itself,
- newValue);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControl32BitMaximum(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 _rv;
- #ifndef GetControl32BitMaximum
- PyMac_PRECHECK(GetControl32BitMaximum);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControl32BitMaximum(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControl32BitMaximum(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 newMaximum;
- #ifndef SetControl32BitMaximum
- PyMac_PRECHECK(SetControl32BitMaximum);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &newMaximum))
- return NULL;
- SetControl32BitMaximum(_self->ob_itself,
- newMaximum);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControl32BitMinimum(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 _rv;
- #ifndef GetControl32BitMinimum
- PyMac_PRECHECK(GetControl32BitMinimum);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControl32BitMinimum(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControl32BitMinimum(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 newMinimum;
- #ifndef SetControl32BitMinimum
- PyMac_PRECHECK(SetControl32BitMinimum);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &newMinimum))
- return NULL;
- SetControl32BitMinimum(_self->ob_itself,
- newMinimum);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_IsValidControlHandle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- #ifndef IsValidControlHandle
- PyMac_PRECHECK(IsValidControlHandle);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = IsValidControlHandle(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControlID(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- ControlID inID;
- #ifndef SetControlID
- PyMac_PRECHECK(SetControlID);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyControlID_Convert, &inID))
- return NULL;
- _err = SetControlID(_self->ob_itself,
- &inID);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlID(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- ControlID outID;
- #ifndef GetControlID
- PyMac_PRECHECK(GetControlID);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetControlID(_self->ob_itself,
- &outID);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- PyControlID_New, &outID);
- return _res;
- }
- static PyObject *CtlObj_SetControlCommandID(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- UInt32 inCommandID;
- #ifndef SetControlCommandID
- PyMac_PRECHECK(SetControlCommandID);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &inCommandID))
- return NULL;
- _err = SetControlCommandID(_self->ob_itself,
- inCommandID);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlCommandID(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- UInt32 outCommandID;
- #ifndef GetControlCommandID
- PyMac_PRECHECK(GetControlCommandID);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetControlCommandID(_self->ob_itself,
- &outCommandID);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outCommandID);
- return _res;
- }
- static PyObject *CtlObj_RemoveControlProperty(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- OSType propertyCreator;
- OSType propertyTag;
- #ifndef RemoveControlProperty
- PyMac_PRECHECK(RemoveControlProperty);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetOSType, &propertyCreator,
- PyMac_GetOSType, &propertyTag))
- return NULL;
- _err = RemoveControlProperty(_self->ob_itself,
- propertyCreator,
- propertyTag);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlPropertyAttributes(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- OSType propertyCreator;
- OSType propertyTag;
- UInt32 attributes;
- #ifndef GetControlPropertyAttributes
- PyMac_PRECHECK(GetControlPropertyAttributes);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&",
- PyMac_GetOSType, &propertyCreator,
- PyMac_GetOSType, &propertyTag))
- return NULL;
- _err = GetControlPropertyAttributes(_self->ob_itself,
- propertyCreator,
- propertyTag,
- &attributes);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- attributes);
- return _res;
- }
- static PyObject *CtlObj_ChangeControlPropertyAttributes(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- OSType propertyCreator;
- OSType propertyTag;
- UInt32 attributesToSet;
- UInt32 attributesToClear;
- #ifndef ChangeControlPropertyAttributes
- PyMac_PRECHECK(ChangeControlPropertyAttributes);
- #endif
- if (!PyArg_ParseTuple(_args, "O&O&ll",
- PyMac_GetOSType, &propertyCreator,
- PyMac_GetOSType, &propertyTag,
- &attributesToSet,
- &attributesToClear))
- return NULL;
- _err = ChangeControlPropertyAttributes(_self->ob_itself,
- propertyCreator,
- propertyTag,
- attributesToSet,
- attributesToClear);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlRegion(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- ControlPartCode inPart;
- RgnHandle outRegion;
- #ifndef GetControlRegion
- PyMac_PRECHECK(GetControlRegion);
- #endif
- if (!PyArg_ParseTuple(_args, "hO&",
- &inPart,
- ResObj_Convert, &outRegion))
- return NULL;
- _err = GetControlRegion(_self->ob_itself,
- inPart,
- outRegion);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlVariant(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- ControlVariant _rv;
- #ifndef GetControlVariant
- PyMac_PRECHECK(GetControlVariant);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlVariant(_self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControlAction(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- PyObject* actionProc;
- UniversalProcPtr c_callback;
- #ifndef SetControlAction
- PyMac_PRECHECK(SetControlAction);
- #endif
- if (!PyArg_ParseTuple(_args, "O",
- &actionProc))
- return NULL;
- SetControlAction(_self->ob_itself,
- myactionproc_upp);
- Py_INCREF(Py_None);
- _res = Py_None;
- setcallback((PyObject*)_self, kMyControlActionProcTag, actionProc, &c_callback);
- return _res;
- }
- static PyObject *CtlObj_SetControlReference(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 data;
- #ifndef SetControlReference
- PyMac_PRECHECK(SetControlReference);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &data))
- return NULL;
- SetControlReference(_self->ob_itself,
- data);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlReference(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- SInt32 _rv;
- #ifndef GetControlReference
- PyMac_PRECHECK(GetControlReference);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlReference(_self->ob_itself);
- _res = Py_BuildValue("l",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_EmbedControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- ControlHandle inContainer;
- #ifndef EmbedControl
- PyMac_PRECHECK(EmbedControl);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- CtlObj_Convert, &inContainer))
- return NULL;
- _err = EmbedControl(_self->ob_itself,
- inContainer);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_AutoEmbedControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- WindowPtr inWindow;
- #ifndef AutoEmbedControl
- PyMac_PRECHECK(AutoEmbedControl);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- WinObj_Convert, &inWindow))
- return NULL;
- _err = AutoEmbedControl(_self->ob_itself,
- inWindow);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetSuperControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- ControlHandle outParent;
- #ifndef GetSuperControl
- PyMac_PRECHECK(GetSuperControl);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetSuperControl(_self->ob_itself,
- &outParent);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- CtlObj_WhichControl, outParent);
- return _res;
- }
- static PyObject *CtlObj_CountSubControls(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- UInt16 outNumChildren;
- #ifndef CountSubControls
- PyMac_PRECHECK(CountSubControls);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = CountSubControls(_self->ob_itself,
- &outNumChildren);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("H",
- outNumChildren);
- return _res;
- }
- static PyObject *CtlObj_GetIndexedSubControl(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- UInt16 inIndex;
- ControlHandle outSubControl;
- #ifndef GetIndexedSubControl
- PyMac_PRECHECK(GetIndexedSubControl);
- #endif
- if (!PyArg_ParseTuple(_args, "H",
- &inIndex))
- return NULL;
- _err = GetIndexedSubControl(_self->ob_itself,
- inIndex,
- &outSubControl);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- CtlObj_WhichControl, outSubControl);
- return _res;
- }
- static PyObject *CtlObj_SetControlSupervisor(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- ControlHandle inBoss;
- #ifndef SetControlSupervisor
- PyMac_PRECHECK(SetControlSupervisor);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- CtlObj_Convert, &inBoss))
- return NULL;
- _err = SetControlSupervisor(_self->ob_itself,
- inBoss);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetControlFeatures(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- UInt32 outFeatures;
- #ifndef GetControlFeatures
- PyMac_PRECHECK(GetControlFeatures);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetControlFeatures(_self->ob_itself,
- &outFeatures);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outFeatures);
- return _res;
- }
- static PyObject *CtlObj_GetControlDataSize(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- ControlPartCode inPart;
- ResType inTagName;
- Size outMaxSize;
- #ifndef GetControlDataSize
- PyMac_PRECHECK(GetControlDataSize);
- #endif
- if (!PyArg_ParseTuple(_args, "hO&",
- &inPart,
- PyMac_GetOSType, &inTagName))
- return NULL;
- _err = GetControlDataSize(_self->ob_itself,
- inPart,
- inTagName,
- &outMaxSize);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("l",
- outMaxSize);
- return _res;
- }
- static PyObject *CtlObj_HandleControlDragTracking(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- DragTrackingMessage inMessage;
- DragReference inDrag;
- Boolean outLikesDrag;
- #ifndef HandleControlDragTracking
- PyMac_PRECHECK(HandleControlDragTracking);
- #endif
- if (!PyArg_ParseTuple(_args, "hO&",
- &inMessage,
- DragObj_Convert, &inDrag))
- return NULL;
- _err = HandleControlDragTracking(_self->ob_itself,
- inMessage,
- inDrag,
- &outLikesDrag);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("b",
- outLikesDrag);
- return _res;
- }
- static PyObject *CtlObj_HandleControlDragReceive(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- DragReference inDrag;
- #ifndef HandleControlDragReceive
- PyMac_PRECHECK(HandleControlDragReceive);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- DragObj_Convert, &inDrag))
- return NULL;
- _err = HandleControlDragReceive(_self->ob_itself,
- inDrag);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetControlDragTrackingEnabled(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Boolean inTracks;
- #ifndef SetControlDragTrackingEnabled
- PyMac_PRECHECK(SetControlDragTrackingEnabled);
- #endif
- if (!PyArg_ParseTuple(_args, "b",
- &inTracks))
- return NULL;
- _err = SetControlDragTrackingEnabled(_self->ob_itself,
- inTracks);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_IsControlDragTrackingEnabled(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- Boolean outTracks;
- #ifndef IsControlDragTrackingEnabled
- PyMac_PRECHECK(IsControlDragTrackingEnabled);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = IsControlDragTrackingEnabled(_self->ob_itself,
- &outTracks);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("b",
- outTracks);
- return _res;
- }
- static PyObject *CtlObj_GetControlBounds(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Rect bounds;
- #ifndef GetControlBounds
- PyMac_PRECHECK(GetControlBounds);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- GetControlBounds(_self->ob_itself,
- &bounds);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &bounds);
- return _res;
- }
- static PyObject *CtlObj_IsControlHilited(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- #ifndef IsControlHilited
- PyMac_PRECHECK(IsControlHilited);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = IsControlHilited(_self->ob_itself);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_GetControlHilite(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- UInt16 _rv;
- #ifndef GetControlHilite
- PyMac_PRECHECK(GetControlHilite);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlHilite(_self->ob_itself);
- _res = Py_BuildValue("H",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_GetControlOwner(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- WindowPtr _rv;
- #ifndef GetControlOwner
- PyMac_PRECHECK(GetControlOwner);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlOwner(_self->ob_itself);
- _res = Py_BuildValue("O&",
- WinObj_New, _rv);
- return _res;
- }
- static PyObject *CtlObj_GetControlDataHandle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Handle _rv;
- #ifndef GetControlDataHandle
- PyMac_PRECHECK(GetControlDataHandle);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlDataHandle(_self->ob_itself);
- _res = Py_BuildValue("O&",
- ResObj_New, _rv);
- return _res;
- }
- static PyObject *CtlObj_GetControlPopupMenuHandle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- MenuHandle _rv;
- #ifndef GetControlPopupMenuHandle
- PyMac_PRECHECK(GetControlPopupMenuHandle);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlPopupMenuHandle(_self->ob_itself);
- _res = Py_BuildValue("O&",
- MenuObj_New, _rv);
- return _res;
- }
- static PyObject *CtlObj_GetControlPopupMenuID(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- short _rv;
- #ifndef GetControlPopupMenuID
- PyMac_PRECHECK(GetControlPopupMenuID);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _rv = GetControlPopupMenuID(_self->ob_itself);
- _res = Py_BuildValue("h",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_SetControlDataHandle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Handle dataHandle;
- #ifndef SetControlDataHandle
- PyMac_PRECHECK(SetControlDataHandle);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ResObj_Convert, &dataHandle))
- return NULL;
- SetControlDataHandle(_self->ob_itself,
- dataHandle);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetControlBounds(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Rect bounds;
- #ifndef SetControlBounds
- PyMac_PRECHECK(SetControlBounds);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetRect, &bounds))
- return NULL;
- SetControlBounds(_self->ob_itself,
- &bounds);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetControlPopupMenuHandle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- MenuHandle popupMenu;
- #ifndef SetControlPopupMenuHandle
- PyMac_PRECHECK(SetControlPopupMenuHandle);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- MenuObj_Convert, &popupMenu))
- return NULL;
- SetControlPopupMenuHandle(_self->ob_itself,
- popupMenu);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetControlPopupMenuID(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- short menuID;
- #ifndef SetControlPopupMenuID
- PyMac_PRECHECK(SetControlPopupMenuID);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &menuID))
- return NULL;
- SetControlPopupMenuID(_self->ob_itself,
- menuID);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetBevelButtonMenuValue(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- SInt16 outValue;
- #ifndef GetBevelButtonMenuValue
- PyMac_PRECHECK(GetBevelButtonMenuValue);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetBevelButtonMenuValue(_self->ob_itself,
- &outValue);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("h",
- outValue);
- return _res;
- }
- static PyObject *CtlObj_SetBevelButtonMenuValue(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- SInt16 inValue;
- #ifndef SetBevelButtonMenuValue
- PyMac_PRECHECK(SetBevelButtonMenuValue);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &inValue))
- return NULL;
- _err = SetBevelButtonMenuValue(_self->ob_itself,
- inValue);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetBevelButtonMenuHandle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- MenuHandle outHandle;
- #ifndef GetBevelButtonMenuHandle
- PyMac_PRECHECK(GetBevelButtonMenuHandle);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetBevelButtonMenuHandle(_self->ob_itself,
- &outHandle);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- MenuObj_New, outHandle);
- return _res;
- }
- static PyObject *CtlObj_SetBevelButtonContentInfo(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- ControlButtonContentInfo inContent;
- #ifndef SetBevelButtonContentInfo
- PyMac_PRECHECK(SetBevelButtonContentInfo);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ControlButtonContentInfo_Convert, &inContent))
- return NULL;
- _err = SetBevelButtonContentInfo(_self->ob_itself,
- &inContent);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetBevelButtonTransform(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- IconTransformType transform;
- #ifndef SetBevelButtonTransform
- PyMac_PRECHECK(SetBevelButtonTransform);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &transform))
- return NULL;
- _err = SetBevelButtonTransform(_self->ob_itself,
- transform);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetDisclosureTriangleLastValue(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- SInt16 inValue;
- #ifndef SetDisclosureTriangleLastValue
- PyMac_PRECHECK(SetDisclosureTriangleLastValue);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &inValue))
- return NULL;
- _err = SetDisclosureTriangleLastValue(_self->ob_itself,
- inValue);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetTabContentRect(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- Rect outContentRect;
- #ifndef GetTabContentRect
- PyMac_PRECHECK(GetTabContentRect);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetTabContentRect(_self->ob_itself,
- &outContentRect);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- PyMac_BuildRect, &outContentRect);
- return _res;
- }
- static PyObject *CtlObj_SetTabEnabled(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- SInt16 inTabToHilite;
- Boolean inEnabled;
- #ifndef SetTabEnabled
- PyMac_PRECHECK(SetTabEnabled);
- #endif
- if (!PyArg_ParseTuple(_args, "hb",
- &inTabToHilite,
- &inEnabled))
- return NULL;
- _err = SetTabEnabled(_self->ob_itself,
- inTabToHilite,
- inEnabled);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetImageWellContentInfo(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- ControlButtonContentInfo inContent;
- #ifndef SetImageWellContentInfo
- PyMac_PRECHECK(SetImageWellContentInfo);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- ControlButtonContentInfo_Convert, &inContent))
- return NULL;
- _err = SetImageWellContentInfo(_self->ob_itself,
- &inContent);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_SetImageWellTransform(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSErr _err;
- IconTransformType inTransform;
- #ifndef SetImageWellTransform
- PyMac_PRECHECK(SetImageWellTransform);
- #endif
- if (!PyArg_ParseTuple(_args, "h",
- &inTransform))
- return NULL;
- _err = SetImageWellTransform(_self->ob_itself,
- inTransform);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetDataBrowserViewStyle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- OSType style;
- #ifndef GetDataBrowserViewStyle
- PyMac_PRECHECK(GetDataBrowserViewStyle);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- _err = GetDataBrowserViewStyle(_self->ob_itself,
- &style);
- if (_err != noErr) return PyMac_Error(_err);
- _res = Py_BuildValue("O&",
- PyMac_BuildOSType, style);
- return _res;
- }
- static PyObject *CtlObj_SetDataBrowserViewStyle(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- OSType style;
- #ifndef SetDataBrowserViewStyle
- PyMac_PRECHECK(SetDataBrowserViewStyle);
- #endif
- if (!PyArg_ParseTuple(_args, "O&",
- PyMac_GetOSType, &style))
- return NULL;
- _err = SetDataBrowserViewStyle(_self->ob_itself,
- style);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_EnableDataBrowserEditCommand(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- Boolean _rv;
- UInt32 command;
- #ifndef EnableDataBrowserEditCommand
- PyMac_PRECHECK(EnableDataBrowserEditCommand);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &command))
- return NULL;
- _rv = EnableDataBrowserEditCommand(_self->ob_itself,
- command);
- _res = Py_BuildValue("b",
- _rv);
- return _res;
- }
- static PyObject *CtlObj_ExecuteDataBrowserEditCommand(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- UInt32 command;
- #ifndef ExecuteDataBrowserEditCommand
- PyMac_PRECHECK(ExecuteDataBrowserEditCommand);
- #endif
- if (!PyArg_ParseTuple(_args, "l",
- &command))
- return NULL;
- _err = ExecuteDataBrowserEditCommand(_self->ob_itself,
- command);
- if (_err != noErr) return PyMac_Error(_err);
- Py_INCREF(Py_None);
- _res = Py_None;
- return _res;
- }
- static PyObject *CtlObj_GetDataBrowserSelectionAnchor(ControlObject *_self, PyObject *_args)
- {
- PyObject *_res = NULL;
- OSStatus _err;
- UInt32 first;
- UInt32 last;
- #ifndef GetDataBrowserSelectionAnchor
- PyMac_PRECHECK(GetDataBrowserSelectionAnchor);
- #endif
- if (!PyArg_ParseTuple(_args, ""))
- r…