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.FontChooserIF; 26 27 private import glib.Str; 28 private import gobject.ObjectG; 29 private import gobject.Signals; 30 public import gtkc.gdktypes; 31 private import gtkc.gtk; 32 public import gtkc.gtktypes; 33 private import pango.PgFontDescription; 34 private import pango.PgFontFace; 35 private import pango.PgFontFamily; 36 37 38 /** 39 * #GtkFontChooser is an interface that can be implemented by widgets 40 * displaying the list of fonts. In GTK+, the main objects 41 * that implement this interface are #GtkFontChooserWidget, 42 * #GtkFontChooserDialog and #GtkFontButton. 43 */ 44 public interface FontChooserIF{ 45 /** Get the main Gtk struct */ 46 public GtkFontChooser* getFontChooserStruct(); 47 48 /** the main Gtk struct as a void* */ 49 protected void* getStruct(); 50 51 /** 52 */ 53 54 /** 55 * Gets the currently-selected font name. 56 * 57 * Note that this can be a different string than what you set with 58 * gtk_font_chooser_set_font(), as the font chooser widget may 59 * normalize font names and thus return a string with a different 60 * structure. For example, “Helvetica Italic Bold 12” could be 61 * normalized to “Helvetica Bold Italic 12”. 62 * 63 * Use pango_font_description_equal() if you want to compare two 64 * font descriptions. 65 * 66 * Return: A string with the name 67 * of the current font, or %NULL if no font is selected. You must 68 * free this string with g_free(). 69 * 70 * Since: 3.2 71 */ 72 public string getFont(); 73 74 /** 75 * Gets the currently-selected font. 76 * 77 * Note that this can be a different string than what you set with 78 * gtk_font_chooser_set_font(), as the font chooser widget may 79 * normalize font names and thus return a string with a different 80 * structure. For example, “Helvetica Italic Bold 12” could be 81 * normalized to “Helvetica Bold Italic 12”. 82 * 83 * Use pango_font_description_equal() if you want to compare two 84 * font descriptions. 85 * 86 * Return: A #PangoFontDescription for the 87 * current font, or %NULL if no font is selected. 88 * 89 * Since: 3.2 90 */ 91 public PgFontDescription getFontDesc(); 92 93 /** 94 * Gets the #PangoFontFace representing the selected font group 95 * details (i.e. family, slant, weight, width, etc). 96 * 97 * If the selected font is not installed, returns %NULL. 98 * 99 * Return: A #PangoFontFace representing the 100 * selected font group details, or %NULL. The returned object is owned by 101 * @fontchooser and must not be modified or freed. 102 * 103 * Since: 3.2 104 */ 105 public PgFontFace getFontFace(); 106 107 /** 108 * Gets the #PangoFontFamily representing the selected font family. 109 * Font families are a collection of font faces. 110 * 111 * If the selected font is not installed, returns %NULL. 112 * 113 * Return: A #PangoFontFamily representing the 114 * selected font family, or %NULL. The returned object is owned by @fontchooser 115 * and must not be modified or freed. 116 * 117 * Since: 3.2 118 */ 119 public PgFontFamily getFontFamily(); 120 121 /** 122 * The selected font size. 123 * 124 * Return: A n integer representing the selected font size, 125 * or -1 if no font size is selected. 126 * 127 * Since: 3.2 128 */ 129 public int getFontSize(); 130 131 /** 132 * Gets the text displayed in the preview area. 133 * 134 * Return: the text displayed in the 135 * preview area 136 * 137 * Since: 3.2 138 */ 139 public string getPreviewText(); 140 141 /** 142 * Returns whether the preview entry is shown or not. 143 * 144 * Return: %TRUE if the preview entry is shown 145 * or %FALSE if it is hidden. 146 * 147 * Since: 3.2 148 */ 149 public bool getShowPreviewEntry(); 150 151 /** 152 * Adds a filter function that decides which fonts to display 153 * in the font chooser. 154 * 155 * Params: 156 * filter = a #GtkFontFilterFunc, or %NULL 157 * userData = data to pass to @filter 158 * destroy = function to call to free @data when it is no longer needed 159 * 160 * Since: 3.2 161 */ 162 public void setFilterFunc(GtkFontFilterFunc filter, void* userData, GDestroyNotify destroy); 163 164 /** 165 * Sets the currently-selected font. 166 * 167 * Params: 168 * fontname = a font name like “Helvetica 12” or “Times Bold 18” 169 * 170 * Since: 3.2 171 */ 172 public void setFont(string fontname); 173 174 /** 175 * Sets the currently-selected font from @font_desc. 176 * 177 * Params: 178 * fontDesc = a #PangoFontDescription 179 * 180 * Since: 3.2 181 */ 182 public void setFontDesc(PgFontDescription fontDesc); 183 184 /** 185 * Sets the text displayed in the preview area. 186 * The @text is used to show how the selected font looks. 187 * 188 * Params: 189 * text = the text to display in the preview area 190 * 191 * Since: 3.2 192 */ 193 public void setPreviewText(string text); 194 195 /** 196 * Shows or hides the editable preview entry. 197 * 198 * Params: 199 * showPreviewEntry = whether to show the editable preview entry or not 200 * 201 * Since: 3.2 202 */ 203 public void setShowPreviewEntry(bool showPreviewEntry); 204 @property void delegate(string, FontChooserIF)[] onFontActivatedListeners(); 205 /** 206 * Emitted when a font is activated. 207 * This usually happens when the user double clicks an item, 208 * or an item is selected and the user presses one of the keys 209 * Space, Shift+Space, Return or Enter. 210 * 211 * Params: 212 * fontname = the font name 213 */ 214 void addOnFontActivated(void delegate(string, FontChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 215 216 }