]> git.sur5r.net Git - glabels/commitdiff
2009-08-31 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Tue, 1 Sep 2009 02:25:51 +0000 (02:25 +0000)
committerJim Evins <evins@snaught.com>
Tue, 1 Sep 2009 02:25:51 +0000 (02:25 +0000)
* data/builder/property-bar.builder:
Make sure event box does not obscure tool bar background.
* src/Makefile.am:
* src/color-swatch.c:
* src/color-swatch.h:
New color swatch widget.
* src/color-combo-color-menu-item.c:
(gl_color_combo_color_menu_item_init),
(gl_color_combo_color_menu_item_new),
(gl_color_combo_color_menu_item_set_color):
* src/color-combo.c: (gl_color_combo_init),
(gl_color_combo_finalize), (gl_color_combo_new),
(gl_color_combo_set_color), (menu_color_changed_cb):
Updated to use new color swatch widget.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@863 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/ChangeLog
glabels2/data/builder/property-bar.builder
glabels2/src/Makefile.am
glabels2/src/color-combo-color-menu-item.c
glabels2/src/color-combo.c
glabels2/src/color-swatch.c [new file with mode: 0644]
glabels2/src/color-swatch.h [new file with mode: 0644]

index 42267793881c2d5fab48e504174a1fe94e770d08..2f3fb91204c0f3495ae537d54af2bfdb04d656e8 100644 (file)
@@ -1,3 +1,20 @@
+2009-08-31  Jim Evins  <evins@snaught.com>
+
+       * data/builder/property-bar.builder:
+               Make sure event box does not obscure tool bar background.
+       * src/Makefile.am:
+       * src/color-swatch.c:
+       * src/color-swatch.h:
+               New color swatch widget.
+       * src/color-combo-color-menu-item.c:
+       (gl_color_combo_color_menu_item_init),
+       (gl_color_combo_color_menu_item_new),
+       (gl_color_combo_color_menu_item_set_color):
+       * src/color-combo.c: (gl_color_combo_init),
+       (gl_color_combo_finalize), (gl_color_combo_new),
+       (gl_color_combo_set_color), (menu_color_changed_cb):
+               Updated to use new color swatch widget.
+
 2009-08-26  Jim Evins  <evins@snaught.com>
 
        * po/POTFILES.in:
index 74a2f8f3bd432bf99a8de058c54c35381aff938e..3fd4f0ac37385c9f3552e67d4e46b42ce5e1439e 100644 (file)
               <object class="GtkEventBox" id="text_color_eventbox">
                 <property name="visible">True</property>
                 <property name="tooltip_text" translatable="yes">Text color</property>
+                <property name="visible_window">False</property>
                 <child>
                   <placeholder/>
                 </child>
               <object class="GtkEventBox" id="fill_color_eventbox">
                 <property name="visible">True</property>
                 <property name="tooltip_text" translatable="yes">Fill color</property>
+                <property name="visible_window">False</property>
                 <child>
                   <placeholder/>
                 </child>
               <object class="GtkEventBox" id="line_color_eventbox">
                 <property name="visible">True</property>
                 <property name="tooltip_text" translatable="yes">Line color</property>
+                <property name="visible_window">False</property>
                 <child>
                   <placeholder/>
                 </child>
index c848a5f04819f5819528888c17ce22ab88e400e0..da5c4de8373f4c8516470d8790cbc41f7b37cf84 100644 (file)
@@ -187,6 +187,8 @@ glabels_SOURCES =                   \
        color-combo-color-menu-item.h   \
        color-combo-history.c           \
        color-combo-history.h           \
+       color-swatch.c                  \
+       color-swatch.h                  \
        cairo-label-path.c              \
        cairo-label-path.h              \
        cairo-markup-path.c             \
index 742b3de53ede6589cb1dd9f9cd264c86249c0a7f..9fc6c79d13fb39bc07eb175405e35df25350d5a7 100644 (file)
@@ -27,9 +27,9 @@
 #include <gtk/gtkmenuitem.h>
 #include <gtk/gtkseparatormenuitem.h>
 #include <gtk/gtklabel.h>
