1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * color-group.h - Utility to keep a shered memory of custom colors
4 * between arbitrary widgets.
5 * Copyright 2000, Michael Levy
6 * Copyright 2001, Almer S. Tigelaar
9 * Michael Levy (mlevy@genoscope.cns.fr)
10 * Revised and polished by:
11 * Almer S. Tigelaar <almer@gnome.org>
13 * Modified for gLabels by:
14 * Jim Evins <evins@snaught.com>
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public
18 * License, version 2, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * General Public License for more details.
25 * You should have received a copy of the GNU General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
31 #ifndef GNOME_APP_LIB__COLOR_GROUP_H
32 #define GNOME_APP_LIB__COLOR_GROUP_H
34 #include <glib-object.h>
36 #include <gdk/gdktypes.h>
40 typedef gboolean (* CbCustomColors) (GdkColor const * const color, gpointer data);
42 typedef struct _ColorGroup {
48 GPtrArray *history; /* The custom color history */
49 gint history_size; /* length of color_history */
53 GObjectClass parent_class;
55 /* Signals emited by this object */
56 void (*custom_color_add) (ColorGroup *color_group, GdkColor const * const color);
59 #define COLOR_GROUP_TYPE (color_group_get_type ())
60 #define COLOR_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COLOR_GROUP_TYPE, ColorGroup))
61 #define COLOR_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST (k), COLOR_GROUP_TYPE)
62 #define IS_COLOR_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COLOR_GROUP_TYPE))
64 GType color_group_get_type (void);
65 ColorGroup *color_group_fetch (const gchar *name, gpointer context);
66 ColorGroup *color_group_get (const gchar *name, gpointer context);
68 void color_group_set_history_size (ColorGroup *cg, gint size);
69 gint color_group_get_history_size (ColorGroup *cg);
71 void color_group_get_custom_colors (ColorGroup *cg, CbCustomColors callback,
73 void color_group_add_color (ColorGroup *cg, GdkColor const * const color);
77 #endif /* GNOME_APP_LIB__COLOR_GROUP_H */