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