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.FontSelection; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.Box; 31 private import gtk.Widget; 32 private import gtkc.gtk; 33 public import gtkc.gtktypes; 34 private import pango.PgFontFace; 35 private import pango.PgFontFamily; 36 37 38 public class FontSelection : Box 39 { 40 /** the main Gtk struct */ 41 protected GtkFontSelection* gtkFontSelection; 42 43 /** Get the main Gtk struct */ 44 public GtkFontSelection* getFontSelectionStruct() 45 { 46 return gtkFontSelection; 47 } 48 49 /** the main Gtk struct as a void* */ 50 protected override void* getStruct() 51 { 52 return cast(void*)gtkFontSelection; 53 } 54 55 protected override void setStruct(GObject* obj) 56 { 57 gtkFontSelection = cast(GtkFontSelection*)obj; 58 super.setStruct(obj); 59 } 60 61 /** 62 * Sets our main struct and passes it to the parent class. 63 */ 64 public this (GtkFontSelection* gtkFontSelection, bool ownedRef = false) 65 { 66 this.gtkFontSelection = gtkFontSelection; 67 super(cast(GtkBox*)gtkFontSelection, ownedRef); 68 } 69 70 /** 71 */ 72 73 public static GType getType() 74 { 75 return gtk_font_selection_get_type(); 76 } 77 78 /** 79 * Creates a new #GtkFontSelection. 80 * 81 * Deprecated: Use #GtkFontChooserWidget instead 82 * 83 * Return: a new #GtkFontSelection 84 * 85 * Throws: ConstructionException GTK+ fails to create the object. 86 */ 87 public this() 88 { 89 auto p = gtk_font_selection_new(); 90 91 if(p is null) 92 { 93 throw new ConstructionException("null returned by new"); 94 } 95 96 this(cast(GtkFontSelection*) p); 97 } 98 99 /** 100 * Gets the #PangoFontFace representing the selected font group 101 * details (i.e. family, slant, weight, width, etc). 102 * 103 * Deprecated: Use #GtkFontChooser 104 * 105 * Return: A #PangoFontFace representing the 106 * selected font group details. The returned object is owned by 107 * @fontsel and must not be modified or freed. 108 * 109 * Since: 2.14 110 */ 111 public PgFontFace getFace() 112 { 113 auto p = gtk_font_selection_get_face(gtkFontSelection); 114 115 if(p is null) 116 { 117 return null; 118 } 119 120 return ObjectG.getDObject!(PgFontFace)(cast(PangoFontFace*) p); 121 } 122 123 /** 124 * This returns the #GtkTreeView which lists all styles available for 125 * the selected font. For example, “Regular”, “Bold”, etc. 126 * 127 * Deprecated: Use #GtkFontChooser 128 * 129 * Return: A #GtkWidget that is part of @fontsel 130 * 131 * Since: 2.14 132 */ 133 public Widget getFaceList() 134 { 135 auto p = gtk_font_selection_get_face_list(gtkFontSelection); 136 137 if(p is null) 138 { 139 return null; 140 } 141 142 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 143 } 144 145 /** 146 * Gets the #PangoFontFamily representing the selected font family. 147 * 148 * Deprecated: Use #GtkFontChooser 149 * 150 * Return: A #PangoFontFamily representing the 151 * selected font family. Font families are a collection of font 152 * faces. The returned object is owned by @fontsel and must not 153 * be modified or freed. 154 * 155 * Since: 2.14 156 */ 157 public PgFontFamily getFamily() 158 { 159 auto p = gtk_font_selection_get_family(gtkFontSelection); 160 161 if(p is null) 162 { 163 return null; 164 } 165 166 return ObjectG.getDObject!(PgFontFamily)(cast(PangoFontFamily*) p); 167 } 168 169 /** 170 * This returns the #GtkTreeView that lists font families, for 171 * example, “Sans”, “Serif”, etc. 172 * 173 * Deprecated: Use #GtkFontChooser 174 * 175 * Return: A #GtkWidget that is part of @fontsel 176 * 177 * Since: 2.14 178 */ 179 public Widget getFamilyList() 180 { 181 auto p = gtk_font_selection_get_family_list(gtkFontSelection); 182 183 if(p is null) 184 { 185 return null; 186 } 187 188 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 189 } 190 191 /** 192 * Gets the currently-selected font name. 193 * 194 * Note that this can be a different string than what you set with 195 * gtk_font_selection_set_font_name(), as the font selection widget may 196 * normalize font names and thus return a string with a different structure. 197 * For example, “Helvetica Italic Bold 12” could be normalized to 198 * “Helvetica Bold Italic 12”. Use pango_font_description_equal() 199 * if you want to compare two font descriptions. 200 * 201 * Deprecated: Use #GtkFontChooser 202 * 203 * Return: A string with the name of the current font, or %NULL if 204 * no font is selected. You must free this string with g_free(). 205 */ 206 public string getFontName() 207 { 208 return Str.toString(gtk_font_selection_get_font_name(gtkFontSelection)); 209 } 210 211 /** 212 * This returns the #GtkEntry used to display the font as a preview. 213 * 214 * Deprecated: Use #GtkFontChooser 215 * 216 * Return: A #GtkWidget that is part of @fontsel 217 * 218 * Since: 2.14 219 */ 220 public Widget getPreviewEntry() 221 { 222 auto p = gtk_font_selection_get_preview_entry(gtkFontSelection); 223 224 if(p is null) 225 { 226 return null; 227 } 228 229 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 230 } 231 232 /** 233 * Gets the text displayed in the preview area. 234 * 235 * Deprecated: Use #GtkFontChooser 236 * 237 * Return: the text displayed in the preview area. 238 * This string is owned by the widget and should not be 239 * modified or freed 240 */ 241 public string getPreviewText() 242 { 243 return Str.toString(gtk_font_selection_get_preview_text(gtkFontSelection)); 244 } 245 246 /** 247 * The selected font size. 248 * 249 * Deprecated: Use #GtkFontChooser 250 * 251 * Return: A n integer representing the selected font size, 252 * or -1 if no font size is selected. 253 * 254 * Since: 2.14 255 */ 256 public int getSize() 257 { 258 return gtk_font_selection_get_size(gtkFontSelection); 259 } 260 261 /** 262 * This returns the #GtkEntry used to allow the user to edit the font 263 * number manually instead of selecting it from the list of font sizes. 264 * 265 * Deprecated: Use #GtkFontChooser 266 * 267 * Return: A #GtkWidget that is part of @fontsel 268 * 269 * Since: 2.14 270 */ 271 public Widget getSizeEntry() 272 { 273 auto p = gtk_font_selection_get_size_entry(gtkFontSelection); 274 275 if(p is null) 276 { 277 return null; 278 } 279 280 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 281 } 282 283 /** 284 * This returns the #GtkTreeView used to list font sizes. 285 * 286 * Deprecated: Use #GtkFontChooser 287 * 288 * Return: A #GtkWidget that is part of @fontsel 289 * 290 * Since: 2.14 291 */ 292 public Widget getSizeList() 293 { 294 auto p = gtk_font_selection_get_size_list(gtkFontSelection); 295 296 if(p is null) 297 { 298 return null; 299 } 300 301 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 302 } 303 304 /** 305 * Sets the currently-selected font. 306 * 307 * Note that the @fontsel needs to know the screen in which it will appear 308 * for this to work; this can be guaranteed by simply making sure that the 309 * @fontsel is inserted in a toplevel window before you call this function. 310 * 311 * Deprecated: Use #GtkFontChooser 312 * 313 * Params: 314 * fontname = a font name like “Helvetica 12” or “Times Bold 18” 315 * 316 * Return: %TRUE if the font could be set successfully; %FALSE if no 317 * such font exists or if the @fontsel doesn’t belong to a particular 318 * screen yet. 319 */ 320 public bool setFontName(string fontname) 321 { 322 return gtk_font_selection_set_font_name(gtkFontSelection, Str.toStringz(fontname)) != 0; 323 } 324 325 /** 326 * Sets the text displayed in the preview area. 327 * The @text is used to show how the selected font looks. 328 * 329 * Deprecated: Use #GtkFontChooser 330 * 331 * Params: 332 * text = the text to display in the preview area 333 */ 334 public void setPreviewText(string text) 335 { 336 gtk_font_selection_set_preview_text(gtkFontSelection, Str.toStringz(text)); 337 } 338 }