diff options
Diffstat (limited to 'atk.override')
-rw-r--r-- | atk.override | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/atk.override b/atk.override index 5f27e3be..7d792cf9 100644 --- a/atk.override +++ b/atk.override @@ -75,3 +75,157 @@ _wrap_atk_relation_new (PyGObject *self, PyObject *args, PyObject *kwargs) pygobject_register_wrapper((PyObject *) self); return 0; } +%% +override atk_component_get_extents kwargs +static PyObject * +_wrap_atk_component_get_extents(PyGObject *self, PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "coord_type", NULL }; + gint x, y, width, height; + AtkCoordType coord_type; + PyObject *py_coord_type; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O:atk.Component.get_extents", kwlist, + &py_coord_type)) + return NULL; + + if (pyg_enum_get_value(ATK_TYPE_COORD_TYPE, py_coord_type, + (gint *)&coord_type)) + return NULL; + atk_component_get_extents(ATK_COMPONENT(self->obj), &x, &y, &width, + &height, coord_type); + return Py_BuildValue("(iiii)", x, y, width, height); +} +%% +override atk_component_get_position kwargs +static PyObject * +_wrap_atk_component_get_position(PyGObject *self, PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "coord_type", NULL }; + gint x, y; + AtkCoordType coord_type; + PyObject *py_coord_type; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O:atk.Component.get_position", kwlist, + &py_coord_type)) + return NULL; + + if (pyg_enum_get_value(ATK_TYPE_COORD_TYPE, py_coord_type, + (gint *)&coord_type)) + return NULL; + atk_component_get_position(ATK_COMPONENT(self->obj), &x, &y, coord_type); + return Py_BuildValue("(ii)", x, y); +} +%% +override atk_component_get_size noargs +static PyObject * +_wrap_atk_component_get_size(PyGObject *self) +{ + gint width, height; + + atk_component_get_size(ATK_COMPONENT(self->obj), &width, &height); + return Py_BuildValue("(ii)", width, height); +} +%% +override atk_editable_text_set_run_attributes kwargs +static PyObject * +_wrap_atk_editable_text_set_run_attributes(PyGObject *self, PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "attrib_set", "start_offset", "end_offset", + NULL }; + gint start, end, n_attrs, i; + gboolean ret; + AtkAttributeSet *attrib_set = NULL; + PyObject *py_attrib_set; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "Oii:atk.EditableText.set_run_attributes", + kwlist, &py_attrib_set, &start, &end)) + return NULL; + + + if (!(py_attrib_set = PySequence_Fast(py_attrib_set, + "attrib_set must be a sequence"))) + return NULL; + + n_attrs = PySequence_Fast_GET_SIZE(py_attrib_set); + for (i = 0; i < n_attrs; i++) { + PyObject *item = PySequence_Fast_GET_ITEM(py_attrib_set, i); + AtkAttribute *attr = g_new0(AtkAttribute, 1); + if (!PyArg_ParseTuple(item, "ss", &attr->name, &attr->value)) { + PyErr_Clear(); + PyErr_SetString(PyExc_TypeError, + "attrib_set items should be (string,string)"); + g_free(attr); + g_slist_foreach(attrib_set, (GFunc)g_free, NULL); + g_slist_free(attrib_set); + Py_DECREF(py_attrib_set); + return NULL; + } + g_slist_append(attrib_set, attr); + } + ret = atk_editable_text_set_run_attributes(ATK_EDITABLE_TEXT(self->obj), + attrib_set, start, end); + + g_slist_foreach(attrib_set, (GFunc)g_free, NULL); + g_slist_free(attrib_set); + Py_DECREF(py_attrib_set); + return PyBool_FromLong(ret); +} +%% +override atk_editable_text_insert_text kwargs +static PyObject * +_wrap_atk_editable_text_insert_text(PyGObject *self, PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "string", "length", "position", + NULL }; + gint length, position; + const gchar *string; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "sii:atk.EditableText.insert_text", + kwlist, &string, &length, &position)) + return NULL; + + atk_editable_text_insert_text(ATK_EDITABLE_TEXT(self->obj), + string, length, &position); + return PyInt_FromLong(position); +} +%% +override atk_image_get_image_size noargs +static PyObject * +_wrap_atk_image_get_image_size(PyGObject *self) +{ + gint width, height; + + atk_image_get_image_size(ATK_IMAGE(self->obj), &width, &height); + return Py_BuildValue("(ii)", width, height); +} +%% +override atk_image_get_image_position kwargs +static PyObject * +_wrap_atk_image_get_image_position(PyGObject *self, PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "coord_type", NULL }; + gint x, y; + AtkCoordType coord_type; + PyObject *py_coord_type; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O:atk.Image.get_image_position", kwlist, + &py_coord_type)) + return NULL; + + if (pyg_enum_get_value(ATK_TYPE_COORD_TYPE, py_coord_type, + (gint *)&coord_type)) + return NULL; + atk_image_get_image_position(ATK_IMAGE(self->obj), &x, &y, coord_type); + return Py_BuildValue("(ii)", x, y); +} |