1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.FontChooserIF;
26 
27 private import glib.Str;
28 private import gobject.ObjectG;
29 private import gobject.Signals;
30 public  import gtkc.gdktypes;
31 private import gtkc.gtk;
32 public  import gtkc.gtktypes;
33 private import pango.PgFontDescription;
34 private import pango.PgFontFace;
35 private import pango.PgFontFamily;
36 private import pango.PgFontMap;
37 private import std.algorithm;
38 
39 
40 /**
41  * #GtkFontChooser is an interface that can be implemented by widgets
42  * displaying the list of fonts. In GTK+, the main objects
43  * that implement this interface are #GtkFontChooserWidget,
44  * #GtkFontChooserDialog and #GtkFontButton. The GtkFontChooser interface
45  * has been introducted in GTK+ 3.2.
46  */
47 public interface FontChooserIF{
48 	/** Get the main Gtk struct */
49 	public GtkFontChooser* getFontChooserStruct();
50 
51 	/** the main Gtk struct as a void* */
52 	protected void* getStruct();
53 
54 
55 	/**
56 	 * Gets the currently-selected font name.
57 	 *
58 	 * Note that this can be a different string than what you set with
59 	 * gtk_font_chooser_set_font(), as the font chooser widget may
60 	 * normalize font names and thus return a string with a different
61 	 * structure. For example, “Helvetica Italic Bold 12” could be
62 	 * normalized to “Helvetica Bold Italic 12”.
63 	 *
64 	 * Use pango_font_description_equal() if you want to compare two
65 	 * font descriptions.
66 	 *
67 	 * Return: A string with the name
68 	 *     of the current font, or %NULL if  no font is selected. You must
69 	 *     free this string with g_free().
70 	 *
71 	 * Since: 3.2
72 	 */
73 	public string getFont();
74 
75 	/**
76 	 * Gets the currently-selected font.
77 	 *
78 	 * Note that this can be a different string than what you set with
79 	 * gtk_font_chooser_set_font(), as the font chooser widget may
80 	 * normalize font names and thus return a string with a different
81 	 * structure. For example, “Helvetica Italic Bold 12” could be
82 	 * normalized to “Helvetica Bold Italic 12”.
83 	 *
84 	 * Use pango_font_description_equal() if you want to compare two
85 	 * font descriptions.
86 	 *
87 	 * Return: A #PangoFontDescription for the
88 	 *     current font, or %NULL if  no font is selected.
89 	 *
90 	 * Since: 3.2
91 	 */
92 	public PgFontDescription getFontDesc();
93 
94 	/**
95 	 * Gets the #PangoFontFace representing the selected font group
96 	 * details (i.e. family, slant, weight, width, etc).
97 	 *
98 	 * If the selected font is not installed, returns %NULL.
99 	 *
100 	 * Return: A #PangoFontFace representing the
101 	 *     selected font group details, or %NULL. The returned object is owned by
102 	 *     @fontchooser and must not be modified or freed.
103 	 *
104 	 * Since: 3.2
105 	 */
106 	public PgFontFace getFontFace();
107 
108 	/**
109 	 * Gets the #PangoFontFamily representing the selected font family.
110 	 * Font families are a collection of font faces.
111 	 *
112 	 * If the selected font is not installed, returns %NULL.
113 	 *
114 	 * Return: A #PangoFontFamily representing the
115 	 *     selected font family, or %NULL. The returned object is owned by @fontchooser
116 	 *     and must not be modified or freed.
117 	 *
118 	 * Since: 3.2
119 	 */
120 	public PgFontFamily getFontFamily();
121 
122 	/**
123 	 * Gets the custom font map of this font chooser widget,
124 	 * or %NULL if it does not have one.
125 	 *
126 	 * Return: a #PangoFontMap, or %NULL
127 	 *
128 	 * Since: 3.18
129 	 */
130 	public PgFontMap getFontMap();
131 
132 	/**
133 	 * The selected font size.
134 	 *
135 	 * Return: A n integer representing the selected font size,
136 	 *     or -1 if no font size is selected.
137 	 *
138 	 * Since: 3.2
139 	 */
140 	public int getFontSize();
141 
142 	/**
143 	 * Gets the text displayed in the preview area.
144 	 *
145 	 * Return: the text displayed in the
146 	 *     preview area
147 	 *
148 	 * Since: 3.2
149 	 */
150 	public string getPreviewText();
151 
152 	/**
153 	 * Returns whether the preview entry is shown or not.
154 	 *
155 	 * Return: %TRUE if the preview entry is shown
156 	 *     or %FALSE if it is hidden.
157 	 *
158 	 * Since: 3.2
159 	 */
160 	public bool getShowPreviewEntry();
161 
162 	/**
163 	 * Adds a filter function that decides which fonts to display
164 	 * in the font chooser.
165 	 *
166 	 * Params:
167 	 *     filter = a #GtkFontFilterFunc, or %NULL
168 	 *     userData = data to pass to @filter
169 	 *     destroy = function to call to free @data when it is no longer needed
170 	 *
171 	 * Since: 3.2
172 	 */
173 	public void setFilterFunc(GtkFontFilterFunc filter, void* userData, GDestroyNotify destroy);
174 
175 	/**
176 	 * Sets the currently-selected font.
177 	 *
178 	 * Params:
179 	 *     fontname = a font name like “Helvetica 12” or “Times Bold 18”
180 	 *
181 	 * Since: 3.2
182 	 */
183 	public void setFont(string fontname);
184 
185 	/**
186 	 * Sets the currently-selected font from @font_desc.
187 	 *
188 	 * Params:
189 	 *     fontDesc = a #PangoFontDescription
190 	 *
191 	 * Since: 3.2
192 	 */
193 	public void setFontDesc(PgFontDescription fontDesc);
194 
195 	/**
196 	 * Sets a custom font map to use for this font chooser widget.
197 	 * A custom font map can be used to present application-specific
198 	 * fonts instead of or in addition to the normal system fonts.
199 	 *
200 	 * |[<!-- language="C" -->
201 	 * FcConfig *config;
202 	 * PangoFontMap *fontmap;
203 	 *
204 	 * config = FcInitLoadConfigAndFonts ();
205 	 * FcConfigAppFontAddFile (config, my_app_font_file);
206 	 *
207 	 * fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
208 	 * pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
209 	 *
210 	 * gtk_font_chooser_set_font_map (font_chooser, fontmap);
211 	 * ]|
212 	 *
213 	 * Note that other GTK+ widgets will only be able to use the application-specific
214 	 * font if it is present in the font map they use:
215 	 *
216 	 * |[
217 	 * context = gtk_widget_get_pango_context (label);
218 	 * pango_context_set_font_map (context, fontmap);
219 	 * ]|
220 	 *
221 	 * Params:
222 	 *     fontmap = a #PangoFontMap
223 	 *
224 	 * Since: 3.18
225 	 */
226 	public void setFontMap(PgFontMap fontmap);
227 
228 	/**
229 	 * Sets the text displayed in the preview area.
230 	 * The @text is used to show how the selected font looks.
231 	 *
232 	 * Params:
233 	 *     text = the text to display in the preview area
234 	 *
235 	 * Since: 3.2
236 	 */
237 	public void setPreviewText(string text);
238 
239 	/**
240 	 * Shows or hides the editable preview entry.
241 	 *
242 	 * Params:
243 	 *     showPreviewEntry = whether to show the editable preview entry or not
244 	 *
245 	 * Since: 3.2
246 	 */
247 	public void setShowPreviewEntry(bool showPreviewEntry);
248 	/**
249 	 * Emitted when a font is activated.
250 	 * This usually happens when the user double clicks an item,
251 	 * or an item is selected and the user presses one of the keys
252 	 * Space, Shift+Space, Return or Enter.
253 	 *
254 	 * Params:
255 	 *     fontname = the font name
256 	 */
257 	gulong addOnFontActivated(void delegate(string, FontChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
258 	;
259 
260 }