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