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  = 
27  * outPack = gtk
28  * outFile = IconSize
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = IconSize
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_icon_size_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gtk.Settings
48  * structWrap:
49  * 	- GtkSettings* -> Settings
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module gtk.IconSize;
56 
57 public  import gtkc.gtktypes;
58 
59 private import gtkc.gtk;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 private import glib.Str;
64 private import gtk.Settings;
65 
66 
67 
68 /**
69  * Browse the available stock icons in the list of stock IDs found here. You can also use
70  * the gtk-demo application for this purpose.
71  *
72  * An icon factory manages a collection of GtkIconSet; a GtkIconSet manages a
73  * set of variants of a particular icon (i.e. a GtkIconSet contains variants for
74  * different sizes and widget states). Icons in an icon factory are named by a
75  * stock ID, which is a simple string identifying the icon. Each GtkStyle has a
76  * list of GtkIconFactory derived from the current theme; those icon factories
77  * are consulted first when searching for an icon. If the theme doesn't set a
78  * particular icon, GTK+ looks for the icon in a list of default icon factories,
79  * maintained by gtk_icon_factory_add_default() and
80  * gtk_icon_factory_remove_default(). Applications with icons should add a default
81  * icon factory with their icons, which will allow themes to override the icons
82  * for the application.
83  *
84  * To display an icon, always use gtk_style_lookup_icon_set() on the widget that
85  * will display the icon, or the convenience function
86  * gtk_widget_render_icon(). These functions take the theme into account when
87  * looking up the icon to use for a given stock ID.
88  *
89  * GtkIconFactory as GtkBuildable
90  *
91  * GtkIconFactory supports a custom <sources> element, which can contain
92  * multiple <source> elements.
93  * The following attributes are allowed:
94  *
95  * stock-id
96  *
97  * The stock id of the source, a string.
98  * This attribute is mandatory
99  *
100  * filename
101  *
102  * The filename of the source, a string.
103  * This attribute is optional
104  *
105  * icon-name
106  *
107  * The icon name for the source, a string.
108  * This attribute is optional.
109  *
110  * size
111  *
112  * Size of the icon, a GtkIconSize enum value.
113  * This attribute is optional.
114  *
115  * direction
116  *
117  * Direction of the source, a GtkTextDirection enum value.
118  * This attribute is optional.
119  *
120  * state
121  *
122  * State of the source, a GtkStateType enum value.
123  * This attribute is optional.
124  *
125  * $(DDOC_COMMENT example)
126  */
127 public class IconSize
128 {
129 	
130 	/**
131 	 */
132 	
133 	/**
134 	 * Params:
135 	 * size = an icon size. [type int]
136 	 * width = location to store icon width. [out][allow-none]
137 	 * height = location to store icon height. [out][allow-none]
138 	 * Returns: TRUE if size was a valid size
139 	 */
140 	public static int lookup(GtkIconSize size, out int width, out int height)
141 	{
142 		// gboolean gtk_icon_size_lookup (GtkIconSize size,  gint *width,  gint *height);
143 		return gtk_icon_size_lookup(size, &width, &height);
144 	}
145 	
146 	/**
147 	 * Warning
148 	 * gtk_icon_size_lookup_for_settings has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_icon_size_lookup() instead.
149 	 * Obtains the pixel size of a semantic icon size, possibly
150 	 * modified by user preferences for a particular
151 	 * GtkSettings. Normally size would be
152 	 * GTK_ICON_SIZE_MENU, GTK_ICON_SIZE_BUTTON, etc. This function
153 	 * isn't normally needed, gtk_widget_render_icon_pixbuf() is the usual
154 	 * way to get an icon for rendering, then just look at the size of
155 	 * the rendered pixbuf. The rendered pixbuf may not even correspond to
156 	 * the width/height returned by gtk_icon_size_lookup(), because themes
157 	 * are free to render the pixbuf however they like, including changing
158 	 * the usual size.
159 	 * Since 2.2
160 	 * Params:
161 	 * settings = a GtkSettings object, used to determine
162 	 * which set of user preferences to used.
163 	 * size = an icon size. [type int]
164 	 * width = location to store icon width. [out][allow-none]
165 	 * height = location to store icon height. [out][allow-none]
166 	 * Returns: TRUE if size was a valid size
167 	 */
168 	public static int lookupForSettings(Settings settings, GtkIconSize size, out int width, out int height)
169 	{
170 		// gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings,  GtkIconSize size,  gint *width,  gint *height);
171 		return gtk_icon_size_lookup_for_settings((settings is null) ? null : settings.getSettingsStruct(), size, &width, &height);
172 	}
173 	
174 	/**
175 	 * Warning
176 	 * gtk_icon_size_register has been deprecated since version 3.10 and should not be used in newly-written code. Use GtkIconTheme instead.
177 	 * Registers a new icon size, along the same lines as GTK_ICON_SIZE_MENU,
178 	 * etc. Returns the integer value for the size.
179 	 * Params:
180 	 * name = name of the icon size
181 	 * width = the icon width
182 	 * height = the icon height
183 	 * Returns: integer value representing the size. [type int]
184 	 */
185 	public static GtkIconSize register(string name, int width, int height)
186 	{
187 		// GtkIconSize gtk_icon_size_register (const gchar *name,  gint width,  gint height);
188 		return gtk_icon_size_register(Str.toStringz(name), width, height);
189 	}
190 	
191 	/**
192 	 * Warning
193 	 * gtk_icon_size_register_alias has been deprecated since version 3.10 and should not be used in newly-written code. Use GtkIconTheme instead.
194 	 * Registers alias as another name for target.
195 	 * So calling gtk_icon_size_from_name() with alias as argument
196 	 * will return target.
197 	 * Params:
198 	 * target = an existing icon size. [type int]
199 	 */
200 	public static void registerAlias(string alia, GtkIconSize target)
201 	{
202 		// void gtk_icon_size_register_alias (const gchar *alias,  GtkIconSize target);
203 		gtk_icon_size_register_alias(Str.toStringz(alia), target);
204 	}
205 	
206 	/**
207 	 * Warning
208 	 * gtk_icon_size_from_name has been deprecated since version 3.10 and should not be used in newly-written code. Use GtkIconTheme instead.
209 	 * Looks up the icon size associated with name.
210 	 * Params:
211 	 * name = the name to look up.
212 	 * Returns: the icon size. [type int]
213 	 */
214 	public static GtkIconSize fromName(string name)
215 	{
216 		// GtkIconSize gtk_icon_size_from_name (const gchar *name);
217 		return gtk_icon_size_from_name(Str.toStringz(name));
218 	}
219 	
220 	/**
221 	 * Warning
222 	 * gtk_icon_size_get_name has been deprecated since version 3.10 and should not be used in newly-written code. Use GtkIconTheme instead.
223 	 * Gets the canonical name of the given icon size. The returned string
224 	 * is statically allocated and should not be freed.
225 	 * Params:
226 	 * size = a GtkIconSize. [type int]
227 	 * Returns: the name of the given icon size.
228 	 */
229 	public static string getName(GtkIconSize size)
230 	{
231 		// const gchar * gtk_icon_size_get_name (GtkIconSize size);
232 		return Str.toString(gtk_icon_size_get_name(size));
233 	}
234 }