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 = 27 * outPack = gtk 28 * outFile = IconSize 29 * strct = 30 * realStrct= 31 * ctorStrct= 32 * clss = IconSize 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_icon_size_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - gtk.Settings 48 * structWrap: 49 * - GtkSettings* -> Settings 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module gtk.IconSize; 56 57 public import gtkc.gtktypes; 58 59 private import gtkc.gtk; 60 private import glib.ConstructionException; 61 private import gobject.ObjectG; 62 63 64 private import glib.Str; 65 private import gtk.Settings; 66 67 68 69 70 /** 71 * Description 72 * Browse the available stock icons in the list of stock IDs found here. You can also use 73 * the gtk-demo application for this purpose. 74 * An icon factory manages a collection of GtkIconSet; a GtkIconSet manages a 75 * set of variants of a particular icon (i.e. a GtkIconSet contains variants for 76 * different sizes and widget states). Icons in an icon factory are named by a 77 * stock ID, which is a simple string identifying the icon. Each GtkStyle has a 78 * list of GtkIconFactory derived from the current theme; those icon factories 79 * are consulted first when searching for an icon. If the theme doesn't set a 80 * particular icon, GTK+ looks for the icon in a list of default icon factories, 81 * maintained by gtk_icon_factory_add_default() and 82 * gtk_icon_factory_remove_default(). Applications with icons should add a default 83 * icon factory with their icons, which will allow themes to override the icons 84 * for the application. 85 * To display an icon, always use gtk_style_lookup_icon_set() on the widget that 86 * will display the icon, or the convenience function 87 * gtk_widget_render_icon(). These functions take the theme into account when 88 * looking up the icon to use for a given stock ID. 89 * GtkIconFactory as GtkBuildable 90 * GtkIconFactory supports a custom <sources> element, which 91 * can contain multiple <source> elements. 92 * The following attributes are allowed: 93 * stock-id 94 * The stock id of the source, a string. 95 * This attribute is mandatory 96 * filename 97 * The filename of the source, a string. 98 * This attribute is optional 99 * icon-name 100 * The icon name for the source, a string. 101 * This attribute is optional. 102 * size 103 * Size of the icon, a GtkIconSize enum value. 104 * This attribute is optional. 105 * direction 106 * Direction of the source, a GtkTextDirection enum value. 107 * This attribute is optional. 108 * state 109 * State of the source, a GtkStateType enum value. 110 * This attribute is optional. 111 * $(DDOC_COMMENT example) 112 */ 113 public class IconSize 114 { 115 116 /** 117 */ 118 119 /** 120 * Obtains the pixel size of a semantic icon size, possibly 121 * modified by user preferences for the default GtkSettings. 122 * (See gtk_icon_size_lookup_for_settings().) 123 * Normally size would be 124 * GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_BUTTON, etc. This function 125 * isn't normally needed, gtk_widget_render_icon() is the usual 126 * way to get an icon for rendering, then just look at the size of 127 * the rendered pixbuf. The rendered pixbuf may not even correspond to 128 * the width/height returned by gtk_icon_size_lookup(), because themes 129 * are free to render the pixbuf however they like, including changing 130 * the usual size. 131 * Params: 132 * size = an icon size. [type int] 133 * width = location to store icon width 134 * height = location to store icon height 135 * Returns: TRUE if size was a valid size 136 */ 137 public static int lookup(GtkIconSize size, out int width, out int height) 138 { 139 // gboolean gtk_icon_size_lookup (GtkIconSize size, gint *width, gint *height); 140 return gtk_icon_size_lookup(size, &width, &height); 141 } 142 143 /** 144 * Obtains the pixel size of a semantic icon size, possibly 145 * modified by user preferences for a particular 146 * GtkSettings. Normally size would be 147 * GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_BUTTON, etc. This function 148 * isn't normally needed, gtk_widget_render_icon() is the usual 149 * way to get an icon for rendering, then just look at the size of 150 * the rendered pixbuf. The rendered pixbuf may not even correspond to 151 * the width/height returned by gtk_icon_size_lookup(), because themes 152 * are free to render the pixbuf however they like, including changing 153 * the usual size. 154 * Since 2.2 155 * Params: 156 * settings = a GtkSettings object, used to determine 157 * which set of user preferences to used. 158 * size = an icon size. [type int] 159 * width = location to store icon width 160 * height = location to store icon height 161 * Returns: TRUE if size was a valid size 162 */ 163 public static int lookupForSettings(Settings settings, GtkIconSize size, out int width, out int height) 164 { 165 // gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings, GtkIconSize size, gint *width, gint *height); 166 return gtk_icon_size_lookup_for_settings((settings is null) ? null : settings.getSettingsStruct(), size, &width, &height); 167 } 168 169 /** 170 * Registers a new icon size, along the same lines as GTK_ICON_SIZE_MENU, 171 * etc. Returns the integer value for the size. 172 * Params: 173 * name = name of the icon size 174 * width = the icon width 175 * height = the icon height 176 * Returns: integer value representing the size. [type int] 177 */ 178 public static GtkIconSize register(string name, int width, int height) 179 { 180 // GtkIconSize gtk_icon_size_register (const gchar *name, gint width, gint height); 181 return gtk_icon_size_register(Str.toStringz(name), width, height); 182 } 183 184 /** 185 * Registers alias as another name for target. 186 * So calling gtk_icon_size_from_name() with alias as argument 187 * will return target. 188 * Params: 189 * target = an existing icon size. [type int] 190 */ 191 public static void registerAlias(string alia, GtkIconSize target) 192 { 193 // void gtk_icon_size_register_alias (const gchar *alias, GtkIconSize target); 194 gtk_icon_size_register_alias(Str.toStringz(alia), target); 195 } 196 197 /** 198 * Looks up the icon size associated with name. 199 * Params: 200 * name = the name to look up. 201 * Returns: the icon size with the given name. 202 */ 203 public static GtkIconSize fromName(string name) 204 { 205 // GtkIconSize gtk_icon_size_from_name (const gchar *name); 206 return gtk_icon_size_from_name(Str.toStringz(name)); 207 } 208 209 /** 210 * Gets the canonical name of the given icon size. The returned string 211 * is statically allocated and should not be freed. 212 * Params: 213 * size = a GtkIconSize. [type int] 214 * Returns: the name of the given icon size. 215 */ 216 public static string getName(GtkIconSize size) 217 { 218 // const gchar* gtk_icon_size_get_name (GtkIconSize size); 219 return Str.toString(gtk_icon_size_get_name(size)); 220 } 221 }