alternative to assert
[gtkD.git] / gtkD / src / gtk / FontSelectionDialog.d
blob3797c1c2eddcd04c460a6cce130f7fa09885d0b1
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkFontSelectionDialog.html
26 * outPack = gtk
27 * outFile = FontSelectionDialog
28 * strct = GtkFontSelectionDialog
29 * realStrct=
30 * ctorStrct=
31 * clss = FontSelectionDialog
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_font_selection_dialog_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gdk.Font
47 * structWrap:
48 * - GdkFont* -> Font
49 * module aliases:
50 * local aliases:
53 module gtk.FontSelectionDialog;
55 version(noAssert)
57 version(Tango)
59 import tango.io.Stdout; // use the tango loging?
63 private import gtkc.gtktypes;
65 private import gtkc.gtk;
68 private import glib.Str;
69 private import gdk.Font;
74 /**
75 * Description
76 * The GtkFontSelectionDialog widget is a dialog box for selecting a font.
77 * To set the font which is initially selected, use
78 * gtk_font_selection_dialog_set_font_name().
79 * To get the selected font use gtk_font_selection_dialog_get_font_name().
80 * To change the text which is shown in the preview area, use
81 * gtk_font_selection_dialog_set_preview_text().
83 private import gtk.Dialog;
84 public class FontSelectionDialog : Dialog
87 /** the main Gtk struct */
88 protected GtkFontSelectionDialog* gtkFontSelectionDialog;
91 public GtkFontSelectionDialog* getFontSelectionDialogStruct()
93 return gtkFontSelectionDialog;
97 /** the main Gtk struct as a void* */
98 protected void* getStruct()
100 return cast(void*)gtkFontSelectionDialog;
104 * Sets our main struct and passes it to the parent class
106 public this (GtkFontSelectionDialog* gtkFontSelectionDialog)
108 version(noAssert)
110 if ( gtkFontSelectionDialog is null )
112 int zero = 0;
113 version(Tango)
115 Stdout("struct gtkFontSelectionDialog is null on constructor").newline;
117 else
119 printf("struct gtkFontSelectionDialog is null on constructor");
121 zero = zero / zero;
124 else
126 assert(gtkFontSelectionDialog !is null, "struct gtkFontSelectionDialog is null on constructor");
128 super(cast(GtkDialog*)gtkFontSelectionDialog);
129 this.gtkFontSelectionDialog = gtkFontSelectionDialog;
137 * Creates a new GtkFontSelectionDialog.
138 * title:
139 * the title of the dialog box.
140 * Returns:
141 * a new GtkFontSelectionDialog.
143 public this (char[] title)
145 // GtkWidget* gtk_font_selection_dialog_new (const gchar *title);
146 this(cast(GtkFontSelectionDialog*)gtk_font_selection_dialog_new(Str.toStringz(title)) );
150 * Warning
151 * gtk_font_selection_dialog_get_font is deprecated and should not be used in newly-written code.
152 * Gets the currently-selected font.
153 * fsd:
154 * a GtkFontSelectionDialog.
155 * Returns:
156 * the currently-selected font, or NULL if no font is selected.
158 public Font getFont()
160 // GdkFont* gtk_font_selection_dialog_get_font (GtkFontSelectionDialog *fsd);
161 return new Font( gtk_font_selection_dialog_get_font(gtkFontSelectionDialog) );
165 * Gets the currently-selected font name. Note that this can be a different
166 * string than what you set with gtk_font_selection_dialog_set_font_name(), as
167 * the font selection widget may normalize font names and thus return a string
168 * with a different structure. For example, "Helvetica Italic Bold 12" could be
169 * normalized to "Helvetica Bold Italic 12". Use pango_font_description_equal()
170 * if you want to compare two font descriptions.
171 * fsd:
172 * a GtkFontSelectionDialog
173 * Returns:
174 * A string with the name of the current font, or NULL if no font
175 * is selected. You must free this string with g_free().
177 public char[] getFontName()
179 // gchar* gtk_font_selection_dialog_get_font_name (GtkFontSelectionDialog *fsd);
180 return Str.toString(gtk_font_selection_dialog_get_font_name(gtkFontSelectionDialog) );
184 * Sets the currently-selected font.
185 * fsd:
186 * a GtkFontSelectionDialog.
187 * fontname:
188 * a fontname.
189 * Returns:
190 * TRUE if the font was found.
192 public int setFontName(char[] fontname)
194 // gboolean gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd, const gchar *fontname);
195 return gtk_font_selection_dialog_set_font_name(gtkFontSelectionDialog, Str.toStringz(fontname));
199 * Gets the text displayed in the preview area.
200 * fsd:
201 * a GtkFontSelectionDialog.
202 * Returns:
203 * the text displayed in the preview area. This string is owned
204 * by the widget and should not be modified or freed.
206 public char[] getPreviewText()
208 // const gchar* gtk_font_selection_dialog_get_preview_text (GtkFontSelectionDialog *fsd);
209 return Str.toString(gtk_font_selection_dialog_get_preview_text(gtkFontSelectionDialog) );
213 * Sets the text displayed in the preview area.
214 * fsd:
215 * a GtkFontSelectionDialog.
216 * text:
217 * the text to display in the preview area.
218 * See Also
219 * GtkFontSelection, GtkDialog
220 * the underlying widget for selecting
221 * fonts.
222 * the parent class of GtkFontSelectionDialog
224 public void setPreviewText(char[] text)
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));