| 1 | n/a | |
|---|
| 2 | n/a | /* ========================== Module _Ctl =========================== */ |
|---|
| 3 | n/a | |
|---|
| 4 | n/a | #include "Python.h" |
|---|
| 5 | n/a | |
|---|
| 6 | n/a | #ifndef __LP64__ |
|---|
| 7 | n/a | |
|---|
| 8 | n/a | |
|---|
| 9 | n/a | #include "pymactoolbox.h" |
|---|
| 10 | n/a | |
|---|
| 11 | n/a | /* Macro to test whether a weak-loaded CFM function exists */ |
|---|
| 12 | n/a | #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ |
|---|
| 13 | n/a | PyErr_SetString(PyExc_NotImplementedError, \ |
|---|
| 14 | n/a | "Not available in this shared library/OS version"); \ |
|---|
| 15 | n/a | return NULL; \ |
|---|
| 16 | n/a | }} while(0) |
|---|
| 17 | n/a | |
|---|
| 18 | n/a | |
|---|
| 19 | n/a | #include <Carbon/Carbon.h> |
|---|
| 20 | n/a | |
|---|
| 21 | n/a | #ifdef USE_TOOLBOX_OBJECT_GLUE |
|---|
| 22 | n/a | extern PyObject *_CtlObj_New(ControlHandle); |
|---|
| 23 | n/a | extern int _CtlObj_Convert(PyObject *, ControlHandle *); |
|---|
| 24 | n/a | |
|---|
| 25 | n/a | #define CtlObj_New _CtlObj_New |
|---|
| 26 | n/a | #define CtlObj_Convert _CtlObj_Convert |
|---|
| 27 | n/a | #endif |
|---|
| 28 | n/a | |
|---|
| 29 | n/a | static PyObject *CtlObj_WhichControl(ControlHandle); |
|---|
| 30 | n/a | |
|---|
| 31 | n/a | #define as_Control(h) ((ControlHandle)h) |
|---|
| 32 | n/a | #define as_Resource(ctl) ((Handle)ctl) |
|---|
| 33 | n/a | #define GetControlRect(ctl, rectp) GetControlBounds(ctl, rectp) |
|---|
| 34 | n/a | |
|---|
| 35 | n/a | #define MAXTABS 32 /* maximum number of tabs that we support in a tabs control */ |
|---|
| 36 | n/a | /* |
|---|
| 37 | n/a | ** Parse/generate ControlFontStyleRec records |
|---|
| 38 | n/a | */ |
|---|
| 39 | n/a | #if 0 /* Not needed */ |
|---|
| 40 | n/a | static PyObject * |
|---|
| 41 | n/a | ControlFontStyle_New(ControlFontStyleRec *itself) |
|---|
| 42 | n/a | { |
|---|
| 43 | n/a | |
|---|
| 44 | n/a | return Py_BuildValue("hhhhhhO&O&", itself->flags, itself->font, |
|---|
| 45 | n/a | itself->size, itself->style, itself->mode, itself->just, |
|---|
| 46 | n/a | QdRGB_New, &itself->foreColor, QdRGB_New, &itself->backColor); |
|---|
| 47 | n/a | } |
|---|
| 48 | n/a | #endif |
|---|
| 49 | n/a | |
|---|
| 50 | n/a | static int |
|---|
| 51 | n/a | ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself) |
|---|
| 52 | n/a | { |
|---|
| 53 | n/a | return PyArg_Parse(v, "(hhhhhhO&O&)", &itself->flags, |
|---|
| 54 | n/a | &itself->font, &itself->size, &itself->style, &itself->mode, |
|---|
| 55 | n/a | &itself->just, QdRGB_Convert, &itself->foreColor, |
|---|
| 56 | n/a | QdRGB_Convert, &itself->backColor); |
|---|
| 57 | n/a | } |
|---|
| 58 | n/a | |
|---|
| 59 | n/a | /* |
|---|
| 60 | n/a | ** Parse/generate ControlID records |
|---|
| 61 | n/a | */ |
|---|
| 62 | n/a | static PyObject * |
|---|
| 63 | n/a | PyControlID_New(ControlID *itself) |
|---|
| 64 | n/a | { |
|---|
| 65 | n/a | |
|---|
| 66 | n/a | return Py_BuildValue("O&l", PyMac_BuildOSType, itself->signature, itself->id); |
|---|
| 67 | n/a | } |
|---|
| 68 | n/a | |
|---|
| 69 | n/a | static int |
|---|
| 70 | n/a | PyControlID_Convert(PyObject *v, ControlID *itself) |
|---|
| 71 | n/a | { |
|---|
| 72 | n/a | return PyArg_Parse(v, "(O&l)", PyMac_GetOSType, &itself->signature, &itself->id); |
|---|
| 73 | n/a | } |
|---|
| 74 | n/a | |
|---|
| 75 | n/a | /* |
|---|
| 76 | n/a | ** generate DataBrowserListViewColumnDesc records |
|---|
| 77 | n/a | */ |
|---|
| 78 | n/a | static int |
|---|
| 79 | n/a | DataBrowserTableViewColumnDesc_Convert(PyObject *v, DataBrowserTableViewColumnDesc *itself) |
|---|
| 80 | n/a | { |
|---|
| 81 | n/a | return PyArg_Parse(v, "(lO&l)", |
|---|
| 82 | n/a | &itself->propertyID, |
|---|
| 83 | n/a | PyMac_GetOSType, &itself->propertyType, |
|---|
| 84 | n/a | &itself->propertyFlags); |
|---|
| 85 | n/a | } |
|---|
| 86 | n/a | |
|---|
| 87 | n/a | static int |
|---|
| 88 | n/a | ControlButtonContentInfo_Convert(PyObject *v, ControlButtonContentInfo *itself) |
|---|
| 89 | n/a | { |
|---|
| 90 | n/a | return PyArg_Parse(v, "(hO&)", |
|---|
| 91 | n/a | &itself->contentType, |
|---|
| 92 | n/a | OptResObj_Convert, &itself->u.iconSuite); |
|---|
| 93 | n/a | } |
|---|
| 94 | n/a | |
|---|
| 95 | n/a | static int |
|---|
| 96 | n/a | DataBrowserListViewHeaderDesc_Convert(PyObject *v, DataBrowserListViewHeaderDesc *itself) |
|---|
| 97 | n/a | { |
|---|
| 98 | n/a | itself->version = kDataBrowserListViewLatestHeaderDesc; |
|---|
| 99 | n/a | return PyArg_Parse(v, "(HHhO&HO&O&)", |
|---|
| 100 | n/a | &itself->minimumWidth, |
|---|
| 101 | n/a | &itself->maximumWidth, |
|---|
| 102 | n/a | &itself->titleOffset, |
|---|
| 103 | n/a | CFStringRefObj_Convert, &itself->titleString, |
|---|
| 104 | n/a | &itself->initialOrder, |
|---|
| 105 | n/a | ControlFontStyle_Convert, &itself->btnFontStyle, |
|---|
| 106 | n/a | ControlButtonContentInfo_Convert, &itself->btnContentInfo); |
|---|
| 107 | n/a | } |
|---|
| 108 | n/a | |
|---|
| 109 | n/a | static int |
|---|
| 110 | n/a | DataBrowserListViewColumnDesc_Convert(PyObject *v, DataBrowserListViewColumnDesc *itself) |
|---|
| 111 | n/a | { |
|---|
| 112 | n/a | return PyArg_Parse(v, "(O&O&)", |
|---|
| 113 | n/a | DataBrowserTableViewColumnDesc_Convert, &itself->propertyDesc, |
|---|
| 114 | n/a | DataBrowserListViewHeaderDesc_Convert, &itself->headerBtnDesc); |
|---|
| 115 | n/a | } |
|---|
| 116 | n/a | |
|---|
| 117 | n/a | /* TrackControl and HandleControlClick callback support */ |
|---|
| 118 | n/a | #define kMyControlActionProcTag 'ACTN' /* not an official tag, only for internal use */ |
|---|
| 119 | n/a | static PyObject *tracker; |
|---|
| 120 | n/a | static ControlActionUPP mytracker_upp; |
|---|
| 121 | n/a | static ControlActionUPP myactionproc_upp; |
|---|
| 122 | n/a | static ControlUserPaneKeyDownUPP mykeydownproc_upp; |
|---|
| 123 | n/a | static ControlUserPaneFocusUPP myfocusproc_upp; |
|---|
| 124 | n/a | static ControlUserPaneDrawUPP mydrawproc_upp; |
|---|
| 125 | n/a | static ControlUserPaneIdleUPP myidleproc_upp; |
|---|
| 126 | n/a | static ControlUserPaneHitTestUPP myhittestproc_upp; |
|---|
| 127 | n/a | static ControlUserPaneTrackingUPP mytrackingproc_upp; |
|---|
| 128 | n/a | |
|---|
| 129 | n/a | static int settrackfunc(PyObject *); /* forward */ |
|---|
| 130 | n/a | static void clrtrackfunc(void); /* forward */ |
|---|
| 131 | n/a | static int setcallback(PyObject *, OSType, PyObject *, UniversalProcPtr *); |
|---|
| 132 | n/a | |
|---|
| 133 | n/a | static PyObject *Ctl_Error; |
|---|
| 134 | n/a | |
|---|
| 135 | n/a | /* ---------------------- Object type Control ----------------------- */ |
|---|
| 136 | n/a | |
|---|
| 137 | n/a | PyTypeObject Control_Type; |
|---|
| 138 | n/a | |
|---|
| 139 | n/a | #define CtlObj_Check(x) ((x)->ob_type == &Control_Type || PyObject_TypeCheck((x), &Control_Type)) |
|---|
| 140 | n/a | |
|---|
| 141 | n/a | typedef struct ControlObject { |
|---|
| 142 | n/a | PyObject_HEAD |
|---|
| 143 | n/a | ControlHandle ob_itself; |
|---|
| 144 | n/a | PyObject *ob_callbackdict; |
|---|
| 145 | n/a | } ControlObject; |
|---|
| 146 | n/a | |
|---|
| 147 | n/a | PyObject *CtlObj_New(ControlHandle itself) |
|---|
| 148 | n/a | { |
|---|
| 149 | n/a | ControlObject *it; |
|---|
| 150 | n/a | if (itself == NULL) return PyMac_Error(resNotFound); |
|---|
| 151 | n/a | it = PyObject_NEW(ControlObject, &Control_Type); |
|---|
| 152 | n/a | if (it == NULL) return NULL; |
|---|
| 153 | n/a | it->ob_itself = itself; |
|---|
| 154 | n/a | SetControlReference(itself, (long)it); |
|---|
| 155 | n/a | it->ob_callbackdict = NULL; |
|---|
| 156 | n/a | return (PyObject *)it; |
|---|
| 157 | n/a | } |
|---|
| 158 | n/a | |
|---|
| 159 | n/a | int CtlObj_Convert(PyObject *v, ControlHandle *p_itself) |
|---|
| 160 | n/a | { |
|---|
| 161 | n/a | if (!CtlObj_Check(v)) |
|---|
| 162 | n/a | { |
|---|
| 163 | n/a | PyErr_SetString(PyExc_TypeError, "Control required"); |
|---|
| 164 | n/a | return 0; |
|---|
| 165 | n/a | } |
|---|
| 166 | n/a | *p_itself = ((ControlObject *)v)->ob_itself; |
|---|
| 167 | n/a | return 1; |
|---|
| 168 | n/a | } |
|---|
| 169 | n/a | |
|---|
| 170 | n/a | static void CtlObj_dealloc(ControlObject *self) |
|---|
| 171 | n/a | { |
|---|
| 172 | n/a | Py_XDECREF(self->ob_callbackdict); |
|---|
| 173 | n/a | if (self->ob_itself)SetControlReference(self->ob_itself, (long)0); /* Make it forget about us */ |
|---|
| 174 | n/a | self->ob_type->tp_free((PyObject *)self); |
|---|
| 175 | n/a | } |
|---|
| 176 | n/a | |
|---|
| 177 | n/a | static PyObject *CtlObj_HiliteControl(ControlObject *_self, PyObject *_args) |
|---|
| 178 | n/a | { |
|---|
| 179 | n/a | PyObject *_res = NULL; |
|---|
| 180 | n/a | ControlPartCode hiliteState; |
|---|
| 181 | n/a | #ifndef HiliteControl |
|---|
| 182 | n/a | PyMac_PRECHECK(HiliteControl); |
|---|
| 183 | n/a | #endif |
|---|
| 184 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 185 | n/a | &hiliteState)) |
|---|
| 186 | n/a | return NULL; |
|---|
| 187 | n/a | HiliteControl(_self->ob_itself, |
|---|
| 188 | n/a | hiliteState); |
|---|
| 189 | n/a | Py_INCREF(Py_None); |
|---|
| 190 | n/a | _res = Py_None; |
|---|
| 191 | n/a | return _res; |
|---|
| 192 | n/a | } |
|---|
| 193 | n/a | |
|---|
| 194 | n/a | static PyObject *CtlObj_ShowControl(ControlObject *_self, PyObject *_args) |
|---|
| 195 | n/a | { |
|---|
| 196 | n/a | PyObject *_res = NULL; |
|---|
| 197 | n/a | #ifndef ShowControl |
|---|
| 198 | n/a | PyMac_PRECHECK(ShowControl); |
|---|
| 199 | n/a | #endif |
|---|
| 200 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 201 | n/a | return NULL; |
|---|
| 202 | n/a | ShowControl(_self->ob_itself); |
|---|
| 203 | n/a | Py_INCREF(Py_None); |
|---|
| 204 | n/a | _res = Py_None; |
|---|
| 205 | n/a | return _res; |
|---|
| 206 | n/a | } |
|---|
| 207 | n/a | |
|---|
| 208 | n/a | static PyObject *CtlObj_HideControl(ControlObject *_self, PyObject *_args) |
|---|
| 209 | n/a | { |
|---|
| 210 | n/a | PyObject *_res = NULL; |
|---|
| 211 | n/a | #ifndef HideControl |
|---|
| 212 | n/a | PyMac_PRECHECK(HideControl); |
|---|
| 213 | n/a | #endif |
|---|
| 214 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 215 | n/a | return NULL; |
|---|
| 216 | n/a | HideControl(_self->ob_itself); |
|---|
| 217 | n/a | Py_INCREF(Py_None); |
|---|
| 218 | n/a | _res = Py_None; |
|---|
| 219 | n/a | return _res; |
|---|
| 220 | n/a | } |
|---|
| 221 | n/a | |
|---|
| 222 | n/a | static PyObject *CtlObj_IsControlActive(ControlObject *_self, PyObject *_args) |
|---|
| 223 | n/a | { |
|---|
| 224 | n/a | PyObject *_res = NULL; |
|---|
| 225 | n/a | Boolean _rv; |
|---|
| 226 | n/a | #ifndef IsControlActive |
|---|
| 227 | n/a | PyMac_PRECHECK(IsControlActive); |
|---|
| 228 | n/a | #endif |
|---|
| 229 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 230 | n/a | return NULL; |
|---|
| 231 | n/a | _rv = IsControlActive(_self->ob_itself); |
|---|
| 232 | n/a | _res = Py_BuildValue("b", |
|---|
| 233 | n/a | _rv); |
|---|
| 234 | n/a | return _res; |
|---|
| 235 | n/a | } |
|---|
| 236 | n/a | |
|---|
| 237 | n/a | static PyObject *CtlObj_IsControlVisible(ControlObject *_self, PyObject *_args) |
|---|
| 238 | n/a | { |
|---|
| 239 | n/a | PyObject *_res = NULL; |
|---|
| 240 | n/a | Boolean _rv; |
|---|
| 241 | n/a | #ifndef IsControlVisible |
|---|
| 242 | n/a | PyMac_PRECHECK(IsControlVisible); |
|---|
| 243 | n/a | #endif |
|---|
| 244 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 245 | n/a | return NULL; |
|---|
| 246 | n/a | _rv = IsControlVisible(_self->ob_itself); |
|---|
| 247 | n/a | _res = Py_BuildValue("b", |
|---|
| 248 | n/a | _rv); |
|---|
| 249 | n/a | return _res; |
|---|
| 250 | n/a | } |
|---|
| 251 | n/a | |
|---|
| 252 | n/a | static PyObject *CtlObj_ActivateControl(ControlObject *_self, PyObject *_args) |
|---|
| 253 | n/a | { |
|---|
| 254 | n/a | PyObject *_res = NULL; |
|---|
| 255 | n/a | OSErr _err; |
|---|
| 256 | n/a | #ifndef ActivateControl |
|---|
| 257 | n/a | PyMac_PRECHECK(ActivateControl); |
|---|
| 258 | n/a | #endif |
|---|
| 259 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 260 | n/a | return NULL; |
|---|
| 261 | n/a | _err = ActivateControl(_self->ob_itself); |
|---|
| 262 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 263 | n/a | Py_INCREF(Py_None); |
|---|
| 264 | n/a | _res = Py_None; |
|---|
| 265 | n/a | return _res; |
|---|
| 266 | n/a | } |
|---|
| 267 | n/a | |
|---|
| 268 | n/a | static PyObject *CtlObj_DeactivateControl(ControlObject *_self, PyObject *_args) |
|---|
| 269 | n/a | { |
|---|
| 270 | n/a | PyObject *_res = NULL; |
|---|
| 271 | n/a | OSErr _err; |
|---|
| 272 | n/a | #ifndef DeactivateControl |
|---|
| 273 | n/a | PyMac_PRECHECK(DeactivateControl); |
|---|
| 274 | n/a | #endif |
|---|
| 275 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 276 | n/a | return NULL; |
|---|
| 277 | n/a | _err = DeactivateControl(_self->ob_itself); |
|---|
| 278 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 279 | n/a | Py_INCREF(Py_None); |
|---|
| 280 | n/a | _res = Py_None; |
|---|
| 281 | n/a | return _res; |
|---|
| 282 | n/a | } |
|---|
| 283 | n/a | |
|---|
| 284 | n/a | static PyObject *CtlObj_SetControlVisibility(ControlObject *_self, PyObject *_args) |
|---|
| 285 | n/a | { |
|---|
| 286 | n/a | PyObject *_res = NULL; |
|---|
| 287 | n/a | OSErr _err; |
|---|
| 288 | n/a | Boolean inIsVisible; |
|---|
| 289 | n/a | Boolean inDoDraw; |
|---|
| 290 | n/a | #ifndef SetControlVisibility |
|---|
| 291 | n/a | PyMac_PRECHECK(SetControlVisibility); |
|---|
| 292 | n/a | #endif |
|---|
| 293 | n/a | if (!PyArg_ParseTuple(_args, "bb", |
|---|
| 294 | n/a | &inIsVisible, |
|---|
| 295 | n/a | &inDoDraw)) |
|---|
| 296 | n/a | return NULL; |
|---|
| 297 | n/a | _err = SetControlVisibility(_self->ob_itself, |
|---|
| 298 | n/a | inIsVisible, |
|---|
| 299 | n/a | inDoDraw); |
|---|
| 300 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 301 | n/a | Py_INCREF(Py_None); |
|---|
| 302 | n/a | _res = Py_None; |
|---|
| 303 | n/a | return _res; |
|---|
| 304 | n/a | } |
|---|
| 305 | n/a | |
|---|
| 306 | n/a | static PyObject *CtlObj_IsControlEnabled(ControlObject *_self, PyObject *_args) |
|---|
| 307 | n/a | { |
|---|
| 308 | n/a | PyObject *_res = NULL; |
|---|
| 309 | n/a | Boolean _rv; |
|---|
| 310 | n/a | #ifndef IsControlEnabled |
|---|
| 311 | n/a | PyMac_PRECHECK(IsControlEnabled); |
|---|
| 312 | n/a | #endif |
|---|
| 313 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 314 | n/a | return NULL; |
|---|
| 315 | n/a | _rv = IsControlEnabled(_self->ob_itself); |
|---|
| 316 | n/a | _res = Py_BuildValue("b", |
|---|
| 317 | n/a | _rv); |
|---|
| 318 | n/a | return _res; |
|---|
| 319 | n/a | } |
|---|
| 320 | n/a | |
|---|
| 321 | n/a | static PyObject *CtlObj_EnableControl(ControlObject *_self, PyObject *_args) |
|---|
| 322 | n/a | { |
|---|
| 323 | n/a | PyObject *_res = NULL; |
|---|
| 324 | n/a | OSStatus _err; |
|---|
| 325 | n/a | #ifndef EnableControl |
|---|
| 326 | n/a | PyMac_PRECHECK(EnableControl); |
|---|
| 327 | n/a | #endif |
|---|
| 328 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 329 | n/a | return NULL; |
|---|
| 330 | n/a | _err = EnableControl(_self->ob_itself); |
|---|
| 331 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 332 | n/a | Py_INCREF(Py_None); |
|---|
| 333 | n/a | _res = Py_None; |
|---|
| 334 | n/a | return _res; |
|---|
| 335 | n/a | } |
|---|
| 336 | n/a | |
|---|
| 337 | n/a | static PyObject *CtlObj_DisableControl(ControlObject *_self, PyObject *_args) |
|---|
| 338 | n/a | { |
|---|
| 339 | n/a | PyObject *_res = NULL; |
|---|
| 340 | n/a | OSStatus _err; |
|---|
| 341 | n/a | #ifndef DisableControl |
|---|
| 342 | n/a | PyMac_PRECHECK(DisableControl); |
|---|
| 343 | n/a | #endif |
|---|
| 344 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 345 | n/a | return NULL; |
|---|
| 346 | n/a | _err = DisableControl(_self->ob_itself); |
|---|
| 347 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 348 | n/a | Py_INCREF(Py_None); |
|---|
| 349 | n/a | _res = Py_None; |
|---|
| 350 | n/a | return _res; |
|---|
| 351 | n/a | } |
|---|
| 352 | n/a | |
|---|
| 353 | n/a | static PyObject *CtlObj_Draw1Control(ControlObject *_self, PyObject *_args) |
|---|
| 354 | n/a | { |
|---|
| 355 | n/a | PyObject *_res = NULL; |
|---|
| 356 | n/a | #ifndef Draw1Control |
|---|
| 357 | n/a | PyMac_PRECHECK(Draw1Control); |
|---|
| 358 | n/a | #endif |
|---|
| 359 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 360 | n/a | return NULL; |
|---|
| 361 | n/a | Draw1Control(_self->ob_itself); |
|---|
| 362 | n/a | Py_INCREF(Py_None); |
|---|
| 363 | n/a | _res = Py_None; |
|---|
| 364 | n/a | return _res; |
|---|
| 365 | n/a | } |
|---|
| 366 | n/a | |
|---|
| 367 | n/a | static PyObject *CtlObj_GetBestControlRect(ControlObject *_self, PyObject *_args) |
|---|
| 368 | n/a | { |
|---|
| 369 | n/a | PyObject *_res = NULL; |
|---|
| 370 | n/a | OSErr _err; |
|---|
| 371 | n/a | Rect outRect; |
|---|
| 372 | n/a | SInt16 outBaseLineOffset; |
|---|
| 373 | n/a | #ifndef GetBestControlRect |
|---|
| 374 | n/a | PyMac_PRECHECK(GetBestControlRect); |
|---|
| 375 | n/a | #endif |
|---|
| 376 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 377 | n/a | return NULL; |
|---|
| 378 | n/a | _err = GetBestControlRect(_self->ob_itself, |
|---|
| 379 | n/a | &outRect, |
|---|
| 380 | n/a | &outBaseLineOffset); |
|---|
| 381 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 382 | n/a | _res = Py_BuildValue("O&h", |
|---|
| 383 | n/a | PyMac_BuildRect, &outRect, |
|---|
| 384 | n/a | outBaseLineOffset); |
|---|
| 385 | n/a | return _res; |
|---|
| 386 | n/a | } |
|---|
| 387 | n/a | |
|---|
| 388 | n/a | static PyObject *CtlObj_SetControlFontStyle(ControlObject *_self, PyObject *_args) |
|---|
| 389 | n/a | { |
|---|
| 390 | n/a | PyObject *_res = NULL; |
|---|
| 391 | n/a | OSErr _err; |
|---|
| 392 | n/a | ControlFontStyleRec inStyle; |
|---|
| 393 | n/a | #ifndef SetControlFontStyle |
|---|
| 394 | n/a | PyMac_PRECHECK(SetControlFontStyle); |
|---|
| 395 | n/a | #endif |
|---|
| 396 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 397 | n/a | ControlFontStyle_Convert, &inStyle)) |
|---|
| 398 | n/a | return NULL; |
|---|
| 399 | n/a | _err = SetControlFontStyle(_self->ob_itself, |
|---|
| 400 | n/a | &inStyle); |
|---|
| 401 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 402 | n/a | Py_INCREF(Py_None); |
|---|
| 403 | n/a | _res = Py_None; |
|---|
| 404 | n/a | return _res; |
|---|
| 405 | n/a | } |
|---|
| 406 | n/a | |
|---|
| 407 | n/a | static PyObject *CtlObj_DrawControlInCurrentPort(ControlObject *_self, PyObject *_args) |
|---|
| 408 | n/a | { |
|---|
| 409 | n/a | PyObject *_res = NULL; |
|---|
| 410 | n/a | #ifndef DrawControlInCurrentPort |
|---|
| 411 | n/a | PyMac_PRECHECK(DrawControlInCurrentPort); |
|---|
| 412 | n/a | #endif |
|---|
| 413 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 414 | n/a | return NULL; |
|---|
| 415 | n/a | DrawControlInCurrentPort(_self->ob_itself); |
|---|
| 416 | n/a | Py_INCREF(Py_None); |
|---|
| 417 | n/a | _res = Py_None; |
|---|
| 418 | n/a | return _res; |
|---|
| 419 | n/a | } |
|---|
| 420 | n/a | |
|---|
| 421 | n/a | static PyObject *CtlObj_SetUpControlBackground(ControlObject *_self, PyObject *_args) |
|---|
| 422 | n/a | { |
|---|
| 423 | n/a | PyObject *_res = NULL; |
|---|
| 424 | n/a | OSErr _err; |
|---|
| 425 | n/a | SInt16 inDepth; |
|---|
| 426 | n/a | Boolean inIsColorDevice; |
|---|
| 427 | n/a | #ifndef SetUpControlBackground |
|---|
| 428 | n/a | PyMac_PRECHECK(SetUpControlBackground); |
|---|
| 429 | n/a | #endif |
|---|
| 430 | n/a | if (!PyArg_ParseTuple(_args, "hb", |
|---|
| 431 | n/a | &inDepth, |
|---|
| 432 | n/a | &inIsColorDevice)) |
|---|
| 433 | n/a | return NULL; |
|---|
| 434 | n/a | _err = SetUpControlBackground(_self->ob_itself, |
|---|
| 435 | n/a | inDepth, |
|---|
| 436 | n/a | inIsColorDevice); |
|---|
| 437 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 438 | n/a | Py_INCREF(Py_None); |
|---|
| 439 | n/a | _res = Py_None; |
|---|
| 440 | n/a | return _res; |
|---|
| 441 | n/a | } |
|---|
| 442 | n/a | |
|---|
| 443 | n/a | static PyObject *CtlObj_SetUpControlTextColor(ControlObject *_self, PyObject *_args) |
|---|
| 444 | n/a | { |
|---|
| 445 | n/a | PyObject *_res = NULL; |
|---|
| 446 | n/a | OSErr _err; |
|---|
| 447 | n/a | SInt16 inDepth; |
|---|
| 448 | n/a | Boolean inIsColorDevice; |
|---|
| 449 | n/a | #ifndef SetUpControlTextColor |
|---|
| 450 | n/a | PyMac_PRECHECK(SetUpControlTextColor); |
|---|
| 451 | n/a | #endif |
|---|
| 452 | n/a | if (!PyArg_ParseTuple(_args, "hb", |
|---|
| 453 | n/a | &inDepth, |
|---|
| 454 | n/a | &inIsColorDevice)) |
|---|
| 455 | n/a | return NULL; |
|---|
| 456 | n/a | _err = SetUpControlTextColor(_self->ob_itself, |
|---|
| 457 | n/a | inDepth, |
|---|
| 458 | n/a | inIsColorDevice); |
|---|
| 459 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 460 | n/a | Py_INCREF(Py_None); |
|---|
| 461 | n/a | _res = Py_None; |
|---|
| 462 | n/a | return _res; |
|---|
| 463 | n/a | } |
|---|
| 464 | n/a | |
|---|
| 465 | n/a | static PyObject *CtlObj_DragControl(ControlObject *_self, PyObject *_args) |
|---|
| 466 | n/a | { |
|---|
| 467 | n/a | PyObject *_res = NULL; |
|---|
| 468 | n/a | Point startPoint; |
|---|
| 469 | n/a | Rect limitRect; |
|---|
| 470 | n/a | Rect slopRect; |
|---|
| 471 | n/a | DragConstraint axis; |
|---|
| 472 | n/a | #ifndef DragControl |
|---|
| 473 | n/a | PyMac_PRECHECK(DragControl); |
|---|
| 474 | n/a | #endif |
|---|
| 475 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&H", |
|---|
| 476 | n/a | PyMac_GetPoint, &startPoint, |
|---|
| 477 | n/a | PyMac_GetRect, &limitRect, |
|---|
| 478 | n/a | PyMac_GetRect, &slopRect, |
|---|
| 479 | n/a | &axis)) |
|---|
| 480 | n/a | return NULL; |
|---|
| 481 | n/a | DragControl(_self->ob_itself, |
|---|
| 482 | n/a | startPoint, |
|---|
| 483 | n/a | &limitRect, |
|---|
| 484 | n/a | &slopRect, |
|---|
| 485 | n/a | axis); |
|---|
| 486 | n/a | Py_INCREF(Py_None); |
|---|
| 487 | n/a | _res = Py_None; |
|---|
| 488 | n/a | return _res; |
|---|
| 489 | n/a | } |
|---|
| 490 | n/a | |
|---|
| 491 | n/a | static PyObject *CtlObj_TestControl(ControlObject *_self, PyObject *_args) |
|---|
| 492 | n/a | { |
|---|
| 493 | n/a | PyObject *_res = NULL; |
|---|
| 494 | n/a | ControlPartCode _rv; |
|---|
| 495 | n/a | Point testPoint; |
|---|
| 496 | n/a | #ifndef TestControl |
|---|
| 497 | n/a | PyMac_PRECHECK(TestControl); |
|---|
| 498 | n/a | #endif |
|---|
| 499 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 500 | n/a | PyMac_GetPoint, &testPoint)) |
|---|
| 501 | n/a | return NULL; |
|---|
| 502 | n/a | _rv = TestControl(_self->ob_itself, |
|---|
| 503 | n/a | testPoint); |
|---|
| 504 | n/a | _res = Py_BuildValue("h", |
|---|
| 505 | n/a | _rv); |
|---|
| 506 | n/a | return _res; |
|---|
| 507 | n/a | } |
|---|
| 508 | n/a | |
|---|
| 509 | n/a | static PyObject *CtlObj_HandleControlContextualMenuClick(ControlObject *_self, PyObject *_args) |
|---|
| 510 | n/a | { |
|---|
| 511 | n/a | PyObject *_res = NULL; |
|---|
| 512 | n/a | OSStatus _err; |
|---|
| 513 | n/a | Point inWhere; |
|---|
| 514 | n/a | Boolean menuDisplayed; |
|---|
| 515 | n/a | #ifndef HandleControlContextualMenuClick |
|---|
| 516 | n/a | PyMac_PRECHECK(HandleControlContextualMenuClick); |
|---|
| 517 | n/a | #endif |
|---|
| 518 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 519 | n/a | PyMac_GetPoint, &inWhere)) |
|---|
| 520 | n/a | return NULL; |
|---|
| 521 | n/a | _err = HandleControlContextualMenuClick(_self->ob_itself, |
|---|
| 522 | n/a | inWhere, |
|---|
| 523 | n/a | &menuDisplayed); |
|---|
| 524 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 525 | n/a | _res = Py_BuildValue("b", |
|---|
| 526 | n/a | menuDisplayed); |
|---|
| 527 | n/a | return _res; |
|---|
| 528 | n/a | } |
|---|
| 529 | n/a | |
|---|
| 530 | n/a | static PyObject *CtlObj_GetControlClickActivation(ControlObject *_self, PyObject *_args) |
|---|
| 531 | n/a | { |
|---|
| 532 | n/a | PyObject *_res = NULL; |
|---|
| 533 | n/a | OSStatus _err; |
|---|
| 534 | n/a | Point inWhere; |
|---|
| 535 | n/a | EventModifiers inModifiers; |
|---|
| 536 | n/a | ClickActivationResult outResult; |
|---|
| 537 | n/a | #ifndef GetControlClickActivation |
|---|
| 538 | n/a | PyMac_PRECHECK(GetControlClickActivation); |
|---|
| 539 | n/a | #endif |
|---|
| 540 | n/a | if (!PyArg_ParseTuple(_args, "O&H", |
|---|
| 541 | n/a | PyMac_GetPoint, &inWhere, |
|---|
| 542 | n/a | &inModifiers)) |
|---|
| 543 | n/a | return NULL; |
|---|
| 544 | n/a | _err = GetControlClickActivation(_self->ob_itself, |
|---|
| 545 | n/a | inWhere, |
|---|
| 546 | n/a | inModifiers, |
|---|
| 547 | n/a | &outResult); |
|---|
| 548 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 549 | n/a | _res = Py_BuildValue("l", |
|---|
| 550 | n/a | outResult); |
|---|
| 551 | n/a | return _res; |
|---|
| 552 | n/a | } |
|---|
| 553 | n/a | |
|---|
| 554 | n/a | static PyObject *CtlObj_HandleControlKey(ControlObject *_self, PyObject *_args) |
|---|
| 555 | n/a | { |
|---|
| 556 | n/a | PyObject *_res = NULL; |
|---|
| 557 | n/a | ControlPartCode _rv; |
|---|
| 558 | n/a | SInt16 inKeyCode; |
|---|
| 559 | n/a | SInt16 inCharCode; |
|---|
| 560 | n/a | EventModifiers inModifiers; |
|---|
| 561 | n/a | #ifndef HandleControlKey |
|---|
| 562 | n/a | PyMac_PRECHECK(HandleControlKey); |
|---|
| 563 | n/a | #endif |
|---|
| 564 | n/a | if (!PyArg_ParseTuple(_args, "hhH", |
|---|
| 565 | n/a | &inKeyCode, |
|---|
| 566 | n/a | &inCharCode, |
|---|
| 567 | n/a | &inModifiers)) |
|---|
| 568 | n/a | return NULL; |
|---|
| 569 | n/a | _rv = HandleControlKey(_self->ob_itself, |
|---|
| 570 | n/a | inKeyCode, |
|---|
| 571 | n/a | inCharCode, |
|---|
| 572 | n/a | inModifiers); |
|---|
| 573 | n/a | _res = Py_BuildValue("h", |
|---|
| 574 | n/a | _rv); |
|---|
| 575 | n/a | return _res; |
|---|
| 576 | n/a | } |
|---|
| 577 | n/a | |
|---|
| 578 | n/a | static PyObject *CtlObj_HandleControlSetCursor(ControlObject *_self, PyObject *_args) |
|---|
| 579 | n/a | { |
|---|
| 580 | n/a | PyObject *_res = NULL; |
|---|
| 581 | n/a | OSStatus _err; |
|---|
| 582 | n/a | Point localPoint; |
|---|
| 583 | n/a | EventModifiers modifiers; |
|---|
| 584 | n/a | Boolean cursorWasSet; |
|---|
| 585 | n/a | #ifndef HandleControlSetCursor |
|---|
| 586 | n/a | PyMac_PRECHECK(HandleControlSetCursor); |
|---|
| 587 | n/a | #endif |
|---|
| 588 | n/a | if (!PyArg_ParseTuple(_args, "O&H", |
|---|
| 589 | n/a | PyMac_GetPoint, &localPoint, |
|---|
| 590 | n/a | &modifiers)) |
|---|
| 591 | n/a | return NULL; |
|---|
| 592 | n/a | _err = HandleControlSetCursor(_self->ob_itself, |
|---|
| 593 | n/a | localPoint, |
|---|
| 594 | n/a | modifiers, |
|---|
| 595 | n/a | &cursorWasSet); |
|---|
| 596 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 597 | n/a | _res = Py_BuildValue("b", |
|---|
| 598 | n/a | cursorWasSet); |
|---|
| 599 | n/a | return _res; |
|---|
| 600 | n/a | } |
|---|
| 601 | n/a | |
|---|
| 602 | n/a | static PyObject *CtlObj_MoveControl(ControlObject *_self, PyObject *_args) |
|---|
| 603 | n/a | { |
|---|
| 604 | n/a | PyObject *_res = NULL; |
|---|
| 605 | n/a | SInt16 h; |
|---|
| 606 | n/a | SInt16 v; |
|---|
| 607 | n/a | #ifndef MoveControl |
|---|
| 608 | n/a | PyMac_PRECHECK(MoveControl); |
|---|
| 609 | n/a | #endif |
|---|
| 610 | n/a | if (!PyArg_ParseTuple(_args, "hh", |
|---|
| 611 | n/a | &h, |
|---|
| 612 | n/a | &v)) |
|---|
| 613 | n/a | return NULL; |
|---|
| 614 | n/a | MoveControl(_self->ob_itself, |
|---|
| 615 | n/a | h, |
|---|
| 616 | n/a | v); |
|---|
| 617 | n/a | Py_INCREF(Py_None); |
|---|
| 618 | n/a | _res = Py_None; |
|---|
| 619 | n/a | return _res; |
|---|
| 620 | n/a | } |
|---|
| 621 | n/a | |
|---|
| 622 | n/a | static PyObject *CtlObj_SizeControl(ControlObject *_self, PyObject *_args) |
|---|
| 623 | n/a | { |
|---|
| 624 | n/a | PyObject *_res = NULL; |
|---|
| 625 | n/a | SInt16 w; |
|---|
| 626 | n/a | SInt16 h; |
|---|
| 627 | n/a | #ifndef SizeControl |
|---|
| 628 | n/a | PyMac_PRECHECK(SizeControl); |
|---|
| 629 | n/a | #endif |
|---|
| 630 | n/a | if (!PyArg_ParseTuple(_args, "hh", |
|---|
| 631 | n/a | &w, |
|---|
| 632 | n/a | &h)) |
|---|
| 633 | n/a | return NULL; |
|---|
| 634 | n/a | SizeControl(_self->ob_itself, |
|---|
| 635 | n/a | w, |
|---|
| 636 | n/a | h); |
|---|
| 637 | n/a | Py_INCREF(Py_None); |
|---|
| 638 | n/a | _res = Py_None; |
|---|
| 639 | n/a | return _res; |
|---|
| 640 | n/a | } |
|---|
| 641 | n/a | |
|---|
| 642 | n/a | static PyObject *CtlObj_SetControlTitle(ControlObject *_self, PyObject *_args) |
|---|
| 643 | n/a | { |
|---|
| 644 | n/a | PyObject *_res = NULL; |
|---|
| 645 | n/a | Str255 title; |
|---|
| 646 | n/a | #ifndef SetControlTitle |
|---|
| 647 | n/a | PyMac_PRECHECK(SetControlTitle); |
|---|
| 648 | n/a | #endif |
|---|
| 649 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 650 | n/a | PyMac_GetStr255, title)) |
|---|
| 651 | n/a | return NULL; |
|---|
| 652 | n/a | SetControlTitle(_self->ob_itself, |
|---|
| 653 | n/a | title); |
|---|
| 654 | n/a | Py_INCREF(Py_None); |
|---|
| 655 | n/a | _res = Py_None; |
|---|
| 656 | n/a | return _res; |
|---|
| 657 | n/a | } |
|---|
| 658 | n/a | |
|---|
| 659 | n/a | static PyObject *CtlObj_GetControlTitle(ControlObject *_self, PyObject *_args) |
|---|
| 660 | n/a | { |
|---|
| 661 | n/a | PyObject *_res = NULL; |
|---|
| 662 | n/a | Str255 title; |
|---|
| 663 | n/a | #ifndef GetControlTitle |
|---|
| 664 | n/a | PyMac_PRECHECK(GetControlTitle); |
|---|
| 665 | n/a | #endif |
|---|
| 666 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 667 | n/a | return NULL; |
|---|
| 668 | n/a | GetControlTitle(_self->ob_itself, |
|---|
| 669 | n/a | title); |
|---|
| 670 | n/a | _res = Py_BuildValue("O&", |
|---|
| 671 | n/a | PyMac_BuildStr255, title); |
|---|
| 672 | n/a | return _res; |
|---|
| 673 | n/a | } |
|---|
| 674 | n/a | |
|---|
| 675 | n/a | static PyObject *CtlObj_SetControlTitleWithCFString(ControlObject *_self, PyObject *_args) |
|---|
| 676 | n/a | { |
|---|
| 677 | n/a | PyObject *_res = NULL; |
|---|
| 678 | n/a | OSStatus _err; |
|---|
| 679 | n/a | CFStringRef inString; |
|---|
| 680 | n/a | #ifndef SetControlTitleWithCFString |
|---|
| 681 | n/a | PyMac_PRECHECK(SetControlTitleWithCFString); |
|---|
| 682 | n/a | #endif |
|---|
| 683 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 684 | n/a | CFStringRefObj_Convert, &inString)) |
|---|
| 685 | n/a | return NULL; |
|---|
| 686 | n/a | _err = SetControlTitleWithCFString(_self->ob_itself, |
|---|
| 687 | n/a | inString); |
|---|
| 688 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 689 | n/a | Py_INCREF(Py_None); |
|---|
| 690 | n/a | _res = Py_None; |
|---|
| 691 | n/a | return _res; |
|---|
| 692 | n/a | } |
|---|
| 693 | n/a | |
|---|
| 694 | n/a | static PyObject *CtlObj_CopyControlTitleAsCFString(ControlObject *_self, PyObject *_args) |
|---|
| 695 | n/a | { |
|---|
| 696 | n/a | PyObject *_res = NULL; |
|---|
| 697 | n/a | OSStatus _err; |
|---|
| 698 | n/a | CFStringRef outString; |
|---|
| 699 | n/a | #ifndef CopyControlTitleAsCFString |
|---|
| 700 | n/a | PyMac_PRECHECK(CopyControlTitleAsCFString); |
|---|
| 701 | n/a | #endif |
|---|
| 702 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 703 | n/a | return NULL; |
|---|
| 704 | n/a | _err = CopyControlTitleAsCFString(_self->ob_itself, |
|---|
| 705 | n/a | &outString); |
|---|
| 706 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 707 | n/a | _res = Py_BuildValue("O&", |
|---|
| 708 | n/a | CFStringRefObj_New, outString); |
|---|
| 709 | n/a | return _res; |
|---|
| 710 | n/a | } |
|---|
| 711 | n/a | |
|---|
| 712 | n/a | static PyObject *CtlObj_GetControlValue(ControlObject *_self, PyObject *_args) |
|---|
| 713 | n/a | { |
|---|
| 714 | n/a | PyObject *_res = NULL; |
|---|
| 715 | n/a | SInt16 _rv; |
|---|
| 716 | n/a | #ifndef GetControlValue |
|---|
| 717 | n/a | PyMac_PRECHECK(GetControlValue); |
|---|
| 718 | n/a | #endif |
|---|
| 719 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 720 | n/a | return NULL; |
|---|
| 721 | n/a | _rv = GetControlValue(_self->ob_itself); |
|---|
| 722 | n/a | _res = Py_BuildValue("h", |
|---|
| 723 | n/a | _rv); |
|---|
| 724 | n/a | return _res; |
|---|
| 725 | n/a | } |
|---|
| 726 | n/a | |
|---|
| 727 | n/a | static PyObject *CtlObj_SetControlValue(ControlObject *_self, PyObject *_args) |
|---|
| 728 | n/a | { |
|---|
| 729 | n/a | PyObject *_res = NULL; |
|---|
| 730 | n/a | SInt16 newValue; |
|---|
| 731 | n/a | #ifndef SetControlValue |
|---|
| 732 | n/a | PyMac_PRECHECK(SetControlValue); |
|---|
| 733 | n/a | #endif |
|---|
| 734 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 735 | n/a | &newValue)) |
|---|
| 736 | n/a | return NULL; |
|---|
| 737 | n/a | SetControlValue(_self->ob_itself, |
|---|
| 738 | n/a | newValue); |
|---|
| 739 | n/a | Py_INCREF(Py_None); |
|---|
| 740 | n/a | _res = Py_None; |
|---|
| 741 | n/a | return _res; |
|---|
| 742 | n/a | } |
|---|
| 743 | n/a | |
|---|
| 744 | n/a | static PyObject *CtlObj_GetControlMinimum(ControlObject *_self, PyObject *_args) |
|---|
| 745 | n/a | { |
|---|
| 746 | n/a | PyObject *_res = NULL; |
|---|
| 747 | n/a | SInt16 _rv; |
|---|
| 748 | n/a | #ifndef GetControlMinimum |
|---|
| 749 | n/a | PyMac_PRECHECK(GetControlMinimum); |
|---|
| 750 | n/a | #endif |
|---|
| 751 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 752 | n/a | return NULL; |
|---|
| 753 | n/a | _rv = GetControlMinimum(_self->ob_itself); |
|---|
| 754 | n/a | _res = Py_BuildValue("h", |
|---|
| 755 | n/a | _rv); |
|---|
| 756 | n/a | return _res; |
|---|
| 757 | n/a | } |
|---|
| 758 | n/a | |
|---|
| 759 | n/a | static PyObject *CtlObj_SetControlMinimum(ControlObject *_self, PyObject *_args) |
|---|
| 760 | n/a | { |
|---|
| 761 | n/a | PyObject *_res = NULL; |
|---|
| 762 | n/a | SInt16 newMinimum; |
|---|
| 763 | n/a | #ifndef SetControlMinimum |
|---|
| 764 | n/a | PyMac_PRECHECK(SetControlMinimum); |
|---|
| 765 | n/a | #endif |
|---|
| 766 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 767 | n/a | &newMinimum)) |
|---|
| 768 | n/a | return NULL; |
|---|
| 769 | n/a | SetControlMinimum(_self->ob_itself, |
|---|
| 770 | n/a | newMinimum); |
|---|
| 771 | n/a | Py_INCREF(Py_None); |
|---|
| 772 | n/a | _res = Py_None; |
|---|
| 773 | n/a | return _res; |
|---|
| 774 | n/a | } |
|---|
| 775 | n/a | |
|---|
| 776 | n/a | static PyObject *CtlObj_GetControlMaximum(ControlObject *_self, PyObject *_args) |
|---|
| 777 | n/a | { |
|---|
| 778 | n/a | PyObject *_res = NULL; |
|---|
| 779 | n/a | SInt16 _rv; |
|---|
| 780 | n/a | #ifndef GetControlMaximum |
|---|
| 781 | n/a | PyMac_PRECHECK(GetControlMaximum); |
|---|
| 782 | n/a | #endif |
|---|
| 783 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 784 | n/a | return NULL; |
|---|
| 785 | n/a | _rv = GetControlMaximum(_self->ob_itself); |
|---|
| 786 | n/a | _res = Py_BuildValue("h", |
|---|
| 787 | n/a | _rv); |
|---|
| 788 | n/a | return _res; |
|---|
| 789 | n/a | } |
|---|
| 790 | n/a | |
|---|
| 791 | n/a | static PyObject *CtlObj_SetControlMaximum(ControlObject *_self, PyObject *_args) |
|---|
| 792 | n/a | { |
|---|
| 793 | n/a | PyObject *_res = NULL; |
|---|
| 794 | n/a | SInt16 newMaximum; |
|---|
| 795 | n/a | #ifndef SetControlMaximum |
|---|
| 796 | n/a | PyMac_PRECHECK(SetControlMaximum); |
|---|
| 797 | n/a | #endif |
|---|
| 798 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 799 | n/a | &newMaximum)) |
|---|
| 800 | n/a | return NULL; |
|---|
| 801 | n/a | SetControlMaximum(_self->ob_itself, |
|---|
| 802 | n/a | newMaximum); |
|---|
| 803 | n/a | Py_INCREF(Py_None); |
|---|
| 804 | n/a | _res = Py_None; |
|---|
| 805 | n/a | return _res; |
|---|
| 806 | n/a | } |
|---|
| 807 | n/a | |
|---|
| 808 | n/a | static PyObject *CtlObj_GetControlViewSize(ControlObject *_self, PyObject *_args) |
|---|
| 809 | n/a | { |
|---|
| 810 | n/a | PyObject *_res = NULL; |
|---|
| 811 | n/a | SInt32 _rv; |
|---|
| 812 | n/a | #ifndef GetControlViewSize |
|---|
| 813 | n/a | PyMac_PRECHECK(GetControlViewSize); |
|---|
| 814 | n/a | #endif |
|---|
| 815 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 816 | n/a | return NULL; |
|---|
| 817 | n/a | _rv = GetControlViewSize(_self->ob_itself); |
|---|
| 818 | n/a | _res = Py_BuildValue("l", |
|---|
| 819 | n/a | _rv); |
|---|
| 820 | n/a | return _res; |
|---|
| 821 | n/a | } |
|---|
| 822 | n/a | |
|---|
| 823 | n/a | static PyObject *CtlObj_SetControlViewSize(ControlObject *_self, PyObject *_args) |
|---|
| 824 | n/a | { |
|---|
| 825 | n/a | PyObject *_res = NULL; |
|---|
| 826 | n/a | SInt32 newViewSize; |
|---|
| 827 | n/a | #ifndef SetControlViewSize |
|---|
| 828 | n/a | PyMac_PRECHECK(SetControlViewSize); |
|---|
| 829 | n/a | #endif |
|---|
| 830 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 831 | n/a | &newViewSize)) |
|---|
| 832 | n/a | return NULL; |
|---|
| 833 | n/a | SetControlViewSize(_self->ob_itself, |
|---|
| 834 | n/a | newViewSize); |
|---|
| 835 | n/a | Py_INCREF(Py_None); |
|---|
| 836 | n/a | _res = Py_None; |
|---|
| 837 | n/a | return _res; |
|---|
| 838 | n/a | } |
|---|
| 839 | n/a | |
|---|
| 840 | n/a | static PyObject *CtlObj_GetControl32BitValue(ControlObject *_self, PyObject *_args) |
|---|
| 841 | n/a | { |
|---|
| 842 | n/a | PyObject *_res = NULL; |
|---|
| 843 | n/a | SInt32 _rv; |
|---|
| 844 | n/a | #ifndef GetControl32BitValue |
|---|
| 845 | n/a | PyMac_PRECHECK(GetControl32BitValue); |
|---|
| 846 | n/a | #endif |
|---|
| 847 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 848 | n/a | return NULL; |
|---|
| 849 | n/a | _rv = GetControl32BitValue(_self->ob_itself); |
|---|
| 850 | n/a | _res = Py_BuildValue("l", |
|---|
| 851 | n/a | _rv); |
|---|
| 852 | n/a | return _res; |
|---|
| 853 | n/a | } |
|---|
| 854 | n/a | |
|---|
| 855 | n/a | static PyObject *CtlObj_SetControl32BitValue(ControlObject *_self, PyObject *_args) |
|---|
| 856 | n/a | { |
|---|
| 857 | n/a | PyObject *_res = NULL; |
|---|
| 858 | n/a | SInt32 newValue; |
|---|
| 859 | n/a | #ifndef SetControl32BitValue |
|---|
| 860 | n/a | PyMac_PRECHECK(SetControl32BitValue); |
|---|
| 861 | n/a | #endif |
|---|
| 862 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 863 | n/a | &newValue)) |
|---|
| 864 | n/a | return NULL; |
|---|
| 865 | n/a | SetControl32BitValue(_self->ob_itself, |
|---|
| 866 | n/a | newValue); |
|---|
| 867 | n/a | Py_INCREF(Py_None); |
|---|
| 868 | n/a | _res = Py_None; |
|---|
| 869 | n/a | return _res; |
|---|
| 870 | n/a | } |
|---|
| 871 | n/a | |
|---|
| 872 | n/a | static PyObject *CtlObj_GetControl32BitMaximum(ControlObject *_self, PyObject *_args) |
|---|
| 873 | n/a | { |
|---|
| 874 | n/a | PyObject *_res = NULL; |
|---|
| 875 | n/a | SInt32 _rv; |
|---|
| 876 | n/a | #ifndef GetControl32BitMaximum |
|---|
| 877 | n/a | PyMac_PRECHECK(GetControl32BitMaximum); |
|---|
| 878 | n/a | #endif |
|---|
| 879 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 880 | n/a | return NULL; |
|---|
| 881 | n/a | _rv = GetControl32BitMaximum(_self->ob_itself); |
|---|
| 882 | n/a | _res = Py_BuildValue("l", |
|---|
| 883 | n/a | _rv); |
|---|
| 884 | n/a | return _res; |
|---|
| 885 | n/a | } |
|---|
| 886 | n/a | |
|---|
| 887 | n/a | static PyObject *CtlObj_SetControl32BitMaximum(ControlObject *_self, PyObject *_args) |
|---|
| 888 | n/a | { |
|---|
| 889 | n/a | PyObject *_res = NULL; |
|---|
| 890 | n/a | SInt32 newMaximum; |
|---|
| 891 | n/a | #ifndef SetControl32BitMaximum |
|---|
| 892 | n/a | PyMac_PRECHECK(SetControl32BitMaximum); |
|---|
| 893 | n/a | #endif |
|---|
| 894 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 895 | n/a | &newMaximum)) |
|---|
| 896 | n/a | return NULL; |
|---|
| 897 | n/a | SetControl32BitMaximum(_self->ob_itself, |
|---|
| 898 | n/a | newMaximum); |
|---|
| 899 | n/a | Py_INCREF(Py_None); |
|---|
| 900 | n/a | _res = Py_None; |
|---|
| 901 | n/a | return _res; |
|---|
| 902 | n/a | } |
|---|
| 903 | n/a | |
|---|
| 904 | n/a | static PyObject *CtlObj_GetControl32BitMinimum(ControlObject *_self, PyObject *_args) |
|---|
| 905 | n/a | { |
|---|
| 906 | n/a | PyObject *_res = NULL; |
|---|
| 907 | n/a | SInt32 _rv; |
|---|
| 908 | n/a | #ifndef GetControl32BitMinimum |
|---|
| 909 | n/a | PyMac_PRECHECK(GetControl32BitMinimum); |
|---|
| 910 | n/a | #endif |
|---|
| 911 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 912 | n/a | return NULL; |
|---|
| 913 | n/a | _rv = GetControl32BitMinimum(_self->ob_itself); |
|---|
| 914 | n/a | _res = Py_BuildValue("l", |
|---|
| 915 | n/a | _rv); |
|---|
| 916 | n/a | return _res; |
|---|
| 917 | n/a | } |
|---|
| 918 | n/a | |
|---|
| 919 | n/a | static PyObject *CtlObj_SetControl32BitMinimum(ControlObject *_self, PyObject *_args) |
|---|
| 920 | n/a | { |
|---|
| 921 | n/a | PyObject *_res = NULL; |
|---|
| 922 | n/a | SInt32 newMinimum; |
|---|
| 923 | n/a | #ifndef SetControl32BitMinimum |
|---|
| 924 | n/a | PyMac_PRECHECK(SetControl32BitMinimum); |
|---|
| 925 | n/a | #endif |
|---|
| 926 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 927 | n/a | &newMinimum)) |
|---|
| 928 | n/a | return NULL; |
|---|
| 929 | n/a | SetControl32BitMinimum(_self->ob_itself, |
|---|
| 930 | n/a | newMinimum); |
|---|
| 931 | n/a | Py_INCREF(Py_None); |
|---|
| 932 | n/a | _res = Py_None; |
|---|
| 933 | n/a | return _res; |
|---|
| 934 | n/a | } |
|---|
| 935 | n/a | |
|---|
| 936 | n/a | static PyObject *CtlObj_IsValidControlHandle(ControlObject *_self, PyObject *_args) |
|---|
| 937 | n/a | { |
|---|
| 938 | n/a | PyObject *_res = NULL; |
|---|
| 939 | n/a | Boolean _rv; |
|---|
| 940 | n/a | #ifndef IsValidControlHandle |
|---|
| 941 | n/a | PyMac_PRECHECK(IsValidControlHandle); |
|---|
| 942 | n/a | #endif |
|---|
| 943 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 944 | n/a | return NULL; |
|---|
| 945 | n/a | _rv = IsValidControlHandle(_self->ob_itself); |
|---|
| 946 | n/a | _res = Py_BuildValue("b", |
|---|
| 947 | n/a | _rv); |
|---|
| 948 | n/a | return _res; |
|---|
| 949 | n/a | } |
|---|
| 950 | n/a | |
|---|
| 951 | n/a | static PyObject *CtlObj_SetControlID(ControlObject *_self, PyObject *_args) |
|---|
| 952 | n/a | { |
|---|
| 953 | n/a | PyObject *_res = NULL; |
|---|
| 954 | n/a | OSStatus _err; |
|---|
| 955 | n/a | ControlID inID; |
|---|
| 956 | n/a | #ifndef SetControlID |
|---|
| 957 | n/a | PyMac_PRECHECK(SetControlID); |
|---|
| 958 | n/a | #endif |
|---|
| 959 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 960 | n/a | PyControlID_Convert, &inID)) |
|---|
| 961 | n/a | return NULL; |
|---|
| 962 | n/a | _err = SetControlID(_self->ob_itself, |
|---|
| 963 | n/a | &inID); |
|---|
| 964 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 965 | n/a | Py_INCREF(Py_None); |
|---|
| 966 | n/a | _res = Py_None; |
|---|
| 967 | n/a | return _res; |
|---|
| 968 | n/a | } |
|---|
| 969 | n/a | |
|---|
| 970 | n/a | static PyObject *CtlObj_GetControlID(ControlObject *_self, PyObject *_args) |
|---|
| 971 | n/a | { |
|---|
| 972 | n/a | PyObject *_res = NULL; |
|---|
| 973 | n/a | OSStatus _err; |
|---|
| 974 | n/a | ControlID outID; |
|---|
| 975 | n/a | #ifndef GetControlID |
|---|
| 976 | n/a | PyMac_PRECHECK(GetControlID); |
|---|
| 977 | n/a | #endif |
|---|
| 978 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 979 | n/a | return NULL; |
|---|
| 980 | n/a | _err = GetControlID(_self->ob_itself, |
|---|
| 981 | n/a | &outID); |
|---|
| 982 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 983 | n/a | _res = Py_BuildValue("O&", |
|---|
| 984 | n/a | PyControlID_New, &outID); |
|---|
| 985 | n/a | return _res; |
|---|
| 986 | n/a | } |
|---|
| 987 | n/a | |
|---|
| 988 | n/a | static PyObject *CtlObj_SetControlCommandID(ControlObject *_self, PyObject *_args) |
|---|
| 989 | n/a | { |
|---|
| 990 | n/a | PyObject *_res = NULL; |
|---|
| 991 | n/a | OSStatus _err; |
|---|
| 992 | n/a | UInt32 inCommandID; |
|---|
| 993 | n/a | #ifndef SetControlCommandID |
|---|
| 994 | n/a | PyMac_PRECHECK(SetControlCommandID); |
|---|
| 995 | n/a | #endif |
|---|
| 996 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 997 | n/a | &inCommandID)) |
|---|
| 998 | n/a | return NULL; |
|---|
| 999 | n/a | _err = SetControlCommandID(_self->ob_itself, |
|---|
| 1000 | n/a | inCommandID); |
|---|
| 1001 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1002 | n/a | Py_INCREF(Py_None); |
|---|
| 1003 | n/a | _res = Py_None; |
|---|
| 1004 | n/a | return _res; |
|---|
| 1005 | n/a | } |
|---|
| 1006 | n/a | |
|---|
| 1007 | n/a | static PyObject *CtlObj_GetControlCommandID(ControlObject *_self, PyObject *_args) |
|---|
| 1008 | n/a | { |
|---|
| 1009 | n/a | PyObject *_res = NULL; |
|---|
| 1010 | n/a | OSStatus _err; |
|---|
| 1011 | n/a | UInt32 outCommandID; |
|---|
| 1012 | n/a | #ifndef GetControlCommandID |
|---|
| 1013 | n/a | PyMac_PRECHECK(GetControlCommandID); |
|---|
| 1014 | n/a | #endif |
|---|
| 1015 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1016 | n/a | return NULL; |
|---|
| 1017 | n/a | _err = GetControlCommandID(_self->ob_itself, |
|---|
| 1018 | n/a | &outCommandID); |
|---|
| 1019 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1020 | n/a | _res = Py_BuildValue("l", |
|---|
| 1021 | n/a | outCommandID); |
|---|
| 1022 | n/a | return _res; |
|---|
| 1023 | n/a | } |
|---|
| 1024 | n/a | |
|---|
| 1025 | n/a | static PyObject *CtlObj_RemoveControlProperty(ControlObject *_self, PyObject *_args) |
|---|
| 1026 | n/a | { |
|---|
| 1027 | n/a | PyObject *_res = NULL; |
|---|
| 1028 | n/a | OSStatus _err; |
|---|
| 1029 | n/a | OSType propertyCreator; |
|---|
| 1030 | n/a | OSType propertyTag; |
|---|
| 1031 | n/a | #ifndef RemoveControlProperty |
|---|
| 1032 | n/a | PyMac_PRECHECK(RemoveControlProperty); |
|---|
| 1033 | n/a | #endif |
|---|
| 1034 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 1035 | n/a | PyMac_GetOSType, &propertyCreator, |
|---|
| 1036 | n/a | PyMac_GetOSType, &propertyTag)) |
|---|
| 1037 | n/a | return NULL; |
|---|
| 1038 | n/a | _err = RemoveControlProperty(_self->ob_itself, |
|---|
| 1039 | n/a | propertyCreator, |
|---|
| 1040 | n/a | propertyTag); |
|---|
| 1041 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1042 | n/a | Py_INCREF(Py_None); |
|---|
| 1043 | n/a | _res = Py_None; |
|---|
| 1044 | n/a | return _res; |
|---|
| 1045 | n/a | } |
|---|
| 1046 | n/a | |
|---|
| 1047 | n/a | static PyObject *CtlObj_GetControlPropertyAttributes(ControlObject *_self, PyObject *_args) |
|---|
| 1048 | n/a | { |
|---|
| 1049 | n/a | PyObject *_res = NULL; |
|---|
| 1050 | n/a | OSStatus _err; |
|---|
| 1051 | n/a | OSType propertyCreator; |
|---|
| 1052 | n/a | OSType propertyTag; |
|---|
| 1053 | n/a | UInt32 attributes; |
|---|
| 1054 | n/a | #ifndef GetControlPropertyAttributes |
|---|
| 1055 | n/a | PyMac_PRECHECK(GetControlPropertyAttributes); |
|---|
| 1056 | n/a | #endif |
|---|
| 1057 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 1058 | n/a | PyMac_GetOSType, &propertyCreator, |
|---|
| 1059 | n/a | PyMac_GetOSType, &propertyTag)) |
|---|
| 1060 | n/a | return NULL; |
|---|
| 1061 | n/a | _err = GetControlPropertyAttributes(_self->ob_itself, |
|---|
| 1062 | n/a | propertyCreator, |
|---|
| 1063 | n/a | propertyTag, |
|---|
| 1064 | n/a | &attributes); |
|---|
| 1065 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1066 | n/a | _res = Py_BuildValue("l", |
|---|
| 1067 | n/a | attributes); |
|---|
| 1068 | n/a | return _res; |
|---|
| 1069 | n/a | } |
|---|
| 1070 | n/a | |
|---|
| 1071 | n/a | static PyObject *CtlObj_ChangeControlPropertyAttributes(ControlObject *_self, PyObject *_args) |
|---|
| 1072 | n/a | { |
|---|
| 1073 | n/a | PyObject *_res = NULL; |
|---|
| 1074 | n/a | OSStatus _err; |
|---|
| 1075 | n/a | OSType propertyCreator; |
|---|
| 1076 | n/a | OSType propertyTag; |
|---|
| 1077 | n/a | UInt32 attributesToSet; |
|---|
| 1078 | n/a | UInt32 attributesToClear; |
|---|
| 1079 | n/a | #ifndef ChangeControlPropertyAttributes |
|---|
| 1080 | n/a | PyMac_PRECHECK(ChangeControlPropertyAttributes); |
|---|
| 1081 | n/a | #endif |
|---|
| 1082 | n/a | if (!PyArg_ParseTuple(_args, "O&O&ll", |
|---|
| 1083 | n/a | PyMac_GetOSType, &propertyCreator, |
|---|
| 1084 | n/a | PyMac_GetOSType, &propertyTag, |
|---|
| 1085 | n/a | &attributesToSet, |
|---|
| 1086 | n/a | &attributesToClear)) |
|---|
| 1087 | n/a | return NULL; |
|---|
| 1088 | n/a | _err = ChangeControlPropertyAttributes(_self->ob_itself, |
|---|
| 1089 | n/a | propertyCreator, |
|---|
| 1090 | n/a | propertyTag, |
|---|
| 1091 | n/a | attributesToSet, |
|---|
| 1092 | n/a | attributesToClear); |
|---|
| 1093 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1094 | n/a | Py_INCREF(Py_None); |
|---|
| 1095 | n/a | _res = Py_None; |
|---|
| 1096 | n/a | return _res; |
|---|
| 1097 | n/a | } |
|---|
| 1098 | n/a | |
|---|
| 1099 | n/a | static PyObject *CtlObj_GetControlRegion(ControlObject *_self, PyObject *_args) |
|---|
| 1100 | n/a | { |
|---|
| 1101 | n/a | PyObject *_res = NULL; |
|---|
| 1102 | n/a | OSStatus _err; |
|---|
| 1103 | n/a | ControlPartCode inPart; |
|---|
| 1104 | n/a | RgnHandle outRegion; |
|---|
| 1105 | n/a | #ifndef GetControlRegion |
|---|
| 1106 | n/a | PyMac_PRECHECK(GetControlRegion); |
|---|
| 1107 | n/a | #endif |
|---|
| 1108 | n/a | if (!PyArg_ParseTuple(_args, "hO&", |
|---|
| 1109 | n/a | &inPart, |
|---|
| 1110 | n/a | ResObj_Convert, &outRegion)) |
|---|
| 1111 | n/a | return NULL; |
|---|
| 1112 | n/a | _err = GetControlRegion(_self->ob_itself, |
|---|
| 1113 | n/a | inPart, |
|---|
| 1114 | n/a | outRegion); |
|---|
| 1115 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1116 | n/a | Py_INCREF(Py_None); |
|---|
| 1117 | n/a | _res = Py_None; |
|---|
| 1118 | n/a | return _res; |
|---|
| 1119 | n/a | } |
|---|
| 1120 | n/a | |
|---|
| 1121 | n/a | static PyObject *CtlObj_GetControlVariant(ControlObject *_self, PyObject *_args) |
|---|
| 1122 | n/a | { |
|---|
| 1123 | n/a | PyObject *_res = NULL; |
|---|
| 1124 | n/a | ControlVariant _rv; |
|---|
| 1125 | n/a | #ifndef GetControlVariant |
|---|
| 1126 | n/a | PyMac_PRECHECK(GetControlVariant); |
|---|
| 1127 | n/a | #endif |
|---|
| 1128 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1129 | n/a | return NULL; |
|---|
| 1130 | n/a | _rv = GetControlVariant(_self->ob_itself); |
|---|
| 1131 | n/a | _res = Py_BuildValue("h", |
|---|
| 1132 | n/a | _rv); |
|---|
| 1133 | n/a | return _res; |
|---|
| 1134 | n/a | } |
|---|
| 1135 | n/a | |
|---|
| 1136 | n/a | static PyObject *CtlObj_SetControlAction(ControlObject *_self, PyObject *_args) |
|---|
| 1137 | n/a | { |
|---|
| 1138 | n/a | PyObject *_res = NULL; |
|---|
| 1139 | n/a | PyObject* actionProc; |
|---|
| 1140 | n/a | UniversalProcPtr c_callback; |
|---|
| 1141 | n/a | #ifndef SetControlAction |
|---|
| 1142 | n/a | PyMac_PRECHECK(SetControlAction); |
|---|
| 1143 | n/a | #endif |
|---|
| 1144 | n/a | if (!PyArg_ParseTuple(_args, "O", |
|---|
| 1145 | n/a | &actionProc)) |
|---|
| 1146 | n/a | return NULL; |
|---|
| 1147 | n/a | SetControlAction(_self->ob_itself, |
|---|
| 1148 | n/a | myactionproc_upp); |
|---|
| 1149 | n/a | Py_INCREF(Py_None); |
|---|
| 1150 | n/a | _res = Py_None; |
|---|
| 1151 | n/a | setcallback((PyObject*)_self, kMyControlActionProcTag, actionProc, &c_callback); |
|---|
| 1152 | n/a | return _res; |
|---|
| 1153 | n/a | } |
|---|
| 1154 | n/a | |
|---|
| 1155 | n/a | static PyObject *CtlObj_SetControlReference(ControlObject *_self, PyObject *_args) |
|---|
| 1156 | n/a | { |
|---|
| 1157 | n/a | PyObject *_res = NULL; |
|---|
| 1158 | n/a | SInt32 data; |
|---|
| 1159 | n/a | #ifndef SetControlReference |
|---|
| 1160 | n/a | PyMac_PRECHECK(SetControlReference); |
|---|
| 1161 | n/a | #endif |
|---|
| 1162 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 1163 | n/a | &data)) |
|---|
| 1164 | n/a | return NULL; |
|---|
| 1165 | n/a | SetControlReference(_self->ob_itself, |
|---|
| 1166 | n/a | data); |
|---|
| 1167 | n/a | Py_INCREF(Py_None); |
|---|
| 1168 | n/a | _res = Py_None; |
|---|
| 1169 | n/a | return _res; |
|---|
| 1170 | n/a | } |
|---|
| 1171 | n/a | |
|---|
| 1172 | n/a | static PyObject *CtlObj_GetControlReference(ControlObject *_self, PyObject *_args) |
|---|
| 1173 | n/a | { |
|---|
| 1174 | n/a | PyObject *_res = NULL; |
|---|
| 1175 | n/a | SInt32 _rv; |
|---|
| 1176 | n/a | #ifndef GetControlReference |
|---|
| 1177 | n/a | PyMac_PRECHECK(GetControlReference); |
|---|
| 1178 | n/a | #endif |
|---|
| 1179 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1180 | n/a | return NULL; |
|---|
| 1181 | n/a | _rv = GetControlReference(_self->ob_itself); |
|---|
| 1182 | n/a | _res = Py_BuildValue("l", |
|---|
| 1183 | n/a | _rv); |
|---|
| 1184 | n/a | return _res; |
|---|
| 1185 | n/a | } |
|---|
| 1186 | n/a | |
|---|
| 1187 | n/a | static PyObject *CtlObj_EmbedControl(ControlObject *_self, PyObject *_args) |
|---|
| 1188 | n/a | { |
|---|
| 1189 | n/a | PyObject *_res = NULL; |
|---|
| 1190 | n/a | OSErr _err; |
|---|
| 1191 | n/a | ControlHandle inContainer; |
|---|
| 1192 | n/a | #ifndef EmbedControl |
|---|
| 1193 | n/a | PyMac_PRECHECK(EmbedControl); |
|---|
| 1194 | n/a | #endif |
|---|
| 1195 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1196 | n/a | CtlObj_Convert, &inContainer)) |
|---|
| 1197 | n/a | return NULL; |
|---|
| 1198 | n/a | _err = EmbedControl(_self->ob_itself, |
|---|
| 1199 | n/a | inContainer); |
|---|
| 1200 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1201 | n/a | Py_INCREF(Py_None); |
|---|
| 1202 | n/a | _res = Py_None; |
|---|
| 1203 | n/a | return _res; |
|---|
| 1204 | n/a | } |
|---|
| 1205 | n/a | |
|---|
| 1206 | n/a | static PyObject *CtlObj_AutoEmbedControl(ControlObject *_self, PyObject *_args) |
|---|
| 1207 | n/a | { |
|---|
| 1208 | n/a | PyObject *_res = NULL; |
|---|
| 1209 | n/a | OSErr _err; |
|---|
| 1210 | n/a | WindowPtr inWindow; |
|---|
| 1211 | n/a | #ifndef AutoEmbedControl |
|---|
| 1212 | n/a | PyMac_PRECHECK(AutoEmbedControl); |
|---|
| 1213 | n/a | #endif |
|---|
| 1214 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1215 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 1216 | n/a | return NULL; |
|---|
| 1217 | n/a | _err = AutoEmbedControl(_self->ob_itself, |
|---|
| 1218 | n/a | inWindow); |
|---|
| 1219 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1220 | n/a | Py_INCREF(Py_None); |
|---|
| 1221 | n/a | _res = Py_None; |
|---|
| 1222 | n/a | return _res; |
|---|
| 1223 | n/a | } |
|---|
| 1224 | n/a | |
|---|
| 1225 | n/a | static PyObject *CtlObj_GetSuperControl(ControlObject *_self, PyObject *_args) |
|---|
| 1226 | n/a | { |
|---|
| 1227 | n/a | PyObject *_res = NULL; |
|---|
| 1228 | n/a | OSErr _err; |
|---|
| 1229 | n/a | ControlHandle outParent; |
|---|
| 1230 | n/a | #ifndef GetSuperControl |
|---|
| 1231 | n/a | PyMac_PRECHECK(GetSuperControl); |
|---|
| 1232 | n/a | #endif |
|---|
| 1233 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1234 | n/a | return NULL; |
|---|
| 1235 | n/a | _err = GetSuperControl(_self->ob_itself, |
|---|
| 1236 | n/a | &outParent); |
|---|
| 1237 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1238 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1239 | n/a | CtlObj_WhichControl, outParent); |
|---|
| 1240 | n/a | return _res; |
|---|
| 1241 | n/a | } |
|---|
| 1242 | n/a | |
|---|
| 1243 | n/a | static PyObject *CtlObj_CountSubControls(ControlObject *_self, PyObject *_args) |
|---|
| 1244 | n/a | { |
|---|
| 1245 | n/a | PyObject *_res = NULL; |
|---|
| 1246 | n/a | OSErr _err; |
|---|
| 1247 | n/a | UInt16 outNumChildren; |
|---|
| 1248 | n/a | #ifndef CountSubControls |
|---|
| 1249 | n/a | PyMac_PRECHECK(CountSubControls); |
|---|
| 1250 | n/a | #endif |
|---|
| 1251 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1252 | n/a | return NULL; |
|---|
| 1253 | n/a | _err = CountSubControls(_self->ob_itself, |
|---|
| 1254 | n/a | &outNumChildren); |
|---|
| 1255 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1256 | n/a | _res = Py_BuildValue("H", |
|---|
| 1257 | n/a | outNumChildren); |
|---|
| 1258 | n/a | return _res; |
|---|
| 1259 | n/a | } |
|---|
| 1260 | n/a | |
|---|
| 1261 | n/a | static PyObject *CtlObj_GetIndexedSubControl(ControlObject *_self, PyObject *_args) |
|---|
| 1262 | n/a | { |
|---|
| 1263 | n/a | PyObject *_res = NULL; |
|---|
| 1264 | n/a | OSErr _err; |
|---|
| 1265 | n/a | UInt16 inIndex; |
|---|
| 1266 | n/a | ControlHandle outSubControl; |
|---|
| 1267 | n/a | #ifndef GetIndexedSubControl |
|---|
| 1268 | n/a | PyMac_PRECHECK(GetIndexedSubControl); |
|---|
| 1269 | n/a | #endif |
|---|
| 1270 | n/a | if (!PyArg_ParseTuple(_args, "H", |
|---|
| 1271 | n/a | &inIndex)) |
|---|
| 1272 | n/a | return NULL; |
|---|
| 1273 | n/a | _err = GetIndexedSubControl(_self->ob_itself, |
|---|
| 1274 | n/a | inIndex, |
|---|
| 1275 | n/a | &outSubControl); |
|---|
| 1276 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1277 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1278 | n/a | CtlObj_WhichControl, outSubControl); |
|---|
| 1279 | n/a | return _res; |
|---|
| 1280 | n/a | } |
|---|
| 1281 | n/a | |
|---|
| 1282 | n/a | static PyObject *CtlObj_SetControlSupervisor(ControlObject *_self, PyObject *_args) |
|---|
| 1283 | n/a | { |
|---|
| 1284 | n/a | PyObject *_res = NULL; |
|---|
| 1285 | n/a | OSErr _err; |
|---|
| 1286 | n/a | ControlHandle inBoss; |
|---|
| 1287 | n/a | #ifndef SetControlSupervisor |
|---|
| 1288 | n/a | PyMac_PRECHECK(SetControlSupervisor); |
|---|
| 1289 | n/a | #endif |
|---|
| 1290 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1291 | n/a | CtlObj_Convert, &inBoss)) |
|---|
| 1292 | n/a | return NULL; |
|---|
| 1293 | n/a | _err = SetControlSupervisor(_self->ob_itself, |
|---|
| 1294 | n/a | inBoss); |
|---|
| 1295 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1296 | n/a | Py_INCREF(Py_None); |
|---|
| 1297 | n/a | _res = Py_None; |
|---|
| 1298 | n/a | return _res; |
|---|
| 1299 | n/a | } |
|---|
| 1300 | n/a | |
|---|
| 1301 | n/a | static PyObject *CtlObj_GetControlFeatures(ControlObject *_self, PyObject *_args) |
|---|
| 1302 | n/a | { |
|---|
| 1303 | n/a | PyObject *_res = NULL; |
|---|
| 1304 | n/a | OSErr _err; |
|---|
| 1305 | n/a | UInt32 outFeatures; |
|---|
| 1306 | n/a | #ifndef GetControlFeatures |
|---|
| 1307 | n/a | PyMac_PRECHECK(GetControlFeatures); |
|---|
| 1308 | n/a | #endif |
|---|
| 1309 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1310 | n/a | return NULL; |
|---|
| 1311 | n/a | _err = GetControlFeatures(_self->ob_itself, |
|---|
| 1312 | n/a | &outFeatures); |
|---|
| 1313 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1314 | n/a | _res = Py_BuildValue("l", |
|---|
| 1315 | n/a | outFeatures); |
|---|
| 1316 | n/a | return _res; |
|---|
| 1317 | n/a | } |
|---|
| 1318 | n/a | |
|---|
| 1319 | n/a | static PyObject *CtlObj_GetControlDataSize(ControlObject *_self, PyObject *_args) |
|---|
| 1320 | n/a | { |
|---|
| 1321 | n/a | PyObject *_res = NULL; |
|---|
| 1322 | n/a | OSErr _err; |
|---|
| 1323 | n/a | ControlPartCode inPart; |
|---|
| 1324 | n/a | ResType inTagName; |
|---|
| 1325 | n/a | Size outMaxSize; |
|---|
| 1326 | n/a | #ifndef GetControlDataSize |
|---|
| 1327 | n/a | PyMac_PRECHECK(GetControlDataSize); |
|---|
| 1328 | n/a | #endif |
|---|
| 1329 | n/a | if (!PyArg_ParseTuple(_args, "hO&", |
|---|
| 1330 | n/a | &inPart, |
|---|
| 1331 | n/a | PyMac_GetOSType, &inTagName)) |
|---|
| 1332 | n/a | return NULL; |
|---|
| 1333 | n/a | _err = GetControlDataSize(_self->ob_itself, |
|---|
| 1334 | n/a | inPart, |
|---|
| 1335 | n/a | inTagName, |
|---|
| 1336 | n/a | &outMaxSize); |
|---|
| 1337 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1338 | n/a | _res = Py_BuildValue("l", |
|---|
| 1339 | n/a | outMaxSize); |
|---|
| 1340 | n/a | return _res; |
|---|
| 1341 | n/a | } |
|---|
| 1342 | n/a | |
|---|
| 1343 | n/a | static PyObject *CtlObj_HandleControlDragTracking(ControlObject *_self, PyObject *_args) |
|---|
| 1344 | n/a | { |
|---|
| 1345 | n/a | PyObject *_res = NULL; |
|---|
| 1346 | n/a | OSStatus _err; |
|---|
| 1347 | n/a | DragTrackingMessage inMessage; |
|---|
| 1348 | n/a | DragReference inDrag; |
|---|
| 1349 | n/a | Boolean outLikesDrag; |
|---|
| 1350 | n/a | #ifndef HandleControlDragTracking |
|---|
| 1351 | n/a | PyMac_PRECHECK(HandleControlDragTracking); |
|---|
| 1352 | n/a | #endif |
|---|
| 1353 | n/a | if (!PyArg_ParseTuple(_args, "hO&", |
|---|
| 1354 | n/a | &inMessage, |
|---|
| 1355 | n/a | DragObj_Convert, &inDrag)) |
|---|
| 1356 | n/a | return NULL; |
|---|
| 1357 | n/a | _err = HandleControlDragTracking(_self->ob_itself, |
|---|
| 1358 | n/a | inMessage, |
|---|
| 1359 | n/a | inDrag, |
|---|
| 1360 | n/a | &outLikesDrag); |
|---|
| 1361 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1362 | n/a | _res = Py_BuildValue("b", |
|---|
| 1363 | n/a | outLikesDrag); |
|---|
| 1364 | n/a | return _res; |
|---|
| 1365 | n/a | } |
|---|
| 1366 | n/a | |
|---|
| 1367 | n/a | static PyObject *CtlObj_HandleControlDragReceive(ControlObject *_self, PyObject *_args) |
|---|
| 1368 | n/a | { |
|---|
| 1369 | n/a | PyObject *_res = NULL; |
|---|
| 1370 | n/a | OSStatus _err; |
|---|
| 1371 | n/a | DragReference inDrag; |
|---|
| 1372 | n/a | #ifndef HandleControlDragReceive |
|---|
| 1373 | n/a | PyMac_PRECHECK(HandleControlDragReceive); |
|---|
| 1374 | n/a | #endif |
|---|
| 1375 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1376 | n/a | DragObj_Convert, &inDrag)) |
|---|
| 1377 | n/a | return NULL; |
|---|
| 1378 | n/a | _err = HandleControlDragReceive(_self->ob_itself, |
|---|
| 1379 | n/a | inDrag); |
|---|
| 1380 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1381 | n/a | Py_INCREF(Py_None); |
|---|
| 1382 | n/a | _res = Py_None; |
|---|
| 1383 | n/a | return _res; |
|---|
| 1384 | n/a | } |
|---|
| 1385 | n/a | |
|---|
| 1386 | n/a | static PyObject *CtlObj_SetControlDragTrackingEnabled(ControlObject *_self, PyObject *_args) |
|---|
| 1387 | n/a | { |
|---|
| 1388 | n/a | PyObject *_res = NULL; |
|---|
| 1389 | n/a | OSStatus _err; |
|---|
| 1390 | n/a | Boolean inTracks; |
|---|
| 1391 | n/a | #ifndef SetControlDragTrackingEnabled |
|---|
| 1392 | n/a | PyMac_PRECHECK(SetControlDragTrackingEnabled); |
|---|
| 1393 | n/a | #endif |
|---|
| 1394 | n/a | if (!PyArg_ParseTuple(_args, "b", |
|---|
| 1395 | n/a | &inTracks)) |
|---|
| 1396 | n/a | return NULL; |
|---|
| 1397 | n/a | _err = SetControlDragTrackingEnabled(_self->ob_itself, |
|---|
| 1398 | n/a | inTracks); |
|---|
| 1399 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1400 | n/a | Py_INCREF(Py_None); |
|---|
| 1401 | n/a | _res = Py_None; |
|---|
| 1402 | n/a | return _res; |
|---|
| 1403 | n/a | } |
|---|
| 1404 | n/a | |
|---|
| 1405 | n/a | static PyObject *CtlObj_IsControlDragTrackingEnabled(ControlObject *_self, PyObject *_args) |
|---|
| 1406 | n/a | { |
|---|
| 1407 | n/a | PyObject *_res = NULL; |
|---|
| 1408 | n/a | OSStatus _err; |
|---|
| 1409 | n/a | Boolean outTracks; |
|---|
| 1410 | n/a | #ifndef IsControlDragTrackingEnabled |
|---|
| 1411 | n/a | PyMac_PRECHECK(IsControlDragTrackingEnabled); |
|---|
| 1412 | n/a | #endif |
|---|
| 1413 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1414 | n/a | return NULL; |
|---|
| 1415 | n/a | _err = IsControlDragTrackingEnabled(_self->ob_itself, |
|---|
| 1416 | n/a | &outTracks); |
|---|
| 1417 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1418 | n/a | _res = Py_BuildValue("b", |
|---|
| 1419 | n/a | outTracks); |
|---|
| 1420 | n/a | return _res; |
|---|
| 1421 | n/a | } |
|---|
| 1422 | n/a | |
|---|
| 1423 | n/a | static PyObject *CtlObj_GetControlBounds(ControlObject *_self, PyObject *_args) |
|---|
| 1424 | n/a | { |
|---|
| 1425 | n/a | PyObject *_res = NULL; |
|---|
| 1426 | n/a | Rect bounds; |
|---|
| 1427 | n/a | #ifndef GetControlBounds |
|---|
| 1428 | n/a | PyMac_PRECHECK(GetControlBounds); |
|---|
| 1429 | n/a | #endif |
|---|
| 1430 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1431 | n/a | return NULL; |
|---|
| 1432 | n/a | GetControlBounds(_self->ob_itself, |
|---|
| 1433 | n/a | &bounds); |
|---|
| 1434 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1435 | n/a | PyMac_BuildRect, &bounds); |
|---|
| 1436 | n/a | return _res; |
|---|
| 1437 | n/a | } |
|---|
| 1438 | n/a | |
|---|
| 1439 | n/a | static PyObject *CtlObj_IsControlHilited(ControlObject *_self, PyObject *_args) |
|---|
| 1440 | n/a | { |
|---|
| 1441 | n/a | PyObject *_res = NULL; |
|---|
| 1442 | n/a | Boolean _rv; |
|---|
| 1443 | n/a | #ifndef IsControlHilited |
|---|
| 1444 | n/a | PyMac_PRECHECK(IsControlHilited); |
|---|
| 1445 | n/a | #endif |
|---|
| 1446 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1447 | n/a | return NULL; |
|---|
| 1448 | n/a | _rv = IsControlHilited(_self->ob_itself); |
|---|
| 1449 | n/a | _res = Py_BuildValue("b", |
|---|
| 1450 | n/a | _rv); |
|---|
| 1451 | n/a | return _res; |
|---|
| 1452 | n/a | } |
|---|
| 1453 | n/a | |
|---|
| 1454 | n/a | static PyObject *CtlObj_GetControlHilite(ControlObject *_self, PyObject *_args) |
|---|
| 1455 | n/a | { |
|---|
| 1456 | n/a | PyObject *_res = NULL; |
|---|
| 1457 | n/a | UInt16 _rv; |
|---|
| 1458 | n/a | #ifndef GetControlHilite |
|---|
| 1459 | n/a | PyMac_PRECHECK(GetControlHilite); |
|---|
| 1460 | n/a | #endif |
|---|
| 1461 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1462 | n/a | return NULL; |
|---|
| 1463 | n/a | _rv = GetControlHilite(_self->ob_itself); |
|---|
| 1464 | n/a | _res = Py_BuildValue("H", |
|---|
| 1465 | n/a | _rv); |
|---|
| 1466 | n/a | return _res; |
|---|
| 1467 | n/a | } |
|---|
| 1468 | n/a | |
|---|
| 1469 | n/a | static PyObject *CtlObj_GetControlOwner(ControlObject *_self, PyObject *_args) |
|---|
| 1470 | n/a | { |
|---|
| 1471 | n/a | PyObject *_res = NULL; |
|---|
| 1472 | n/a | WindowPtr _rv; |
|---|
| 1473 | n/a | #ifndef GetControlOwner |
|---|
| 1474 | n/a | PyMac_PRECHECK(GetControlOwner); |
|---|
| 1475 | n/a | #endif |
|---|
| 1476 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1477 | n/a | return NULL; |
|---|
| 1478 | n/a | _rv = GetControlOwner(_self->ob_itself); |
|---|
| 1479 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1480 | n/a | WinObj_New, _rv); |
|---|
| 1481 | n/a | return _res; |
|---|
| 1482 | n/a | } |
|---|
| 1483 | n/a | |
|---|
| 1484 | n/a | static PyObject *CtlObj_GetControlDataHandle(ControlObject *_self, PyObject *_args) |
|---|
| 1485 | n/a | { |
|---|
| 1486 | n/a | PyObject *_res = NULL; |
|---|
| 1487 | n/a | Handle _rv; |
|---|
| 1488 | n/a | #ifndef GetControlDataHandle |
|---|
| 1489 | n/a | PyMac_PRECHECK(GetControlDataHandle); |
|---|
| 1490 | n/a | #endif |
|---|
| 1491 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1492 | n/a | return NULL; |
|---|
| 1493 | n/a | _rv = GetControlDataHandle(_self->ob_itself); |
|---|
| 1494 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1495 | n/a | ResObj_New, _rv); |
|---|
| 1496 | n/a | return _res; |
|---|
| 1497 | n/a | } |
|---|
| 1498 | n/a | |
|---|
| 1499 | n/a | static PyObject *CtlObj_GetControlPopupMenuHandle(ControlObject *_self, PyObject *_args) |
|---|
| 1500 | n/a | { |
|---|
| 1501 | n/a | PyObject *_res = NULL; |
|---|
| 1502 | n/a | MenuHandle _rv; |
|---|
| 1503 | n/a | #ifndef GetControlPopupMenuHandle |
|---|
| 1504 | n/a | PyMac_PRECHECK(GetControlPopupMenuHandle); |
|---|
| 1505 | n/a | #endif |
|---|
| 1506 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1507 | n/a | return NULL; |
|---|
| 1508 | n/a | _rv = GetControlPopupMenuHandle(_self->ob_itself); |
|---|
| 1509 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1510 | n/a | MenuObj_New, _rv); |
|---|
| 1511 | n/a | return _res; |
|---|
| 1512 | n/a | } |
|---|
| 1513 | n/a | |
|---|
| 1514 | n/a | static PyObject *CtlObj_GetControlPopupMenuID(ControlObject *_self, PyObject *_args) |
|---|
| 1515 | n/a | { |
|---|
| 1516 | n/a | PyObject *_res = NULL; |
|---|
| 1517 | n/a | short _rv; |
|---|
| 1518 | n/a | #ifndef GetControlPopupMenuID |
|---|
| 1519 | n/a | PyMac_PRECHECK(GetControlPopupMenuID); |
|---|
| 1520 | n/a | #endif |
|---|
| 1521 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1522 | n/a | return NULL; |
|---|
| 1523 | n/a | _rv = GetControlPopupMenuID(_self->ob_itself); |
|---|
| 1524 | n/a | _res = Py_BuildValue("h", |
|---|
| 1525 | n/a | _rv); |
|---|
| 1526 | n/a | return _res; |
|---|
| 1527 | n/a | } |
|---|
| 1528 | n/a | |
|---|
| 1529 | n/a | static PyObject *CtlObj_SetControlDataHandle(ControlObject *_self, PyObject *_args) |
|---|
| 1530 | n/a | { |
|---|
| 1531 | n/a | PyObject *_res = NULL; |
|---|
| 1532 | n/a | Handle dataHandle; |
|---|
| 1533 | n/a | #ifndef SetControlDataHandle |
|---|
| 1534 | n/a | PyMac_PRECHECK(SetControlDataHandle); |
|---|
| 1535 | n/a | #endif |
|---|
| 1536 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1537 | n/a | ResObj_Convert, &dataHandle)) |
|---|
| 1538 | n/a | return NULL; |
|---|
| 1539 | n/a | SetControlDataHandle(_self->ob_itself, |
|---|
| 1540 | n/a | dataHandle); |
|---|
| 1541 | n/a | Py_INCREF(Py_None); |
|---|
| 1542 | n/a | _res = Py_None; |
|---|
| 1543 | n/a | return _res; |
|---|
| 1544 | n/a | } |
|---|
| 1545 | n/a | |
|---|
| 1546 | n/a | static PyObject *CtlObj_SetControlBounds(ControlObject *_self, PyObject *_args) |
|---|
| 1547 | n/a | { |
|---|
| 1548 | n/a | PyObject *_res = NULL; |
|---|
| 1549 | n/a | Rect bounds; |
|---|
| 1550 | n/a | #ifndef SetControlBounds |
|---|
| 1551 | n/a | PyMac_PRECHECK(SetControlBounds); |
|---|
| 1552 | n/a | #endif |
|---|
| 1553 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1554 | n/a | PyMac_GetRect, &bounds)) |
|---|
| 1555 | n/a | return NULL; |
|---|
| 1556 | n/a | SetControlBounds(_self->ob_itself, |
|---|
| 1557 | n/a | &bounds); |
|---|
| 1558 | n/a | Py_INCREF(Py_None); |
|---|
| 1559 | n/a | _res = Py_None; |
|---|
| 1560 | n/a | return _res; |
|---|
| 1561 | n/a | } |
|---|
| 1562 | n/a | |
|---|
| 1563 | n/a | static PyObject *CtlObj_SetControlPopupMenuHandle(ControlObject *_self, PyObject *_args) |
|---|
| 1564 | n/a | { |
|---|
| 1565 | n/a | PyObject *_res = NULL; |
|---|
| 1566 | n/a | MenuHandle popupMenu; |
|---|
| 1567 | n/a | #ifndef SetControlPopupMenuHandle |
|---|
| 1568 | n/a | PyMac_PRECHECK(SetControlPopupMenuHandle); |
|---|
| 1569 | n/a | #endif |
|---|
| 1570 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1571 | n/a | MenuObj_Convert, &popupMenu)) |
|---|
| 1572 | n/a | return NULL; |
|---|
| 1573 | n/a | SetControlPopupMenuHandle(_self->ob_itself, |
|---|
| 1574 | n/a | popupMenu); |
|---|
| 1575 | n/a | Py_INCREF(Py_None); |
|---|
| 1576 | n/a | _res = Py_None; |
|---|
| 1577 | n/a | return _res; |
|---|
| 1578 | n/a | } |
|---|
| 1579 | n/a | |
|---|
| 1580 | n/a | static PyObject *CtlObj_SetControlPopupMenuID(ControlObject *_self, PyObject *_args) |
|---|
| 1581 | n/a | { |
|---|
| 1582 | n/a | PyObject *_res = NULL; |
|---|
| 1583 | n/a | short menuID; |
|---|
| 1584 | n/a | #ifndef SetControlPopupMenuID |
|---|
| 1585 | n/a | PyMac_PRECHECK(SetControlPopupMenuID); |
|---|
| 1586 | n/a | #endif |
|---|
| 1587 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 1588 | n/a | &menuID)) |
|---|
| 1589 | n/a | return NULL; |
|---|
| 1590 | n/a | SetControlPopupMenuID(_self->ob_itself, |
|---|
| 1591 | n/a | menuID); |
|---|
| 1592 | n/a | Py_INCREF(Py_None); |
|---|
| 1593 | n/a | _res = Py_None; |
|---|
| 1594 | n/a | return _res; |
|---|
| 1595 | n/a | } |
|---|
| 1596 | n/a | |
|---|
| 1597 | n/a | static PyObject *CtlObj_GetBevelButtonMenuValue(ControlObject *_self, PyObject *_args) |
|---|
| 1598 | n/a | { |
|---|
| 1599 | n/a | PyObject *_res = NULL; |
|---|
| 1600 | n/a | OSErr _err; |
|---|
| 1601 | n/a | UInt16 outValue; |
|---|
| 1602 | n/a | #ifndef GetBevelButtonMenuValue |
|---|
| 1603 | n/a | PyMac_PRECHECK(GetBevelButtonMenuValue); |
|---|
| 1604 | n/a | #endif |
|---|
| 1605 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1606 | n/a | return NULL; |
|---|
| 1607 | n/a | _err = GetBevelButtonMenuValue(_self->ob_itself, |
|---|
| 1608 | n/a | &outValue); |
|---|
| 1609 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1610 | n/a | _res = Py_BuildValue("h", |
|---|
| 1611 | n/a | outValue); |
|---|
| 1612 | n/a | return _res; |
|---|
| 1613 | n/a | } |
|---|
| 1614 | n/a | |
|---|
| 1615 | n/a | static PyObject *CtlObj_SetBevelButtonMenuValue(ControlObject *_self, PyObject *_args) |
|---|
| 1616 | n/a | { |
|---|
| 1617 | n/a | PyObject *_res = NULL; |
|---|
| 1618 | n/a | OSErr _err; |
|---|
| 1619 | n/a | SInt16 inValue; |
|---|
| 1620 | n/a | #ifndef SetBevelButtonMenuValue |
|---|
| 1621 | n/a | PyMac_PRECHECK(SetBevelButtonMenuValue); |
|---|
| 1622 | n/a | #endif |
|---|
| 1623 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 1624 | n/a | &inValue)) |
|---|
| 1625 | n/a | return NULL; |
|---|
| 1626 | n/a | _err = SetBevelButtonMenuValue(_self->ob_itself, |
|---|
| 1627 | n/a | inValue); |
|---|
| 1628 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1629 | n/a | Py_INCREF(Py_None); |
|---|
| 1630 | n/a | _res = Py_None; |
|---|
| 1631 | n/a | return _res; |
|---|
| 1632 | n/a | } |
|---|
| 1633 | n/a | |
|---|
| 1634 | n/a | static PyObject *CtlObj_GetBevelButtonMenuHandle(ControlObject *_self, PyObject *_args) |
|---|
| 1635 | n/a | { |
|---|
| 1636 | n/a | PyObject *_res = NULL; |
|---|
| 1637 | n/a | OSErr _err; |
|---|
| 1638 | n/a | MenuHandle outHandle; |
|---|
| 1639 | n/a | #ifndef GetBevelButtonMenuHandle |
|---|
| 1640 | n/a | PyMac_PRECHECK(GetBevelButtonMenuHandle); |
|---|
| 1641 | n/a | #endif |
|---|
| 1642 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1643 | n/a | return NULL; |
|---|
| 1644 | n/a | _err = GetBevelButtonMenuHandle(_self->ob_itself, |
|---|
| 1645 | n/a | &outHandle); |
|---|
| 1646 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1647 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1648 | n/a | MenuObj_New, outHandle); |
|---|
| 1649 | n/a | return _res; |
|---|
| 1650 | n/a | } |
|---|
| 1651 | n/a | |
|---|
| 1652 | n/a | static PyObject *CtlObj_SetBevelButtonContentInfo(ControlObject *_self, PyObject *_args) |
|---|
| 1653 | n/a | { |
|---|
| 1654 | n/a | PyObject *_res = NULL; |
|---|
| 1655 | n/a | OSErr _err; |
|---|
| 1656 | n/a | ControlButtonContentInfo inContent; |
|---|
| 1657 | n/a | #ifndef SetBevelButtonContentInfo |
|---|
| 1658 | n/a | PyMac_PRECHECK(SetBevelButtonContentInfo); |
|---|
| 1659 | n/a | #endif |
|---|
| 1660 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1661 | n/a | ControlButtonContentInfo_Convert, &inContent)) |
|---|
| 1662 | n/a | return NULL; |
|---|
| 1663 | n/a | _err = SetBevelButtonContentInfo(_self->ob_itself, |
|---|
| 1664 | n/a | &inContent); |
|---|
| 1665 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1666 | n/a | Py_INCREF(Py_None); |
|---|
| 1667 | n/a | _res = Py_None; |
|---|
| 1668 | n/a | return _res; |
|---|
| 1669 | n/a | } |
|---|
| 1670 | n/a | |
|---|
| 1671 | n/a | static PyObject *CtlObj_SetBevelButtonTransform(ControlObject *_self, PyObject *_args) |
|---|
| 1672 | n/a | { |
|---|
| 1673 | n/a | PyObject *_res = NULL; |
|---|
| 1674 | n/a | OSErr _err; |
|---|
| 1675 | n/a | IconTransformType transform; |
|---|
| 1676 | n/a | #ifndef SetBevelButtonTransform |
|---|
| 1677 | n/a | PyMac_PRECHECK(SetBevelButtonTransform); |
|---|
| 1678 | n/a | #endif |
|---|
| 1679 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 1680 | n/a | &transform)) |
|---|
| 1681 | n/a | return NULL; |
|---|
| 1682 | n/a | _err = SetBevelButtonTransform(_self->ob_itself, |
|---|
| 1683 | n/a | transform); |
|---|
| 1684 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1685 | n/a | Py_INCREF(Py_None); |
|---|
| 1686 | n/a | _res = Py_None; |
|---|
| 1687 | n/a | return _res; |
|---|
| 1688 | n/a | } |
|---|
| 1689 | n/a | |
|---|
| 1690 | n/a | static PyObject *CtlObj_SetDisclosureTriangleLastValue(ControlObject *_self, PyObject *_args) |
|---|
| 1691 | n/a | { |
|---|
| 1692 | n/a | PyObject *_res = NULL; |
|---|
| 1693 | n/a | OSErr _err; |
|---|
| 1694 | n/a | SInt16 inValue; |
|---|
| 1695 | n/a | #ifndef SetDisclosureTriangleLastValue |
|---|
| 1696 | n/a | PyMac_PRECHECK(SetDisclosureTriangleLastValue); |
|---|
| 1697 | n/a | #endif |
|---|
| 1698 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 1699 | n/a | &inValue)) |
|---|
| 1700 | n/a | return NULL; |
|---|
| 1701 | n/a | _err = SetDisclosureTriangleLastValue(_self->ob_itself, |
|---|
| 1702 | n/a | inValue); |
|---|
| 1703 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1704 | n/a | Py_INCREF(Py_None); |
|---|
| 1705 | n/a | _res = Py_None; |
|---|
| 1706 | n/a | return _res; |
|---|
| 1707 | n/a | } |
|---|
| 1708 | n/a | |
|---|
| 1709 | n/a | static PyObject *CtlObj_GetTabContentRect(ControlObject *_self, PyObject *_args) |
|---|
| 1710 | n/a | { |
|---|
| 1711 | n/a | PyObject *_res = NULL; |
|---|
| 1712 | n/a | OSErr _err; |
|---|
| 1713 | n/a | Rect outContentRect; |
|---|
| 1714 | n/a | #ifndef GetTabContentRect |
|---|
| 1715 | n/a | PyMac_PRECHECK(GetTabContentRect); |
|---|
| 1716 | n/a | #endif |
|---|
| 1717 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1718 | n/a | return NULL; |
|---|
| 1719 | n/a | _err = GetTabContentRect(_self->ob_itself, |
|---|
| 1720 | n/a | &outContentRect); |
|---|
| 1721 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1722 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1723 | n/a | PyMac_BuildRect, &outContentRect); |
|---|
| 1724 | n/a | return _res; |
|---|
| 1725 | n/a | } |
|---|
| 1726 | n/a | |
|---|
| 1727 | n/a | static PyObject *CtlObj_SetTabEnabled(ControlObject *_self, PyObject *_args) |
|---|
| 1728 | n/a | { |
|---|
| 1729 | n/a | PyObject *_res = NULL; |
|---|
| 1730 | n/a | OSErr _err; |
|---|
| 1731 | n/a | SInt16 inTabToHilite; |
|---|
| 1732 | n/a | Boolean inEnabled; |
|---|
| 1733 | n/a | #ifndef SetTabEnabled |
|---|
| 1734 | n/a | PyMac_PRECHECK(SetTabEnabled); |
|---|
| 1735 | n/a | #endif |
|---|
| 1736 | n/a | if (!PyArg_ParseTuple(_args, "hb", |
|---|
| 1737 | n/a | &inTabToHilite, |
|---|
| 1738 | n/a | &inEnabled)) |
|---|
| 1739 | n/a | return NULL; |
|---|
| 1740 | n/a | _err = SetTabEnabled(_self->ob_itself, |
|---|
| 1741 | n/a | inTabToHilite, |
|---|
| 1742 | n/a | inEnabled); |
|---|
| 1743 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1744 | n/a | Py_INCREF(Py_None); |
|---|
| 1745 | n/a | _res = Py_None; |
|---|
| 1746 | n/a | return _res; |
|---|
| 1747 | n/a | } |
|---|
| 1748 | n/a | |
|---|
| 1749 | n/a | static PyObject *CtlObj_SetImageWellContentInfo(ControlObject *_self, PyObject *_args) |
|---|
| 1750 | n/a | { |
|---|
| 1751 | n/a | PyObject *_res = NULL; |
|---|
| 1752 | n/a | OSErr _err; |
|---|
| 1753 | n/a | ControlButtonContentInfo inContent; |
|---|
| 1754 | n/a | #ifndef SetImageWellContentInfo |
|---|
| 1755 | n/a | PyMac_PRECHECK(SetImageWellContentInfo); |
|---|
| 1756 | n/a | #endif |
|---|
| 1757 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1758 | n/a | ControlButtonContentInfo_Convert, &inContent)) |
|---|
| 1759 | n/a | return NULL; |
|---|
| 1760 | n/a | _err = SetImageWellContentInfo(_self->ob_itself, |
|---|
| 1761 | n/a | &inContent); |
|---|
| 1762 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1763 | n/a | Py_INCREF(Py_None); |
|---|
| 1764 | n/a | _res = Py_None; |
|---|
| 1765 | n/a | return _res; |
|---|
| 1766 | n/a | } |
|---|
| 1767 | n/a | |
|---|
| 1768 | n/a | static PyObject *CtlObj_SetImageWellTransform(ControlObject *_self, PyObject *_args) |
|---|
| 1769 | n/a | { |
|---|
| 1770 | n/a | PyObject *_res = NULL; |
|---|
| 1771 | n/a | OSErr _err; |
|---|
| 1772 | n/a | IconTransformType inTransform; |
|---|
| 1773 | n/a | #ifndef SetImageWellTransform |
|---|
| 1774 | n/a | PyMac_PRECHECK(SetImageWellTransform); |
|---|
| 1775 | n/a | #endif |
|---|
| 1776 | n/a | if (!PyArg_ParseTuple(_args, "h", |
|---|
| 1777 | n/a | &inTransform)) |
|---|
| 1778 | n/a | return NULL; |
|---|
| 1779 | n/a | _err = SetImageWellTransform(_self->ob_itself, |
|---|
| 1780 | n/a | inTransform); |
|---|
| 1781 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1782 | n/a | Py_INCREF(Py_None); |
|---|
| 1783 | n/a | _res = Py_None; |
|---|
| 1784 | n/a | return _res; |
|---|
| 1785 | n/a | } |
|---|
| 1786 | n/a | |
|---|
| 1787 | n/a | static PyObject *CtlObj_GetDataBrowserViewStyle(ControlObject *_self, PyObject *_args) |
|---|
| 1788 | n/a | { |
|---|
| 1789 | n/a | PyObject *_res = NULL; |
|---|
| 1790 | n/a | OSStatus _err; |
|---|
| 1791 | n/a | OSType style; |
|---|
| 1792 | n/a | #ifndef GetDataBrowserViewStyle |
|---|
| 1793 | n/a | PyMac_PRECHECK(GetDataBrowserViewStyle); |
|---|
| 1794 | n/a | #endif |
|---|
| 1795 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1796 | n/a | return NULL; |
|---|
| 1797 | n/a | _err = GetDataBrowserViewStyle(_self->ob_itself, |
|---|
| 1798 | n/a | &style); |
|---|
| 1799 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1800 | n/a | _res = Py_BuildValue("O&", |
|---|
| 1801 | n/a | PyMac_BuildOSType, style); |
|---|
| 1802 | n/a | return _res; |
|---|
| 1803 | n/a | } |
|---|
| 1804 | n/a | |
|---|
| 1805 | n/a | static PyObject *CtlObj_SetDataBrowserViewStyle(ControlObject *_self, PyObject *_args) |
|---|
| 1806 | n/a | { |
|---|
| 1807 | n/a | PyObject *_res = NULL; |
|---|
| 1808 | n/a | OSStatus _err; |
|---|
| 1809 | n/a | OSType style; |
|---|
| 1810 | n/a | #ifndef SetDataBrowserViewStyle |
|---|
| 1811 | n/a | PyMac_PRECHECK(SetDataBrowserViewStyle); |
|---|
| 1812 | n/a | #endif |
|---|
| 1813 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 1814 | n/a | PyMac_GetOSType, &style)) |
|---|
| 1815 | n/a | return NULL; |
|---|
| 1816 | n/a | _err = SetDataBrowserViewStyle(_self->ob_itself, |
|---|
| 1817 | n/a | style); |
|---|
| 1818 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1819 | n/a | Py_INCREF(Py_None); |
|---|
| 1820 | n/a | _res = Py_None; |
|---|
| 1821 | n/a | return _res; |
|---|
| 1822 | n/a | } |
|---|
| 1823 | n/a | |
|---|
| 1824 | n/a | static PyObject *CtlObj_EnableDataBrowserEditCommand(ControlObject *_self, PyObject *_args) |
|---|
| 1825 | n/a | { |
|---|
| 1826 | n/a | PyObject *_res = NULL; |
|---|
| 1827 | n/a | Boolean _rv; |
|---|
| 1828 | n/a | UInt32 command; |
|---|
| 1829 | n/a | #ifndef EnableDataBrowserEditCommand |
|---|
| 1830 | n/a | PyMac_PRECHECK(EnableDataBrowserEditCommand); |
|---|
| 1831 | n/a | #endif |
|---|
| 1832 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 1833 | n/a | &command)) |
|---|
| 1834 | n/a | return NULL; |
|---|
| 1835 | n/a | _rv = EnableDataBrowserEditCommand(_self->ob_itself, |
|---|
| 1836 | n/a | command); |
|---|
| 1837 | n/a | _res = Py_BuildValue("b", |
|---|
| 1838 | n/a | _rv); |
|---|
| 1839 | n/a | return _res; |
|---|
| 1840 | n/a | } |
|---|
| 1841 | n/a | |
|---|
| 1842 | n/a | static PyObject *CtlObj_ExecuteDataBrowserEditCommand(ControlObject *_self, PyObject *_args) |
|---|
| 1843 | n/a | { |
|---|
| 1844 | n/a | PyObject *_res = NULL; |
|---|
| 1845 | n/a | OSStatus _err; |
|---|
| 1846 | n/a | UInt32 command; |
|---|
| 1847 | n/a | #ifndef ExecuteDataBrowserEditCommand |
|---|
| 1848 | n/a | PyMac_PRECHECK(ExecuteDataBrowserEditCommand); |
|---|
| 1849 | n/a | #endif |
|---|
| 1850 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 1851 | n/a | &command)) |
|---|
| 1852 | n/a | return NULL; |
|---|
| 1853 | n/a | _err = ExecuteDataBrowserEditCommand(_self->ob_itself, |
|---|
| 1854 | n/a | command); |
|---|
| 1855 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1856 | n/a | Py_INCREF(Py_None); |
|---|
| 1857 | n/a | _res = Py_None; |
|---|
| 1858 | n/a | return _res; |
|---|
| 1859 | n/a | } |
|---|
| 1860 | n/a | |
|---|
| 1861 | n/a | static PyObject *CtlObj_GetDataBrowserSelectionAnchor(ControlObject *_self, PyObject *_args) |
|---|
| 1862 | n/a | { |
|---|
| 1863 | n/a | PyObject *_res = NULL; |
|---|
| 1864 | n/a | OSStatus _err; |
|---|
| 1865 | n/a | UInt32 first; |
|---|
| 1866 | n/a | UInt32 last; |
|---|
| 1867 | n/a | #ifndef GetDataBrowserSelectionAnchor |
|---|
| 1868 | n/a | PyMac_PRECHECK(GetDataBrowserSelectionAnchor); |
|---|
| 1869 | n/a | #endif |
|---|
| 1870 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 1871 | n/a | return NULL; |
|---|
| 1872 | n/a | _err = GetDataBrowserSelectionAnchor(_self->ob_itself, |
|---|
| 1873 | n/a | &first, |
|---|
| 1874 | n/a | &last); |
|---|
| 1875 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1876 | n/a | _res = Py_BuildValue("ll", |
|---|
| 1877 | n/a | first, |
|---|
| 1878 | n/a | last); |
|---|
| 1879 | n/a | return _res; |
|---|
| 1880 | n/a | } |
|---|
| 1881 | n/a | |
|---|
| 1882 | n/a | static PyObject *CtlObj_MoveDataBrowserSelectionAnchor(ControlObject *_self, PyObject *_args) |
|---|
| 1883 | n/a | { |
|---|
| 1884 | n/a | PyObject *_res = NULL; |
|---|
| 1885 | n/a | OSStatus _err; |
|---|
| 1886 | n/a | UInt32 direction; |
|---|
| 1887 | n/a | Boolean extendSelection; |
|---|
| 1888 | n/a | #ifndef MoveDataBrowserSelectionAnchor |
|---|
| 1889 | n/a | PyMac_PRECHECK(MoveDataBrowserSelectionAnchor); |
|---|
| 1890 | n/a | #endif |
|---|
| 1891 | n/a | if (!PyArg_ParseTuple(_args, "lb", |
|---|
| 1892 | n/a | &direction, |
|---|
| 1893 | n/a | &extendSelection)) |
|---|
| 1894 | n/a | return NULL; |
|---|
| 1895 | n/a | _err = MoveDataBrowserSelectionAnchor(_self->ob_itself, |
|---|
| 1896 | n/a | direction, |
|---|
| 1897 | n/a | extendSelection); |
|---|
| 1898 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1899 | n/a | Py_INCREF(Py_None); |
|---|
| 1900 | n/a | _res = Py_None; |
|---|
| 1901 | n/a | return _res; |
|---|
| 1902 | n/a | } |
|---|
| 1903 | n/a | |
|---|
| 1904 | n/a | static PyObject *CtlObj_OpenDataBrowserContainer(ControlObject *_self, PyObject *_args) |
|---|
| 1905 | n/a | { |
|---|
| 1906 | n/a | PyObject *_res = NULL; |
|---|
| 1907 | n/a | OSStatus _err; |
|---|
| 1908 | n/a | UInt32 container; |
|---|
| 1909 | n/a | #ifndef OpenDataBrowserContainer |
|---|
| 1910 | n/a | PyMac_PRECHECK(OpenDataBrowserContainer); |
|---|
| 1911 | n/a | #endif |
|---|
| 1912 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 1913 | n/a | &container)) |
|---|
| 1914 | n/a | return NULL; |
|---|
| 1915 | n/a | _err = OpenDataBrowserContainer(_self->ob_itself, |
|---|
| 1916 | n/a | container); |
|---|
| 1917 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1918 | n/a | Py_INCREF(Py_None); |
|---|
| 1919 | n/a | _res = Py_None; |
|---|
| 1920 | n/a | return _res; |
|---|
| 1921 | n/a | } |
|---|
| 1922 | n/a | |
|---|
| 1923 | n/a | static PyObject *CtlObj_CloseDataBrowserContainer(ControlObject *_self, PyObject *_args) |
|---|
| 1924 | n/a | { |
|---|
| 1925 | n/a | PyObject *_res = NULL; |
|---|
| 1926 | n/a | OSStatus _err; |
|---|
| 1927 | n/a | UInt32 container; |
|---|
| 1928 | n/a | #ifndef CloseDataBrowserContainer |
|---|
| 1929 | n/a | PyMac_PRECHECK(CloseDataBrowserContainer); |
|---|
| 1930 | n/a | #endif |
|---|
| 1931 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 1932 | n/a | &container)) |
|---|
| 1933 | n/a | return NULL; |
|---|
| 1934 | n/a | _err = CloseDataBrowserContainer(_self->ob_itself, |
|---|
| 1935 | n/a | container); |
|---|
| 1936 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1937 | n/a | Py_INCREF(Py_None); |
|---|
| 1938 | n/a | _res = Py_None; |
|---|
| 1939 | n/a | return _res; |
|---|
| 1940 | n/a | } |
|---|
| 1941 | n/a | |
|---|
| 1942 | n/a | static PyObject *CtlObj_SortDataBrowserContainer(ControlObject *_self, PyObject *_args) |
|---|
| 1943 | n/a | { |
|---|
| 1944 | n/a | PyObject *_res = NULL; |
|---|
| 1945 | n/a | OSStatus _err; |
|---|
| 1946 | n/a | UInt32 container; |
|---|
| 1947 | n/a | Boolean sortChildren; |
|---|
| 1948 | n/a | #ifndef SortDataBrowserContainer |
|---|
| 1949 | n/a | PyMac_PRECHECK(SortDataBrowserContainer); |
|---|
| 1950 | n/a | #endif |
|---|
| 1951 | n/a | if (!PyArg_ParseTuple(_args, "lb", |
|---|
| 1952 | n/a | &container, |
|---|
| 1953 | n/a | &sortChildren)) |
|---|
| 1954 | n/a | return NULL; |
|---|
| 1955 | n/a | _err = SortDataBrowserContainer(_self->ob_itself, |
|---|
| 1956 | n/a | container, |
|---|
| 1957 | n/a | sortChildren); |
|---|
| 1958 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1959 | n/a | Py_INCREF(Py_None); |
|---|
| 1960 | n/a | _res = Py_None; |
|---|
| 1961 | n/a | return _res; |
|---|
| 1962 | n/a | } |
|---|
| 1963 | n/a | |
|---|
| 1964 | n/a | static PyObject *CtlObj_GetDataBrowserItems(ControlObject *_self, PyObject *_args) |
|---|
| 1965 | n/a | { |
|---|
| 1966 | n/a | PyObject *_res = NULL; |
|---|
| 1967 | n/a | OSStatus _err; |
|---|
| 1968 | n/a | UInt32 container; |
|---|
| 1969 | n/a | Boolean recurse; |
|---|
| 1970 | n/a | UInt32 state; |
|---|
| 1971 | n/a | Handle items; |
|---|
| 1972 | n/a | #ifndef GetDataBrowserItems |
|---|
| 1973 | n/a | PyMac_PRECHECK(GetDataBrowserItems); |
|---|
| 1974 | n/a | #endif |
|---|
| 1975 | n/a | if (!PyArg_ParseTuple(_args, "lblO&", |
|---|
| 1976 | n/a | &container, |
|---|
| 1977 | n/a | &recurse, |
|---|
| 1978 | n/a | &state, |
|---|
| 1979 | n/a | ResObj_Convert, &items)) |
|---|
| 1980 | n/a | return NULL; |
|---|
| 1981 | n/a | _err = GetDataBrowserItems(_self->ob_itself, |
|---|
| 1982 | n/a | container, |
|---|
| 1983 | n/a | recurse, |
|---|
| 1984 | n/a | state, |
|---|
| 1985 | n/a | items); |
|---|
| 1986 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 1987 | n/a | Py_INCREF(Py_None); |
|---|
| 1988 | n/a | _res = Py_None; |
|---|
| 1989 | n/a | return _res; |
|---|
| 1990 | n/a | } |
|---|
| 1991 | n/a | |
|---|
| 1992 | n/a | static PyObject *CtlObj_GetDataBrowserItemCount(ControlObject *_self, PyObject *_args) |
|---|
| 1993 | n/a | { |
|---|
| 1994 | n/a | PyObject *_res = NULL; |
|---|
| 1995 | n/a | OSStatus _err; |
|---|
| 1996 | n/a | UInt32 container; |
|---|
| 1997 | n/a | Boolean recurse; |
|---|
| 1998 | n/a | UInt32 state; |
|---|
| 1999 | n/a | UInt32 numItems; |
|---|
| 2000 | n/a | #ifndef GetDataBrowserItemCount |
|---|
| 2001 | n/a | PyMac_PRECHECK(GetDataBrowserItemCount); |
|---|
| 2002 | n/a | #endif |
|---|
| 2003 | n/a | if (!PyArg_ParseTuple(_args, "lbl", |
|---|
| 2004 | n/a | &container, |
|---|
| 2005 | n/a | &recurse, |
|---|
| 2006 | n/a | &state)) |
|---|
| 2007 | n/a | return NULL; |
|---|
| 2008 | n/a | _err = GetDataBrowserItemCount(_self->ob_itself, |
|---|
| 2009 | n/a | container, |
|---|
| 2010 | n/a | recurse, |
|---|
| 2011 | n/a | state, |
|---|
| 2012 | n/a | &numItems); |
|---|
| 2013 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2014 | n/a | _res = Py_BuildValue("l", |
|---|
| 2015 | n/a | numItems); |
|---|
| 2016 | n/a | return _res; |
|---|
| 2017 | n/a | } |
|---|
| 2018 | n/a | |
|---|
| 2019 | n/a | static PyObject *CtlObj_IsDataBrowserItemSelected(ControlObject *_self, PyObject *_args) |
|---|
| 2020 | n/a | { |
|---|
| 2021 | n/a | PyObject *_res = NULL; |
|---|
| 2022 | n/a | Boolean _rv; |
|---|
| 2023 | n/a | UInt32 item; |
|---|
| 2024 | n/a | #ifndef IsDataBrowserItemSelected |
|---|
| 2025 | n/a | PyMac_PRECHECK(IsDataBrowserItemSelected); |
|---|
| 2026 | n/a | #endif |
|---|
| 2027 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2028 | n/a | &item)) |
|---|
| 2029 | n/a | return NULL; |
|---|
| 2030 | n/a | _rv = IsDataBrowserItemSelected(_self->ob_itself, |
|---|
| 2031 | n/a | item); |
|---|
| 2032 | n/a | _res = Py_BuildValue("b", |
|---|
| 2033 | n/a | _rv); |
|---|
| 2034 | n/a | return _res; |
|---|
| 2035 | n/a | } |
|---|
| 2036 | n/a | |
|---|
| 2037 | n/a | static PyObject *CtlObj_GetDataBrowserItemState(ControlObject *_self, PyObject *_args) |
|---|
| 2038 | n/a | { |
|---|
| 2039 | n/a | PyObject *_res = NULL; |
|---|
| 2040 | n/a | OSStatus _err; |
|---|
| 2041 | n/a | UInt32 item; |
|---|
| 2042 | n/a | UInt32 state; |
|---|
| 2043 | n/a | #ifndef GetDataBrowserItemState |
|---|
| 2044 | n/a | PyMac_PRECHECK(GetDataBrowserItemState); |
|---|
| 2045 | n/a | #endif |
|---|
| 2046 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2047 | n/a | &item)) |
|---|
| 2048 | n/a | return NULL; |
|---|
| 2049 | n/a | _err = GetDataBrowserItemState(_self->ob_itself, |
|---|
| 2050 | n/a | item, |
|---|
| 2051 | n/a | &state); |
|---|
| 2052 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2053 | n/a | _res = Py_BuildValue("l", |
|---|
| 2054 | n/a | state); |
|---|
| 2055 | n/a | return _res; |
|---|
| 2056 | n/a | } |
|---|
| 2057 | n/a | |
|---|
| 2058 | n/a | static PyObject *CtlObj_RevealDataBrowserItem(ControlObject *_self, PyObject *_args) |
|---|
| 2059 | n/a | { |
|---|
| 2060 | n/a | PyObject *_res = NULL; |
|---|
| 2061 | n/a | OSStatus _err; |
|---|
| 2062 | n/a | UInt32 item; |
|---|
| 2063 | n/a | UInt32 propertyID; |
|---|
| 2064 | n/a | UInt8 options; |
|---|
| 2065 | n/a | #ifndef RevealDataBrowserItem |
|---|
| 2066 | n/a | PyMac_PRECHECK(RevealDataBrowserItem); |
|---|
| 2067 | n/a | #endif |
|---|
| 2068 | n/a | if (!PyArg_ParseTuple(_args, "llb", |
|---|
| 2069 | n/a | &item, |
|---|
| 2070 | n/a | &propertyID, |
|---|
| 2071 | n/a | &options)) |
|---|
| 2072 | n/a | return NULL; |
|---|
| 2073 | n/a | _err = RevealDataBrowserItem(_self->ob_itself, |
|---|
| 2074 | n/a | item, |
|---|
| 2075 | n/a | propertyID, |
|---|
| 2076 | n/a | options); |
|---|
| 2077 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2078 | n/a | Py_INCREF(Py_None); |
|---|
| 2079 | n/a | _res = Py_None; |
|---|
| 2080 | n/a | return _res; |
|---|
| 2081 | n/a | } |
|---|
| 2082 | n/a | |
|---|
| 2083 | n/a | static PyObject *CtlObj_SetDataBrowserActiveItems(ControlObject *_self, PyObject *_args) |
|---|
| 2084 | n/a | { |
|---|
| 2085 | n/a | PyObject *_res = NULL; |
|---|
| 2086 | n/a | OSStatus _err; |
|---|
| 2087 | n/a | Boolean active; |
|---|
| 2088 | n/a | #ifndef SetDataBrowserActiveItems |
|---|
| 2089 | n/a | PyMac_PRECHECK(SetDataBrowserActiveItems); |
|---|
| 2090 | n/a | #endif |
|---|
| 2091 | n/a | if (!PyArg_ParseTuple(_args, "b", |
|---|
| 2092 | n/a | &active)) |
|---|
| 2093 | n/a | return NULL; |
|---|
| 2094 | n/a | _err = SetDataBrowserActiveItems(_self->ob_itself, |
|---|
| 2095 | n/a | active); |
|---|
| 2096 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2097 | n/a | Py_INCREF(Py_None); |
|---|
| 2098 | n/a | _res = Py_None; |
|---|
| 2099 | n/a | return _res; |
|---|
| 2100 | n/a | } |
|---|
| 2101 | n/a | |
|---|
| 2102 | n/a | static PyObject *CtlObj_GetDataBrowserActiveItems(ControlObject *_self, PyObject *_args) |
|---|
| 2103 | n/a | { |
|---|
| 2104 | n/a | PyObject *_res = NULL; |
|---|
| 2105 | n/a | OSStatus _err; |
|---|
| 2106 | n/a | Boolean active; |
|---|
| 2107 | n/a | #ifndef GetDataBrowserActiveItems |
|---|
| 2108 | n/a | PyMac_PRECHECK(GetDataBrowserActiveItems); |
|---|
| 2109 | n/a | #endif |
|---|
| 2110 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2111 | n/a | return NULL; |
|---|
| 2112 | n/a | _err = GetDataBrowserActiveItems(_self->ob_itself, |
|---|
| 2113 | n/a | &active); |
|---|
| 2114 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2115 | n/a | _res = Py_BuildValue("b", |
|---|
| 2116 | n/a | active); |
|---|
| 2117 | n/a | return _res; |
|---|
| 2118 | n/a | } |
|---|
| 2119 | n/a | |
|---|
| 2120 | n/a | static PyObject *CtlObj_SetDataBrowserScrollBarInset(ControlObject *_self, PyObject *_args) |
|---|
| 2121 | n/a | { |
|---|
| 2122 | n/a | PyObject *_res = NULL; |
|---|
| 2123 | n/a | OSStatus _err; |
|---|
| 2124 | n/a | Rect insetRect; |
|---|
| 2125 | n/a | #ifndef SetDataBrowserScrollBarInset |
|---|
| 2126 | n/a | PyMac_PRECHECK(SetDataBrowserScrollBarInset); |
|---|
| 2127 | n/a | #endif |
|---|
| 2128 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2129 | n/a | return NULL; |
|---|
| 2130 | n/a | _err = SetDataBrowserScrollBarInset(_self->ob_itself, |
|---|
| 2131 | n/a | &insetRect); |
|---|
| 2132 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2133 | n/a | _res = Py_BuildValue("O&", |
|---|
| 2134 | n/a | PyMac_BuildRect, &insetRect); |
|---|
| 2135 | n/a | return _res; |
|---|
| 2136 | n/a | } |
|---|
| 2137 | n/a | |
|---|
| 2138 | n/a | static PyObject *CtlObj_GetDataBrowserScrollBarInset(ControlObject *_self, PyObject *_args) |
|---|
| 2139 | n/a | { |
|---|
| 2140 | n/a | PyObject *_res = NULL; |
|---|
| 2141 | n/a | OSStatus _err; |
|---|
| 2142 | n/a | Rect insetRect; |
|---|
| 2143 | n/a | #ifndef GetDataBrowserScrollBarInset |
|---|
| 2144 | n/a | PyMac_PRECHECK(GetDataBrowserScrollBarInset); |
|---|
| 2145 | n/a | #endif |
|---|
| 2146 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2147 | n/a | return NULL; |
|---|
| 2148 | n/a | _err = GetDataBrowserScrollBarInset(_self->ob_itself, |
|---|
| 2149 | n/a | &insetRect); |
|---|
| 2150 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2151 | n/a | _res = Py_BuildValue("O&", |
|---|
| 2152 | n/a | PyMac_BuildRect, &insetRect); |
|---|
| 2153 | n/a | return _res; |
|---|
| 2154 | n/a | } |
|---|
| 2155 | n/a | |
|---|
| 2156 | n/a | static PyObject *CtlObj_SetDataBrowserTarget(ControlObject *_self, PyObject *_args) |
|---|
| 2157 | n/a | { |
|---|
| 2158 | n/a | PyObject *_res = NULL; |
|---|
| 2159 | n/a | OSStatus _err; |
|---|
| 2160 | n/a | UInt32 target; |
|---|
| 2161 | n/a | #ifndef SetDataBrowserTarget |
|---|
| 2162 | n/a | PyMac_PRECHECK(SetDataBrowserTarget); |
|---|
| 2163 | n/a | #endif |
|---|
| 2164 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2165 | n/a | &target)) |
|---|
| 2166 | n/a | return NULL; |
|---|
| 2167 | n/a | _err = SetDataBrowserTarget(_self->ob_itself, |
|---|
| 2168 | n/a | target); |
|---|
| 2169 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2170 | n/a | Py_INCREF(Py_None); |
|---|
| 2171 | n/a | _res = Py_None; |
|---|
| 2172 | n/a | return _res; |
|---|
| 2173 | n/a | } |
|---|
| 2174 | n/a | |
|---|
| 2175 | n/a | static PyObject *CtlObj_GetDataBrowserTarget(ControlObject *_self, PyObject *_args) |
|---|
| 2176 | n/a | { |
|---|
| 2177 | n/a | PyObject *_res = NULL; |
|---|
| 2178 | n/a | OSStatus _err; |
|---|
| 2179 | n/a | UInt32 target; |
|---|
| 2180 | n/a | #ifndef GetDataBrowserTarget |
|---|
| 2181 | n/a | PyMac_PRECHECK(GetDataBrowserTarget); |
|---|
| 2182 | n/a | #endif |
|---|
| 2183 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2184 | n/a | return NULL; |
|---|
| 2185 | n/a | _err = GetDataBrowserTarget(_self->ob_itself, |
|---|
| 2186 | n/a | &target); |
|---|
| 2187 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2188 | n/a | _res = Py_BuildValue("l", |
|---|
| 2189 | n/a | target); |
|---|
| 2190 | n/a | return _res; |
|---|
| 2191 | n/a | } |
|---|
| 2192 | n/a | |
|---|
| 2193 | n/a | static PyObject *CtlObj_SetDataBrowserSortOrder(ControlObject *_self, PyObject *_args) |
|---|
| 2194 | n/a | { |
|---|
| 2195 | n/a | PyObject *_res = NULL; |
|---|
| 2196 | n/a | OSStatus _err; |
|---|
| 2197 | n/a | UInt16 order; |
|---|
| 2198 | n/a | #ifndef SetDataBrowserSortOrder |
|---|
| 2199 | n/a | PyMac_PRECHECK(SetDataBrowserSortOrder); |
|---|
| 2200 | n/a | #endif |
|---|
| 2201 | n/a | if (!PyArg_ParseTuple(_args, "H", |
|---|
| 2202 | n/a | &order)) |
|---|
| 2203 | n/a | return NULL; |
|---|
| 2204 | n/a | _err = SetDataBrowserSortOrder(_self->ob_itself, |
|---|
| 2205 | n/a | order); |
|---|
| 2206 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2207 | n/a | Py_INCREF(Py_None); |
|---|
| 2208 | n/a | _res = Py_None; |
|---|
| 2209 | n/a | return _res; |
|---|
| 2210 | n/a | } |
|---|
| 2211 | n/a | |
|---|
| 2212 | n/a | static PyObject *CtlObj_GetDataBrowserSortOrder(ControlObject *_self, PyObject *_args) |
|---|
| 2213 | n/a | { |
|---|
| 2214 | n/a | PyObject *_res = NULL; |
|---|
| 2215 | n/a | OSStatus _err; |
|---|
| 2216 | n/a | UInt16 order; |
|---|
| 2217 | n/a | #ifndef GetDataBrowserSortOrder |
|---|
| 2218 | n/a | PyMac_PRECHECK(GetDataBrowserSortOrder); |
|---|
| 2219 | n/a | #endif |
|---|
| 2220 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2221 | n/a | return NULL; |
|---|
| 2222 | n/a | _err = GetDataBrowserSortOrder(_self->ob_itself, |
|---|
| 2223 | n/a | &order); |
|---|
| 2224 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2225 | n/a | _res = Py_BuildValue("H", |
|---|
| 2226 | n/a | order); |
|---|
| 2227 | n/a | return _res; |
|---|
| 2228 | n/a | } |
|---|
| 2229 | n/a | |
|---|
| 2230 | n/a | static PyObject *CtlObj_SetDataBrowserScrollPosition(ControlObject *_self, PyObject *_args) |
|---|
| 2231 | n/a | { |
|---|
| 2232 | n/a | PyObject *_res = NULL; |
|---|
| 2233 | n/a | OSStatus _err; |
|---|
| 2234 | n/a | UInt32 top; |
|---|
| 2235 | n/a | UInt32 left; |
|---|
| 2236 | n/a | #ifndef SetDataBrowserScrollPosition |
|---|
| 2237 | n/a | PyMac_PRECHECK(SetDataBrowserScrollPosition); |
|---|
| 2238 | n/a | #endif |
|---|
| 2239 | n/a | if (!PyArg_ParseTuple(_args, "ll", |
|---|
| 2240 | n/a | &top, |
|---|
| 2241 | n/a | &left)) |
|---|
| 2242 | n/a | return NULL; |
|---|
| 2243 | n/a | _err = SetDataBrowserScrollPosition(_self->ob_itself, |
|---|
| 2244 | n/a | top, |
|---|
| 2245 | n/a | left); |
|---|
| 2246 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2247 | n/a | Py_INCREF(Py_None); |
|---|
| 2248 | n/a | _res = Py_None; |
|---|
| 2249 | n/a | return _res; |
|---|
| 2250 | n/a | } |
|---|
| 2251 | n/a | |
|---|
| 2252 | n/a | static PyObject *CtlObj_GetDataBrowserScrollPosition(ControlObject *_self, PyObject *_args) |
|---|
| 2253 | n/a | { |
|---|
| 2254 | n/a | PyObject *_res = NULL; |
|---|
| 2255 | n/a | OSStatus _err; |
|---|
| 2256 | n/a | UInt32 top; |
|---|
| 2257 | n/a | UInt32 left; |
|---|
| 2258 | n/a | #ifndef GetDataBrowserScrollPosition |
|---|
| 2259 | n/a | PyMac_PRECHECK(GetDataBrowserScrollPosition); |
|---|
| 2260 | n/a | #endif |
|---|
| 2261 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2262 | n/a | return NULL; |
|---|
| 2263 | n/a | _err = GetDataBrowserScrollPosition(_self->ob_itself, |
|---|
| 2264 | n/a | &top, |
|---|
| 2265 | n/a | &left); |
|---|
| 2266 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2267 | n/a | _res = Py_BuildValue("ll", |
|---|
| 2268 | n/a | top, |
|---|
| 2269 | n/a | left); |
|---|
| 2270 | n/a | return _res; |
|---|
| 2271 | n/a | } |
|---|
| 2272 | n/a | |
|---|
| 2273 | n/a | static PyObject *CtlObj_SetDataBrowserHasScrollBars(ControlObject *_self, PyObject *_args) |
|---|
| 2274 | n/a | { |
|---|
| 2275 | n/a | PyObject *_res = NULL; |
|---|
| 2276 | n/a | OSStatus _err; |
|---|
| 2277 | n/a | Boolean horiz; |
|---|
| 2278 | n/a | Boolean vert; |
|---|
| 2279 | n/a | #ifndef SetDataBrowserHasScrollBars |
|---|
| 2280 | n/a | PyMac_PRECHECK(SetDataBrowserHasScrollBars); |
|---|
| 2281 | n/a | #endif |
|---|
| 2282 | n/a | if (!PyArg_ParseTuple(_args, "bb", |
|---|
| 2283 | n/a | &horiz, |
|---|
| 2284 | n/a | &vert)) |
|---|
| 2285 | n/a | return NULL; |
|---|
| 2286 | n/a | _err = SetDataBrowserHasScrollBars(_self->ob_itself, |
|---|
| 2287 | n/a | horiz, |
|---|
| 2288 | n/a | vert); |
|---|
| 2289 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2290 | n/a | Py_INCREF(Py_None); |
|---|
| 2291 | n/a | _res = Py_None; |
|---|
| 2292 | n/a | return _res; |
|---|
| 2293 | n/a | } |
|---|
| 2294 | n/a | |
|---|
| 2295 | n/a | static PyObject *CtlObj_GetDataBrowserHasScrollBars(ControlObject *_self, PyObject *_args) |
|---|
| 2296 | n/a | { |
|---|
| 2297 | n/a | PyObject *_res = NULL; |
|---|
| 2298 | n/a | OSStatus _err; |
|---|
| 2299 | n/a | Boolean horiz; |
|---|
| 2300 | n/a | Boolean vert; |
|---|
| 2301 | n/a | #ifndef GetDataBrowserHasScrollBars |
|---|
| 2302 | n/a | PyMac_PRECHECK(GetDataBrowserHasScrollBars); |
|---|
| 2303 | n/a | #endif |
|---|
| 2304 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2305 | n/a | return NULL; |
|---|
| 2306 | n/a | _err = GetDataBrowserHasScrollBars(_self->ob_itself, |
|---|
| 2307 | n/a | &horiz, |
|---|
| 2308 | n/a | &vert); |
|---|
| 2309 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2310 | n/a | _res = Py_BuildValue("bb", |
|---|
| 2311 | n/a | horiz, |
|---|
| 2312 | n/a | vert); |
|---|
| 2313 | n/a | return _res; |
|---|
| 2314 | n/a | } |
|---|
| 2315 | n/a | |
|---|
| 2316 | n/a | static PyObject *CtlObj_SetDataBrowserSortProperty(ControlObject *_self, PyObject *_args) |
|---|
| 2317 | n/a | { |
|---|
| 2318 | n/a | PyObject *_res = NULL; |
|---|
| 2319 | n/a | OSStatus _err; |
|---|
| 2320 | n/a | UInt32 property; |
|---|
| 2321 | n/a | #ifndef SetDataBrowserSortProperty |
|---|
| 2322 | n/a | PyMac_PRECHECK(SetDataBrowserSortProperty); |
|---|
| 2323 | n/a | #endif |
|---|
| 2324 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2325 | n/a | &property)) |
|---|
| 2326 | n/a | return NULL; |
|---|
| 2327 | n/a | _err = SetDataBrowserSortProperty(_self->ob_itself, |
|---|
| 2328 | n/a | property); |
|---|
| 2329 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2330 | n/a | Py_INCREF(Py_None); |
|---|
| 2331 | n/a | _res = Py_None; |
|---|
| 2332 | n/a | return _res; |
|---|
| 2333 | n/a | } |
|---|
| 2334 | n/a | |
|---|
| 2335 | n/a | static PyObject *CtlObj_GetDataBrowserSortProperty(ControlObject *_self, PyObject *_args) |
|---|
| 2336 | n/a | { |
|---|
| 2337 | n/a | PyObject *_res = NULL; |
|---|
| 2338 | n/a | OSStatus _err; |
|---|
| 2339 | n/a | UInt32 property; |
|---|
| 2340 | n/a | #ifndef GetDataBrowserSortProperty |
|---|
| 2341 | n/a | PyMac_PRECHECK(GetDataBrowserSortProperty); |
|---|
| 2342 | n/a | #endif |
|---|
| 2343 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2344 | n/a | return NULL; |
|---|
| 2345 | n/a | _err = GetDataBrowserSortProperty(_self->ob_itself, |
|---|
| 2346 | n/a | &property); |
|---|
| 2347 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2348 | n/a | _res = Py_BuildValue("l", |
|---|
| 2349 | n/a | property); |
|---|
| 2350 | n/a | return _res; |
|---|
| 2351 | n/a | } |
|---|
| 2352 | n/a | |
|---|
| 2353 | n/a | static PyObject *CtlObj_SetDataBrowserSelectionFlags(ControlObject *_self, PyObject *_args) |
|---|
| 2354 | n/a | { |
|---|
| 2355 | n/a | PyObject *_res = NULL; |
|---|
| 2356 | n/a | OSStatus _err; |
|---|
| 2357 | n/a | UInt32 selectionFlags; |
|---|
| 2358 | n/a | #ifndef SetDataBrowserSelectionFlags |
|---|
| 2359 | n/a | PyMac_PRECHECK(SetDataBrowserSelectionFlags); |
|---|
| 2360 | n/a | #endif |
|---|
| 2361 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2362 | n/a | &selectionFlags)) |
|---|
| 2363 | n/a | return NULL; |
|---|
| 2364 | n/a | _err = SetDataBrowserSelectionFlags(_self->ob_itself, |
|---|
| 2365 | n/a | selectionFlags); |
|---|
| 2366 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2367 | n/a | Py_INCREF(Py_None); |
|---|
| 2368 | n/a | _res = Py_None; |
|---|
| 2369 | n/a | return _res; |
|---|
| 2370 | n/a | } |
|---|
| 2371 | n/a | |
|---|
| 2372 | n/a | static PyObject *CtlObj_GetDataBrowserSelectionFlags(ControlObject *_self, PyObject *_args) |
|---|
| 2373 | n/a | { |
|---|
| 2374 | n/a | PyObject *_res = NULL; |
|---|
| 2375 | n/a | OSStatus _err; |
|---|
| 2376 | n/a | UInt32 selectionFlags; |
|---|
| 2377 | n/a | #ifndef GetDataBrowserSelectionFlags |
|---|
| 2378 | n/a | PyMac_PRECHECK(GetDataBrowserSelectionFlags); |
|---|
| 2379 | n/a | #endif |
|---|
| 2380 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2381 | n/a | return NULL; |
|---|
| 2382 | n/a | _err = GetDataBrowserSelectionFlags(_self->ob_itself, |
|---|
| 2383 | n/a | &selectionFlags); |
|---|
| 2384 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2385 | n/a | _res = Py_BuildValue("l", |
|---|
| 2386 | n/a | selectionFlags); |
|---|
| 2387 | n/a | return _res; |
|---|
| 2388 | n/a | } |
|---|
| 2389 | n/a | |
|---|
| 2390 | n/a | static PyObject *CtlObj_SetDataBrowserPropertyFlags(ControlObject *_self, PyObject *_args) |
|---|
| 2391 | n/a | { |
|---|
| 2392 | n/a | PyObject *_res = NULL; |
|---|
| 2393 | n/a | OSStatus _err; |
|---|
| 2394 | n/a | UInt32 property; |
|---|
| 2395 | n/a | UInt32 flags; |
|---|
| 2396 | n/a | #ifndef SetDataBrowserPropertyFlags |
|---|
| 2397 | n/a | PyMac_PRECHECK(SetDataBrowserPropertyFlags); |
|---|
| 2398 | n/a | #endif |
|---|
| 2399 | n/a | if (!PyArg_ParseTuple(_args, "ll", |
|---|
| 2400 | n/a | &property, |
|---|
| 2401 | n/a | &flags)) |
|---|
| 2402 | n/a | return NULL; |
|---|
| 2403 | n/a | _err = SetDataBrowserPropertyFlags(_self->ob_itself, |
|---|
| 2404 | n/a | property, |
|---|
| 2405 | n/a | flags); |
|---|
| 2406 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2407 | n/a | Py_INCREF(Py_None); |
|---|
| 2408 | n/a | _res = Py_None; |
|---|
| 2409 | n/a | return _res; |
|---|
| 2410 | n/a | } |
|---|
| 2411 | n/a | |
|---|
| 2412 | n/a | static PyObject *CtlObj_GetDataBrowserPropertyFlags(ControlObject *_self, PyObject *_args) |
|---|
| 2413 | n/a | { |
|---|
| 2414 | n/a | PyObject *_res = NULL; |
|---|
| 2415 | n/a | OSStatus _err; |
|---|
| 2416 | n/a | UInt32 property; |
|---|
| 2417 | n/a | UInt32 flags; |
|---|
| 2418 | n/a | #ifndef GetDataBrowserPropertyFlags |
|---|
| 2419 | n/a | PyMac_PRECHECK(GetDataBrowserPropertyFlags); |
|---|
| 2420 | n/a | #endif |
|---|
| 2421 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2422 | n/a | &property)) |
|---|
| 2423 | n/a | return NULL; |
|---|
| 2424 | n/a | _err = GetDataBrowserPropertyFlags(_self->ob_itself, |
|---|
| 2425 | n/a | property, |
|---|
| 2426 | n/a | &flags); |
|---|
| 2427 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2428 | n/a | _res = Py_BuildValue("l", |
|---|
| 2429 | n/a | flags); |
|---|
| 2430 | n/a | return _res; |
|---|
| 2431 | n/a | } |
|---|
| 2432 | n/a | |
|---|
| 2433 | n/a | static PyObject *CtlObj_SetDataBrowserEditText(ControlObject *_self, PyObject *_args) |
|---|
| 2434 | n/a | { |
|---|
| 2435 | n/a | PyObject *_res = NULL; |
|---|
| 2436 | n/a | OSStatus _err; |
|---|
| 2437 | n/a | CFStringRef text; |
|---|
| 2438 | n/a | #ifndef SetDataBrowserEditText |
|---|
| 2439 | n/a | PyMac_PRECHECK(SetDataBrowserEditText); |
|---|
| 2440 | n/a | #endif |
|---|
| 2441 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 2442 | n/a | CFStringRefObj_Convert, &text)) |
|---|
| 2443 | n/a | return NULL; |
|---|
| 2444 | n/a | _err = SetDataBrowserEditText(_self->ob_itself, |
|---|
| 2445 | n/a | text); |
|---|
| 2446 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2447 | n/a | Py_INCREF(Py_None); |
|---|
| 2448 | n/a | _res = Py_None; |
|---|
| 2449 | n/a | return _res; |
|---|
| 2450 | n/a | } |
|---|
| 2451 | n/a | |
|---|
| 2452 | n/a | static PyObject *CtlObj_CopyDataBrowserEditText(ControlObject *_self, PyObject *_args) |
|---|
| 2453 | n/a | { |
|---|
| 2454 | n/a | PyObject *_res = NULL; |
|---|
| 2455 | n/a | OSStatus _err; |
|---|
| 2456 | n/a | CFStringRef text; |
|---|
| 2457 | n/a | #ifndef CopyDataBrowserEditText |
|---|
| 2458 | n/a | PyMac_PRECHECK(CopyDataBrowserEditText); |
|---|
| 2459 | n/a | #endif |
|---|
| 2460 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2461 | n/a | return NULL; |
|---|
| 2462 | n/a | _err = CopyDataBrowserEditText(_self->ob_itself, |
|---|
| 2463 | n/a | &text); |
|---|
| 2464 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2465 | n/a | _res = Py_BuildValue("O&", |
|---|
| 2466 | n/a | CFStringRefObj_New, text); |
|---|
| 2467 | n/a | return _res; |
|---|
| 2468 | n/a | } |
|---|
| 2469 | n/a | |
|---|
| 2470 | n/a | static PyObject *CtlObj_GetDataBrowserEditText(ControlObject *_self, PyObject *_args) |
|---|
| 2471 | n/a | { |
|---|
| 2472 | n/a | PyObject *_res = NULL; |
|---|
| 2473 | n/a | OSStatus _err; |
|---|
| 2474 | n/a | CFMutableStringRef text; |
|---|
| 2475 | n/a | #ifndef GetDataBrowserEditText |
|---|
| 2476 | n/a | PyMac_PRECHECK(GetDataBrowserEditText); |
|---|
| 2477 | n/a | #endif |
|---|
| 2478 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 2479 | n/a | CFMutableStringRefObj_Convert, &text)) |
|---|
| 2480 | n/a | return NULL; |
|---|
| 2481 | n/a | _err = GetDataBrowserEditText(_self->ob_itself, |
|---|
| 2482 | n/a | text); |
|---|
| 2483 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2484 | n/a | Py_INCREF(Py_None); |
|---|
| 2485 | n/a | _res = Py_None; |
|---|
| 2486 | n/a | return _res; |
|---|
| 2487 | n/a | } |
|---|
| 2488 | n/a | |
|---|
| 2489 | n/a | static PyObject *CtlObj_SetDataBrowserEditItem(ControlObject *_self, PyObject *_args) |
|---|
| 2490 | n/a | { |
|---|
| 2491 | n/a | PyObject *_res = NULL; |
|---|
| 2492 | n/a | OSStatus _err; |
|---|
| 2493 | n/a | UInt32 item; |
|---|
| 2494 | n/a | UInt32 property; |
|---|
| 2495 | n/a | #ifndef SetDataBrowserEditItem |
|---|
| 2496 | n/a | PyMac_PRECHECK(SetDataBrowserEditItem); |
|---|
| 2497 | n/a | #endif |
|---|
| 2498 | n/a | if (!PyArg_ParseTuple(_args, "ll", |
|---|
| 2499 | n/a | &item, |
|---|
| 2500 | n/a | &property)) |
|---|
| 2501 | n/a | return NULL; |
|---|
| 2502 | n/a | _err = SetDataBrowserEditItem(_self->ob_itself, |
|---|
| 2503 | n/a | item, |
|---|
| 2504 | n/a | property); |
|---|
| 2505 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2506 | n/a | Py_INCREF(Py_None); |
|---|
| 2507 | n/a | _res = Py_None; |
|---|
| 2508 | n/a | return _res; |
|---|
| 2509 | n/a | } |
|---|
| 2510 | n/a | |
|---|
| 2511 | n/a | static PyObject *CtlObj_GetDataBrowserEditItem(ControlObject *_self, PyObject *_args) |
|---|
| 2512 | n/a | { |
|---|
| 2513 | n/a | PyObject *_res = NULL; |
|---|
| 2514 | n/a | OSStatus _err; |
|---|
| 2515 | n/a | UInt32 item; |
|---|
| 2516 | n/a | UInt32 property; |
|---|
| 2517 | n/a | #ifndef GetDataBrowserEditItem |
|---|
| 2518 | n/a | PyMac_PRECHECK(GetDataBrowserEditItem); |
|---|
| 2519 | n/a | #endif |
|---|
| 2520 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2521 | n/a | return NULL; |
|---|
| 2522 | n/a | _err = GetDataBrowserEditItem(_self->ob_itself, |
|---|
| 2523 | n/a | &item, |
|---|
| 2524 | n/a | &property); |
|---|
| 2525 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2526 | n/a | _res = Py_BuildValue("ll", |
|---|
| 2527 | n/a | item, |
|---|
| 2528 | n/a | property); |
|---|
| 2529 | n/a | return _res; |
|---|
| 2530 | n/a | } |
|---|
| 2531 | n/a | |
|---|
| 2532 | n/a | static PyObject *CtlObj_GetDataBrowserItemPartBounds(ControlObject *_self, PyObject *_args) |
|---|
| 2533 | n/a | { |
|---|
| 2534 | n/a | PyObject *_res = NULL; |
|---|
| 2535 | n/a | OSStatus _err; |
|---|
| 2536 | n/a | UInt32 item; |
|---|
| 2537 | n/a | UInt32 property; |
|---|
| 2538 | n/a | OSType part; |
|---|
| 2539 | n/a | Rect bounds; |
|---|
| 2540 | n/a | #ifndef GetDataBrowserItemPartBounds |
|---|
| 2541 | n/a | PyMac_PRECHECK(GetDataBrowserItemPartBounds); |
|---|
| 2542 | n/a | #endif |
|---|
| 2543 | n/a | if (!PyArg_ParseTuple(_args, "llO&", |
|---|
| 2544 | n/a | &item, |
|---|
| 2545 | n/a | &property, |
|---|
| 2546 | n/a | PyMac_GetOSType, &part)) |
|---|
| 2547 | n/a | return NULL; |
|---|
| 2548 | n/a | _err = GetDataBrowserItemPartBounds(_self->ob_itself, |
|---|
| 2549 | n/a | item, |
|---|
| 2550 | n/a | property, |
|---|
| 2551 | n/a | part, |
|---|
| 2552 | n/a | &bounds); |
|---|
| 2553 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2554 | n/a | _res = Py_BuildValue("O&", |
|---|
| 2555 | n/a | PyMac_BuildRect, &bounds); |
|---|
| 2556 | n/a | return _res; |
|---|
| 2557 | n/a | } |
|---|
| 2558 | n/a | |
|---|
| 2559 | n/a | static PyObject *CtlObj_RemoveDataBrowserTableViewColumn(ControlObject *_self, PyObject *_args) |
|---|
| 2560 | n/a | { |
|---|
| 2561 | n/a | PyObject *_res = NULL; |
|---|
| 2562 | n/a | OSStatus _err; |
|---|
| 2563 | n/a | UInt32 column; |
|---|
| 2564 | n/a | #ifndef RemoveDataBrowserTableViewColumn |
|---|
| 2565 | n/a | PyMac_PRECHECK(RemoveDataBrowserTableViewColumn); |
|---|
| 2566 | n/a | #endif |
|---|
| 2567 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2568 | n/a | &column)) |
|---|
| 2569 | n/a | return NULL; |
|---|
| 2570 | n/a | _err = RemoveDataBrowserTableViewColumn(_self->ob_itself, |
|---|
| 2571 | n/a | column); |
|---|
| 2572 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2573 | n/a | Py_INCREF(Py_None); |
|---|
| 2574 | n/a | _res = Py_None; |
|---|
| 2575 | n/a | return _res; |
|---|
| 2576 | n/a | } |
|---|
| 2577 | n/a | |
|---|
| 2578 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewColumnCount(ControlObject *_self, PyObject *_args) |
|---|
| 2579 | n/a | { |
|---|
| 2580 | n/a | PyObject *_res = NULL; |
|---|
| 2581 | n/a | OSStatus _err; |
|---|
| 2582 | n/a | UInt32 numColumns; |
|---|
| 2583 | n/a | #ifndef GetDataBrowserTableViewColumnCount |
|---|
| 2584 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewColumnCount); |
|---|
| 2585 | n/a | #endif |
|---|
| 2586 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2587 | n/a | return NULL; |
|---|
| 2588 | n/a | _err = GetDataBrowserTableViewColumnCount(_self->ob_itself, |
|---|
| 2589 | n/a | &numColumns); |
|---|
| 2590 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2591 | n/a | _res = Py_BuildValue("l", |
|---|
| 2592 | n/a | numColumns); |
|---|
| 2593 | n/a | return _res; |
|---|
| 2594 | n/a | } |
|---|
| 2595 | n/a | |
|---|
| 2596 | n/a | static PyObject *CtlObj_SetDataBrowserTableViewHiliteStyle(ControlObject *_self, PyObject *_args) |
|---|
| 2597 | n/a | { |
|---|
| 2598 | n/a | PyObject *_res = NULL; |
|---|
| 2599 | n/a | OSStatus _err; |
|---|
| 2600 | n/a | UInt32 hiliteStyle; |
|---|
| 2601 | n/a | #ifndef SetDataBrowserTableViewHiliteStyle |
|---|
| 2602 | n/a | PyMac_PRECHECK(SetDataBrowserTableViewHiliteStyle); |
|---|
| 2603 | n/a | #endif |
|---|
| 2604 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2605 | n/a | &hiliteStyle)) |
|---|
| 2606 | n/a | return NULL; |
|---|
| 2607 | n/a | _err = SetDataBrowserTableViewHiliteStyle(_self->ob_itself, |
|---|
| 2608 | n/a | hiliteStyle); |
|---|
| 2609 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2610 | n/a | Py_INCREF(Py_None); |
|---|
| 2611 | n/a | _res = Py_None; |
|---|
| 2612 | n/a | return _res; |
|---|
| 2613 | n/a | } |
|---|
| 2614 | n/a | |
|---|
| 2615 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewHiliteStyle(ControlObject *_self, PyObject *_args) |
|---|
| 2616 | n/a | { |
|---|
| 2617 | n/a | PyObject *_res = NULL; |
|---|
| 2618 | n/a | OSStatus _err; |
|---|
| 2619 | n/a | UInt32 hiliteStyle; |
|---|
| 2620 | n/a | #ifndef GetDataBrowserTableViewHiliteStyle |
|---|
| 2621 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewHiliteStyle); |
|---|
| 2622 | n/a | #endif |
|---|
| 2623 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2624 | n/a | return NULL; |
|---|
| 2625 | n/a | _err = GetDataBrowserTableViewHiliteStyle(_self->ob_itself, |
|---|
| 2626 | n/a | &hiliteStyle); |
|---|
| 2627 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2628 | n/a | _res = Py_BuildValue("l", |
|---|
| 2629 | n/a | hiliteStyle); |
|---|
| 2630 | n/a | return _res; |
|---|
| 2631 | n/a | } |
|---|
| 2632 | n/a | |
|---|
| 2633 | n/a | static PyObject *CtlObj_SetDataBrowserTableViewRowHeight(ControlObject *_self, PyObject *_args) |
|---|
| 2634 | n/a | { |
|---|
| 2635 | n/a | PyObject *_res = NULL; |
|---|
| 2636 | n/a | OSStatus _err; |
|---|
| 2637 | n/a | UInt16 height; |
|---|
| 2638 | n/a | #ifndef SetDataBrowserTableViewRowHeight |
|---|
| 2639 | n/a | PyMac_PRECHECK(SetDataBrowserTableViewRowHeight); |
|---|
| 2640 | n/a | #endif |
|---|
| 2641 | n/a | if (!PyArg_ParseTuple(_args, "H", |
|---|
| 2642 | n/a | &height)) |
|---|
| 2643 | n/a | return NULL; |
|---|
| 2644 | n/a | _err = SetDataBrowserTableViewRowHeight(_self->ob_itself, |
|---|
| 2645 | n/a | height); |
|---|
| 2646 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2647 | n/a | Py_INCREF(Py_None); |
|---|
| 2648 | n/a | _res = Py_None; |
|---|
| 2649 | n/a | return _res; |
|---|
| 2650 | n/a | } |
|---|
| 2651 | n/a | |
|---|
| 2652 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewRowHeight(ControlObject *_self, PyObject *_args) |
|---|
| 2653 | n/a | { |
|---|
| 2654 | n/a | PyObject *_res = NULL; |
|---|
| 2655 | n/a | OSStatus _err; |
|---|
| 2656 | n/a | UInt16 height; |
|---|
| 2657 | n/a | #ifndef GetDataBrowserTableViewRowHeight |
|---|
| 2658 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewRowHeight); |
|---|
| 2659 | n/a | #endif |
|---|
| 2660 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2661 | n/a | return NULL; |
|---|
| 2662 | n/a | _err = GetDataBrowserTableViewRowHeight(_self->ob_itself, |
|---|
| 2663 | n/a | &height); |
|---|
| 2664 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2665 | n/a | _res = Py_BuildValue("H", |
|---|
| 2666 | n/a | height); |
|---|
| 2667 | n/a | return _res; |
|---|
| 2668 | n/a | } |
|---|
| 2669 | n/a | |
|---|
| 2670 | n/a | static PyObject *CtlObj_SetDataBrowserTableViewColumnWidth(ControlObject *_self, PyObject *_args) |
|---|
| 2671 | n/a | { |
|---|
| 2672 | n/a | PyObject *_res = NULL; |
|---|
| 2673 | n/a | OSStatus _err; |
|---|
| 2674 | n/a | UInt16 width; |
|---|
| 2675 | n/a | #ifndef SetDataBrowserTableViewColumnWidth |
|---|
| 2676 | n/a | PyMac_PRECHECK(SetDataBrowserTableViewColumnWidth); |
|---|
| 2677 | n/a | #endif |
|---|
| 2678 | n/a | if (!PyArg_ParseTuple(_args, "H", |
|---|
| 2679 | n/a | &width)) |
|---|
| 2680 | n/a | return NULL; |
|---|
| 2681 | n/a | _err = SetDataBrowserTableViewColumnWidth(_self->ob_itself, |
|---|
| 2682 | n/a | width); |
|---|
| 2683 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2684 | n/a | Py_INCREF(Py_None); |
|---|
| 2685 | n/a | _res = Py_None; |
|---|
| 2686 | n/a | return _res; |
|---|
| 2687 | n/a | } |
|---|
| 2688 | n/a | |
|---|
| 2689 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewColumnWidth(ControlObject *_self, PyObject *_args) |
|---|
| 2690 | n/a | { |
|---|
| 2691 | n/a | PyObject *_res = NULL; |
|---|
| 2692 | n/a | OSStatus _err; |
|---|
| 2693 | n/a | UInt16 width; |
|---|
| 2694 | n/a | #ifndef GetDataBrowserTableViewColumnWidth |
|---|
| 2695 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewColumnWidth); |
|---|
| 2696 | n/a | #endif |
|---|
| 2697 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2698 | n/a | return NULL; |
|---|
| 2699 | n/a | _err = GetDataBrowserTableViewColumnWidth(_self->ob_itself, |
|---|
| 2700 | n/a | &width); |
|---|
| 2701 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2702 | n/a | _res = Py_BuildValue("H", |
|---|
| 2703 | n/a | width); |
|---|
| 2704 | n/a | return _res; |
|---|
| 2705 | n/a | } |
|---|
| 2706 | n/a | |
|---|
| 2707 | n/a | static PyObject *CtlObj_SetDataBrowserTableViewItemRowHeight(ControlObject *_self, PyObject *_args) |
|---|
| 2708 | n/a | { |
|---|
| 2709 | n/a | PyObject *_res = NULL; |
|---|
| 2710 | n/a | OSStatus _err; |
|---|
| 2711 | n/a | UInt32 item; |
|---|
| 2712 | n/a | UInt16 height; |
|---|
| 2713 | n/a | #ifndef SetDataBrowserTableViewItemRowHeight |
|---|
| 2714 | n/a | PyMac_PRECHECK(SetDataBrowserTableViewItemRowHeight); |
|---|
| 2715 | n/a | #endif |
|---|
| 2716 | n/a | if (!PyArg_ParseTuple(_args, "lH", |
|---|
| 2717 | n/a | &item, |
|---|
| 2718 | n/a | &height)) |
|---|
| 2719 | n/a | return NULL; |
|---|
| 2720 | n/a | _err = SetDataBrowserTableViewItemRowHeight(_self->ob_itself, |
|---|
| 2721 | n/a | item, |
|---|
| 2722 | n/a | height); |
|---|
| 2723 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2724 | n/a | Py_INCREF(Py_None); |
|---|
| 2725 | n/a | _res = Py_None; |
|---|
| 2726 | n/a | return _res; |
|---|
| 2727 | n/a | } |
|---|
| 2728 | n/a | |
|---|
| 2729 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewItemRowHeight(ControlObject *_self, PyObject *_args) |
|---|
| 2730 | n/a | { |
|---|
| 2731 | n/a | PyObject *_res = NULL; |
|---|
| 2732 | n/a | OSStatus _err; |
|---|
| 2733 | n/a | UInt32 item; |
|---|
| 2734 | n/a | UInt16 height; |
|---|
| 2735 | n/a | #ifndef GetDataBrowserTableViewItemRowHeight |
|---|
| 2736 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewItemRowHeight); |
|---|
| 2737 | n/a | #endif |
|---|
| 2738 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2739 | n/a | &item)) |
|---|
| 2740 | n/a | return NULL; |
|---|
| 2741 | n/a | _err = GetDataBrowserTableViewItemRowHeight(_self->ob_itself, |
|---|
| 2742 | n/a | item, |
|---|
| 2743 | n/a | &height); |
|---|
| 2744 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2745 | n/a | _res = Py_BuildValue("H", |
|---|
| 2746 | n/a | height); |
|---|
| 2747 | n/a | return _res; |
|---|
| 2748 | n/a | } |
|---|
| 2749 | n/a | |
|---|
| 2750 | n/a | static PyObject *CtlObj_SetDataBrowserTableViewNamedColumnWidth(ControlObject *_self, PyObject *_args) |
|---|
| 2751 | n/a | { |
|---|
| 2752 | n/a | PyObject *_res = NULL; |
|---|
| 2753 | n/a | OSStatus _err; |
|---|
| 2754 | n/a | UInt32 column; |
|---|
| 2755 | n/a | UInt16 width; |
|---|
| 2756 | n/a | #ifndef SetDataBrowserTableViewNamedColumnWidth |
|---|
| 2757 | n/a | PyMac_PRECHECK(SetDataBrowserTableViewNamedColumnWidth); |
|---|
| 2758 | n/a | #endif |
|---|
| 2759 | n/a | if (!PyArg_ParseTuple(_args, "lH", |
|---|
| 2760 | n/a | &column, |
|---|
| 2761 | n/a | &width)) |
|---|
| 2762 | n/a | return NULL; |
|---|
| 2763 | n/a | _err = SetDataBrowserTableViewNamedColumnWidth(_self->ob_itself, |
|---|
| 2764 | n/a | column, |
|---|
| 2765 | n/a | width); |
|---|
| 2766 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2767 | n/a | Py_INCREF(Py_None); |
|---|
| 2768 | n/a | _res = Py_None; |
|---|
| 2769 | n/a | return _res; |
|---|
| 2770 | n/a | } |
|---|
| 2771 | n/a | |
|---|
| 2772 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewNamedColumnWidth(ControlObject *_self, PyObject *_args) |
|---|
| 2773 | n/a | { |
|---|
| 2774 | n/a | PyObject *_res = NULL; |
|---|
| 2775 | n/a | OSStatus _err; |
|---|
| 2776 | n/a | UInt32 column; |
|---|
| 2777 | n/a | UInt16 width; |
|---|
| 2778 | n/a | #ifndef GetDataBrowserTableViewNamedColumnWidth |
|---|
| 2779 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewNamedColumnWidth); |
|---|
| 2780 | n/a | #endif |
|---|
| 2781 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2782 | n/a | &column)) |
|---|
| 2783 | n/a | return NULL; |
|---|
| 2784 | n/a | _err = GetDataBrowserTableViewNamedColumnWidth(_self->ob_itself, |
|---|
| 2785 | n/a | column, |
|---|
| 2786 | n/a | &width); |
|---|
| 2787 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2788 | n/a | _res = Py_BuildValue("H", |
|---|
| 2789 | n/a | width); |
|---|
| 2790 | n/a | return _res; |
|---|
| 2791 | n/a | } |
|---|
| 2792 | n/a | |
|---|
| 2793 | n/a | static PyObject *CtlObj_SetDataBrowserTableViewGeometry(ControlObject *_self, PyObject *_args) |
|---|
| 2794 | n/a | { |
|---|
| 2795 | n/a | PyObject *_res = NULL; |
|---|
| 2796 | n/a | OSStatus _err; |
|---|
| 2797 | n/a | Boolean variableWidthColumns; |
|---|
| 2798 | n/a | Boolean variableHeightRows; |
|---|
| 2799 | n/a | #ifndef SetDataBrowserTableViewGeometry |
|---|
| 2800 | n/a | PyMac_PRECHECK(SetDataBrowserTableViewGeometry); |
|---|
| 2801 | n/a | #endif |
|---|
| 2802 | n/a | if (!PyArg_ParseTuple(_args, "bb", |
|---|
| 2803 | n/a | &variableWidthColumns, |
|---|
| 2804 | n/a | &variableHeightRows)) |
|---|
| 2805 | n/a | return NULL; |
|---|
| 2806 | n/a | _err = SetDataBrowserTableViewGeometry(_self->ob_itself, |
|---|
| 2807 | n/a | variableWidthColumns, |
|---|
| 2808 | n/a | variableHeightRows); |
|---|
| 2809 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2810 | n/a | Py_INCREF(Py_None); |
|---|
| 2811 | n/a | _res = Py_None; |
|---|
| 2812 | n/a | return _res; |
|---|
| 2813 | n/a | } |
|---|
| 2814 | n/a | |
|---|
| 2815 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewGeometry(ControlObject *_self, PyObject *_args) |
|---|
| 2816 | n/a | { |
|---|
| 2817 | n/a | PyObject *_res = NULL; |
|---|
| 2818 | n/a | OSStatus _err; |
|---|
| 2819 | n/a | Boolean variableWidthColumns; |
|---|
| 2820 | n/a | Boolean variableHeightRows; |
|---|
| 2821 | n/a | #ifndef GetDataBrowserTableViewGeometry |
|---|
| 2822 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewGeometry); |
|---|
| 2823 | n/a | #endif |
|---|
| 2824 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2825 | n/a | return NULL; |
|---|
| 2826 | n/a | _err = GetDataBrowserTableViewGeometry(_self->ob_itself, |
|---|
| 2827 | n/a | &variableWidthColumns, |
|---|
| 2828 | n/a | &variableHeightRows); |
|---|
| 2829 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2830 | n/a | _res = Py_BuildValue("bb", |
|---|
| 2831 | n/a | variableWidthColumns, |
|---|
| 2832 | n/a | variableHeightRows); |
|---|
| 2833 | n/a | return _res; |
|---|
| 2834 | n/a | } |
|---|
| 2835 | n/a | |
|---|
| 2836 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewItemID(ControlObject *_self, PyObject *_args) |
|---|
| 2837 | n/a | { |
|---|
| 2838 | n/a | PyObject *_res = NULL; |
|---|
| 2839 | n/a | OSStatus _err; |
|---|
| 2840 | n/a | UInt32 row; |
|---|
| 2841 | n/a | UInt32 item; |
|---|
| 2842 | n/a | #ifndef GetDataBrowserTableViewItemID |
|---|
| 2843 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewItemID); |
|---|
| 2844 | n/a | #endif |
|---|
| 2845 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2846 | n/a | &row)) |
|---|
| 2847 | n/a | return NULL; |
|---|
| 2848 | n/a | _err = GetDataBrowserTableViewItemID(_self->ob_itself, |
|---|
| 2849 | n/a | row, |
|---|
| 2850 | n/a | &item); |
|---|
| 2851 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2852 | n/a | _res = Py_BuildValue("l", |
|---|
| 2853 | n/a | item); |
|---|
| 2854 | n/a | return _res; |
|---|
| 2855 | n/a | } |
|---|
| 2856 | n/a | |
|---|
| 2857 | n/a | static PyObject *CtlObj_SetDataBrowserTableViewItemRow(ControlObject *_self, PyObject *_args) |
|---|
| 2858 | n/a | { |
|---|
| 2859 | n/a | PyObject *_res = NULL; |
|---|
| 2860 | n/a | OSStatus _err; |
|---|
| 2861 | n/a | UInt32 item; |
|---|
| 2862 | n/a | UInt32 row; |
|---|
| 2863 | n/a | #ifndef SetDataBrowserTableViewItemRow |
|---|
| 2864 | n/a | PyMac_PRECHECK(SetDataBrowserTableViewItemRow); |
|---|
| 2865 | n/a | #endif |
|---|
| 2866 | n/a | if (!PyArg_ParseTuple(_args, "ll", |
|---|
| 2867 | n/a | &item, |
|---|
| 2868 | n/a | &row)) |
|---|
| 2869 | n/a | return NULL; |
|---|
| 2870 | n/a | _err = SetDataBrowserTableViewItemRow(_self->ob_itself, |
|---|
| 2871 | n/a | item, |
|---|
| 2872 | n/a | row); |
|---|
| 2873 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2874 | n/a | Py_INCREF(Py_None); |
|---|
| 2875 | n/a | _res = Py_None; |
|---|
| 2876 | n/a | return _res; |
|---|
| 2877 | n/a | } |
|---|
| 2878 | n/a | |
|---|
| 2879 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewItemRow(ControlObject *_self, PyObject *_args) |
|---|
| 2880 | n/a | { |
|---|
| 2881 | n/a | PyObject *_res = NULL; |
|---|
| 2882 | n/a | OSStatus _err; |
|---|
| 2883 | n/a | UInt32 item; |
|---|
| 2884 | n/a | UInt32 row; |
|---|
| 2885 | n/a | #ifndef GetDataBrowserTableViewItemRow |
|---|
| 2886 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewItemRow); |
|---|
| 2887 | n/a | #endif |
|---|
| 2888 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2889 | n/a | &item)) |
|---|
| 2890 | n/a | return NULL; |
|---|
| 2891 | n/a | _err = GetDataBrowserTableViewItemRow(_self->ob_itself, |
|---|
| 2892 | n/a | item, |
|---|
| 2893 | n/a | &row); |
|---|
| 2894 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2895 | n/a | _res = Py_BuildValue("l", |
|---|
| 2896 | n/a | row); |
|---|
| 2897 | n/a | return _res; |
|---|
| 2898 | n/a | } |
|---|
| 2899 | n/a | |
|---|
| 2900 | n/a | static PyObject *CtlObj_SetDataBrowserTableViewColumnPosition(ControlObject *_self, PyObject *_args) |
|---|
| 2901 | n/a | { |
|---|
| 2902 | n/a | PyObject *_res = NULL; |
|---|
| 2903 | n/a | OSStatus _err; |
|---|
| 2904 | n/a | UInt32 column; |
|---|
| 2905 | n/a | UInt32 position; |
|---|
| 2906 | n/a | #ifndef SetDataBrowserTableViewColumnPosition |
|---|
| 2907 | n/a | PyMac_PRECHECK(SetDataBrowserTableViewColumnPosition); |
|---|
| 2908 | n/a | #endif |
|---|
| 2909 | n/a | if (!PyArg_ParseTuple(_args, "ll", |
|---|
| 2910 | n/a | &column, |
|---|
| 2911 | n/a | &position)) |
|---|
| 2912 | n/a | return NULL; |
|---|
| 2913 | n/a | _err = SetDataBrowserTableViewColumnPosition(_self->ob_itself, |
|---|
| 2914 | n/a | column, |
|---|
| 2915 | n/a | position); |
|---|
| 2916 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2917 | n/a | Py_INCREF(Py_None); |
|---|
| 2918 | n/a | _res = Py_None; |
|---|
| 2919 | n/a | return _res; |
|---|
| 2920 | n/a | } |
|---|
| 2921 | n/a | |
|---|
| 2922 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewColumnPosition(ControlObject *_self, PyObject *_args) |
|---|
| 2923 | n/a | { |
|---|
| 2924 | n/a | PyObject *_res = NULL; |
|---|
| 2925 | n/a | OSStatus _err; |
|---|
| 2926 | n/a | UInt32 column; |
|---|
| 2927 | n/a | UInt32 position; |
|---|
| 2928 | n/a | #ifndef GetDataBrowserTableViewColumnPosition |
|---|
| 2929 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewColumnPosition); |
|---|
| 2930 | n/a | #endif |
|---|
| 2931 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2932 | n/a | &column)) |
|---|
| 2933 | n/a | return NULL; |
|---|
| 2934 | n/a | _err = GetDataBrowserTableViewColumnPosition(_self->ob_itself, |
|---|
| 2935 | n/a | column, |
|---|
| 2936 | n/a | &position); |
|---|
| 2937 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2938 | n/a | _res = Py_BuildValue("l", |
|---|
| 2939 | n/a | position); |
|---|
| 2940 | n/a | return _res; |
|---|
| 2941 | n/a | } |
|---|
| 2942 | n/a | |
|---|
| 2943 | n/a | static PyObject *CtlObj_GetDataBrowserTableViewColumnProperty(ControlObject *_self, PyObject *_args) |
|---|
| 2944 | n/a | { |
|---|
| 2945 | n/a | PyObject *_res = NULL; |
|---|
| 2946 | n/a | OSStatus _err; |
|---|
| 2947 | n/a | UInt32 column; |
|---|
| 2948 | n/a | UInt32 property; |
|---|
| 2949 | n/a | #ifndef GetDataBrowserTableViewColumnProperty |
|---|
| 2950 | n/a | PyMac_PRECHECK(GetDataBrowserTableViewColumnProperty); |
|---|
| 2951 | n/a | #endif |
|---|
| 2952 | n/a | if (!PyArg_ParseTuple(_args, "l", |
|---|
| 2953 | n/a | &column)) |
|---|
| 2954 | n/a | return NULL; |
|---|
| 2955 | n/a | _err = GetDataBrowserTableViewColumnProperty(_self->ob_itself, |
|---|
| 2956 | n/a | column, |
|---|
| 2957 | n/a | &property); |
|---|
| 2958 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2959 | n/a | _res = Py_BuildValue("l", |
|---|
| 2960 | n/a | property); |
|---|
| 2961 | n/a | return _res; |
|---|
| 2962 | n/a | } |
|---|
| 2963 | n/a | |
|---|
| 2964 | n/a | static PyObject *CtlObj_AutoSizeDataBrowserListViewColumns(ControlObject *_self, PyObject *_args) |
|---|
| 2965 | n/a | { |
|---|
| 2966 | n/a | PyObject *_res = NULL; |
|---|
| 2967 | n/a | OSStatus _err; |
|---|
| 2968 | n/a | #ifndef AutoSizeDataBrowserListViewColumns |
|---|
| 2969 | n/a | PyMac_PRECHECK(AutoSizeDataBrowserListViewColumns); |
|---|
| 2970 | n/a | #endif |
|---|
| 2971 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 2972 | n/a | return NULL; |
|---|
| 2973 | n/a | _err = AutoSizeDataBrowserListViewColumns(_self->ob_itself); |
|---|
| 2974 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2975 | n/a | Py_INCREF(Py_None); |
|---|
| 2976 | n/a | _res = Py_None; |
|---|
| 2977 | n/a | return _res; |
|---|
| 2978 | n/a | } |
|---|
| 2979 | n/a | |
|---|
| 2980 | n/a | static PyObject *CtlObj_AddDataBrowserListViewColumn(ControlObject *_self, PyObject *_args) |
|---|
| 2981 | n/a | { |
|---|
| 2982 | n/a | PyObject *_res = NULL; |
|---|
| 2983 | n/a | OSStatus _err; |
|---|
| 2984 | n/a | DataBrowserListViewColumnDesc columnDesc; |
|---|
| 2985 | n/a | UInt32 position; |
|---|
| 2986 | n/a | #ifndef AddDataBrowserListViewColumn |
|---|
| 2987 | n/a | PyMac_PRECHECK(AddDataBrowserListViewColumn); |
|---|
| 2988 | n/a | #endif |
|---|
| 2989 | n/a | if (!PyArg_ParseTuple(_args, "O&l", |
|---|
| 2990 | n/a | DataBrowserListViewColumnDesc_Convert, &columnDesc, |
|---|
| 2991 | n/a | &position)) |
|---|
| 2992 | n/a | return NULL; |
|---|
| 2993 | n/a | _err = AddDataBrowserListViewColumn(_self->ob_itself, |
|---|
| 2994 | n/a | &columnDesc, |
|---|
| 2995 | n/a | position); |
|---|
| 2996 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 2997 | n/a | Py_INCREF(Py_None); |
|---|
| 2998 | n/a | _res = Py_None; |
|---|
| 2999 | n/a | return _res; |
|---|
| 3000 | n/a | } |
|---|
| 3001 | n/a | |
|---|
| 3002 | n/a | static PyObject *CtlObj_SetDataBrowserListViewHeaderBtnHeight(ControlObject *_self, PyObject *_args) |
|---|
| 3003 | n/a | { |
|---|
| 3004 | n/a | PyObject *_res = NULL; |
|---|
| 3005 | n/a | OSStatus _err; |
|---|
| 3006 | n/a | UInt16 height; |
|---|
| 3007 | n/a | #ifndef SetDataBrowserListViewHeaderBtnHeight |
|---|
| 3008 | n/a | PyMac_PRECHECK(SetDataBrowserListViewHeaderBtnHeight); |
|---|
| 3009 | n/a | #endif |
|---|
| 3010 | n/a | if (!PyArg_ParseTuple(_args, "H", |
|---|
| 3011 | n/a | &height)) |
|---|
| 3012 | n/a | return NULL; |
|---|
| 3013 | n/a | _err = SetDataBrowserListViewHeaderBtnHeight(_self->ob_itself, |
|---|
| 3014 | n/a | height); |
|---|
| 3015 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3016 | n/a | Py_INCREF(Py_None); |
|---|
| 3017 | n/a | _res = Py_None; |
|---|
| 3018 | n/a | return _res; |
|---|
| 3019 | n/a | } |
|---|
| 3020 | n/a | |
|---|
| 3021 | n/a | static PyObject *CtlObj_GetDataBrowserListViewHeaderBtnHeight(ControlObject *_self, PyObject *_args) |
|---|
| 3022 | n/a | { |
|---|
| 3023 | n/a | PyObject *_res = NULL; |
|---|
| 3024 | n/a | OSStatus _err; |
|---|
| 3025 | n/a | UInt16 height; |
|---|
| 3026 | n/a | #ifndef GetDataBrowserListViewHeaderBtnHeight |
|---|
| 3027 | n/a | PyMac_PRECHECK(GetDataBrowserListViewHeaderBtnHeight); |
|---|
| 3028 | n/a | #endif |
|---|
| 3029 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 3030 | n/a | return NULL; |
|---|
| 3031 | n/a | _err = GetDataBrowserListViewHeaderBtnHeight(_self->ob_itself, |
|---|
| 3032 | n/a | &height); |
|---|
| 3033 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3034 | n/a | _res = Py_BuildValue("H", |
|---|
| 3035 | n/a | height); |
|---|
| 3036 | n/a | return _res; |
|---|
| 3037 | n/a | } |
|---|
| 3038 | n/a | |
|---|
| 3039 | n/a | static PyObject *CtlObj_SetDataBrowserListViewUsePlainBackground(ControlObject *_self, PyObject *_args) |
|---|
| 3040 | n/a | { |
|---|
| 3041 | n/a | PyObject *_res = NULL; |
|---|
| 3042 | n/a | OSStatus _err; |
|---|
| 3043 | n/a | Boolean usePlainBackground; |
|---|
| 3044 | n/a | #ifndef SetDataBrowserListViewUsePlainBackground |
|---|
| 3045 | n/a | PyMac_PRECHECK(SetDataBrowserListViewUsePlainBackground); |
|---|
| 3046 | n/a | #endif |
|---|
| 3047 | n/a | if (!PyArg_ParseTuple(_args, "b", |
|---|
| 3048 | n/a | &usePlainBackground)) |
|---|
| 3049 | n/a | return NULL; |
|---|
| 3050 | n/a | _err = SetDataBrowserListViewUsePlainBackground(_self->ob_itself, |
|---|
| 3051 | n/a | usePlainBackground); |
|---|
| 3052 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3053 | n/a | Py_INCREF(Py_None); |
|---|
| 3054 | n/a | _res = Py_None; |
|---|
| 3055 | n/a | return _res; |
|---|
| 3056 | n/a | } |
|---|
| 3057 | n/a | |
|---|
| 3058 | n/a | static PyObject *CtlObj_GetDataBrowserListViewUsePlainBackground(ControlObject *_self, PyObject *_args) |
|---|
| 3059 | n/a | { |
|---|
| 3060 | n/a | PyObject *_res = NULL; |
|---|
| 3061 | n/a | OSStatus _err; |
|---|
| 3062 | n/a | Boolean usePlainBackground; |
|---|
| 3063 | n/a | #ifndef GetDataBrowserListViewUsePlainBackground |
|---|
| 3064 | n/a | PyMac_PRECHECK(GetDataBrowserListViewUsePlainBackground); |
|---|
| 3065 | n/a | #endif |
|---|
| 3066 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 3067 | n/a | return NULL; |
|---|
| 3068 | n/a | _err = GetDataBrowserListViewUsePlainBackground(_self->ob_itself, |
|---|
| 3069 | n/a | &usePlainBackground); |
|---|
| 3070 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3071 | n/a | _res = Py_BuildValue("b", |
|---|
| 3072 | n/a | usePlainBackground); |
|---|
| 3073 | n/a | return _res; |
|---|
| 3074 | n/a | } |
|---|
| 3075 | n/a | |
|---|
| 3076 | n/a | static PyObject *CtlObj_SetDataBrowserListViewDisclosureColumn(ControlObject *_self, PyObject *_args) |
|---|
| 3077 | n/a | { |
|---|
| 3078 | n/a | PyObject *_res = NULL; |
|---|
| 3079 | n/a | OSStatus _err; |
|---|
| 3080 | n/a | UInt32 column; |
|---|
| 3081 | n/a | Boolean expandableRows; |
|---|
| 3082 | n/a | #ifndef SetDataBrowserListViewDisclosureColumn |
|---|
| 3083 | n/a | PyMac_PRECHECK(SetDataBrowserListViewDisclosureColumn); |
|---|
| 3084 | n/a | #endif |
|---|
| 3085 | n/a | if (!PyArg_ParseTuple(_args, "lb", |
|---|
| 3086 | n/a | &column, |
|---|
| 3087 | n/a | &expandableRows)) |
|---|
| 3088 | n/a | return NULL; |
|---|
| 3089 | n/a | _err = SetDataBrowserListViewDisclosureColumn(_self->ob_itself, |
|---|
| 3090 | n/a | column, |
|---|
| 3091 | n/a | expandableRows); |
|---|
| 3092 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3093 | n/a | Py_INCREF(Py_None); |
|---|
| 3094 | n/a | _res = Py_None; |
|---|
| 3095 | n/a | return _res; |
|---|
| 3096 | n/a | } |
|---|
| 3097 | n/a | |
|---|
| 3098 | n/a | static PyObject *CtlObj_GetDataBrowserListViewDisclosureColumn(ControlObject *_self, PyObject *_args) |
|---|
| 3099 | n/a | { |
|---|
| 3100 | n/a | PyObject *_res = NULL; |
|---|
| 3101 | n/a | OSStatus _err; |
|---|
| 3102 | n/a | UInt32 column; |
|---|
| 3103 | n/a | Boolean expandableRows; |
|---|
| 3104 | n/a | #ifndef GetDataBrowserListViewDisclosureColumn |
|---|
| 3105 | n/a | PyMac_PRECHECK(GetDataBrowserListViewDisclosureColumn); |
|---|
| 3106 | n/a | #endif |
|---|
| 3107 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 3108 | n/a | return NULL; |
|---|
| 3109 | n/a | _err = GetDataBrowserListViewDisclosureColumn(_self->ob_itself, |
|---|
| 3110 | n/a | &column, |
|---|
| 3111 | n/a | &expandableRows); |
|---|
| 3112 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3113 | n/a | _res = Py_BuildValue("lb", |
|---|
| 3114 | n/a | column, |
|---|
| 3115 | n/a | expandableRows); |
|---|
| 3116 | n/a | return _res; |
|---|
| 3117 | n/a | } |
|---|
| 3118 | n/a | |
|---|
| 3119 | n/a | static PyObject *CtlObj_GetDataBrowserColumnViewPath(ControlObject *_self, PyObject *_args) |
|---|
| 3120 | n/a | { |
|---|
| 3121 | n/a | PyObject *_res = NULL; |
|---|
| 3122 | n/a | OSStatus _err; |
|---|
| 3123 | n/a | Handle path; |
|---|
| 3124 | n/a | #ifndef GetDataBrowserColumnViewPath |
|---|
| 3125 | n/a | PyMac_PRECHECK(GetDataBrowserColumnViewPath); |
|---|
| 3126 | n/a | #endif |
|---|
| 3127 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 3128 | n/a | ResObj_Convert, &path)) |
|---|
| 3129 | n/a | return NULL; |
|---|
| 3130 | n/a | _err = GetDataBrowserColumnViewPath(_self->ob_itself, |
|---|
| 3131 | n/a | path); |
|---|
| 3132 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3133 | n/a | Py_INCREF(Py_None); |
|---|
| 3134 | n/a | _res = Py_None; |
|---|
| 3135 | n/a | return _res; |
|---|
| 3136 | n/a | } |
|---|
| 3137 | n/a | |
|---|
| 3138 | n/a | static PyObject *CtlObj_GetDataBrowserColumnViewPathLength(ControlObject *_self, PyObject *_args) |
|---|
| 3139 | n/a | { |
|---|
| 3140 | n/a | PyObject *_res = NULL; |
|---|
| 3141 | n/a | OSStatus _err; |
|---|
| 3142 | n/a | UInt32 pathLength; |
|---|
| 3143 | n/a | #ifndef GetDataBrowserColumnViewPathLength |
|---|
| 3144 | n/a | PyMac_PRECHECK(GetDataBrowserColumnViewPathLength); |
|---|
| 3145 | n/a | #endif |
|---|
| 3146 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 3147 | n/a | return NULL; |
|---|
| 3148 | n/a | _err = GetDataBrowserColumnViewPathLength(_self->ob_itself, |
|---|
| 3149 | n/a | &pathLength); |
|---|
| 3150 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3151 | n/a | _res = Py_BuildValue("l", |
|---|
| 3152 | n/a | pathLength); |
|---|
| 3153 | n/a | return _res; |
|---|
| 3154 | n/a | } |
|---|
| 3155 | n/a | |
|---|
| 3156 | n/a | static PyObject *CtlObj_SetDataBrowserColumnViewDisplayType(ControlObject *_self, PyObject *_args) |
|---|
| 3157 | n/a | { |
|---|
| 3158 | n/a | PyObject *_res = NULL; |
|---|
| 3159 | n/a | OSStatus _err; |
|---|
| 3160 | n/a | OSType propertyType; |
|---|
| 3161 | n/a | #ifndef SetDataBrowserColumnViewDisplayType |
|---|
| 3162 | n/a | PyMac_PRECHECK(SetDataBrowserColumnViewDisplayType); |
|---|
| 3163 | n/a | #endif |
|---|
| 3164 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 3165 | n/a | PyMac_GetOSType, &propertyType)) |
|---|
| 3166 | n/a | return NULL; |
|---|
| 3167 | n/a | _err = SetDataBrowserColumnViewDisplayType(_self->ob_itself, |
|---|
| 3168 | n/a | propertyType); |
|---|
| 3169 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3170 | n/a | Py_INCREF(Py_None); |
|---|
| 3171 | n/a | _res = Py_None; |
|---|
| 3172 | n/a | return _res; |
|---|
| 3173 | n/a | } |
|---|
| 3174 | n/a | |
|---|
| 3175 | n/a | static PyObject *CtlObj_GetDataBrowserColumnViewDisplayType(ControlObject *_self, PyObject *_args) |
|---|
| 3176 | n/a | { |
|---|
| 3177 | n/a | PyObject *_res = NULL; |
|---|
| 3178 | n/a | OSStatus _err; |
|---|
| 3179 | n/a | OSType propertyType; |
|---|
| 3180 | n/a | #ifndef GetDataBrowserColumnViewDisplayType |
|---|
| 3181 | n/a | PyMac_PRECHECK(GetDataBrowserColumnViewDisplayType); |
|---|
| 3182 | n/a | #endif |
|---|
| 3183 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 3184 | n/a | return NULL; |
|---|
| 3185 | n/a | _err = GetDataBrowserColumnViewDisplayType(_self->ob_itself, |
|---|
| 3186 | n/a | &propertyType); |
|---|
| 3187 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 3188 | n/a | _res = Py_BuildValue("O&", |
|---|
| 3189 | n/a | PyMac_BuildOSType, propertyType); |
|---|
| 3190 | n/a | return _res; |
|---|
| 3191 | n/a | } |
|---|
| 3192 | n/a | |
|---|
| 3193 | n/a | static PyObject *CtlObj_as_Resource(ControlObject *_self, PyObject *_args) |
|---|
| 3194 | n/a | { |
|---|
| 3195 | n/a | PyObject *_res = NULL; |
|---|
| 3196 | n/a | Handle _rv; |
|---|
| 3197 | n/a | #ifndef as_Resource |
|---|
| 3198 | n/a | PyMac_PRECHECK(as_Resource); |
|---|
| 3199 | n/a | #endif |
|---|
| 3200 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 3201 | n/a | return NULL; |
|---|
| 3202 | n/a | _rv = as_Resource(_self->ob_itself); |
|---|
| 3203 | n/a | _res = Py_BuildValue("O&", |
|---|
| 3204 | n/a | ResObj_New, _rv); |
|---|
| 3205 | n/a | return _res; |
|---|
| 3206 | n/a | } |
|---|
| 3207 | n/a | |
|---|
| 3208 | n/a | static PyObject *CtlObj_GetControlRect(ControlObject *_self, PyObject *_args) |
|---|
| 3209 | n/a | { |
|---|
| 3210 | n/a | PyObject *_res = NULL; |
|---|
| 3211 | n/a | Rect rect; |
|---|
| 3212 | n/a | #ifndef GetControlRect |
|---|
| 3213 | n/a | PyMac_PRECHECK(GetControlRect); |
|---|
| 3214 | n/a | #endif |
|---|
| 3215 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 3216 | n/a | return NULL; |
|---|
| 3217 | n/a | GetControlRect(_self->ob_itself, |
|---|
| 3218 | n/a | &rect); |
|---|
| 3219 | n/a | _res = Py_BuildValue("O&", |
|---|
| 3220 | n/a | PyMac_BuildRect, &rect); |
|---|
| 3221 | n/a | return _res; |
|---|
| 3222 | n/a | } |
|---|
| 3223 | n/a | |
|---|
| 3224 | n/a | static PyObject *CtlObj_DisposeControl(ControlObject *_self, PyObject *_args) |
|---|
| 3225 | n/a | { |
|---|
| 3226 | n/a | PyObject *_res = NULL; |
|---|
| 3227 | n/a | |
|---|
| 3228 | n/a | if (!PyArg_ParseTuple(_args, "")) |
|---|
| 3229 | n/a | return NULL; |
|---|
| 3230 | n/a | if ( _self->ob_itself ) { |
|---|
| 3231 | n/a | SetControlReference(_self->ob_itself, (long)0); /* Make it forget about us */ |
|---|
| 3232 | n/a | DisposeControl(_self->ob_itself); |
|---|
| 3233 | n/a | _self->ob_itself = NULL; |
|---|
| 3234 | n/a | } |
|---|
| 3235 | n/a | Py_INCREF(Py_None); |
|---|
| 3236 | n/a | _res = Py_None; |
|---|
| 3237 | n/a | return _res; |
|---|
| 3238 | n/a | |
|---|
| 3239 | n/a | } |
|---|
| 3240 | n/a | |
|---|
| 3241 | n/a | static PyObject *CtlObj_TrackControl(ControlObject *_self, PyObject *_args) |
|---|
| 3242 | n/a | { |
|---|
| 3243 | n/a | PyObject *_res = NULL; |
|---|
| 3244 | n/a | |
|---|
| 3245 | n/a | ControlPartCode _rv; |
|---|
| 3246 | n/a | Point startPoint; |
|---|
| 3247 | n/a | ControlActionUPP upp = 0; |
|---|
| 3248 | n/a | PyObject *callback = 0; |
|---|
| 3249 | n/a | |
|---|
| 3250 | n/a | if (!PyArg_ParseTuple(_args, "O&|O", |
|---|
| 3251 | n/a | PyMac_GetPoint, &startPoint, &callback)) |
|---|
| 3252 | n/a | return NULL; |
|---|
| 3253 | n/a | if (callback && callback != Py_None) { |
|---|
| 3254 | n/a | if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1) |
|---|
| 3255 | n/a | upp = (ControlActionUPP)-1; |
|---|
| 3256 | n/a | else { |
|---|
| 3257 | n/a | settrackfunc(callback); |
|---|
| 3258 | n/a | upp = mytracker_upp; |
|---|
| 3259 | n/a | } |
|---|
| 3260 | n/a | } |
|---|
| 3261 | n/a | _rv = TrackControl(_self->ob_itself, |
|---|
| 3262 | n/a | startPoint, |
|---|
| 3263 | n/a | upp); |
|---|
| 3264 | n/a | clrtrackfunc(); |
|---|
| 3265 | n/a | _res = Py_BuildValue("h", |
|---|
| 3266 | n/a | _rv); |
|---|
| 3267 | n/a | return _res; |
|---|
| 3268 | n/a | |
|---|
| 3269 | n/a | } |
|---|
| 3270 | n/a | |
|---|
| 3271 | n/a | static PyObject *CtlObj_HandleControlClick(ControlObject *_self, PyObject *_args) |
|---|
| 3272 | n/a | { |
|---|
| 3273 | n/a | PyObject *_res = NULL; |
|---|
| 3274 | n/a | |
|---|
| 3275 | n/a | ControlPartCode _rv; |
|---|
| 3276 | n/a | Point startPoint; |
|---|
| 3277 | n/a | SInt16 modifiers; |
|---|
| 3278 | n/a | ControlActionUPP upp = 0; |
|---|
| 3279 | n/a | PyObject *callback = 0; |
|---|
| 3280 | n/a | |
|---|
| 3281 | n/a | if (!PyArg_ParseTuple(_args, "O&h|O", |
|---|
| 3282 | n/a | PyMac_GetPoint, &startPoint, |
|---|
| 3283 | n/a | &modifiers, |
|---|
| 3284 | n/a | &callback)) |
|---|
| 3285 | n/a | return NULL; |
|---|
| 3286 | n/a | if (callback && callback != Py_None) { |
|---|
| 3287 | n/a | if (PyInt_Check(callback) && PyInt_AS_LONG(callback) == -1) |
|---|
| 3288 | n/a | upp = (ControlActionUPP)-1; |
|---|
| 3289 | n/a | else { |
|---|
| 3290 | n/a | settrackfunc(callback); |
|---|
| 3291 | n/a | upp = mytracker_upp; |
|---|
| 3292 | n/a | } |
|---|
| 3293 | n/a | } |
|---|
| 3294 | n/a | _rv = HandleControlClick(_self->ob_itself, |
|---|
| 3295 | n/a | startPoint, |
|---|
| 3296 | n/a | modifiers, |
|---|
| 3297 | n/a | upp); |
|---|
| 3298 | n/a | clrtrackfunc(); |
|---|
| 3299 | n/a | _res = Py_BuildValue("h", |
|---|
| 3300 | n/a | _rv); |
|---|
| 3301 | n/a | return _res; |
|---|
| 3302 | n/a | |
|---|
| 3303 | n/a | } |
|---|
| 3304 | n/a | |
|---|
| 3305 | n/a | static PyObject *CtlObj_SetControlData(ControlObject *_self, PyObject *_args) |
|---|
| 3306 | n/a | { |
|---|
| 3307 | n/a | PyObject *_res = NULL; |
|---|
| 3308 | n/a | |
|---|
| 3309 | n/a | OSErr _err; |
|---|
| 3310 | n/a | ControlPartCode inPart; |
|---|
| 3311 | n/a | ResType inTagName; |
|---|
| 3312 | n/a | Size bufferSize; |
|---|
| 3313 | n/a | Ptr buffer; |
|---|
| 3314 | n/a | |
|---|
| 3315 | n/a | if (!PyArg_ParseTuple(_args, "hO&s#", |
|---|
| 3316 | n/a | &inPart, |
|---|
| 3317 | n/a | PyMac_GetOSType, &inTagName, |
|---|
| 3318 | n/a | &buffer, &bufferSize)) |
|---|
| 3319 | n/a | return NULL; |
|---|
| 3320 | n/a | |
|---|
| 3321 | n/a | _err = SetControlData(_self->ob_itself, |
|---|
| 3322 | n/a | inPart, |
|---|
| 3323 | n/a | inTagName, |
|---|
| 3324 | n/a | bufferSize, |
|---|
| 3325 | n/a | buffer); |
|---|
| 3326 | n/a | |
|---|
| 3327 | n/a | if (_err != noErr) |
|---|
| 3328 | n/a | return PyMac_Error(_err); |
|---|
| 3329 | n/a | _res = Py_None; |
|---|
| 3330 | n/a | return _res; |
|---|
| 3331 | n/a | |
|---|
| 3332 | n/a | } |
|---|
| 3333 | n/a | |
|---|
| 3334 | n/a | static PyObject *CtlObj_GetControlData(ControlObject *_self, PyObject *_args) |
|---|
| 3335 | n/a | { |
|---|
| 3336 | n/a | PyObject *_res = NULL; |
|---|
| 3337 | n/a | |
|---|
| 3338 | n/a | OSErr _err; |
|---|
| 3339 | n/a | ControlPartCode inPart; |
|---|
| 3340 | n/a | ResType inTagName; |
|---|
| 3341 | n/a | Size bufferSize; |
|---|
| 3342 | n/a | Ptr buffer; |
|---|
| 3343 | n/a | Size outSize; |
|---|
| 3344 | n/a | |
|---|
| 3345 | n/a | if (!PyArg_ParseTuple(_args, "hO&", |
|---|
| 3346 | n/a | &inPart, |
|---|
| 3347 | n/a | PyMac_GetOSType, &inTagName)) |
|---|
| 3348 | n/a | return NULL; |
|---|
| 3349 | n/a | |
|---|
| 3350 | n/a | /* allocate a buffer for the data */ |
|---|
| 3351 | n/a | _err = GetControlDataSize(_self->ob_itself, |
|---|
| 3352 | n/a | inPart, |
|---|
| 3353 | n/a | inTagName, |
|---|
| 3354 | n/a | &bufferSize); |
|---|
| 3355 | n/a | if (_err != noErr) |
|---|
| 3356 | n/a | return PyMac_Error(_err); |
|---|
| 3357 | n/a | buffer = PyMem_NEW(char, bufferSize); |
|---|
| 3358 | n/a | if (buffer == NULL) |
|---|
| 3359 | n/a | return PyErr_NoMemory(); |
|---|
| 3360 | n/a | |
|---|
| 3361 | n/a | _err = GetControlData(_self->ob_itself, |
|---|
| 3362 | n/a | inPart, |
|---|
| 3363 | n/a | inTagName, |
|---|
| 3364 | n/a | bufferSize, |
|---|
| 3365 | n/a | buffer, |
|---|
| 3366 | n/a | &outSize); |
|---|
| 3367 | n/a | |
|---|
| 3368 | n/a | if (_err != noErr) { |
|---|
| 3369 | n/a | PyMem_DEL(buffer); |
|---|
| 3370 | n/a | return PyMac_Error(_err); |
|---|
| 3371 | n/a | } |
|---|
| 3372 | n/a | _res = Py_BuildValue("s#", buffer, outSize); |
|---|
| 3373 | n/a | PyMem_DEL(buffer); |
|---|
| 3374 | n/a | return _res; |
|---|
| 3375 | n/a | |
|---|
| 3376 | n/a | } |
|---|
| 3377 | n/a | |
|---|
| 3378 | n/a | static PyObject *CtlObj_SetControlData_Handle(ControlObject *_self, PyObject *_args) |
|---|
| 3379 | n/a | { |
|---|
| 3380 | n/a | PyObject *_res = NULL; |
|---|
| 3381 | n/a | |
|---|
| 3382 | n/a | OSErr _err; |
|---|
| 3383 | n/a | ControlPartCode inPart; |
|---|
| 3384 | n/a | ResType inTagName; |
|---|
| 3385 | n/a | Handle buffer; |
|---|
| 3386 | n/a | |
|---|
| 3387 | n/a | if (!PyArg_ParseTuple(_args, "hO&O&", |
|---|
| 3388 | n/a | &inPart, |
|---|
| 3389 | n/a | PyMac_GetOSType, &inTagName, |
|---|
| 3390 | n/a | OptResObj_Convert, &buffer)) |
|---|
| 3391 | n/a | return NULL; |
|---|
| 3392 | n/a | |
|---|
| 3393 | n/a | _err = SetControlData(_self->ob_itself, |
|---|
| 3394 | n/a | inPart, |
|---|
| 3395 | n/a | inTagName, |
|---|
| 3396 | n/a | sizeof(buffer), |
|---|
| 3397 | n/a | (Ptr)&buffer); |
|---|
| 3398 | n/a | |
|---|
| 3399 | n/a | if (_err != noErr) |
|---|
| 3400 | n/a | return PyMac_Error(_err); |
|---|
| 3401 | n/a | _res = Py_None; |
|---|
| 3402 | n/a | return _res; |
|---|
| 3403 | n/a | |
|---|
| 3404 | n/a | } |
|---|
| 3405 | n/a | |
|---|
| 3406 | n/a | static PyObject *CtlObj_GetControlData_Handle(ControlObject *_self, PyObject *_args) |
|---|
| 3407 | n/a | { |
|---|
| 3408 | n/a | PyObject *_res = NULL; |
|---|
| 3409 | n/a | |
|---|
| 3410 | n/a | OSErr _err; |
|---|
| 3411 | n/a | ControlPartCode inPart; |
|---|
| 3412 | n/a | ResType inTagName; |
|---|
| 3413 | n/a | Size bufferSize; |
|---|
| 3414 | n/a | Handle hdl; |
|---|
| 3415 | n/a | |
|---|
| 3416 | n/a | if (!PyArg_ParseTuple(_args, "hO&", |
|---|
| 3417 | n/a | &inPart, |
|---|
| 3418 | n/a | PyMac_GetOSType, &inTagName)) |
|---|
| 3419 | n/a | return NULL; |
|---|
| 3420 | n/a | |
|---|
| 3421 | n/a | /* Check it is handle-sized */ |
|---|
| 3422 | n/a | _err = GetControlDataSize(_self->ob_itself, |
|---|
| 3423 | n/a | inPart, |
|---|
| 3424 | n/a | inTagName, |
|---|
| 3425 | n/a | &bufferSize); |
|---|
| 3426 | n/a | if (_err != noErr) |
|---|
| 3427 | n/a | return PyMac_Error(_err); |
|---|
| 3428 | n/a | if (bufferSize != sizeof(Handle)) { |
|---|
| 3429 | n/a | PyErr_SetString(Ctl_Error, "GetControlDataSize() != sizeof(Handle)"); |
|---|
| 3430 | n/a | return NULL; |
|---|
| 3431 | n/a | } |
|---|
| 3432 | n/a | |
|---|
| 3433 | n/a | _err = GetControlData(_self->ob_itself, |
|---|
| 3434 | n/a | inPart, |
|---|
| 3435 | n/a | inTagName, |
|---|
| 3436 | n/a | sizeof(Handle), |
|---|
| 3437 | n/a | (Ptr)&hdl, |
|---|
| 3438 | n/a | &bufferSize); |
|---|
| 3439 | n/a | |
|---|
| 3440 | n/a | if (_err != noErr) { |
|---|
| 3441 | n/a | return PyMac_Error(_err); |
|---|
| 3442 | n/a | } |
|---|
| 3443 | n/a | _res = Py_BuildValue("O&", OptResObj_New, hdl); |
|---|
| 3444 | n/a | return _res; |
|---|
| 3445 | n/a | |
|---|
| 3446 | n/a | } |
|---|
| 3447 | n/a | |
|---|
| 3448 | n/a | static PyObject *CtlObj_SetControlData_Callback(ControlObject *_self, PyObject *_args) |
|---|
| 3449 | n/a | { |
|---|
| 3450 | n/a | PyObject *_res = NULL; |
|---|
| 3451 | n/a | |
|---|
| 3452 | n/a | OSErr _err; |
|---|
| 3453 | n/a | ControlPartCode inPart; |
|---|
| 3454 | n/a | ResType inTagName; |
|---|
| 3455 | n/a | PyObject *callback; |
|---|
| 3456 | n/a | UniversalProcPtr c_callback; |
|---|
| 3457 | n/a | |
|---|
| 3458 | n/a | if (!PyArg_ParseTuple(_args, "hO&O", |
|---|
| 3459 | n/a | &inPart, |
|---|
| 3460 | n/a | PyMac_GetOSType, &inTagName, |
|---|
| 3461 | n/a | &callback)) |
|---|
| 3462 | n/a | return NULL; |
|---|
| 3463 | n/a | |
|---|
| 3464 | n/a | if ( setcallback((PyObject *)_self, inTagName, callback, &c_callback) < 0 ) |
|---|
| 3465 | n/a | return NULL; |
|---|
| 3466 | n/a | _err = SetControlData(_self->ob_itself, |
|---|
| 3467 | n/a | inPart, |
|---|
| 3468 | n/a | inTagName, |
|---|
| 3469 | n/a | sizeof(c_callback), |
|---|
| 3470 | n/a | (Ptr)&c_callback); |
|---|
| 3471 | n/a | |
|---|
| 3472 | n/a | if (_err != noErr) |
|---|
| 3473 | n/a | return PyMac_Error(_err); |
|---|
| 3474 | n/a | _res = Py_None; |
|---|
| 3475 | n/a | return _res; |
|---|
| 3476 | n/a | |
|---|
| 3477 | n/a | } |
|---|
| 3478 | n/a | |
|---|
| 3479 | n/a | static PyMethodDef CtlObj_methods[] = { |
|---|
| 3480 | n/a | {"HiliteControl", (PyCFunction)CtlObj_HiliteControl, 1, |
|---|
| 3481 | n/a | PyDoc_STR("(ControlPartCode hiliteState) -> None")}, |
|---|
| 3482 | n/a | {"ShowControl", (PyCFunction)CtlObj_ShowControl, 1, |
|---|
| 3483 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3484 | n/a | {"HideControl", (PyCFunction)CtlObj_HideControl, 1, |
|---|
| 3485 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3486 | n/a | {"IsControlActive", (PyCFunction)CtlObj_IsControlActive, 1, |
|---|
| 3487 | n/a | PyDoc_STR("() -> (Boolean _rv)")}, |
|---|
| 3488 | n/a | {"IsControlVisible", (PyCFunction)CtlObj_IsControlVisible, 1, |
|---|
| 3489 | n/a | PyDoc_STR("() -> (Boolean _rv)")}, |
|---|
| 3490 | n/a | {"ActivateControl", (PyCFunction)CtlObj_ActivateControl, 1, |
|---|
| 3491 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3492 | n/a | {"DeactivateControl", (PyCFunction)CtlObj_DeactivateControl, 1, |
|---|
| 3493 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3494 | n/a | {"SetControlVisibility", (PyCFunction)CtlObj_SetControlVisibility, 1, |
|---|
| 3495 | n/a | PyDoc_STR("(Boolean inIsVisible, Boolean inDoDraw) -> None")}, |
|---|
| 3496 | n/a | {"IsControlEnabled", (PyCFunction)CtlObj_IsControlEnabled, 1, |
|---|
| 3497 | n/a | PyDoc_STR("() -> (Boolean _rv)")}, |
|---|
| 3498 | n/a | {"EnableControl", (PyCFunction)CtlObj_EnableControl, 1, |
|---|
| 3499 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3500 | n/a | {"DisableControl", (PyCFunction)CtlObj_DisableControl, 1, |
|---|
| 3501 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3502 | n/a | {"Draw1Control", (PyCFunction)CtlObj_Draw1Control, 1, |
|---|
| 3503 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3504 | n/a | {"GetBestControlRect", (PyCFunction)CtlObj_GetBestControlRect, 1, |
|---|
| 3505 | n/a | PyDoc_STR("() -> (Rect outRect, SInt16 outBaseLineOffset)")}, |
|---|
| 3506 | n/a | {"SetControlFontStyle", (PyCFunction)CtlObj_SetControlFontStyle, 1, |
|---|
| 3507 | n/a | PyDoc_STR("(ControlFontStyleRec inStyle) -> None")}, |
|---|
| 3508 | n/a | {"DrawControlInCurrentPort", (PyCFunction)CtlObj_DrawControlInCurrentPort, 1, |
|---|
| 3509 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3510 | n/a | {"SetUpControlBackground", (PyCFunction)CtlObj_SetUpControlBackground, 1, |
|---|
| 3511 | n/a | PyDoc_STR("(SInt16 inDepth, Boolean inIsColorDevice) -> None")}, |
|---|
| 3512 | n/a | {"SetUpControlTextColor", (PyCFunction)CtlObj_SetUpControlTextColor, 1, |
|---|
| 3513 | n/a | PyDoc_STR("(SInt16 inDepth, Boolean inIsColorDevice) -> None")}, |
|---|
| 3514 | n/a | {"DragControl", (PyCFunction)CtlObj_DragControl, 1, |
|---|
| 3515 | n/a | PyDoc_STR("(Point startPoint, Rect limitRect, Rect slopRect, DragConstraint axis) -> None")}, |
|---|
| 3516 | n/a | {"TestControl", (PyCFunction)CtlObj_TestControl, 1, |
|---|
| 3517 | n/a | PyDoc_STR("(Point testPoint) -> (ControlPartCode _rv)")}, |
|---|
| 3518 | n/a | {"HandleControlContextualMenuClick", (PyCFunction)CtlObj_HandleControlContextualMenuClick, 1, |
|---|
| 3519 | n/a | PyDoc_STR("(Point inWhere) -> (Boolean menuDisplayed)")}, |
|---|
| 3520 | n/a | {"GetControlClickActivation", (PyCFunction)CtlObj_GetControlClickActivation, 1, |
|---|
| 3521 | n/a | PyDoc_STR("(Point inWhere, EventModifiers inModifiers) -> (ClickActivationResult outResult)")}, |
|---|
| 3522 | n/a | {"HandleControlKey", (PyCFunction)CtlObj_HandleControlKey, 1, |
|---|
| 3523 | n/a | PyDoc_STR("(SInt16 inKeyCode, SInt16 inCharCode, EventModifiers inModifiers) -> (ControlPartCode _rv)")}, |
|---|
| 3524 | n/a | {"HandleControlSetCursor", (PyCFunction)CtlObj_HandleControlSetCursor, 1, |
|---|
| 3525 | n/a | PyDoc_STR("(Point localPoint, EventModifiers modifiers) -> (Boolean cursorWasSet)")}, |
|---|
| 3526 | n/a | {"MoveControl", (PyCFunction)CtlObj_MoveControl, 1, |
|---|
| 3527 | n/a | PyDoc_STR("(SInt16 h, SInt16 v) -> None")}, |
|---|
| 3528 | n/a | {"SizeControl", (PyCFunction)CtlObj_SizeControl, 1, |
|---|
| 3529 | n/a | PyDoc_STR("(SInt16 w, SInt16 h) -> None")}, |
|---|
| 3530 | n/a | {"SetControlTitle", (PyCFunction)CtlObj_SetControlTitle, 1, |
|---|
| 3531 | n/a | PyDoc_STR("(Str255 title) -> None")}, |
|---|
| 3532 | n/a | {"GetControlTitle", (PyCFunction)CtlObj_GetControlTitle, 1, |
|---|
| 3533 | n/a | PyDoc_STR("() -> (Str255 title)")}, |
|---|
| 3534 | n/a | {"SetControlTitleWithCFString", (PyCFunction)CtlObj_SetControlTitleWithCFString, 1, |
|---|
| 3535 | n/a | PyDoc_STR("(CFStringRef inString) -> None")}, |
|---|
| 3536 | n/a | {"CopyControlTitleAsCFString", (PyCFunction)CtlObj_CopyControlTitleAsCFString, 1, |
|---|
| 3537 | n/a | PyDoc_STR("() -> (CFStringRef outString)")}, |
|---|
| 3538 | n/a | {"GetControlValue", (PyCFunction)CtlObj_GetControlValue, 1, |
|---|
| 3539 | n/a | PyDoc_STR("() -> (SInt16 _rv)")}, |
|---|
| 3540 | n/a | {"SetControlValue", (PyCFunction)CtlObj_SetControlValue, 1, |
|---|
| 3541 | n/a | PyDoc_STR("(SInt16 newValue) -> None")}, |
|---|
| 3542 | n/a | {"GetControlMinimum", (PyCFunction)CtlObj_GetControlMinimum, 1, |
|---|
| 3543 | n/a | PyDoc_STR("() -> (SInt16 _rv)")}, |
|---|
| 3544 | n/a | {"SetControlMinimum", (PyCFunction)CtlObj_SetControlMinimum, 1, |
|---|
| 3545 | n/a | PyDoc_STR("(SInt16 newMinimum) -> None")}, |
|---|
| 3546 | n/a | {"GetControlMaximum", (PyCFunction)CtlObj_GetControlMaximum, 1, |
|---|
| 3547 | n/a | PyDoc_STR("() -> (SInt16 _rv)")}, |
|---|
| 3548 | n/a | {"SetControlMaximum", (PyCFunction)CtlObj_SetControlMaximum, 1, |
|---|
| 3549 | n/a | PyDoc_STR("(SInt16 newMaximum) -> None")}, |
|---|
| 3550 | n/a | {"GetControlViewSize", (PyCFunction)CtlObj_GetControlViewSize, 1, |
|---|
| 3551 | n/a | PyDoc_STR("() -> (SInt32 _rv)")}, |
|---|
| 3552 | n/a | {"SetControlViewSize", (PyCFunction)CtlObj_SetControlViewSize, 1, |
|---|
| 3553 | n/a | PyDoc_STR("(SInt32 newViewSize) -> None")}, |
|---|
| 3554 | n/a | {"GetControl32BitValue", (PyCFunction)CtlObj_GetControl32BitValue, 1, |
|---|
| 3555 | n/a | PyDoc_STR("() -> (SInt32 _rv)")}, |
|---|
| 3556 | n/a | {"SetControl32BitValue", (PyCFunction)CtlObj_SetControl32BitValue, 1, |
|---|
| 3557 | n/a | PyDoc_STR("(SInt32 newValue) -> None")}, |
|---|
| 3558 | n/a | {"GetControl32BitMaximum", (PyCFunction)CtlObj_GetControl32BitMaximum, 1, |
|---|
| 3559 | n/a | PyDoc_STR("() -> (SInt32 _rv)")}, |
|---|
| 3560 | n/a | {"SetControl32BitMaximum", (PyCFunction)CtlObj_SetControl32BitMaximum, 1, |
|---|
| 3561 | n/a | PyDoc_STR("(SInt32 newMaximum) -> None")}, |
|---|
| 3562 | n/a | {"GetControl32BitMinimum", (PyCFunction)CtlObj_GetControl32BitMinimum, 1, |
|---|
| 3563 | n/a | PyDoc_STR("() -> (SInt32 _rv)")}, |
|---|
| 3564 | n/a | {"SetControl32BitMinimum", (PyCFunction)CtlObj_SetControl32BitMinimum, 1, |
|---|
| 3565 | n/a | PyDoc_STR("(SInt32 newMinimum) -> None")}, |
|---|
| 3566 | n/a | {"IsValidControlHandle", (PyCFunction)CtlObj_IsValidControlHandle, 1, |
|---|
| 3567 | n/a | PyDoc_STR("() -> (Boolean _rv)")}, |
|---|
| 3568 | n/a | {"SetControlID", (PyCFunction)CtlObj_SetControlID, 1, |
|---|
| 3569 | n/a | PyDoc_STR("(ControlID inID) -> None")}, |
|---|
| 3570 | n/a | {"GetControlID", (PyCFunction)CtlObj_GetControlID, 1, |
|---|
| 3571 | n/a | PyDoc_STR("() -> (ControlID outID)")}, |
|---|
| 3572 | n/a | {"SetControlCommandID", (PyCFunction)CtlObj_SetControlCommandID, 1, |
|---|
| 3573 | n/a | PyDoc_STR("(UInt32 inCommandID) -> None")}, |
|---|
| 3574 | n/a | {"GetControlCommandID", (PyCFunction)CtlObj_GetControlCommandID, 1, |
|---|
| 3575 | n/a | PyDoc_STR("() -> (UInt32 outCommandID)")}, |
|---|
| 3576 | n/a | {"RemoveControlProperty", (PyCFunction)CtlObj_RemoveControlProperty, 1, |
|---|
| 3577 | n/a | PyDoc_STR("(OSType propertyCreator, OSType propertyTag) -> None")}, |
|---|
| 3578 | n/a | {"GetControlPropertyAttributes", (PyCFunction)CtlObj_GetControlPropertyAttributes, 1, |
|---|
| 3579 | n/a | PyDoc_STR("(OSType propertyCreator, OSType propertyTag) -> (UInt32 attributes)")}, |
|---|
| 3580 | n/a | {"ChangeControlPropertyAttributes", (PyCFunction)CtlObj_ChangeControlPropertyAttributes, 1, |
|---|
| 3581 | n/a | PyDoc_STR("(OSType propertyCreator, OSType propertyTag, UInt32 attributesToSet, UInt32 attributesToClear) -> None")}, |
|---|
| 3582 | n/a | {"GetControlRegion", (PyCFunction)CtlObj_GetControlRegion, 1, |
|---|
| 3583 | n/a | PyDoc_STR("(ControlPartCode inPart, RgnHandle outRegion) -> None")}, |
|---|
| 3584 | n/a | {"GetControlVariant", (PyCFunction)CtlObj_GetControlVariant, 1, |
|---|
| 3585 | n/a | PyDoc_STR("() -> (ControlVariant _rv)")}, |
|---|
| 3586 | n/a | {"SetControlAction", (PyCFunction)CtlObj_SetControlAction, 1, |
|---|
| 3587 | n/a | PyDoc_STR("(PyObject* actionProc) -> None")}, |
|---|
| 3588 | n/a | {"SetControlReference", (PyCFunction)CtlObj_SetControlReference, 1, |
|---|
| 3589 | n/a | PyDoc_STR("(SInt32 data) -> None")}, |
|---|
| 3590 | n/a | {"GetControlReference", (PyCFunction)CtlObj_GetControlReference, 1, |
|---|
| 3591 | n/a | PyDoc_STR("() -> (SInt32 _rv)")}, |
|---|
| 3592 | n/a | {"EmbedControl", (PyCFunction)CtlObj_EmbedControl, 1, |
|---|
| 3593 | n/a | PyDoc_STR("(ControlHandle inContainer) -> None")}, |
|---|
| 3594 | n/a | {"AutoEmbedControl", (PyCFunction)CtlObj_AutoEmbedControl, 1, |
|---|
| 3595 | n/a | PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|---|
| 3596 | n/a | {"GetSuperControl", (PyCFunction)CtlObj_GetSuperControl, 1, |
|---|
| 3597 | n/a | PyDoc_STR("() -> (ControlHandle outParent)")}, |
|---|
| 3598 | n/a | {"CountSubControls", (PyCFunction)CtlObj_CountSubControls, 1, |
|---|
| 3599 | n/a | PyDoc_STR("() -> (UInt16 outNumChildren)")}, |
|---|
| 3600 | n/a | {"GetIndexedSubControl", (PyCFunction)CtlObj_GetIndexedSubControl, 1, |
|---|
| 3601 | n/a | PyDoc_STR("(UInt16 inIndex) -> (ControlHandle outSubControl)")}, |
|---|
| 3602 | n/a | {"SetControlSupervisor", (PyCFunction)CtlObj_SetControlSupervisor, 1, |
|---|
| 3603 | n/a | PyDoc_STR("(ControlHandle inBoss) -> None")}, |
|---|
| 3604 | n/a | {"GetControlFeatures", (PyCFunction)CtlObj_GetControlFeatures, 1, |
|---|
| 3605 | n/a | PyDoc_STR("() -> (UInt32 outFeatures)")}, |
|---|
| 3606 | n/a | {"GetControlDataSize", (PyCFunction)CtlObj_GetControlDataSize, 1, |
|---|
| 3607 | n/a | PyDoc_STR("(ControlPartCode inPart, ResType inTagName) -> (Size outMaxSize)")}, |
|---|
| 3608 | n/a | {"HandleControlDragTracking", (PyCFunction)CtlObj_HandleControlDragTracking, 1, |
|---|
| 3609 | n/a | PyDoc_STR("(DragTrackingMessage inMessage, DragReference inDrag) -> (Boolean outLikesDrag)")}, |
|---|
| 3610 | n/a | {"HandleControlDragReceive", (PyCFunction)CtlObj_HandleControlDragReceive, 1, |
|---|
| 3611 | n/a | PyDoc_STR("(DragReference inDrag) -> None")}, |
|---|
| 3612 | n/a | {"SetControlDragTrackingEnabled", (PyCFunction)CtlObj_SetControlDragTrackingEnabled, 1, |
|---|
| 3613 | n/a | PyDoc_STR("(Boolean inTracks) -> None")}, |
|---|
| 3614 | n/a | {"IsControlDragTrackingEnabled", (PyCFunction)CtlObj_IsControlDragTrackingEnabled, 1, |
|---|
| 3615 | n/a | PyDoc_STR("() -> (Boolean outTracks)")}, |
|---|
| 3616 | n/a | {"GetControlBounds", (PyCFunction)CtlObj_GetControlBounds, 1, |
|---|
| 3617 | n/a | PyDoc_STR("() -> (Rect bounds)")}, |
|---|
| 3618 | n/a | {"IsControlHilited", (PyCFunction)CtlObj_IsControlHilited, 1, |
|---|
| 3619 | n/a | PyDoc_STR("() -> (Boolean _rv)")}, |
|---|
| 3620 | n/a | {"GetControlHilite", (PyCFunction)CtlObj_GetControlHilite, 1, |
|---|
| 3621 | n/a | PyDoc_STR("() -> (UInt16 _rv)")}, |
|---|
| 3622 | n/a | {"GetControlOwner", (PyCFunction)CtlObj_GetControlOwner, 1, |
|---|
| 3623 | n/a | PyDoc_STR("() -> (WindowPtr _rv)")}, |
|---|
| 3624 | n/a | {"GetControlDataHandle", (PyCFunction)CtlObj_GetControlDataHandle, 1, |
|---|
| 3625 | n/a | PyDoc_STR("() -> (Handle _rv)")}, |
|---|
| 3626 | n/a | {"GetControlPopupMenuHandle", (PyCFunction)CtlObj_GetControlPopupMenuHandle, 1, |
|---|
| 3627 | n/a | PyDoc_STR("() -> (MenuHandle _rv)")}, |
|---|
| 3628 | n/a | {"GetControlPopupMenuID", (PyCFunction)CtlObj_GetControlPopupMenuID, 1, |
|---|
| 3629 | n/a | PyDoc_STR("() -> (short _rv)")}, |
|---|
| 3630 | n/a | {"SetControlDataHandle", (PyCFunction)CtlObj_SetControlDataHandle, 1, |
|---|
| 3631 | n/a | PyDoc_STR("(Handle dataHandle) -> None")}, |
|---|
| 3632 | n/a | {"SetControlBounds", (PyCFunction)CtlObj_SetControlBounds, 1, |
|---|
| 3633 | n/a | PyDoc_STR("(Rect bounds) -> None")}, |
|---|
| 3634 | n/a | {"SetControlPopupMenuHandle", (PyCFunction)CtlObj_SetControlPopupMenuHandle, 1, |
|---|
| 3635 | n/a | PyDoc_STR("(MenuHandle popupMenu) -> None")}, |
|---|
| 3636 | n/a | {"SetControlPopupMenuID", (PyCFunction)CtlObj_SetControlPopupMenuID, 1, |
|---|
| 3637 | n/a | PyDoc_STR("(short menuID) -> None")}, |
|---|
| 3638 | n/a | {"GetBevelButtonMenuValue", (PyCFunction)CtlObj_GetBevelButtonMenuValue, 1, |
|---|
| 3639 | n/a | PyDoc_STR("() -> (SInt16 outValue)")}, |
|---|
| 3640 | n/a | {"SetBevelButtonMenuValue", (PyCFunction)CtlObj_SetBevelButtonMenuValue, 1, |
|---|
| 3641 | n/a | PyDoc_STR("(SInt16 inValue) -> None")}, |
|---|
| 3642 | n/a | {"GetBevelButtonMenuHandle", (PyCFunction)CtlObj_GetBevelButtonMenuHandle, 1, |
|---|
| 3643 | n/a | PyDoc_STR("() -> (MenuHandle outHandle)")}, |
|---|
| 3644 | n/a | {"SetBevelButtonContentInfo", (PyCFunction)CtlObj_SetBevelButtonContentInfo, 1, |
|---|
| 3645 | n/a | PyDoc_STR("(ControlButtonContentInfo inContent) -> None")}, |
|---|
| 3646 | n/a | {"SetBevelButtonTransform", (PyCFunction)CtlObj_SetBevelButtonTransform, 1, |
|---|
| 3647 | n/a | PyDoc_STR("(IconTransformType transform) -> None")}, |
|---|
| 3648 | n/a | {"SetDisclosureTriangleLastValue", (PyCFunction)CtlObj_SetDisclosureTriangleLastValue, 1, |
|---|
| 3649 | n/a | PyDoc_STR("(SInt16 inValue) -> None")}, |
|---|
| 3650 | n/a | {"GetTabContentRect", (PyCFunction)CtlObj_GetTabContentRect, 1, |
|---|
| 3651 | n/a | PyDoc_STR("() -> (Rect outContentRect)")}, |
|---|
| 3652 | n/a | {"SetTabEnabled", (PyCFunction)CtlObj_SetTabEnabled, 1, |
|---|
| 3653 | n/a | PyDoc_STR("(SInt16 inTabToHilite, Boolean inEnabled) -> None")}, |
|---|
| 3654 | n/a | {"SetImageWellContentInfo", (PyCFunction)CtlObj_SetImageWellContentInfo, 1, |
|---|
| 3655 | n/a | PyDoc_STR("(ControlButtonContentInfo inContent) -> None")}, |
|---|
| 3656 | n/a | {"SetImageWellTransform", (PyCFunction)CtlObj_SetImageWellTransform, 1, |
|---|
| 3657 | n/a | PyDoc_STR("(IconTransformType inTransform) -> None")}, |
|---|
| 3658 | n/a | {"GetDataBrowserViewStyle", (PyCFunction)CtlObj_GetDataBrowserViewStyle, 1, |
|---|
| 3659 | n/a | PyDoc_STR("() -> (OSType style)")}, |
|---|
| 3660 | n/a | {"SetDataBrowserViewStyle", (PyCFunction)CtlObj_SetDataBrowserViewStyle, 1, |
|---|
| 3661 | n/a | PyDoc_STR("(OSType style) -> None")}, |
|---|
| 3662 | n/a | {"EnableDataBrowserEditCommand", (PyCFunction)CtlObj_EnableDataBrowserEditCommand, 1, |
|---|
| 3663 | n/a | PyDoc_STR("(UInt32 command) -> (Boolean _rv)")}, |
|---|
| 3664 | n/a | {"ExecuteDataBrowserEditCommand", (PyCFunction)CtlObj_ExecuteDataBrowserEditCommand, 1, |
|---|
| 3665 | n/a | PyDoc_STR("(UInt32 command) -> None")}, |
|---|
| 3666 | n/a | {"GetDataBrowserSelectionAnchor", (PyCFunction)CtlObj_GetDataBrowserSelectionAnchor, 1, |
|---|
| 3667 | n/a | PyDoc_STR("() -> (UInt32 first, UInt32 last)")}, |
|---|
| 3668 | n/a | {"MoveDataBrowserSelectionAnchor", (PyCFunction)CtlObj_MoveDataBrowserSelectionAnchor, 1, |
|---|
| 3669 | n/a | PyDoc_STR("(UInt32 direction, Boolean extendSelection) -> None")}, |
|---|
| 3670 | n/a | {"OpenDataBrowserContainer", (PyCFunction)CtlObj_OpenDataBrowserContainer, 1, |
|---|
| 3671 | n/a | PyDoc_STR("(UInt32 container) -> None")}, |
|---|
| 3672 | n/a | {"CloseDataBrowserContainer", (PyCFunction)CtlObj_CloseDataBrowserContainer, 1, |
|---|
| 3673 | n/a | PyDoc_STR("(UInt32 container) -> None")}, |
|---|
| 3674 | n/a | {"SortDataBrowserContainer", (PyCFunction)CtlObj_SortDataBrowserContainer, 1, |
|---|
| 3675 | n/a | PyDoc_STR("(UInt32 container, Boolean sortChildren) -> None")}, |
|---|
| 3676 | n/a | {"GetDataBrowserItems", (PyCFunction)CtlObj_GetDataBrowserItems, 1, |
|---|
| 3677 | n/a | PyDoc_STR("(UInt32 container, Boolean recurse, UInt32 state, Handle items) -> None")}, |
|---|
| 3678 | n/a | {"GetDataBrowserItemCount", (PyCFunction)CtlObj_GetDataBrowserItemCount, 1, |
|---|
| 3679 | n/a | PyDoc_STR("(UInt32 container, Boolean recurse, UInt32 state) -> (UInt32 numItems)")}, |
|---|
| 3680 | n/a | {"IsDataBrowserItemSelected", (PyCFunction)CtlObj_IsDataBrowserItemSelected, 1, |
|---|
| 3681 | n/a | PyDoc_STR("(UInt32 item) -> (Boolean _rv)")}, |
|---|
| 3682 | n/a | {"GetDataBrowserItemState", (PyCFunction)CtlObj_GetDataBrowserItemState, 1, |
|---|
| 3683 | n/a | PyDoc_STR("(UInt32 item) -> (UInt32 state)")}, |
|---|
| 3684 | n/a | {"RevealDataBrowserItem", (PyCFunction)CtlObj_RevealDataBrowserItem, 1, |
|---|
| 3685 | n/a | PyDoc_STR("(UInt32 item, UInt32 propertyID, UInt8 options) -> None")}, |
|---|
| 3686 | n/a | {"SetDataBrowserActiveItems", (PyCFunction)CtlObj_SetDataBrowserActiveItems, 1, |
|---|
| 3687 | n/a | PyDoc_STR("(Boolean active) -> None")}, |
|---|
| 3688 | n/a | {"GetDataBrowserActiveItems", (PyCFunction)CtlObj_GetDataBrowserActiveItems, 1, |
|---|
| 3689 | n/a | PyDoc_STR("() -> (Boolean active)")}, |
|---|
| 3690 | n/a | {"SetDataBrowserScrollBarInset", (PyCFunction)CtlObj_SetDataBrowserScrollBarInset, 1, |
|---|
| 3691 | n/a | PyDoc_STR("() -> (Rect insetRect)")}, |
|---|
| 3692 | n/a | {"GetDataBrowserScrollBarInset", (PyCFunction)CtlObj_GetDataBrowserScrollBarInset, 1, |
|---|
| 3693 | n/a | PyDoc_STR("() -> (Rect insetRect)")}, |
|---|
| 3694 | n/a | {"SetDataBrowserTarget", (PyCFunction)CtlObj_SetDataBrowserTarget, 1, |
|---|
| 3695 | n/a | PyDoc_STR("(UInt32 target) -> None")}, |
|---|
| 3696 | n/a | {"GetDataBrowserTarget", (PyCFunction)CtlObj_GetDataBrowserTarget, 1, |
|---|
| 3697 | n/a | PyDoc_STR("() -> (UInt32 target)")}, |
|---|
| 3698 | n/a | {"SetDataBrowserSortOrder", (PyCFunction)CtlObj_SetDataBrowserSortOrder, 1, |
|---|
| 3699 | n/a | PyDoc_STR("(UInt16 order) -> None")}, |
|---|
| 3700 | n/a | {"GetDataBrowserSortOrder", (PyCFunction)CtlObj_GetDataBrowserSortOrder, 1, |
|---|
| 3701 | n/a | PyDoc_STR("() -> (UInt16 order)")}, |
|---|
| 3702 | n/a | {"SetDataBrowserScrollPosition", (PyCFunction)CtlObj_SetDataBrowserScrollPosition, 1, |
|---|
| 3703 | n/a | PyDoc_STR("(UInt32 top, UInt32 left) -> None")}, |
|---|
| 3704 | n/a | {"GetDataBrowserScrollPosition", (PyCFunction)CtlObj_GetDataBrowserScrollPosition, 1, |
|---|
| 3705 | n/a | PyDoc_STR("() -> (UInt32 top, UInt32 left)")}, |
|---|
| 3706 | n/a | {"SetDataBrowserHasScrollBars", (PyCFunction)CtlObj_SetDataBrowserHasScrollBars, 1, |
|---|
| 3707 | n/a | PyDoc_STR("(Boolean horiz, Boolean vert) -> None")}, |
|---|
| 3708 | n/a | {"GetDataBrowserHasScrollBars", (PyCFunction)CtlObj_GetDataBrowserHasScrollBars, 1, |
|---|
| 3709 | n/a | PyDoc_STR("() -> (Boolean horiz, Boolean vert)")}, |
|---|
| 3710 | n/a | {"SetDataBrowserSortProperty", (PyCFunction)CtlObj_SetDataBrowserSortProperty, 1, |
|---|
| 3711 | n/a | PyDoc_STR("(UInt32 property) -> None")}, |
|---|
| 3712 | n/a | {"GetDataBrowserSortProperty", (PyCFunction)CtlObj_GetDataBrowserSortProperty, 1, |
|---|
| 3713 | n/a | PyDoc_STR("() -> (UInt32 property)")}, |
|---|
| 3714 | n/a | {"SetDataBrowserSelectionFlags", (PyCFunction)CtlObj_SetDataBrowserSelectionFlags, 1, |
|---|
| 3715 | n/a | PyDoc_STR("(UInt32 selectionFlags) -> None")}, |
|---|
| 3716 | n/a | {"GetDataBrowserSelectionFlags", (PyCFunction)CtlObj_GetDataBrowserSelectionFlags, 1, |
|---|
| 3717 | n/a | PyDoc_STR("() -> (UInt32 selectionFlags)")}, |
|---|
| 3718 | n/a | {"SetDataBrowserPropertyFlags", (PyCFunction)CtlObj_SetDataBrowserPropertyFlags, 1, |
|---|
| 3719 | n/a | PyDoc_STR("(UInt32 property, UInt32 flags) -> None")}, |
|---|
| 3720 | n/a | {"GetDataBrowserPropertyFlags", (PyCFunction)CtlObj_GetDataBrowserPropertyFlags, 1, |
|---|
| 3721 | n/a | PyDoc_STR("(UInt32 property) -> (UInt32 flags)")}, |
|---|
| 3722 | n/a | {"SetDataBrowserEditText", (PyCFunction)CtlObj_SetDataBrowserEditText, 1, |
|---|
| 3723 | n/a | PyDoc_STR("(CFStringRef text) -> None")}, |
|---|
| 3724 | n/a | {"CopyDataBrowserEditText", (PyCFunction)CtlObj_CopyDataBrowserEditText, 1, |
|---|
| 3725 | n/a | PyDoc_STR("() -> (CFStringRef text)")}, |
|---|
| 3726 | n/a | {"GetDataBrowserEditText", (PyCFunction)CtlObj_GetDataBrowserEditText, 1, |
|---|
| 3727 | n/a | PyDoc_STR("(CFMutableStringRef text) -> None")}, |
|---|
| 3728 | n/a | {"SetDataBrowserEditItem", (PyCFunction)CtlObj_SetDataBrowserEditItem, 1, |
|---|
| 3729 | n/a | PyDoc_STR("(UInt32 item, UInt32 property) -> None")}, |
|---|
| 3730 | n/a | {"GetDataBrowserEditItem", (PyCFunction)CtlObj_GetDataBrowserEditItem, 1, |
|---|
| 3731 | n/a | PyDoc_STR("() -> (UInt32 item, UInt32 property)")}, |
|---|
| 3732 | n/a | {"GetDataBrowserItemPartBounds", (PyCFunction)CtlObj_GetDataBrowserItemPartBounds, 1, |
|---|
| 3733 | n/a | PyDoc_STR("(UInt32 item, UInt32 property, OSType part) -> (Rect bounds)")}, |
|---|
| 3734 | n/a | {"RemoveDataBrowserTableViewColumn", (PyCFunction)CtlObj_RemoveDataBrowserTableViewColumn, 1, |
|---|
| 3735 | n/a | PyDoc_STR("(UInt32 column) -> None")}, |
|---|
| 3736 | n/a | {"GetDataBrowserTableViewColumnCount", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnCount, 1, |
|---|
| 3737 | n/a | PyDoc_STR("() -> (UInt32 numColumns)")}, |
|---|
| 3738 | n/a | {"SetDataBrowserTableViewHiliteStyle", (PyCFunction)CtlObj_SetDataBrowserTableViewHiliteStyle, 1, |
|---|
| 3739 | n/a | PyDoc_STR("(UInt32 hiliteStyle) -> None")}, |
|---|
| 3740 | n/a | {"GetDataBrowserTableViewHiliteStyle", (PyCFunction)CtlObj_GetDataBrowserTableViewHiliteStyle, 1, |
|---|
| 3741 | n/a | PyDoc_STR("() -> (UInt32 hiliteStyle)")}, |
|---|
| 3742 | n/a | {"SetDataBrowserTableViewRowHeight", (PyCFunction)CtlObj_SetDataBrowserTableViewRowHeight, 1, |
|---|
| 3743 | n/a | PyDoc_STR("(UInt16 height) -> None")}, |
|---|
| 3744 | n/a | {"GetDataBrowserTableViewRowHeight", (PyCFunction)CtlObj_GetDataBrowserTableViewRowHeight, 1, |
|---|
| 3745 | n/a | PyDoc_STR("() -> (UInt16 height)")}, |
|---|
| 3746 | n/a | {"SetDataBrowserTableViewColumnWidth", (PyCFunction)CtlObj_SetDataBrowserTableViewColumnWidth, 1, |
|---|
| 3747 | n/a | PyDoc_STR("(UInt16 width) -> None")}, |
|---|
| 3748 | n/a | {"GetDataBrowserTableViewColumnWidth", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnWidth, 1, |
|---|
| 3749 | n/a | PyDoc_STR("() -> (UInt16 width)")}, |
|---|
| 3750 | n/a | {"SetDataBrowserTableViewItemRowHeight", (PyCFunction)CtlObj_SetDataBrowserTableViewItemRowHeight, 1, |
|---|
| 3751 | n/a | PyDoc_STR("(UInt32 item, UInt16 height) -> None")}, |
|---|
| 3752 | n/a | {"GetDataBrowserTableViewItemRowHeight", (PyCFunction)CtlObj_GetDataBrowserTableViewItemRowHeight, 1, |
|---|
| 3753 | n/a | PyDoc_STR("(UInt32 item) -> (UInt16 height)")}, |
|---|
| 3754 | n/a | {"SetDataBrowserTableViewNamedColumnWidth", (PyCFunction)CtlObj_SetDataBrowserTableViewNamedColumnWidth, 1, |
|---|
| 3755 | n/a | PyDoc_STR("(UInt32 column, UInt16 width) -> None")}, |
|---|
| 3756 | n/a | {"GetDataBrowserTableViewNamedColumnWidth", (PyCFunction)CtlObj_GetDataBrowserTableViewNamedColumnWidth, 1, |
|---|
| 3757 | n/a | PyDoc_STR("(UInt32 column) -> (UInt16 width)")}, |
|---|
| 3758 | n/a | {"SetDataBrowserTableViewGeometry", (PyCFunction)CtlObj_SetDataBrowserTableViewGeometry, 1, |
|---|
| 3759 | n/a | PyDoc_STR("(Boolean variableWidthColumns, Boolean variableHeightRows) -> None")}, |
|---|
| 3760 | n/a | {"GetDataBrowserTableViewGeometry", (PyCFunction)CtlObj_GetDataBrowserTableViewGeometry, 1, |
|---|
| 3761 | n/a | PyDoc_STR("() -> (Boolean variableWidthColumns, Boolean variableHeightRows)")}, |
|---|
| 3762 | n/a | {"GetDataBrowserTableViewItemID", (PyCFunction)CtlObj_GetDataBrowserTableViewItemID, 1, |
|---|
| 3763 | n/a | PyDoc_STR("(UInt32 row) -> (UInt32 item)")}, |
|---|
| 3764 | n/a | {"SetDataBrowserTableViewItemRow", (PyCFunction)CtlObj_SetDataBrowserTableViewItemRow, 1, |
|---|
| 3765 | n/a | PyDoc_STR("(UInt32 item, UInt32 row) -> None")}, |
|---|
| 3766 | n/a | {"GetDataBrowserTableViewItemRow", (PyCFunction)CtlObj_GetDataBrowserTableViewItemRow, 1, |
|---|
| 3767 | n/a | PyDoc_STR("(UInt32 item) -> (UInt32 row)")}, |
|---|
| 3768 | n/a | {"SetDataBrowserTableViewColumnPosition", (PyCFunction)CtlObj_SetDataBrowserTableViewColumnPosition, 1, |
|---|
| 3769 | n/a | PyDoc_STR("(UInt32 column, UInt32 position) -> None")}, |
|---|
| 3770 | n/a | {"GetDataBrowserTableViewColumnPosition", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnPosition, 1, |
|---|
| 3771 | n/a | PyDoc_STR("(UInt32 column) -> (UInt32 position)")}, |
|---|
| 3772 | n/a | {"GetDataBrowserTableViewColumnProperty", (PyCFunction)CtlObj_GetDataBrowserTableViewColumnProperty, 1, |
|---|
| 3773 | n/a | PyDoc_STR("(UInt32 column) -> (UInt32 property)")}, |
|---|
| 3774 | n/a | {"AutoSizeDataBrowserListViewColumns", (PyCFunction)CtlObj_AutoSizeDataBrowserListViewColumns, 1, |
|---|
| 3775 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3776 | n/a | {"AddDataBrowserListViewColumn", (PyCFunction)CtlObj_AddDataBrowserListViewColumn, 1, |
|---|
| 3777 | n/a | PyDoc_STR("(DataBrowserListViewColumnDesc columnDesc, UInt32 position) -> None")}, |
|---|
| 3778 | n/a | {"SetDataBrowserListViewHeaderBtnHeight", (PyCFunction)CtlObj_SetDataBrowserListViewHeaderBtnHeight, 1, |
|---|
| 3779 | n/a | PyDoc_STR("(UInt16 height) -> None")}, |
|---|
| 3780 | n/a | {"GetDataBrowserListViewHeaderBtnHeight", (PyCFunction)CtlObj_GetDataBrowserListViewHeaderBtnHeight, 1, |
|---|
| 3781 | n/a | PyDoc_STR("() -> (UInt16 height)")}, |
|---|
| 3782 | n/a | {"SetDataBrowserListViewUsePlainBackground", (PyCFunction)CtlObj_SetDataBrowserListViewUsePlainBackground, 1, |
|---|
| 3783 | n/a | PyDoc_STR("(Boolean usePlainBackground) -> None")}, |
|---|
| 3784 | n/a | {"GetDataBrowserListViewUsePlainBackground", (PyCFunction)CtlObj_GetDataBrowserListViewUsePlainBackground, 1, |
|---|
| 3785 | n/a | PyDoc_STR("() -> (Boolean usePlainBackground)")}, |
|---|
| 3786 | n/a | {"SetDataBrowserListViewDisclosureColumn", (PyCFunction)CtlObj_SetDataBrowserListViewDisclosureColumn, 1, |
|---|
| 3787 | n/a | PyDoc_STR("(UInt32 column, Boolean expandableRows) -> None")}, |
|---|
| 3788 | n/a | {"GetDataBrowserListViewDisclosureColumn", (PyCFunction)CtlObj_GetDataBrowserListViewDisclosureColumn, 1, |
|---|
| 3789 | n/a | PyDoc_STR("() -> (UInt32 column, Boolean expandableRows)")}, |
|---|
| 3790 | n/a | {"GetDataBrowserColumnViewPath", (PyCFunction)CtlObj_GetDataBrowserColumnViewPath, 1, |
|---|
| 3791 | n/a | PyDoc_STR("(Handle path) -> None")}, |
|---|
| 3792 | n/a | {"GetDataBrowserColumnViewPathLength", (PyCFunction)CtlObj_GetDataBrowserColumnViewPathLength, 1, |
|---|
| 3793 | n/a | PyDoc_STR("() -> (UInt32 pathLength)")}, |
|---|
| 3794 | n/a | {"SetDataBrowserColumnViewDisplayType", (PyCFunction)CtlObj_SetDataBrowserColumnViewDisplayType, 1, |
|---|
| 3795 | n/a | PyDoc_STR("(OSType propertyType) -> None")}, |
|---|
| 3796 | n/a | {"GetDataBrowserColumnViewDisplayType", (PyCFunction)CtlObj_GetDataBrowserColumnViewDisplayType, 1, |
|---|
| 3797 | n/a | PyDoc_STR("() -> (OSType propertyType)")}, |
|---|
| 3798 | n/a | {"as_Resource", (PyCFunction)CtlObj_as_Resource, 1, |
|---|
| 3799 | n/a | PyDoc_STR("() -> (Handle _rv)")}, |
|---|
| 3800 | n/a | {"GetControlRect", (PyCFunction)CtlObj_GetControlRect, 1, |
|---|
| 3801 | n/a | PyDoc_STR("() -> (Rect rect)")}, |
|---|
| 3802 | n/a | {"DisposeControl", (PyCFunction)CtlObj_DisposeControl, 1, |
|---|
| 3803 | n/a | PyDoc_STR("() -> None")}, |
|---|
| 3804 | n/a | {"TrackControl", (PyCFunction)CtlObj_TrackControl, 1, |
|---|
| 3805 | n/a | PyDoc_STR("(Point startPoint [,trackercallback]) -> (ControlPartCode _rv)")}, |
|---|
| 3806 | n/a | {"HandleControlClick", (PyCFunction)CtlObj_HandleControlClick, 1, |
|---|
| 3807 | n/a | PyDoc_STR("(Point startPoint, Integer modifiers, [,trackercallback]) -> (ControlPartCode _rv)")}, |
|---|
| 3808 | n/a | {"SetControlData", (PyCFunction)CtlObj_SetControlData, 1, |
|---|
| 3809 | n/a | PyDoc_STR("(stuff) -> None")}, |
|---|
| 3810 | n/a | {"GetControlData", (PyCFunction)CtlObj_GetControlData, 1, |
|---|
| 3811 | n/a | PyDoc_STR("(part, type) -> String")}, |
|---|
| 3812 | n/a | {"SetControlData_Handle", (PyCFunction)CtlObj_SetControlData_Handle, 1, |
|---|
| 3813 | n/a | PyDoc_STR("(ResObj) -> None")}, |
|---|
| 3814 | n/a | {"GetControlData_Handle", (PyCFunction)CtlObj_GetControlData_Handle, 1, |
|---|
| 3815 | n/a | PyDoc_STR("(part, type) -> ResObj")}, |
|---|
| 3816 | n/a | {"SetControlData_Callback", (PyCFunction)CtlObj_SetControlData_Callback, 1, |
|---|
| 3817 | n/a | PyDoc_STR("(callbackfunc) -> None")}, |
|---|
| 3818 | n/a | {NULL, NULL, 0} |
|---|
| 3819 | n/a | }; |
|---|
| 3820 | n/a | |
|---|
| 3821 | n/a | #define CtlObj_getsetlist NULL |
|---|
| 3822 | n/a | |
|---|
| 3823 | n/a | |
|---|
| 3824 | n/a | static int CtlObj_compare(ControlObject *self, ControlObject *other) |
|---|
| 3825 | n/a | { |
|---|
| 3826 | n/a | unsigned long v, w; |
|---|
| 3827 | n/a | |
|---|
| 3828 | n/a | if (!CtlObj_Check((PyObject *)other)) |
|---|
| 3829 | n/a | { |
|---|
| 3830 | n/a | v=(unsigned long)self; |
|---|
| 3831 | n/a | w=(unsigned long)other; |
|---|
| 3832 | n/a | } |
|---|
| 3833 | n/a | else |
|---|
| 3834 | n/a | { |
|---|
| 3835 | n/a | v=(unsigned long)self->ob_itself; |
|---|
| 3836 | n/a | w=(unsigned long)other->ob_itself; |
|---|
| 3837 | n/a | } |
|---|
| 3838 | n/a | if( v < w ) return -1; |
|---|
| 3839 | n/a | if( v > w ) return 1; |
|---|
| 3840 | n/a | return 0; |
|---|
| 3841 | n/a | } |
|---|
| 3842 | n/a | |
|---|
| 3843 | n/a | #define CtlObj_repr NULL |
|---|
| 3844 | n/a | |
|---|
| 3845 | n/a | static long CtlObj_hash(ControlObject *self) |
|---|
| 3846 | n/a | { |
|---|
| 3847 | n/a | return (long)self->ob_itself; |
|---|
| 3848 | n/a | } |
|---|
| 3849 | n/a | #define CtlObj_tp_init 0 |
|---|
| 3850 | n/a | |
|---|
| 3851 | n/a | #define CtlObj_tp_alloc PyType_GenericAlloc |
|---|
| 3852 | n/a | |
|---|
| 3853 | n/a | static PyObject *CtlObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds) |
|---|
| 3854 | n/a | { |
|---|
| 3855 | n/a | PyObject *_self; |
|---|
| 3856 | n/a | ControlHandle itself; |
|---|
| 3857 | n/a | char *kw[] = {"itself", 0}; |
|---|
| 3858 | n/a | |
|---|
| 3859 | n/a | if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, CtlObj_Convert, &itself)) return NULL; |
|---|
| 3860 | n/a | if ((_self = type->tp_alloc(type, 0)) == NULL) return NULL; |
|---|
| 3861 | n/a | ((ControlObject *)_self)->ob_itself = itself; |
|---|
| 3862 | n/a | return _self; |
|---|
| 3863 | n/a | } |
|---|
| 3864 | n/a | |
|---|
| 3865 | n/a | #define CtlObj_tp_free PyObject_Del |
|---|
| 3866 | n/a | |
|---|
| 3867 | n/a | |
|---|
| 3868 | n/a | PyTypeObject Control_Type = { |
|---|
| 3869 | n/a | PyObject_HEAD_INIT(NULL) |
|---|
| 3870 | n/a | 0, /*ob_size*/ |
|---|
| 3871 | n/a | "_Ctl.Control", /*tp_name*/ |
|---|
| 3872 | n/a | sizeof(ControlObject), /*tp_basicsize*/ |
|---|
| 3873 | n/a | 0, /*tp_itemsize*/ |
|---|
| 3874 | n/a | /* methods */ |
|---|
| 3875 | n/a | (destructor) CtlObj_dealloc, /*tp_dealloc*/ |
|---|
| 3876 | n/a | 0, /*tp_print*/ |
|---|
| 3877 | n/a | (getattrfunc)0, /*tp_getattr*/ |
|---|
| 3878 | n/a | (setattrfunc)0, /*tp_setattr*/ |
|---|
| 3879 | n/a | (cmpfunc) CtlObj_compare, /*tp_compare*/ |
|---|
| 3880 | n/a | (reprfunc) CtlObj_repr, /*tp_repr*/ |
|---|
| 3881 | n/a | (PyNumberMethods *)0, /* tp_as_number */ |
|---|
| 3882 | n/a | (PySequenceMethods *)0, /* tp_as_sequence */ |
|---|
| 3883 | n/a | (PyMappingMethods *)0, /* tp_as_mapping */ |
|---|
| 3884 | n/a | (hashfunc) CtlObj_hash, /*tp_hash*/ |
|---|
| 3885 | n/a | 0, /*tp_call*/ |
|---|
| 3886 | n/a | 0, /*tp_str*/ |
|---|
| 3887 | n/a | PyObject_GenericGetAttr, /*tp_getattro*/ |
|---|
| 3888 | n/a | PyObject_GenericSetAttr, /*tp_setattro */ |
|---|
| 3889 | n/a | 0, /*tp_as_buffer*/ |
|---|
| 3890 | n/a | Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|---|
| 3891 | n/a | 0, /*tp_doc*/ |
|---|
| 3892 | n/a | 0, /*tp_traverse*/ |
|---|
| 3893 | n/a | 0, /*tp_clear*/ |
|---|
| 3894 | n/a | 0, /*tp_richcompare*/ |
|---|
| 3895 | n/a | 0, /*tp_weaklistoffset*/ |
|---|
| 3896 | n/a | 0, /*tp_iter*/ |
|---|
| 3897 | n/a | 0, /*tp_iternext*/ |
|---|
| 3898 | n/a | CtlObj_methods, /* tp_methods */ |
|---|
| 3899 | n/a | 0, /*tp_members*/ |
|---|
| 3900 | n/a | CtlObj_getsetlist, /*tp_getset*/ |
|---|
| 3901 | n/a | 0, /*tp_base*/ |
|---|
| 3902 | n/a | 0, /*tp_dict*/ |
|---|
| 3903 | n/a | 0, /*tp_descr_get*/ |
|---|
| 3904 | n/a | 0, /*tp_descr_set*/ |
|---|
| 3905 | n/a | 0, /*tp_dictoffset*/ |
|---|
| 3906 | n/a | CtlObj_tp_init, /* tp_init */ |
|---|
| 3907 | n/a | CtlObj_tp_alloc, /* tp_alloc */ |
|---|
| 3908 | n/a | CtlObj_tp_new, /* tp_new */ |
|---|
| 3909 | n/a | CtlObj_tp_free, /* tp_free */ |
|---|
| 3910 | n/a | }; |
|---|
| 3911 | n/a | |
|---|
| 3912 | n/a | /* -------------------- End object type Control --------------------- */ |
|---|
| 3913 | n/a | |
|---|
| 3914 | n/a | |
|---|
| 3915 | n/a | static PyObject *Ctl_NewControl(PyObject *_self, PyObject *_args) |
|---|
| 3916 | n/a | { |
|---|
| 3917 | n/a | PyObject *_res = NULL; |
|---|
| 3918 | n/a | ControlHandle _rv; |
|---|
| 3919 | n/a | WindowPtr owningWindow; |
|---|
| 3920 | n/a | Rect boundsRect; |
|---|
| 3921 | n/a | Str255 controlTitle; |
|---|
| 3922 | n/a | Boolean initiallyVisible; |
|---|
| 3923 | n/a | SInt16 initialValue; |
|---|
| 3924 | n/a | SInt16 minimumValue; |
|---|
| 3925 | n/a | SInt16 maximumValue; |
|---|
| 3926 | n/a | SInt16 procID; |
|---|
| 3927 | n/a | SInt32 controlReference; |
|---|
| 3928 | n/a | #ifndef NewControl |
|---|
| 3929 | n/a | PyMac_PRECHECK(NewControl); |
|---|
| 3930 | n/a | #endif |
|---|
| 3931 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&bhhhhl", |
|---|
| 3932 | n/a | WinObj_Convert, &owningWindow, |
|---|
| 3933 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 3934 | n/a | PyMac_GetStr255, controlTitle, |
|---|
| 3935 | n/a | &initiallyVisible, |
|---|
| 3936 | n/a | &initialValue, |
|---|
| 3937 | n/a | &minimumValue, |
|---|
| 3938 | n/a | &maximumValue, |
|---|
| 3939 | n/a | &procID, |
|---|
| 3940 | n/a | &controlReference)) |
|---|
| 3941 | n/a | return NULL; |
|---|
| 3942 | n/a | _rv = NewControl(owningWindow, |
|---|
| 3943 | n/a | &boundsRect, |
|---|
| 3944 | n/a | controlTitle, |
|---|
| 3945 | n/a | initiallyVisible, |
|---|
| 3946 | n/a | initialValue, |
|---|
| 3947 | n/a | minimumValue, |
|---|
| 3948 | n/a | maximumValue, |
|---|
| 3949 | n/a | procID, |
|---|
| 3950 | n/a | controlReference); |
|---|
| 3951 | n/a | _res = Py_BuildValue("O&", |
|---|
| 3952 | n/a | CtlObj_New, _rv); |
|---|
| 3953 | n/a | return _res; |
|---|
| 3954 | n/a | } |
|---|
| 3955 | n/a | |
|---|
| 3956 | n/a | static PyObject *Ctl_GetNewControl(PyObject *_self, PyObject *_args) |
|---|
| 3957 | n/a | { |
|---|
| 3958 | n/a | PyObject *_res = NULL; |
|---|
| 3959 | n/a | ControlHandle _rv; |
|---|
| 3960 | n/a | SInt16 resourceID; |
|---|
| 3961 | n/a | WindowPtr owningWindow; |
|---|
| 3962 | n/a | #ifndef GetNewControl |
|---|
| 3963 | n/a | PyMac_PRECHECK(GetNewControl); |
|---|
| 3964 | n/a | #endif |
|---|
| 3965 | n/a | if (!PyArg_ParseTuple(_args, "hO&", |
|---|
| 3966 | n/a | &resourceID, |
|---|
| 3967 | n/a | WinObj_Convert, &owningWindow)) |
|---|
| 3968 | n/a | return NULL; |
|---|
| 3969 | n/a | _rv = GetNewControl(resourceID, |
|---|
| 3970 | n/a | owningWindow); |
|---|
| 3971 | n/a | _res = Py_BuildValue("O&", |
|---|
| 3972 | n/a | CtlObj_New, _rv); |
|---|
| 3973 | n/a | return _res; |
|---|
| 3974 | n/a | } |
|---|
| 3975 | n/a | |
|---|
| 3976 | n/a | static PyObject *Ctl_DrawControls(PyObject *_self, PyObject *_args) |
|---|
| 3977 | n/a | { |
|---|
| 3978 | n/a | PyObject *_res = NULL; |
|---|
| 3979 | n/a | WindowPtr theWindow; |
|---|
| 3980 | n/a | #ifndef DrawControls |
|---|
| 3981 | n/a | PyMac_PRECHECK(DrawControls); |
|---|
| 3982 | n/a | #endif |
|---|
| 3983 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 3984 | n/a | WinObj_Convert, &theWindow)) |
|---|
| 3985 | n/a | return NULL; |
|---|
| 3986 | n/a | DrawControls(theWindow); |
|---|
| 3987 | n/a | Py_INCREF(Py_None); |
|---|
| 3988 | n/a | _res = Py_None; |
|---|
| 3989 | n/a | return _res; |
|---|
| 3990 | n/a | } |
|---|
| 3991 | n/a | |
|---|
| 3992 | n/a | static PyObject *Ctl_UpdateControls(PyObject *_self, PyObject *_args) |
|---|
| 3993 | n/a | { |
|---|
| 3994 | n/a | PyObject *_res = NULL; |
|---|
| 3995 | n/a | WindowPtr inWindow; |
|---|
| 3996 | n/a | RgnHandle inUpdateRegion; |
|---|
| 3997 | n/a | #ifndef UpdateControls |
|---|
| 3998 | n/a | PyMac_PRECHECK(UpdateControls); |
|---|
| 3999 | n/a | #endif |
|---|
| 4000 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 4001 | n/a | WinObj_Convert, &inWindow, |
|---|
| 4002 | n/a | ResObj_Convert, &inUpdateRegion)) |
|---|
| 4003 | n/a | return NULL; |
|---|
| 4004 | n/a | UpdateControls(inWindow, |
|---|
| 4005 | n/a | inUpdateRegion); |
|---|
| 4006 | n/a | Py_INCREF(Py_None); |
|---|
| 4007 | n/a | _res = Py_None; |
|---|
| 4008 | n/a | return _res; |
|---|
| 4009 | n/a | } |
|---|
| 4010 | n/a | |
|---|
| 4011 | n/a | static PyObject *Ctl_FindControl(PyObject *_self, PyObject *_args) |
|---|
| 4012 | n/a | { |
|---|
| 4013 | n/a | PyObject *_res = NULL; |
|---|
| 4014 | n/a | ControlPartCode _rv; |
|---|
| 4015 | n/a | Point testPoint; |
|---|
| 4016 | n/a | WindowPtr theWindow; |
|---|
| 4017 | n/a | ControlHandle theControl; |
|---|
| 4018 | n/a | #ifndef FindControl |
|---|
| 4019 | n/a | PyMac_PRECHECK(FindControl); |
|---|
| 4020 | n/a | #endif |
|---|
| 4021 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 4022 | n/a | PyMac_GetPoint, &testPoint, |
|---|
| 4023 | n/a | WinObj_Convert, &theWindow)) |
|---|
| 4024 | n/a | return NULL; |
|---|
| 4025 | n/a | _rv = FindControl(testPoint, |
|---|
| 4026 | n/a | theWindow, |
|---|
| 4027 | n/a | &theControl); |
|---|
| 4028 | n/a | _res = Py_BuildValue("hO&", |
|---|
| 4029 | n/a | _rv, |
|---|
| 4030 | n/a | CtlObj_WhichControl, theControl); |
|---|
| 4031 | n/a | return _res; |
|---|
| 4032 | n/a | } |
|---|
| 4033 | n/a | |
|---|
| 4034 | n/a | static PyObject *Ctl_IdleControls(PyObject *_self, PyObject *_args) |
|---|
| 4035 | n/a | { |
|---|
| 4036 | n/a | PyObject *_res = NULL; |
|---|
| 4037 | n/a | WindowPtr inWindow; |
|---|
| 4038 | n/a | #ifndef IdleControls |
|---|
| 4039 | n/a | PyMac_PRECHECK(IdleControls); |
|---|
| 4040 | n/a | #endif |
|---|
| 4041 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 4042 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 4043 | n/a | return NULL; |
|---|
| 4044 | n/a | IdleControls(inWindow); |
|---|
| 4045 | n/a | Py_INCREF(Py_None); |
|---|
| 4046 | n/a | _res = Py_None; |
|---|
| 4047 | n/a | return _res; |
|---|
| 4048 | n/a | } |
|---|
| 4049 | n/a | |
|---|
| 4050 | n/a | static PyObject *Ctl_GetControlByID(PyObject *_self, PyObject *_args) |
|---|
| 4051 | n/a | { |
|---|
| 4052 | n/a | PyObject *_res = NULL; |
|---|
| 4053 | n/a | OSStatus _err; |
|---|
| 4054 | n/a | WindowPtr inWindow; |
|---|
| 4055 | n/a | ControlID inID; |
|---|
| 4056 | n/a | ControlHandle outControl; |
|---|
| 4057 | n/a | #ifndef GetControlByID |
|---|
| 4058 | n/a | PyMac_PRECHECK(GetControlByID); |
|---|
| 4059 | n/a | #endif |
|---|
| 4060 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 4061 | n/a | WinObj_Convert, &inWindow, |
|---|
| 4062 | n/a | PyControlID_Convert, &inID)) |
|---|
| 4063 | n/a | return NULL; |
|---|
| 4064 | n/a | _err = GetControlByID(inWindow, |
|---|
| 4065 | n/a | &inID, |
|---|
| 4066 | n/a | &outControl); |
|---|
| 4067 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4068 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4069 | n/a | CtlObj_WhichControl, outControl); |
|---|
| 4070 | n/a | return _res; |
|---|
| 4071 | n/a | } |
|---|
| 4072 | n/a | |
|---|
| 4073 | n/a | static PyObject *Ctl_DumpControlHierarchy(PyObject *_self, PyObject *_args) |
|---|
| 4074 | n/a | { |
|---|
| 4075 | n/a | PyObject *_res = NULL; |
|---|
| 4076 | n/a | OSErr _err; |
|---|
| 4077 | n/a | WindowPtr inWindow; |
|---|
| 4078 | n/a | FSSpec inDumpFile; |
|---|
| 4079 | n/a | #ifndef DumpControlHierarchy |
|---|
| 4080 | n/a | PyMac_PRECHECK(DumpControlHierarchy); |
|---|
| 4081 | n/a | #endif |
|---|
| 4082 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 4083 | n/a | WinObj_Convert, &inWindow, |
|---|
| 4084 | n/a | PyMac_GetFSSpec, &inDumpFile)) |
|---|
| 4085 | n/a | return NULL; |
|---|
| 4086 | n/a | _err = DumpControlHierarchy(inWindow, |
|---|
| 4087 | n/a | &inDumpFile); |
|---|
| 4088 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4089 | n/a | Py_INCREF(Py_None); |
|---|
| 4090 | n/a | _res = Py_None; |
|---|
| 4091 | n/a | return _res; |
|---|
| 4092 | n/a | } |
|---|
| 4093 | n/a | |
|---|
| 4094 | n/a | static PyObject *Ctl_CreateRootControl(PyObject *_self, PyObject *_args) |
|---|
| 4095 | n/a | { |
|---|
| 4096 | n/a | PyObject *_res = NULL; |
|---|
| 4097 | n/a | OSErr _err; |
|---|
| 4098 | n/a | WindowPtr inWindow; |
|---|
| 4099 | n/a | ControlHandle outControl; |
|---|
| 4100 | n/a | #ifndef CreateRootControl |
|---|
| 4101 | n/a | PyMac_PRECHECK(CreateRootControl); |
|---|
| 4102 | n/a | #endif |
|---|
| 4103 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 4104 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 4105 | n/a | return NULL; |
|---|
| 4106 | n/a | _err = CreateRootControl(inWindow, |
|---|
| 4107 | n/a | &outControl); |
|---|
| 4108 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4109 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4110 | n/a | CtlObj_New, outControl); |
|---|
| 4111 | n/a | return _res; |
|---|
| 4112 | n/a | } |
|---|
| 4113 | n/a | |
|---|
| 4114 | n/a | static PyObject *Ctl_GetRootControl(PyObject *_self, PyObject *_args) |
|---|
| 4115 | n/a | { |
|---|
| 4116 | n/a | PyObject *_res = NULL; |
|---|
| 4117 | n/a | OSErr _err; |
|---|
| 4118 | n/a | WindowPtr inWindow; |
|---|
| 4119 | n/a | ControlHandle outControl; |
|---|
| 4120 | n/a | #ifndef GetRootControl |
|---|
| 4121 | n/a | PyMac_PRECHECK(GetRootControl); |
|---|
| 4122 | n/a | #endif |
|---|
| 4123 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 4124 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 4125 | n/a | return NULL; |
|---|
| 4126 | n/a | _err = GetRootControl(inWindow, |
|---|
| 4127 | n/a | &outControl); |
|---|
| 4128 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4129 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4130 | n/a | CtlObj_WhichControl, outControl); |
|---|
| 4131 | n/a | return _res; |
|---|
| 4132 | n/a | } |
|---|
| 4133 | n/a | |
|---|
| 4134 | n/a | static PyObject *Ctl_GetKeyboardFocus(PyObject *_self, PyObject *_args) |
|---|
| 4135 | n/a | { |
|---|
| 4136 | n/a | PyObject *_res = NULL; |
|---|
| 4137 | n/a | OSErr _err; |
|---|
| 4138 | n/a | WindowPtr inWindow; |
|---|
| 4139 | n/a | ControlHandle outControl; |
|---|
| 4140 | n/a | #ifndef GetKeyboardFocus |
|---|
| 4141 | n/a | PyMac_PRECHECK(GetKeyboardFocus); |
|---|
| 4142 | n/a | #endif |
|---|
| 4143 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 4144 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 4145 | n/a | return NULL; |
|---|
| 4146 | n/a | _err = GetKeyboardFocus(inWindow, |
|---|
| 4147 | n/a | &outControl); |
|---|
| 4148 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4149 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4150 | n/a | CtlObj_WhichControl, outControl); |
|---|
| 4151 | n/a | return _res; |
|---|
| 4152 | n/a | } |
|---|
| 4153 | n/a | |
|---|
| 4154 | n/a | static PyObject *Ctl_SetKeyboardFocus(PyObject *_self, PyObject *_args) |
|---|
| 4155 | n/a | { |
|---|
| 4156 | n/a | PyObject *_res = NULL; |
|---|
| 4157 | n/a | OSErr _err; |
|---|
| 4158 | n/a | WindowPtr inWindow; |
|---|
| 4159 | n/a | ControlHandle inControl; |
|---|
| 4160 | n/a | ControlFocusPart inPart; |
|---|
| 4161 | n/a | #ifndef SetKeyboardFocus |
|---|
| 4162 | n/a | PyMac_PRECHECK(SetKeyboardFocus); |
|---|
| 4163 | n/a | #endif |
|---|
| 4164 | n/a | if (!PyArg_ParseTuple(_args, "O&O&h", |
|---|
| 4165 | n/a | WinObj_Convert, &inWindow, |
|---|
| 4166 | n/a | CtlObj_Convert, &inControl, |
|---|
| 4167 | n/a | &inPart)) |
|---|
| 4168 | n/a | return NULL; |
|---|
| 4169 | n/a | _err = SetKeyboardFocus(inWindow, |
|---|
| 4170 | n/a | inControl, |
|---|
| 4171 | n/a | inPart); |
|---|
| 4172 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4173 | n/a | Py_INCREF(Py_None); |
|---|
| 4174 | n/a | _res = Py_None; |
|---|
| 4175 | n/a | return _res; |
|---|
| 4176 | n/a | } |
|---|
| 4177 | n/a | |
|---|
| 4178 | n/a | static PyObject *Ctl_AdvanceKeyboardFocus(PyObject *_self, PyObject *_args) |
|---|
| 4179 | n/a | { |
|---|
| 4180 | n/a | PyObject *_res = NULL; |
|---|
| 4181 | n/a | OSErr _err; |
|---|
| 4182 | n/a | WindowPtr inWindow; |
|---|
| 4183 | n/a | #ifndef AdvanceKeyboardFocus |
|---|
| 4184 | n/a | PyMac_PRECHECK(AdvanceKeyboardFocus); |
|---|
| 4185 | n/a | #endif |
|---|
| 4186 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 4187 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 4188 | n/a | return NULL; |
|---|
| 4189 | n/a | _err = AdvanceKeyboardFocus(inWindow); |
|---|
| 4190 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4191 | n/a | Py_INCREF(Py_None); |
|---|
| 4192 | n/a | _res = Py_None; |
|---|
| 4193 | n/a | return _res; |
|---|
| 4194 | n/a | } |
|---|
| 4195 | n/a | |
|---|
| 4196 | n/a | static PyObject *Ctl_ReverseKeyboardFocus(PyObject *_self, PyObject *_args) |
|---|
| 4197 | n/a | { |
|---|
| 4198 | n/a | PyObject *_res = NULL; |
|---|
| 4199 | n/a | OSErr _err; |
|---|
| 4200 | n/a | WindowPtr inWindow; |
|---|
| 4201 | n/a | #ifndef ReverseKeyboardFocus |
|---|
| 4202 | n/a | PyMac_PRECHECK(ReverseKeyboardFocus); |
|---|
| 4203 | n/a | #endif |
|---|
| 4204 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 4205 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 4206 | n/a | return NULL; |
|---|
| 4207 | n/a | _err = ReverseKeyboardFocus(inWindow); |
|---|
| 4208 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4209 | n/a | Py_INCREF(Py_None); |
|---|
| 4210 | n/a | _res = Py_None; |
|---|
| 4211 | n/a | return _res; |
|---|
| 4212 | n/a | } |
|---|
| 4213 | n/a | |
|---|
| 4214 | n/a | static PyObject *Ctl_ClearKeyboardFocus(PyObject *_self, PyObject *_args) |
|---|
| 4215 | n/a | { |
|---|
| 4216 | n/a | PyObject *_res = NULL; |
|---|
| 4217 | n/a | OSErr _err; |
|---|
| 4218 | n/a | WindowPtr inWindow; |
|---|
| 4219 | n/a | #ifndef ClearKeyboardFocus |
|---|
| 4220 | n/a | PyMac_PRECHECK(ClearKeyboardFocus); |
|---|
| 4221 | n/a | #endif |
|---|
| 4222 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 4223 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 4224 | n/a | return NULL; |
|---|
| 4225 | n/a | _err = ClearKeyboardFocus(inWindow); |
|---|
| 4226 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4227 | n/a | Py_INCREF(Py_None); |
|---|
| 4228 | n/a | _res = Py_None; |
|---|
| 4229 | n/a | return _res; |
|---|
| 4230 | n/a | } |
|---|
| 4231 | n/a | |
|---|
| 4232 | n/a | static PyObject *Ctl_SetAutomaticControlDragTrackingEnabledForWindow(PyObject *_self, PyObject *_args) |
|---|
| 4233 | n/a | { |
|---|
| 4234 | n/a | PyObject *_res = NULL; |
|---|
| 4235 | n/a | OSStatus _err; |
|---|
| 4236 | n/a | WindowPtr inWindow; |
|---|
| 4237 | n/a | Boolean inTracks; |
|---|
| 4238 | n/a | #ifndef SetAutomaticControlDragTrackingEnabledForWindow |
|---|
| 4239 | n/a | PyMac_PRECHECK(SetAutomaticControlDragTrackingEnabledForWindow); |
|---|
| 4240 | n/a | #endif |
|---|
| 4241 | n/a | if (!PyArg_ParseTuple(_args, "O&b", |
|---|
| 4242 | n/a | WinObj_Convert, &inWindow, |
|---|
| 4243 | n/a | &inTracks)) |
|---|
| 4244 | n/a | return NULL; |
|---|
| 4245 | n/a | _err = SetAutomaticControlDragTrackingEnabledForWindow(inWindow, |
|---|
| 4246 | n/a | inTracks); |
|---|
| 4247 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4248 | n/a | Py_INCREF(Py_None); |
|---|
| 4249 | n/a | _res = Py_None; |
|---|
| 4250 | n/a | return _res; |
|---|
| 4251 | n/a | } |
|---|
| 4252 | n/a | |
|---|
| 4253 | n/a | static PyObject *Ctl_IsAutomaticControlDragTrackingEnabledForWindow(PyObject *_self, PyObject *_args) |
|---|
| 4254 | n/a | { |
|---|
| 4255 | n/a | PyObject *_res = NULL; |
|---|
| 4256 | n/a | OSStatus _err; |
|---|
| 4257 | n/a | WindowPtr inWindow; |
|---|
| 4258 | n/a | Boolean outTracks; |
|---|
| 4259 | n/a | #ifndef IsAutomaticControlDragTrackingEnabledForWindow |
|---|
| 4260 | n/a | PyMac_PRECHECK(IsAutomaticControlDragTrackingEnabledForWindow); |
|---|
| 4261 | n/a | #endif |
|---|
| 4262 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 4263 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 4264 | n/a | return NULL; |
|---|
| 4265 | n/a | _err = IsAutomaticControlDragTrackingEnabledForWindow(inWindow, |
|---|
| 4266 | n/a | &outTracks); |
|---|
| 4267 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4268 | n/a | _res = Py_BuildValue("b", |
|---|
| 4269 | n/a | outTracks); |
|---|
| 4270 | n/a | return _res; |
|---|
| 4271 | n/a | } |
|---|
| 4272 | n/a | |
|---|
| 4273 | n/a | static PyObject *Ctl_CreateBevelButtonControl(PyObject *_self, PyObject *_args) |
|---|
| 4274 | n/a | { |
|---|
| 4275 | n/a | PyObject *_res = NULL; |
|---|
| 4276 | n/a | OSStatus _err; |
|---|
| 4277 | n/a | WindowPtr window; |
|---|
| 4278 | n/a | Rect boundsRect; |
|---|
| 4279 | n/a | CFStringRef title; |
|---|
| 4280 | n/a | UInt16 thickness; |
|---|
| 4281 | n/a | UInt16 behavior; |
|---|
| 4282 | n/a | ControlButtonContentInfo info; |
|---|
| 4283 | n/a | SInt16 menuID; |
|---|
| 4284 | n/a | UInt16 menuBehavior; |
|---|
| 4285 | n/a | UInt16 menuPlacement; |
|---|
| 4286 | n/a | ControlHandle outControl; |
|---|
| 4287 | n/a | #ifndef CreateBevelButtonControl |
|---|
| 4288 | n/a | PyMac_PRECHECK(CreateBevelButtonControl); |
|---|
| 4289 | n/a | #endif |
|---|
| 4290 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&HHO&hHH", |
|---|
| 4291 | n/a | WinObj_Convert, &window, |
|---|
| 4292 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4293 | n/a | CFStringRefObj_Convert, &title, |
|---|
| 4294 | n/a | &thickness, |
|---|
| 4295 | n/a | &behavior, |
|---|
| 4296 | n/a | ControlButtonContentInfo_Convert, &info, |
|---|
| 4297 | n/a | &menuID, |
|---|
| 4298 | n/a | &menuBehavior, |
|---|
| 4299 | n/a | &menuPlacement)) |
|---|
| 4300 | n/a | return NULL; |
|---|
| 4301 | n/a | _err = CreateBevelButtonControl(window, |
|---|
| 4302 | n/a | &boundsRect, |
|---|
| 4303 | n/a | title, |
|---|
| 4304 | n/a | thickness, |
|---|
| 4305 | n/a | behavior, |
|---|
| 4306 | n/a | &info, |
|---|
| 4307 | n/a | menuID, |
|---|
| 4308 | n/a | menuBehavior, |
|---|
| 4309 | n/a | menuPlacement, |
|---|
| 4310 | n/a | &outControl); |
|---|
| 4311 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4312 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4313 | n/a | CtlObj_New, outControl); |
|---|
| 4314 | n/a | return _res; |
|---|
| 4315 | n/a | } |
|---|
| 4316 | n/a | |
|---|
| 4317 | n/a | static PyObject *Ctl_CreateSliderControl(PyObject *_self, PyObject *_args) |
|---|
| 4318 | n/a | { |
|---|
| 4319 | n/a | PyObject *_res = NULL; |
|---|
| 4320 | n/a | OSStatus _err; |
|---|
| 4321 | n/a | WindowPtr window; |
|---|
| 4322 | n/a | Rect boundsRect; |
|---|
| 4323 | n/a | SInt32 value; |
|---|
| 4324 | n/a | SInt32 minimum; |
|---|
| 4325 | n/a | SInt32 maximum; |
|---|
| 4326 | n/a | UInt16 orientation; |
|---|
| 4327 | n/a | UInt16 numTickMarks; |
|---|
| 4328 | n/a | Boolean liveTracking; |
|---|
| 4329 | n/a | PyObject* liveTrackingProc; |
|---|
| 4330 | n/a | UniversalProcPtr c_callback; |
|---|
| 4331 | n/a | ControlHandle outControl; |
|---|
| 4332 | n/a | #ifndef CreateSliderControl |
|---|
| 4333 | n/a | PyMac_PRECHECK(CreateSliderControl); |
|---|
| 4334 | n/a | #endif |
|---|
| 4335 | n/a | if (!PyArg_ParseTuple(_args, "O&O&lllHHbO", |
|---|
| 4336 | n/a | WinObj_Convert, &window, |
|---|
| 4337 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4338 | n/a | &value, |
|---|
| 4339 | n/a | &minimum, |
|---|
| 4340 | n/a | &maximum, |
|---|
| 4341 | n/a | &orientation, |
|---|
| 4342 | n/a | &numTickMarks, |
|---|
| 4343 | n/a | &liveTracking, |
|---|
| 4344 | n/a | &liveTrackingProc)) |
|---|
| 4345 | n/a | return NULL; |
|---|
| 4346 | n/a | _err = CreateSliderControl(window, |
|---|
| 4347 | n/a | &boundsRect, |
|---|
| 4348 | n/a | value, |
|---|
| 4349 | n/a | minimum, |
|---|
| 4350 | n/a | maximum, |
|---|
| 4351 | n/a | orientation, |
|---|
| 4352 | n/a | numTickMarks, |
|---|
| 4353 | n/a | liveTracking, |
|---|
| 4354 | n/a | myactionproc_upp, |
|---|
| 4355 | n/a | &outControl); |
|---|
| 4356 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4357 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4358 | n/a | CtlObj_New, outControl); |
|---|
| 4359 | n/a | setcallback(_res, kMyControlActionProcTag, liveTrackingProc, &c_callback); |
|---|
| 4360 | n/a | return _res; |
|---|
| 4361 | n/a | } |
|---|
| 4362 | n/a | |
|---|
| 4363 | n/a | static PyObject *Ctl_CreateDisclosureTriangleControl(PyObject *_self, PyObject *_args) |
|---|
| 4364 | n/a | { |
|---|
| 4365 | n/a | PyObject *_res = NULL; |
|---|
| 4366 | n/a | OSStatus _err; |
|---|
| 4367 | n/a | WindowPtr inWindow; |
|---|
| 4368 | n/a | Rect inBoundsRect; |
|---|
| 4369 | n/a | UInt16 inOrientation; |
|---|
| 4370 | n/a | CFStringRef inTitle; |
|---|
| 4371 | n/a | SInt32 inInitialValue; |
|---|
| 4372 | n/a | Boolean inDrawTitle; |
|---|
| 4373 | n/a | Boolean inAutoToggles; |
|---|
| 4374 | n/a | ControlHandle outControl; |
|---|
| 4375 | n/a | #ifndef CreateDisclosureTriangleControl |
|---|
| 4376 | n/a | PyMac_PRECHECK(CreateDisclosureTriangleControl); |
|---|
| 4377 | n/a | #endif |
|---|
| 4378 | n/a | if (!PyArg_ParseTuple(_args, "O&O&HO&lbb", |
|---|
| 4379 | n/a | WinObj_Convert, &inWindow, |
|---|
| 4380 | n/a | PyMac_GetRect, &inBoundsRect, |
|---|
| 4381 | n/a | &inOrientation, |
|---|
| 4382 | n/a | CFStringRefObj_Convert, &inTitle, |
|---|
| 4383 | n/a | &inInitialValue, |
|---|
| 4384 | n/a | &inDrawTitle, |
|---|
| 4385 | n/a | &inAutoToggles)) |
|---|
| 4386 | n/a | return NULL; |
|---|
| 4387 | n/a | _err = CreateDisclosureTriangleControl(inWindow, |
|---|
| 4388 | n/a | &inBoundsRect, |
|---|
| 4389 | n/a | inOrientation, |
|---|
| 4390 | n/a | inTitle, |
|---|
| 4391 | n/a | inInitialValue, |
|---|
| 4392 | n/a | inDrawTitle, |
|---|
| 4393 | n/a | inAutoToggles, |
|---|
| 4394 | n/a | &outControl); |
|---|
| 4395 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4396 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4397 | n/a | CtlObj_New, outControl); |
|---|
| 4398 | n/a | return _res; |
|---|
| 4399 | n/a | } |
|---|
| 4400 | n/a | |
|---|
| 4401 | n/a | static PyObject *Ctl_CreateProgressBarControl(PyObject *_self, PyObject *_args) |
|---|
| 4402 | n/a | { |
|---|
| 4403 | n/a | PyObject *_res = NULL; |
|---|
| 4404 | n/a | OSStatus _err; |
|---|
| 4405 | n/a | WindowPtr window; |
|---|
| 4406 | n/a | Rect boundsRect; |
|---|
| 4407 | n/a | SInt32 value; |
|---|
| 4408 | n/a | SInt32 minimum; |
|---|
| 4409 | n/a | SInt32 maximum; |
|---|
| 4410 | n/a | Boolean indeterminate; |
|---|
| 4411 | n/a | ControlHandle outControl; |
|---|
| 4412 | n/a | #ifndef CreateProgressBarControl |
|---|
| 4413 | n/a | PyMac_PRECHECK(CreateProgressBarControl); |
|---|
| 4414 | n/a | #endif |
|---|
| 4415 | n/a | if (!PyArg_ParseTuple(_args, "O&O&lllb", |
|---|
| 4416 | n/a | WinObj_Convert, &window, |
|---|
| 4417 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4418 | n/a | &value, |
|---|
| 4419 | n/a | &minimum, |
|---|
| 4420 | n/a | &maximum, |
|---|
| 4421 | n/a | &indeterminate)) |
|---|
| 4422 | n/a | return NULL; |
|---|
| 4423 | n/a | _err = CreateProgressBarControl(window, |
|---|
| 4424 | n/a | &boundsRect, |
|---|
| 4425 | n/a | value, |
|---|
| 4426 | n/a | minimum, |
|---|
| 4427 | n/a | maximum, |
|---|
| 4428 | n/a | indeterminate, |
|---|
| 4429 | n/a | &outControl); |
|---|
| 4430 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4431 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4432 | n/a | CtlObj_New, outControl); |
|---|
| 4433 | n/a | return _res; |
|---|
| 4434 | n/a | } |
|---|
| 4435 | n/a | |
|---|
| 4436 | n/a | static PyObject *Ctl_CreateRelevanceBarControl(PyObject *_self, PyObject *_args) |
|---|
| 4437 | n/a | { |
|---|
| 4438 | n/a | PyObject *_res = NULL; |
|---|
| 4439 | n/a | OSStatus _err; |
|---|
| 4440 | n/a | WindowPtr window; |
|---|
| 4441 | n/a | Rect boundsRect; |
|---|
| 4442 | n/a | SInt32 value; |
|---|
| 4443 | n/a | SInt32 minimum; |
|---|
| 4444 | n/a | SInt32 maximum; |
|---|
| 4445 | n/a | ControlHandle outControl; |
|---|
| 4446 | n/a | #ifndef CreateRelevanceBarControl |
|---|
| 4447 | n/a | PyMac_PRECHECK(CreateRelevanceBarControl); |
|---|
| 4448 | n/a | #endif |
|---|
| 4449 | n/a | if (!PyArg_ParseTuple(_args, "O&O&lll", |
|---|
| 4450 | n/a | WinObj_Convert, &window, |
|---|
| 4451 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4452 | n/a | &value, |
|---|
| 4453 | n/a | &minimum, |
|---|
| 4454 | n/a | &maximum)) |
|---|
| 4455 | n/a | return NULL; |
|---|
| 4456 | n/a | _err = CreateRelevanceBarControl(window, |
|---|
| 4457 | n/a | &boundsRect, |
|---|
| 4458 | n/a | value, |
|---|
| 4459 | n/a | minimum, |
|---|
| 4460 | n/a | maximum, |
|---|
| 4461 | n/a | &outControl); |
|---|
| 4462 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4463 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4464 | n/a | CtlObj_New, outControl); |
|---|
| 4465 | n/a | return _res; |
|---|
| 4466 | n/a | } |
|---|
| 4467 | n/a | |
|---|
| 4468 | n/a | static PyObject *Ctl_CreateLittleArrowsControl(PyObject *_self, PyObject *_args) |
|---|
| 4469 | n/a | { |
|---|
| 4470 | n/a | PyObject *_res = NULL; |
|---|
| 4471 | n/a | OSStatus _err; |
|---|
| 4472 | n/a | WindowPtr window; |
|---|
| 4473 | n/a | Rect boundsRect; |
|---|
| 4474 | n/a | SInt32 value; |
|---|
| 4475 | n/a | SInt32 minimum; |
|---|
| 4476 | n/a | SInt32 maximum; |
|---|
| 4477 | n/a | SInt32 increment; |
|---|
| 4478 | n/a | ControlHandle outControl; |
|---|
| 4479 | n/a | #ifndef CreateLittleArrowsControl |
|---|
| 4480 | n/a | PyMac_PRECHECK(CreateLittleArrowsControl); |
|---|
| 4481 | n/a | #endif |
|---|
| 4482 | n/a | if (!PyArg_ParseTuple(_args, "O&O&llll", |
|---|
| 4483 | n/a | WinObj_Convert, &window, |
|---|
| 4484 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4485 | n/a | &value, |
|---|
| 4486 | n/a | &minimum, |
|---|
| 4487 | n/a | &maximum, |
|---|
| 4488 | n/a | &increment)) |
|---|
| 4489 | n/a | return NULL; |
|---|
| 4490 | n/a | _err = CreateLittleArrowsControl(window, |
|---|
| 4491 | n/a | &boundsRect, |
|---|
| 4492 | n/a | value, |
|---|
| 4493 | n/a | minimum, |
|---|
| 4494 | n/a | maximum, |
|---|
| 4495 | n/a | increment, |
|---|
| 4496 | n/a | &outControl); |
|---|
| 4497 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4498 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4499 | n/a | CtlObj_New, outControl); |
|---|
| 4500 | n/a | return _res; |
|---|
| 4501 | n/a | } |
|---|
| 4502 | n/a | |
|---|
| 4503 | n/a | static PyObject *Ctl_CreateChasingArrowsControl(PyObject *_self, PyObject *_args) |
|---|
| 4504 | n/a | { |
|---|
| 4505 | n/a | PyObject *_res = NULL; |
|---|
| 4506 | n/a | OSStatus _err; |
|---|
| 4507 | n/a | WindowPtr window; |
|---|
| 4508 | n/a | Rect boundsRect; |
|---|
| 4509 | n/a | ControlHandle outControl; |
|---|
| 4510 | n/a | #ifndef CreateChasingArrowsControl |
|---|
| 4511 | n/a | PyMac_PRECHECK(CreateChasingArrowsControl); |
|---|
| 4512 | n/a | #endif |
|---|
| 4513 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 4514 | n/a | WinObj_Convert, &window, |
|---|
| 4515 | n/a | PyMac_GetRect, &boundsRect)) |
|---|
| 4516 | n/a | return NULL; |
|---|
| 4517 | n/a | _err = CreateChasingArrowsControl(window, |
|---|
| 4518 | n/a | &boundsRect, |
|---|
| 4519 | n/a | &outControl); |
|---|
| 4520 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4521 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4522 | n/a | CtlObj_New, outControl); |
|---|
| 4523 | n/a | return _res; |
|---|
| 4524 | n/a | } |
|---|
| 4525 | n/a | |
|---|
| 4526 | n/a | static PyObject *Ctl_CreateSeparatorControl(PyObject *_self, PyObject *_args) |
|---|
| 4527 | n/a | { |
|---|
| 4528 | n/a | PyObject *_res = NULL; |
|---|
| 4529 | n/a | OSStatus _err; |
|---|
| 4530 | n/a | WindowPtr window; |
|---|
| 4531 | n/a | Rect boundsRect; |
|---|
| 4532 | n/a | ControlHandle outControl; |
|---|
| 4533 | n/a | #ifndef CreateSeparatorControl |
|---|
| 4534 | n/a | PyMac_PRECHECK(CreateSeparatorControl); |
|---|
| 4535 | n/a | #endif |
|---|
| 4536 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 4537 | n/a | WinObj_Convert, &window, |
|---|
| 4538 | n/a | PyMac_GetRect, &boundsRect)) |
|---|
| 4539 | n/a | return NULL; |
|---|
| 4540 | n/a | _err = CreateSeparatorControl(window, |
|---|
| 4541 | n/a | &boundsRect, |
|---|
| 4542 | n/a | &outControl); |
|---|
| 4543 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4544 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4545 | n/a | CtlObj_New, outControl); |
|---|
| 4546 | n/a | return _res; |
|---|
| 4547 | n/a | } |
|---|
| 4548 | n/a | |
|---|
| 4549 | n/a | static PyObject *Ctl_CreateGroupBoxControl(PyObject *_self, PyObject *_args) |
|---|
| 4550 | n/a | { |
|---|
| 4551 | n/a | PyObject *_res = NULL; |
|---|
| 4552 | n/a | OSStatus _err; |
|---|
| 4553 | n/a | WindowPtr window; |
|---|
| 4554 | n/a | Rect boundsRect; |
|---|
| 4555 | n/a | CFStringRef title; |
|---|
| 4556 | n/a | Boolean primary; |
|---|
| 4557 | n/a | ControlHandle outControl; |
|---|
| 4558 | n/a | #ifndef CreateGroupBoxControl |
|---|
| 4559 | n/a | PyMac_PRECHECK(CreateGroupBoxControl); |
|---|
| 4560 | n/a | #endif |
|---|
| 4561 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&b", |
|---|
| 4562 | n/a | WinObj_Convert, &window, |
|---|
| 4563 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4564 | n/a | CFStringRefObj_Convert, &title, |
|---|
| 4565 | n/a | &primary)) |
|---|
| 4566 | n/a | return NULL; |
|---|
| 4567 | n/a | _err = CreateGroupBoxControl(window, |
|---|
| 4568 | n/a | &boundsRect, |
|---|
| 4569 | n/a | title, |
|---|
| 4570 | n/a | primary, |
|---|
| 4571 | n/a | &outControl); |
|---|
| 4572 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4573 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4574 | n/a | CtlObj_New, outControl); |
|---|
| 4575 | n/a | return _res; |
|---|
| 4576 | n/a | } |
|---|
| 4577 | n/a | |
|---|
| 4578 | n/a | static PyObject *Ctl_CreateCheckGroupBoxControl(PyObject *_self, PyObject *_args) |
|---|
| 4579 | n/a | { |
|---|
| 4580 | n/a | PyObject *_res = NULL; |
|---|
| 4581 | n/a | OSStatus _err; |
|---|
| 4582 | n/a | WindowPtr window; |
|---|
| 4583 | n/a | Rect boundsRect; |
|---|
| 4584 | n/a | CFStringRef title; |
|---|
| 4585 | n/a | SInt32 initialValue; |
|---|
| 4586 | n/a | Boolean primary; |
|---|
| 4587 | n/a | Boolean autoToggle; |
|---|
| 4588 | n/a | ControlHandle outControl; |
|---|
| 4589 | n/a | #ifndef CreateCheckGroupBoxControl |
|---|
| 4590 | n/a | PyMac_PRECHECK(CreateCheckGroupBoxControl); |
|---|
| 4591 | n/a | #endif |
|---|
| 4592 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&lbb", |
|---|
| 4593 | n/a | WinObj_Convert, &window, |
|---|
| 4594 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4595 | n/a | CFStringRefObj_Convert, &title, |
|---|
| 4596 | n/a | &initialValue, |
|---|
| 4597 | n/a | &primary, |
|---|
| 4598 | n/a | &autoToggle)) |
|---|
| 4599 | n/a | return NULL; |
|---|
| 4600 | n/a | _err = CreateCheckGroupBoxControl(window, |
|---|
| 4601 | n/a | &boundsRect, |
|---|
| 4602 | n/a | title, |
|---|
| 4603 | n/a | initialValue, |
|---|
| 4604 | n/a | primary, |
|---|
| 4605 | n/a | autoToggle, |
|---|
| 4606 | n/a | &outControl); |
|---|
| 4607 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4608 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4609 | n/a | CtlObj_New, outControl); |
|---|
| 4610 | n/a | return _res; |
|---|
| 4611 | n/a | } |
|---|
| 4612 | n/a | |
|---|
| 4613 | n/a | static PyObject *Ctl_CreatePopupGroupBoxControl(PyObject *_self, PyObject *_args) |
|---|
| 4614 | n/a | { |
|---|
| 4615 | n/a | PyObject *_res = NULL; |
|---|
| 4616 | n/a | OSStatus _err; |
|---|
| 4617 | n/a | WindowPtr window; |
|---|
| 4618 | n/a | Rect boundsRect; |
|---|
| 4619 | n/a | CFStringRef title; |
|---|
| 4620 | n/a | Boolean primary; |
|---|
| 4621 | n/a | SInt16 menuID; |
|---|
| 4622 | n/a | Boolean variableWidth; |
|---|
| 4623 | n/a | SInt16 titleWidth; |
|---|
| 4624 | n/a | SInt16 titleJustification; |
|---|
| 4625 | n/a | Style titleStyle; |
|---|
| 4626 | n/a | ControlHandle outControl; |
|---|
| 4627 | n/a | #ifndef CreatePopupGroupBoxControl |
|---|
| 4628 | n/a | PyMac_PRECHECK(CreatePopupGroupBoxControl); |
|---|
| 4629 | n/a | #endif |
|---|
| 4630 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&bhbhhb", |
|---|
| 4631 | n/a | WinObj_Convert, &window, |
|---|
| 4632 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4633 | n/a | CFStringRefObj_Convert, &title, |
|---|
| 4634 | n/a | &primary, |
|---|
| 4635 | n/a | &menuID, |
|---|
| 4636 | n/a | &variableWidth, |
|---|
| 4637 | n/a | &titleWidth, |
|---|
| 4638 | n/a | &titleJustification, |
|---|
| 4639 | n/a | &titleStyle)) |
|---|
| 4640 | n/a | return NULL; |
|---|
| 4641 | n/a | _err = CreatePopupGroupBoxControl(window, |
|---|
| 4642 | n/a | &boundsRect, |
|---|
| 4643 | n/a | title, |
|---|
| 4644 | n/a | primary, |
|---|
| 4645 | n/a | menuID, |
|---|
| 4646 | n/a | variableWidth, |
|---|
| 4647 | n/a | titleWidth, |
|---|
| 4648 | n/a | titleJustification, |
|---|
| 4649 | n/a | titleStyle, |
|---|
| 4650 | n/a | &outControl); |
|---|
| 4651 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4652 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4653 | n/a | CtlObj_New, outControl); |
|---|
| 4654 | n/a | return _res; |
|---|
| 4655 | n/a | } |
|---|
| 4656 | n/a | |
|---|
| 4657 | n/a | static PyObject *Ctl_CreateImageWellControl(PyObject *_self, PyObject *_args) |
|---|
| 4658 | n/a | { |
|---|
| 4659 | n/a | PyObject *_res = NULL; |
|---|
| 4660 | n/a | OSStatus _err; |
|---|
| 4661 | n/a | WindowPtr window; |
|---|
| 4662 | n/a | Rect boundsRect; |
|---|
| 4663 | n/a | ControlButtonContentInfo info; |
|---|
| 4664 | n/a | ControlHandle outControl; |
|---|
| 4665 | n/a | #ifndef CreateImageWellControl |
|---|
| 4666 | n/a | PyMac_PRECHECK(CreateImageWellControl); |
|---|
| 4667 | n/a | #endif |
|---|
| 4668 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&", |
|---|
| 4669 | n/a | WinObj_Convert, &window, |
|---|
| 4670 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4671 | n/a | ControlButtonContentInfo_Convert, &info)) |
|---|
| 4672 | n/a | return NULL; |
|---|
| 4673 | n/a | _err = CreateImageWellControl(window, |
|---|
| 4674 | n/a | &boundsRect, |
|---|
| 4675 | n/a | &info, |
|---|
| 4676 | n/a | &outControl); |
|---|
| 4677 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4678 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4679 | n/a | CtlObj_New, outControl); |
|---|
| 4680 | n/a | return _res; |
|---|
| 4681 | n/a | } |
|---|
| 4682 | n/a | |
|---|
| 4683 | n/a | static PyObject *Ctl_CreatePopupArrowControl(PyObject *_self, PyObject *_args) |
|---|
| 4684 | n/a | { |
|---|
| 4685 | n/a | PyObject *_res = NULL; |
|---|
| 4686 | n/a | OSStatus _err; |
|---|
| 4687 | n/a | WindowPtr window; |
|---|
| 4688 | n/a | Rect boundsRect; |
|---|
| 4689 | n/a | UInt16 orientation; |
|---|
| 4690 | n/a | UInt16 size; |
|---|
| 4691 | n/a | ControlHandle outControl; |
|---|
| 4692 | n/a | #ifndef CreatePopupArrowControl |
|---|
| 4693 | n/a | PyMac_PRECHECK(CreatePopupArrowControl); |
|---|
| 4694 | n/a | #endif |
|---|
| 4695 | n/a | if (!PyArg_ParseTuple(_args, "O&O&HH", |
|---|
| 4696 | n/a | WinObj_Convert, &window, |
|---|
| 4697 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4698 | n/a | &orientation, |
|---|
| 4699 | n/a | &size)) |
|---|
| 4700 | n/a | return NULL; |
|---|
| 4701 | n/a | _err = CreatePopupArrowControl(window, |
|---|
| 4702 | n/a | &boundsRect, |
|---|
| 4703 | n/a | orientation, |
|---|
| 4704 | n/a | size, |
|---|
| 4705 | n/a | &outControl); |
|---|
| 4706 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4707 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4708 | n/a | CtlObj_New, outControl); |
|---|
| 4709 | n/a | return _res; |
|---|
| 4710 | n/a | } |
|---|
| 4711 | n/a | |
|---|
| 4712 | n/a | static PyObject *Ctl_CreatePlacardControl(PyObject *_self, PyObject *_args) |
|---|
| 4713 | n/a | { |
|---|
| 4714 | n/a | PyObject *_res = NULL; |
|---|
| 4715 | n/a | OSStatus _err; |
|---|
| 4716 | n/a | WindowPtr window; |
|---|
| 4717 | n/a | Rect boundsRect; |
|---|
| 4718 | n/a | ControlHandle outControl; |
|---|
| 4719 | n/a | #ifndef CreatePlacardControl |
|---|
| 4720 | n/a | PyMac_PRECHECK(CreatePlacardControl); |
|---|
| 4721 | n/a | #endif |
|---|
| 4722 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 4723 | n/a | WinObj_Convert, &window, |
|---|
| 4724 | n/a | PyMac_GetRect, &boundsRect)) |
|---|
| 4725 | n/a | return NULL; |
|---|
| 4726 | n/a | _err = CreatePlacardControl(window, |
|---|
| 4727 | n/a | &boundsRect, |
|---|
| 4728 | n/a | &outControl); |
|---|
| 4729 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4730 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4731 | n/a | CtlObj_New, outControl); |
|---|
| 4732 | n/a | return _res; |
|---|
| 4733 | n/a | } |
|---|
| 4734 | n/a | |
|---|
| 4735 | n/a | static PyObject *Ctl_CreateClockControl(PyObject *_self, PyObject *_args) |
|---|
| 4736 | n/a | { |
|---|
| 4737 | n/a | PyObject *_res = NULL; |
|---|
| 4738 | n/a | OSStatus _err; |
|---|
| 4739 | n/a | WindowPtr window; |
|---|
| 4740 | n/a | Rect boundsRect; |
|---|
| 4741 | n/a | UInt16 clockType; |
|---|
| 4742 | n/a | UInt32 clockFlags; |
|---|
| 4743 | n/a | ControlHandle outControl; |
|---|
| 4744 | n/a | #ifndef CreateClockControl |
|---|
| 4745 | n/a | PyMac_PRECHECK(CreateClockControl); |
|---|
| 4746 | n/a | #endif |
|---|
| 4747 | n/a | if (!PyArg_ParseTuple(_args, "O&O&Hl", |
|---|
| 4748 | n/a | WinObj_Convert, &window, |
|---|
| 4749 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4750 | n/a | &clockType, |
|---|
| 4751 | n/a | &clockFlags)) |
|---|
| 4752 | n/a | return NULL; |
|---|
| 4753 | n/a | _err = CreateClockControl(window, |
|---|
| 4754 | n/a | &boundsRect, |
|---|
| 4755 | n/a | clockType, |
|---|
| 4756 | n/a | clockFlags, |
|---|
| 4757 | n/a | &outControl); |
|---|
| 4758 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4759 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4760 | n/a | CtlObj_New, outControl); |
|---|
| 4761 | n/a | return _res; |
|---|
| 4762 | n/a | } |
|---|
| 4763 | n/a | |
|---|
| 4764 | n/a | static PyObject *Ctl_CreateUserPaneControl(PyObject *_self, PyObject *_args) |
|---|
| 4765 | n/a | { |
|---|
| 4766 | n/a | PyObject *_res = NULL; |
|---|
| 4767 | n/a | OSStatus _err; |
|---|
| 4768 | n/a | WindowPtr window; |
|---|
| 4769 | n/a | Rect boundsRect; |
|---|
| 4770 | n/a | UInt32 features; |
|---|
| 4771 | n/a | ControlHandle outControl; |
|---|
| 4772 | n/a | #ifndef CreateUserPaneControl |
|---|
| 4773 | n/a | PyMac_PRECHECK(CreateUserPaneControl); |
|---|
| 4774 | n/a | #endif |
|---|
| 4775 | n/a | if (!PyArg_ParseTuple(_args, "O&O&l", |
|---|
| 4776 | n/a | WinObj_Convert, &window, |
|---|
| 4777 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4778 | n/a | &features)) |
|---|
| 4779 | n/a | return NULL; |
|---|
| 4780 | n/a | _err = CreateUserPaneControl(window, |
|---|
| 4781 | n/a | &boundsRect, |
|---|
| 4782 | n/a | features, |
|---|
| 4783 | n/a | &outControl); |
|---|
| 4784 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4785 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4786 | n/a | CtlObj_New, outControl); |
|---|
| 4787 | n/a | return _res; |
|---|
| 4788 | n/a | } |
|---|
| 4789 | n/a | |
|---|
| 4790 | n/a | static PyObject *Ctl_CreateEditTextControl(PyObject *_self, PyObject *_args) |
|---|
| 4791 | n/a | { |
|---|
| 4792 | n/a | PyObject *_res = NULL; |
|---|
| 4793 | n/a | OSStatus _err; |
|---|
| 4794 | n/a | WindowPtr window; |
|---|
| 4795 | n/a | Rect boundsRect; |
|---|
| 4796 | n/a | CFStringRef text; |
|---|
| 4797 | n/a | Boolean isPassword; |
|---|
| 4798 | n/a | Boolean useInlineInput; |
|---|
| 4799 | n/a | ControlFontStyleRec style; |
|---|
| 4800 | n/a | ControlHandle outControl; |
|---|
| 4801 | n/a | #ifndef CreateEditTextControl |
|---|
| 4802 | n/a | PyMac_PRECHECK(CreateEditTextControl); |
|---|
| 4803 | n/a | #endif |
|---|
| 4804 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&bbO&", |
|---|
| 4805 | n/a | WinObj_Convert, &window, |
|---|
| 4806 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4807 | n/a | CFStringRefObj_Convert, &text, |
|---|
| 4808 | n/a | &isPassword, |
|---|
| 4809 | n/a | &useInlineInput, |
|---|
| 4810 | n/a | ControlFontStyle_Convert, &style)) |
|---|
| 4811 | n/a | return NULL; |
|---|
| 4812 | n/a | _err = CreateEditTextControl(window, |
|---|
| 4813 | n/a | &boundsRect, |
|---|
| 4814 | n/a | text, |
|---|
| 4815 | n/a | isPassword, |
|---|
| 4816 | n/a | useInlineInput, |
|---|
| 4817 | n/a | &style, |
|---|
| 4818 | n/a | &outControl); |
|---|
| 4819 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4820 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4821 | n/a | CtlObj_New, outControl); |
|---|
| 4822 | n/a | return _res; |
|---|
| 4823 | n/a | } |
|---|
| 4824 | n/a | |
|---|
| 4825 | n/a | static PyObject *Ctl_CreateStaticTextControl(PyObject *_self, PyObject *_args) |
|---|
| 4826 | n/a | { |
|---|
| 4827 | n/a | PyObject *_res = NULL; |
|---|
| 4828 | n/a | OSStatus _err; |
|---|
| 4829 | n/a | WindowPtr window; |
|---|
| 4830 | n/a | Rect boundsRect; |
|---|
| 4831 | n/a | CFStringRef text; |
|---|
| 4832 | n/a | ControlFontStyleRec style; |
|---|
| 4833 | n/a | ControlHandle outControl; |
|---|
| 4834 | n/a | #ifndef CreateStaticTextControl |
|---|
| 4835 | n/a | PyMac_PRECHECK(CreateStaticTextControl); |
|---|
| 4836 | n/a | #endif |
|---|
| 4837 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&O&", |
|---|
| 4838 | n/a | WinObj_Convert, &window, |
|---|
| 4839 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4840 | n/a | CFStringRefObj_Convert, &text, |
|---|
| 4841 | n/a | ControlFontStyle_Convert, &style)) |
|---|
| 4842 | n/a | return NULL; |
|---|
| 4843 | n/a | _err = CreateStaticTextControl(window, |
|---|
| 4844 | n/a | &boundsRect, |
|---|
| 4845 | n/a | text, |
|---|
| 4846 | n/a | &style, |
|---|
| 4847 | n/a | &outControl); |
|---|
| 4848 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4849 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4850 | n/a | CtlObj_New, outControl); |
|---|
| 4851 | n/a | return _res; |
|---|
| 4852 | n/a | } |
|---|
| 4853 | n/a | |
|---|
| 4854 | n/a | static PyObject *Ctl_CreatePictureControl(PyObject *_self, PyObject *_args) |
|---|
| 4855 | n/a | { |
|---|
| 4856 | n/a | PyObject *_res = NULL; |
|---|
| 4857 | n/a | OSStatus _err; |
|---|
| 4858 | n/a | WindowPtr window; |
|---|
| 4859 | n/a | Rect boundsRect; |
|---|
| 4860 | n/a | ControlButtonContentInfo content; |
|---|
| 4861 | n/a | Boolean dontTrack; |
|---|
| 4862 | n/a | ControlHandle outControl; |
|---|
| 4863 | n/a | #ifndef CreatePictureControl |
|---|
| 4864 | n/a | PyMac_PRECHECK(CreatePictureControl); |
|---|
| 4865 | n/a | #endif |
|---|
| 4866 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&b", |
|---|
| 4867 | n/a | WinObj_Convert, &window, |
|---|
| 4868 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4869 | n/a | ControlButtonContentInfo_Convert, &content, |
|---|
| 4870 | n/a | &dontTrack)) |
|---|
| 4871 | n/a | return NULL; |
|---|
| 4872 | n/a | _err = CreatePictureControl(window, |
|---|
| 4873 | n/a | &boundsRect, |
|---|
| 4874 | n/a | &content, |
|---|
| 4875 | n/a | dontTrack, |
|---|
| 4876 | n/a | &outControl); |
|---|
| 4877 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4878 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4879 | n/a | CtlObj_New, outControl); |
|---|
| 4880 | n/a | return _res; |
|---|
| 4881 | n/a | } |
|---|
| 4882 | n/a | |
|---|
| 4883 | n/a | static PyObject *Ctl_CreateIconControl(PyObject *_self, PyObject *_args) |
|---|
| 4884 | n/a | { |
|---|
| 4885 | n/a | PyObject *_res = NULL; |
|---|
| 4886 | n/a | OSStatus _err; |
|---|
| 4887 | n/a | WindowPtr inWindow; |
|---|
| 4888 | n/a | Rect inBoundsRect; |
|---|
| 4889 | n/a | ControlButtonContentInfo inIconContent; |
|---|
| 4890 | n/a | Boolean inDontTrack; |
|---|
| 4891 | n/a | ControlHandle outControl; |
|---|
| 4892 | n/a | #ifndef CreateIconControl |
|---|
| 4893 | n/a | PyMac_PRECHECK(CreateIconControl); |
|---|
| 4894 | n/a | #endif |
|---|
| 4895 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&b", |
|---|
| 4896 | n/a | WinObj_Convert, &inWindow, |
|---|
| 4897 | n/a | PyMac_GetRect, &inBoundsRect, |
|---|
| 4898 | n/a | ControlButtonContentInfo_Convert, &inIconContent, |
|---|
| 4899 | n/a | &inDontTrack)) |
|---|
| 4900 | n/a | return NULL; |
|---|
| 4901 | n/a | _err = CreateIconControl(inWindow, |
|---|
| 4902 | n/a | &inBoundsRect, |
|---|
| 4903 | n/a | &inIconContent, |
|---|
| 4904 | n/a | inDontTrack, |
|---|
| 4905 | n/a | &outControl); |
|---|
| 4906 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4907 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4908 | n/a | CtlObj_New, outControl); |
|---|
| 4909 | n/a | return _res; |
|---|
| 4910 | n/a | } |
|---|
| 4911 | n/a | |
|---|
| 4912 | n/a | static PyObject *Ctl_CreateWindowHeaderControl(PyObject *_self, PyObject *_args) |
|---|
| 4913 | n/a | { |
|---|
| 4914 | n/a | PyObject *_res = NULL; |
|---|
| 4915 | n/a | OSStatus _err; |
|---|
| 4916 | n/a | WindowPtr window; |
|---|
| 4917 | n/a | Rect boundsRect; |
|---|
| 4918 | n/a | Boolean isListHeader; |
|---|
| 4919 | n/a | ControlHandle outControl; |
|---|
| 4920 | n/a | #ifndef CreateWindowHeaderControl |
|---|
| 4921 | n/a | PyMac_PRECHECK(CreateWindowHeaderControl); |
|---|
| 4922 | n/a | #endif |
|---|
| 4923 | n/a | if (!PyArg_ParseTuple(_args, "O&O&b", |
|---|
| 4924 | n/a | WinObj_Convert, &window, |
|---|
| 4925 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4926 | n/a | &isListHeader)) |
|---|
| 4927 | n/a | return NULL; |
|---|
| 4928 | n/a | _err = CreateWindowHeaderControl(window, |
|---|
| 4929 | n/a | &boundsRect, |
|---|
| 4930 | n/a | isListHeader, |
|---|
| 4931 | n/a | &outControl); |
|---|
| 4932 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4933 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4934 | n/a | CtlObj_New, outControl); |
|---|
| 4935 | n/a | return _res; |
|---|
| 4936 | n/a | } |
|---|
| 4937 | n/a | |
|---|
| 4938 | n/a | static PyObject *Ctl_CreatePushButtonControl(PyObject *_self, PyObject *_args) |
|---|
| 4939 | n/a | { |
|---|
| 4940 | n/a | PyObject *_res = NULL; |
|---|
| 4941 | n/a | OSStatus _err; |
|---|
| 4942 | n/a | WindowPtr window; |
|---|
| 4943 | n/a | Rect boundsRect; |
|---|
| 4944 | n/a | CFStringRef title; |
|---|
| 4945 | n/a | ControlHandle outControl; |
|---|
| 4946 | n/a | #ifndef CreatePushButtonControl |
|---|
| 4947 | n/a | PyMac_PRECHECK(CreatePushButtonControl); |
|---|
| 4948 | n/a | #endif |
|---|
| 4949 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&", |
|---|
| 4950 | n/a | WinObj_Convert, &window, |
|---|
| 4951 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4952 | n/a | CFStringRefObj_Convert, &title)) |
|---|
| 4953 | n/a | return NULL; |
|---|
| 4954 | n/a | _err = CreatePushButtonControl(window, |
|---|
| 4955 | n/a | &boundsRect, |
|---|
| 4956 | n/a | title, |
|---|
| 4957 | n/a | &outControl); |
|---|
| 4958 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4959 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4960 | n/a | CtlObj_New, outControl); |
|---|
| 4961 | n/a | return _res; |
|---|
| 4962 | n/a | } |
|---|
| 4963 | n/a | |
|---|
| 4964 | n/a | static PyObject *Ctl_CreatePushButtonWithIconControl(PyObject *_self, PyObject *_args) |
|---|
| 4965 | n/a | { |
|---|
| 4966 | n/a | PyObject *_res = NULL; |
|---|
| 4967 | n/a | OSStatus _err; |
|---|
| 4968 | n/a | WindowPtr window; |
|---|
| 4969 | n/a | Rect boundsRect; |
|---|
| 4970 | n/a | CFStringRef title; |
|---|
| 4971 | n/a | ControlButtonContentInfo icon; |
|---|
| 4972 | n/a | UInt16 iconAlignment; |
|---|
| 4973 | n/a | ControlHandle outControl; |
|---|
| 4974 | n/a | #ifndef CreatePushButtonWithIconControl |
|---|
| 4975 | n/a | PyMac_PRECHECK(CreatePushButtonWithIconControl); |
|---|
| 4976 | n/a | #endif |
|---|
| 4977 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&O&H", |
|---|
| 4978 | n/a | WinObj_Convert, &window, |
|---|
| 4979 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 4980 | n/a | CFStringRefObj_Convert, &title, |
|---|
| 4981 | n/a | ControlButtonContentInfo_Convert, &icon, |
|---|
| 4982 | n/a | &iconAlignment)) |
|---|
| 4983 | n/a | return NULL; |
|---|
| 4984 | n/a | _err = CreatePushButtonWithIconControl(window, |
|---|
| 4985 | n/a | &boundsRect, |
|---|
| 4986 | n/a | title, |
|---|
| 4987 | n/a | &icon, |
|---|
| 4988 | n/a | iconAlignment, |
|---|
| 4989 | n/a | &outControl); |
|---|
| 4990 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 4991 | n/a | _res = Py_BuildValue("O&", |
|---|
| 4992 | n/a | CtlObj_New, outControl); |
|---|
| 4993 | n/a | return _res; |
|---|
| 4994 | n/a | } |
|---|
| 4995 | n/a | |
|---|
| 4996 | n/a | static PyObject *Ctl_CreateRadioButtonControl(PyObject *_self, PyObject *_args) |
|---|
| 4997 | n/a | { |
|---|
| 4998 | n/a | PyObject *_res = NULL; |
|---|
| 4999 | n/a | OSStatus _err; |
|---|
| 5000 | n/a | WindowPtr window; |
|---|
| 5001 | n/a | Rect boundsRect; |
|---|
| 5002 | n/a | CFStringRef title; |
|---|
| 5003 | n/a | SInt32 initialValue; |
|---|
| 5004 | n/a | Boolean autoToggle; |
|---|
| 5005 | n/a | ControlHandle outControl; |
|---|
| 5006 | n/a | #ifndef CreateRadioButtonControl |
|---|
| 5007 | n/a | PyMac_PRECHECK(CreateRadioButtonControl); |
|---|
| 5008 | n/a | #endif |
|---|
| 5009 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&lb", |
|---|
| 5010 | n/a | WinObj_Convert, &window, |
|---|
| 5011 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 5012 | n/a | CFStringRefObj_Convert, &title, |
|---|
| 5013 | n/a | &initialValue, |
|---|
| 5014 | n/a | &autoToggle)) |
|---|
| 5015 | n/a | return NULL; |
|---|
| 5016 | n/a | _err = CreateRadioButtonControl(window, |
|---|
| 5017 | n/a | &boundsRect, |
|---|
| 5018 | n/a | title, |
|---|
| 5019 | n/a | initialValue, |
|---|
| 5020 | n/a | autoToggle, |
|---|
| 5021 | n/a | &outControl); |
|---|
| 5022 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5023 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5024 | n/a | CtlObj_New, outControl); |
|---|
| 5025 | n/a | return _res; |
|---|
| 5026 | n/a | } |
|---|
| 5027 | n/a | |
|---|
| 5028 | n/a | static PyObject *Ctl_CreateCheckBoxControl(PyObject *_self, PyObject *_args) |
|---|
| 5029 | n/a | { |
|---|
| 5030 | n/a | PyObject *_res = NULL; |
|---|
| 5031 | n/a | OSStatus _err; |
|---|
| 5032 | n/a | WindowPtr window; |
|---|
| 5033 | n/a | Rect boundsRect; |
|---|
| 5034 | n/a | CFStringRef title; |
|---|
| 5035 | n/a | SInt32 initialValue; |
|---|
| 5036 | n/a | Boolean autoToggle; |
|---|
| 5037 | n/a | ControlHandle outControl; |
|---|
| 5038 | n/a | #ifndef CreateCheckBoxControl |
|---|
| 5039 | n/a | PyMac_PRECHECK(CreateCheckBoxControl); |
|---|
| 5040 | n/a | #endif |
|---|
| 5041 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&lb", |
|---|
| 5042 | n/a | WinObj_Convert, &window, |
|---|
| 5043 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 5044 | n/a | CFStringRefObj_Convert, &title, |
|---|
| 5045 | n/a | &initialValue, |
|---|
| 5046 | n/a | &autoToggle)) |
|---|
| 5047 | n/a | return NULL; |
|---|
| 5048 | n/a | _err = CreateCheckBoxControl(window, |
|---|
| 5049 | n/a | &boundsRect, |
|---|
| 5050 | n/a | title, |
|---|
| 5051 | n/a | initialValue, |
|---|
| 5052 | n/a | autoToggle, |
|---|
| 5053 | n/a | &outControl); |
|---|
| 5054 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5055 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5056 | n/a | CtlObj_New, outControl); |
|---|
| 5057 | n/a | return _res; |
|---|
| 5058 | n/a | } |
|---|
| 5059 | n/a | |
|---|
| 5060 | n/a | static PyObject *Ctl_CreateScrollBarControl(PyObject *_self, PyObject *_args) |
|---|
| 5061 | n/a | { |
|---|
| 5062 | n/a | PyObject *_res = NULL; |
|---|
| 5063 | n/a | OSStatus _err; |
|---|
| 5064 | n/a | WindowPtr window; |
|---|
| 5065 | n/a | Rect boundsRect; |
|---|
| 5066 | n/a | SInt32 value; |
|---|
| 5067 | n/a | SInt32 minimum; |
|---|
| 5068 | n/a | SInt32 maximum; |
|---|
| 5069 | n/a | SInt32 viewSize; |
|---|
| 5070 | n/a | Boolean liveTracking; |
|---|
| 5071 | n/a | PyObject* liveTrackingProc; |
|---|
| 5072 | n/a | UniversalProcPtr c_callback; |
|---|
| 5073 | n/a | ControlHandle outControl; |
|---|
| 5074 | n/a | #ifndef CreateScrollBarControl |
|---|
| 5075 | n/a | PyMac_PRECHECK(CreateScrollBarControl); |
|---|
| 5076 | n/a | #endif |
|---|
| 5077 | n/a | if (!PyArg_ParseTuple(_args, "O&O&llllbO", |
|---|
| 5078 | n/a | WinObj_Convert, &window, |
|---|
| 5079 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 5080 | n/a | &value, |
|---|
| 5081 | n/a | &minimum, |
|---|
| 5082 | n/a | &maximum, |
|---|
| 5083 | n/a | &viewSize, |
|---|
| 5084 | n/a | &liveTracking, |
|---|
| 5085 | n/a | &liveTrackingProc)) |
|---|
| 5086 | n/a | return NULL; |
|---|
| 5087 | n/a | _err = CreateScrollBarControl(window, |
|---|
| 5088 | n/a | &boundsRect, |
|---|
| 5089 | n/a | value, |
|---|
| 5090 | n/a | minimum, |
|---|
| 5091 | n/a | maximum, |
|---|
| 5092 | n/a | viewSize, |
|---|
| 5093 | n/a | liveTracking, |
|---|
| 5094 | n/a | myactionproc_upp, |
|---|
| 5095 | n/a | &outControl); |
|---|
| 5096 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5097 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5098 | n/a | CtlObj_New, outControl); |
|---|
| 5099 | n/a | setcallback(_res, kMyControlActionProcTag, liveTrackingProc, &c_callback); |
|---|
| 5100 | n/a | return _res; |
|---|
| 5101 | n/a | } |
|---|
| 5102 | n/a | |
|---|
| 5103 | n/a | static PyObject *Ctl_CreatePopupButtonControl(PyObject *_self, PyObject *_args) |
|---|
| 5104 | n/a | { |
|---|
| 5105 | n/a | PyObject *_res = NULL; |
|---|
| 5106 | n/a | OSStatus _err; |
|---|
| 5107 | n/a | WindowPtr window; |
|---|
| 5108 | n/a | Rect boundsRect; |
|---|
| 5109 | n/a | CFStringRef title; |
|---|
| 5110 | n/a | SInt16 menuID; |
|---|
| 5111 | n/a | Boolean variableWidth; |
|---|
| 5112 | n/a | SInt16 titleWidth; |
|---|
| 5113 | n/a | SInt16 titleJustification; |
|---|
| 5114 | n/a | Style titleStyle; |
|---|
| 5115 | n/a | ControlHandle outControl; |
|---|
| 5116 | n/a | #ifndef CreatePopupButtonControl |
|---|
| 5117 | n/a | PyMac_PRECHECK(CreatePopupButtonControl); |
|---|
| 5118 | n/a | #endif |
|---|
| 5119 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&hbhhb", |
|---|
| 5120 | n/a | WinObj_Convert, &window, |
|---|
| 5121 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 5122 | n/a | CFStringRefObj_Convert, &title, |
|---|
| 5123 | n/a | &menuID, |
|---|
| 5124 | n/a | &variableWidth, |
|---|
| 5125 | n/a | &titleWidth, |
|---|
| 5126 | n/a | &titleJustification, |
|---|
| 5127 | n/a | &titleStyle)) |
|---|
| 5128 | n/a | return NULL; |
|---|
| 5129 | n/a | _err = CreatePopupButtonControl(window, |
|---|
| 5130 | n/a | &boundsRect, |
|---|
| 5131 | n/a | title, |
|---|
| 5132 | n/a | menuID, |
|---|
| 5133 | n/a | variableWidth, |
|---|
| 5134 | n/a | titleWidth, |
|---|
| 5135 | n/a | titleJustification, |
|---|
| 5136 | n/a | titleStyle, |
|---|
| 5137 | n/a | &outControl); |
|---|
| 5138 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5139 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5140 | n/a | CtlObj_New, outControl); |
|---|
| 5141 | n/a | return _res; |
|---|
| 5142 | n/a | } |
|---|
| 5143 | n/a | |
|---|
| 5144 | n/a | static PyObject *Ctl_CreateRadioGroupControl(PyObject *_self, PyObject *_args) |
|---|
| 5145 | n/a | { |
|---|
| 5146 | n/a | PyObject *_res = NULL; |
|---|
| 5147 | n/a | OSStatus _err; |
|---|
| 5148 | n/a | WindowPtr window; |
|---|
| 5149 | n/a | Rect boundsRect; |
|---|
| 5150 | n/a | ControlHandle outControl; |
|---|
| 5151 | n/a | #ifndef CreateRadioGroupControl |
|---|
| 5152 | n/a | PyMac_PRECHECK(CreateRadioGroupControl); |
|---|
| 5153 | n/a | #endif |
|---|
| 5154 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 5155 | n/a | WinObj_Convert, &window, |
|---|
| 5156 | n/a | PyMac_GetRect, &boundsRect)) |
|---|
| 5157 | n/a | return NULL; |
|---|
| 5158 | n/a | _err = CreateRadioGroupControl(window, |
|---|
| 5159 | n/a | &boundsRect, |
|---|
| 5160 | n/a | &outControl); |
|---|
| 5161 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5162 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5163 | n/a | CtlObj_New, outControl); |
|---|
| 5164 | n/a | return _res; |
|---|
| 5165 | n/a | } |
|---|
| 5166 | n/a | |
|---|
| 5167 | n/a | static PyObject *Ctl_CreateScrollingTextBoxControl(PyObject *_self, PyObject *_args) |
|---|
| 5168 | n/a | { |
|---|
| 5169 | n/a | PyObject *_res = NULL; |
|---|
| 5170 | n/a | OSStatus _err; |
|---|
| 5171 | n/a | WindowPtr window; |
|---|
| 5172 | n/a | Rect boundsRect; |
|---|
| 5173 | n/a | SInt16 contentResID; |
|---|
| 5174 | n/a | Boolean autoScroll; |
|---|
| 5175 | n/a | UInt32 delayBeforeAutoScroll; |
|---|
| 5176 | n/a | UInt32 delayBetweenAutoScroll; |
|---|
| 5177 | n/a | UInt16 autoScrollAmount; |
|---|
| 5178 | n/a | ControlHandle outControl; |
|---|
| 5179 | n/a | #ifndef CreateScrollingTextBoxControl |
|---|
| 5180 | n/a | PyMac_PRECHECK(CreateScrollingTextBoxControl); |
|---|
| 5181 | n/a | #endif |
|---|
| 5182 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hbllH", |
|---|
| 5183 | n/a | WinObj_Convert, &window, |
|---|
| 5184 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 5185 | n/a | &contentResID, |
|---|
| 5186 | n/a | &autoScroll, |
|---|
| 5187 | n/a | &delayBeforeAutoScroll, |
|---|
| 5188 | n/a | &delayBetweenAutoScroll, |
|---|
| 5189 | n/a | &autoScrollAmount)) |
|---|
| 5190 | n/a | return NULL; |
|---|
| 5191 | n/a | _err = CreateScrollingTextBoxControl(window, |
|---|
| 5192 | n/a | &boundsRect, |
|---|
| 5193 | n/a | contentResID, |
|---|
| 5194 | n/a | autoScroll, |
|---|
| 5195 | n/a | delayBeforeAutoScroll, |
|---|
| 5196 | n/a | delayBetweenAutoScroll, |
|---|
| 5197 | n/a | autoScrollAmount, |
|---|
| 5198 | n/a | &outControl); |
|---|
| 5199 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5200 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5201 | n/a | CtlObj_New, outControl); |
|---|
| 5202 | n/a | return _res; |
|---|
| 5203 | n/a | } |
|---|
| 5204 | n/a | |
|---|
| 5205 | n/a | static PyObject *Ctl_CreateDisclosureButtonControl(PyObject *_self, PyObject *_args) |
|---|
| 5206 | n/a | { |
|---|
| 5207 | n/a | PyObject *_res = NULL; |
|---|
| 5208 | n/a | OSStatus _err; |
|---|
| 5209 | n/a | WindowPtr inWindow; |
|---|
| 5210 | n/a | Rect inBoundsRect; |
|---|
| 5211 | n/a | SInt32 inValue; |
|---|
| 5212 | n/a | Boolean inAutoToggles; |
|---|
| 5213 | n/a | ControlHandle outControl; |
|---|
| 5214 | n/a | #ifndef CreateDisclosureButtonControl |
|---|
| 5215 | n/a | PyMac_PRECHECK(CreateDisclosureButtonControl); |
|---|
| 5216 | n/a | #endif |
|---|
| 5217 | n/a | if (!PyArg_ParseTuple(_args, "O&O&lb", |
|---|
| 5218 | n/a | WinObj_Convert, &inWindow, |
|---|
| 5219 | n/a | PyMac_GetRect, &inBoundsRect, |
|---|
| 5220 | n/a | &inValue, |
|---|
| 5221 | n/a | &inAutoToggles)) |
|---|
| 5222 | n/a | return NULL; |
|---|
| 5223 | n/a | _err = CreateDisclosureButtonControl(inWindow, |
|---|
| 5224 | n/a | &inBoundsRect, |
|---|
| 5225 | n/a | inValue, |
|---|
| 5226 | n/a | inAutoToggles, |
|---|
| 5227 | n/a | &outControl); |
|---|
| 5228 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5229 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5230 | n/a | CtlObj_New, outControl); |
|---|
| 5231 | n/a | return _res; |
|---|
| 5232 | n/a | } |
|---|
| 5233 | n/a | |
|---|
| 5234 | n/a | static PyObject *Ctl_CreateRoundButtonControl(PyObject *_self, PyObject *_args) |
|---|
| 5235 | n/a | { |
|---|
| 5236 | n/a | PyObject *_res = NULL; |
|---|
| 5237 | n/a | OSStatus _err; |
|---|
| 5238 | n/a | WindowPtr inWindow; |
|---|
| 5239 | n/a | Rect inBoundsRect; |
|---|
| 5240 | n/a | SInt16 inSize; |
|---|
| 5241 | n/a | ControlButtonContentInfo inContent; |
|---|
| 5242 | n/a | ControlHandle outControl; |
|---|
| 5243 | n/a | #ifndef CreateRoundButtonControl |
|---|
| 5244 | n/a | PyMac_PRECHECK(CreateRoundButtonControl); |
|---|
| 5245 | n/a | #endif |
|---|
| 5246 | n/a | if (!PyArg_ParseTuple(_args, "O&O&hO&", |
|---|
| 5247 | n/a | WinObj_Convert, &inWindow, |
|---|
| 5248 | n/a | PyMac_GetRect, &inBoundsRect, |
|---|
| 5249 | n/a | &inSize, |
|---|
| 5250 | n/a | ControlButtonContentInfo_Convert, &inContent)) |
|---|
| 5251 | n/a | return NULL; |
|---|
| 5252 | n/a | _err = CreateRoundButtonControl(inWindow, |
|---|
| 5253 | n/a | &inBoundsRect, |
|---|
| 5254 | n/a | inSize, |
|---|
| 5255 | n/a | &inContent, |
|---|
| 5256 | n/a | &outControl); |
|---|
| 5257 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5258 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5259 | n/a | CtlObj_New, outControl); |
|---|
| 5260 | n/a | return _res; |
|---|
| 5261 | n/a | } |
|---|
| 5262 | n/a | |
|---|
| 5263 | n/a | static PyObject *Ctl_CreateDataBrowserControl(PyObject *_self, PyObject *_args) |
|---|
| 5264 | n/a | { |
|---|
| 5265 | n/a | PyObject *_res = NULL; |
|---|
| 5266 | n/a | OSStatus _err; |
|---|
| 5267 | n/a | WindowPtr window; |
|---|
| 5268 | n/a | Rect boundsRect; |
|---|
| 5269 | n/a | OSType style; |
|---|
| 5270 | n/a | ControlHandle outControl; |
|---|
| 5271 | n/a | #ifndef CreateDataBrowserControl |
|---|
| 5272 | n/a | PyMac_PRECHECK(CreateDataBrowserControl); |
|---|
| 5273 | n/a | #endif |
|---|
| 5274 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&", |
|---|
| 5275 | n/a | WinObj_Convert, &window, |
|---|
| 5276 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 5277 | n/a | PyMac_GetOSType, &style)) |
|---|
| 5278 | n/a | return NULL; |
|---|
| 5279 | n/a | _err = CreateDataBrowserControl(window, |
|---|
| 5280 | n/a | &boundsRect, |
|---|
| 5281 | n/a | style, |
|---|
| 5282 | n/a | &outControl); |
|---|
| 5283 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5284 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5285 | n/a | CtlObj_New, outControl); |
|---|
| 5286 | n/a | return _res; |
|---|
| 5287 | n/a | } |
|---|
| 5288 | n/a | |
|---|
| 5289 | n/a | static PyObject *Ctl_CreateEditUnicodeTextControl(PyObject *_self, PyObject *_args) |
|---|
| 5290 | n/a | { |
|---|
| 5291 | n/a | PyObject *_res = NULL; |
|---|
| 5292 | n/a | OSStatus _err; |
|---|
| 5293 | n/a | WindowPtr window; |
|---|
| 5294 | n/a | Rect boundsRect; |
|---|
| 5295 | n/a | CFStringRef text; |
|---|
| 5296 | n/a | Boolean isPassword; |
|---|
| 5297 | n/a | ControlFontStyleRec style; |
|---|
| 5298 | n/a | ControlHandle outControl; |
|---|
| 5299 | n/a | #ifndef CreateEditUnicodeTextControl |
|---|
| 5300 | n/a | PyMac_PRECHECK(CreateEditUnicodeTextControl); |
|---|
| 5301 | n/a | #endif |
|---|
| 5302 | n/a | if (!PyArg_ParseTuple(_args, "O&O&O&bO&", |
|---|
| 5303 | n/a | WinObj_Convert, &window, |
|---|
| 5304 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 5305 | n/a | CFStringRefObj_Convert, &text, |
|---|
| 5306 | n/a | &isPassword, |
|---|
| 5307 | n/a | ControlFontStyle_Convert, &style)) |
|---|
| 5308 | n/a | return NULL; |
|---|
| 5309 | n/a | _err = CreateEditUnicodeTextControl(window, |
|---|
| 5310 | n/a | &boundsRect, |
|---|
| 5311 | n/a | text, |
|---|
| 5312 | n/a | isPassword, |
|---|
| 5313 | n/a | &style, |
|---|
| 5314 | n/a | &outControl); |
|---|
| 5315 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5316 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5317 | n/a | CtlObj_New, outControl); |
|---|
| 5318 | n/a | return _res; |
|---|
| 5319 | n/a | } |
|---|
| 5320 | n/a | |
|---|
| 5321 | n/a | static PyObject *Ctl_FindControlUnderMouse(PyObject *_self, PyObject *_args) |
|---|
| 5322 | n/a | { |
|---|
| 5323 | n/a | PyObject *_res = NULL; |
|---|
| 5324 | n/a | ControlHandle _rv; |
|---|
| 5325 | n/a | Point inWhere; |
|---|
| 5326 | n/a | WindowPtr inWindow; |
|---|
| 5327 | n/a | SInt16 outPart; |
|---|
| 5328 | n/a | #ifndef FindControlUnderMouse |
|---|
| 5329 | n/a | PyMac_PRECHECK(FindControlUnderMouse); |
|---|
| 5330 | n/a | #endif |
|---|
| 5331 | n/a | if (!PyArg_ParseTuple(_args, "O&O&", |
|---|
| 5332 | n/a | PyMac_GetPoint, &inWhere, |
|---|
| 5333 | n/a | WinObj_Convert, &inWindow)) |
|---|
| 5334 | n/a | return NULL; |
|---|
| 5335 | n/a | _rv = FindControlUnderMouse(inWhere, |
|---|
| 5336 | n/a | inWindow, |
|---|
| 5337 | n/a | &outPart); |
|---|
| 5338 | n/a | _res = Py_BuildValue("O&h", |
|---|
| 5339 | n/a | CtlObj_WhichControl, _rv, |
|---|
| 5340 | n/a | outPart); |
|---|
| 5341 | n/a | return _res; |
|---|
| 5342 | n/a | } |
|---|
| 5343 | n/a | |
|---|
| 5344 | n/a | static PyObject *Ctl_as_Control(PyObject *_self, PyObject *_args) |
|---|
| 5345 | n/a | { |
|---|
| 5346 | n/a | PyObject *_res = NULL; |
|---|
| 5347 | n/a | ControlHandle _rv; |
|---|
| 5348 | n/a | Handle h; |
|---|
| 5349 | n/a | #ifndef as_Control |
|---|
| 5350 | n/a | PyMac_PRECHECK(as_Control); |
|---|
| 5351 | n/a | #endif |
|---|
| 5352 | n/a | if (!PyArg_ParseTuple(_args, "O&", |
|---|
| 5353 | n/a | ResObj_Convert, &h)) |
|---|
| 5354 | n/a | return NULL; |
|---|
| 5355 | n/a | _rv = as_Control(h); |
|---|
| 5356 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5357 | n/a | CtlObj_New, _rv); |
|---|
| 5358 | n/a | return _res; |
|---|
| 5359 | n/a | } |
|---|
| 5360 | n/a | |
|---|
| 5361 | n/a | static PyObject *Ctl_CreateTabsControl(PyObject *_self, PyObject *_args) |
|---|
| 5362 | n/a | { |
|---|
| 5363 | n/a | PyObject *_res = NULL; |
|---|
| 5364 | n/a | OSStatus _err; |
|---|
| 5365 | n/a | WindowPtr window; |
|---|
| 5366 | n/a | Rect boundsRect; |
|---|
| 5367 | n/a | UInt16 size; |
|---|
| 5368 | n/a | UInt16 direction; |
|---|
| 5369 | n/a | int i; |
|---|
| 5370 | n/a | UInt16 numTabs; |
|---|
| 5371 | n/a | ControlTabEntry tabArray[MAXTABS]; |
|---|
| 5372 | n/a | ControlHandle outControl; |
|---|
| 5373 | n/a | PyObject *tabArrayObj, *tabEntry; |
|---|
| 5374 | n/a | |
|---|
| 5375 | n/a | #ifndef CreateTabsControl |
|---|
| 5376 | n/a | PyMac_PRECHECK(CreateTabsControl); |
|---|
| 5377 | n/a | #endif |
|---|
| 5378 | n/a | if (!PyArg_ParseTuple(_args, "O&O&HHO", |
|---|
| 5379 | n/a | WinObj_Convert, &window, |
|---|
| 5380 | n/a | PyMac_GetRect, &boundsRect, |
|---|
| 5381 | n/a | &size, |
|---|
| 5382 | n/a | &direction, |
|---|
| 5383 | n/a | &tabArrayObj)) |
|---|
| 5384 | n/a | return NULL; |
|---|
| 5385 | n/a | |
|---|
| 5386 | n/a | i = PySequence_Length(tabArrayObj); |
|---|
| 5387 | n/a | if (i == -1) |
|---|
| 5388 | n/a | return NULL; |
|---|
| 5389 | n/a | if (i > MAXTABS) { |
|---|
| 5390 | n/a | PyErr_SetString(Ctl_Error, "Too many tabs"); |
|---|
| 5391 | n/a | return NULL; |
|---|
| 5392 | n/a | } |
|---|
| 5393 | n/a | numTabs = i; |
|---|
| 5394 | n/a | for (i=0; i<numTabs; i++) { |
|---|
| 5395 | n/a | tabEntry = PySequence_GetItem(tabArrayObj, i); |
|---|
| 5396 | n/a | if (tabEntry == NULL) |
|---|
| 5397 | n/a | return NULL; |
|---|
| 5398 | n/a | if (!PyArg_Parse(tabEntry, "(O&O&B)", |
|---|
| 5399 | n/a | ControlButtonContentInfo_Convert, &tabArray[i].icon, |
|---|
| 5400 | n/a | CFStringRefObj_Convert, &tabArray[i].name, |
|---|
| 5401 | n/a | &tabArray[i].enabled |
|---|
| 5402 | n/a | )) |
|---|
| 5403 | n/a | return NULL; |
|---|
| 5404 | n/a | } |
|---|
| 5405 | n/a | |
|---|
| 5406 | n/a | _err = CreateTabsControl(window, |
|---|
| 5407 | n/a | &boundsRect, |
|---|
| 5408 | n/a | size, |
|---|
| 5409 | n/a | direction, |
|---|
| 5410 | n/a | numTabs, |
|---|
| 5411 | n/a | tabArray, |
|---|
| 5412 | n/a | &outControl); |
|---|
| 5413 | n/a | if (_err != noErr) return PyMac_Error(_err); |
|---|
| 5414 | n/a | _res = Py_BuildValue("O&", |
|---|
| 5415 | n/a | CtlObj_New, outControl); |
|---|
| 5416 | n/a | return _res; |
|---|
| 5417 | n/a | } |
|---|
| 5418 | n/a | |
|---|
| 5419 | n/a | static PyMethodDef Ctl_methods[] = { |
|---|
| 5420 | n/a | {"NewControl", (PyCFunction)Ctl_NewControl, 1, |
|---|
| 5421 | n/a | PyDoc_STR("(WindowPtr owningWindow, Rect boundsRect, Str255 controlTitle, Boolean initiallyVisible, SInt16 initialValue, SInt16 minimumValue, SInt16 maximumValue, SInt16 procID, SInt32 controlReference) -> (ControlHandle _rv)")}, |
|---|
| 5422 | n/a | {"GetNewControl", (PyCFunction)Ctl_GetNewControl, 1, |
|---|
| 5423 | n/a | PyDoc_STR("(SInt16 resourceID, WindowPtr owningWindow) -> (ControlHandle _rv)")}, |
|---|
| 5424 | n/a | {"DrawControls", (PyCFunction)Ctl_DrawControls, 1, |
|---|
| 5425 | n/a | PyDoc_STR("(WindowPtr theWindow) -> None")}, |
|---|
| 5426 | n/a | {"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1, |
|---|
| 5427 | n/a | PyDoc_STR("(WindowPtr inWindow, RgnHandle inUpdateRegion) -> None")}, |
|---|
| 5428 | n/a | {"FindControl", (PyCFunction)Ctl_FindControl, 1, |
|---|
| 5429 | n/a | PyDoc_STR("(Point testPoint, WindowPtr theWindow) -> (ControlPartCode _rv, ControlHandle theControl)")}, |
|---|
| 5430 | n/a | {"IdleControls", (PyCFunction)Ctl_IdleControls, 1, |
|---|
| 5431 | n/a | PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|---|
| 5432 | n/a | {"GetControlByID", (PyCFunction)Ctl_GetControlByID, 1, |
|---|
| 5433 | n/a | PyDoc_STR("(WindowPtr inWindow, ControlID inID) -> (ControlHandle outControl)")}, |
|---|
| 5434 | n/a | {"DumpControlHierarchy", (PyCFunction)Ctl_DumpControlHierarchy, 1, |
|---|
| 5435 | n/a | PyDoc_STR("(WindowPtr inWindow, FSSpec inDumpFile) -> None")}, |
|---|
| 5436 | n/a | {"CreateRootControl", (PyCFunction)Ctl_CreateRootControl, 1, |
|---|
| 5437 | n/a | PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, |
|---|
| 5438 | n/a | {"GetRootControl", (PyCFunction)Ctl_GetRootControl, 1, |
|---|
| 5439 | n/a | PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, |
|---|
| 5440 | n/a | {"GetKeyboardFocus", (PyCFunction)Ctl_GetKeyboardFocus, 1, |
|---|
| 5441 | n/a | PyDoc_STR("(WindowPtr inWindow) -> (ControlHandle outControl)")}, |
|---|
| 5442 | n/a | {"SetKeyboardFocus", (PyCFunction)Ctl_SetKeyboardFocus, 1, |
|---|
| 5443 | n/a | PyDoc_STR("(WindowPtr inWindow, ControlHandle inControl, ControlFocusPart inPart) -> None")}, |
|---|
| 5444 | n/a | {"AdvanceKeyboardFocus", (PyCFunction)Ctl_AdvanceKeyboardFocus, 1, |
|---|
| 5445 | n/a | PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|---|
| 5446 | n/a | {"ReverseKeyboardFocus", (PyCFunction)Ctl_ReverseKeyboardFocus, 1, |
|---|
| 5447 | n/a | PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|---|
| 5448 | n/a | {"ClearKeyboardFocus", (PyCFunction)Ctl_ClearKeyboardFocus, 1, |
|---|
| 5449 | n/a | PyDoc_STR("(WindowPtr inWindow) -> None")}, |
|---|
| 5450 | n/a | {"SetAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_SetAutomaticControlDragTrackingEnabledForWindow, 1, |
|---|
| 5451 | n/a | PyDoc_STR("(WindowPtr inWindow, Boolean inTracks) -> None")}, |
|---|
| 5452 | n/a | {"IsAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_IsAutomaticControlDragTrackingEnabledForWindow, 1, |
|---|
| 5453 | n/a | PyDoc_STR("(WindowPtr inWindow) -> (Boolean outTracks)")}, |
|---|
| 5454 | n/a | {"CreateBevelButtonControl", (PyCFunction)Ctl_CreateBevelButtonControl, 1, |
|---|
| 5455 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, UInt16 thickness, UInt16 behavior, ControlButtonContentInfo info, SInt16 menuID, UInt16 menuBehavior, UInt16 menuPlacement) -> (ControlHandle outControl)")}, |
|---|
| 5456 | n/a | {"CreateSliderControl", (PyCFunction)Ctl_CreateSliderControl, 1, |
|---|
| 5457 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, UInt16 orientation, UInt16 numTickMarks, Boolean liveTracking, PyObject* liveTrackingProc) -> (ControlHandle outControl)")}, |
|---|
| 5458 | n/a | {"CreateDisclosureTriangleControl", (PyCFunction)Ctl_CreateDisclosureTriangleControl, 1, |
|---|
| 5459 | n/a | PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, UInt16 inOrientation, CFStringRef inTitle, SInt32 inInitialValue, Boolean inDrawTitle, Boolean inAutoToggles) -> (ControlHandle outControl)")}, |
|---|
| 5460 | n/a | {"CreateProgressBarControl", (PyCFunction)Ctl_CreateProgressBarControl, 1, |
|---|
| 5461 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, Boolean indeterminate) -> (ControlHandle outControl)")}, |
|---|
| 5462 | n/a | {"CreateRelevanceBarControl", (PyCFunction)Ctl_CreateRelevanceBarControl, 1, |
|---|
| 5463 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum) -> (ControlHandle outControl)")}, |
|---|
| 5464 | n/a | {"CreateLittleArrowsControl", (PyCFunction)Ctl_CreateLittleArrowsControl, 1, |
|---|
| 5465 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 increment) -> (ControlHandle outControl)")}, |
|---|
| 5466 | n/a | {"CreateChasingArrowsControl", (PyCFunction)Ctl_CreateChasingArrowsControl, 1, |
|---|
| 5467 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")}, |
|---|
| 5468 | n/a | {"CreateSeparatorControl", (PyCFunction)Ctl_CreateSeparatorControl, 1, |
|---|
| 5469 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")}, |
|---|
| 5470 | n/a | {"CreateGroupBoxControl", (PyCFunction)Ctl_CreateGroupBoxControl, 1, |
|---|
| 5471 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, Boolean primary) -> (ControlHandle outControl)")}, |
|---|
| 5472 | n/a | {"CreateCheckGroupBoxControl", (PyCFunction)Ctl_CreateCheckGroupBoxControl, 1, |
|---|
| 5473 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean primary, Boolean autoToggle) -> (ControlHandle outControl)")}, |
|---|
| 5474 | n/a | {"CreatePopupGroupBoxControl", (PyCFunction)Ctl_CreatePopupGroupBoxControl, 1, |
|---|
| 5475 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, Boolean primary, SInt16 menuID, Boolean variableWidth, SInt16 titleWidth, SInt16 titleJustification, Style titleStyle) -> (ControlHandle outControl)")}, |
|---|
| 5476 | n/a | {"CreateImageWellControl", (PyCFunction)Ctl_CreateImageWellControl, 1, |
|---|
| 5477 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, ControlButtonContentInfo info) -> (ControlHandle outControl)")}, |
|---|
| 5478 | n/a | {"CreatePopupArrowControl", (PyCFunction)Ctl_CreatePopupArrowControl, 1, |
|---|
| 5479 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 orientation, UInt16 size) -> (ControlHandle outControl)")}, |
|---|
| 5480 | n/a | {"CreatePlacardControl", (PyCFunction)Ctl_CreatePlacardControl, 1, |
|---|
| 5481 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")}, |
|---|
| 5482 | n/a | {"CreateClockControl", (PyCFunction)Ctl_CreateClockControl, 1, |
|---|
| 5483 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 clockType, UInt32 clockFlags) -> (ControlHandle outControl)")}, |
|---|
| 5484 | n/a | {"CreateUserPaneControl", (PyCFunction)Ctl_CreateUserPaneControl, 1, |
|---|
| 5485 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt32 features) -> (ControlHandle outControl)")}, |
|---|
| 5486 | n/a | {"CreateEditTextControl", (PyCFunction)Ctl_CreateEditTextControl, 1, |
|---|
| 5487 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, Boolean useInlineInput, ControlFontStyleRec style) -> (ControlHandle outControl)")}, |
|---|
| 5488 | n/a | {"CreateStaticTextControl", (PyCFunction)Ctl_CreateStaticTextControl, 1, |
|---|
| 5489 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, ControlFontStyleRec style) -> (ControlHandle outControl)")}, |
|---|
| 5490 | n/a | {"CreatePictureControl", (PyCFunction)Ctl_CreatePictureControl, 1, |
|---|
| 5491 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, ControlButtonContentInfo content, Boolean dontTrack) -> (ControlHandle outControl)")}, |
|---|
| 5492 | n/a | {"CreateIconControl", (PyCFunction)Ctl_CreateIconControl, 1, |
|---|
| 5493 | n/a | PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, ControlButtonContentInfo inIconContent, Boolean inDontTrack) -> (ControlHandle outControl)")}, |
|---|
| 5494 | n/a | {"CreateWindowHeaderControl", (PyCFunction)Ctl_CreateWindowHeaderControl, 1, |
|---|
| 5495 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, Boolean isListHeader) -> (ControlHandle outControl)")}, |
|---|
| 5496 | n/a | {"CreatePushButtonControl", (PyCFunction)Ctl_CreatePushButtonControl, 1, |
|---|
| 5497 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title) -> (ControlHandle outControl)")}, |
|---|
| 5498 | n/a | {"CreatePushButtonWithIconControl", (PyCFunction)Ctl_CreatePushButtonWithIconControl, 1, |
|---|
| 5499 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, ControlButtonContentInfo icon, UInt16 iconAlignment) -> (ControlHandle outControl)")}, |
|---|
| 5500 | n/a | {"CreateRadioButtonControl", (PyCFunction)Ctl_CreateRadioButtonControl, 1, |
|---|
| 5501 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean autoToggle) -> (ControlHandle outControl)")}, |
|---|
| 5502 | n/a | {"CreateCheckBoxControl", (PyCFunction)Ctl_CreateCheckBoxControl, 1, |
|---|
| 5503 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt32 initialValue, Boolean autoToggle) -> (ControlHandle outControl)")}, |
|---|
| 5504 | n/a | {"CreateScrollBarControl", (PyCFunction)Ctl_CreateScrollBarControl, 1, |
|---|
| 5505 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, SInt32 viewSize, Boolean liveTracking, PyObject* liveTrackingProc) -> (ControlHandle outControl)")}, |
|---|
| 5506 | n/a | {"CreatePopupButtonControl", (PyCFunction)Ctl_CreatePopupButtonControl, 1, |
|---|
| 5507 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, SInt16 menuID, Boolean variableWidth, SInt16 titleWidth, SInt16 titleJustification, Style titleStyle) -> (ControlHandle outControl)")}, |
|---|
| 5508 | n/a | {"CreateRadioGroupControl", (PyCFunction)Ctl_CreateRadioGroupControl, 1, |
|---|
| 5509 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect) -> (ControlHandle outControl)")}, |
|---|
| 5510 | n/a | {"CreateScrollingTextBoxControl", (PyCFunction)Ctl_CreateScrollingTextBoxControl, 1, |
|---|
| 5511 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt16 contentResID, Boolean autoScroll, UInt32 delayBeforeAutoScroll, UInt32 delayBetweenAutoScroll, UInt16 autoScrollAmount) -> (ControlHandle outControl)")}, |
|---|
| 5512 | n/a | {"CreateDisclosureButtonControl", (PyCFunction)Ctl_CreateDisclosureButtonControl, 1, |
|---|
| 5513 | n/a | PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, SInt32 inValue, Boolean inAutoToggles) -> (ControlHandle outControl)")}, |
|---|
| 5514 | n/a | {"CreateRoundButtonControl", (PyCFunction)Ctl_CreateRoundButtonControl, 1, |
|---|
| 5515 | n/a | PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, SInt16 inSize, ControlButtonContentInfo inContent) -> (ControlHandle outControl)")}, |
|---|
| 5516 | n/a | {"CreateDataBrowserControl", (PyCFunction)Ctl_CreateDataBrowserControl, 1, |
|---|
| 5517 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, OSType style) -> (ControlHandle outControl)")}, |
|---|
| 5518 | n/a | {"CreateEditUnicodeTextControl", (PyCFunction)Ctl_CreateEditUnicodeTextControl, 1, |
|---|
| 5519 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef text, Boolean isPassword, ControlFontStyleRec style) -> (ControlHandle outControl)")}, |
|---|
| 5520 | n/a | {"FindControlUnderMouse", (PyCFunction)Ctl_FindControlUnderMouse, 1, |
|---|
| 5521 | n/a | PyDoc_STR("(Point inWhere, WindowPtr inWindow) -> (ControlHandle _rv, SInt16 outPart)")}, |
|---|
| 5522 | n/a | {"as_Control", (PyCFunction)Ctl_as_Control, 1, |
|---|
| 5523 | n/a | PyDoc_STR("(Handle h) -> (ControlHandle _rv)")}, |
|---|
| 5524 | n/a | {"CreateTabsControl", (PyCFunction)Ctl_CreateTabsControl, 1, |
|---|
| 5525 | n/a | PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 size, UInt16 direction, ControlTabEntry tabArray) -> (ControlHandle outControl)")}, |
|---|
| 5526 | n/a | {NULL, NULL, 0} |
|---|
| 5527 | n/a | }; |
|---|
| 5528 | n/a | |
|---|
| 5529 | n/a | |
|---|
| 5530 | n/a | |
|---|
| 5531 | n/a | static PyObject * |
|---|
| 5532 | n/a | CtlObj_NewUnmanaged(ControlHandle itself) |
|---|
| 5533 | n/a | { |
|---|
| 5534 | n/a | ControlObject *it; |
|---|
| 5535 | n/a | if (itself == NULL) return PyMac_Error(resNotFound); |
|---|
| 5536 | n/a | it = PyObject_NEW(ControlObject, &Control_Type); |
|---|
| 5537 | n/a | if (it == NULL) return NULL; |
|---|
| 5538 | n/a | it->ob_itself = itself; |
|---|
| 5539 | n/a | it->ob_callbackdict = NULL; |
|---|
| 5540 | n/a | return (PyObject *)it; |
|---|
| 5541 | n/a | } |
|---|
| 5542 | n/a | |
|---|
| 5543 | n/a | static PyObject * |
|---|
| 5544 | n/a | CtlObj_WhichControl(ControlHandle c) |
|---|
| 5545 | n/a | { |
|---|
| 5546 | n/a | PyObject *it; |
|---|
| 5547 | n/a | |
|---|
| 5548 | n/a | if (c == NULL) |
|---|
| 5549 | n/a | it = Py_None; |
|---|
| 5550 | n/a | else { |
|---|
| 5551 | n/a | it = (PyObject *) GetControlReference(c); |
|---|
| 5552 | n/a | /* |
|---|
| 5553 | n/a | ** If the refcon is zero or doesn't point back to the Python object |
|---|
| 5554 | n/a | ** the control is not ours. Return a temporary object. |
|---|
| 5555 | n/a | */ |
|---|
| 5556 | n/a | if (it == NULL || ((ControlObject *)it)->ob_itself != c) |
|---|
| 5557 | n/a | return CtlObj_NewUnmanaged(c); |
|---|
| 5558 | n/a | } |
|---|
| 5559 | n/a | Py_INCREF(it); |
|---|
| 5560 | n/a | return it; |
|---|
| 5561 | n/a | } |
|---|
| 5562 | n/a | |
|---|
| 5563 | n/a | static int |
|---|
| 5564 | n/a | settrackfunc(PyObject *obj) |
|---|
| 5565 | n/a | { |
|---|
| 5566 | n/a | if (tracker) { |
|---|
| 5567 | n/a | PyErr_SetString(Ctl_Error, "Tracker function in use"); |
|---|
| 5568 | n/a | return 0; |
|---|
| 5569 | n/a | } |
|---|
| 5570 | n/a | tracker = obj; |
|---|
| 5571 | n/a | Py_INCREF(tracker); |
|---|
| 5572 | n/a | return 1; |
|---|
| 5573 | n/a | } |
|---|
| 5574 | n/a | |
|---|
| 5575 | n/a | static void |
|---|
| 5576 | n/a | clrtrackfunc(void) |
|---|
| 5577 | n/a | { |
|---|
| 5578 | n/a | Py_XDECREF(tracker); |
|---|
| 5579 | n/a | tracker = 0; |
|---|
| 5580 | n/a | } |
|---|
| 5581 | n/a | |
|---|
| 5582 | n/a | static pascal void |
|---|
| 5583 | n/a | mytracker(ControlHandle ctl, short part) |
|---|
| 5584 | n/a | { |
|---|
| 5585 | n/a | PyObject *args, *rv=0; |
|---|
| 5586 | n/a | |
|---|
| 5587 | n/a | args = Py_BuildValue("(O&i)", CtlObj_WhichControl, ctl, (int)part); |
|---|
| 5588 | n/a | if (args && tracker) { |
|---|
| 5589 | n/a | rv = PyEval_CallObject(tracker, args); |
|---|
| 5590 | n/a | Py_DECREF(args); |
|---|
| 5591 | n/a | } |
|---|
| 5592 | n/a | if (rv) |
|---|
| 5593 | n/a | Py_DECREF(rv); |
|---|
| 5594 | n/a | else { |
|---|
| 5595 | n/a | PySys_WriteStderr("TrackControl or HandleControlClick: exception in tracker function\n"); |
|---|
| 5596 | n/a | PyErr_Print(); |
|---|
| 5597 | n/a | } |
|---|
| 5598 | n/a | } |
|---|
| 5599 | n/a | |
|---|
| 5600 | n/a | static int |
|---|
| 5601 | n/a | setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr *uppp) |
|---|
| 5602 | n/a | { |
|---|
| 5603 | n/a | ControlObject *self = (ControlObject *)myself; |
|---|
| 5604 | n/a | char keybuf[9]; |
|---|
| 5605 | n/a | |
|---|
| 5606 | n/a | if ( which == kMyControlActionProcTag ) |
|---|
| 5607 | n/a | *uppp = (UniversalProcPtr)myactionproc_upp; |
|---|
| 5608 | n/a | else if ( which == kControlUserPaneKeyDownProcTag ) |
|---|
| 5609 | n/a | *uppp = (UniversalProcPtr)mykeydownproc_upp; |
|---|
| 5610 | n/a | else if ( which == kControlUserPaneFocusProcTag ) |
|---|
| 5611 | n/a | *uppp = (UniversalProcPtr)myfocusproc_upp; |
|---|
| 5612 | n/a | else if ( which == kControlUserPaneDrawProcTag ) |
|---|
| 5613 | n/a | *uppp = (UniversalProcPtr)mydrawproc_upp; |
|---|
| 5614 | n/a | else if ( which == kControlUserPaneIdleProcTag ) |
|---|
| 5615 | n/a | *uppp = (UniversalProcPtr)myidleproc_upp; |
|---|
| 5616 | n/a | else if ( which == kControlUserPaneHitTestProcTag ) |
|---|
| 5617 | n/a | *uppp = (UniversalProcPtr)myhittestproc_upp; |
|---|
| 5618 | n/a | else if ( which == kControlUserPaneTrackingProcTag ) |
|---|
| 5619 | n/a | *uppp = (UniversalProcPtr)mytrackingproc_upp; |
|---|
| 5620 | n/a | else |
|---|
| 5621 | n/a | return -1; |
|---|
| 5622 | n/a | /* Only now do we test for clearing of the callback: */ |
|---|
| 5623 | n/a | if ( callback == Py_None ) |
|---|
| 5624 | n/a | *uppp = NULL; |
|---|
| 5625 | n/a | /* Create the dict if it doesn't exist yet (so we don't get such a dict for every control) */ |
|---|
| 5626 | n/a | if ( self->ob_callbackdict == NULL ) |
|---|
| 5627 | n/a | if ( (self->ob_callbackdict = PyDict_New()) == NULL ) |
|---|
| 5628 | n/a | return -1; |
|---|
| 5629 | n/a | /* And store the Python callback */ |
|---|
| 5630 | n/a | sprintf(keybuf, "%x", (unsigned)which); |
|---|
| 5631 | n/a | if (PyDict_SetItemString(self->ob_callbackdict, keybuf, callback) < 0) |
|---|
| 5632 | n/a | return -1; |
|---|
| 5633 | n/a | return 0; |
|---|
| 5634 | n/a | } |
|---|
| 5635 | n/a | |
|---|
| 5636 | n/a | static PyObject * |
|---|
| 5637 | n/a | callcallback(ControlObject *self, OSType which, PyObject *arglist) |
|---|
| 5638 | n/a | { |
|---|
| 5639 | n/a | char keybuf[9]; |
|---|
| 5640 | n/a | PyObject *func, *rv; |
|---|
| 5641 | n/a | |
|---|
| 5642 | n/a | sprintf(keybuf, "%x", (unsigned)which); |
|---|
| 5643 | n/a | if ( self->ob_callbackdict == NULL || |
|---|
| 5644 | n/a | (func = PyDict_GetItemString(self->ob_callbackdict, keybuf)) == NULL ) { |
|---|
| 5645 | n/a | PySys_WriteStderr("Control callback %x without callback object\n", (unsigned)which); |
|---|
| 5646 | n/a | return NULL; |
|---|
| 5647 | n/a | } |
|---|
| 5648 | n/a | rv = PyEval_CallObject(func, arglist); |
|---|
| 5649 | n/a | if ( rv == NULL ) { |
|---|
| 5650 | n/a | PySys_WriteStderr("Exception in control callback %x handler\n", (unsigned)which); |
|---|
| 5651 | n/a | PyErr_Print(); |
|---|
| 5652 | n/a | } |
|---|
| 5653 | n/a | return rv; |
|---|
| 5654 | n/a | } |
|---|
| 5655 | n/a | |
|---|
| 5656 | n/a | static pascal void |
|---|
| 5657 | n/a | myactionproc(ControlHandle control, SInt16 part) |
|---|
| 5658 | n/a | { |
|---|
| 5659 | n/a | ControlObject *ctl_obj; |
|---|
| 5660 | n/a | PyObject *arglist, *rv; |
|---|
| 5661 | n/a | |
|---|
| 5662 | n/a | ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|---|
| 5663 | n/a | arglist = Py_BuildValue("Oh", ctl_obj, part); |
|---|
| 5664 | n/a | rv = callcallback(ctl_obj, kMyControlActionProcTag, arglist); |
|---|
| 5665 | n/a | Py_XDECREF(arglist); |
|---|
| 5666 | n/a | Py_XDECREF(rv); |
|---|
| 5667 | n/a | } |
|---|
| 5668 | n/a | |
|---|
| 5669 | n/a | static pascal ControlPartCode |
|---|
| 5670 | n/a | mykeydownproc(ControlHandle control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers) |
|---|
| 5671 | n/a | { |
|---|
| 5672 | n/a | ControlObject *ctl_obj; |
|---|
| 5673 | n/a | PyObject *arglist, *rv; |
|---|
| 5674 | n/a | short c_rv = 0; |
|---|
| 5675 | n/a | |
|---|
| 5676 | n/a | ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|---|
| 5677 | n/a | arglist = Py_BuildValue("Ohhh", ctl_obj, keyCode, charCode, modifiers); |
|---|
| 5678 | n/a | rv = callcallback(ctl_obj, kControlUserPaneKeyDownProcTag, arglist); |
|---|
| 5679 | n/a | Py_XDECREF(arglist); |
|---|
| 5680 | n/a | if ( rv ) |
|---|
| 5681 | n/a | if (!PyArg_Parse(rv, "h", &c_rv)) |
|---|
| 5682 | n/a | PyErr_Clear(); |
|---|
| 5683 | n/a | Py_XDECREF(rv); |
|---|
| 5684 | n/a | return (ControlPartCode)c_rv; |
|---|
| 5685 | n/a | } |
|---|
| 5686 | n/a | |
|---|
| 5687 | n/a | static pascal ControlPartCode |
|---|
| 5688 | n/a | myfocusproc(ControlHandle control, ControlPartCode part) |
|---|
| 5689 | n/a | { |
|---|
| 5690 | n/a | ControlObject *ctl_obj; |
|---|
| 5691 | n/a | PyObject *arglist, *rv; |
|---|
| 5692 | n/a | short c_rv = kControlFocusNoPart; |
|---|
| 5693 | n/a | |
|---|
| 5694 | n/a | ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|---|
| 5695 | n/a | arglist = Py_BuildValue("Oh", ctl_obj, part); |
|---|
| 5696 | n/a | rv = callcallback(ctl_obj, kControlUserPaneFocusProcTag, arglist); |
|---|
| 5697 | n/a | Py_XDECREF(arglist); |
|---|
| 5698 | n/a | if ( rv ) |
|---|
| 5699 | n/a | if (!PyArg_Parse(rv, "h", &c_rv)) |
|---|
| 5700 | n/a | PyErr_Clear(); |
|---|
| 5701 | n/a | Py_XDECREF(rv); |
|---|
| 5702 | n/a | return (ControlPartCode)c_rv; |
|---|
| 5703 | n/a | } |
|---|
| 5704 | n/a | |
|---|
| 5705 | n/a | static pascal void |
|---|
| 5706 | n/a | mydrawproc(ControlHandle control, SInt16 part) |
|---|
| 5707 | n/a | { |
|---|
| 5708 | n/a | ControlObject *ctl_obj; |
|---|
| 5709 | n/a | PyObject *arglist, *rv; |
|---|
| 5710 | n/a | |
|---|
| 5711 | n/a | ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|---|
| 5712 | n/a | arglist = Py_BuildValue("Oh", ctl_obj, part); |
|---|
| 5713 | n/a | rv = callcallback(ctl_obj, kControlUserPaneDrawProcTag, arglist); |
|---|
| 5714 | n/a | Py_XDECREF(arglist); |
|---|
| 5715 | n/a | Py_XDECREF(rv); |
|---|
| 5716 | n/a | } |
|---|
| 5717 | n/a | |
|---|
| 5718 | n/a | static pascal void |
|---|
| 5719 | n/a | myidleproc(ControlHandle control) |
|---|
| 5720 | n/a | { |
|---|
| 5721 | n/a | ControlObject *ctl_obj; |
|---|
| 5722 | n/a | PyObject *arglist, *rv; |
|---|
| 5723 | n/a | |
|---|
| 5724 | n/a | ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|---|
| 5725 | n/a | arglist = Py_BuildValue("O", ctl_obj); |
|---|
| 5726 | n/a | rv = callcallback(ctl_obj, kControlUserPaneIdleProcTag, arglist); |
|---|
| 5727 | n/a | Py_XDECREF(arglist); |
|---|
| 5728 | n/a | Py_XDECREF(rv); |
|---|
| 5729 | n/a | } |
|---|
| 5730 | n/a | |
|---|
| 5731 | n/a | static pascal ControlPartCode |
|---|
| 5732 | n/a | myhittestproc(ControlHandle control, Point where) |
|---|
| 5733 | n/a | { |
|---|
| 5734 | n/a | ControlObject *ctl_obj; |
|---|
| 5735 | n/a | PyObject *arglist, *rv; |
|---|
| 5736 | n/a | short c_rv = -1; |
|---|
| 5737 | n/a | |
|---|
| 5738 | n/a | ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|---|
| 5739 | n/a | arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, where); |
|---|
| 5740 | n/a | rv = callcallback(ctl_obj, kControlUserPaneHitTestProcTag, arglist); |
|---|
| 5741 | n/a | Py_XDECREF(arglist); |
|---|
| 5742 | n/a | /* Ignore errors, nothing we can do about them */ |
|---|
| 5743 | n/a | if ( rv ) |
|---|
| 5744 | n/a | if (!PyArg_Parse(rv, "h", &c_rv)) |
|---|
| 5745 | n/a | PyErr_Clear(); |
|---|
| 5746 | n/a | Py_XDECREF(rv); |
|---|
| 5747 | n/a | return (ControlPartCode)c_rv; |
|---|
| 5748 | n/a | } |
|---|
| 5749 | n/a | |
|---|
| 5750 | n/a | static pascal ControlPartCode |
|---|
| 5751 | n/a | mytrackingproc(ControlHandle control, Point startPt, ControlActionUPP actionProc) |
|---|
| 5752 | n/a | { |
|---|
| 5753 | n/a | ControlObject *ctl_obj; |
|---|
| 5754 | n/a | PyObject *arglist, *rv; |
|---|
| 5755 | n/a | short c_rv = -1; |
|---|
| 5756 | n/a | |
|---|
| 5757 | n/a | ctl_obj = (ControlObject *)CtlObj_WhichControl(control); |
|---|
| 5758 | n/a | /* We cannot pass the actionProc without lots of work */ |
|---|
| 5759 | n/a | arglist = Py_BuildValue("OO&", ctl_obj, PyMac_BuildPoint, startPt); |
|---|
| 5760 | n/a | rv = callcallback(ctl_obj, kControlUserPaneTrackingProcTag, arglist); |
|---|
| 5761 | n/a | Py_XDECREF(arglist); |
|---|
| 5762 | n/a | if ( rv ) |
|---|
| 5763 | n/a | if (!PyArg_Parse(rv, "h", &c_rv)) |
|---|
| 5764 | n/a | PyErr_Clear(); |
|---|
| 5765 | n/a | Py_XDECREF(rv); |
|---|
| 5766 | n/a | return (ControlPartCode)c_rv; |
|---|
| 5767 | n/a | } |
|---|
| 5768 | n/a | |
|---|
| 5769 | n/a | #else /* __LP64__ */ |
|---|
| 5770 | n/a | |
|---|
| 5771 | n/a | static PyMethodDef Ctl_methods[] = { |
|---|
| 5772 | n/a | {NULL, NULL, 0} |
|---|
| 5773 | n/a | }; |
|---|
| 5774 | n/a | |
|---|
| 5775 | n/a | #endif /* __LP64__ */ |
|---|
| 5776 | n/a | |
|---|
| 5777 | n/a | void init_Ctl(void) |
|---|
| 5778 | n/a | { |
|---|
| 5779 | n/a | PyObject *m; |
|---|
| 5780 | n/a | |
|---|
| 5781 | n/a | #ifndef __LP64__ |
|---|
| 5782 | n/a | PyObject *d; |
|---|
| 5783 | n/a | |
|---|
| 5784 | n/a | mytracker_upp = NewControlActionUPP(mytracker); |
|---|
| 5785 | n/a | myactionproc_upp = NewControlActionUPP(myactionproc); |
|---|
| 5786 | n/a | mykeydownproc_upp = NewControlUserPaneKeyDownUPP(mykeydownproc); |
|---|
| 5787 | n/a | myfocusproc_upp = NewControlUserPaneFocusUPP(myfocusproc); |
|---|
| 5788 | n/a | mydrawproc_upp = NewControlUserPaneDrawUPP(mydrawproc); |
|---|
| 5789 | n/a | myidleproc_upp = NewControlUserPaneIdleUPP(myidleproc); |
|---|
| 5790 | n/a | myhittestproc_upp = NewControlUserPaneHitTestUPP(myhittestproc); |
|---|
| 5791 | n/a | mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc); |
|---|
| 5792 | n/a | PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New); |
|---|
| 5793 | n/a | PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert); |
|---|
| 5794 | n/a | #endif /* !__LP64__ */ |
|---|
| 5795 | n/a | |
|---|
| 5796 | n/a | m = Py_InitModule("_Ctl", Ctl_methods); |
|---|
| 5797 | n/a | |
|---|
| 5798 | n/a | #ifndef __LP64__ |
|---|
| 5799 | n/a | d = PyModule_GetDict(m); |
|---|
| 5800 | n/a | Ctl_Error = PyMac_GetOSErrException(); |
|---|
| 5801 | n/a | if (Ctl_Error == NULL || |
|---|
| 5802 | n/a | PyDict_SetItemString(d, "Error", Ctl_Error) != 0) |
|---|
| 5803 | n/a | return; |
|---|
| 5804 | n/a | Control_Type.ob_type = &PyType_Type; |
|---|
| 5805 | n/a | if (PyType_Ready(&Control_Type) < 0) return; |
|---|
| 5806 | n/a | Py_INCREF(&Control_Type); |
|---|
| 5807 | n/a | PyModule_AddObject(m, "Control", (PyObject *)&Control_Type); |
|---|
| 5808 | n/a | /* Backward-compatible name */ |
|---|
| 5809 | n/a | Py_INCREF(&Control_Type); |
|---|
| 5810 | n/a | PyModule_AddObject(m, "ControlType", (PyObject *)&Control_Type); |
|---|
| 5811 | n/a | #endif /* !__LP64__ */ |
|---|
| 5812 | n/a | } |
|---|
| 5813 | n/a | |
|---|
| 5814 | n/a | /* ======================== End module _Ctl ========================= */ |
|---|
| 5815 | n/a | |
|---|