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.BytesIcon;
26 
27 private import gio.IconIF;
28 private import gio.IconT;
29 private import gio.LoadableIconIF;
30 private import gio.LoadableIconT;
31 private import glib.Bytes;
32 private import glib.ConstructionException;
33 private import gobject.ObjectG;
34 private import gtkc.gio;
35 public  import gtkc.giotypes;
36 
37 
38 /**
39  * #GBytesIcon specifies an image held in memory in a common format (usually
40  * png) to be used as icon.
41  */
42 public class BytesIcon : ObjectG, IconIF, LoadableIconIF
43 {
44 	/** the main Gtk struct */
45 	protected GBytesIcon* gBytesIcon;
46 
47 	/** Get the main Gtk struct */
48 	public GBytesIcon* getBytesIconStruct()
49 	{
50 		return gBytesIcon;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)gBytesIcon;
57 	}
58 
59 	protected override void setStruct(GObject* obj)
60 	{
61 		gBytesIcon = cast(GBytesIcon*)obj;
62 		super.setStruct(obj);
63 	}
64 
65 	/**
66 	 * Sets our main struct and passes it to the parent class.
67 	 */
68 	public this (GBytesIcon* gBytesIcon, bool ownedRef = false)
69 	{
70 		this.gBytesIcon = gBytesIcon;
71 		super(cast(GObject*)gBytesIcon, ownedRef);
72 	}
73 
74 	// add the Icon capabilities
75 	mixin IconT!(GBytesIcon);
76 
77 	// add the LoadableIcon capabilities
78 	mixin LoadableIconT!(GBytesIcon);
79 
80 
81 	/** */
82 	public static GType getType()
83 	{
84 		return g_bytes_icon_get_type();
85 	}
86 
87 	/**
88 	 * Creates a new icon for a bytes.
89 	 *
90 	 * Params:
91 	 *     bytes = a #GBytes.
92 	 *
93 	 * Return: a #GIcon for the given
94 	 *     @bytes, or %NULL on error.
95 	 *
96 	 * Since: 2.38
97 	 *
98 	 * Throws: ConstructionException GTK+ fails to create the object.
99 	 */
100 	public this(Bytes bytes)
101 	{
102 		auto p = g_bytes_icon_new((bytes is null) ? null : bytes.getBytesStruct());
103 		
104 		if(p is null)
105 		{
106 			throw new ConstructionException("null returned by new");
107 		}
108 		
109 		this(cast(GBytesIcon*) p, true);
110 	}
111 
112 	/**
113 	 * Gets the #GBytes associated with the given @icon.
114 	 *
115 	 * Return: a #GBytes, or %NULL.
116 	 *
117 	 * Since: 2.38
118 	 */
119 	public Bytes getBytes()
120 	{
121 		auto p = g_bytes_icon_get_bytes(gBytesIcon);
122 		
123 		if(p is null)
124 		{
125 			return null;
126 		}
127 		
128 		return new Bytes(cast(GBytes*) p);
129 	}
130 }