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