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 module gtk.IconSize;
26 
27 private import glib.Str;
28 private import gtk.Settings;
29 private import gtk.c.functions;
30 public  import gtk.c.types;
31 public  import gtkc.gtktypes;
32 
33 
34 /** */
35 public struct IconSize
36 {
37 
38 	/**
39 	 * Looks up the icon size associated with @name.
40 	 *
41 	 * Deprecated: Use #GtkIconTheme instead.
42 	 *
43 	 * Params:
44 	 *     name = the name to look up.
45 	 *
46 	 * Returns: the icon size (#GtkIconSize)
47 	 */
48 	public static GtkIconSize fromName(string name)
49 	{
50 		return gtk_icon_size_from_name(Str.toStringz(name));
51 	}
52 
53 	/**
54 	 * Gets the canonical name of the given icon size. The returned string
55 	 * is statically allocated and should not be freed.
56 	 *
57 	 * Deprecated: Use #GtkIconTheme instead.
58 	 *
59 	 * Params:
60 	 *     size = a #GtkIconSize.
61 	 *
62 	 * Returns: the name of the given icon size.
63 	 */
64 	public static string getName(GtkIconSize size)
65 	{
66 		return Str.toString(gtk_icon_size_get_name(size));
67 	}
68 
69 	/**
70 	 * Obtains the pixel size of a semantic icon size @size:
71 	 * #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc.  This function
72 	 * isn’t normally needed, gtk_icon_theme_load_icon() is the usual
73 	 * way to get an icon for rendering, then just look at the size of
74 	 * the rendered pixbuf. The rendered pixbuf may not even correspond to
75 	 * the width/height returned by gtk_icon_size_lookup(), because themes
76 	 * are free to render the pixbuf however they like, including changing
77 	 * the usual size.
78 	 *
79 	 * Params:
80 	 *     size = an icon size (#GtkIconSize)
81 	 *     width = location to store icon width
82 	 *     height = location to store icon height
83 	 *
84 	 * Returns: %TRUE if @size was a valid size
85 	 */
86 	public static bool lookup(GtkIconSize size, out int width, out int height)
87 	{
88 		return gtk_icon_size_lookup(size, &width, &height) != 0;
89 	}
90 
91 	/**
92 	 * Obtains the pixel size of a semantic icon size, possibly
93 	 * modified by user preferences for a particular
94 	 * #GtkSettings. Normally @size would be
95 	 * #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc.  This function
96 	 * isn’t normally needed, gtk_widget_render_icon_pixbuf() is the usual
97 	 * way to get an icon for rendering, then just look at the size of
98 	 * the rendered pixbuf. The rendered pixbuf may not even correspond to
99 	 * the width/height returned by gtk_icon_size_lookup(), because themes
100 	 * are free to render the pixbuf however they like, including changing
101 	 * the usual size.
102 	 *
103 	 * Deprecated: Use gtk_icon_size_lookup() instead.
104 	 *
105 	 * Params:
106 	 *     settings = a #GtkSettings object, used to determine
107 	 *         which set of user preferences to used.
108 	 *     size = an icon size (#GtkIconSize)
109 	 *     width = location to store icon width
110 	 *     height = location to store icon height
111 	 *
112 	 * Returns: %TRUE if @size was a valid size
113 	 *
114 	 * Since: 2.2
115 	 */
116 	public static bool lookupForSettings(Settings settings, GtkIconSize size, out int width, out int height)
117 	{
118 		return gtk_icon_size_lookup_for_settings((settings is null) ? null : settings.getSettingsStruct(), size, &width, &height) != 0;
119 	}
120 
121 	/**
122 	 * Registers a new icon size, along the same lines as #GTK_ICON_SIZE_MENU,
123 	 * etc. Returns the integer value for the size.
124 	 *
125 	 * Deprecated: Use #GtkIconTheme instead.
126 	 *
127 	 * Params:
128 	 *     name = name of the icon size
129 	 *     width = the icon width
130 	 *     height = the icon height
131 	 *
132 	 * Returns: integer value representing the size (#GtkIconSize)
133 	 */
134 	public static GtkIconSize register(string name, int width, int height)
135 	{
136 		return gtk_icon_size_register(Str.toStringz(name), width, height);
137 	}
138 
139 	/**
140 	 * Registers @alias as another name for @target.
141 	 * So calling gtk_icon_size_from_name() with @alias as argument
142 	 * will return @target.
143 	 *
144 	 * Deprecated: Use #GtkIconTheme instead.
145 	 *
146 	 * Params:
147 	 *     alias_ = an alias for @target
148 	 *     target = an existing icon size (#GtkIconSize)
149 	 */
150 	public static void registerAlias(string alias_, GtkIconSize target)
151 	{
152 		gtk_icon_size_register_alias(Str.toStringz(alias_), target);
153 	}
154 }