2 * Copyright (C) 2007 Openismus GmbH
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
24 #include "gtktoolshell.h"
25 #include "gtkwidget.h"
30 * SECTION:gtktoolshell
31 * @Short_description: Interface for containers containing GtkToolItem widgets
32 * @Title: GtkToolShell
34 * The #GtkToolShell interface allows container widgets to provide additional
35 * information when embedding #GtkToolItem widgets.
37 * @see_also: #GtkToolbar, #GtkToolItem
43 * Dummy structure for accessing instances of #GtkToolShellIface.
47 gtk_tool_shell_get_type (void)
49 static GType type = 0;
53 type = g_type_register_static_simple (G_TYPE_INTERFACE, I_("GtkToolShell"),
54 sizeof (GtkToolShellIface),
56 g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
63 * gtk_tool_shell_get_icon_size:
64 * @shell: a #GtkToolShell
66 * Retrieves the icon size for the tool shell. Tool items must not call this
67 * function directly, but rely on gtk_tool_item_get_icon_size() instead.
69 * Return value: (type int): the current size for icons of @shell
74 gtk_tool_shell_get_icon_size (GtkToolShell *shell)
76 return GTK_TOOL_SHELL_GET_IFACE (shell)->get_icon_size (shell);
80 * gtk_tool_shell_get_orientation:
81 * @shell: a #GtkToolShell
83 * Retrieves the current orientation for the tool shell. Tool items must not
84 * call this function directly, but rely on gtk_tool_item_get_orientation()
87 * Return value: the current orientation of @shell
92 gtk_tool_shell_get_orientation (GtkToolShell *shell)
94 return GTK_TOOL_SHELL_GET_IFACE (shell)->get_orientation (shell);
98 * gtk_tool_shell_get_style:
99 * @shell: a #GtkToolShell
101 * Retrieves whether the tool shell has text, icons, or both. Tool items must
102 * not call this function directly, but rely on gtk_tool_item_get_style()
105 * Return value: the current style of @shell
110 gtk_tool_shell_get_style (GtkToolShell *shell)
112 return GTK_TOOL_SHELL_GET_IFACE (shell)->get_style (shell);
116 * gtk_tool_shell_get_relief_style:
117 * @shell: a #GtkToolShell
119 * Returns the relief style of buttons on @shell. Tool items must not call this
120 * function directly, but rely on gtk_tool_item_get_relief_style() instead.
122 * Return value: The relief style of buttons on @shell.
127 gtk_tool_shell_get_relief_style (GtkToolShell *shell)
129 GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
131 if (iface->get_relief_style)
132 return iface->get_relief_style (shell);
134 return GTK_RELIEF_NONE;
138 * gtk_tool_shell_rebuild_menu:
139 * @shell: a #GtkToolShell
141 * Calling this function signals the tool shell that the overflow menu item for
142 * tool items have changed. If there is an overflow menu and if it is visible
143 * when this function it called, the menu will be rebuilt.
145 * Tool items must not call this function directly, but rely on
146 * gtk_tool_item_rebuild_menu() instead.
151 gtk_tool_shell_rebuild_menu (GtkToolShell *shell)
153 GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
155 if (iface->rebuild_menu)
156 iface->rebuild_menu (shell);
160 * gtk_tool_shell_get_text_orientation:
161 * @shell: a #GtkToolShell
163 * Retrieves the current text orientation for the tool shell. Tool items must not
164 * call this function directly, but rely on gtk_tool_item_get_text_orientation()
167 * Return value: the current text orientation of @shell
172 gtk_tool_shell_get_text_orientation (GtkToolShell *shell)
174 GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
176 if (iface->get_text_orientation)
177 return GTK_TOOL_SHELL_GET_IFACE (shell)->get_text_orientation (shell);
179 return GTK_ORIENTATION_HORIZONTAL;
183 * gtk_tool_shell_get_text_alignment:
184 * @shell: a #GtkToolShell
186 * Retrieves the current text alignment for the tool shell. Tool items must not
187 * call this function directly, but rely on gtk_tool_item_get_text_alignment()
190 * Return value: the current text alignment of @shell
195 gtk_tool_shell_get_text_alignment (GtkToolShell *shell)
197 GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
199 if (iface->get_text_alignment)
200 return GTK_TOOL_SHELL_GET_IFACE (shell)->get_text_alignment (shell);
206 * gtk_tool_shell_get_ellipsize_mode
207 * @shell: a #GtkToolShell
209 * Retrieves the current ellipsize mode for the tool shell. Tool items must not
210 * call this function directly, but rely on gtk_tool_item_get_ellipsize_mode()
213 * Return value: the current ellipsize mode of @shell
218 gtk_tool_shell_get_ellipsize_mode (GtkToolShell *shell)
220 GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
222 if (iface->get_ellipsize_mode)
223 return GTK_TOOL_SHELL_GET_IFACE (shell)->get_ellipsize_mode (shell);
225 return PANGO_ELLIPSIZE_NONE;
229 * gtk_tool_shell_get_text_size_group:
230 * @shell: a #GtkToolShell
232 * Retrieves the current text size group for the tool shell. Tool items must not
233 * call this function directly, but rely on gtk_tool_item_get_text_size_group()
236 * Return value: the current text size group of @shell
241 gtk_tool_shell_get_text_size_group (GtkToolShell *shell)
243 GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
245 if (iface->get_text_size_group)
246 return GTK_TOOL_SHELL_GET_IFACE (shell)->get_text_size_group (shell);