1 | /* HSV color selector for GTK+ |
2 | * |
3 | * Copyright (C) 1999 The Free Software Foundation |
4 | * |
5 | * Authors: Simon Budig <[email protected]> (original code) |
6 | * Federico Mena-Quintero <[email protected]> (cleanup for GTK+) |
7 | * Jonathan Blandford <[email protected]> (cleanup for GTK+) |
8 | * |
9 | * This library is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU Lesser General Public |
11 | * License as published by the Free Software Foundation; either |
12 | * version 2 of the License, or (at your option) any later version. |
13 | * |
14 | * This library is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | * Lesser General Public License for more details. |
18 | * |
19 | * You should have received a copy of the GNU Lesser General Public |
20 | * License along with this library; if not, write to the |
21 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 | * Boston, MA 02111-1307, USA. |
23 | */ |
24 | |
25 | /* |
26 | * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
27 | * file for a list of people on the GTK+ Team. See the ChangeLog |
28 | * files for a list of changes. These files are distributed with |
29 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
30 | */ |
31 | |
32 | #ifndef __GTK_HSV_H__ |
33 | #define __GTK_HSV_H__ |
34 | |
35 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
36 | #error "Only <gtk/gtk.h> can be included directly." |
37 | #endif |
38 | |
39 | #include <gtk/gtkwidget.h> |
40 | |
41 | G_BEGIN_DECLS |
42 | |
43 | #define GTK_TYPE_HSV (gtk_hsv_get_type ()) |
44 | #define GTK_HSV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HSV, GtkHSV)) |
45 | #define GTK_HSV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSV, GtkHSVClass)) |
46 | #define GTK_IS_HSV(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HSV)) |
47 | #define GTK_IS_HSV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSV)) |
48 | #define GTK_HSV_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HSV, GtkHSVClass)) |
49 | |
50 | |
51 | typedef struct _GtkHSV GtkHSV; |
52 | typedef struct _GtkHSVClass GtkHSVClass; |
53 | |
54 | struct _GtkHSV |
55 | { |
56 | GtkWidget parent_instance; |
57 | |
58 | /* Private data */ |
59 | gpointer GSEAL (priv); |
60 | }; |
61 | |
62 | struct _GtkHSVClass |
63 | { |
64 | GtkWidgetClass parent_class; |
65 | |
66 | /* Notification signals */ |
67 | void (* changed) (GtkHSV *hsv); |
68 | |
69 | /* Keybindings */ |
70 | void (* move) (GtkHSV *hsv, |
71 | GtkDirectionType type); |
72 | |
73 | /* Padding for future expansion */ |
74 | void (*_gtk_reserved1) (void); |
75 | void (*_gtk_reserved2) (void); |
76 | void (*_gtk_reserved3) (void); |
77 | void (*_gtk_reserved4) (void); |
78 | }; |
79 | |
80 | |
81 | GType gtk_hsv_get_type (void) G_GNUC_CONST; |
82 | GtkWidget* gtk_hsv_new (void); |
83 | void gtk_hsv_set_color (GtkHSV *hsv, |
84 | double h, |
85 | double s, |
86 | double v); |
87 | void gtk_hsv_get_color (GtkHSV *hsv, |
88 | gdouble *h, |
89 | gdouble *s, |
90 | gdouble *v); |
91 | void gtk_hsv_set_metrics (GtkHSV *hsv, |
92 | gint size, |
93 | gint ring_width); |
94 | void gtk_hsv_get_metrics (GtkHSV *hsv, |
95 | gint *size, |
96 | gint *ring_width); |
97 | gboolean gtk_hsv_is_adjusting (GtkHSV *hsv); |
98 | |
99 | /* Convert colors between the RGB and HSV color spaces */ |
100 | void gtk_hsv_to_rgb (gdouble h, |
101 | gdouble s, |
102 | gdouble v, |
103 | gdouble *r, |
104 | gdouble *g, |
105 | gdouble *b); |
106 | void gtk_rgb_to_hsv (gdouble r, |
107 | gdouble g, |
108 | gdouble b, |
109 | gdouble *h, |
110 | gdouble *s, |
111 | gdouble *v); |
112 | |
113 | G_END_DECLS |
114 | |
115 | #endif /* __GTK_HSV_H__ */ |
116 | |