]> Pileus Git - ~andy/gtk/blob - gtk/gtkcolorsel.h
Initial revision
[~andy/gtk] / gtk / gtkcolorsel.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 #ifndef __GTK_COLORSEL_H__
19 #define __GTK_COLORSEL_H__
20
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <math.h>
24 #include <gdk/gdk.h>
25
26 #include "gtkwindow.h"
27 #include "gtkvbox.h"
28 #include "gtkframe.h"
29 #include "gtkpreview.h"
30 #include "gtkbutton.h"
31 #include "gtkentry.h"
32 #include "gtkhbox.h"
33 #include "gtklabel.h"
34 #include "gtkmain.h"
35 #include "gtksignal.h"
36 #include "gtkmisc.h"
37 #include "gtkrange.h"
38 #include "gtkscale.h"
39 #include "gtkhscale.h"
40 #include "gtktable.h"
41 #include "gtkeventbox.h"
42
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif /* __cplusplus */
47
48
49 #define GTK_COLOR_SELECTION(obj)          GTK_CHECK_CAST (obj, gtk_color_selection_get_type (), GtkColorSelection)
50 #define GTK_COLOR_SELECTION_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_color_selection_get_type (), GtkColorSelectionClass)
51 #define GTK_IS_COLOR_SELECTION(obj)       GTK_CHECK_TYPE (obj, gtk_color_selection_get_type ())
52
53 #define GTK_COLOR_SELECTION_DIALOG(obj)          GTK_CHECK_CAST (obj, gtk_color_selection_dialog_get_type (), GtkColorSelectionDialog)
54 #define GTK_COLOR_SELECTION_DIALOG_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, gtk_color_selection_dialog_get_type (), GtkColorSelectionDialogClass)
55 #define GTK_IS_COLOR_SELECTION_DIALOG(obj)       GTK_CHECK_TYPE (obj, gtk_color_selection_dialog_get_type ())
56
57
58 typedef struct _GtkColorSelection             GtkColorSelection;
59 typedef struct _GtkColorSelectionClass        GtkColorSelectionClass;
60
61 typedef struct _GtkColorSelectionDialog       GtkColorSelectionDialog;
62 typedef struct _GtkColorSelectionDialogClass  GtkColorSelectionDialogClass;
63
64
65 struct _GtkColorSelection
66 {
67   GtkVBox vbox;
68
69   GtkWidget *wheel_area;
70   GtkWidget *value_area;
71   GtkWidget *sample_area, *sample_area_eb;
72
73   GtkWidget *scales[8];
74   GtkWidget *entries[8];
75   GtkWidget *opacity_label;
76
77   GdkGC *wheel_gc;
78   GdkGC *value_gc;
79   GdkGC *sample_gc;
80
81   GtkUpdateType policy;
82   gint use_opacity;
83   gint timer_active;
84   gint timer_tag;
85   gdouble values[8];
86   gdouble old_values[8];
87
88   guchar *wheel_buf;
89   guchar *value_buf;
90   guchar *sample_buf;
91 };
92
93 struct _GtkColorSelectionClass
94 {
95   GtkVBoxClass parent_class;
96
97   void (* color_changed) (GtkColorSelection *colorsel);
98 };
99
100 struct _GtkColorSelectionDialog
101 {
102   GtkWindow window;
103
104   GtkWidget *colorsel;
105   GtkWidget *main_vbox;
106   GtkWidget *ok_button;
107   GtkWidget *reset_button;
108   GtkWidget *cancel_button;
109   GtkWidget *help_button;
110 };
111
112 struct _GtkColorSelectionDialogClass
113 {
114   GtkWindowClass parent_class;
115 };
116
117
118 /* ColorSelection */
119
120 guint      gtk_color_selection_get_type          (void);
121 void       gtk_color_selection_class_init        (GtkColorSelectionClass *klass);
122 void       gtk_color_selection_init              (GtkColorSelection      *colorsel);
123
124 GtkWidget* gtk_color_selection_new               (void);
125
126 void       gtk_color_selection_set_update_policy (GtkColorSelection     *colorsel,
127                                                   GtkUpdateType          policy);
128
129 void       gtk_color_selection_set_opacity       (GtkColorSelection     *colorsel,
130                                                   gint                   use_opacity);
131
132 void       gtk_color_selection_set_color         (GtkColorSelection     *colorsel,
133                                                   gdouble               *color);
134
135 void       gtk_color_selection_get_color         (GtkColorSelection     *colorsel,
136                                                   gdouble               *color);
137
138 /* ColorSelectionDialog */
139
140 guint      gtk_color_selection_dialog_get_type   (void);
141 void       gtk_color_selection_dialog_class_init (GtkColorSelectionDialogClass *klass);
142 void       gtk_color_selection_dialog_init       (GtkColorSelectionDialog      *colorseldiag);
143
144 GtkWidget* gtk_color_selection_dialog_new        (const gchar *title);
145
146
147 #ifdef __cplusplus
148 }
149 #endif /* __cplusplus */
150
151
152 #endif /* __GTK_COLORSEL_H__ */