]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkfontseldlg.sgml
docs/reference/gtk/tmpl/gtkfontseldlg.sgml, gdk/gdkwindow.c,
[~andy/gtk] / docs / reference / gtk / tmpl / gtkfontseldlg.sgml
1 <!-- ##### SECTION Title ##### -->
2 GtkFontSelectionDialog
3
4 <!-- ##### SECTION Short_Description ##### -->
5 a dialog box for selecting fonts.
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 The #GtkFontSelectionDialog widget is a dialog box for selecting a font.
10 </para>
11 <para>
12 To set the font which is initially selected, use
13 gtk_font_selection_dialog_set_font_name().
14 </para>
15 <para>
16 To get the selected font use gtk_font_selection_dialog_get_font()
17 or gtk_font_selection_dialog_get_font_name().
18 </para>
19 <para>
20 To change the text which is shown in the preview area, use
21 gtk_font_selection_dialog_set_preview_text().
22 </para>
23 <para>
24 Filters can be used to limit the fonts shown. There are 2 filters in the
25 #GtkFontSelectionDialog - a base filter and a user filter. The base filter
26 can not be changed by the user, so this can be used when the user must choose
27 from the restricted set of fonts (e.g. for a terminal-type application you may
28 want to force the user to select a fixed-width font). The user filter can be
29 changed or reset by the user, by using the 'Reset Filter' button or changing
30 the options on the 'Filter' page of the dialog.
31 </para>
32
33 <example>
34 <title>Setting a filter to show only fixed-width fonts.</title>
35 <programlisting>
36   gchar *spacings[] = { "c", "m", NULL };
37   gtk_font_selection_dialog_set_filter (GTK_FONT_SELECTION_DIALOG (fontsel),
38                                        GTK_FONT_FILTER_BASE, GTK_FONT_ALL,
39                                        NULL, NULL, NULL, NULL, spacings, NULL);
40 </programlisting>
41 </example>
42
43 <para>
44 To allow only true scalable fonts to be selected use:
45 </para>
46
47 <example>
48 <title>Setting a filter to show only true scalable fonts.</title>
49 <programlisting>
50   gtk_font_selection_dialog_set_filter (GTK_FONT_SELECTION_DIALOG (fontsel),
51                                        GTK_FONT_FILTER_BASE, GTK_FONT_SCALABLE,
52                                        NULL, NULL, NULL, NULL, NULL, NULL);
53 </programlisting>
54 </example>
55
56 <!-- ##### SECTION See_Also ##### -->
57 <para>
58 <variablelist>
59
60 <varlistentry>
61 <term>#GtkFontSelection</term>
62 <listitem><para>the underlying widget for selecting
63 fonts.</para></listitem>
64 <term>#GtkDialog</term>
65 <listitem><para>the parent class of GtkFontSelectionDialog</para></listitem>
66 </varlistentry>
67
68 </variablelist>
69 </para>
70
71 <!-- ##### STRUCT GtkFontSelectionDialog ##### -->
72
73
74 @ok_button: The OK button of the dialog
75 @apply_button: The Apply button of the dialog. This button is hidden
76 by default but you can show/hide it
77 @cancel_button: The Cancel button of the dialog
78
79 <!-- ##### FUNCTION gtk_font_selection_dialog_new ##### -->
80 <para>
81 Creates a new #GtkFontSelectionDialog.
82 </para>
83
84 @title: the title of the dialog box.
85 @Returns: a new #GtkFontSelectionDialog.
86
87
88 <!-- ##### FUNCTION gtk_font_selection_dialog_get_font ##### -->
89 <para>
90 Gets the currently-selected font.
91 </para>
92
93 @fsd: a #GtkFontSelectionDialog.
94 @Returns: the currently-selected font, or %NULL if no font is selected.
95
96
97 <!-- ##### FUNCTION gtk_font_selection_dialog_get_font_name ##### -->
98 <para>
99 Gets the currently-selected font name.
100 </para>
101
102 @fsd: a #GtkFontSelectionDialog.
103 @Returns: the currently-selected font name, or %NULL if no font is selected.
104
105
106 <!-- ##### FUNCTION gtk_font_selection_dialog_set_font_name ##### -->
107 <para>
108 Sets the currently-selected font.
109 </para>
110
111 @fsd: a #GtkFontSelectionDialog.
112 @fontname: a fontname.
113 @Returns: %TRUE if the font was found.
114
115
116 <!-- ##### FUNCTION gtk_font_selection_dialog_get_preview_text ##### -->
117 <para>
118 Gets the text displayed in the preview area.
119 </para>
120
121 @fsd: a #GtkFontSelectionDialog.
122 @Returns: the text displayed in the preview area. This string is owned
123    by the widget and should not be modified or freed.
124
125
126 <!-- ##### FUNCTION gtk_font_selection_dialog_set_preview_text ##### -->
127 <para>
128 Sets the text displayed in the preview area.
129 </para>
130
131 @fsd: a #GtkFontSelectionDialog.
132 @text: the text to display in the preview area.
133
134