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 
83 	public static GType getType()
84 	{
85 		return g_bytes_icon_get_type();
86 	}
87 
88 	/**
89 	 * Creates a new icon for a bytes.
90 	 *
91 	 * Params:
92 	 *     bytes = a #GBytes.
93 	 *
94 	 * Return: a #GIcon for the given
95 	 *     @bytes, or %NULL on error.
96 	 *
97 	 * Since: 2.38
98 	 *
99 	 * Throws: ConstructionException GTK+ fails to create the object.
100 	 */
101 	public this(Bytes bytes)
102 	{
103 		auto p = g_bytes_icon_new((bytes is null) ? null : bytes.getBytesStruct());
104 		
105 		if(p is null)
106 		{
107 			throw new ConstructionException("null returned by new");
108 		}
109 		
110 		this(cast(GBytesIcon*) p, true);
111 	}
112 
113 	/**
114 	 * Gets the #GBytes associated with the given @icon.
115 	 *
116 	 * Return: a #GBytes, or %NULL.
117 	 *
118 	 * Since: 2.38
119 	 */
120 	public Bytes getBytes()
121 	{
122 		auto p = g_bytes_icon_get_bytes(gBytesIcon);
123 		
124 		if(p is null)
125 		{
126 			return null;
127 		}
128 		
129 		return new Bytes(cast(GBytes*) p);
130 	}
131 }