diff options
author | Johan Dahlin <zilch@src.gnome.org> | 2003-06-06 00:09:47 +0000 |
---|---|---|
committer | Johan Dahlin <zilch@src.gnome.org> | 2003-06-06 00:09:47 +0000 |
commit | 16b425f89526b4eda653d75c1a9a461444dd1adc (patch) | |
tree | be66756b5897de88369d6aeaef831bf1b49750a3 /gtk/gtkwindow.override | |
parent | 80e0750d929fcaac005ed159046b056247facfcf (diff) | |
download | pygtk-16b425f89526b4eda653d75c1a9a461444dd1adc.tar.gz |
New files, splitted out from gtk.override
* gtk/gtk*.override: New files, splitted out from gtk.override
* gtk/Makefile.am (EXTRA_DIST): Add *.override here
* codegen/override.py (Overrides.__parse_override): Added
"include" keyword, to be able to include files in override files
Diffstat (limited to 'gtk/gtkwindow.override')
-rw-r--r-- | gtk/gtkwindow.override | 266 |
1 files changed, 266 insertions, 0 deletions
diff --git a/gtk/gtkwindow.override b/gtk/gtkwindow.override new file mode 100644 index 00000000..80d84c39 --- /dev/null +++ b/gtk/gtkwindow.override @@ -0,0 +1,266 @@ +/* -*- Mode: C; c-basic-offset: 4 -*- */ +%% +ignore + gtk_window_add_embedded_xid + gtk_window_remove_embedded_xid +%% +override gtk_window_list_toplevels noargs +static PyObject * +_wrap_gtk_window_list_toplevels(PyGObject *self) +{ + GList *list, *tmp; + PyObject *py_list; + PyObject *gtk_obj; + + list = gtk_window_list_toplevels(); + + if ((py_list = PyList_New(0)) == NULL) { + g_list_free(list); + return NULL; + } + for (tmp = list; tmp != NULL; tmp = tmp->next) { + gtk_obj = pygobject_new(G_OBJECT(tmp->data)); + if (gtk_obj == NULL) { + g_list_free(list); + Py_DECREF(py_list); + return NULL; + } + PyList_Append(py_list, gtk_obj); + Py_DECREF(gtk_obj); + } + g_list_free(list); + return py_list; +} +%% +override gtk_window_set_geometry_hints kwargs +static PyObject * +_wrap_gtk_window_set_geometry_hints(PyGObject *self, PyObject *args, + PyObject *kwargs) +{ + static char *kwlist[] = { "geometry_widget", "min_width", "min_height", + "max_width", "max_height", "base_width", + "base_height", "width_inc", "height_inc", + "min_aspect", "max_aspect", NULL }; + PyObject *py_geometry_widget = Py_None; + GtkWidget *geometry_widget = NULL; + gint min_width = -1, min_height = -1, max_width = -1, max_height = -1; + gint base_width = -1, base_height = -1, width_inc = -1, height_inc = -1; + gdouble min_aspect = -1.0, max_aspect = -1.0; + GdkGeometry geometry = { 0 }; + GdkWindowHints geom_mask = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "|Oiiiiiiiidd:GtkWindow.set_geometry_hints", kwlist, + &py_geometry_widget, &min_width, + &min_height, &max_width, &max_height, + &base_width, &base_height, &width_inc, + &height_inc, &min_aspect, &max_aspect)) + return NULL; + if (pygobject_check(py_geometry_widget, &PyGtkWidget_Type)) + geometry_widget = GTK_WIDGET(pygobject_get(py_geometry_widget)); + else if (py_geometry_widget != Py_None) { + PyErr_SetString(PyExc_TypeError, + "geometry_widget must be a GtkWidget or None"); + return NULL; + } + if (min_width >= 0 || min_height >= 0) { + geometry.min_width = MAX(min_width, 0); + geometry.min_height = MAX(min_height, 0); + geom_mask |= GDK_HINT_MIN_SIZE; + } + if (max_width >= 0 || max_height >= 0) { + geometry.max_width = MAX(max_width, 0); + geometry.max_height = MAX(max_height, 0); + geom_mask |= GDK_HINT_MAX_SIZE; + } + if (base_width >= 0 || base_height >= 0) { + geometry.base_width = MAX(base_width, 0); + geometry.base_height = MAX(base_height, 0); + geom_mask |= GDK_HINT_BASE_SIZE; + } + if (width_inc >= 0 || height_inc >= 0) { + geometry.width_inc = MAX(width_inc, 0); + geometry.height_inc = MAX(height_inc, 0); + geom_mask |= GDK_HINT_RESIZE_INC; + } + if (min_aspect >= 0.0 || max_aspect >= 0.0) { + if (min_aspect <= 0.0 || max_aspect <= 0.0) { + PyErr_SetString(PyExc_TypeError, "aspect ratios must be positive"); + return NULL; + } + geometry.min_aspect = min_aspect; + geometry.max_aspect = max_aspect; + geom_mask |= GDK_HINT_ASPECT; + } + gtk_window_set_geometry_hints(GTK_WINDOW(self->obj), geometry_widget, + &geometry, geom_mask); + Py_INCREF(Py_None); + return Py_None; +} +%% +override gtk_window_get_position +static PyObject * +_wrap_gtk_window_get_position(PyGObject *self) +{ + gint root_x, root_y; + + gtk_window_get_position(GTK_WINDOW(self->obj), &root_x, &root_y); + return Py_BuildValue("(ii)", root_x, root_y); +} +%% +override gtk_window_get_size +static PyObject * +_wrap_gtk_window_get_size(PyGObject *self) +{ + gint width, height; + + gtk_window_get_size(GTK_WINDOW(self->obj), &width, &height); + return Py_BuildValue("(ii)", width, height); +} +%% +override gtk_window_get_default_size +static PyObject * +_wrap_gtk_window_get_default_size(PyGObject *self) +{ + gint width, height; + + gtk_window_get_default_size(GTK_WINDOW(self->obj), &width, &height); + return Py_BuildValue("(ii)", width, height); +} +%% +override gtk_window_get_frame_dimensions noargs +static PyObject * +_wrap_gtk_window_get_frame_dimensions(PyGObject *self) +{ + int left, top, right, bottom; + + gtk_window_get_frame_dimensions(GTK_WINDOW(self->obj), + &left, &top, &right, &bottom); + return Py_BuildValue("(iiii)", left, top, right, bottom); +} +%% +override gtk_widget_get_size_request noargs +static PyObject * +_wrap_gtk_widget_get_size_request(PyGObject *self) +{ + int width, height; + + gtk_widget_get_size_request(GTK_WIDGET(self->obj), &width, &height); + return Py_BuildValue("(ii)", width, height); +} +%% +override gtk_window_set_icon_list args +static PyObject * +_wrap_gtk_window_set_icon_list(PyGObject *self, PyObject *args) +{ + GList *icon_list = NULL; + PyObject *pyicon; + gint len, i; + + len = PyTuple_Size(args); + for (i = 0; i < len; i++) { + pyicon = PyTuple_GetItem(args, i); + if (!pygobject_check(pyicon, &PyGdkPixbuf_Type)) { + PyErr_SetString(PyExc_TypeError, + "icons must be GdkPixbufs"); + g_list_free(icon_list); + return NULL; + } + icon_list = g_list_prepend(icon_list, pygobject_get(pyicon)); + } + gtk_window_set_icon_list(GTK_WINDOW(self->obj), icon_list); + g_list_free(icon_list); + Py_INCREF(Py_None); + return Py_None; +} +%% +override gtk_window_get_icon_list noargs +static PyObject * +_wrap_gtk_window_get_icon_list(PyGObject *self) +{ + GList *icon_list = NULL; + PyObject *pyicon; + + if ((icon_list = gtk_window_get_icon_list(GTK_WINDOW(self->obj)))) { + PyObject *py_list; + GList *tmp; + + if ((py_list = PyList_New(0)) == NULL) { + g_list_free(icon_list); + return NULL; + } + for (tmp = icon_list; tmp != NULL; tmp = tmp->next) { + pyicon = pygobject_new(G_OBJECT(tmp->data)); + + if (pyicon == NULL) { + g_list_free(icon_list); + Py_DECREF(py_list); + return NULL; + } + PyList_Append(py_list, pyicon); + Py_DECREF(pyicon); + } + g_list_free(icon_list); + return py_list; + } + Py_INCREF(Py_None); + return Py_None; +} +%% +override gtk_window_set_default_icon_list args +static PyObject * +_wrap_gtk_window_set_default_icon_list(PyGObject *self, PyObject *args) +{ + GList *icon_list = NULL; + PyObject *pyicon; + gint len, i; + + len = PyTuple_Size(args); + for (i = 0; i < len; i++) { + pyicon = PyTuple_GetItem(args, i); + if (!pygobject_check(pyicon, &PyGdkPixbuf_Type)) { + PyErr_SetString(PyExc_TypeError, + "icons must be GdkPixbufs"); + g_list_free(icon_list); + return NULL; + } + icon_list = g_list_prepend(icon_list, pygobject_get(pyicon)); + } + gtk_window_set_default_icon_list(icon_list); + g_list_free(icon_list); + Py_INCREF(Py_None); + return Py_None; +} +%% +override gtk_window_get_default_icon_list noargs +static PyObject * +_wrap_gtk_window_get_default_icon_list(PyGObject *self) +{ + GList *icon_list = NULL; + PyObject *pyicon; + + if ((icon_list = gtk_window_get_default_icon_list())) { + PyObject *py_list; + GList *tmp; + + if ((py_list = PyList_New(0)) == NULL) { + g_list_free(icon_list); + return NULL; + } + for (tmp = icon_list; tmp != NULL; tmp = tmp->next) { + pyicon = pygobject_new(G_OBJECT(tmp->data)); + + if (pyicon == NULL) { + g_list_free(icon_list); + Py_DECREF(py_list); + return NULL; + } + PyList_Append(py_list, pyicon); + Py_DECREF(pyicon); + } + g_list_free(icon_list); + return py_list; + } + Py_INCREF(Py_None); + return Py_None; +} |