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