alternative to assert
[gtkD.git] / gtkD / src / gtk / FontSelection.d
blob1029fc59c790f48232fadcdfa4a02a395c7e8526
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 = GtkFontSelection.html
26 * outPack = gtk
27 * outFile = FontSelection
28 * strct = GtkFontSelection
29 * realStrct=
30 * ctorStrct=
31 * clss = FontSelection
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_font_selection_
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.FontSelection;
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 GtkFontSelection widget lists the available fonts, styles and sizes,
77 * allowing the user to select a font.
78 * It is used in the GtkFontSelectionDialog widget to provide a dialog box for
79 * selecting fonts.
80 * To set the font which is initially selected, use
81 * gtk_font_selection_set_font_name().
82 * To get the selected font use gtk_font_selection_get_font_name().
83 * To change the text which is shown in the preview area, use
84 * gtk_font_selection_set_preview_text().
86 private import gtk.VBox;
87 public class FontSelection : VBox
90 /** the main Gtk struct */
91 protected GtkFontSelection* gtkFontSelection;
94 public GtkFontSelection* getFontSelectionStruct()
96 return gtkFontSelection;
100 /** the main Gtk struct as a void* */
101 protected void* getStruct()
103 return cast(void*)gtkFontSelection;
107 * Sets our main struct and passes it to the parent class
109 public this (GtkFontSelection* gtkFontSelection)
111 version(noAssert)
113 if ( gtkFontSelection is null )
115 int zero = 0;
116 version(Tango)
118 Stdout("struct gtkFontSelection is null on constructor").newline;
120 else
122 printf("struct gtkFontSelection is null on constructor");
124 zero = zero / zero;
127 else
129 assert(gtkFontSelection !is null, "struct gtkFontSelection is null on constructor");
131 super(cast(GtkVBox*)gtkFontSelection);
132 this.gtkFontSelection = gtkFontSelection;
140 * Creates a new GtkFontSelection.
141 * Returns:
142 * a new GtkFontSelection.
144 public this ()
146 // GtkWidget* gtk_font_selection_new (void);
147 this(cast(GtkFontSelection*)gtk_font_selection_new() );
151 * Warning
152 * gtk_font_selection_get_font is deprecated and should not be used in newly-written code.
153 * Gets the currently-selected font.
154 * fontsel:
155 * a GtkFontSelection.
156 * Returns:
157 * the currently-selected font, or NULL if no font is selected.
159 public Font getFont()
161 // GdkFont* gtk_font_selection_get_font (GtkFontSelection *fontsel);
162 return new Font( gtk_font_selection_get_font(gtkFontSelection) );
166 * Gets the currently-selected font name. Note that this can be a different
167 * string than what you set with gtk_font_selection_set_font_name(), as
168 * the font selection widget may normalize font names and thus return a string
169 * with a different structure. For example, "Helvetica Italic Bold 12" could be
170 * normalized to "Helvetica Bold Italic 12". Use pango_font_description_equal()
171 * if you want to compare two font descriptions.
172 * fontsel:
173 * a GtkFontSelection
174 * Returns:
175 * A string with the name of the current font, or NULL if no font
176 * is selected. You must free this string with g_free().
178 public char[] getFontName()
180 // gchar* gtk_font_selection_get_font_name (GtkFontSelection *fontsel);
181 return Str.toString(gtk_font_selection_get_font_name(gtkFontSelection) );
185 * Sets the currently-selected font. Note that the fontsel needs to know the
186 * screen in which it will appear for this to work; this can be guaranteed by
187 * simply making sure that the fontsel is inserted in a toplevel window before
188 * you call this function.
189 * fontsel:
190 * a GtkFontSelection
191 * fontname:
192 * a font name like "Helvetica 12" or "Times Bold 18"
193 * Returns:
194 * TRUE if the font could be set successfully; FALSE if no such
195 * font exists or if the fontsel doesn't belong to a particular screen yet.
197 public int setFontName(char[] fontname)
199 // gboolean gtk_font_selection_set_font_name (GtkFontSelection *fontsel, const gchar *fontname);
200 return gtk_font_selection_set_font_name(gtkFontSelection, Str.toStringz(fontname));
204 * Gets the text displayed in the preview area.
205 * fontsel:
206 * a GtkFontSelection.
207 * Returns:
208 * the text displayed in the preview area. This string is
209 * owned by the widget and should not be modified or freed.
211 public char[] getPreviewText()
213 // const gchar* gtk_font_selection_get_preview_text (GtkFontSelection *fontsel);
214 return Str.toString(gtk_font_selection_get_preview_text(gtkFontSelection) );
218 * Sets the text displayed in the preview area.
219 * fontsel:
220 * a GtkFontSelection.
221 * text:
222 * the text to display in the preview area.
223 * Property Details
224 * The "font" property
225 * "font" GdkFont : Read
226 * The GdkFont that is currently selected.
228 public void setPreviewText(char[] text)
230 // void gtk_font_selection_set_preview_text (GtkFontSelection *fontsel, const gchar *text);
231 gtk_font_selection_set_preview_text(gtkFontSelection, Str.toStringz(text));