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  = GLoadableIcon.html
27  * outPack = gio
28  * outFile = LoadableIconT
29  * strct   = GLoadableIcon
30  * realStrct=
31  * ctorStrct=
32  * clss    = LoadableIconT
33  * interf  = LoadableIconIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- g_loadable_icon_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ErrorG
49  * 	- glib.GException
50  * 	- gio.AsyncResultIF
51  * 	- gio.Cancellable
52  * 	- gio.InputStream
53  * structWrap:
54  * 	- GAsyncResult* -> AsyncResultIF
55  * 	- GCancellable* -> Cancellable
56  * 	- GInputStream* -> InputStream
57  * module aliases:
58  * local aliases:
59  * overrides:
60  */
61 
62 module gio.LoadableIconT;
63 
64 public  import gtkc.giotypes;
65 
66 public import gtkc.gio;
67 public import glib.ConstructionException;
68 public import gobject.ObjectG;
69 
70 
71 public import glib.Str;
72 public import glib.ErrorG;
73 public import glib.GException;
74 public import gio.AsyncResultIF;
75 public import gio.Cancellable;
76 public import gio.InputStream;
77 
78 
79 
80 
81 /**
82  * Extends the GIcon interface and adds the ability to
83  * load icons from streams.
84  */
85 public template LoadableIconT(TStruct)
86 {
87 	
88 	/** the main Gtk struct */
89 	protected GLoadableIcon* gLoadableIcon;
90 	
91 	
92 	public GLoadableIcon* getLoadableIconTStruct()
93 	{
94 		return cast(GLoadableIcon*)getStruct();
95 	}
96 	
97 	
98 	/**
99 	 */
100 	
101 	/**
102 	 * Loads a loadable icon. For the asynchronous version of this function,
103 	 * see g_loadable_icon_load_async().
104 	 * Params:
105 	 * size = an integer.
106 	 * type = a location to store the type of the
107 	 * loaded icon, NULL to ignore. [out][allow-none]
108 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
109 	 * Returns: a GInputStream to read the icon from. [transfer full]
110 	 * Throws: GException on failure.
111 	 */
112 	public InputStream load(int size, out string type, Cancellable cancellable)
113 	{
114 		// GInputStream * g_loadable_icon_load (GLoadableIcon *icon,  int size,  char **type,  GCancellable *cancellable,  GError **error);
115 		char* outtype = null;
116 		GError* err = null;
117 		
118 		auto p = g_loadable_icon_load(getLoadableIconTStruct(), size, &outtype, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
119 		
120 		if (err !is null)
121 		{
122 			throw new GException( new ErrorG(err) );
123 		}
124 		
125 		type = Str.toString(outtype);
126 		
127 		if(p is null)
128 		{
129 			return null;
130 		}
131 		
132 		return ObjectG.getDObject!(InputStream)(cast(GInputStream*) p);
133 	}
134 	
135 	/**
136 	 * Loads an icon asynchronously. To finish this function, see
137 	 * g_loadable_icon_load_finish(). For the synchronous, blocking
138 	 * version of this function, see g_loadable_icon_load().
139 	 * Params:
140 	 * size = an integer.
141 	 * cancellable = optional GCancellable object, NULL to ignore. [allow-none]
142 	 * callback = a GAsyncReadyCallback to call when the
143 	 * request is satisfied. [scope async]
144 	 * userData = the data to pass to callback function. [closure]
145 	 */
146 	public void loadAsync(int size, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
147 	{
148 		// void g_loadable_icon_load_async (GLoadableIcon *icon,  int size,  GCancellable *cancellable,  GAsyncReadyCallback callback,  gpointer user_data);
149 		g_loadable_icon_load_async(getLoadableIconTStruct(), size, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
150 	}
151 	
152 	/**
153 	 * Finishes an asynchronous icon load started in g_loadable_icon_load_async().
154 	 * Params:
155 	 * res = a GAsyncResult.
156 	 * type = a location to store the type of the
157 	 * loaded icon, NULL to ignore. [out][allow-none]
158 	 * Returns: a GInputStream to read the icon from. [transfer full]
159 	 * Throws: GException on failure.
160 	 */
161 	public InputStream loadFinish(AsyncResultIF res, out string type)
162 	{
163 		// GInputStream * g_loadable_icon_load_finish (GLoadableIcon *icon,  GAsyncResult *res,  char **type,  GError **error);
164 		char* outtype = null;
165 		GError* err = null;
166 		
167 		auto p = g_loadable_icon_load_finish(getLoadableIconTStruct(), (res is null) ? null : res.getAsyncResultTStruct(), &outtype, &err);
168 		
169 		if (err !is null)
170 		{
171 			throw new GException( new ErrorG(err) );
172 		}
173 		
174 		type = Str.toString(outtype);
175 		
176 		if(p is null)
177 		{
178 			return null;
179 		}
180 		
181 		return ObjectG.getDObject!(InputStream)(cast(GInputStream*) p);
182 	}
183 }