|
29 | 29 |
|
30 | 30 | static PyObject *App_Error; |
31 | 31 |
|
| 32 | +/* ----------------- Object type ThemeDrawingState ------------------ */ |
| 33 | + |
| 34 | +PyTypeObject ThemeDrawingState_Type; |
| 35 | + |
| 36 | +#define ThemeDrawingState_Check(x) ((x)->ob_type == &ThemeDrawingState_Type) |
| 37 | + |
| 38 | +typedef struct ThemeDrawingStateObject { |
| 39 | + PyObject_HEAD |
| 40 | + ThemeDrawingState ob_itself; |
| 41 | +} ThemeDrawingStateObject; |
| 42 | + |
| 43 | +PyObject *ThemeDrawingState_New(ThemeDrawingState itself) |
| 44 | +{ |
| 45 | + ThemeDrawingStateObject *it; |
| 46 | + it = PyObject_NEW(ThemeDrawingStateObject, &ThemeDrawingState_Type); |
| 47 | + if (it == NULL) return NULL; |
| 48 | + it->ob_itself = itself; |
| 49 | + return (PyObject *)it; |
| 50 | +} |
| 51 | +int ThemeDrawingState_Convert(PyObject *v, ThemeDrawingState *p_itself) |
| 52 | +{ |
| 53 | + if (!ThemeDrawingState_Check(v)) |
| 54 | + { |
| 55 | + PyErr_SetString(PyExc_TypeError, "ThemeDrawingState required"); |
| 56 | + return 0; |
| 57 | + } |
| 58 | + *p_itself = ((ThemeDrawingStateObject *)v)->ob_itself; |
| 59 | + return 1; |
| 60 | +} |
| 61 | + |
| 62 | +static void ThemeDrawingState_dealloc(ThemeDrawingStateObject *self) |
| 63 | +{ |
| 64 | + /* Cleanup of self->ob_itself goes here */ |
| 65 | + PyMem_DEL(self); |
| 66 | +} |
| 67 | + |
| 68 | +static PyObject *ThemeDrawingState_SetThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args) |
| 69 | +{ |
| 70 | + PyObject *_res = NULL; |
| 71 | + OSStatus _rv; |
| 72 | + Boolean inDisposeNow; |
| 73 | + if (!PyArg_ParseTuple(_args, "b", |
| 74 | + &inDisposeNow)) |
| 75 | + return NULL; |
| 76 | + _rv = SetThemeDrawingState(_self->ob_itself, |
| 77 | + inDisposeNow); |
| 78 | + _res = Py_BuildValue("l", |
| 79 | + _rv); |
| 80 | + return _res; |
| 81 | +} |
| 82 | + |
| 83 | +static PyObject *ThemeDrawingState_DisposeThemeDrawingState(ThemeDrawingStateObject *_self, PyObject *_args) |
| 84 | +{ |
| 85 | + PyObject *_res = NULL; |
| 86 | + OSStatus _rv; |
| 87 | + if (!PyArg_ParseTuple(_args, "")) |
| 88 | + return NULL; |
| 89 | + _rv = DisposeThemeDrawingState(_self->ob_itself); |
| 90 | + _res = Py_BuildValue("l", |
| 91 | + _rv); |
| 92 | + return _res; |
| 93 | +} |
| 94 | + |
| 95 | +static PyMethodDef ThemeDrawingState_methods[] = { |
| 96 | + {"SetThemeDrawingState", (PyCFunction)ThemeDrawingState_SetThemeDrawingState, 1, |
| 97 | + "(Boolean inDisposeNow) -> (OSStatus _rv)"}, |
| 98 | + {"DisposeThemeDrawingState", (PyCFunction)ThemeDrawingState_DisposeThemeDrawingState, 1, |
| 99 | + "() -> (OSStatus _rv)"}, |
| 100 | + {NULL, NULL, 0} |
| 101 | +}; |
| 102 | + |
| 103 | +PyMethodChain ThemeDrawingState_chain = { ThemeDrawingState_methods, NULL }; |
| 104 | + |
| 105 | +static PyObject *ThemeDrawingState_getattr(ThemeDrawingStateObject *self, char *name) |
| 106 | +{ |
| 107 | + return Py_FindMethodInChain(&ThemeDrawingState_chain, (PyObject *)self, name); |
| 108 | +} |
| 109 | + |
| 110 | +#define ThemeDrawingState_setattr NULL |
| 111 | + |
| 112 | +#define ThemeDrawingState_compare NULL |
| 113 | + |
| 114 | +#define ThemeDrawingState_repr NULL |
| 115 | + |
| 116 | +#define ThemeDrawingState_hash NULL |
| 117 | + |
| 118 | +PyTypeObject ThemeDrawingState_Type = { |
| 119 | + PyObject_HEAD_INIT(NULL) |
| 120 | + 0, /*ob_size*/ |
| 121 | + "_App.ThemeDrawingState", /*tp_name*/ |
| 122 | + sizeof(ThemeDrawingStateObject), /*tp_basicsize*/ |
| 123 | + 0, /*tp_itemsize*/ |
| 124 | + /* methods */ |
| 125 | + (destructor) ThemeDrawingState_dealloc, /*tp_dealloc*/ |
| 126 | + 0, /*tp_print*/ |
| 127 | + (getattrfunc) ThemeDrawingState_getattr, /*tp_getattr*/ |
| 128 | + (setattrfunc) ThemeDrawingState_setattr, /*tp_setattr*/ |
| 129 | + (cmpfunc) ThemeDrawingState_compare, /*tp_compare*/ |
| 130 | + (reprfunc) ThemeDrawingState_repr, /*tp_repr*/ |
| 131 | + (PyNumberMethods *)0, /* tp_as_number */ |
| 132 | + (PySequenceMethods *)0, /* tp_as_sequence */ |
| 133 | + (PyMappingMethods *)0, /* tp_as_mapping */ |
| 134 | + (hashfunc) ThemeDrawingState_hash, /*tp_hash*/ |
| 135 | +}; |
| 136 | + |
| 137 | +/* --------------- End object type ThemeDrawingState ---------------- */ |
| 138 | + |
| 139 | + |
32 | 140 | static PyObject *App_RegisterAppearanceClient(PyObject *_self, PyObject *_args) |
33 | 141 | { |
34 | 142 | PyObject *_res = NULL; |
@@ -1033,6 +1141,20 @@ static PyObject *App_NormalizeThemeDrawingState(PyObject *_self, PyObject *_args |
1033 | 1141 | return _res; |
1034 | 1142 | } |
1035 | 1143 |
|
| 1144 | +static PyObject *App_GetThemeDrawingState(PyObject *_self, PyObject *_args) |
| 1145 | +{ |
| 1146 | + PyObject *_res = NULL; |
| 1147 | + OSStatus _err; |
| 1148 | + ThemeDrawingState outState; |
| 1149 | + if (!PyArg_ParseTuple(_args, "")) |
| 1150 | + return NULL; |
| 1151 | + _err = GetThemeDrawingState(&outState); |
| 1152 | + if (_err != noErr) return PyMac_Error(_err); |
| 1153 | + _res = Py_BuildValue("O&", |
| 1154 | + ThemeDrawingState_New, outState); |
| 1155 | + return _res; |
| 1156 | +} |
| 1157 | + |
1036 | 1158 | static PyObject *App_ApplyThemeBackground(PyObject *_self, PyObject *_args) |
1037 | 1159 | { |
1038 | 1160 | PyObject *_res = NULL; |
@@ -1281,6 +1403,8 @@ static PyMethodDef App_methods[] = { |
1281 | 1403 | "(Point origin, ThemeGrowDirection growDirection, Boolean isSmall) -> (Rect bounds)"}, |
1282 | 1404 | {"NormalizeThemeDrawingState", (PyCFunction)App_NormalizeThemeDrawingState, 1, |
1283 | 1405 | "() -> None"}, |
| 1406 | + {"GetThemeDrawingState", (PyCFunction)App_GetThemeDrawingState, 1, |
| 1407 | + "() -> (ThemeDrawingState outState)"}, |
1284 | 1408 | {"ApplyThemeBackground", (PyCFunction)App_ApplyThemeBackground, 1, |
1285 | 1409 | "(ThemeBackgroundKind inKind, Rect bounds, ThemeDrawState inState, SInt16 inDepth, Boolean inColorDev) -> None"}, |
1286 | 1410 | {"SetThemeTextColorForWindow", (PyCFunction)App_SetThemeTextColorForWindow, 1, |
@@ -1316,6 +1440,10 @@ void init_App(void) |
1316 | 1440 | if (App_Error == NULL || |
1317 | 1441 | PyDict_SetItemString(d, "Error", App_Error) != 0) |
1318 | 1442 | return; |
| 1443 | + ThemeDrawingState_Type.ob_type = &PyType_Type; |
| 1444 | + Py_INCREF(&ThemeDrawingState_Type); |
| 1445 | + if (PyDict_SetItemString(d, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type) != 0) |
| 1446 | + Py_FatalError("can't initialize ThemeDrawingStateType"); |
1319 | 1447 | } |
1320 | 1448 |
|
1321 | 1449 | /* ======================== End module _App ========================= */ |
|
0 commit comments