]> www.fi.muni.cz Git - evince.git/commitdiff
Add GimpCellRendererToggle from gimp slightly modified to fit our needs.
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 15 Nov 2008 10:08:33 +0000 (10:08 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Sat, 15 Nov 2008 10:08:33 +0000 (10:08 +0000)
2008-11-15  Carlos Garcia Campos  <carlosgc@gnome.org>

* configure.ac:
* cut-n-paste/Makefile.am:
* cut-n-paste/gimpcellrenderertoggle/Makefile.am:
* cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.[ch]:
* cut-n-paste/gimpcellrenderertoggle/gimpwidgetsmarshal.list:

Add GimpCellRendererToggle from gimp slightly modified to fit our
needs.

svn path=/trunk/; revision=3266

ChangeLog
configure.ac
cut-n-paste/Makefile.am
cut-n-paste/gimpcellrenderertoggle/Makefile.am [new file with mode: 0644]
cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c [new file with mode: 0644]
cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.h [new file with mode: 0644]
cut-n-paste/gimpcellrenderertoggle/gimpwidgetsmarshal.list [new file with mode: 0644]

index b1e29288ec4c0a0db467b10cabd809ca76dc1b0d..255a0e43885a692490283adf69d58f71d3a0e814 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-11-15  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * configure.ac:
+       * cut-n-paste/Makefile.am:
+       * cut-n-paste/gimpcellrenderertoggle/Makefile.am:
+       * cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.[ch]:
+       * cut-n-paste/gimpcellrenderertoggle/gimpwidgetsmarshal.list:
+
+       Add GimpCellRendererToggle from gimp slightly modified to fit our
+       needs. 
+       
 2008-11-15  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * configure.ac:
index 4bba61b27a237728021f58e78af17f90f91ab491..3ddbdfe1da1166562b7c91720455b97eb247177a 100644 (file)
@@ -419,6 +419,7 @@ backend/tiff/Makefile
 cut-n-paste/Makefile
 cut-n-paste/evmountoperation/Makefile
 cut-n-paste/gedit-message-area/Makefile
+cut-n-paste/gimpcellrenderertoggle/Makefile
 cut-n-paste/smclient/Makefile
 cut-n-paste/toolbar-editor/Makefile
 cut-n-paste/zoom-control/Makefile
index fd5453b6f1f76cb91f3be394076367ffb1b5837c..abdb2096bd1c244d65814390231e7ba112ae1a0e 100644 (file)
@@ -1 +1 @@
-SUBDIRS = zoom-control toolbar-editor totem-screensaver gedit-message-area evmountoperation smclient
+SUBDIRS = zoom-control toolbar-editor totem-screensaver gedit-message-area evmountoperation smclient gimpcellrenderertoggle
diff --git a/cut-n-paste/gimpcellrenderertoggle/Makefile.am b/cut-n-paste/gimpcellrenderertoggle/Makefile.am
new file mode 100644 (file)
index 0000000..d986847
--- /dev/null
@@ -0,0 +1,37 @@
+noinst_LTLIBRARIES = libgimpcellrenderertoggle.la
+
+libgimpcellrenderertoggle_la_sources = \
+       gimpcellrenderertoggle.h        \
+       gimpcellrenderertoggle.c
+
+libgimpcellrenderertoggle_la_CFLAGS =  \
+       -I$(top_srcdir)/lib             \
+       $(LIB_CFLAGS)                   \
+       $(WARNING_CFLAGS)               \
+       $(DISABLE_DEPRECATED)
+
+libgimpcellrenderertoggle_la_built_sources =   \
+       gimpwidgetsmarshal.h                    \
+       gimpwidgetsmarshal.c
+
+libgimpcellrenderertoggle_la_SOURCES =                         \
+       $(libgimpcellrenderertoggle_la_built_sources)   \
+       $(libgimpcellrenderertoggle_la_sources)
+
+libgimpcellrenderertoggle_la_extra_sources = gimpwidgetsmarshal.list
+
+gimpwidgetsmarshal.h: $(srcdir)/gimpwidgetsmarshal.list
+       $(GLIB_GENMARSHAL) --prefix=_gimp_widgets_marshal $(srcdir)/gimpwidgetsmarshal.list --header >> xgen-wmh \
+        && (cmp -s xgen-wmh $(@F) || cp xgen-wmh $(@F)) \
+        && rm -f xgen-wmh xgen-wmh~
+
+gimpwidgetsmarshal.c: gimpwidgetsmarshal.h
+       echo "#include \"gimpwidgetsmarshal.h\"" >> xgen-wmc \
+        && $(GLIB_GENMARSHAL) --prefix=_gimp_widgets_marshal $(srcdir)/gimpwidgetsmarshal.list --body >> xgen-wmc \
+        && cp xgen-wmc $(@F) \
+        && rm -f xgen-wmc xgen-wmc~
+
+gen_sources = xgen-wmh xgen-wmc $(libgimpcellrenderertoggle_la_built_sources)
+CLEANFILES = $(gen_sources)
+
+EXTRA_DIST = $(libgimpcellrenderertoggle_la_extra_sources)
\ No newline at end of file
diff --git a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c
new file mode 100644 (file)
index 0000000..47da7ca
--- /dev/null
@@ -0,0 +1,482 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpcellrenderertoggle.c
+ * Copyright (C) 2003-2004  Sven Neumann <sven@gimp.org>
+ *
+ * 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 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
+ * Library 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include "gimpwidgetsmarshal.h"
+#include "gimpcellrenderertoggle.h"
+
+
+#define DEFAULT_ICON_SIZE  GTK_ICON_SIZE_BUTTON
+
+
+enum
+{
+  CLICKED,
+  LAST_SIGNAL
+};
+
+enum
+{
+  PROP_0,
+  PROP_STOCK_ID,
+  PROP_STOCK_SIZE
+};
+
+
+static void gimp_cell_renderer_toggle_finalize     (GObject         *object);
+static void gimp_cell_renderer_toggle_get_property (GObject         *object,
+                                                    guint            param_id,
+                                                    GValue          *value,
+                                                    GParamSpec      *pspec);
+static void gimp_cell_renderer_toggle_set_property (GObject         *object,
+                                                    guint            param_id,
+                                                    const GValue    *value,
+                                                    GParamSpec      *pspec);
+static void gimp_cell_renderer_toggle_get_size     (GtkCellRenderer *cell,
+                                                    GtkWidget       *widget,
+                                                    GdkRectangle    *rectangle,
+                                                    gint            *x_offset,
+                                                    gint            *y_offset,
+                                                    gint            *width,
+                                                    gint            *height);
+static void gimp_cell_renderer_toggle_render       (GtkCellRenderer *cell,
+                                                    GdkWindow       *window,
+                                                    GtkWidget       *widget,
+                                                    GdkRectangle    *background_area,
+                                                    GdkRectangle    *cell_area,
+                                                    GdkRectangle    *expose_area,
+                                                    GtkCellRendererState flags);
+static gboolean gimp_cell_renderer_toggle_activate (GtkCellRenderer *cell,
+                                                    GdkEvent        *event,
+                                                    GtkWidget       *widget,
+                                                    const gchar     *path,
+                                                    GdkRectangle    *background_area,
+                                                    GdkRectangle    *cell_area,
+                                                    GtkCellRendererState  flags);
+static void gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle,
+                                                     GtkWidget              *widget);
+
+
+G_DEFINE_TYPE (GimpCellRendererToggle, gimp_cell_renderer_toggle,
+               GTK_TYPE_CELL_RENDERER_TOGGLE)
+
+#define parent_class gimp_cell_renderer_toggle_parent_class
+
+static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
+
+
+static void
+gimp_cell_renderer_toggle_class_init (GimpCellRendererToggleClass *klass)
+{
+  GObjectClass         *object_class = G_OBJECT_CLASS (klass);
+  GtkCellRendererClass *cell_class   = GTK_CELL_RENDERER_CLASS (klass);
+
+  toggle_cell_signals[CLICKED] =
+    g_signal_new ("clicked",
+                  G_OBJECT_CLASS_TYPE (object_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GimpCellRendererToggleClass, clicked),
+                  NULL, NULL,
+                  _gimp_widgets_marshal_VOID__STRING_FLAGS,
+                  G_TYPE_NONE, 2,
+                  G_TYPE_STRING,
+                  GDK_TYPE_MODIFIER_TYPE);
+
+  object_class->finalize     = gimp_cell_renderer_toggle_finalize;
+  object_class->get_property = gimp_cell_renderer_toggle_get_property;
+  object_class->set_property = gimp_cell_renderer_toggle_set_property;
+
+  cell_class->get_size       = gimp_cell_renderer_toggle_get_size;
+  cell_class->render         = gimp_cell_renderer_toggle_render;
+  cell_class->activate       = gimp_cell_renderer_toggle_activate;
+
+  g_object_class_install_property (object_class,
+                                   PROP_STOCK_ID,
+                                   g_param_spec_string ("stock-id",
+                                                        NULL, NULL,
+                                                        NULL,
+                                                        G_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT));
+  g_object_class_install_property (object_class,
+                                   PROP_STOCK_SIZE,
+                                   g_param_spec_int ("stock-size",
+                                                     NULL, NULL,
+                                                     0, G_MAXINT,
+                                                     DEFAULT_ICON_SIZE,
+                                                     G_PARAM_READWRITE |
+                                                     G_PARAM_CONSTRUCT));
+}
+
+static void
+gimp_cell_renderer_toggle_init (GimpCellRendererToggle *toggle)
+{
+}
+
+static void
+gimp_cell_renderer_toggle_finalize (GObject *object)
+{
+  GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (object);
+
+  if (toggle->stock_id)
+    {
+      g_free (toggle->stock_id);
+      toggle->stock_id = NULL;
+    }
+
+  if (toggle->pixbuf)
+    {
+      g_object_unref (toggle->pixbuf);
+      toggle->pixbuf = NULL;
+    }
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gimp_cell_renderer_toggle_get_property (GObject    *object,
+                                        guint       param_id,
+                                        GValue     *value,
+                                        GParamSpec *pspec)
+{
+  GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (object);
+
+  switch (param_id)
+    {
+    case PROP_STOCK_ID:
+      g_value_set_string (value, toggle->stock_id);
+      break;
+    case PROP_STOCK_SIZE:
+      g_value_set_int (value, toggle->stock_size);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+      break;
+    }
+}
+
+static void
+gimp_cell_renderer_toggle_set_property (GObject      *object,
+                                        guint         param_id,
+                                        const GValue *value,
+                                        GParamSpec   *pspec)
+{
+  GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (object);
+
+  switch (param_id)
+    {
+    case PROP_STOCK_ID:
+      if (toggle->stock_id)
+        g_free (toggle->stock_id);
+      toggle->stock_id = g_value_dup_string (value);
+      break;
+    case PROP_STOCK_SIZE:
+      toggle->stock_size = g_value_get_int (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+      break;
+    }
+
+  if (toggle->pixbuf)
+    {
+      g_object_unref (toggle->pixbuf);
+      toggle->pixbuf = NULL;
+    }
+}
+
+static void
+gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
+                                    GtkWidget       *widget,
+                                    GdkRectangle    *cell_area,
+                                    gint            *x_offset,
+                                    gint            *y_offset,
+                                    gint            *width,
+                                    gint            *height)
+{
+  GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
+  GtkStyle               *style  = gtk_widget_get_style (widget);
+  gint                    calc_width;
+  gint                    calc_height;
+  gint                    pixbuf_width;
+  gint                    pixbuf_height;
+
+  if (! toggle->stock_id)
+    {
+      GTK_CELL_RENDERER_CLASS (parent_class)->get_size (cell,
+                                                        widget,
+                                                        cell_area,
+                                                        x_offset, y_offset,
+                                                        width, height);
+      return;
+    }
+
+  if (! toggle->pixbuf)
+    gimp_cell_renderer_toggle_create_pixbuf (toggle, widget);
+
+  pixbuf_width  = gdk_pixbuf_get_width  (toggle->pixbuf);
+  pixbuf_height = gdk_pixbuf_get_height (toggle->pixbuf);
+
+  calc_width  = (pixbuf_width +
+                 (gint) cell->xpad * 2 + style->xthickness * 2);
+  calc_height = (pixbuf_height +
+                 (gint) cell->ypad * 2 + style->ythickness * 2);
+
+  if (width)
+    *width  = calc_width;
+
+  if (height)
+    *height = calc_height;
+
+  if (cell_area)
+    {
+      if (x_offset)
+        {
+          *x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
+                        (1.0 - cell->xalign) : cell->xalign) *
+                       (cell_area->width - calc_width));
+          *x_offset = MAX (*x_offset, 0);
+        }
+
+      if (y_offset)
+        {
+          *y_offset = cell->yalign * (cell_area->height - calc_height);
+          *y_offset = MAX (*y_offset, 0);
+        }
+    }
+}
+
+static void
+gimp_cell_renderer_toggle_render (GtkCellRenderer      *cell,
+                                  GdkWindow            *window,
+                                  GtkWidget            *widget,
+                                  GdkRectangle         *background_area,
+                                  GdkRectangle         *cell_area,
+                                  GdkRectangle         *expose_area,
+                                  GtkCellRendererState  flags)
+{
+  GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
+  GtkStyle               *style  = gtk_widget_get_style (widget);
+  GdkRectangle            toggle_rect;
+  GdkRectangle            draw_rect;
+  GtkStateType            state;
+  gboolean                active;
+
+  if (! toggle->stock_id)
+    {
+      GTK_CELL_RENDERER_CLASS (parent_class)->render (cell, window, widget,
+                                                      background_area,
+                                                      cell_area, expose_area,
+                                                      flags);
+      return;
+    }
+
+  gimp_cell_renderer_toggle_get_size (cell, widget, cell_area,
+                                      &toggle_rect.x,
+                                      &toggle_rect.y,
+                                      &toggle_rect.width,
+                                      &toggle_rect.height);
+
+  toggle_rect.x      += cell_area->x + cell->xpad;
+  toggle_rect.y      += cell_area->y + cell->ypad;
+  toggle_rect.width  -= cell->xpad * 2;
+  toggle_rect.height -= cell->ypad * 2;
+
+  if (toggle_rect.width <= 0 || toggle_rect.height <= 0)
+    return;
+
+  active =
+    gtk_cell_renderer_toggle_get_active (GTK_CELL_RENDERER_TOGGLE (cell));
+
+  if (!cell->sensitive)
+    {
+      state = GTK_STATE_INSENSITIVE;
+    }
+  else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
+    {
+      if (GTK_WIDGET_HAS_FOCUS (widget))
+        state = GTK_STATE_SELECTED;
+      else
+        state = GTK_STATE_ACTIVE;
+    }
+  else
+    {
+      if (GTK_CELL_RENDERER_TOGGLE (cell)->activatable)
+        state = GTK_STATE_NORMAL;
+      else
+        state = GTK_STATE_INSENSITIVE;
+    }
+
+  if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) &&
+      (flags & GTK_CELL_RENDERER_PRELIT))
+    gtk_paint_shadow (style,
+                      window,
+                      state,
+                      active ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
+                      &draw_rect,
+                      widget, NULL,
+                      toggle_rect.x,     toggle_rect.y,
+                      toggle_rect.width, toggle_rect.height);
+
+  if (active)
+    {
+      GdkPixbuf *insensitive = NULL;
+      GdkPixbuf *pixbuf = toggle->pixbuf;
+      
+      toggle_rect.x      += style->xthickness;
+      toggle_rect.y      += style->ythickness;
+      toggle_rect.width  -= style->xthickness * 2;
+      toggle_rect.height -= style->ythickness * 2;
+
+      if (state == GTK_STATE_INSENSITIVE)
+        {
+         GtkIconSource *source;
+
+         source = gtk_icon_source_new ();
+         gtk_icon_source_set_pixbuf (source, pixbuf);
+         /* The size here is arbitrary; since size isn't
+          * wildcarded in the source, it isn't supposed to be
+          * scaled by the engine function
+          */
+         gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
+         gtk_icon_source_set_size_wildcarded (source, FALSE);
+
+         insensitive = gtk_style_render_icon (widget->style,
+                                              source,
+                                              gtk_widget_get_direction (widget),
+                                              GTK_STATE_INSENSITIVE,
+                                              /* arbitrary */
+                                              (GtkIconSize)-1,
+                                              widget,
+                                              "gimpcellrenderertoggle");
+
+         gtk_icon_source_free (source);
+
+         pixbuf = insensitive;
+       }
+
+      if (gdk_rectangle_intersect (&draw_rect, &toggle_rect, &draw_rect))
+        {
+         cairo_t *cr;
+         
+         cr = gdk_cairo_create (window);
+
+         gdk_cairo_set_source_pixbuf (cr, pixbuf, toggle_rect.x, toggle_rect.y);
+         gdk_cairo_rectangle (cr, &draw_rect);
+         cairo_fill (cr);
+         
+         cairo_destroy (cr);
+       }
+             
+      if (insensitive)
+        g_object_unref (insensitive);
+    }
+}
+
+static gboolean
+gimp_cell_renderer_toggle_activate (GtkCellRenderer      *cell,
+                                    GdkEvent             *event,
+                                    GtkWidget            *widget,
+                                    const gchar          *path,
+                                    GdkRectangle         *background_area,
+                                    GdkRectangle         *cell_area,
+                                    GtkCellRendererState  flags)
+{
+  GtkCellRendererToggle *toggle = GTK_CELL_RENDERER_TOGGLE (cell);
+
+  if (toggle->activatable)
+    {
+      GdkModifierType state = 0;
+
+      GTK_CELL_RENDERER_CLASS (parent_class)->activate (cell, event, widget,
+                                                       path, background_area,
+                                                       cell_area, flags);
+
+      if (event && ((GdkEventAny *) event)->type == GDK_BUTTON_PRESS)
+        state = ((GdkEventButton *) event)->state;
+
+      gimp_cell_renderer_toggle_clicked (GIMP_CELL_RENDERER_TOGGLE (cell),
+                                         path, state);
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static void
+gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle,
+                                         GtkWidget              *widget)
+{
+  if (toggle->pixbuf)
+    g_object_unref (toggle->pixbuf);
+
+  toggle->pixbuf = gtk_widget_render_icon (widget,
+                                           toggle->stock_id,
+                                           toggle->stock_size, NULL);
+}
+
+
+/**
+ * gimp_cell_renderer_toggle_new:
+ * @stock_id: the stock_id of the icon to use for the active state
+ *
+ * Creates a custom version of the #GtkCellRendererToggle. Instead of
+ * showing the standard toggle button, it shows a stock icon if the
+ * cell is active and no icon otherwise. This cell renderer is for
+ * example used in the Layers treeview to indicate and control the
+ * layer's visibility by showing %GIMP_STOCK_VISIBLE.
+ *
+ * Return value: a new #GimpCellRendererToggle
+ *
+ * Since: GIMP 2.2
+ **/
+GtkCellRenderer *
+gimp_cell_renderer_toggle_new (const gchar *stock_id)
+{
+  return g_object_new (GIMP_TYPE_CELL_RENDERER_TOGGLE,
+                       "stock_id", stock_id,
+                       NULL);
+}
+
+/**
+ * gimp_cell_renderer_toggle_clicked:
+ * @cell: a #GimpCellRendererToggle
+ * @path:
+ * @state:
+ *
+ * Emits the "clicked" signal from a #GimpCellRendererToggle.
+ *
+ * Since: GIMP 2.2
+ **/
+void
+gimp_cell_renderer_toggle_clicked (GimpCellRendererToggle *cell,
+                                   const gchar            *path,
+                                   GdkModifierType         state)
+{
+  g_return_if_fail (GIMP_IS_CELL_RENDERER_TOGGLE (cell));
+  g_return_if_fail (path != NULL);
+
+  g_signal_emit (cell, toggle_cell_signals[CLICKED], 0, path, state);
+}
diff --git a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.h b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.h
new file mode 100644 (file)
index 0000000..1a77841
--- /dev/null
@@ -0,0 +1,77 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
+ *
+ * gimpcellrenderertoggle.h
+ * Copyright (C) 2003-2004  Sven Neumann <sven@gimp.org>
+ *
+ * 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 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
+ * Library 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_CELL_RENDERER_TOGGLE_H__
+#define __GIMP_CELL_RENDERER_TOGGLE_H__
+
+#include <gtk/gtk.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GIMP_TYPE_CELL_RENDERER_TOGGLE            (gimp_cell_renderer_toggle_get_type ())
+#define GIMP_CELL_RENDERER_TOGGLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CELL_RENDERER_TOGGLE, GimpCellRendererToggle))
+#define GIMP_CELL_RENDERER_TOGGLE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CELL_RENDERER_TOGGLE, GimpCellRendererToggleClass))
+#define GIMP_IS_CELL_RENDERER_TOGGLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_CELL_RENDERER_TOGGLE))
+#define GIMP_IS_CELL_RENDERER_TOGGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_CELL_RENDERER_TOGGLE))
+#define GIMP_CELL_RENDERER_TOGGLE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_CELL_RENDERER_TOGGLE, GimpCellRendererToggleClass))
+
+typedef struct _GimpCellRendererToggle      GimpCellRendererToggle;
+typedef struct _GimpCellRendererToggleClass GimpCellRendererToggleClass;
+
+struct _GimpCellRendererToggle
+{
+  GtkCellRendererToggle       parent_instance;
+
+  gchar                      *stock_id;
+  GtkIconSize                 stock_size;
+  GdkPixbuf                  *pixbuf;
+};
+
+struct _GimpCellRendererToggleClass
+{
+  GtkCellRendererToggleClass  parent_class;
+
+  void (* clicked) (GimpCellRendererToggle *cell,
+                    const gchar            *path,
+                    GdkModifierType         state);
+
+  /* Padding for future expansion */
+  void (* _gimp_reserved1) (void);
+  void (* _gimp_reserved2) (void);
+  void (* _gimp_reserved3) (void);
+  void (* _gimp_reserved4) (void);
+};
+
+
+GType             gimp_cell_renderer_toggle_get_type (void) G_GNUC_CONST;
+
+GtkCellRenderer * gimp_cell_renderer_toggle_new      (const gchar *stock_id);
+
+void    gimp_cell_renderer_toggle_clicked (GimpCellRendererToggle *cell,
+                                           const gchar            *path,
+                                           GdkModifierType         state);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_CELL_RENDERER_TOGGLE_H__ */
diff --git a/cut-n-paste/gimpcellrenderertoggle/gimpwidgetsmarshal.list b/cut-n-paste/gimpcellrenderertoggle/gimpwidgetsmarshal.list
new file mode 100644 (file)
index 0000000..f32f0f9
--- /dev/null
@@ -0,0 +1,26 @@
+# see glib-genmarshal(1) for a detailed description of the file format,
+# possible parameter types are:
+#   VOID        indicates   no   return   type,  or  no  extra
+#               parameters. if VOID is used as  the  parameter
+#               list, no additional parameters may be present.
+#   BOOLEAN     for boolean types (gboolean)
+#   CHAR        for signed char types (gchar)
+#   UCHAR       for unsigned char types (guchar)
+#   INT         for signed integer types (gint)
+#   UINT        for unsigned integer types (guint)
+#   LONG        for signed long integer types (glong)
+#   ULONG       for unsigned long integer types (gulong)
+#   ENUM        for enumeration types (gint)
+#   FLAGS       for flag enumeration types (guint)
+#   FLOAT       for single-precision float types (gfloat)
+#   DOUBLE      for double-precision float types (gdouble)
+#   STRING      for string types (gchar*)
+#   BOXED       for boxed (anonymous but reference counted) types (GBoxed*)
+#   POINTER     for anonymous pointer types (gpointer)
+#   PARAM       for GParamSpec or derived types  (GParamSpec*)
+#   OBJECT      for GObject or derived types (GObject*)
+#   NONE        deprecated alias for VOID
+#   BOOL        deprecated alias for BOOLEAN
+
+VOID: STRING, FLAGS
+