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 private import gobject.ObjectG;
64 
65 
66 private import glib.Str;
67 private import gio.IconT;
68 private import gio.IconIF;
69 
70 
71 
72 private import gobject.ObjectG;
73 
74 /**
75  * Description
76  * GThemedIcon is an implementation of GIcon that supports icon themes.
77  * GThemedIcon contains a list of all of the icons present in an icon
78  * theme, so that icons can be looked up quickly. GThemedIcon does
79  * not provide actual pixmaps for icons, just the icon names.
80  * Ideally something like gtk_icon_theme_choose_icon() should be used to
81  * resolve the list of names so that fallback icons work nicely with
82  * themes that inherit other themes.
83  */
84 public class ThemedIcon : ObjectG, IconIF
85 {
86 	
87 	/** the main Gtk struct */
88 	protected GThemedIcon* gThemedIcon;
89 	
90 	
91 	public GThemedIcon* getThemedIconStruct()
92 	{
93 		return gThemedIcon;
94 	}
95 	
96 	
97 	/** the main Gtk struct as a void* */
98 	protected override void* getStruct()
99 	{
100 		return cast(void*)gThemedIcon;
101 	}
102 	
103 	/**
104 	 * Sets our main struct and passes it to the parent class
105 	 */
106 	public this (GThemedIcon* gThemedIcon)
107 	{
108 		super(cast(GObject*)gThemedIcon);
109 		this.gThemedIcon = gThemedIcon;
110 	}
111 	
112 	protected override void setStruct(GObject* obj)
113 	{
114 		super.setStruct(obj);
115 		gThemedIcon = cast(GThemedIcon*)obj;
116 	}
117 	
118 	// add the Icon capabilities
119 	mixin IconT!(GThemedIcon);
120 	
121 	/**
122 	 */
123 	
124 	/**
125 	 * Creates a new themed icon for iconnames.
126 	 * Params:
127 	 * iconnames = an array of strings containing icon names. [array length=len]
128 	 * len = the length of the iconnames array, or -1 if iconnames is
129 	 * NULL-terminated
130 	 * Throws: ConstructionException GTK+ fails to create the object.
131 	 */
132 	public this (string[] iconnames, int len)
133 	{
134 		// GIcon * g_themed_icon_new_from_names (char **iconnames,  int len);
135 		auto p = g_themed_icon_new_from_names(Str.toStringzArray(iconnames), len);
136 		if(p is null)
137 		{
138 			throw new ConstructionException("null returned by g_themed_icon_new_from_names(Str.toStringzArray(iconnames), len)");
139 		}
140 		this(cast(GThemedIcon*) p);
141 	}
142 	
143 	/**
144 	 * Creates a new themed icon for iconname, and all the names
145 	 * that can be created by shortening iconname at '-' characters.
146 	 * Params:
147 	 * iconname = a string containing an icon name
148 	 * Throws: ConstructionException GTK+ fails to create the object.
149 	 */
150 	public this (string iconname)
151 	{
152 		// GIcon * g_themed_icon_new_with_default_fallbacks  (const char *iconname);
153 		auto p = g_themed_icon_new_with_default_fallbacks(Str.toStringz(iconname));
154 		if(p is null)
155 		{
156 			throw new ConstructionException("null returned by g_themed_icon_new_with_default_fallbacks(Str.toStringz(iconname))");
157 		}
158 		this(cast(GThemedIcon*) p);
159 	}
160 	
161 	/**
162 	 * Prepend a name to the list of icons from within icon.
163 	 * Note
164 	 * Note that doing so invalidates the hash computed by prior calls
165 	 * to g_icon_hash().
166 	 * Since 2.18
167 	 * Params:
168 	 * icon = a GThemedIcon
169 	 * iconname = name of icon to prepend to list of icons from within icon.
170 	 */
171 	public void prependName(string iconname)
172 	{
173 		// void g_themed_icon_prepend_name (GThemedIcon *icon,  const char *iconname);
174 		g_themed_icon_prepend_name(gThemedIcon, Str.toStringz(iconname));
175 	}
176 	
177 	/**
178 	 * Append a name to the list of icons from within icon.
179 	 * Note
180 	 * Note that doing so invalidates the hash computed by prior calls
181 	 * to g_icon_hash().
182 	 * Params:
183 	 * icon = a GThemedIcon
184 	 * iconname = name of icon to append to list of icons from within icon.
185 	 */
186 	public void appendName(string iconname)
187 	{
188 		// void g_themed_icon_append_name (GThemedIcon *icon,  const char *iconname);
189 		g_themed_icon_append_name(gThemedIcon, Str.toStringz(iconname));
190 	}
191 	
192 	/**
193 	 * Gets the names of icons from within icon.
194 	 * Returns: a list of icon names. [transfer none]
195 	 */
196 	public string[] getNames()
197 	{
198 		// const gchar * const * g_themed_icon_get_names (GThemedIcon *icon);
199 		return Str.toStringArray(g_themed_icon_get_names(gThemedIcon));
200 	}
201 }