-#include <gtk/gtkimage.h>
+#include "color-swatch.h"
 #include "color.h"
-#include "util.h"
+
 
 
 /*===========================================*/
@@ -37,7 +37,6 @@
 /*===========================================*/
 
 #define SIZE 20
-#define PAD   5
 
 
 /*===========================================*/
@@ -46,7 +45,9 @@
 
 struct _glColorComboColorMenuItemPrivate {
 
-        gint id;
+        gint       id;
+
+        GtkWidget *swatch;
 };
 
 
@@ -95,8 +96,6 @@ static void
 gl_color_combo_color_menu_item_init (glColorComboColorMenuItem *this)
 {
        this->priv = g_new0 (glColorComboColorMenuItemPrivate, 1);
-
-        gtk_widget_set_size_request (GTK_MENU_ITEM (this), SIZE + 2*PAD, SIZE + 2*PAD);
 }
 
 
@@ -126,15 +125,13 @@ gl_color_combo_color_menu_item_new (gint         id,
                                     const gchar *tip)
 {
        glColorComboColorMenuItem *this;
-        GdkPixbuf                 *pixbuf;
 
        this = g_object_new (GL_TYPE_COLOR_COMBO_COLOR_MENU_ITEM, NULL);
 
         this->priv->id = id;
 
-        pixbuf = create_color_pixbuf (SIZE, SIZE, color);
-        gtk_container_add (GTK_CONTAINER (this),
-                           gtk_image_new_from_pixbuf (pixbuf));
+        this->priv->swatch = gl_color_swatch_new (SIZE, SIZE, color);
+        gtk_container_add (GTK_CONTAINER (this), this->priv->swatch);
 
         gtk_widget_set_tooltip_text (GTK_WIDGET (this), tip);
 
@@ -151,60 +148,11 @@ gl_color_combo_color_menu_item_set_color(glColorComboColorMenuItem *this,
                                          guint                      color,
                                          const gchar               *tip)
 {
-        GdkPixbuf                 *pixbuf;
-
         this->priv->id = id;
 
-        pixbuf = create_color_pixbuf (SIZE, SIZE, color);
-        gtk_image_set_from_pixbuf (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (this))),
-                                   pixbuf);
+        gl_color_swatch_set_color (GL_COLOR_SWATCH (this->priv->swatch), color);
 
         gtk_widget_set_tooltip_text (GTK_WIDGET (this), tip);
- }
-
-
-/*****************************************************************************/
-/* Create new pixbuf with color preview.                                     */
-/*****************************************************************************/
-static GdkPixbuf *
-create_color_pixbuf (gdouble         w,
-                     gdouble         h,
-                     guint           color)
-{
-        cairo_surface_t   *surface;
-        cairo_t           *cr;
-        GdkPixbuf         *pixbuf;
-
-        surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h);
-
-        cr = cairo_create (surface);
-
-        cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
-
-        cairo_save (cr);
-        cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
-        cairo_paint (cr);
-        cairo_restore (cr);
-
-        cairo_rectangle( cr, 2, 2, w-3, h-3 );
-
-        cairo_set_source_rgba (cr,
-                               GL_COLOR_F_RED   (color),
-                               GL_COLOR_F_GREEN (color),
-                               GL_COLOR_F_BLUE  (color),
-                               GL_COLOR_F_ALPHA (color));
-        cairo_fill_preserve( cr );
-
-        cairo_set_line_width (cr, 1.0);
-        cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
-        cairo_stroke (cr);
-
-        cairo_destroy( cr );
-
-        pixbuf = gl_util_cairo_convert_to_pixbuf (surface);
-        cairo_surface_destroy (surface);
-
-        return pixbuf;
 }
 
 
index c98b8b618852e080741e8951192ba34f3b2807fa..f296f51ea038a386af9ba02ea18db7bab9257b5d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  color-combo.c
- *  Copyright (C) 2008  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2008-2009  Jim Evins <evins@snaught.com>.
  *
  *  This file is part of gLabels.
  *
 #include <glib/gi18n.h>
 #include <gtk/gtkbutton.h>
 #include <gtk/gtkvbox.h>
