|
Packit |
98cdb6 |
/* gtktoolshell.c
|
|
Packit |
98cdb6 |
* Copyright (C) 2007 Openismus GmbH
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
98cdb6 |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
98cdb6 |
* License as published by the Free Software Foundation; either
|
|
Packit |
98cdb6 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
98cdb6 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
98cdb6 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
98cdb6 |
* Library General Public License for more details.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
98cdb6 |
* License along with this library; if not, write to the
|
|
Packit |
98cdb6 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Packit |
98cdb6 |
* Boston, MA 02111-1307, USA.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Author:
|
|
Packit |
98cdb6 |
* Mathias Hasselmann
|
|
Packit |
98cdb6 |
*/
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
#include "config.h"
|
|
Packit |
98cdb6 |
#include "gtktoolshell.h"
|
|
Packit |
98cdb6 |
#include "gtkwidget.h"
|
|
Packit |
98cdb6 |
#include "gtkintl.h"
|
|
Packit |
98cdb6 |
#include "gtkalias.h"
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* SECTION:gtktoolshell
|
|
Packit |
98cdb6 |
* @Short_description: Interface for containers containing GtkToolItem widgets
|
|
Packit |
98cdb6 |
* @Title: GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* The #GtkToolShell interface allows container widgets to provide additional
|
|
Packit |
98cdb6 |
* information when embedding #GtkToolItem widgets.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* @see_also: #GtkToolbar, #GtkToolItem
|
|
Packit |
98cdb6 |
*/
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* GtkToolShell:
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Dummy structure for accessing instances of #GtkToolShellIface.
|
|
Packit |
98cdb6 |
*/
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
GType
|
|
Packit |
98cdb6 |
gtk_tool_shell_get_type (void)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
static GType type = 0;
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
if (!type)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
type = g_type_register_static_simple (G_TYPE_INTERFACE, I_("GtkToolShell"),
|
|
Packit |
98cdb6 |
sizeof (GtkToolShellIface),
|
|
Packit |
98cdb6 |
NULL, 0, NULL, 0);
|
|
Packit |
98cdb6 |
g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
return type;
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* gtk_tool_shell_get_icon_size:
|
|
Packit |
98cdb6 |
* @shell: a #GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Retrieves the icon size for the tool shell. Tool items must not call this
|
|
Packit |
98cdb6 |
* function directly, but rely on gtk_tool_item_get_icon_size() instead.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Return value: (type int): the current size for icons of @shell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Since: 2.14
|
|
Packit |
98cdb6 |
**/
|
|
Packit |
98cdb6 |
GtkIconSize
|
|
Packit |
98cdb6 |
gtk_tool_shell_get_icon_size (GtkToolShell *shell)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_icon_size (shell);
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* gtk_tool_shell_get_orientation:
|
|
Packit |
98cdb6 |
* @shell: a #GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Retrieves the current orientation for the tool shell. Tool items must not
|
|
Packit |
98cdb6 |
* call this function directly, but rely on gtk_tool_item_get_orientation()
|
|
Packit |
98cdb6 |
* instead.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Return value: the current orientation of @shell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Since: 2.14
|
|
Packit |
98cdb6 |
**/
|
|
Packit |
98cdb6 |
GtkOrientation
|
|
Packit |
98cdb6 |
gtk_tool_shell_get_orientation (GtkToolShell *shell)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_orientation (shell);
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* gtk_tool_shell_get_style:
|
|
Packit |
98cdb6 |
* @shell: a #GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Retrieves whether the tool shell has text, icons, or both. Tool items must
|
|
Packit |
98cdb6 |
* not call this function directly, but rely on gtk_tool_item_get_style()
|
|
Packit |
98cdb6 |
* instead.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Return value: the current style of @shell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Since: 2.14
|
|
Packit |
98cdb6 |
**/
|
|
Packit |
98cdb6 |
GtkToolbarStyle
|
|
Packit |
98cdb6 |
gtk_tool_shell_get_style (GtkToolShell *shell)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_style (shell);
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* gtk_tool_shell_get_relief_style:
|
|
Packit |
98cdb6 |
* @shell: a #GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Returns the relief style of buttons on @shell. Tool items must not call this
|
|
Packit |
98cdb6 |
* function directly, but rely on gtk_tool_item_get_relief_style() instead.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Return value: The relief style of buttons on @shell.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Since: 2.14
|
|
Packit |
98cdb6 |
**/
|
|
Packit |
98cdb6 |
GtkReliefStyle
|
|
Packit |
98cdb6 |
gtk_tool_shell_get_relief_style (GtkToolShell *shell)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
if (iface->get_relief_style)
|
|
Packit |
98cdb6 |
return iface->get_relief_style (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
return GTK_RELIEF_NONE;
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* gtk_tool_shell_rebuild_menu:
|
|
Packit |
98cdb6 |
* @shell: a #GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Calling this function signals the tool shell that the overflow menu item for
|
|
Packit |
98cdb6 |
* tool items have changed. If there is an overflow menu and if it is visible
|
|
Packit |
98cdb6 |
* when this function it called, the menu will be rebuilt.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Tool items must not call this function directly, but rely on
|
|
Packit |
98cdb6 |
* gtk_tool_item_rebuild_menu() instead.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Since: 2.14
|
|
Packit |
98cdb6 |
**/
|
|
Packit |
98cdb6 |
void
|
|
Packit |
98cdb6 |
gtk_tool_shell_rebuild_menu (GtkToolShell *shell)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
if (iface->rebuild_menu)
|
|
Packit |
98cdb6 |
iface->rebuild_menu (shell);
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* gtk_tool_shell_get_text_orientation:
|
|
Packit |
98cdb6 |
* @shell: a #GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Retrieves the current text orientation for the tool shell. Tool items must not
|
|
Packit |
98cdb6 |
* call this function directly, but rely on gtk_tool_item_get_text_orientation()
|
|
Packit |
98cdb6 |
* instead.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Return value: the current text orientation of @shell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Since: 2.20
|
|
Packit |
98cdb6 |
**/
|
|
Packit |
98cdb6 |
GtkOrientation
|
|
Packit |
98cdb6 |
gtk_tool_shell_get_text_orientation (GtkToolShell *shell)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
if (iface->get_text_orientation)
|
|
Packit |
98cdb6 |
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_text_orientation (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
return GTK_ORIENTATION_HORIZONTAL;
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* gtk_tool_shell_get_text_alignment:
|
|
Packit |
98cdb6 |
* @shell: a #GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Retrieves the current text alignment for the tool shell. Tool items must not
|
|
Packit |
98cdb6 |
* call this function directly, but rely on gtk_tool_item_get_text_alignment()
|
|
Packit |
98cdb6 |
* instead.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Return value: the current text alignment of @shell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Since: 2.20
|
|
Packit |
98cdb6 |
**/
|
|
Packit |
98cdb6 |
gfloat
|
|
Packit |
98cdb6 |
gtk_tool_shell_get_text_alignment (GtkToolShell *shell)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
if (iface->get_text_alignment)
|
|
Packit |
98cdb6 |
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_text_alignment (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
return 0.5f;
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* gtk_tool_shell_get_ellipsize_mode
|
|
Packit |
98cdb6 |
* @shell: a #GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Retrieves the current ellipsize mode for the tool shell. Tool items must not
|
|
Packit |
98cdb6 |
* call this function directly, but rely on gtk_tool_item_get_ellipsize_mode()
|
|
Packit |
98cdb6 |
* instead.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Return value: the current ellipsize mode of @shell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Since: 2.20
|
|
Packit |
98cdb6 |
**/
|
|
Packit |
98cdb6 |
PangoEllipsizeMode
|
|
Packit |
98cdb6 |
gtk_tool_shell_get_ellipsize_mode (GtkToolShell *shell)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
if (iface->get_ellipsize_mode)
|
|
Packit |
98cdb6 |
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_ellipsize_mode (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
return PANGO_ELLIPSIZE_NONE;
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/**
|
|
Packit |
98cdb6 |
* gtk_tool_shell_get_text_size_group:
|
|
Packit |
98cdb6 |
* @shell: a #GtkToolShell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Retrieves the current text size group for the tool shell. Tool items must not
|
|
Packit |
98cdb6 |
* call this function directly, but rely on gtk_tool_item_get_text_size_group()
|
|
Packit |
98cdb6 |
* instead.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Return value: (transfer none): the current text size group of @shell
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* Since: 2.20
|
|
Packit |
98cdb6 |
**/
|
|
Packit |
98cdb6 |
GtkSizeGroup *
|
|
Packit |
98cdb6 |
gtk_tool_shell_get_text_size_group (GtkToolShell *shell)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
if (iface->get_text_size_group)
|
|
Packit |
98cdb6 |
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_text_size_group (shell);
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
return NULL;
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
#define __GTK_TOOL_SHELL_C__
|
|
Packit |
98cdb6 |
#include "gtkaliasdef.c"
|