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 = GIcon.html 27 * outPack = gio 28 * outFile = IconT 29 * strct = GIcon 30 * realStrct= 31 * ctorStrct= 32 * clss = IconT 33 * interf = IconIF 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * - TStruct 38 * extend = 39 * implements: 40 * prefixes: 41 * - g_icon_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * - g_icon_new_for_string 46 * omit signals: 47 * imports: 48 * - glib.Str 49 * - glib.ErrorG 50 * - glib.GException 51 * structWrap: 52 * module aliases: 53 * local aliases: 54 * overrides: 55 * - toString 56 */ 57 58 module gio.IconT; 59 60 public import gtkc.giotypes; 61 62 public import gtkc.gio; 63 public import glib.ConstructionException; 64 public import gobject.ObjectG; 65 66 67 public import glib.Str; 68 public import glib.ErrorG; 69 public import glib.GException; 70 71 72 73 74 /** 75 * Description 76 * GIcon is a very minimal interface for icons. It provides functions 77 * for checking the equality of two icons, hashing of icons and 78 * serializing an icon to and from strings. 79 * GIcon does not provide the actual pixmap for the icon as this is out 80 * of GIO's scope, however implementations of GIcon may contain the name 81 * of an icon (see GThemedIcon), or the path to an icon (see GLoadableIcon). 82 * To obtain a hash of a GIcon, see g_icon_hash(). 83 * To check if two GIcons are equal, see g_icon_equal(). 84 * For serializing a GIcon, use g_icon_to_string() and 85 * g_icon_new_for_string(). 86 * If your application or library provides one or more GIcon 87 * implementations you need to ensure that each GType is registered 88 * with the type system prior to calling g_icon_new_for_string(). 89 */ 90 public template IconT(TStruct) 91 { 92 93 /** the main Gtk struct */ 94 protected GIcon* gIcon; 95 96 97 public GIcon* getIconTStruct() 98 { 99 return cast(GIcon*)getStruct(); 100 } 101 102 103 /** 104 */ 105 106 /** 107 * Gets a hash for an icon. 108 * Virtual: hash 109 * Params: 110 * icon = gconstpointer to an icon object. 111 * Returns: a guint containing a hash for the icon, suitable for use in a GHashTable or similar data structure. 112 */ 113 public static uint hash(void* icon) 114 { 115 // guint g_icon_hash (gconstpointer icon); 116 return g_icon_hash(icon); 117 } 118 119 /** 120 * Checks if two icons are equal. 121 * Params: 122 * icon2 = pointer to the second GIcon. 123 * Returns: TRUE if icon1 is equal to icon2. FALSE otherwise. 124 */ 125 public int equal(GIcon* icon2) 126 { 127 // gboolean g_icon_equal (GIcon *icon1, GIcon *icon2); 128 return g_icon_equal(getIconTStruct(), icon2); 129 } 130 131 /** 132 * Generates a textual representation of icon that can be used for 133 * serialization such as when passing icon to a different process or 134 * saving it to persistent storage. Use g_icon_new_for_string() to 135 * get icon back from the returned string. 136 * The encoding of the returned string is proprietary to GIcon except 137 * in the following two cases 138 * If icon is a GFileIcon, the returned string is a native path 139 * (such as /path/to/my icon.png) without escaping 140 * if the GFile for icon is a native file. If the file is not 141 * native, the returned string is the result of g_file_get_uri() 142 * (such as sftp://path/to/my%20icon.png). 143 * If icon is a GThemedIcon with exactly one name, the encoding is 144 * simply the name (such as network-server). 145 * Virtual: to_tokens 146 * Since 2.20 147 * Returns: An allocated NUL-terminated UTF8 string or NULL if icon can't be serialized. Use g_free() to free. 148 */ 149 public override string toString() 150 { 151 // gchar * g_icon_to_string (GIcon *icon); 152 return Str.toString(g_icon_to_string(getIconTStruct())); 153 } 154 }