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