]> git.sur5r.net Git - glabels/blob - src/mygal/widget-color-combo.h
Imported Upstream version 2.2.8
[glabels] / src / mygal / widget-color-combo.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* 
3  * widget-color-combo.h - A color selector combo box
4  * Copyright 2000, 2001, Ximian, Inc.
5  *
6  * Authors:
7  *   Miguel de Icaza (miguel@kernel.org)
8  *   Dom Lachowicz (dominicl@seas.upenn.edu)
9  *
10  * Reworked and split up into a separate ColorPalette object:
11  *   Michael Levy (mlevy@genoscope.cns.fr)
12  *
13  * And later revised and polished by:
14  *   Almer S. Tigelaar (almer@gnome.org)
15  *
16  * Modified for gLabels by:
17  *   Jim Evins <evins@snaught.com>
18  *
19  * This library is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public
21  * License, version 2, as published by the Free Software Foundation.
22  *
23  * This library is distributed in the hope that it will be useful, but
24  * WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26  * General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public
29  * License along with this library; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
31  * 02111-1307, USA.
32  */
33
34 #ifndef GNUMERIC_WIDGET_COLOR_COMBO_H
35 #define GNUMERIC_WIDGET_COLOR_COMBO_H
36
37 #include <gtk/gtkwidget.h>
38 #include "mygal-combo-box.h"
39 #include "color-palette.h"
40
41 G_BEGIN_DECLS
42
43 typedef struct _ColorCombo {
44         MygalComboBox     combo_box;
45
46         /*
47          * GtkImage where we display
48          */
49         GtkWidget       *preview_button;
50         GtkWidget       *preview_image;
51         gboolean        preview_is_icon;
52
53         ColorPalette    *palette;
54
55         GdkColor *default_color;
56         gboolean  trigger;
57 } ColorCombo;
58
59 typedef struct {
60         MygalComboBoxClass parent_class;
61
62         /* Signals emited by this widget */
63         void (* color_changed) (ColorCombo *color_combo, GdkColor *color,
64                                 gboolean custom, gboolean by_user, gboolean is_default);
65 } ColorComboClass;
66
67 #define COLOR_COMBO_TYPE     (color_combo_get_type ())
68 #define COLOR_COMBO(obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), COLOR_COMBO_TYPE, ColorCombo))
69 #define COLOR_COMBO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST(k), COLOR_COMBO_TYPE)
70 #define IS_COLOR_COMBO(obj)  (G_TYPE_CHECK_INSTANCE_TYPE((obj), COLOR_COMBO_TYPE))
71
72 GtkType    color_combo_get_type   (void);
73 GtkWidget *color_combo_new        (GdkPixbuf   *icon,
74                                    char  const *no_color_label,
75                                    GdkColor    *default_color,
76                                    ColorGroup  *color_group);
77 void       color_combo_set_color  (ColorCombo  *cc,
78                                    GdkColor    *color);
79 void       color_combo_set_color_to_default (ColorCombo *cc);
80 GdkColor  *color_combo_get_color  (ColorCombo  *cc, gboolean *is_default);
81
82 void       color_combo_box_set_preview_relief (ColorCombo *cc, GtkReliefStyle relief);
83
84 G_END_DECLS
85
86 #endif /* GNUMERIC_WIDGET_COLOR_COMBO_H */