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