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 
66 private import gio.Icon;
67 private import gio.IconIF;
68 private import gio.IconT;
69 
70 
71 
72 private import gobject.ObjectG;
73 
74 /**
75  * Description
76  * GEmblem is an implementation of GIcon that supports
77  * having an emblem, which is an icon with additional properties.
78  * It can than be added to a GEmblemedIcon.
79  * Currently, only metainformation about the emblem's origin is
80  * supported. More may be added in the future.
81  */
82 public class Emblem : ObjectG, IconIF
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GEmblem* gEmblem;
87 	
88 	
89 	public GEmblem* getEmblemStruct()
90 	{
91 		return gEmblem;
92 	}
93 	
94 	
95 	/** the main Gtk struct as a void* */
96 	protected override void* getStruct()
97 	{
98 		return cast(void*)gEmblem;
99 	}
100 	
101 	/**
102 	 * Sets our main struct and passes it to the parent class
103 	 */
104 	public this (GEmblem* gEmblem)
105 	{
106 		super(cast(GObject*)gEmblem);
107 		this.gEmblem = gEmblem;
108 	}
109 	
110 	protected override void setStruct(GObject* obj)
111 	{
112 		super.setStruct(obj);
113 		gEmblem = cast(GEmblem*)obj;
114 	}
115 	
116 	// add the Icon capabilities
117 	mixin IconT!(GEmblem);
118 	
119 	/**
120 	 */
121 	
122 	/**
123 	 * Creates a new emblem for icon.
124 	 * Since 2.18
125 	 * Params:
126 	 * icon = a GIcon containing the icon.
127 	 * Throws: ConstructionException GTK+ fails to create the object.
128 	 */
129 	public this (IconIF icon)
130 	{
131 		// GEmblem * g_emblem_new (GIcon *icon);
132 		auto p = g_emblem_new((icon is null) ? null : icon.getIconTStruct());
133 		if(p is null)
134 		{
135 			throw new ConstructionException("null returned by g_emblem_new((icon is null) ? null : icon.getIconTStruct())");
136 		}
137 		this(cast(GEmblem*) p);
138 	}
139 	
140 	/**
141 	 * Creates a new emblem for icon.
142 	 * Since 2.18
143 	 * Params:
144 	 * icon = a GIcon containing the icon.
145 	 * origin = a GEmblemOrigin enum defining the emblem's origin
146 	 * Throws: ConstructionException GTK+ fails to create the object.
147 	 */
148 	public this (IconIF icon, GEmblemOrigin origin)
149 	{
150 		// GEmblem * g_emblem_new_with_origin (GIcon *icon,  GEmblemOrigin origin);
151 		auto p = g_emblem_new_with_origin((icon is null) ? null : icon.getIconTStruct(), origin);
152 		if(p is null)
153 		{
154 			throw new ConstructionException("null returned by g_emblem_new_with_origin((icon is null) ? null : icon.getIconTStruct(), origin)");
155 		}
156 		this(cast(GEmblem*) p);
157 	}
158 	
159 	/**
160 	 * Gives back the icon from emblem.
161 	 * Since 2.18
162 	 * Returns: a GIcon. The returned object belongs to the emblem and should not be modified or freed. [transfer none]
163 	 */
164 	public IconIF getIcon()
165 	{
166 		// GIcon * g_emblem_get_icon (GEmblem *emblem);
167 		auto p = g_emblem_get_icon(gEmblem);
168 		
169 		if(p is null)
170 		{
171 			return null;
172 		}
173 		
174 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
175 	}
176 	
177 	/**
178 	 * Gets the origin of the emblem.
179 	 * Since 2.18
180 	 * Returns: the origin of the emblem. [transfer none]
181 	 */
182 	public GEmblemOrigin getOrigin()
183 	{
184 		// GEmblemOrigin g_emblem_get_origin (GEmblem *emblem);
185 		return g_emblem_get_origin(gEmblem);
186 	}
187 }