]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkfontseldlg.sgml
Minor documentation fixes
[~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 fonts.</para></listitem>
63 </varlistentry>
64
65 </variablelist>
66 </para>
67
68 <!-- ##### STRUCT GtkFontSelectionDialog ##### -->
69 <para>
70 The #GtkFontSelectionDialog struct contains private data only, and should
71 only be accessed using the functions below.
72 </para>
73
74
75 <!-- ##### FUNCTION gtk_font_selection_dialog_new ##### -->
76 <para>
77 Creates a new #GtkFontSelectionDialog.
78 </para>
79
80 @title: the title of the dialog box.
81 @Returns: a new #GtkFontSelectionDialog.
82
83
84 <!-- ##### FUNCTION gtk_font_selection_dialog_get_font ##### -->
85 <para>
86 Gets the currently-selected font.
87 </para>
88
89 @fsd: a #GtkFontSelectionDialog.
90 @Returns: the currently-selected font, or %NULL if no font is selected.
91
92
93 <!-- ##### FUNCTION gtk_font_selection_dialog_get_font_name ##### -->
94 <para>
95 Gets the currently-selected font name.
96 </para>
97
98 @fsd: a #GtkFontSelectionDialog.
99 @Returns: the currently-selected font name, or %NULL if no font is selected.
100
101
102 <!-- ##### FUNCTION gtk_font_selection_dialog_set_font_name ##### -->
103 <para>
104 Sets the currently-selected font.
105 </para>
106
107 @fsd: a #GtkFontSelectionDialog.
108 @fontname: a fontname.
109 @Returns: %TRUE if the font was found.
110
111
112 <!-- ##### FUNCTION gtk_font_selection_dialog_get_preview_text ##### -->
113 <para>
114 Gets the text displayed in the preview area.
115 </para>
116
117 @fsd: a #GtkFontSelectionDialog.
118 @Returns: the text displayed in the preview area. This string is owned
119    by the widget and should not be modified or freed.
120
121
122 <!-- ##### FUNCTION gtk_font_selection_dialog_set_preview_text ##### -->
123 <para>
124 Sets the text displayed in the preview area.
125 </para>
126
127 @fsd: a #GtkFontSelectionDialog.
128 @text: the text to display in the preview area.
129
130