No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

gtkfontsel.h 9.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * GtkFontSelection widget for Gtk+, by Damon Chaplin, May 1998.
  5. * Based on the GnomeFontSelector widget, by Elliot Lee, but major changes.
  6. * The GnomeFontSelector was derived from app/text_tool.c in the GIMP.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the
  20. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. * Boston, MA 02111-1307, USA.
  22. */
  23. /*
  24. * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
  25. * file for a list of people on the GTK+ Team. See the ChangeLog
  26. * files for a list of changes. These files are distributed with
  27. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  28. */
  29. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  30. #error "Only <gtk/gtk.h> can be included directly."
  31. #endif
  32. #ifndef __GTK_FONTSEL_H__
  33. #define __GTK_FONTSEL_H__
  34. #include <gtk/gtkdialog.h>
  35. #include <gtk/gtkvbox.h>
  36. G_BEGIN_DECLS
  37. #define GTK_TYPE_FONT_SELECTION (gtk_font_selection_get_type ())
  38. #define GTK_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelection))
  39. #define GTK_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
  40. #define GTK_IS_FONT_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION))
  41. #define GTK_IS_FONT_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION))
  42. #define GTK_FONT_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION, GtkFontSelectionClass))
  43. #define GTK_TYPE_FONT_SELECTION_DIALOG (gtk_font_selection_dialog_get_type ())
  44. #define GTK_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialog))
  45. #define GTK_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
  46. #define GTK_IS_FONT_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FONT_SELECTION_DIALOG))
  47. #define GTK_IS_FONT_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FONT_SELECTION_DIALOG))
  48. #define GTK_FONT_SELECTION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_SELECTION_DIALOG, GtkFontSelectionDialogClass))
  49. typedef struct _GtkFontSelection GtkFontSelection;
  50. typedef struct _GtkFontSelectionClass GtkFontSelectionClass;
  51. typedef struct _GtkFontSelectionDialog GtkFontSelectionDialog;
  52. typedef struct _GtkFontSelectionDialogClass GtkFontSelectionDialogClass;
  53. struct _GtkFontSelection
  54. {
  55. GtkVBox parent_instance;
  56. GtkWidget *GSEAL (font_entry); /* Used _get_family_entry() for consistency, -mr */
  57. GtkWidget *GSEAL (family_list);
  58. GtkWidget *GSEAL (font_style_entry); /* Used _get_face_entry() for consistency, -mr */
  59. GtkWidget *GSEAL (face_list);
  60. GtkWidget *GSEAL (size_entry);
  61. GtkWidget *GSEAL (size_list);
  62. GtkWidget *GSEAL (pixels_button); /* Unused, -mr */
  63. GtkWidget *GSEAL (points_button); /* Unused, -mr */
  64. GtkWidget *GSEAL (filter_button); /* Unused, -mr */
  65. GtkWidget *GSEAL (preview_entry);
  66. PangoFontFamily *GSEAL (family); /* Current family */
  67. PangoFontFace *GSEAL (face); /* Current face */
  68. gint GSEAL (size);
  69. GdkFont *GSEAL (font); /* Cache for gdk_font_selection_get_font, so we can preserve
  70. * refcounting behavior
  71. */
  72. };
  73. struct _GtkFontSelectionClass
  74. {
  75. GtkVBoxClass parent_class;
  76. /* Padding for future expansion */
  77. void (*_gtk_reserved1) (void);
  78. void (*_gtk_reserved2) (void);
  79. void (*_gtk_reserved3) (void);
  80. void (*_gtk_reserved4) (void);
  81. };
  82. struct _GtkFontSelectionDialog
  83. {
  84. GtkDialog parent_instance;
  85. /*< private >*/
  86. GtkWidget *GSEAL (fontsel);
  87. GtkWidget *GSEAL (main_vbox); /* Not wrapped with an API, can use GTK_DIALOG->vbox instead, -mr */
  88. GtkWidget *GSEAL (action_area); /* Not wrapped with an API, can use GTK_DIALOG->action_area instead, -mr */
  89. /*< public >*/
  90. GtkWidget *GSEAL (ok_button);
  91. GtkWidget *GSEAL (apply_button);
  92. GtkWidget *GSEAL (cancel_button);
  93. /*< private >*/
  94. /* If the user changes the width of the dialog, we turn auto-shrink off.
  95. * (Unused now, autoshrink doesn't mean anything anymore -Yosh)
  96. */
  97. gint GSEAL (dialog_width);
  98. gboolean GSEAL (auto_resize);
  99. };
  100. struct _GtkFontSelectionDialogClass
  101. {
  102. GtkDialogClass parent_class;
  103. /* Padding for future expansion */
  104. void (*_gtk_reserved1) (void);
  105. void (*_gtk_reserved2) (void);
  106. void (*_gtk_reserved3) (void);
  107. void (*_gtk_reserved4) (void);
  108. };
  109. /*****************************************************************************
  110. * GtkFontSelection functions.
  111. * see the comments in the GtkFontSelectionDialog functions.
  112. *****************************************************************************/
  113. GType gtk_font_selection_get_type (void) G_GNUC_CONST;
  114. GtkWidget * gtk_font_selection_new (void);
  115. GtkWidget * gtk_font_selection_get_family_list (GtkFontSelection *fontsel);
  116. GtkWidget * gtk_font_selection_get_face_list (GtkFontSelection *fontsel);
  117. GtkWidget * gtk_font_selection_get_size_entry (GtkFontSelection *fontsel);
  118. GtkWidget * gtk_font_selection_get_size_list (GtkFontSelection *fontsel);
  119. GtkWidget * gtk_font_selection_get_preview_entry (GtkFontSelection *fontsel);
  120. PangoFontFamily *
  121. gtk_font_selection_get_family (GtkFontSelection *fontsel);
  122. PangoFontFace *
  123. gtk_font_selection_get_face (GtkFontSelection *fontsel);
  124. gint gtk_font_selection_get_size (GtkFontSelection *fontsel);
  125. gchar* gtk_font_selection_get_font_name (GtkFontSelection *fontsel);
  126. #ifndef GTK_DISABLE_DEPRECATED
  127. GdkFont* gtk_font_selection_get_font (GtkFontSelection *fontsel);
  128. #endif /* GTK_DISABLE_DEPRECATED */
  129. gboolean gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
  130. const gchar *fontname);
  131. const gchar* gtk_font_selection_get_preview_text (GtkFontSelection *fontsel);
  132. void gtk_font_selection_set_preview_text (GtkFontSelection *fontsel,
  133. const gchar *text);
  134. /*****************************************************************************
  135. * GtkFontSelectionDialog functions.
  136. * most of these functions simply call the corresponding function in the
  137. * GtkFontSelection.
  138. *****************************************************************************/
  139. GType gtk_font_selection_dialog_get_type (void) G_GNUC_CONST;
  140. GtkWidget *gtk_font_selection_dialog_new (const gchar *title);
  141. GtkWidget *gtk_font_selection_dialog_get_ok_button (GtkFontSelectionDialog *fsd);
  142. #ifndef GTK_DISABLE_DEPRECATED
  143. GtkWidget *gtk_font_selection_dialog_get_apply_button (GtkFontSelectionDialog *fsd);
  144. #endif
  145. GtkWidget *gtk_font_selection_dialog_get_cancel_button (GtkFontSelectionDialog *fsd);
  146. GtkWidget *gtk_font_selection_dialog_get_font_selection (GtkFontSelectionDialog *fsd);
  147. /* This returns the X Logical Font Description fontname, or NULL if no font
  148. is selected. Note that there is a slight possibility that the font might not
  149. have been loaded OK. You should call gtk_font_selection_dialog_get_font()
  150. to see if it has been loaded OK.
  151. You should g_free() the returned font name after you're done with it. */
  152. gchar* gtk_font_selection_dialog_get_font_name (GtkFontSelectionDialog *fsd);
  153. #ifndef GTK_DISABLE_DEPRECATED
  154. /* This will return the current GdkFont, or NULL if none is selected or there
  155. was a problem loading it. Remember to use gdk_font_ref/unref() if you want
  156. to use the font (in a style, for example). */
  157. GdkFont* gtk_font_selection_dialog_get_font (GtkFontSelectionDialog *fsd);
  158. #endif /* GTK_DISABLE_DEPRECATED */
  159. /* This sets the currently displayed font. It should be a valid X Logical
  160. Font Description font name (anything else will be ignored), e.g.
  161. "-adobe-courier-bold-o-normal--25-*-*-*-*-*-*-*"
  162. It returns TRUE on success. */
  163. gboolean gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd,
  164. const gchar *fontname);
  165. /* This returns the text in the preview entry. You should copy the returned
  166. text if you need it. */
  167. G_CONST_RETURN gchar*
  168. gtk_font_selection_dialog_get_preview_text (GtkFontSelectionDialog *fsd);
  169. /* This sets the text in the preview entry. It will be copied by the entry,
  170. so there's no need to g_strdup() it first. */
  171. void gtk_font_selection_dialog_set_preview_text (GtkFontSelectionDialog *fsd,
  172. const gchar *text);
  173. G_END_DECLS
  174. #endif /* __GTK_FONTSEL_H__ */