| 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 = GThemedIcon.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = ThemedIcon |
|---|
| 29 |
* strct = GThemedIcon |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct=GIcon |
|---|
| 32 |
* clss = ThemedIcon |
|---|
| 33 |
* interf = |
|---|
| 34 |
* class Code: Yes |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* extend = |
|---|
| 38 |
* implements: |
|---|
| 39 |
* - IconIF |
|---|
| 40 |
* prefixes: |
|---|
| 41 |
* - g_themed_icon_ |
|---|
| 42 |
* omit structs: |
|---|
| 43 |
* omit prefixes: |
|---|
| 44 |
* omit code: |
|---|
| 45 |
* - g_themed_icon_new |
|---|
| 46 |
* omit signals: |
|---|
| 47 |
* imports: |
|---|
| 48 |
* - glib.Str |
|---|
| 49 |
* - gio.IconT |
|---|
| 50 |
* - gio.IconIF |
|---|
| 51 |
* structWrap: |
|---|
| 52 |
* module aliases: |
|---|
| 53 |
* local aliases: |
|---|
| 54 |
* overrides: |
|---|
| 55 |
*/ |
|---|
| 56 |
|
|---|
| 57 |
module gio.ThemedIcon; |
|---|
| 58 |
|
|---|
| 59 |
public import gtkc.giotypes; |
|---|
| 60 |
|
|---|
| 61 |
private import gtkc.gio; |
|---|
| 62 |
private import glib.ConstructionException; |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
private import glib.Str; |
|---|
| 66 |
private import gio.IconT; |
|---|
| 67 |
private import gio.IconIF; |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
private import gobject.ObjectG; |
|---|
| 72 |
|
|---|
| 73 |
/** |
|---|
| 74 |
* Description |
|---|
| 75 |
* GThemedIcon is an implementation of GIcon that supports icon themes. |
|---|
| 76 |
* GThemedIcon contains a list of all of the icons present in an icon |
|---|
| 77 |
* theme, so that icons can be looked up quickly. GThemedIcon does |
|---|
| 78 |
* not provide actual pixmaps for icons, just the icon names. |
|---|
| 79 |
* Ideally something like gtk_icon_theme_choose_icon() should be used to |
|---|
| 80 |
* resolve the list of names so that fallback icons work nicely with |
|---|
| 81 |
* themes that inherit other themes. |
|---|
| 82 |
*/ |
|---|
| 83 |
public class ThemedIcon : ObjectG, IconIF |
|---|
| 84 |
{ |
|---|
| 85 |
|
|---|
| 86 |
/** the main Gtk struct */ |
|---|
| 87 |
protected GThemedIcon* gThemedIcon; |
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
public GThemedIcon* getThemedIconStruct() |
|---|
| 91 |
{ |
|---|
| 92 |
return gThemedIcon; |
|---|
| 93 |
} |
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
/** the main Gtk struct as a void* */ |
|---|
| 97 |
protected override void* getStruct() |
|---|
| 98 |
{ |
|---|
| 99 |
return cast(void*)gThemedIcon; |
|---|
| 100 |
} |
|---|
| 101 |
|
|---|
| 102 |
/** |
|---|
| 103 |
* Sets our main struct and passes it to the parent class |
|---|
| 104 |
*/ |
|---|
| 105 |
public this (GThemedIcon* gThemedIcon) |
|---|
| 106 |
{ |
|---|
| 107 |
if(gThemedIcon is null) |
|---|
| 108 |
{ |
|---|
| 109 |
this = null; |
|---|
| 110 |
return; |
|---|
| 111 |
} |
|---|
| 112 |
//Check if there already is a D object for this gtk struct |
|---|
| 113 |
void* ptr = getDObject(cast(GObject*)gThemedIcon); |
|---|
| 114 |
if( ptr !is null ) |
|---|
| 115 |
{ |
|---|
| 116 |
this = cast(ThemedIcon)ptr; |
|---|
| 117 |
return; |
|---|
| 118 |
} |
|---|
| 119 |
super(cast(GObject*)gThemedIcon); |
|---|
| 120 |
this.gThemedIcon = gThemedIcon; |
|---|
| 121 |
} |
|---|
| 122 |
|
|---|
| 123 |
protected override void setStruct(GObject* obj) |
|---|
| 124 |
{ |
|---|
| 125 |
super.setStruct(obj); |
|---|
| 126 |
gThemedIcon = cast(GThemedIcon*)obj; |
|---|
| 127 |
} |
|---|
| 128 |
|
|---|
| 129 |
// add the Icon capabilities |
|---|
| 130 |
mixin IconT!(GThemedIcon); |
|---|
| 131 |
|
|---|
| 132 |
/** |
|---|
| 133 |
*/ |
|---|
| 134 |
|
|---|
| 135 |
/** |
|---|
| 136 |
* Creates a new themed icon for iconnames. |
|---|
| 137 |
* Params: |
|---|
| 138 |
* iconnames = an array of strings containing icon names. [array length=len] |
|---|
| 139 |
* len = the length of the iconnames array, or -1 if iconnames is |
|---|
| 140 |
* NULL-terminated |
|---|
| 141 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 142 |
*/ |
|---|
| 143 |
public this (string[] iconnames, int len) |
|---|
| 144 |
{ |
|---|
| 145 |
// GIcon * g_themed_icon_new_from_names (char **iconnames, int len); |
|---|
| 146 |
auto p = g_themed_icon_new_from_names(Str.toStringzArray(iconnames), len); |
|---|
| 147 |
if(p is null) |
|---|
| 148 |
{ |
|---|
| 149 |
throw new ConstructionException("null returned by g_themed_icon_new_from_names(Str.toStringzArray(iconnames), len)"); |
|---|
| 150 |
} |
|---|
| 151 |
this(cast(GThemedIcon*) p); |
|---|
| 152 |
} |
|---|
| 153 |
|
|---|
| 154 |
/** |
|---|
| 155 |
* Creates a new themed icon for iconname, and all the names |
|---|
| 156 |
* that can be created by shortening iconname at '-' characters. |
|---|
| 157 |
* Params: |
|---|
| 158 |
* iconname = a string containing an icon name |
|---|
| 159 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 160 |
*/ |
|---|
| 161 |
public this (string iconname) |
|---|
| 162 |
{ |
|---|
| 163 |
// GIcon * g_themed_icon_new_with_default_fallbacks (const char *iconname); |
|---|
| 164 |
auto p = g_themed_icon_new_with_default_fallbacks(Str.toStringz(iconname)); |
|---|
| 165 |
if(p is null) |
|---|
| 166 |
{ |
|---|
| 167 |
throw new ConstructionException("null returned by g_themed_icon_new_with_default_fallbacks(Str.toStringz(iconname))"); |
|---|
| 168 |
} |
|---|
| 169 |
this(cast(GThemedIcon*) p); |
|---|
| 170 |
} |
|---|
| 171 |
|
|---|
| 172 |
/** |
|---|
| 173 |
* Prepend a name to the list of icons from within icon. |
|---|
| 174 |
* Note |
|---|
| 175 |
* Note that doing so invalidates the hash computed by prior calls |
|---|
| 176 |
* to g_icon_hash(). |
|---|
| 177 |
* Since 2.18 |
|---|
| 178 |
* Params: |
|---|
| 179 |
* icon = a GThemedIcon |
|---|
| 180 |
* iconname = name of icon to prepend to list of icons from within icon. |
|---|
| 181 |
*/ |
|---|
| 182 |
public void prependName(string iconname) |
|---|
| 183 |
{ |
|---|
| 184 |
// void g_themed_icon_prepend_name (GThemedIcon *icon, const char *iconname); |
|---|
| 185 |
g_themed_icon_prepend_name(gThemedIcon, Str.toStringz(iconname)); |
|---|
| 186 |
} |
|---|
| 187 |
|
|---|
| 188 |
/** |
|---|
| 189 |
* Append a name to the list of icons from within icon. |
|---|
| 190 |
* Note |
|---|
| 191 |
* Note that doing so invalidates the hash computed by prior calls |
|---|
| 192 |
* to g_icon_hash(). |
|---|
| 193 |
* Params: |
|---|
| 194 |
* icon = a GThemedIcon |
|---|
| 195 |
* iconname = name of icon to append to list of icons from within icon. |
|---|
| 196 |
*/ |
|---|
| 197 |
public void appendName(string iconname) |
|---|
| 198 |
{ |
|---|
| 199 |
// void g_themed_icon_append_name (GThemedIcon *icon, const char *iconname); |
|---|
| 200 |
g_themed_icon_append_name(gThemedIcon, Str.toStringz(iconname)); |
|---|
| 201 |
} |
|---|
| 202 |
|
|---|
| 203 |
/** |
|---|
| 204 |
* Gets the names of icons from within icon. |
|---|
| 205 |
* Returns: a list of icon names. [transfer none] |
|---|
| 206 |
*/ |
|---|
| 207 |
public string[] getNames() |
|---|
| 208 |
{ |
|---|
| 209 |
// const gchar * const * g_themed_icon_get_names (GThemedIcon *icon); |
|---|
| 210 |
return Str.toStringArray(g_themed_icon_get_names(gThemedIcon)); |
|---|
| 211 |
} |
|---|
| 212 |
} |
|---|