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 private import pango.PgFontMap; 37 38 39 /** 40 * #GtkFontChooser is an interface that can be implemented by widgets 41 * displaying the list of fonts. In GTK+, the main objects 42 * that implement this interface are #GtkFontChooserWidget, 43 * #GtkFontChooserDialog and #GtkFontButton. The GtkFontChooser interface 44 * has been introducted in GTK+ 3.2. 45 */ 46 public interface FontChooserIF{ 47 /** Get the main Gtk struct */ 48 public GtkFontChooser* getFontChooserStruct(); 49 50 /** the main Gtk struct as a void* */ 51 protected void* getStruct(); 52 53 /** 54 */ 55 56 /** 57 * Gets the currently-selected font name. 58 * 59 * Note that this can be a different string than what you set with 60 * gtk_font_chooser_set_font(), as the font chooser widget may 61 * normalize font names and thus return a string with a different 62 * structure. For example, “Helvetica Italic Bold 12” could be 63 * normalized to “Helvetica Bold Italic 12”. 64 * 65 * Use pango_font_description_equal() if you want to compare two 66 * font descriptions. 67 * 68 * Return: A string with the name 69 * of the current font, or %NULL if no font is selected. You must 70 * free this string with g_free(). 71 * 72 * Since: 3.2 73 */ 74 public string getFont(); 75 76 /** 77 * Gets the currently-selected font. 78 * 79 * Note that this can be a different string than what you set with 80 * gtk_font_chooser_set_font(), as the font chooser widget may 81 * normalize font names and thus return a string with a different 82 * structure. For example, “Helvetica Italic Bold 12” could be 83 * normalized to “Helvetica Bold Italic 12”. 84 * 85 * Use pango_font_description_equal() if you want to compare two 86 * font descriptions. 87 * 88 * Return: A #PangoFontDescription for the 89 * current font, or %NULL if no font is selected. 90 * 91 * Since: 3.2 92 */ 93 public PgFontDescription getFontDesc(); 94 95 /** 96 * Gets the #PangoFontFace representing the selected font group 97 * details (i.e. family, slant, weight, width, etc). 98 * 99 * If the selected font is not installed, returns %NULL. 100 * 101 * Return: A #PangoFontFace representing the 102 * selected font group details, or %NULL. The returned object is owned by 103 * @fontchooser and must not be modified or freed. 104 * 105 * Since: 3.2 106 */ 107 public PgFontFace getFontFace(); 108 109 /** 110 * Gets the #PangoFontFamily representing the selected font family. 111 * Font families are a collection of font faces. 112 * 113 * If the selected font is not installed, returns %NULL. 114 * 115 * Return: A #PangoFontFamily representing the 116 * selected font family, or %NULL. The returned object is owned by @fontchooser 117 * and must not be modified or freed. 118 * 119 * Since: 3.2 120 */ 121 public PgFontFamily getFontFamily(); 122 123 /** 124 * Gets the custom font map of this font chooser widget, 125 * or %NULL if it does not have one. 126 * 127 * Return: a #PangoFontMap, or %NULL 128 * 129 * Since: 3.18 130 */ 131 public PgFontMap getFontMap(); 132 133 /** 134 * The selected font size. 135 * 136 * Return: A n integer representing the selected font size, 137 * or -1 if no font size is selected. 138 * 139 * Since: 3.2 140 */ 141 public int getFontSize(); 142 143 /** 144 * Gets the text displayed in the preview area. 145 * 146 * Return: the text displayed in the 147 * preview area 148 * 149 * Since: 3.2 150 */ 151 public string getPreviewText(); 152 153 /** 154 * Returns whether the preview entry is shown or not. 155 * 156 * Return: %TRUE if the preview entry is shown 157 * or %FALSE if it is hidden. 158 * 159 * Since: 3.2 160 */ 161 public bool getShowPreviewEntry(); 162 163 /** 164 * Adds a filter function that decides which fonts to display 165 * in the font chooser. 166 * 167 * Params: 168 * filter = a #GtkFontFilterFunc, or %NULL 169 * userData = data to pass to @filter 170 * destroy = function to call to free @data when it is no longer needed 171 * 172 * Since: 3.2 173 */ 174 public void setFilterFunc(GtkFontFilterFunc filter, void* userData, GDestroyNotify destroy); 175 176 /** 177 * Sets the currently-selected font. 178 * 179 * Params: 180 * fontname = a font name like “Helvetica 12” or “Times Bold 18” 181 * 182 * Since: 3.2 183 */ 184 public void setFont(string fontname); 185 186 /** 187 * Sets the currently-selected font from @font_desc. 188 * 189 * Params: 190 * fontDesc = a #PangoFontDescription 191 * 192 * Since: 3.2 193 */ 194 public void setFontDesc(PgFontDescription fontDesc); 195 196 /** 197 * Sets a custom font map to use for this font chooser widget. 198 * A custom font map can be used to present application-specific 199 * fonts instead of or in addition to the normal system fonts. 200 * 201 * |[<!-- language="C" --> 202 * FcConfig *config; 203 * PangoFontMap *fontmap; 204 * 205 * config = FcInitLoadConfigAndFonts (); 206 * FcConfigAppFontAddFile (config, my_app_font_file); 207 * 208 * fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT); 209 * pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config); 210 * 211 * gtk_font_chooser_set_font_map (font_chooser, fontmap); 212 * ]| 213 * 214 * Note that other GTK+ widgets will only be able to use the application-specific 215 * font if it is present in the font map they use: 216 * 217 * |[ 218 * context = gtk_widget_get_pango_context (label); 219 * pango_context_set_font_map (context, fontmap); 220 * ]| 221 * 222 * Params: 223 * fontmap = a #PangoFontMap 224 * 225 * Since: 3.18 226 */ 227 public void setFontMap(PgFontMap fontmap); 228 229 /** 230 * Sets the text displayed in the preview area. 231 * The @text is used to show how the selected font looks. 232 * 233 * Params: 234 * text = the text to display in the preview area 235 * 236 * Since: 3.2 237 */ 238 public void setPreviewText(string text); 239 240 /** 241 * Shows or hides the editable preview entry. 242 * 243 * Params: 244 * showPreviewEntry = whether to show the editable preview entry or not 245 * 246 * Since: 3.2 247 */ 248 public void setShowPreviewEntry(bool showPreviewEntry); 249 @property void delegate(string, FontChooserIF)[] onFontActivatedListeners(); 250 /** 251 * Emitted when a font is activated. 252 * This usually happens when the user double clicks an item, 253 * or an item is selected and the user presses one of the keys 254 * Space, Shift+Space, Return or Enter. 255 * 256 * Params: 257 * fontname = the font name 258 */ 259 void addOnFontActivated(void delegate(string, FontChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0); 260 261 }