/* -*- Mode: C; c-basic-offset: 4 -*- * pygtk- Python bindings for the GTK toolkit. * Copyright (C) 1998-2003 James Henstridge * * gtkstyle.override: overrides for the gtk.Style object. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA */ %% override-attr GtkStyle.fg static PyObject * _wrap_gtk_style__get_fg(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_COLOUR_ARRAY, style->fg); } %% override-attr GtkStyle.bg static PyObject * _wrap_gtk_style__get_bg(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_COLOUR_ARRAY, style->bg); } %% override-attr GtkStyle.light static PyObject * _wrap_gtk_style__get_light(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_COLOUR_ARRAY, style->light); } %% override-attr GtkStyle.dark static PyObject * _wrap_gtk_style__get_dark(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_COLOUR_ARRAY, style->dark); } %% override-attr GtkStyle.mid static PyObject * _wrap_gtk_style__get_mid(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_COLOUR_ARRAY, style->mid); } %% override-attr GtkStyle.text static PyObject * _wrap_gtk_style__get_text(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_COLOUR_ARRAY, style->text); } %% override-attr GtkStyle.base static PyObject * _wrap_gtk_style__get_base(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_COLOUR_ARRAY, style->base); } %% override-attr GtkStyle.text_aa static PyObject * _wrap_gtk_style__get_text_aa(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_COLOUR_ARRAY, style->text_aa); } %% override-attr GtkStyle.white static PyObject * _wrap_gtk_style__get_white(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return pyg_boxed_new(GDK_TYPE_COLOR, &style->white, TRUE, TRUE); } static int _wrap_gtk_style__set_white(PyGObject *self, PyObject *value, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); if (!pyg_boxed_check(value, GDK_TYPE_COLOR)) { PyErr_SetString(PyExc_TypeError, "can only assign a GdkColor"); return -1; } style->white = *pyg_boxed_get(value, GdkColor); return 0; } %% override-attr GtkStyle.black static PyObject * _wrap_gtk_style__get_black(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return pyg_boxed_new(GDK_TYPE_COLOR, &style->black, TRUE, TRUE); } static int _wrap_gtk_style__set_black(PyGObject *self, PyObject *value, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); if (!pyg_boxed_check(value, GDK_TYPE_COLOR)) { PyErr_SetString(PyExc_TypeError, "can only assign a GdkColor"); return -1; } style->black = *pyg_boxed_get(value, GdkColor); return 0; } %% override-attr GtkStyle.fg_gc static PyObject * _wrap_gtk_style__get_fg_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_GC_ARRAY, style->fg_gc); } %% override-attr GtkStyle.bg_gc static PyObject * _wrap_gtk_style__get_bg_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_GC_ARRAY, style->bg_gc); } %% override-attr GtkStyle.light_gc static PyObject * _wrap_gtk_style__get_light_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_GC_ARRAY, style->light_gc); } %% override-attr GtkStyle.dark_gc static PyObject * _wrap_gtk_style__get_dark_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_GC_ARRAY, style->dark_gc); } %% override-attr GtkStyle.mid_gc static PyObject * _wrap_gtk_style__get_mid_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_GC_ARRAY, style->mid_gc); } %% override-attr GtkStyle.text_gc static PyObject * _wrap_gtk_style__get_text_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_GC_ARRAY, style->text_gc); } %% override-attr GtkStyle.base_gc static PyObject * _wrap_gtk_style__get_base_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_GC_ARRAY, style->base_gc); } %% override-attr GtkStyle.text_aa_gc static PyObject * _wrap_gtk_style__get_text_aa_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_GC_ARRAY, style->text_aa_gc); } %% override-attr GtkStyle.white_gc static PyObject * _wrap_gtk_style__get_white_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return pygobject_new((GObject *)style->white_gc); } static int _wrap_gtk_style__set_white_gc(PyGObject *self, PyObject *value, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); if (!pygobject_check(value, &PyGdkGC_Type)) { PyErr_SetString(PyExc_TypeError, "can only assign a GdkGC"); return -1; } style->white_gc = GDK_GC(pygobject_get(value)); return 0; } %% override-attr GtkStyle.black_gc static PyObject * _wrap_gtk_style__get_black_gc(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return pygobject_new((GObject *)style->black_gc); } static int _wrap_gtk_style__set_black_gc(PyGObject *self, PyObject *value, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); if (!pygobject_check(value, &PyGdkGC_Type)) { PyErr_SetString(PyExc_TypeError, "can only assign a GdkGC"); return -1; } style->black_gc = GDK_GC(pygobject_get(value)); return 0; } %% override-attr GtkStyle.bg_pixmap static PyObject * _wrap_gtk_style__get_bg_pixmap(PyGObject *self, void *closure) { GtkStyle *style = GTK_STYLE(self->obj); return _pygtk_style_helper_new(style, STYLE_PIXMAP_ARRAY, style->bg_pixmap); } %% override gtk_style_lookup_color kwargs static PyObject * _wrap_gtk_style_lookup_color(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "color_name", NULL }; char *color_name; GdkColor color; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:GtkStyle.lookup_color", kwlist, &color_name)) return NULL; if (gtk_style_lookup_color(GTK_STYLE(self->obj), color_name, &color)) return pyg_boxed_new(GDK_TYPE_COLOR, &color, TRUE, TRUE); Py_INCREF(Py_None); return Py_None; }