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