]> git.kernelconcepts.de Git - gbdfed.git/blob - glyphtest.h
Fixup several compile faults due to changes in recent distributions,
[gbdfed.git] / glyphtest.h
1 /*
2  * Copyright 2008 Department of Mathematical Sciences, New Mexico State University
3  *
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:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
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.
21  */
22 #ifndef _h_glyphtest
23 #define _h_glyphtest
24
25 #include <gdk/gdk.h>
26 #include <gtk/gtkwidget.h>
27 #include <gtk/gtksignal.h>
28 #include "bdfP.h"
29 #include "gtkcompat.h"
30
31 G_BEGIN_DECLS
32
33 /*
34  * The macros for accessing various parts of the widget class.
35  */
36 #define GLYPHTEST(o) \
37         (G_TYPE_CHECK_INSTANCE_CAST((o), glyphtest_get_type(), Glyphtest))
38
39 #define GLYPHTEST_CLASS(c) \
40         (G_TYPE_CHECK_CLASS_CAST((c), glyphtest_get_type(), GlyphtestClass))
41
42 #define IS_GLYPHTEST(o) G_TYPE_CHECK_INSTANCE_TYPE((o), glyphtest_get_type())
43
44 #define IS_GLYPHTEST_CLASS(c) \
45         (G_TYPE_CHECK_CLASS_TYPE((c), glyphtest_get_type()))
46
47 #define GLYPHTEST_GET_CLASS(o) \
48         (G_TYPE_INSTANCE_GET_CLASS((o), glyphtest_get_type(), GlyphtestClass))
49
50 typedef struct _Glyphtest      Glyphtest;
51 typedef struct _GlyphtestClass GlyphtestClass;
52
53 typedef struct {
54     bdf_font_t *font;
55     bdf_glyph_t *glyph;
56 } GlyphtestGlyph;
57
58 typedef struct {
59     GlyphtestGlyph *glyphs;
60     guint32 glyphs_used;
61     guint32 glyphs_size;
62     GdkPoint cpoint;
63     guint16 width;
64     guint16 height;
65     bdf_bbx_t bbx;
66 } GlyphtestLine;
67
68 struct _Glyphtest {
69     GtkWidget widget;
70
71     /*
72      * Public members.
73      */
74     guint dir;
75     gboolean show_baseline;
76 #if 0
77     /* ENABLE WHEN COLORS ARE WORKING. */
78     gulong *colors;
79 #endif
80
81     /*
82      * Private members.
83      */
84     GlyphtestLine line;
85
86     /*
87      * The points used to draw the glyphs.
88      */
89     GdkPoint *image;
90     guint32 image_used;
91     guint32 image_size;
92
93     guint16 vmargin;
94     guint16 hmargin;
95     guint16 focus_thickness;
96 };
97
98 struct _GlyphtestClass {
99     GtkWidgetClass parent_class;
100
101     void (*glyph_added)(GtkWidget *, gpointer);
102 };
103
104 /**************************************************************************
105  *
106  * General API
107  *
108  **************************************************************************/
109
110 extern GType glyphtest_get_type(void);
111 extern GtkWidget *glyphtest_new(void);
112
113 /*
114  * Direction values for the change_direction call.
115  */
116 #define GLYPHTEST_LEFT_TO_RIGHT 0
117 #define GLYPHTEST_RIGHT_TO_LEFT 1
118
119 extern void glyphtest_add_glyph(Glyphtest *, bdf_font_t *, bdf_glyph_t *);
120 extern void glyphtest_remove_font(Glyphtest *, bdf_font_t *);
121 extern void glyphtest_update_device_width(Glyphtest *, bdf_font_t *);
122 extern void glyphtest_change_direction(Glyphtest *, gint direction);
123 extern void glyphtest_show_baseline(Glyphtest *, gboolean baseline);
124 extern void glyphtest_erase(Glyphtest *);
125
126 G_END_DECLS
127
128 #endif /* _h_glyphtest */