alternative to assert
[gtkD.git] / gtkD / src / gtk / FontButton.d
blob58e008018ab43c503ba0b71f8c26cc1b978e84ce
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 = GtkFontButton.html
26 * outPack = gtk
27 * outFile = FontButton
28 * strct = GtkFontButton
29 * realStrct=
30 * ctorStrct=
31 * clss = FontButton
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_font_button_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * structWrap:
47 * module aliases:
48 * local aliases:
51 module gtk.FontButton;
53 version(noAssert)
55 version(Tango)
57 import tango.io.Stdout; // use the tango loging?
61 private import gtkc.gtktypes;
63 private import gtkc.gtk;
66 private import glib.Str;
71 /**
72 * Description
73 * The GtkFontButton is a button which displays the currently selected font an allows to open a font selection
74 * dialog to change the font. It is suitable widget for selecting a font in a preference dialog.
76 private import gtk.Button;
77 public class FontButton : Button
80 /** the main Gtk struct */
81 protected GtkFontButton* gtkFontButton;
84 public GtkFontButton* getFontButtonStruct()
86 return gtkFontButton;
90 /** the main Gtk struct as a void* */
91 protected void* getStruct()
93 return cast(void*)gtkFontButton;
96 /**
97 * Sets our main struct and passes it to the parent class
99 public this (GtkFontButton* gtkFontButton)
101 version(noAssert)
103 if ( gtkFontButton is null )
105 int zero = 0;
106 version(Tango)
108 Stdout("struct gtkFontButton is null on constructor").newline;
110 else
112 printf("struct gtkFontButton is null on constructor");
114 zero = zero / zero;
117 else
119 assert(gtkFontButton !is null, "struct gtkFontButton is null on constructor");
121 super(cast(GtkButton*)gtkFontButton);
122 this.gtkFontButton = gtkFontButton;
128 // imports for the signal processing
129 private import gobject.Signals;
130 private import gtkc.gdktypes;
131 int[char[]] connectedSignals;
133 void delegate(FontButton)[] onFontSetListeners;
134 void addOnFontSet(void delegate(FontButton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
136 if ( !("font-set" in connectedSignals) )
138 Signals.connectData(
139 getStruct(),
140 "font-set",
141 cast(GCallback)&callBackFontSet,
142 cast(void*)this,
143 null,
144 connectFlags);
145 connectedSignals["font-set"] = 1;
147 onFontSetListeners ~= dlg;
149 extern(C) static void callBackFontSet(GtkFontButton* widgetStruct, FontButton fontButton)
151 bool consumed = false;
153 foreach ( void delegate(FontButton) dlg ; fontButton.onFontSetListeners )
155 dlg(fontButton);
158 return consumed;
164 * Creates a new font picker widget.
165 * Returns:
166 * a new font picker widget.
167 * Since 2.4
169 public this ()
171 // GtkWidget* gtk_font_button_new (void);
172 this(cast(GtkFontButton*)gtk_font_button_new() );
176 * Creates a new font picker widget.
177 * fontname:
178 * Name of font to display in font selection dialog
179 * Returns:
180 * a new font picker widget.
181 * Since 2.4
183 public this (char[] fontname)
185 // GtkWidget* gtk_font_button_new_with_font (const gchar *fontname);
186 this(cast(GtkFontButton*)gtk_font_button_new_with_font(Str.toStringz(fontname)) );
190 * Sets or updates the currently-displayed font in font picker dialog.
191 * font_button:
192 * a GtkFontButton
193 * fontname:
194 * Name of font to display in font selection dialog
195 * Returns:
196 * Return value of gtk_font_selection_dialog_set_font_name() if the
197 * font selection dialog exists, otherwise FALSE.
198 * Since 2.4
200 public int setFontName(char[] fontname)
202 // gboolean gtk_font_button_set_font_name (GtkFontButton *font_button, const gchar *fontname);
203 return gtk_font_button_set_font_name(gtkFontButton, Str.toStringz(fontname));
207 * Retrieves the name of the currently selected font.
208 * font_button:
209 * a GtkFontButton
210 * Returns:
211 * an internal copy of the font name which must not be freed.
212 * Since 2.4
214 public char[] getFontName()
216 // const gchar* gtk_font_button_get_font_name (GtkFontButton *font_button);
217 return Str.toString(gtk_font_button_get_font_name(gtkFontButton) );
221 * If show_style is TRUE, the font style will be displayed along with name of the selected font.
222 * font_button:
223 * a GtkFontButton
224 * show_style:
225 * TRUE if font style should be displayed in label.
226 * Since 2.4
228 public void setShowStyle(int showStyle)
230 // void gtk_font_button_set_show_style (GtkFontButton *font_button, gboolean show_style);
231 gtk_font_button_set_show_style(gtkFontButton, showStyle);
235 * Returns whether the name of the font style will be shown in the label.
236 * font_button:
237 * a GtkFontButton
238 * Returns:
239 * whether the font style will be shown in the label.
240 * Since 2.4
242 public int getShowStyle()
244 // gboolean gtk_font_button_get_show_style (GtkFontButton *font_button);
245 return gtk_font_button_get_show_style(gtkFontButton);
249 * If show_size is TRUE, the font size will be displayed along with the name of the selected font.
250 * font_button:
251 * a GtkFontButton
252 * show_size:
253 * TRUE if font size should be displayed in dialog.
254 * Since 2.4
256 public void setShowSize(int showSize)
258 // void gtk_font_button_set_show_size (GtkFontButton *font_button, gboolean show_size);
259 gtk_font_button_set_show_size(gtkFontButton, showSize);
263 * Returns whether the font size will be shown in the label.
264 * font_button:
265 * a GtkFontButton
266 * Returns:
267 * whether the font size will be shown in the label.
268 * Since 2.4
270 public int getShowSize()
272 // gboolean gtk_font_button_get_show_size (GtkFontButton *font_button);
273 return gtk_font_button_get_show_size(gtkFontButton);
277 * If use_font is TRUE, the font name will be written using the selected font.
278 * font_button:
279 * a GtkFontButton
280 * use_font:
281 * If TRUE, font name will be written using font chosen.
282 * Since 2.4
284 public void setUseFont(int useFont)
286 // void gtk_font_button_set_use_font (GtkFontButton *font_button, gboolean use_font);
287 gtk_font_button_set_use_font(gtkFontButton, useFont);
291 * Returns whether the selected font is used in the label.
292 * font_button:
293 * a GtkFontButton
294 * Returns:
295 * whether the selected font is used in the label.
296 * Since 2.4
298 public int getUseFont()
300 // gboolean gtk_font_button_get_use_font (GtkFontButton *font_button);
301 return gtk_font_button_get_use_font(gtkFontButton);
305 * If use_size is TRUE, the font name will be written using the selected size.
306 * font_button:
307 * a GtkFontButton
308 * use_size:
309 * If TRUE, font name will be written using the selected size.
310 * Since 2.4
312 public void setUseSize(int useSize)
314 // void gtk_font_button_set_use_size (GtkFontButton *font_button, gboolean use_size);
315 gtk_font_button_set_use_size(gtkFontButton, useSize);
319 * Returns whether the selected size is used in the label.
320 * font_button:
321 * a GtkFontButton
322 * Returns:
323 * whether the selected size is used in the label.
324 * Since 2.4
326 public int getUseSize()
328 // gboolean gtk_font_button_get_use_size (GtkFontButton *font_button);
329 return gtk_font_button_get_use_size(gtkFontButton);
333 * Sets the title for the font selection dialog.
334 * font_button:
335 * a GtkFontButton
336 * title:
337 * a string containing the font selection dialog title
338 * Since 2.4
340 public void setTitle(char[] title)
342 // void gtk_font_button_set_title (GtkFontButton *font_button, const gchar *title);
343 gtk_font_button_set_title(gtkFontButton, Str.toStringz(title));
347 * Retrieves the title of the font selection dialog.
348 * font_button:
349 * a GtkFontButton
350 * Returns:
351 * an internal copy of the title string which must not be freed.
352 * Since 2.4
353 * Property Details
354 * The "font-name" property
355 * "font-name" gchararray : Read / Write
356 * The name of the currently selected font.
357 * Default value: "Sans 12"
358 * Since 2.4
360 public char[] getTitle()
362 // const gchar* gtk_font_button_get_title (GtkFontButton *font_button);
363 return Str.toString(gtk_font_button_get_title(gtkFontButton) );