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