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