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 module gtk.FontSelectionDialog; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.Dialog; 31 private import gtk.FontSelection; 32 private import gtk.Widget; 33 private import gtkc.gtk; 34 public import gtkc.gtktypes; 35 36 37 public class FontSelectionDialog : Dialog 38 { 39 /** the main Gtk struct */ 40 protected GtkFontSelectionDialog* gtkFontSelectionDialog; 41 42 /** Get the main Gtk struct */ 43 public GtkFontSelectionDialog* getFontSelectionDialogStruct() 44 { 45 return gtkFontSelectionDialog; 46 } 47 48 /** the main Gtk struct as a void* */ 49 protected override void* getStruct() 50 { 51 return cast(void*)gtkFontSelectionDialog; 52 } 53 54 protected override void setStruct(GObject* obj) 55 { 56 gtkFontSelectionDialog = cast(GtkFontSelectionDialog*)obj; 57 super.setStruct(obj); 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GtkFontSelectionDialog* gtkFontSelectionDialog, bool ownedRef = false) 64 { 65 this.gtkFontSelectionDialog = gtkFontSelectionDialog; 66 super(cast(GtkDialog*)gtkFontSelectionDialog, ownedRef); 67 } 68 69 /** 70 * Retrieves the FontSelection widget embedded in the dialog. 71 * 72 * Deprecated: Use FontChooserDialog 73 * 74 * Return: the embedded FontSelection 75 * 76 * Since: 2.22 77 */ 78 public FontSelection getFontSelection() 79 { 80 auto p = gtk_font_selection_dialog_get_font_selection(gtkFontSelectionDialog); 81 82 if(p is null) 83 { 84 return null; 85 } 86 87 return ObjectG.getDObject!(FontSelection)(cast(GtkFontSelection*) p); 88 } 89 90 /** 91 */ 92 93 public static GType getType() 94 { 95 return gtk_font_selection_dialog_get_type(); 96 } 97 98 /** 99 * Creates a new #GtkFontSelectionDialog. 100 * 101 * Deprecated: Use #GtkFontChooserDialog 102 * 103 * Params: 104 * title = the title of the dialog window 105 * 106 * Return: a new #GtkFontSelectionDialog 107 * 108 * Throws: ConstructionException GTK+ fails to create the object. 109 */ 110 public this(string title) 111 { 112 auto p = gtk_font_selection_dialog_new(Str.toStringz(title)); 113 114 if(p is null) 115 { 116 throw new ConstructionException("null returned by new"); 117 } 118 119 this(cast(GtkFontSelectionDialog*) p); 120 } 121 122 /** 123 * Gets the “Cancel” button. 124 * 125 * Deprecated: Use #GtkFontChooserDialog 126 * 127 * Return: the #GtkWidget used in the dialog 128 * for the “Cancel” button. 129 * 130 * Since: 2.14 131 */ 132 public Widget getCancelButton() 133 { 134 auto p = gtk_font_selection_dialog_get_cancel_button(gtkFontSelectionDialog); 135 136 if(p is null) 137 { 138 return null; 139 } 140 141 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 142 } 143 144 /** 145 * Gets the currently-selected font name. 146 * 147 * Note that this can be a different string than what you set with 148 * gtk_font_selection_dialog_set_font_name(), as the font selection widget 149 * may normalize font names and thus return a string with a different 150 * structure. For example, “Helvetica Italic Bold 12” could be normalized 151 * to “Helvetica Bold Italic 12”. Use pango_font_description_equal() 152 * if you want to compare two font descriptions. 153 * 154 * Deprecated: Use #GtkFontChooserDialog 155 * 156 * Return: A string with the name of the current font, or %NULL if no 157 * font is selected. You must free this string with g_free(). 158 */ 159 public string getFontName() 160 { 161 return Str.toString(gtk_font_selection_dialog_get_font_name(gtkFontSelectionDialog)); 162 } 163 164 /** 165 * Gets the “OK” button. 166 * 167 * Deprecated: Use #GtkFontChooserDialog 168 * 169 * Return: the #GtkWidget used in the dialog 170 * for the “OK” button. 171 * 172 * Since: 2.14 173 */ 174 public Widget getOkButton() 175 { 176 auto p = gtk_font_selection_dialog_get_ok_button(gtkFontSelectionDialog); 177 178 if(p is null) 179 { 180 return null; 181 } 182 183 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 184 } 185 186 /** 187 * Gets the text displayed in the preview area. 188 * 189 * Deprecated: Use #GtkFontChooserDialog 190 * 191 * Return: the text displayed in the preview area. 192 * This string is owned by the widget and should not be 193 * modified or freed 194 */ 195 public string getPreviewText() 196 { 197 return Str.toString(gtk_font_selection_dialog_get_preview_text(gtkFontSelectionDialog)); 198 } 199 200 /** 201 * Sets the currently selected font. 202 * 203 * Deprecated: Use #GtkFontChooserDialog 204 * 205 * Params: 206 * fontname = a font name like “Helvetica 12” or “Times Bold 18” 207 * 208 * Return: %TRUE if the font selected in @fsd is now the 209 * @fontname specified, %FALSE otherwise. 210 */ 211 public bool setFontName(string fontname) 212 { 213 return gtk_font_selection_dialog_set_font_name(gtkFontSelectionDialog, Str.toStringz(fontname)) != 0; 214 } 215 216 /** 217 * Sets the text displayed in the preview area. 218 * 219 * Deprecated: Use #GtkFontChooserDialog 220 * 221 * Params: 222 * text = the text to display in the preview area 223 */ 224 public void setPreviewText(string text) 225 { 226 gtk_font_selection_dialog_set_preview_text(gtkFontSelectionDialog, Str.toStringz(text)); 227 } 228 }