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 = GEmblem.html 27 * outPack = gio 28 * outFile = Emblem 29 * strct = GEmblem 30 * realStrct= 31 * ctorStrct= 32 * clss = Emblem 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - IconIF 40 * prefixes: 41 * - g_emblem_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - gio.Icon 48 * - gio.IconIF 49 * - gio.IconT 50 * structWrap: 51 * - GIcon* -> IconIF 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module gio.Emblem; 58 59 public import gtkc.giotypes; 60 61 private import gtkc.gio; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 private import gio.Icon; 66 private import gio.IconIF; 67 private import gio.IconT; 68 69 70 private import gobject.ObjectG; 71 72 /** 73 * GEmblem is an implementation of GIcon that supports 74 * having an emblem, which is an icon with additional properties. 75 * It can than be added to a GEmblemedIcon. 76 * 77 * Currently, only metainformation about the emblem's origin is 78 * supported. More may be added in the future. 79 */ 80 public class Emblem : ObjectG, IconIF 81 { 82 83 /** the main Gtk struct */ 84 protected GEmblem* gEmblem; 85 86 87 /** Get the main Gtk struct */ 88 public GEmblem* getEmblemStruct() 89 { 90 return gEmblem; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected override void* getStruct() 96 { 97 return cast(void*)gEmblem; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (GEmblem* gEmblem) 104 { 105 super(cast(GObject*)gEmblem); 106 this.gEmblem = gEmblem; 107 } 108 109 protected override void setStruct(GObject* obj) 110 { 111 super.setStruct(obj); 112 gEmblem = cast(GEmblem*)obj; 113 } 114 115 // add the Icon capabilities 116 mixin IconT!(GEmblem); 117 118 /** 119 */ 120 121 /** 122 * Creates a new emblem for icon. 123 * Since 2.18 124 * Params: 125 * icon = a GIcon containing the icon. 126 * Throws: ConstructionException GTK+ fails to create the object. 127 */ 128 public this (IconIF icon) 129 { 130 // GEmblem * g_emblem_new (GIcon *icon); 131 auto p = g_emblem_new((icon is null) ? null : icon.getIconTStruct()); 132 if(p is null) 133 { 134 throw new ConstructionException("null returned by g_emblem_new((icon is null) ? null : icon.getIconTStruct())"); 135 } 136 this(cast(GEmblem*) p); 137 } 138 139 /** 140 * Creates a new emblem for icon. 141 * Since 2.18 142 * Params: 143 * icon = a GIcon containing the icon. 144 * origin = a GEmblemOrigin enum defining the emblem's origin 145 * Throws: ConstructionException GTK+ fails to create the object. 146 */ 147 public this (IconIF icon, GEmblemOrigin origin) 148 { 149 // GEmblem * g_emblem_new_with_origin (GIcon *icon, GEmblemOrigin origin); 150 auto p = g_emblem_new_with_origin((icon is null) ? null : icon.getIconTStruct(), origin); 151 if(p is null) 152 { 153 throw new ConstructionException("null returned by g_emblem_new_with_origin((icon is null) ? null : icon.getIconTStruct(), origin)"); 154 } 155 this(cast(GEmblem*) p); 156 } 157 158 /** 159 * Gives back the icon from emblem. 160 * Since 2.18 161 * Returns: a GIcon. The returned object belongs to the emblem and should not be modified or freed. [transfer none] 162 */ 163 public IconIF getIcon() 164 { 165 // GIcon * g_emblem_get_icon (GEmblem *emblem); 166 auto p = g_emblem_get_icon(gEmblem); 167 168 if(p is null) 169 { 170 return null; 171 } 172 173 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 174 } 175 176 /** 177 * Gets the origin of the emblem. 178 * Since 2.18 179 * Returns: the origin of the emblem. [transfer none] 180 */ 181 public GEmblemOrigin getOrigin() 182 { 183 // GEmblemOrigin g_emblem_get_origin (GEmblem *emblem); 184 return g_emblem_get_origin(gEmblem); 185 } 186 }