1 /*
2  * overviewcolor.h - This file is part of the Geany Overview plugin
3  *
4  * Copyright (c) 2015 Matthew Brush <mbrush@codebrainz.ca>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef OVERVIEW_COLOR_H_
24 #define OVERVIEW_COLOR_H_
25 
26 #include <gtk/gtk.h>
27 
28 #define OVERVIEW_TYPE_COLOR (overview_color_get_type ())
29 #define OVERVIEW_COLOR_INIT { 0.0, 0.0, 0.0, 1.0 }
30 
31 typedef struct
32 {
33   gdouble red;
34   gdouble green;
35   gdouble blue;
36   gdouble alpha;
37 }
38 OverviewColor;
39 
40 GType          overview_color_get_type       (void);
41 OverviewColor *overview_color_copy           (OverviewColor       *color);
42 void           overview_color_free           (OverviewColor       *color);
43 gboolean       overview_color_equal          (const OverviewColor *color1,
44                                               const OverviewColor *color2);
45 gboolean       overview_color_parse          (OverviewColor       *color,
46                                               const gchar         *color_str);
47 gchar         *overview_color_to_string      (const OverviewColor *color);
48 void           overview_color_from_gdk_color (OverviewColor       *color,
49                                               const GdkColor      *gcolor,
50                                               gdouble              alpha);
51 void           overview_color_to_gdk_color   (const OverviewColor *color,
52                                               GdkColor            *gcolor);
53 #if GTK_CHECK_VERSION (3, 0, 0)
54 void           overview_color_from_rgba      (OverviewColor       *color,
55                                               const GdkRGBA       *rgba);
56 void           overview_color_to_rgba        (const OverviewColor *color,
57                                               GdkRGBA             *rgba);
58 #endif
59 void           overview_color_from_int       (OverviewColor       *color,
60                                               guint32              abgr,
61                                               gboolean             with_alpha);
62 guint32        overview_color_to_int         (const OverviewColor *color,
63                                               gboolean             with_alpha);
64 gboolean       overview_color_from_keyfile   (OverviewColor       *color,
65                                               GKeyFile            *keyfile,
66                                               const gchar         *section,
67                                               const gchar         *option,
68                                               GError             **error);
69 gboolean       overview_color_to_keyfile     (const OverviewColor *color,
70                                               GKeyFile            *keyfile,
71                                               const gchar         *section,
72                                               const gchar         *option);
73 
74 void           overview_color_from_color_button (OverviewColor       *color,
75                                                  GtkColorButton      *button);
76 void           overview_color_to_color_button   (const OverviewColor *color,
77                                                  GtkColorButton      *button);
78 
79 #endif /* OVERVIEW_COLOR_H_ */
80