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 private import gtk.c.functions;
31 public  import gtk.c.types;
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(bool transferOwnership = false);
50 
51 	/** the main Gtk struct as a void* */
52 	protected void* getStruct();
53 
54 
55 	/** */
56 	public static GType getType()
57 	{
58 		return gtk_font_chooser_get_type();
59 	}
60 
61 	/**
62 	 * Gets the currently-selected font name.
63 	 *
64 	 * Note that this can be a different string than what you set with
65 	 * gtk_font_chooser_set_font(), as the font chooser widget may
66 	 * normalize font names and thus return a string with a different
67 	 * structure. For example, “Helvetica Italic Bold 12” could be
68 	 * normalized to “Helvetica Bold Italic 12”.
69 	 *
70 	 * Use pango_font_description_equal() if you want to compare two
71 	 * font descriptions.
72 	 *
73 	 * Returns: A string with the name
74 	 *     of the current font, or %NULL if  no font is selected. You must
75 	 *     free this string with g_free().
76 	 *
77 	 * Since: 3.2
78 	 */
79 	public string getFont();
80 
81 	/**
82 	 * Gets the currently-selected font.
83 	 *
84 	 * Note that this can be a different string than what you set with
85 	 * gtk_font_chooser_set_font(), as the font chooser widget may
86 	 * normalize font names and thus return a string with a different
87 	 * structure. For example, “Helvetica Italic Bold 12” could be
88 	 * normalized to “Helvetica Bold Italic 12”.
89 	 *
90 	 * Use pango_font_description_equal() if you want to compare two
91 	 * font descriptions.
92 	 *
93 	 * Returns: A #PangoFontDescription for the
94 	 *     current font, or %NULL if  no font is selected.
95 	 *
96 	 * Since: 3.2
97 	 */
98 	public PgFontDescription getFontDesc();
99 
100 	/**
101 	 * Gets the #PangoFontFace representing the selected font group
102 	 * details (i.e. family, slant, weight, width, etc).
103 	 *
104 	 * If the selected font is not installed, returns %NULL.
105 	 *
106 	 * Returns: A #PangoFontFace representing the
107 	 *     selected font group details, or %NULL. The returned object is owned by
108 	 *     @fontchooser and must not be modified or freed.
109 	 *
110 	 * Since: 3.2
111 	 */
112 	public PgFontFace getFontFace();
113 
114 	/**
115 	 * Gets the #PangoFontFamily representing the selected font family.
116 	 * Font families are a collection of font faces.
117 	 *
118 	 * If the selected font is not installed, returns %NULL.
119 	 *
120 	 * Returns: A #PangoFontFamily representing the
121 	 *     selected font family, or %NULL. The returned object is owned by @fontchooser
122 	 *     and must not be modified or freed.
123 	 *
124 	 * Since: 3.2
125 	 */
126 	public PgFontFamily getFontFamily();
127 
128 	/**
129 	 * Gets the custom font map of this font chooser widget,
130 	 * or %NULL if it does not have one.
131 	 *
132 	 * Returns: a #PangoFontMap, or %NULL
133 	 *
134 	 * Since: 3.18
135 	 */
136 	public PgFontMap getFontMap();
137 
138 	/**
139 	 * The selected font size.
140 	 *
141 	 * Returns: A n integer representing the selected font size,
142 	 *     or -1 if no font size is selected.
143 	 *
144 	 * Since: 3.2
145 	 */
146 	public int getFontSize();
147 
148 	/**
149 	 * Gets the text displayed in the preview area.
150 	 *
151 	 * Returns: the text displayed in the
152 	 *     preview area
153 	 *
154 	 * Since: 3.2
155 	 */
156 	public string getPreviewText();
157 
158 	/**
159 	 * Returns whether the preview entry is shown or not.
160 	 *
161 	 * Returns: %TRUE if the preview entry is shown
162 	 *     or %FALSE if it is hidden.
163 	 *
164 	 * Since: 3.2
165 	 */
166 	public bool getShowPreviewEntry();
167 
168 	/**
169 	 * Adds a filter function that decides which fonts to display
170 	 * in the font chooser.
171 	 *
172 	 * Params:
173 	 *     filter = a #GtkFontFilterFunc, or %NULL
174 	 *     userData = data to pass to @filter
175 	 *     destroy = function to call to free @data when it is no longer needed
176 	 *
177 	 * Since: 3.2
178 	 */
179 	public void setFilterFunc(GtkFontFilterFunc filter, void* userData, GDestroyNotify destroy);
180 
181 	/**
182 	 * Sets the currently-selected font.
183 	 *
184 	 * Params:
185 	 *     fontname = a font name like “Helvetica 12” or “Times Bold 18”
186 	 *
187 	 * Since: 3.2
188 	 */
189 	public void setFont(string fontname);
190 
191 	/**
192 	 * Sets the currently-selected font from @font_desc.
193 	 *
194 	 * Params:
195 	 *     fontDesc = a #PangoFontDescription
196 	 *
197 	 * Since: 3.2
198 	 */
199 	public void setFontDesc(PgFontDescription fontDesc);
200 
201 	/**
202 	 * Sets a custom font map to use for this font chooser widget.
203 	 * A custom font map can be used to present application-specific
204 	 * fonts instead of or in addition to the normal system fonts.
205 	 *
206 	 * |[<!-- language="C" -->
207 	 * FcConfig *config;
208 	 * PangoFontMap *fontmap;
209 	 *
210 	 * config = FcInitLoadConfigAndFonts ();
211 	 * FcConfigAppFontAddFile (config, my_app_font_file);
212 	 *
213 	 * fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
214 	 * pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
215 	 *
216 	 * gtk_font_chooser_set_font_map (font_chooser, fontmap);
217 	 * ]|
218 	 *
219 	 * Note that other GTK+ widgets will only be able to use the application-specific
220 	 * font if it is present in the font map they use:
221 	 *
222 	 * |[
223 	 * context = gtk_widget_get_pango_context (label);
224 	 * pango_context_set_font_map (context, fontmap);
225 	 * ]|
226 	 *
227 	 * Params:
228 	 *     fontmap = a #PangoFontMap
229 	 *
230 	 * Since: 3.18
231 	 */
232 	public void setFontMap(PgFontMap fontmap);
233 
234 	/**
235 	 * Sets the text displayed in the preview area.
236 	 * The @text is used to show how the selected font looks.
237 	 *
238 	 * Params:
239 	 *     text = the text to display in the preview area
240 	 *
241 	 * Since: 3.2
242 	 */
243 	public void setPreviewText(string text);
244 
245 	/**
246 	 * Shows or hides the editable preview entry.
247 	 *
248 	 * Params:
249 	 *     showPreviewEntry = whether to show the editable preview entry or not
250 	 *
251 	 * Since: 3.2
252 	 */
253 	public void setShowPreviewEntry(bool showPreviewEntry);
254 
255 	/**
256 	 * Emitted when a font is activated.
257 	 * This usually happens when the user double clicks an item,
258 	 * or an item is selected and the user presses one of the keys
259 	 * Space, Shift+Space, Return or Enter.
260 	 *
261 	 * Params:
262 	 *     fontname = the font name
263 	 */
264 	gulong addOnFontActivated(void delegate(string, FontChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
265 }