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  * 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 		super(cast(GObject*)gThemedIcon);
108 		this.gThemedIcon = gThemedIcon;
109 	}
110 	
111 	protected override void setStruct(GObject* obj)
112 	{
113 		super.setStruct(obj);
114 		gThemedIcon = cast(GThemedIcon*)obj;
115 	}
116 	
117 	// add the Icon capabilities
118 	mixin IconT!(GThemedIcon);
119 	
120 	/**
121 	 */
122 	
123 	/**
124 	 * Creates a new themed icon for iconnames.
125 	 * Params:
126 	 * iconnames = an array of strings containing icon names. [array length=len]
127 	 * len = the length of the iconnames array, or -1 if iconnames is
128 	 * NULL-terminated
129 	 * Throws: ConstructionException GTK+ fails to create the object.
130 	 */
131 	public this (string[] iconnames, int len)
132 	{
133 		// GIcon * g_themed_icon_new_from_names (char **iconnames,  int len);
134 		auto p = g_themed_icon_new_from_names(Str.toStringzArray(iconnames), len);
135 		if(p is null)
136 		{
137 			throw new ConstructionException("null returned by g_themed_icon_new_from_names(Str.toStringzArray(iconnames), len)");
138 		}
139 		this(cast(GThemedIcon*) p);
140 	}
141 	
142 	/**
143 	 * Creates a new themed icon for iconname, and all the names
144 	 * that can be created by shortening iconname at '-' characters.
145 	 * Params:
146 	 * iconname = a string containing an icon name
147 	 * Throws: ConstructionException GTK+ fails to create the object.
148 	 */
149 	public this (string iconname)
150 	{
151 		// GIcon * g_themed_icon_new_with_default_fallbacks  (const char *iconname);
152 		auto p = g_themed_icon_new_with_default_fallbacks(Str.toStringz(iconname));
153 		if(p is null)
154 		{
155 			throw new ConstructionException("null returned by g_themed_icon_new_with_default_fallbacks(Str.toStringz(iconname))");
156 		}
157 		this(cast(GThemedIcon*) p);
158 	}
159 	
160 	/**
161 	 * Prepend a name to the list of icons from within icon.
162 	 * Note
163 	 * Note that doing so invalidates the hash computed by prior calls
164 	 * to g_icon_hash().
165 	 * Since 2.18
166 	 * Params:
167 	 * icon = a GThemedIcon
168 	 * iconname = name of icon to prepend to list of icons from within icon.
169 	 */
170 	public void prependName(string iconname)
171 	{
172 		// void g_themed_icon_prepend_name (GThemedIcon *icon,  const char *iconname);
173 		g_themed_icon_prepend_name(gThemedIcon, Str.toStringz(iconname));
174 	}
175 	
176 	/**
177 	 * Append a name to the list of icons from within icon.
178 	 * Note
179 	 * Note that doing so invalidates the hash computed by prior calls
180 	 * to g_icon_hash().
181 	 * Params:
182 	 * icon = a GThemedIcon
183 	 * iconname = name of icon to append to list of icons from within icon.
184 	 */
185 	public void appendName(string iconname)
186 	{
187 		// void g_themed_icon_append_name (GThemedIcon *icon,  const char *iconname);
188 		g_themed_icon_append_name(gThemedIcon, Str.toStringz(iconname));
189 	}
190 	
191 	/**
192 	 * Gets the names of icons from within icon.
193 	 * Returns: a list of icon names. [transfer none]
194 	 */
195 	public string[] getNames()
196 	{
197 		// const gchar * const * g_themed_icon_get_names (GThemedIcon *icon);
198 		return Str.toStringArray(g_themed_icon_get_names(gThemedIcon));
199 	}
200 }