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 glib.c.functions;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtk.c.functions;
32 public  import gtk.c.types;
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  * for choosing fonts.
43  * 
44  * In GTK, the main objects that implement this interface are
45  * [class@Gtk.FontChooserWidget], [class@Gtk.FontChooserDialog] and
46  * [class@Gtk.FontButton].
47  */
48 public interface FontChooserIF{
49 	/** Get the main Gtk struct */
50 	public GtkFontChooser* getFontChooserStruct(bool transferOwnership = false);
51 
52 	/** the main Gtk struct as a void* */
53 	protected void* getStruct();
54 
55 
56 	/** */
57 	public static GType getType()
58 	{
59 		return gtk_font_chooser_get_type();
60 	}
61 
62 	/**
63 	 * Gets the currently-selected font name.
64 	 *
65 	 * Note that this can be a different string than what you set with
66 	 * [method@Gtk.FontChooser.set_font], as the font chooser widget may
67 	 * normalize font names and thus return a string with a different
68 	 * structure. For example, “Helvetica Italic Bold 12” could be
69 	 * normalized to “Helvetica Bold Italic 12”.
70 	 *
71 	 * Use [method@Pango.FontDescription.equal] if you want to compare two
72 	 * font descriptions.
73 	 *
74 	 * Returns: A string with the name
75 	 *     of the current font, or %NULL if  no font is selected. You must
76 	 *     free this string with g_free().
77 	 */
78 	public string getFont();
79 
80 	/**
81 	 * Gets the currently-selected font.
82 	 *
83 	 * Note that this can be a different string than what you set with
84 	 * [method@Gtk.FontChooser.set_font], as the font chooser widget may
85 	 * normalize font names and thus return a string with a different
86 	 * structure. For example, “Helvetica Italic Bold 12” could be
87 	 * normalized to “Helvetica Bold Italic 12”.
88 	 *
89 	 * Use [method@Pango.FontDescription.equal] if you want to compare two
90 	 * font descriptions.
91 	 *
92 	 * Returns: A `PangoFontDescription` for the
93 	 *     current font, or %NULL if  no font is selected.
94 	 */
95 	public PgFontDescription getFontDesc();
96 
97 	/**
98 	 * Gets the `PangoFontFace` representing the selected font group
99 	 * details (i.e. family, slant, weight, width, etc).
100 	 *
101 	 * If the selected font is not installed, returns %NULL.
102 	 *
103 	 * Returns: A `PangoFontFace` representing the
104 	 *     selected font group details, or %NULL. The returned object is owned by
105 	 *     @fontchooser and must not be modified or freed.
106 	 */
107 	public PgFontFace getFontFace();
108 
109 	/**
110 	 * Gets the `PangoFontFamily` representing the selected font family.
111 	 *
112 	 * Font families are a collection of font faces.
113 	 *
114 	 * If the selected font is not installed, returns %NULL.
115 	 *
116 	 * Returns: A `PangoFontFamily` representing the
117 	 *     selected font family, or %NULL. The returned object is owned by @fontchooser
118 	 *     and must not be modified or freed.
119 	 */
120 	public PgFontFamily getFontFamily();
121 
122 	/**
123 	 * Gets the currently-selected font features.
124 	 *
125 	 * Returns: the currently selected font features
126 	 */
127 	public string getFontFeatures();
128 
129 	/**
130 	 * Gets the custom font map of this font chooser widget,
131 	 * or %NULL if it does not have one.
132 	 *
133 	 * Returns: a `PangoFontMap`, or %NULL
134 	 */
135 	public PgFontMap getFontMap();
136 
137 	/**
138 	 * The selected font size.
139 	 *
140 	 * Returns: A n integer representing the selected font size,
141 	 *     or -1 if no font size is selected.
142 	 */
143 	public int getFontSize();
144 
145 	/**
146 	 * Gets the language that is used for font features.
147 	 *
148 	 * Returns: the currently selected language
149 	 */
150 	public string getLanguage();
151 
152 	/**
153 	 * Returns the current level of granularity for selecting fonts.
154 	 *
155 	 * Returns: the current granularity level
156 	 */
157 	public GtkFontChooserLevel getLevel();
158 
159 	/**
160 	 * Gets the text displayed in the preview area.
161 	 *
162 	 * Returns: the text displayed in the preview area
163 	 */
164 	public string getPreviewText();
165 
166 	/**
167 	 * Returns whether the preview entry is shown or not.
168 	 *
169 	 * Returns: %TRUE if the preview entry is shown or %FALSE if it is hidden.
170 	 */
171 	public bool getShowPreviewEntry();
172 
173 	/**
174 	 * Adds a filter function that decides which fonts to display
175 	 * in the font chooser.
176 	 *
177 	 * Params:
178 	 *     filter = a `GtkFontFilterFunc`, or %NULL
179 	 *     userData = data to pass to @filter
180 	 *     destroy = function to call to free @data when it is no longer needed
181 	 */
182 	public void setFilterFunc(GtkFontFilterFunc filter, void* userData, GDestroyNotify destroy);
183 
184 	/**
185 	 * Sets the currently-selected font.
186 	 *
187 	 * Params:
188 	 *     fontname = a font name like “Helvetica 12” or “Times Bold 18”
189 	 */
190 	public void setFont(string fontname);
191 
192 	/**
193 	 * Sets the currently-selected font from @font_desc.
194 	 *
195 	 * Params:
196 	 *     fontDesc = a `PangoFontDescription`
197 	 */
198 	public void setFontDesc(PgFontDescription fontDesc);
199 
200 	/**
201 	 * Sets a custom font map to use for this font chooser widget.
202 	 *
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 	 * ```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
220 	 * application-specific font if it is present in the font map they use:
221 	 *
222 	 * ```c
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 	public void setFontMap(PgFontMap fontmap);
231 
232 	/**
233 	 * Sets the language to use for font features.
234 	 *
235 	 * Params:
236 	 *     language = a language
237 	 */
238 	public void setLanguage(string language);
239 
240 	/**
241 	 * Sets the desired level of granularity for selecting fonts.
242 	 *
243 	 * Params:
244 	 *     level = the desired level of granularity
245 	 */
246 	public void setLevel(GtkFontChooserLevel level);
247 
248 	/**
249 	 * Sets the text displayed in the preview area.
250 	 *
251 	 * The @text is used to show how the selected font looks.
252 	 *
253 	 * Params:
254 	 *     text = the text to display in the preview area
255 	 */
256 	public void setPreviewText(string text);
257 
258 	/**
259 	 * Shows or hides the editable preview entry.
260 	 *
261 	 * Params:
262 	 *     showPreviewEntry = whether to show the editable preview entry or not
263 	 */
264 	public void setShowPreviewEntry(bool showPreviewEntry);
265 
266 	/**
267 	 * Emitted when a font is activated.
268 	 *
269 	 * This usually happens when the user double clicks an item,
270 	 * or an item is selected and the user presses one of the keys
271 	 * Space, Shift+Space, Return or Enter.
272 	 *
273 	 * Params:
274 	 *     fontname = the font name
275 	 */
276 	gulong addOnFontActivated(void delegate(string, FontChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
277 }