| 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. See gtk_font_chooser_set_filter_func(). |
| 40 | * |
| 41 | * Returns: %TRUE if the font should be displayed |
| 42 | */ |
| 43 | typedef gboolean (*GtkFontFilterFunc) (const PangoFontFamily *family, |
| 44 | const PangoFontFace *face, |
| 45 | gpointer data); |
| 46 | |
| 47 | #define GTK_TYPE_FONT_CHOOSER (gtk_font_chooser_get_type ()) |
| 48 | #define GTK_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_CHOOSER, GtkFontChooser)) |
| 49 | #define GTK_IS_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_CHOOSER)) |
| 50 | #define GTK_FONT_CHOOSER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FONT_CHOOSER, GtkFontChooserIface)) |
| 51 | |
| 52 | typedef struct _GtkFontChooser GtkFontChooser; /* dummy */ |
| 53 | typedef struct _GtkFontChooserIface GtkFontChooserIface; |
| 54 | |
| 55 | struct _GtkFontChooserIface |
| 56 | { |
| 57 | GTypeInterface base_iface; |
| 58 | |
| 59 | /* Methods */ |
| 60 | PangoFontFamily * (* get_font_family) (GtkFontChooser *fontchooser); |
| 61 | PangoFontFace * (* get_font_face) (GtkFontChooser *fontchooser); |
| 62 | gint (* get_font_size) (GtkFontChooser *fontchooser); |
| 63 | |
| 64 | void (* set_filter_func) (GtkFontChooser *fontchooser, |
| 65 | GtkFontFilterFunc filter, |
| 66 | gpointer user_data, |
| 67 | GDestroyNotify destroy); |
| 68 | |
| 69 | /* Signals */ |
| 70 | void (* font_activated) (GtkFontChooser *chooser, |
| 71 | const gchar *fontname); |
| 72 | |
| 73 | /* More methods */ |
| 74 | void (* set_font_map) (GtkFontChooser *fontchooser, |
| 75 | PangoFontMap *fontmap); |
| 76 | PangoFontMap * (* get_font_map) (GtkFontChooser *fontchooser); |
| 77 | |
| 78 | /* Padding */ |
| 79 | gpointer padding[10]; |
| 80 | }; |
| 81 | |
| 82 | GDK_AVAILABLE_IN_3_2 |
| 83 | GType gtk_font_chooser_get_type (void) G_GNUC_CONST; |
| 84 | |
| 85 | GDK_AVAILABLE_IN_3_2 |
| 86 | PangoFontFamily *gtk_font_chooser_get_font_family (GtkFontChooser *fontchooser); |
| 87 | GDK_AVAILABLE_IN_3_2 |
| 88 | PangoFontFace *gtk_font_chooser_get_font_face (GtkFontChooser *fontchooser); |
| 89 | GDK_AVAILABLE_IN_3_2 |
| 90 | gint gtk_font_chooser_get_font_size (GtkFontChooser *fontchooser); |
| 91 | |
| 92 | GDK_AVAILABLE_IN_3_2 |
| 93 | PangoFontDescription * |
| 94 | gtk_font_chooser_get_font_desc (GtkFontChooser *fontchooser); |
| 95 | GDK_AVAILABLE_IN_3_2 |
| 96 | void gtk_font_chooser_set_font_desc (GtkFontChooser *fontchooser, |
| 97 | const PangoFontDescription *font_desc); |
| 98 | |
| 99 | GDK_AVAILABLE_IN_3_2 |
| 100 | gchar* gtk_font_chooser_get_font (GtkFontChooser *fontchooser); |
| 101 | |
| 102 | GDK_AVAILABLE_IN_3_2 |
| 103 | void gtk_font_chooser_set_font (GtkFontChooser *fontchooser, |
| 104 | const gchar *fontname); |
| 105 | GDK_AVAILABLE_IN_3_2 |
| 106 | gchar* gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser); |
| 107 | GDK_AVAILABLE_IN_3_2 |
| 108 | void gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser, |
| 109 | const gchar *text); |
| 110 | GDK_AVAILABLE_IN_3_2 |
| 111 | gboolean gtk_font_chooser_get_show_preview_entry (GtkFontChooser *fontchooser); |
| 112 | GDK_AVAILABLE_IN_3_2 |
| 113 | void gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser, |
| 114 | gboolean show_preview_entry); |
| 115 | GDK_AVAILABLE_IN_3_2 |
| 116 | void gtk_font_chooser_set_filter_func (GtkFontChooser *fontchooser, |
| 117 | GtkFontFilterFunc filter, |
| 118 | gpointer user_data, |
| 119 | GDestroyNotify destroy); |
| 120 | GDK_AVAILABLE_IN_3_18 |
| 121 | void gtk_font_chooser_set_font_map (GtkFontChooser *fontchooser, |
| 122 | PangoFontMap *fontmap); |
| 123 | GDK_AVAILABLE_IN_3_18 |
| 124 | PangoFontMap * gtk_font_chooser_get_font_map (GtkFontChooser *fontchooser); |
| 125 | |
| 126 | G_END_DECLS |
| 127 | |
| 128 | #endif /* __GTK_FONT_CHOOSER_H__ */ |
| 129 | |