| 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 |
|
|---|
| 69 |
|
|---|
| 70 |
public import glib.Str; |
|---|
| 71 |
public import glib.ErrorG; |
|---|
| 72 |
public import glib.GException; |
|---|
| 73 |
public import gio.AsyncResultIF; |
|---|
| 74 |
public import gio.Cancellable; |
|---|
| 75 |
public import gio.InputStream; |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
/** |
|---|
| 81 |
* Description |
|---|
| 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 |
if(p is null) |
|---|
| 127 |
{ |
|---|
| 128 |
return null; |
|---|
| 129 |
} |
|---|
| 130 |
return new InputStream(cast(GInputStream*) p); |
|---|
| 131 |
} |
|---|
| 132 |
|
|---|
| 133 |
/** |
|---|
| 134 |
* Loads an icon asynchronously. To finish this function, see |
|---|
| 135 |
* g_loadable_icon_load_finish(). For the synchronous, blocking |
|---|
| 136 |
* version of this function, see g_loadable_icon_load(). |
|---|
| 137 |
* Params: |
|---|
| 138 |
* size = an integer. |
|---|
| 139 |
* cancellable = optional GCancellable object, NULL to ignore. [allow-none] |
|---|
| 140 |
* callback = a GAsyncReadyCallback to call when the |
|---|
| 141 |
* request is satisfied. [scope async] |
|---|
| 142 |
* userData = the data to pass to callback function. [closure] |
|---|
| 143 |
*/ |
|---|
| 144 |
public void loadAsync(int size, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) |
|---|
| 145 |
{ |
|---|
| 146 |
// void g_loadable_icon_load_async (GLoadableIcon *icon, int size, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); |
|---|
| 147 |
g_loadable_icon_load_async(getLoadableIconTStruct(), size, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); |
|---|
| 148 |
} |
|---|
| 149 |
|
|---|
| 150 |
/** |
|---|
| 151 |
* Finishes an asynchronous icon load started in g_loadable_icon_load_async(). |
|---|
| 152 |
* Params: |
|---|
| 153 |
* res = a GAsyncResult. |
|---|
| 154 |
* type = a location to store the type of the loaded icon, NULL to ignore. |
|---|
| 155 |
* Returns: a GInputStream to read the icon from. [transfer full] |
|---|
| 156 |
* Throws: GException on failure. |
|---|
| 157 |
*/ |
|---|
| 158 |
public InputStream loadFinish(AsyncResultIF res, out string type) |
|---|
| 159 |
{ |
|---|
| 160 |
// GInputStream * g_loadable_icon_load_finish (GLoadableIcon *icon, GAsyncResult *res, char **type, GError **error); |
|---|
| 161 |
char* outtype = null; |
|---|
| 162 |
GError* err = null; |
|---|
| 163 |
|
|---|
| 164 |
auto p = g_loadable_icon_load_finish(getLoadableIconTStruct(), (res is null) ? null : res.getAsyncResultTStruct(), &outtype, &err); |
|---|
| 165 |
|
|---|
| 166 |
if (err !is null) |
|---|
| 167 |
{ |
|---|
| 168 |
throw new GException( new ErrorG(err) ); |
|---|
| 169 |
} |
|---|
| 170 |
|
|---|
| 171 |
type = Str.toString(outtype); |
|---|
| 172 |
if(p is null) |
|---|
| 173 |
{ |
|---|
| 174 |
return null; |
|---|
| 175 |
} |
|---|
| 176 |
return new InputStream(cast(GInputStream*) p); |
|---|
| 177 |
} |
|---|
| 178 |
} |
|---|