2 * Copyright 2008 Department of Mathematical Sciences, New Mexico State University
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * DEPARTMENT OF MATHEMATICAL SCIENCES OR NEW MEXICO STATE UNIVERSITY BE
18 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #include <gtk/gtkvbox.h>
26 #include "gtkcompat.h"
31 * The macros for accessing various parts of the widget class.
33 #define GRAYSWATCH(obj)(G_TYPE_CHECK_INSTANCE_CAST(obj, grayswatch_get_type(), Grayswatch))
34 #define GRAYSWATCH_CLASS(klass) \
35 (G_TYPE_CHECK_CLASS_CAST(klass, grayswatch_get_type(), GrayswatchClass))
36 #define IS_GRAYSWATCH(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, grayswatch_get_type())
37 #define IS_GRAYSWATCH_CLASS(klass) \
38 (G_TYPE_CHECK_CLASS_TYPE(klass, grayswatch_get_type()))
39 #define GRAYSWATCH_GET_CLASS(obj) \
40 (G_TYPE_INSTANCE_GET_CLASS(obj, grayswatch_get_type(), GrayswatchClass))
42 typedef struct _Grayswatch Grayswatch;
43 typedef struct _GrayswatchClass GrayswatchClass;
60 * The grayscale image used to draw the swatch color.
66 * Flag indicating whether the signal should be blocked or not.
68 gboolean signal_blocked;
71 struct _GrayswatchClass {
72 GtkVBoxClass parent_class;
77 void (*value_changed)(GtkWidget *, gint, gpointer);
80 /**************************************************************************
84 **************************************************************************/
86 extern GType grayswatch_get_type(void);
88 extern GtkWidget *grayswatch_new(guint gray);
91 * The gray value is between 0 and 255.
93 extern void grayswatch_set_gray(Grayswatch *gs, guint gray);
96 * Anything over 255 returned by this routine means an error.
98 extern guint grayswatch_get_gray(Grayswatch *gs);
101 * Block the signal from being emitted while setting the gray level.
102 * This is for a specific application and may not be useful anywhere else.
103 * No error checking is done to make sure blocking and unblocking are
106 extern void grayswatch_block_signal(Grayswatch *gs, gboolean block);
110 #endif /* _h_grayswatch */