1 | /* GTK - The GIMP Toolkit |
2 | * gtkfontchooser.h - Abstract interface for font file selectors GUIs |
3 | * |
4 | * Copyright (C) 2006, Emmanuele Bassi |
5 | * Copyright (C) 2011 Alberto Ruiz <aruiz@gnome.org> |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Lesser General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Lesser General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Lesser General Public |
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
19 | */ |
20 | |
21 | #ifndef __GTK_FONT_CHOOSER_H__ |
22 | #define __GTK_FONT_CHOOSER_H__ |
23 | |
24 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
25 | #error "Only <gtk/gtk.h> can be included directly." |
26 | #endif |
27 | |
28 | #include <gtk/gtkwidget.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
32 | /** |
33 | * GtkFontFilterFunc: |
34 | * @family: a `PangoFontFamily` |
35 | * @face: a `PangoFontFace` belonging to @family |
36 | * @data: (closure): user data passed to gtk_font_chooser_set_filter_func() |
37 | * |
38 | * The type of function that is used for deciding what fonts get |
39 | * shown in a `GtkFontChooser`. |
40 | * |
41 | * See [method@Gtk.FontChooser.set_filter_func]. |
42 | * |
43 | * Returns: %TRUE if the font should be displayed |
44 | */ |
45 | typedef gboolean (*GtkFontFilterFunc) (const PangoFontFamily *family, |
46 | const PangoFontFace *face, |
47 | gpointer data); |
48 | |
49 | /** |
50 | * GtkFontChooserLevel: |
51 | * @GTK_FONT_CHOOSER_LEVEL_FAMILY: Allow selecting a font family |
52 | * @GTK_FONT_CHOOSER_LEVEL_STYLE: Allow selecting a specific font face |
53 | * @GTK_FONT_CHOOSER_LEVEL_SIZE: Allow selecting a specific font size |
54 | * @GTK_FONT_CHOOSER_LEVEL_VARIATIONS: Allow changing OpenType font variation axes |
55 | * @GTK_FONT_CHOOSER_LEVEL_FEATURES: Allow selecting specific OpenType font features |
56 | * |
57 | * Specifies the granularity of font selection |
58 | * that is desired in a `GtkFontChooser`. |
59 | * |
60 | * This enumeration may be extended in the future; applications should |
61 | * ignore unknown values. |
62 | */ |
63 | typedef enum { |
64 | GTK_FONT_CHOOSER_LEVEL_FAMILY = 0, |
65 | GTK_FONT_CHOOSER_LEVEL_STYLE = 1 << 0, |
66 | GTK_FONT_CHOOSER_LEVEL_SIZE = 1 << 1, |
67 | GTK_FONT_CHOOSER_LEVEL_VARIATIONS = 1 << 2, |
68 | GTK_FONT_CHOOSER_LEVEL_FEATURES = 1 << 3 |
69 | } GtkFontChooserLevel; |
70 | |
71 | #define GTK_TYPE_FONT_CHOOSER (gtk_font_chooser_get_type ()) |
72 | #define GTK_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_CHOOSER, GtkFontChooser)) |
73 | #define GTK_IS_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_CHOOSER)) |
74 | #define GTK_FONT_CHOOSER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FONT_CHOOSER, GtkFontChooserIface)) |
75 | |
76 | typedef struct _GtkFontChooser GtkFontChooser; /* dummy */ |
77 | typedef struct _GtkFontChooserIface GtkFontChooserIface; |
78 | |
79 | struct _GtkFontChooserIface |
80 | { |
81 | GTypeInterface base_iface; |
82 | |
83 | /* Methods */ |
84 | PangoFontFamily * (* get_font_family) (GtkFontChooser *fontchooser); |
85 | PangoFontFace * (* get_font_face) (GtkFontChooser *fontchooser); |
86 | int (* get_font_size) (GtkFontChooser *fontchooser); |
87 | |
88 | void (* set_filter_func) (GtkFontChooser *fontchooser, |
89 | GtkFontFilterFunc filter, |
90 | gpointer user_data, |
91 | GDestroyNotify destroy); |
92 | |
93 | /* Signals */ |
94 | void (* font_activated) (GtkFontChooser *chooser, |
95 | const char *fontname); |
96 | |
97 | /* More methods */ |
98 | void (* set_font_map) (GtkFontChooser *fontchooser, |
99 | PangoFontMap *fontmap); |
100 | PangoFontMap * (* get_font_map) (GtkFontChooser *fontchooser); |
101 | |
102 | /*< private >*/ |
103 | /* Padding; remove in GTK-next */ |
104 | gpointer padding[10]; |
105 | }; |
106 | |
107 | GDK_AVAILABLE_IN_ALL |
108 | GType gtk_font_chooser_get_type (void) G_GNUC_CONST; |
109 | |
110 | GDK_AVAILABLE_IN_ALL |
111 | PangoFontFamily *gtk_font_chooser_get_font_family (GtkFontChooser *fontchooser); |
112 | GDK_AVAILABLE_IN_ALL |
113 | PangoFontFace *gtk_font_chooser_get_font_face (GtkFontChooser *fontchooser); |
114 | GDK_AVAILABLE_IN_ALL |
115 | int gtk_font_chooser_get_font_size (GtkFontChooser *fontchooser); |
116 | |
117 | GDK_AVAILABLE_IN_ALL |
118 | PangoFontDescription * |
119 | gtk_font_chooser_get_font_desc (GtkFontChooser *fontchooser); |
120 | GDK_AVAILABLE_IN_ALL |
121 | void gtk_font_chooser_set_font_desc (GtkFontChooser *fontchooser, |
122 | const PangoFontDescription *font_desc); |
123 | |
124 | GDK_AVAILABLE_IN_ALL |
125 | char * gtk_font_chooser_get_font (GtkFontChooser *fontchooser); |
126 | |
127 | GDK_AVAILABLE_IN_ALL |
128 | void gtk_font_chooser_set_font (GtkFontChooser *fontchooser, |
129 | const char *fontname); |
130 | GDK_AVAILABLE_IN_ALL |
131 | char * gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser); |
132 | GDK_AVAILABLE_IN_ALL |
133 | void gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser, |
134 | const char *text); |
135 | GDK_AVAILABLE_IN_ALL |
136 | gboolean gtk_font_chooser_get_show_preview_entry (GtkFontChooser *fontchooser); |
137 | GDK_AVAILABLE_IN_ALL |
138 | void gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser, |
139 | gboolean show_preview_entry); |
140 | GDK_AVAILABLE_IN_ALL |
141 | void gtk_font_chooser_set_filter_func (GtkFontChooser *fontchooser, |
142 | GtkFontFilterFunc filter, |
143 | gpointer user_data, |
144 | GDestroyNotify destroy); |
145 | GDK_AVAILABLE_IN_ALL |
146 | void gtk_font_chooser_set_font_map (GtkFontChooser *fontchooser, |
147 | PangoFontMap *fontmap); |
148 | GDK_AVAILABLE_IN_ALL |
149 | PangoFontMap * gtk_font_chooser_get_font_map (GtkFontChooser *fontchooser); |
150 | GDK_AVAILABLE_IN_ALL |
151 | void gtk_font_chooser_set_level (GtkFontChooser *fontchooser, |
152 | GtkFontChooserLevel level); |
153 | GDK_AVAILABLE_IN_ALL |
154 | GtkFontChooserLevel |
155 | gtk_font_chooser_get_level (GtkFontChooser *fontchooser); |
156 | GDK_AVAILABLE_IN_ALL |
157 | char * gtk_font_chooser_get_font_features (GtkFontChooser *fontchooser); |
158 | GDK_AVAILABLE_IN_ALL |
159 | char * gtk_font_chooser_get_language (GtkFontChooser *fontchooser); |
160 | GDK_AVAILABLE_IN_ALL |
161 | void gtk_font_chooser_set_language (GtkFontChooser *fontchooser, |
162 | const char *language); |
163 | |
164 | G_END_DECLS |
165 | |
166 | #endif /* __GTK_FONT_CHOOSER_H__ */ |
167 | |