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.EmblemedIcon;
26 
27 private import gio.Emblem;
28 private import gio.IconIF;
29 private import gio.IconT;
30 private import gio.c.functions;
31 public  import gio.c.types;
32 private import glib.ConstructionException;
33 private import glib.ListG;
34 private import gobject.ObjectG;
35 public  import gtkc.giotypes;
36 
37 
38 /**
39  * #GEmblemedIcon is an implementation of #GIcon that supports
40  * adding an emblem to an icon. Adding multiple emblems to an
41  * icon is ensured via g_emblemed_icon_add_emblem().
42  * 
43  * Note that #GEmblemedIcon allows no control over the position
44  * of the emblems. See also #GEmblem for more information.
45  */
46 public class EmblemedIcon : ObjectG, IconIF
47 {
48 	/** the main Gtk struct */
49 	protected GEmblemedIcon* gEmblemedIcon;
50 
51 	/** Get the main Gtk struct */
52 	public GEmblemedIcon* getEmblemedIconStruct(bool transferOwnership = false)
53 	{
54 		if (transferOwnership)
55 			ownedRef = false;
56 		return gEmblemedIcon;
57 	}
58 
59 	/** the main Gtk struct as a void* */
60 	protected override void* getStruct()
61 	{
62 		return cast(void*)gEmblemedIcon;
63 	}
64 
65 	protected override void setStruct(GObject* obj)
66 	{
67 		gEmblemedIcon = cast(GEmblemedIcon*)obj;
68 		super.setStruct(obj);
69 	}
70 
71 	/**
72 	 * Sets our main struct and passes it to the parent class.
73 	 */
74 	public this (GEmblemedIcon* gEmblemedIcon, bool ownedRef = false)
75 	{
76 		this.gEmblemedIcon = gEmblemedIcon;
77 		super(cast(GObject*)gEmblemedIcon, ownedRef);
78 	}
79 
80 	// add the Icon capabilities
81 	mixin IconT!(GEmblemedIcon);
82 
83 
84 	/** */
85 	public static GType getType()
86 	{
87 		return g_emblemed_icon_get_type();
88 	}
89 
90 	/**
91 	 * Creates a new emblemed icon for @icon with the emblem @emblem.
92 	 *
93 	 * Params:
94 	 *     icon = a #GIcon
95 	 *     emblem = a #GEmblem, or %NULL
96 	 *
97 	 * Returns: a new #GIcon
98 	 *
99 	 * Since: 2.18
100 	 *
101 	 * Throws: ConstructionException GTK+ fails to create the object.
102 	 */
103 	public this(IconIF icon, Emblem emblem)
104 	{
105 		auto p = g_emblemed_icon_new((icon is null) ? null : icon.getIconStruct(), (emblem is null) ? null : emblem.getEmblemStruct());
106 
107 		if(p is null)
108 		{
109 			throw new ConstructionException("null returned by new");
110 		}
111 
112 		this(cast(GEmblemedIcon*) p, true);
113 	}
114 
115 	/**
116 	 * Adds @emblem to the #GList of #GEmblems.
117 	 *
118 	 * Params:
119 	 *     emblem = a #GEmblem
120 	 *
121 	 * Since: 2.18
122 	 */
123 	public void addEmblem(Emblem emblem)
124 	{
125 		g_emblemed_icon_add_emblem(gEmblemedIcon, (emblem is null) ? null : emblem.getEmblemStruct());
126 	}
127 
128 	/**
129 	 * Removes all the emblems from @icon.
130 	 *
131 	 * Since: 2.28
132 	 */
133 	public void clearEmblems()
134 	{
135 		g_emblemed_icon_clear_emblems(gEmblemedIcon);
136 	}
137 
138 	/**
139 	 * Gets the list of emblems for the @icon.
140 	 *
141 	 * Returns: a #GList of
142 	 *     #GEmblems that is owned by @emblemed
143 	 *
144 	 * Since: 2.18
145 	 */
146 	public ListG getEmblems()
147 	{
148 		auto p = g_emblemed_icon_get_emblems(gEmblemedIcon);
149 
150 		if(p is null)
151 		{
152 			return null;
153 		}
154 
155 		return new ListG(cast(GList*) p);
156 	}
157 
158 	/**
159 	 * Gets the main icon for @emblemed.
160 	 *
161 	 * Returns: a #GIcon that is owned by @emblemed
162 	 *
163 	 * Since: 2.18
164 	 */
165 	public IconIF getIcon()
166 	{
167 		auto p = g_emblemed_icon_get_icon(gEmblemedIcon);
168 
169 		if(p is null)
170 		{
171 			return null;
172 		}
173 
174 		return ObjectG.getDObject!(IconIF)(cast(GIcon*) p);
175 	}
176 }