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/gtkdrawingarea.h>
27 #include "gtkcompat.h"
31 #define GECONTROL(obj) \
32 (G_TYPE_CHECK_INSTANCE_CAST(obj, gecontrol_get_type(), GEControl))
33 #define GECONTROL_CLASS(klass) \
34 (G_TYPE_CHECK_CLASS_CAST(klass, gecontrol_get_type(), GEControlClass))
36 #define IS_GECONTROL(obj) \
37 (G_TYPE_CHECK_INSTANCE_TYPE(obj, gecontrol_get_type()))
38 #define IS_GECONTROL_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_TYPE(klass, gecontrol_get_type()))
41 #define GECONTROL_GET_CLASS(obj) \
42 (G_TYPE_INSTANCE_GET_CLASS(obj, gecontrol_get_type(), GEControlClass))
44 typedef struct _GEControl GEControl;
45 typedef struct _GEControlClass GEControlClass;
51 GECONTROL_FLIP_HORIZONTAL,
52 GECONTROL_FLIP_VERTICAL,
54 GECONTROL_ROTATE_LEFT_90,
55 GECONTROL_ROTATE_RIGHT_90,
57 GECONTROL_SHIFT_UP_LEFT,
59 GECONTROL_SHIFT_UP_RIGHT,
61 GECONTROL_SHIFT_RIGHT,
62 GECONTROL_SHIFT_DOWN_LEFT,
64 GECONTROL_SHIFT_DOWN_RIGHT,
65 GECONTROL_COLOR_CHANGE
69 * Structure passed to the "activate" signal handler.
72 GEControlOperation operation;
74 } GEControlActivateInfo;
82 gint other_toggles[2];
104 bdf_bitmap_t *gimage;
107 * An application provided label widget where the help
110 GtkWidget *tip_label;
113 * The list of colors to use.
123 * The current color index.
128 * 16 color spots. Used to track mouse position and update the tip label.
131 GdkRegion *spot_region;
134 * Timer stuff for holding down the buttons.
145 * Buffer for building a grayscale glyph image.
151 GEControlButton buttons[18];
154 struct _GEControlClass {
155 GtkDrawingAreaClass parent_class;
158 * A GC for drawing the color selection rectangle.
188 void (*activate)(GtkWidget *, gpointer, gpointer);
191 extern GType gecontrol_get_type(void);
193 extern GtkWidget *gecontrol_new(const gchar *prop1, ...);
195 extern GtkWidget *gecontrol_newv(GtkWidget *tips_label, bdf_bitmap_t *image,
198 extern void gecontrol_set_glyph_image(GEControl *ge, bdf_bitmap_t *image);
200 extern void gecontrol_update_glyph_image(GEControl *ge, bdf_bitmap_t *image);
202 extern void gecontrol_set_color_list(GEControl *ge, guint16 *colors);
204 extern void gecontrol_change_operation(GEControl *ge, GEControlOperation op);
206 extern void gecontrol_change_color(GEControl *ge, gint cidx);
210 #endif /* _h_gectrl */