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