diff options
author | Christian Persch <chpe@gnome.org> | 2011-09-12 01:49:26 +0200 |
---|---|---|
committer | Christian Persch <chpe@gnome.org> | 2011-09-13 12:55:21 +0200 |
commit | 5452525143ce10628080ceabf19cb1f68d5708a9 (patch) | |
tree | 33afac26fd60bd205d0a636ff516b8e7f0a9a221 /gtk/gtkfontchooser.h | |
parent | 291b04402864563425b34f2c00bc936642fd41f6 (diff) | |
download | gtk+-5452525143ce10628080ceabf19cb1f68d5708a9.tar.gz |
Make GtkFontChooser an interface
Make the GtkFontChooser API similar to the Gtk{File,Recent,App}Chooser
APIs by introducing GtkFontChooser as an interface, that has a default
implementation in GtkFontChooserWidget.
https://bugzilla.gnome.org/show_bug.cgi?id=657627
Diffstat (limited to 'gtk/gtkfontchooser.h')
-rw-r--r-- | gtk/gtkfontchooser.h | 122 |
1 files changed, 58 insertions, 64 deletions
diff --git a/gtk/gtkfontchooser.h b/gtk/gtkfontchooser.h index 4dd390780b..f7df871966 100644 --- a/gtk/gtkfontchooser.h +++ b/gtk/gtkfontchooser.h @@ -1,5 +1,8 @@ /* GTK - The GIMP Toolkit - * Copyright (C) 2011 Alberto Ruiz <aruiz@gnome.org> + * gtkfontchooser.h - Abstract interface for font file selectors GUIs + * + * Copyright (C) 2006, Emmanuele Bassi + * Copyright (C) 2011 Alberto Ruiz <aruiz@gnome.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -8,7 +11,7 @@ * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public @@ -24,71 +27,15 @@ #ifndef __GTK_FONT_CHOOSER_H__ #define __GTK_FONT_CHOOSER_H__ -#include <gtk/gtkbox.h> +#include <gtk/gtkwidget.h> G_BEGIN_DECLS -#define GTK_TYPE_FONT_CHOOSER (gtk_font_chooser_get_type ()) -#define GTK_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_CHOOSER, GtkFontChooser)) -#define GTK_FONT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_CHOOSER, GtkFontChooserClass)) -#define GTK_IS_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_CHOOSER)) -#define GTK_IS_FONT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_CHOOSER)) -#define GTK_FONT_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_CHOOSER, GtkFontChooserClass)) - -typedef struct _GtkFontChooser GtkFontChooser; -typedef struct _GtkFontChooserPrivate GtkFontChooserPrivate; -typedef struct _GtkFontChooserClass GtkFontChooserClass; - -struct _GtkFontChooser -{ - GtkBox parent_instance; - - /*< private >*/ - GtkFontChooserPrivate *priv; -}; - -struct _GtkFontChooserClass -{ - GtkBoxClass parent_class; - - void (* font_activated) (GtkFontChooser *chooser, - const gchar *fontname); - - /* Padding for future expansion */ - void (*_gtk_reserved1) (void); - void (*_gtk_reserved2) (void); - void (*_gtk_reserved3) (void); - void (*_gtk_reserved4) (void); -}; - -/***************************************************************************** - * GtkFontChooser functions. - * see the comments in the GtkFontChooserDialog functions. - *****************************************************************************/ - -GType gtk_font_chooser_get_type (void) G_GNUC_CONST; -GtkWidget* gtk_font_chooser_new (void); -PangoFontFamily* - gtk_font_chooser_get_family (GtkFontChooser *fontchooser); -PangoFontFace* - gtk_font_chooser_get_face (GtkFontChooser *fontchooser); -gint gtk_font_chooser_get_size (GtkFontChooser *fontchooser); -gchar* gtk_font_chooser_get_font_name (GtkFontChooser *fontchooser); - -gboolean gtk_font_chooser_set_font_name (GtkFontChooser *fontchooser, - const gchar *fontname); -const gchar* gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser); -void gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser, - const gchar *text); -gboolean gtk_font_chooser_get_show_preview_entry (GtkFontChooser *fontchooser); -void gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser, - gboolean show_preview_entry); - /** * GtkFontFilterFunc: * @family: a #PangoFontFamily * @face: a #PangoFontFace belonging to @family - * @data (closure): user data passed to gtk_font_chooser_set_filter_func() + * @data: (closure): user data passed to gtk_font_chooser_set_filter_func() * * The type of function that is used for deciding what fonts get * shown in a #GtkFontChooser. See gtk_font_chooser_set_filter_func(). @@ -99,10 +46,57 @@ typedef gboolean (*GtkFontFilterFunc) (const PangoFontFamily *family, const PangoFontFace *face, gpointer data); -void gtk_font_chooser_set_filter_func (GtkFontChooser *fontchooser, - GtkFontFilterFunc filter, - gpointer data, - GDestroyNotify destroy); +#define GTK_TYPE_FONT_CHOOSER (gtk_font_chooser_get_type ()) +#define GTK_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_CHOOSER, GtkFontChooser)) +#define GTK_IS_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_CHOOSER)) +#define GTK_FONT_CHOOSER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FONT_CHOOSER, GtkFontChooserIface)) + +typedef struct _GtkFontChooser GtkFontChooser; /* dummy */ +typedef struct _GtkFontChooserIface GtkFontChooserIface; + +struct _GtkFontChooserIface +{ + GTypeInterface base_iface; + + /* Methods */ + gchar * (* get_font_name) (GtkFontChooser *chooser); + gboolean (* set_font_name) (GtkFontChooser *chooser, + const gchar *fontname); + PangoFontFamily * (* get_font_family) (GtkFontChooser *chooser); + PangoFontFace * (* get_font_face) (GtkFontChooser *chooser); + gint (* get_font_size) (GtkFontChooser *chooser); + void (* set_filter_func) (GtkFontChooser *chooser, + GtkFontFilterFunc filter, + gpointer data, + GDestroyNotify destroy); + + /* Signals */ + void (* font_activated) (GtkFontChooser *chooser, + const gchar *fontname); + + /* Paddig */ + gpointer padding[12]; +}; + +GType gtk_font_chooser_get_type (void) G_GNUC_CONST; + +PangoFontFamily *gtk_font_chooser_get_family (GtkFontChooser *fontchooser); +PangoFontFace *gtk_font_chooser_get_face (GtkFontChooser *fontchooser); +gint gtk_font_chooser_get_size (GtkFontChooser *fontchooser); +gchar* gtk_font_chooser_get_font_name (GtkFontChooser *fontchooser); + +gboolean gtk_font_chooser_set_font_name (GtkFontChooser *fontchooser, + const gchar *font_name); +gchar* gtk_font_chooser_get_preview_text (GtkFontChooser *fontchooser); +void gtk_font_chooser_set_preview_text (GtkFontChooser *fontchooser, + const gchar *text); +gboolean gtk_font_chooser_get_show_preview_entry (GtkFontChooser *fontchooser); +void gtk_font_chooser_set_show_preview_entry (GtkFontChooser *fontchooser, + gboolean show_preview_entry); +void gtk_font_chooser_set_filter_func (GtkFontChooser *fontchooser, + GtkFontFilterFunc filter, + gpointer user_data, + GDestroyNotify destroy); G_END_DECLS |