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 * Conversion parameters: 26 * inFile = GtkFontSelectionDialog.html 27 * outPack = gtk 28 * outFile = FontSelectionDialog 29 * strct = GtkFontSelectionDialog 30 * realStrct= 31 * ctorStrct= 32 * clss = FontSelectionDialog 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_font_selection_dialog_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * - gtk_font_selection_dialog_get_font_selection 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gtk.FontSelection 49 * - gtk.Widget 50 * structWrap: 51 * - GtkWidget* -> Widget 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module gtk.FontSelectionDialog; 58 59 public import gtkc.gtktypes; 60 61 private import gtkc.gtk; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 66 private import glib.Str; 67 private import gtk.FontSelection; 68 private import gtk.Widget; 69 70 71 72 private import gtk.Dialog; 73 74 /** 75 * The GtkFontSelectionDialog widget is a dialog box for selecting a font. 76 * 77 * To set the font which is initially selected, use 78 * gtk_font_selection_dialog_set_font_name(). 79 * 80 * To get the selected font use gtk_font_selection_dialog_get_font_name(). 81 * 82 * To change the text which is shown in the preview area, use 83 * gtk_font_selection_dialog_set_preview_text(). 84 * 85 * In GTK+ 3.2, GtkFontSelectionDialog has been deprecated in favor of 86 * GtkFontChooserDialog. 87 * 88 * GtkFontSelectionDialog as GtkBuildable 89 * 90 * The GtkFontSelectionDialog implementation of the GtkBuildable interface 91 * exposes the embedded GtkFontSelection as internal child with the 92 * name "font_selection". It also exposes the buttons with the names 93 * "ok_button", "cancel_button" and "apply_button". 94 */ 95 public class FontSelectionDialog : Dialog 96 { 97 98 /** the main Gtk struct */ 99 protected GtkFontSelectionDialog* gtkFontSelectionDialog; 100 101 102 public GtkFontSelectionDialog* getFontSelectionDialogStruct() 103 { 104 return gtkFontSelectionDialog; 105 } 106 107 108 /** the main Gtk struct as a void* */ 109 protected override void* getStruct() 110 { 111 return cast(void*)gtkFontSelectionDialog; 112 } 113 114 /** 115 * Sets our main struct and passes it to the parent class 116 */ 117 public this (GtkFontSelectionDialog* gtkFontSelectionDialog) 118 { 119 super(cast(GtkDialog*)gtkFontSelectionDialog); 120 this.gtkFontSelectionDialog = gtkFontSelectionDialog; 121 } 122 123 protected override void setStruct(GObject* obj) 124 { 125 super.setStruct(obj); 126 gtkFontSelectionDialog = cast(GtkFontSelectionDialog*)obj; 127 } 128 129 /** 130 * Retrieves the GtkFontSelection widget embedded in the dialog. 131 * Since 2.22 132 * Returns: the embedded GtkFontSelection 133 */ 134 public FontSelection getFontSelection() 135 { 136 // GtkWidget * gtk_font_selection_dialog_get_font_selection (GtkFontSelectionDialog *fsd); 137 auto p = gtk_font_selection_dialog_get_font_selection(gtkFontSelectionDialog); 138 if(p is null) 139 { 140 return null; 141 } 142 return new FontSelection(cast(GtkFontSelection*) p); 143 } 144 145 /** 146 */ 147 148 /** 149 * Warning 150 * gtk_font_selection_dialog_new has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooserDialog 151 * Creates a new GtkFontSelectionDialog. 152 * Params: 153 * title = the title of the dialog window 154 * Throws: ConstructionException GTK+ fails to create the object. 155 */ 156 public this (string title) 157 { 158 // GtkWidget * gtk_font_selection_dialog_new (const gchar *title); 159 auto p = gtk_font_selection_dialog_new(Str.toStringz(title)); 160 if(p is null) 161 { 162 throw new ConstructionException("null returned by gtk_font_selection_dialog_new(Str.toStringz(title))"); 163 } 164 this(cast(GtkFontSelectionDialog*) p); 165 } 166 167 /** 168 * Warning 169 * gtk_font_selection_dialog_get_font_name has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooserDialog 170 * Gets the currently-selected font name. 171 * Note that this can be a different string than what you set with 172 * gtk_font_selection_dialog_set_font_name(), as the font selection widget 173 * may normalize font names and thus return a string with a different 174 * structure. For example, "Helvetica Italic Bold 12" could be normalized 175 * to "Helvetica Bold Italic 12". Use pango_font_description_equal() 176 * if you want to compare two font descriptions. 177 * Returns: A string with the name of the current font, or NULL if no font is selected. You must free this string with g_free(). 178 */ 179 public string getFontName() 180 { 181 // gchar * gtk_font_selection_dialog_get_font_name (GtkFontSelectionDialog *fsd); 182 return Str.toString(gtk_font_selection_dialog_get_font_name(gtkFontSelectionDialog)); 183 } 184 185 /** 186 * Warning 187 * gtk_font_selection_dialog_set_font_name has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooserDialog 188 * Sets the currently selected font. 189 * Params: 190 * fontname = a font name like "Helvetica 12" or "Times Bold 18" 191 * Returns: TRUE if the font selected in fsd is now the fontname specified, FALSE otherwise. 192 */ 193 public int setFontName(string fontname) 194 { 195 // gboolean gtk_font_selection_dialog_set_font_name (GtkFontSelectionDialog *fsd, const gchar *fontname); 196 return gtk_font_selection_dialog_set_font_name(gtkFontSelectionDialog, Str.toStringz(fontname)); 197 } 198 199 /** 200 * Warning 201 * gtk_font_selection_dialog_get_preview_text has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooserDialog 202 * Gets the text displayed in the preview area. 203 * Returns: the text displayed in the preview area. This string is owned by the widget and should not be modified or freed 204 */ 205 public string getPreviewText() 206 { 207 // const gchar * gtk_font_selection_dialog_get_preview_text (GtkFontSelectionDialog *fsd); 208 return Str.toString(gtk_font_selection_dialog_get_preview_text(gtkFontSelectionDialog)); 209 } 210 211 /** 212 * Warning 213 * gtk_font_selection_dialog_set_preview_text has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooserDialog 214 * Sets the text displayed in the preview area. 215 * Params: 216 * text = the text to display in the preview area 217 */ 218 public void setPreviewText(string text) 219 { 220 // void gtk_font_selection_dialog_set_preview_text (GtkFontSelectionDialog *fsd, const gchar *text); 221 gtk_font_selection_dialog_set_preview_text(gtkFontSelectionDialog, Str.toStringz(text)); 222 } 223 224 /** 225 * Warning 226 * gtk_font_selection_dialog_get_cancel_button has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooserDialog 227 * Gets the 'Cancel' button. 228 * Since 2.14 229 * Returns: the GtkWidget used in the dialog for the 'Cancel' button. [transfer none] 230 */ 231 public Widget getCancelButton() 232 { 233 // GtkWidget * gtk_font_selection_dialog_get_cancel_button (GtkFontSelectionDialog *fsd); 234 auto p = gtk_font_selection_dialog_get_cancel_button(gtkFontSelectionDialog); 235 236 if(p is null) 237 { 238 return null; 239 } 240 241 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 242 } 243 244 /** 245 * Warning 246 * gtk_font_selection_dialog_get_ok_button has been deprecated since version 3.2 and should not be used in newly-written code. Use GtkFontChooserDialog 247 * Gets the 'OK' button. 248 * Since 2.14 249 * Returns: the GtkWidget used in the dialog for the 'OK' button. [transfer none] 250 */ 251 public Widget getOkButton() 252 { 253 // GtkWidget * gtk_font_selection_dialog_get_ok_button (GtkFontSelectionDialog *fsd); 254 auto p = gtk_font_selection_dialog_get_ok_button(gtkFontSelectionDialog); 255 256 if(p is null) 257 { 258 return null; 259 } 260 261 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 262 } 263 }