]> git.sur5r.net Git - glabels/blob - src/mygal/color-group.h
Imported Upstream version 2.2.8
[glabels] / src / mygal / color-group.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* 
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
7  *
8  * Authors:
9  *   Michael Levy (mlevy@genoscope.cns.fr)
10  * Revised and polished by:
11  *   Almer S. Tigelaar <almer@gnome.org>
12  *
13  * Modified for gLabels by:
14  *   Jim Evins <evins@snaught.com>
15  *
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.
19  *
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.
24  *
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
28  * 02111-1307, USA.
29  */
30
31 #ifndef GNOME_APP_LIB__COLOR_GROUP_H
32 #define GNOME_APP_LIB__COLOR_GROUP_H
33
34 #include <glib-object.h>
35 #include <glib.h>
36 #include <gdk/gdktypes.h>
37
38 G_BEGIN_DECLS
39
40 typedef gboolean (* CbCustomColors) (GdkColor const * const color, gpointer data);
41
42 typedef struct _ColorGroup {
43         GObject  parent;
44
45         gchar     *name;
46         gpointer   context;
47
48         GPtrArray *history;         /* The custom color history */
49         gint       history_size;    /* length of color_history */
50 } ColorGroup;
51
52 typedef struct {
53         GObjectClass parent_class;
54         
55         /* Signals emited by this object */
56         void (*custom_color_add) (ColorGroup *color_group, GdkColor const * const color);
57 } ColorGroupClass;
58
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))
63
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);
67
68 void            color_group_set_history_size (ColorGroup *cg, gint size);
69 gint            color_group_get_history_size (ColorGroup *cg);
70
71 void            color_group_get_custom_colors (ColorGroup *cg, CbCustomColors callback,
72                                                gpointer user_data);
73 void            color_group_add_color         (ColorGroup *cg, GdkColor const * const color);
74
75 G_END_DECLS
76
77 #endif /* GNOME_APP_LIB__COLOR_GROUP_H */