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  * Conversion parameters:
26  * inFile  = GtkFontSelection.html
27  * outPack = gtk
28  * outFile = FontSelection
29  * strct   = GtkFontSelection
30  * realStrct=
31  * ctorStrct=
32  * clss    = FontSelection
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_font_selection_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gtk.Widget
48  * 	- pango.PgFontFace
49  * 	- pango.PgFontFamily
50  * structWrap:
51  * 	- GtkWidget* -> Widget
52  * 	- PangoFontFace* -> PgFontFace
53  * 	- PangoFontFamily* -> PgFontFamily
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gtk.FontSelection;
60 
61 public  import gtkc.gtktypes;
62 
63 private import gtkc.gtk;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 
68 private import glib.Str;
69 private import gtk.Widget;
70 private import pango.PgFontFace;
71 private import pango.PgFontFamily;
72 
73 
74 
75 private import gtk.Box;
76 
77 /**
78  * The GtkFontSelection widget lists the available fonts, styles and sizes,
79  * allowing the user to select a font.
80  * It is used in the GtkFontSelectionDialog widget to provide a dialog box for
81  * selecting fonts.
82  *
83  * To set the font which is initially selected, use
84  * gtk_font_selection_set_font_name().
85  *
86  * To get the selected font use gtk_font_selection_get_font_name().
87  *
88  * To change the text which is shown in the preview area, use
89  * gtk_font_selection_set_preview_text().
90  *
91  * In GTK+ 3.2, GtkFontSelection has been deprecated in favor of
92  * GtkFontChooser.
93  */
94 public class FontSelection : Box
95 {
96 	
97 	/** the main Gtk struct */
98 	protected GtkFontSelection* gtkFontSelection;
99 	
100 	
101 	public GtkFontSelection* getFontSelectionStruct()
102 	{
103 		return gtkFontSelection;
104 	}
105 	
106 	
107 	/** the main Gtk struct as a void* */
108 	protected override void* getStruct()
109 	{
110 		return cast(void*)gtkFontSelection;
111 	}
112 	
113 	/**
114 	 * Sets our main struct and passes it to the parent class
115 	 */
116 	public this (GtkFontSelection* gtkFontSelection)
117 	{
118 		super(cast(GtkBox*)gtkFontSelection);
119 		this.gtkFontSelection = gtkFontSelection;
120 	}
121 	
122 	protected override void setStruct(GObject* obj)
123 	{
124 		super.setStruct(obj);
125 		gtkFontSelection = cast(GtkFontSelection*)obj;
126 	}
127 	
128 	/**
129 	 */
130 	
131 	/**
132 	 * Warning
133 	 * gtk_font_selection_new has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooserWidget instead
134 	 * Creates a new GtkFontSelection.
135 	 * Throws: ConstructionException GTK+ fails to create the object.
136 	 */
137 	public this ()
138 	{
139 		// GtkWidget * gtk_font_selection_new (void);
140 		auto p = gtk_font_selection_new();
141 		if(p is null)
142 		{
143 			throw new ConstructionException("null returned by gtk_font_selection_new()");
144 		}
145 		this(cast(GtkFontSelection*) p);
146 	}
147 	
148 	/**
149 	 * Warning
150 	 * gtk_font_selection_get_font_name has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
151 	 * Gets the currently-selected font name.
152 	 * Note that this can be a different string than what you set with
153 	 * gtk_font_selection_set_font_name(), as the font selection widget may
154 	 * normalize font names and thus return a string with a different structure.
155 	 * For example, "Helvetica Italic Bold 12" could be normalized to
156 	 * "Helvetica Bold Italic 12". Use pango_font_description_equal()
157 	 * if you want to compare two font descriptions.
158 	 * Returns: A string with the name of the current font, or NULL if no font is selected. You must free this string with g_free().
159 	 */
160 	public string getFontName()
161 	{
162 		// gchar * gtk_font_selection_get_font_name (GtkFontSelection *fontsel);
163 		return Str.toString(gtk_font_selection_get_font_name(gtkFontSelection));
164 	}
165 	
166 	/**
167 	 * Warning
168 	 * gtk_font_selection_set_font_name has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
169 	 * Sets the currently-selected font.
170 	 * Note that the fontsel needs to know the screen in which it will appear
171 	 * for this to work; this can be guaranteed by simply making sure that the
172 	 * fontsel is inserted in a toplevel window before you call this function.
173 	 * Params:
174 	 * fontname = a font name like "Helvetica 12" or "Times Bold 18"
175 	 * Returns: TRUE if the font could be set successfully; FALSE if no such font exists or if the fontsel doesn't belong to a particular screen yet.
176 	 */
177 	public int setFontName(string fontname)
178 	{
179 		// gboolean gtk_font_selection_set_font_name (GtkFontSelection *fontsel,  const gchar *fontname);
180 		return gtk_font_selection_set_font_name(gtkFontSelection, Str.toStringz(fontname));
181 	}
182 	
183 	/**
184 	 * Warning
185 	 * gtk_font_selection_get_preview_text has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
186 	 * Gets the text displayed in the preview area.
187 	 * Returns: the text displayed in the preview area. This string is owned by the widget and should not be modified or freed
188 	 */
189 	public string getPreviewText()
190 	{
191 		// const gchar * gtk_font_selection_get_preview_text (GtkFontSelection *fontsel);
192 		return Str.toString(gtk_font_selection_get_preview_text(gtkFontSelection));
193 	}
194 	
195 	/**
196 	 * Warning
197 	 * gtk_font_selection_set_preview_text has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
198 	 * Sets the text displayed in the preview area.
199 	 * The text is used to show how the selected font looks.
200 	 * Params:
201 	 * text = the text to display in the preview area
202 	 */
203 	public void setPreviewText(string text)
204 	{
205 		// void gtk_font_selection_set_preview_text (GtkFontSelection *fontsel,  const gchar *text);
206 		gtk_font_selection_set_preview_text(gtkFontSelection, Str.toStringz(text));
207 	}
208 	
209 	/**
210 	 * Warning
211 	 * gtk_font_selection_get_face has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
212 	 * Gets the PangoFontFace representing the selected font group
213 	 * details (i.e. family, slant, weight, width, etc).
214 	 * Since 2.14
215 	 * Returns: A PangoFontFace representing the selected font group details. The returned object is owned by fontsel and must not be modified or freed. [transfer none]
216 	 */
217 	public PgFontFace getFace()
218 	{
219 		// PangoFontFace * gtk_font_selection_get_face (GtkFontSelection *fontsel);
220 		auto p = gtk_font_selection_get_face(gtkFontSelection);
221 		
222 		if(p is null)
223 		{
224 			return null;
225 		}
226 		
227 		return ObjectG.getDObject!(PgFontFace)(cast(PangoFontFace*) p);
228 	}
229 	
230 	/**
231 	 * Warning
232 	 * gtk_font_selection_get_face_list has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
233 	 * This returns the GtkTreeView which lists all styles available for
234 	 * the selected font. For example, 'Regular', 'Bold', etc.
235 	 * Since 2.14
236 	 * Returns: A GtkWidget that is part of fontsel. [transfer none]
237 	 */
238 	public Widget getFaceList()
239 	{
240 		// GtkWidget * gtk_font_selection_get_face_list (GtkFontSelection *fontsel);
241 		auto p = gtk_font_selection_get_face_list(gtkFontSelection);
242 		
243 		if(p is null)
244 		{
245 			return null;
246 		}
247 		
248 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
249 	}
250 	
251 	/**
252 	 * Warning
253 	 * gtk_font_selection_get_family has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
254 	 * Gets the PangoFontFamily representing the selected font family.
255 	 * Since 2.14
256 	 * Returns: A PangoFontFamily representing the selected font family. Font families are a collection of font faces. The returned object is owned by fontsel and must not be modified or freed. [transfer none]
257 	 */
258 	public PgFontFamily getFamily()
259 	{
260 		// PangoFontFamily * gtk_font_selection_get_family (GtkFontSelection *fontsel);
261 		auto p = gtk_font_selection_get_family(gtkFontSelection);
262 		
263 		if(p is null)
264 		{
265 			return null;
266 		}
267 		
268 		return ObjectG.getDObject!(PgFontFamily)(cast(PangoFontFamily*) p);
269 	}
270 	
271 	/**
272 	 * Warning
273 	 * gtk_font_selection_get_size has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
274 	 * The selected font size.
275 	 * Since 2.14
276 	 * Returns: A n integer representing the selected font size, or -1 if no font size is selected.
277 	 */
278 	public int getSize()
279 	{
280 		// gint gtk_font_selection_get_size (GtkFontSelection *fontsel);
281 		return gtk_font_selection_get_size(gtkFontSelection);
282 	}
283 	
284 	/**
285 	 * Warning
286 	 * gtk_font_selection_get_family_list has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
287 	 * This returns the GtkTreeView that lists font families, for
288 	 * example, 'Sans', 'Serif', etc.
289 	 * Since 2.14
290 	 * Returns: A GtkWidget that is part of fontsel. [transfer none]
291 	 */
292 	public Widget getFamilyList()
293 	{
294 		// GtkWidget * gtk_font_selection_get_family_list (GtkFontSelection *fontsel);
295 		auto p = gtk_font_selection_get_family_list(gtkFontSelection);
296 		
297 		if(p is null)
298 		{
299 			return null;
300 		}
301 		
302 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
303 	}
304 	
305 	/**
306 	 * Warning
307 	 * gtk_font_selection_get_preview_entry has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
308 	 * This returns the GtkEntry used to display the font as a preview.
309 	 * Since 2.14
310 	 * Returns: A GtkWidget that is part of fontsel. [transfer none]
311 	 */
312 	public Widget getPreviewEntry()
313 	{
314 		// GtkWidget * gtk_font_selection_get_preview_entry  (GtkFontSelection *fontsel);
315 		auto p = gtk_font_selection_get_preview_entry(gtkFontSelection);
316 		
317 		if(p is null)
318 		{
319 			return null;
320 		}
321 		
322 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
323 	}
324 	
325 	/**
326 	 * Warning
327 	 * gtk_font_selection_get_size_entry has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
328 	 * This returns the GtkEntry used to allow the user to edit the font
329 	 * number manually instead of selecting it from the list of font sizes.
330 	 * Since 2.14
331 	 * Returns: A GtkWidget that is part of fontsel. [transfer none]
332 	 */
333 	public Widget getSizeEntry()
334 	{
335 		// GtkWidget * gtk_font_selection_get_size_entry (GtkFontSelection *fontsel);
336 		auto p = gtk_font_selection_get_size_entry(gtkFontSelection);
337 		
338 		if(p is null)
339 		{
340 			return null;
341 		}
342 		
343 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
344 	}
345 	
346 	/**
347 	 * Warning
348 	 * gtk_font_selection_get_size_list has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooser
349 	 * This returns the GtkTreeView used to list font sizes.
350 	 * Since 2.14
351 	 * Returns: A GtkWidget that is part of fontsel. [transfer none]
352 	 */
353 	public Widget getSizeList()
354 	{
355 		// GtkWidget * gtk_font_selection_get_size_list (GtkFontSelection *fontsel);
356 		auto p = gtk_font_selection_get_size_list(gtkFontSelection);
357 		
358 		if(p is null)
359 		{
360 			return null;
361 		}
362 		
363 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
364 	}
365 }