]> Pileus Git - ~andy/gtk/blob - gtk/gtkfontchooser.h
a33220cbb2d696eda8a88e7f992bc7188532b616
[~andy/gtk] / gtk / gtkfontchooser.h
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, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
24 #error "Only <gtk/gtk.h> can be included directly."
25 #endif
26
27 #ifndef __GTK_FONT_CHOOSER_H__
28 #define __GTK_FONT_CHOOSER_H__
29
30 #include <gtk/gtkwidget.h>
31
32 G_BEGIN_DECLS
33
34 /**
35  * GtkFontFilterFunc:
36  * @family: a #PangoFontFamily
37  * @face: a #PangoFontFace belonging to @family
38  * @data: (closure): user data passed to gtk_font_chooser_set_filter_func()
39  *
40  * The type of function that is used for deciding what fonts get
41  * shown in a #GtkFontChooser. See gtk_font_chooser_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 #define GTK_TYPE_FONT_CHOOSER                   (gtk_font_chooser_get_type ())
50 #define GTK_FONT_CHOOSER(obj)                   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_CHOOSER, GtkFontChooser))
51 #define GTK_IS_FONT_CHOOSER(obj)                (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_CHOOSER))
52 #define GTK_FONT_CHOOSER_GET_IFACE(inst)        (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FONT_CHOOSER, GtkFontChooserIface))
53
54 typedef struct _GtkFontChooser      GtkFontChooser; /* dummy */
55 typedef struct _GtkFontChooserIface GtkFontChooserIface;
56
57 struct _GtkFontChooserIface
58 {
59   GTypeInterface base_iface;
60
61   /* Methods */
62   PangoFontFamily * (* get_font_family)         (GtkFontChooser  *chooser);
63   PangoFontFace *   (* get_font_face)           (GtkFontChooser  *chooser);
64   gint              (* get_font_size)           (GtkFontChooser  *chooser);
65
66   void              (* set_filter_func)         (GtkFontChooser   *chooser,
67                                                  GtkFontFilterFunc filter,
68                                                  gpointer          data,
69                                                  GDestroyNotify    destroy);
70
71   /* Signals */
72   void (* font_activated) (GtkFontChooser *chooser,
73                            const gchar    *fontname);
74
75    /* Padding */
76   gpointer padding[12];
77 };
78
79 GDK_AVAILABLE_IN_3_2
80 GType            gtk_font_chooser_get_type                 (void) G_GNUC_CONST;
81
82 GDK_AVAILABLE_IN_3_2
83 PangoFontFamily *gtk_font_chooser_get_font_family          (GtkFontChooser   *fontchooser);
84 GDK_AVAILABLE_IN_3_2
85 PangoFontFace   *gtk_font_chooser_get_font_face            (GtkFontChooser   *fontchooser);
86 GDK_AVAILABLE_IN_3_2
87 gint             gtk_font_chooser_get_font_size            (GtkFontChooser   *fontchooser);
88
89 GDK_AVAILABLE_IN_3_2
90 PangoFontDescription *
91                  gtk_font_chooser_get_font_desc            (GtkFontChooser             *fontchooser);
92 GDK_AVAILABLE_IN_3_2
93 void             gtk_font_chooser_set_font_desc            (GtkFontChooser             *fontchooser,
94                                                             const PangoFontDescription *font_desc);
95
96 GDK_AVAILABLE_IN_3_2
97 gchar*           gtk_font_chooser_get_font                 (GtkFontChooser   *fontchooser);
98
99 GDK_AVAILABLE_IN_3_2
100 void             gtk_font_chooser_set_font                 (GtkFontChooser   *fontchooser,
101                                                             const gchar      *fontname);
102 GDK_AVAILABLE_IN_3_2
103 gchar*           gtk_font_chooser_get_preview_text         (GtkFontChooser   *fontchooser);
104 GDK_AVAILABLE_IN_3_2
105 void             gtk_font_chooser_set_preview_text         (GtkFontChooser   *fontchooser,
106                                                             const gchar      *text);
107 GDK_AVAILABLE_IN_3_2
108 gboolean         gtk_font_chooser_get_show_preview_entry   (GtkFontChooser   *fontchooser);
109 GDK_AVAILABLE_IN_3_2
110 void             gtk_font_chooser_set_show_preview_entry   (GtkFontChooser   *fontchooser,
111                                                             gboolean          show_preview_entry);
112 GDK_AVAILABLE_IN_3_2
113 void             gtk_font_chooser_set_filter_func          (GtkFontChooser   *fontchooser,
114                                                             GtkFontFilterFunc filter,
115                                                             gpointer          user_data,
116                                                             GDestroyNotify    destroy);
117
118 G_END_DECLS
119
120 #endif /* __GTK_FONT_CHOOSER_H__ */