-#include <gtk/gtkimage.h>
+#include "color-swatch.h"
 #include <gtk/gtkarrow.h>
 #include "marshal.h"
-#include "util.h"
 #include "color.h"
 
 
 #define IMAGE_W 24
 #define IMAGE_H 24
 
+#define SWATCH_H 5
+
+
 /*========================================================*/
 /* Private types.                                         */
 /*========================================================*/
@@ -48,10 +50,9 @@ struct _glColorComboPrivate {
 
         guint       default_color;
 
-        GdkPixbuf  *icon;
-
         GtkWidget  *button;
-        GtkWidget  *button_image;
+        GtkWidget  *button_vbox;
+        GtkWidget  *swatch;
         GtkWidget  *dropdown_button;
 
         GtkWidget  *menu;
@@ -135,17 +136,16 @@ gl_color_combo_class_init (glColorComboClass *class)
 static void
 gl_color_combo_init (glColorCombo *this)
 {
-        GtkWidget *button_vbox;
         GtkWidget *arrow;
 
         gtk_box_set_spacing (GTK_BOX (this), 0);
 
         this->priv = g_new0 (glColorComboPrivate, 1);
 
+        this->priv->button_vbox = gtk_vbox_new (FALSE, 0);
+
         this->priv->button = gtk_button_new ();
-        this->priv->button_image = gtk_image_new ();
-        gtk_button_set_image (GTK_BUTTON (this->priv->button),
-                              this->priv->button_image);
+        gtk_container_add (GTK_CONTAINER (this->priv->button), this->priv->button_vbox);
         gtk_button_set_focus_on_click (GTK_BUTTON (this->priv->button), FALSE);
         g_signal_connect_swapped (this->priv->button, "clicked",
                           G_CALLBACK(button_clicked_cb), this);
@@ -175,11 +175,6 @@ gl_color_combo_finalize (GObject *object)
         g_return_if_fail (object && IS_GL_COLOR_COMBO (object));
         this = GL_COLOR_COMBO (object);
 
-        if (this->priv->icon)
-        {
-                g_object_unref (this->priv->icon);
-        }
-
         g_free (this->priv);
 
         G_OBJECT_CLASS (gl_color_combo_parent_class)->finalize (object);
@@ -196,15 +191,11 @@ gl_color_combo_new (GdkPixbuf    *icon,
                     guint         color)
 {
         glColorCombo *this;
-        GtkWidget    *separator_menuitem;
+        GdkPixbuf    *pixbuf;
+        GtkWidget    *wimage;
 
         this = g_object_new (TYPE_GL_COLOR_COMBO, NULL);
 
-        if (icon)
-        {
-                this->priv->icon = g_object_ref (icon);
-        }
-
         if (!default_label)
         {
                 default_label = _("Default Color");
@@ -213,13 +204,25 @@ gl_color_combo_new (GdkPixbuf    *icon,
         this->priv->default_color = default_color;
         this->priv->color = color;
 
+        if (icon)
+        {
+                pixbuf = gdk_pixbuf_new_subpixbuf (icon, 0, 0, IMAGE_W, IMAGE_H-SWATCH_H);
+                wimage = gtk_image_new_from_pixbuf (pixbuf);
+                g_object_unref (G_OBJECT (pixbuf));
+                gtk_box_pack_start (GTK_BOX (this->priv->button_vbox), wimage, FALSE, FALSE, 0);
+
+                this->priv->swatch = gl_color_swatch_new (IMAGE_W, SWATCH_H, color);
+        }
+        else
+        {
+                this->priv->swatch = gl_color_swatch_new (IMAGE_W, IMAGE_H, color);
+        }
+        gtk_box_pack_start (GTK_BOX (this->priv->button_vbox), this->priv->swatch, FALSE, FALSE, 0);
+
         this->priv->menu = gl_color_combo_menu_new (default_label,
                                                     color);
         gtk_widget_show_all (this->priv->menu);
 
-        gtk_image_set_from_pixbuf (GTK_IMAGE (this->priv->button_image),
-                                   create_pixbuf (this, IMAGE_W, IMAGE_H));
-
         g_signal_connect (this->priv->menu, "color_changed",
                           G_CALLBACK (menu_color_changed_cb), this);
 
@@ -236,8 +239,7 @@ gl_color_combo_set_color (glColorCombo  *this,
 {
         this->priv->color = color;
 
-        gtk_image_set_from_pixbuf (GTK_IMAGE (this->priv->button_image),
-                                   create_pixbuf (this, IMAGE_W, IMAGE_H));
+        gl_color_swatch_set_color (GL_COLOR_SWATCH (this->priv->swatch), color);
 }
 
 
@@ -289,74 +291,6 @@ button_clicked_cb( glColorCombo *this )
 }
 
 
-/*****************************************************************************/
-/* Create new pixbuf with color preview.                                     */
-/*****************************************************************************/
-static GdkPixbuf *
-create_pixbuf (glColorCombo   *this,
-               gdouble         w,
-               gdouble         h)
-{
-        cairo_surface_t   *surface;
-        cairo_t           *cr;
-        gdouble            image_w, image_h;
-        gdouble            swatch_h;
-        GdkPixbuf         *pixbuf;
-
-        surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h);
-
-        cr = cairo_create (surface);
-
-        cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
-
-        cairo_save (cr);
-        cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
-        cairo_paint (cr);
-        cairo_restore (cr);
-
-        if (this->priv->icon)
-        {
-                image_w = gdk_pixbuf_get_width (this->priv->icon);
-                image_h = gdk_pixbuf_get_height (this->priv->icon);
-
-                cairo_save (cr);
-
-                cairo_rectangle (cr, 0, 0, w, h);
-                cairo_scale (cr, w/image_w, h/image_h);
-                gdk_cairo_set_source_pixbuf (cr, this->priv->icon, 0, 0);
-                cairo_fill (cr);
-
-                cairo_restore (cr);
-
-                swatch_h = h/5 + 1;
-        }
-        else
-        {
-                swatch_h = h;
-        }
-
-        cairo_rectangle( cr, 1, h-swatch_h+1, w-2, swatch_h-2 );
-
-        cairo_set_source_rgba (cr,
-                               GL_COLOR_F_RED   (this->priv->color),
-                               GL_COLOR_F_GREEN (this->priv->color),
-                               GL_COLOR_F_BLUE  (this->priv->color),
-                               GL_COLOR_F_ALPHA (this->priv->color));
-        cairo_fill_preserve( cr );
-
-        cairo_set_line_width (cr, 1.0);
-        cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
-        cairo_stroke (cr);
-
-        cairo_destroy( cr );
-
-        pixbuf = gl_util_cairo_convert_to_pixbuf (surface);
-        cairo_surface_destroy (surface);
-
-        return pixbuf;
-}
-
-
 /*****************************************************************************/
 /* Menu positioning function.                                                */
 /*****************************************************************************/
@@ -443,8 +377,7 @@ menu_color_changed_cb (glColorComboMenu     *object,
         }
         this->priv->is_default_flag = is_default;
 
-        gtk_image_set_from_pixbuf (GTK_IMAGE (this->priv->button_image),
-                                   create_pixbuf (this, IMAGE_W, IMAGE_H));
+        gl_color_swatch_set_color (GL_COLOR_SWATCH (this->priv->swatch), color);
 
         g_signal_emit (this, signals[COLOR_CHANGED], 0,
                        this->priv->color,
diff --git a/glabels2/src/color-swatch.c b/glabels2/src/color-swatch.c
new file mode 100644 (file)
index 0000000..b0d453e
--- /dev/null
@@ -0,0 +1,242 @@
+/*
+ *  color-swatch.c
+ *  Copyright (C) 2009  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of gLabels.
+ *
+ *  gLabels is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  gLabels 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "color-swatch.h"
+
+#include "marshal.h"
+#include "color.h"
+
+
+/*===========================================*/
+/* Private macros and constants.             */
+/*===========================================*/
+
+
+/*===========================================*/
+/* Private types                             */
+/*===========================================*/
+
+struct _glColorSwatchPrivate {
+
+        guint      color;
+
+};
+
+
+/*===========================================*/
+/* Private globals                           */
+/*===========================================*/
+
+
+/*===========================================*/
+/* Local function prototypes                 */
+/*===========================================*/
+
+static void       gl_color_swatch_finalize    (GObject        *object);
+
+static void       redraw                      (glColorSwatch  *this);
+
+static gboolean   expose_event_cb             (GtkWidget      *widget,
+                                               GdkEventExpose *event);
+
+static void       draw_swatch                 (glColorSwatch  *this,
+                                               cairo_t        *cr);
+
+
+
+/****************************************************************************/
+/* Boilerplate Object stuff.                                                */
+/****************************************************************************/
+G_DEFINE_TYPE (glColorSwatch, gl_color_swatch, GTK_TYPE_DRAWING_AREA);
+
+
+/*****************************************************************************/
+/* Class Init Function.                                                      */
+/*****************************************************************************/
+static void
+gl_color_swatch_class_init (glColorSwatchClass *class)
+{
+       GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
+        gl_color_swatch_parent_class = g_type_class_peek_parent (class);
+
+       gobject_class->finalize    = gl_color_swatch_finalize;
+
+        widget_class->expose_event = expose_event_cb;
+}
+
+
+/*****************************************************************************/
+/* Object Instance Init Function.                                            */
+/*****************************************************************************/
+static void
+gl_color_swatch_init (glColorSwatch *this)
+{
+       this->priv = g_new0 (glColorSwatchPrivate, 1);
+}
+
+
+/*****************************************************************************/
+/* Finalize Method.                                                          */
+/*****************************************************************************/
+static void
+gl_color_swatch_finalize (GObject *object)
+{
+       glColorSwatch *this = GL_COLOR_SWATCH (object);
+
+       g_return_if_fail (object != NULL);
+       g_return_if_fail (GL_IS_COLOR_SWATCH (object));
+
+       g_free (this->priv);
+
+       G_OBJECT_CLASS (gl_color_swatch_parent_class)->finalize (object);
+}
+
+
+/*****************************************************************************/
+/** New Object Generator.                                                    */
+/*****************************************************************************/
+GtkWidget *
+gl_color_swatch_new (gint         w,
+                     gint         h,
+                     guint        color)
+{
+       glColorSwatch *this;
+
+       this = g_object_new (GL_TYPE_COLOR_SWATCH, NULL);
+
+        this->priv->color = color;
+
+        gtk_widget_set_size_request (GTK_WIDGET (this), w, h);
+
+       return GTK_WIDGET (this);
+}
+
+
+/*****************************************************************************/
+/* Set color.                                                                */
+/*****************************************************************************/
+void
+gl_color_swatch_set_color (glColorSwatch *this,
+                           guint          color)
+{
+        this->priv->color = color;
+
+        redraw (this);
+}
+
+
+/*****************************************************************************/
+/* Request redraw.                                                           */
+/*****************************************************************************/
+static void
+redraw (glColorSwatch  *this)
+{
+       GdkRegion *region;
+
+        if (GTK_WIDGET_REALIZED (GTK_WIDGET (this)))
+        {
+                /* redraw the cairo canvas forcing an expose event */
+                region = gdk_drawable_get_clip_region (GTK_WIDGET (this)->window);
+                gdk_window_invalidate_region (GTK_WIDGET (this)->window, region, TRUE);
+                gdk_region_destroy (region);
+        }
+}
+
+
+/*****************************************************************************/
+/* "Expose event" callback.                                                  */
+/*****************************************************************************/
+static gboolean
+expose_event_cb (GtkWidget      *widget,
+                 GdkEventExpose *event)
+{
+       cairo_t *cr;
+
+       cr = gdk_cairo_create (widget->window);
+
+       cairo_rectangle (cr,
+                       event->area.x, event->area.y,
+                       event->area.width, event->area.height);
+       cairo_clip (cr);
+
+       draw_swatch (GL_COLOR_SWATCH (widget), cr);
+
+       cairo_destroy (cr);
+
+       return FALSE;
+}
+
+
+/*****************************************************************************/
+/* Draw swatch.                                                              */
+/*****************************************************************************/
+static void
+draw_swatch (glColorSwatch *this,
+             cairo_t       *cr)
+{
+        GdkPixbuf *pixbuf;
+        GtkStyle  *style;
+        gdouble    w, h;
+        guint      fill_color, line_color;
+
+
+        cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
+
+
+        w = GTK_WIDGET (this)->allocation.width;
+        h = GTK_WIDGET (this)->allocation.height;
+
+
+        style = gtk_widget_get_style (GTK_WIDGET (this));
+        if ( GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (this)) )
+        {
+                fill_color = this->priv->color;
+                line_color = gl_color_from_gdk_color (&style->fg[GTK_STATE_NORMAL]);
+        }
+        else
+        {
+                fill_color = GL_COLOR_NONE;
+                line_color = gl_color_from_gdk_color (&style->fg[GTK_STATE_INSENSITIVE]);
+        }
+
+        cairo_rectangle( cr, 0, 0, w-1, h-1 );
+
+        cairo_set_source_rgba (cr, GL_COLOR_RGBA_ARGS (fill_color));
+        cairo_fill_preserve( cr );
+
+        cairo_set_source_rgb (cr, GL_COLOR_RGB_ARGS (line_color));
+        cairo_set_line_width (cr, 1.0);
+        cairo_stroke (cr);
+}
+
+
+
+/*
+ * Local Variables:       -- emacs
+ * mode: C                -- emacs
+ * c-basic-offset: 8      -- emacs
+ * tab-width: 8           -- emacs
+ * indent-tabs-mode: nil  -- emacs
+ * End:                   -- emacs
+ */
diff --git a/glabels2/src/color-swatch.h b/glabels2/src/color-swatch.h
new file mode 100644 (file)
index 0000000..94c09a9
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ *  color-swatch.h
+ *  Copyright (C) 2009  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of gLabels.
+ *
+ *  gLabels is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  gLabels 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __COLOR_SWATCH_H__
+#define __COLOR_SWATCH_H__
+
+
+#include <gtk/gtkdrawingarea.h>
+
+
+G_BEGIN_DECLS
+
+#define GL_TYPE_COLOR_SWATCH (gl_color_swatch_get_type ())
+#define GL_COLOR_SWATCH(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST((obj), GL_TYPE_COLOR_SWATCH, glColorSwatch ))
+#define GL_COLOR_SWATCH_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST ((klass), GL_TYPE_COLOR_SWATCH, glColorSwatchClass))
+#define GL_IS_COLOR_SWATCH(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GL_TYPE_COLOR_SWATCH))
+#define GL_IS_COLOR_SWATCH_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE ((klass), GL_TYPE_COLOR_SWATCH))
+
+typedef struct _glColorSwatch        glColorSwatch;
+typedef struct _glColorSwatchPrivate glColorSwatchPrivate;
+typedef struct _glColorSwatchClass   glColorSwatchClass;
+
+struct _glColorSwatch {
+       GtkDrawingArea                    parent_widget;
+
+       glColorSwatchPrivate *priv;
+};
+
+struct _glColorSwatchClass {
+       GtkDrawingAreaClass               parent_class;
+};
+
+
+GType      gl_color_swatch_get_type (void) G_GNUC_CONST;
+
+GtkWidget *gl_color_swatch_new      (gint           w,
+                                     gint           h,
+                                     guint          color);
+
+void       gl_color_swatch_set_color(glColorSwatch *this,
+                                     guint          color);
+
+
+G_END_DECLS
+
+#endif /* __COLOR_SWATCH_H__ */
+
+
+
+/*
+ * Local Variables:       -- emacs
+ * mode: C                -- emacs
+ * c-basic-offset: 8      -- emacs
+ * tab-width: 8           -- emacs
+ * indent-tabs-mode: nil  -- emacs
+ * End:                   -- emacs
+ */