Sebastian Kuschel reports that pfd_closing can be called for a socket
[u/mdw/putty] / unix / gtkfont.h
1 /*
2 * Header file for gtkfont.c. Has to be separate from unix.h
3 * because it depends on GTK data types, hence can't be included
4 * from cross-platform code (which doesn't go near GTK).
5 */
6
7 #ifndef PUTTY_GTKFONT_H
8 #define PUTTY_GTKFONT_H
9
10 /*
11 * Exports from gtkfont.c.
12 */
13 struct unifont_vtable; /* contents internal to gtkfont.c */
14 typedef struct unifont {
15 const struct unifont_vtable *vt;
16 /*
17 * `Non-static data members' of the `class', accessible to
18 * external code.
19 */
20
21 /*
22 * public_charset is the charset used when the user asks for
23 * `Use font encoding'.
24 */
25 int public_charset;
26
27 /*
28 * Font dimensions needed by clients.
29 */
30 int width, height, ascent, descent;
31
32 /*
33 * Indicates whether this font is capable of handling all glyphs
34 * (Pango fonts can do this because Pango automatically supplies
35 * missing glyphs from other fonts), or whether it would like a
36 * fallback font to cope with missing glyphs.
37 */
38 int want_fallback;
39 } unifont;
40
41 unifont *unifont_create(GtkWidget *widget, const char *name,
42 int wide, int bold,
43 int shadowoffset, int shadowalways);
44 void unifont_destroy(unifont *font);
45 void unifont_draw_text(GdkDrawable *target, GdkGC *gc, unifont *font,
46 int x, int y, const wchar_t *string, int len,
47 int wide, int bold, int cellwidth);
48
49 /*
50 * This function behaves exactly like the low-level unifont_create,
51 * except that as well as the requested font it also allocates (if
52 * necessary) a fallback font for filling in replacement glyphs.
53 *
54 * Return value is usable with unifont_destroy and unifont_draw_text
55 * as if it were an ordinary unifont.
56 */
57 unifont *multifont_create(GtkWidget *widget, const char *name,
58 int wide, int bold,
59 int shadowoffset, int shadowalways);
60
61 /*
62 * Unified font selector dialog. I can't be bothered to do a
63 * proper GTK subclassing today, so this will just be an ordinary
64 * data structure with some useful members.
65 *
66 * (Of course, these aren't the only members; this structure is
67 * contained within a bigger one which holds data visible only to
68 * the implementation.)
69 */
70 typedef struct unifontsel {
71 void *user_data; /* settable by the user */
72 GtkWindow *window;
73 GtkWidget *ok_button, *cancel_button;
74 } unifontsel;
75
76 unifontsel *unifontsel_new(const char *wintitle);
77 void unifontsel_destroy(unifontsel *fontsel);
78 void unifontsel_set_name(unifontsel *fontsel, const char *fontname);
79 char *unifontsel_get_name(unifontsel *fontsel);
80
81 #endif /* PUTTY_GTKFONT_H */