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  = GtkNumerableIcon.html
27  * outPack = gtk
28  * outFile = NumerableIcon
29  * strct   = GtkNumerableIcon
30  * realStrct=
31  * ctorStrct=
32  * clss    = NumerableIcon
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = GioEmblemedIcon
38  * implements:
39  * prefixes:
40  * 	- gtk_numerable_icon_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gio.EmblemedIcon : GioEmblemedIcon = EmblemedIcon
48  * 	- gio.Icon
49  * 	- gio.IconIF
50  * 	- gtk.StyleContext
51  * structWrap:
52  * 	- GIcon* -> IconIF
53  * 	- GtkStyleContext* -> StyleContext
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gtk.NumerableIcon;
60 
61 public  import gtkc.gtktypes;
62 
63 private import gtkc.gtk;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 
68 private import glib.Str;
69 private import gio.EmblemedIcon : GioEmblemedIcon = EmblemedIcon;
70 private import gio.Icon;
71 private import gio.IconIF;
72 private import gtk.StyleContext;
73 
74 
75 
76 
77 /**
78  * GtkNumerableIcon is a subclass of GEmblemedIcon that can
79  * show a number or short string as an emblem. The number can
80  * be overlayed on top of another emblem, if desired.
81  *
82  * It supports theming by taking font and color information
83  * from a provided GtkStyleContext; see
84  * gtk_numerable_icon_set_style_context().
85  *
86  * $(DDOC_COMMENT example)
87  */
88 public class NumerableIcon : GioEmblemedIcon
89 {
90 	
91 	/** the main Gtk struct */
92 	protected GtkNumerableIcon* gtkNumerableIcon;
93 	
94 	
95 	public GtkNumerableIcon* getNumerableIconStruct()
96 	{
97 		return gtkNumerableIcon;
98 	}
99 	
100 	
101 	/** the main Gtk struct as a void* */
102 	protected override void* getStruct()
103 	{
104 		return cast(void*)gtkNumerableIcon;
105 	}
106 	
107 	/**
108 	 * Sets our main struct and passes it to the parent class
109 	 */
110 	public this (GtkNumerableIcon* gtkNumerableIcon)
111 	{
112 		super(cast(GEmblemedIcon*)gtkNumerableIcon);
113 		this.gtkNumerableIcon = gtkNumerableIcon;
114 	}
115 	
116 	protected override void setStruct(GObject* obj)
117 	{
118 		super.setStruct(obj);
119 		gtkNumerableIcon = cast(GtkNumerableIcon*)obj;
120 	}
121 	
122 	/**
123 	 */
124 	
125 	/**
126 	 * Creates a new unthemed GtkNumerableIcon.
127 	 * Params:
128 	 * baseIcon = a GIcon to overlay on
129 	 * Returns: a new GIcon. [transfer full] Since 3.0
130 	 */
131 	public static IconIF newNumerableIcon(IconIF baseIcon)
132 	{
133 		// GIcon * gtk_numerable_icon_new (GIcon *base_icon);
134 		auto p = gtk_numerable_icon_new((baseIcon is null) ? null : baseIcon.getIconTStruct());
135 		
136 		if(p is null)
137 		{
138 			return null;
139 		}
140 		
141 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
142 	}
143 	
144 	/**
145 	 * Creates a new GtkNumerableIcon which will themed according
146 	 * to the passed GtkStyleContext. This is a convenience constructor
147 	 * that calls gtk_numerable_icon_set_style_context() internally.
148 	 * Params:
149 	 * baseIcon = a GIcon to overlay on
150 	 * context = a GtkStyleContext
151 	 * Returns: a new GIcon. [transfer full] Since 3.0
152 	 */
153 	public static IconIF newWithStyleContext(IconIF baseIcon, StyleContext context)
154 	{
155 		// GIcon * gtk_numerable_icon_new_with_style_context  (GIcon *base_icon,  GtkStyleContext *context);
156 		auto p = gtk_numerable_icon_new_with_style_context((baseIcon is null) ? null : baseIcon.getIconTStruct(), (context is null) ? null : context.getStyleContextStruct());
157 		
158 		if(p is null)
159 		{
160 			return null;
161 		}
162 		
163 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
164 	}
165 	
166 	/**
167 	 * Returns the GIcon that was set as the base background image, or
168 	 * NULL if there's none. The caller of this function does not own
169 	 * a reference to the returned GIcon.
170 	 * Returns: a GIcon, or NULL. [transfer none] Since 3.0
171 	 */
172 	public IconIF getBackgroundGicon()
173 	{
174 		// GIcon * gtk_numerable_icon_get_background_gicon  (GtkNumerableIcon *self);
175 		auto p = gtk_numerable_icon_get_background_gicon(gtkNumerableIcon);
176 		
177 		if(p is null)
178 		{
179 			return null;
180 		}
181 		
182 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
183 	}
184 	
185 	/**
186 	 * Updates the icon to use icon as the base background image.
187 	 * If icon is NULL, self will go back using style information
188 	 * or default theming for its background image.
189 	 * If this method is called and an icon name was already set as
190 	 * background for the icon, icon will be used, i.e. the last method
191 	 * called between gtk_numerable_icon_set_background_gicon() and
192 	 * gtk_numerable_icon_set_background_icon_name() has always priority.
193 	 * Params:
194 	 * icon = a GIcon, or NULL. [allow-none]
195 	 * Since 3.0
196 	 */
197 	public void setBackgroundGicon(IconIF icon)
198 	{
199 		// void gtk_numerable_icon_set_background_gicon  (GtkNumerableIcon *self,  GIcon *icon);
200 		gtk_numerable_icon_set_background_gicon(gtkNumerableIcon, (icon is null) ? null : icon.getIconTStruct());
201 	}
202 	
203 	/**
204 	 * Returns the icon name used as the base background image,
205 	 * or NULL if there's none.
206 	 * Returns: an icon name, or NULL Since 3.0
207 	 */
208 	public string getBackgroundIconName()
209 	{
210 		// const gchar * gtk_numerable_icon_get_background_icon_name  (GtkNumerableIcon *self);
211 		return Str.toString(gtk_numerable_icon_get_background_icon_name(gtkNumerableIcon));
212 	}
213 	
214 	/**
215 	 * Updates the icon to use the icon named icon_name from the
216 	 * current icon theme as the base background image. If icon_name
217 	 * is NULL, self will go back using style information or default
218 	 * theming for its background image.
219 	 * If this method is called and a GIcon was already set as
220 	 * background for the icon, icon_name will be used, i.e. the
221 	 * last method called between gtk_numerable_icon_set_background_icon_name()
222 	 * and gtk_numerable_icon_set_background_gicon() has always priority.
223 	 * Params:
224 	 * iconName = an icon name, or NULL. [allow-none]
225 	 * Since 3.0
226 	 */
227 	public void setBackgroundIconName(string iconName)
228 	{
229 		// void gtk_numerable_icon_set_background_icon_name  (GtkNumerableIcon *self,  const gchar *icon_name);
230 		gtk_numerable_icon_set_background_icon_name(gtkNumerableIcon, Str.toStringz(iconName));
231 	}
232 	
233 	/**
234 	 * Returns the value currently displayed by self.
235 	 * Returns: the currently displayed value Since 3.0
236 	 */
237 	public int getCount()
238 	{
239 		// gint gtk_numerable_icon_get_count (GtkNumerableIcon *self);
240 		return gtk_numerable_icon_get_count(gtkNumerableIcon);
241 	}
242 	
243 	/**
244 	 * Sets the currently displayed value of self to count.
245 	 * The numeric value is always clamped to make it two digits, i.e.
246 	 * between -99 and 99. Setting a count of zero removes the emblem.
247 	 * If this method is called, and a label was already set on the icon,
248 	 * it will automatically be reset to NULL before rendering the number,
249 	 * i.e. the last method called between gtk_numerable_icon_set_count()
250 	 * and gtk_numerable_icon_set_label() has always priority.
251 	 * Params:
252 	 * count = a number between -99 and 99
253 	 * Since 3.0
254 	 */
255 	public void setCount(int count)
256 	{
257 		// void gtk_numerable_icon_set_count (GtkNumerableIcon *self,  gint count);
258 		gtk_numerable_icon_set_count(gtkNumerableIcon, count);
259 	}
260 	
261 	/**
262 	 * Returns the currently displayed label of the icon, or NULL.
263 	 * Returns: the currently displayed label Since 3.0
264 	 */
265 	public string getLabel()
266 	{
267 		// const gchar * gtk_numerable_icon_get_label (GtkNumerableIcon *self);
268 		return Str.toString(gtk_numerable_icon_get_label(gtkNumerableIcon));
269 	}
270 	
271 	/**
272 	 * Sets the currently displayed value of self to the string
273 	 * in label. Setting an empty label removes the emblem.
274 	 * Note that this is meant for displaying short labels, such as
275 	 * roman numbers, or single letters. For roman numbers, consider
276 	 * using the Unicode characters U+2160 - U+217F. Strings longer
277 	 * than two characters will likely not be rendered very well.
278 	 * If this method is called, and a number was already set on the
279 	 * icon, it will automatically be reset to zero before rendering
280 	 * the label, i.e. the last method called between
281 	 * gtk_numerable_icon_set_label() and gtk_numerable_icon_set_count()
282 	 * has always priority.
283 	 * Params:
284 	 * label = a short label, or NULL. [allow-none]
285 	 * Since 3.0
286 	 */
287 	public void setLabel(string label)
288 	{
289 		// void gtk_numerable_icon_set_label (GtkNumerableIcon *self,  const gchar *label);
290 		gtk_numerable_icon_set_label(gtkNumerableIcon, Str.toStringz(label));
291 	}
292 	
293 	/**
294 	 * Returns the GtkStyleContext used by the icon for theming,
295 	 * or NULL if there's none.
296 	 * Returns: a GtkStyleContext, or NULL. This object is internal to GTK+ and should not be unreffed. Use g_object_ref() if you want to keep it around. [transfer none] Since 3.0
297 	 */
298 	public StyleContext getStyleContext()
299 	{
300 		// GtkStyleContext * gtk_numerable_icon_get_style_context  (GtkNumerableIcon *self);
301 		auto p = gtk_numerable_icon_get_style_context(gtkNumerableIcon);
302 		
303 		if(p is null)
304 		{
305 			return null;
306 		}
307 		
308 		return ObjectG.getDObject!(StyleContext)(cast(GtkStyleContext*) p);
309 	}
310 	
311 	/**
312 	 * Updates the icon to fetch theme information from the
313 	 * given GtkStyleContext.
314 	 * Params:
315 	 * style = a GtkStyleContext
316 	 * Since 3.0
317 	 */
318 	public void setStyleContext(StyleContext style)
319 	{
320 		// void gtk_numerable_icon_set_style_context  (GtkNumerableIcon *self,  GtkStyleContext *style);
321 		gtk_numerable_icon_set_style_context(gtkNumerableIcon, (style is null) ? null : style.getStyleContextStruct());
322 	}
323 }