File: glyphtest.h

package info (click to toggle)
gbdfed 1.3patch1-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,696 kB
  • ctags: 2,336
  • sloc: ansic: 29,796; makefile: 138; sh: 23
file content (131 lines) | stat: -rw-r--r-- 3,705 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * Copyright 2006 Computing Research Labs, New Mexico State University
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#ifndef _h_glyphtest
#define _h_glyphtest

/*
 * $Id: glyphtest.h 1 2006-11-02 16:47:28Z mleisher $
 */

#include <gdk/gdk.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtksignal.h>
#include "bdfP.h"

G_BEGIN_DECLS

/*
 * The macros for accessing various parts of the widget class.
 */
#define GLYPHTEST(o) \
        (G_TYPE_CHECK_INSTANCE_CAST((o), glyphtest_get_type(), Glyphtest))

#define GLYPHTEST_CLASS(c) \
        (G_TYPE_CHECK_CLASS_CAST((c), glyphtest_get_type(), GlyphtestClass))

#define IS_GLYPHTEST(o) G_TYPE_CHECK_INSTANCE_TYPE((o), glyphtest_get_type())

#define IS_GLYPHTEST_CLASS(c) \
        (G_TYPE_CHECK_CLASS_TYPE((c), glyphtest_get_type()))

#define GLYPHTEST_GET_CLASS(o) \
        (G_TYPE_INSTANCE_GET_CLASS((o), glyphtest_get_type(), GlyphtestClass))

typedef struct _Glyphtest      Glyphtest;
typedef struct _GlyphtestClass GlyphtestClass;

typedef struct {
    bdf_font_t *font;
    bdf_glyph_t *glyph;
} GlyphtestGlyph;

typedef struct {
    GlyphtestGlyph *glyphs;
    guint32 glyphs_used;
    guint32 glyphs_size;
    GdkPoint cpoint;
    guint16 width;
    guint16 height;
    bdf_bbx_t bbx;
} GlyphtestLine;

struct _Glyphtest {
    GtkWidget widget;

    /*
     * Public members.
     */
    guint dir;
    gboolean show_baseline;
#if 0
    /* ENABLE WHEN COLORS ARE WORKING. */
    gulong *colors;
#endif

    /*
     * Private members.
     */
    GlyphtestLine line;

    /*
     * The points used to draw the glyphs.
     */
    GdkPoint *image;
    guint32 image_used;
    guint32 image_size;

    guint16 vmargin;
    guint16 hmargin;
    guint16 focus_thickness;
};

struct _GlyphtestClass {
    GtkWidgetClass parent_class;

    void (*glyph_added)(GtkWidget *, gpointer);
};

/**************************************************************************
 *
 * General API
 *
 **************************************************************************/

extern GType glyphtest_get_type(void);
extern GtkWidget *glyphtest_new(void);

/*
 * Direction values for the change_direction call.
 */
#define GLYPHTEST_LEFT_TO_RIGHT 0
#define GLYPHTEST_RIGHT_TO_LEFT 1

extern void glyphtest_add_glyph(Glyphtest *, bdf_font_t *, bdf_glyph_t *);
extern void glyphtest_remove_font(Glyphtest *, bdf_font_t *);
extern void glyphtest_update_device_width(Glyphtest *, bdf_font_t *);
extern void glyphtest_change_direction(Glyphtest *, gint direction);
extern void glyphtest_show_baseline(Glyphtest *, gboolean baseline);
extern void glyphtest_erase(Glyphtest *);

G_END_DECLS

#endif /* _h_glyphtest */