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.FontSelectionDialog;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gtk.Dialog;
31 private import gtk.FontSelection;
32 private import gtk.Widget;
33 private import gtkc.gtk;
34 public  import gtkc.gtktypes;
35 
36 
37 /** */
38 public class FontSelectionDialog : Dialog
39 {
40 	/** the main Gtk struct */
41 	protected GtkFontSelectionDialog* gtkFontSelectionDialog;
42 
43 	/** Get the main Gtk struct */
44 	public GtkFontSelectionDialog* getFontSelectionDialogStruct()
45 	{
46 		return gtkFontSelectionDialog;
47 	}
48 
49 	/** the main Gtk struct as a void* */
50 	protected override void* getStruct()
51 	{
52 		return cast(void*)gtkFontSelectionDialog;
53 	}
54 
55 	protected override void setStruct(GObject* obj)
56 	{
57 		gtkFontSelectionDialog = cast(GtkFontSelectionDialog*)obj;
58 		super.setStruct(obj);
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (GtkFontSelectionDialog* gtkFontSelectionDialog, bool ownedRef = false)
65 	{
66 		this.gtkFontSelectionDialog = gtkFontSelectionDialog;
67 		super(cast(GtkDialog*)gtkFontSelectionDialog, ownedRef);
68 	}
69 
70 	/**
71 	 * Retrieves the FontSelection widget embedded in the dialog.
72 	 *
73 	 * Deprecated: Use FontChooserDialog
74 	 *
75 	 * Return: the embedded FontSelection
76 	 *
77 	 * Since: 2.22
78 	 */
79 	public FontSelection getFontSelection()
80 	{
81 		auto p = gtk_font_selection_dialog_get_font_selection(gtkFontSelectionDialog);
82 		
83 		if(p is null)
84 		{
85 			return null;
86 		}
87 		
88 		return ObjectG.getDObject!(FontSelection)(cast(GtkFontSelection*) p);
89 	}
90 
91 	/**
92 	 */
93 
94 	/** */
95 	public static GType getType()
96 	{
97 		return gtk_font_selection_dialog_get_type();
98 	}
99 
100 	/**
101 	 * Creates a new #GtkFontSelectionDialog.
102 	 *
103 	 * Deprecated: Use #GtkFontChooserDialog
104 	 *
105 	 * Params:
106 	 *     title = the title of the dialog window
107 	 *
108 	 * Return: a new #GtkFontSelectionDialog
109 	 *
110 	 * Throws: ConstructionException GTK+ fails to create the object.
111 	 */
112 	public this(string title)
113 	{
114 		auto p = gtk_font_selection_dialog_new(Str.toStringz(title));
115 		
116 		if(p is null)
117 		{
118 			throw new ConstructionException("null returned by new");
119 		}
120 		
121 		this(cast(GtkFontSelectionDialog*) p);
122 	}
123 
124 	/**
125 	 * Gets the “Cancel” button.
126 	 *
127 	 * Deprecated: Use #GtkFontChooserDialog
128 	 *
129 	 * Return: the #GtkWidget used in the dialog
130 	 *     for the “Cancel” button.
131 	 *
132 	 * Since: 2.14
133 	 */
134 	public Widget getCancelButton()
135 	{
136 		auto p = gtk_font_selection_dialog_get_cancel_button(gtkFontSelectionDialog);
137 		
138 		if(p is null)
139 		{
140 			return null;
141 		}
142 		
143 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
144 	}
145 
146 	/**
147 	 * Gets the currently-selected font name.
148 	 *
149 	 * Note that this can be a different string than what you set with
150 	 * gtk_font_selection_dialog_set_font_name(), as the font selection widget
151 	 * may normalize font names and thus return a string with a different
152 	 * structure. For example, “Helvetica Italic Bold 12” could be normalized
153 	 * to “Helvetica Bold Italic 12”.  Use pango_font_description_equal()
154 	 * if you want to compare two font descriptions.
155 	 *
156 	 * Deprecated: Use #GtkFontChooserDialog
157 	 *
158 	 * Return: A string with the name of the current font, or %NULL if no
159 	 *     font is selected. You must free this string with g_free().
160 	 */
161 	public string getFontName()
162 	{
163 		auto retStr = gtk_font_selection_dialog_get_font_name(gtkFontSelectionDialog);
164 		
165 		scope(exit) Str.freeString(retStr);
166 		return Str.toString(retStr);
167 	}
168 
169 	/**
170 	 * Gets the “OK” button.
171 	 *
172 	 * Deprecated: Use #GtkFontChooserDialog
173 	 *
174 	 * Return: the #GtkWidget used in the dialog
175 	 *     for the “OK” button.
176 	 *
177 	 * Since: 2.14
178 	 */
179 	public Widget getOkButton()
180 	{
181 		auto p = gtk_font_selection_dialog_get_ok_button(gtkFontSelectionDialog);
182 		
183 		if(p is null)
184 		{
185 			return null;
186 		}
187 		
188 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
189 	}
190 
191 	/**
192 	 * Gets the text displayed in the preview area.
193 	 *
194 	 * Deprecated: Use #GtkFontChooserDialog
195 	 *
196 	 * Return: the text displayed in the preview area.
197 	 *     This string is owned by the widget and should not be
198 	 *     modified or freed
199 	 */
200 	public string getPreviewText()
201 	{
202 		return Str.toString(gtk_font_selection_dialog_get_preview_text(gtkFontSelectionDialog));
203 	}
204 
205 	/**
206 	 * Sets the currently selected font.
207 	 *
208 	 * Deprecated: Use #GtkFontChooserDialog
209 	 *
210 	 * Params:
211 	 *     fontname = a font name like “Helvetica 12” or “Times Bold 18”
212 	 *
213 	 * Return: %TRUE if the font selected in @fsd is now the
214 	 *     @fontname specified, %FALSE otherwise.
215 	 */
216 	public bool setFontName(string fontname)
217 	{
218 		return gtk_font_selection_dialog_set_font_name(gtkFontSelectionDialog, Str.toStringz(fontname)) != 0;
219 	}
220 
221 	/**
222 	 * Sets the text displayed in the preview area.
223 	 *
224 	 * Deprecated: Use #GtkFontChooserDialog
225 	 *
226 	 * Params:
227 	 *     text = the text to display in the preview area
228 	 */
229 	public void setPreviewText(string text)
230 	{
231 		gtk_font_selection_dialog_set_preview_text(gtkFontSelectionDialog, Str.toStringz(text));
232 	}
233 }