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