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  = GtkFontSelectionDialog.html
27  * outPack = gtk
28  * outFile = FontSelectionDialog
29  * strct   = GtkFontSelectionDialog
30  * realStrct=
31  * ctorStrct=
32  * clss    = FontSelectionDialog
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_font_selection_dialog_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * 	- gtk_font_selection_dialog_get_font_selection
46  * omit signals:
47  * imports:
48  * 	- glib.Str
49  * 	- gdk.Font
50  * 	- gtk.FontSelection
51  * 	- gtk.Widget
52  * structWrap:
53  * 	- GdkFont* -> Font
54  * 	- GtkWidget* -> Widget
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gtk.FontSelectionDialog;
61 
62 public  import gtkc.gtktypes;
63 
64 private import gtkc.gtk;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 
69 private import glib.Str;
70 private import gdk.Font;
71 private import gtk.FontSelection;
72 private import gtk.Widget;
73 
74 
75 
76 private import gtk.Dialog;
77 
78 /**
79  * Description
80  * The GtkFontSelectionDialog widget is a dialog box for selecting a font.
81  * To set the font which is initially selected, use
82  * gtk_font_selection_dialog_set_font_name().
83  * To get the selected font use gtk_font_selection_dialog_get_font_name().
84  * To change the text which is shown in the preview area, use
85  * gtk_font_selection_dialog_set_preview_text().
86  * GtkFontSelectionDialog as GtkBuildable
87  * The GtkFontSelectionDialog implementation of the GtkBuildable interface
88  * exposes the embedded GtkFontSelection as internal child with the
89  * name "font_selection". It also exposes the buttons with the names
90  * "ok_button", "cancel_button" and "apply_button".
91  */
92 public class FontSelectionDialog : Dialog
93 {
94 	
95 	/** the main Gtk struct */
96 	protected GtkFontSelectionDialog* gtkFontSelectionDialog;
97 	
98 	
99 	public GtkFontSelectionDialog* getFontSelectionDialogStruct()
100 	{
101 		return gtkFontSelectionDialog;
102 	}
103 	
104 	
105 	/** the main Gtk struct as a void* */
106 	protected override void* getStruct()
107 	{
108 		return cast(void*)gtkFontSelectionDialog;
109 	}
110 	
111 	/**
112 	 * Sets our main struct and passes it to the parent class
113 	 */
114 	public this (GtkFontSelectionDialog* gtkFontSelectionDialog)
115 	{
116 		super(cast(GtkDialog*)gtkFontSelectionDialog);
117 		this.gtkFontSelectionDialog = gtkFontSelectionDialog;
118 	}
119 	
120 	protected override void setStruct(GObject* obj)
121 	{
122 		super.setStruct(obj);
123 		gtkFontSelectionDialog = cast(GtkFontSelectionDialog*)obj;
124 	}
125 	
126 	/**
127 	 * Retrieves the GtkFontSelection widget embedded in the dialog.
128 	 * Since 2.22
129 	 * Returns: the embedded GtkFontSelection
130 	 */
131 	public FontSelection getFontSelection()
132 	{
133 		// GtkWidget * gtk_font_selection_dialog_get_font_selection  (GtkFontSelectionDialog *fsd);
134 		auto p = gtk_font_selection_dialog_get_font_selection(gtkFontSelectionDialog);
135 		if(p is null)
136 		{
137 			return null;
138 		}
139 		return new FontSelection(cast(GtkFontSelection*) p);
140 	}
141 	
142 	/**
143 	 */
144 	
145 	/**
146 	 * Creates a new GtkFontSelectionDialog.
147 	 * Params:
148 	 * title = the title of the dialog window
149 	 * Throws: ConstructionException GTK+ fails to create the object.
150 	 */
151 	public this (string title)
152 	{
153 		// GtkWidget * gtk_font_selection_dialog_new (const gchar *title);
154 		auto p = gtk_font_selection_dialog_new(Str.toStringz(title));
155 		if(p is null)
156 		{
157 			throw new ConstructionException("null returned by gtk_font_selection_dialog_new(Str.toStringz(title))");
158 		}
159 		this(cast(GtkFontSelectionDialog*) p);
160 	}
161 	
162 	/**
163 	 * Warning
164 	 * gtk_font_selection_dialog_get_font has been deprecated since version 2.0 and should not be used in newly-written code. Use gtk_font_selection_dialog_get_font_name() instead.
165 	 * Gets the currently-selected font.
166 	 * Returns: the GdkFont from the GtkFontSelection for the currently selected font in the dialog, or NULL if no font is selected
167 	 */
168 	public Font getFont()
169 	{
170 		// GdkFont * gtk_font_selection_dialog_get_font (GtkFontSelectionDialog *fsd);
171 		auto p = gtk_font_selection_dialog_get_font(gtkFontSelectionDialog);
172 		
173 		if(p is null)
174 		{
175 			return null;
176 		}
177 		
178 		return ObjectG.getDObject!(Font)(cast(GdkFont*) p);
179 	}
180 	
181 	/**
182 	 * Gets the currently-selected font name.
183 	 * Note that this can be a different string than what you set with
184 	 * gtk_font_selection_dialog_set_font_name(), as the font selection widget
185 	 * may normalize font names and thus return a string with a different
186 	 * structure. For example, "Helvetica Italic Bold 12" could be normalized
187 	 * to "Helvetica Bold Italic 12". Use pango_font_description_equal()
188 	 * if you want to compare two font descriptions.
189 	 * 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().
190 	 */
191 	public string getFontName()
192 	{
193 		// gchar * gtk_font_selection_dialog_get_font_name  (GtkFontSelectionDialog *fsd);
194 		return Str.toString(gtk_font_selection_dialog_get_font_name(gtkFontSelectionDialog));
195 	}
196 	
197 	/**
198 	 * Sets the currently selected font.
199 	 * Params:
200 	 * fontname = a font name like "Helvetica 12" or "Times Bold 18"
201 	 * Returns: TRUE if the font selected in fsd is now the fontname specified, FALSE otherwise.
202 	 */
203 	public int setFontName(string fontname)
204 	{
205 		// gboolean gtk_font_selection_dialog_set_font_name  (GtkFontSelectionDialog *fsd,  const gchar *fontname);
206 		return gtk_font_selection_dialog_set_font_name(gtkFontSelectionDialog, Str.toStringz(fontname));
207 	}
208 	
209 	/**
210 	 * Gets the text displayed in the preview area.
211 	 * Returns: the text displayed in the preview area. This string is owned by the widget and should not be modified or freed
212 	 */
213 	public string getPreviewText()
214 	{
215 		// const gchar * gtk_font_selection_dialog_get_preview_text  (GtkFontSelectionDialog *fsd);
216 		return Str.toString(gtk_font_selection_dialog_get_preview_text(gtkFontSelectionDialog));
217 	}
218 	
219 	/**
220 	 * Sets the text displayed in the preview area.
221 	 * Params:
222 	 * text = the text to display in the preview area
223 	 */
224 	public void setPreviewText(string text)
225 	{
226 		// void gtk_font_selection_dialog_set_preview_text  (GtkFontSelectionDialog *fsd,  const gchar *text);
227 		gtk_font_selection_dialog_set_preview_text(gtkFontSelectionDialog, Str.toStringz(text));
228 	}
229 	
230 	/**
231 	 * Warning
232 	 * gtk_font_selection_dialog_get_apply_button has been deprecated since version 2.16 and should not be used in newly-written code. Don't use this function.
233 	 * Obtains a button. The button doesn't have any function.
234 	 * Since 2.14
235 	 * Returns: a GtkWidget
236 	 */
237 	public Widget getApplyButton()
238 	{
239 		// GtkWidget * gtk_font_selection_dialog_get_apply_button  (GtkFontSelectionDialog *fsd);
240 		auto p = gtk_font_selection_dialog_get_apply_button(gtkFontSelectionDialog);
241 		
242 		if(p is null)
243 		{
244 			return null;
245 		}
246 		
247 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
248 	}
249 	
250 	/**
251 	 * Gets the 'Cancel' button.
252 	 * Since 2.14
253 	 * Returns: the GtkWidget used in the dialog for the 'Cancel' button. [transfer none]
254 	 */
255 	public Widget getCancelButton()
256 	{
257 		// GtkWidget * gtk_font_selection_dialog_get_cancel_button  (GtkFontSelectionDialog *fsd);
258 		auto p = gtk_font_selection_dialog_get_cancel_button(gtkFontSelectionDialog);
259 		
260 		if(p is null)
261 		{
262 			return null;
263 		}
264 		
265 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
266 	}
267 	
268 	/**
269 	 * Gets the 'OK' button.
270 	 * Since 2.14
271 	 * Returns: the GtkWidget used in the dialog for the 'OK' button. [transfer none]
272 	 */
273 	public Widget getOkButton()
274 	{
275 		// GtkWidget * gtk_font_selection_dialog_get_ok_button  (GtkFontSelectionDialog *fsd);
276 		auto p = gtk_font_selection_dialog_get_ok_button(gtkFontSelectionDialog);
277 		
278 		if(p is null)
279 		{
280 			return null;
281 		}
282 		
283 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
284 	}
285 }