2003-06-29 23:34:20 +00:00
|
|
|
/* gtktoolitem.c
|
|
|
|
*
|
2003-12-29 10:55:53 +00:00
|
|
|
* Copyright (C) 2002 Anders Carlsson <andersca@gnome.org>
|
2003-06-29 23:34:20 +00:00
|
|
|
* Copyright (C) 2002 James Henstridge <james@daa.com.au>
|
|
|
|
* Copyright (C) 2003 Soeren Sandmann <sandmann@daimi.au.dk>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2008-06-17 14:11:26 +00:00
|
|
|
|
2010-09-14 01:33:06 +00:00
|
|
|
#include "gtktoolitem.h"
|
|
|
|
|
2008-06-17 14:11:26 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2003-06-29 23:34:20 +00:00
|
|
|
#include "gtkmarshalers.h"
|
2007-12-14 10:57:46 +00:00
|
|
|
#include "gtktoolshell.h"
|
2003-06-29 23:34:20 +00:00
|
|
|
#include "gtkseparatormenuitem.h"
|
2010-09-14 01:33:06 +00:00
|
|
|
#include "gtksizerequest.h"
|
2009-01-23 15:15:28 +00:00
|
|
|
#include "gtkactivatable.h"
|
2003-06-29 23:34:20 +00:00
|
|
|
#include "gtkintl.h"
|
2011-01-04 22:32:12 +00:00
|
|
|
#include "gtkmainprivate.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
#include "gtkprivate.h"
|
2010-07-09 17:22:23 +00:00
|
|
|
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2007-12-14 10:57:46 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gtktoolitem
|
2008-10-27 04:27:03 +00:00
|
|
|
* @short_description: The base class of widgets that can be added to GtkToolShell
|
2010-05-12 22:59:58 +00:00
|
|
|
* @Title: GtkToolItem
|
2009-07-28 08:20:22 +00:00
|
|
|
* @see_also: <variablelist>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term>#GtkToolbar</term>
|
|
|
|
* <listitem><para>The toolbar widget</para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term>#GtkToolButton</term>
|
|
|
|
* <listitem><para>A subclass of #GtkToolItem that displays buttons on
|
|
|
|
* the toolbar</para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term>#GtkSeparatorToolItem</term>
|
|
|
|
* <listitem><para>A subclass of #GtkToolItem that separates groups of
|
|
|
|
* items on a toolbar</para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* </variablelist>
|
2007-12-14 10:57:46 +00:00
|
|
|
*
|
|
|
|
* #GtkToolItem<!-- -->s are widgets that can appear on a toolbar. To
|
|
|
|
* create a toolbar item that contain something else than a button, use
|
|
|
|
* gtk_tool_item_new(). Use gtk_container_add() to add a child
|
|
|
|
* widget to the tool item.
|
|
|
|
*
|
|
|
|
* For toolbar items that contain buttons, see the #GtkToolButton,
|
|
|
|
* #GtkToggleToolButton and #GtkRadioToolButton classes.
|
|
|
|
*
|
|
|
|
* See the #GtkToolbar class for a description of the toolbar widget, and
|
|
|
|
* #GtkToolShell for a description of the tool shell interface.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkToolItem:
|
|
|
|
*
|
|
|
|
* The GtkToolItem struct contains only private data.
|
|
|
|
* It should only be accessed through the functions described below.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 23:34:20 +00:00
|
|
|
enum {
|
|
|
|
CREATE_MENU_PROXY,
|
|
|
|
TOOLBAR_RECONFIGURED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PROP_0,
|
|
|
|
PROP_VISIBLE_HORIZONTAL,
|
|
|
|
PROP_VISIBLE_VERTICAL,
|
2009-01-23 15:15:28 +00:00
|
|
|
PROP_IS_IMPORTANT,
|
|
|
|
|
|
|
|
/* activatable properties */
|
|
|
|
PROP_ACTIVATABLE_RELATED_ACTION,
|
|
|
|
PROP_ACTIVATABLE_USE_ACTION_APPEARANCE
|
2003-06-29 23:34:20 +00:00
|
|
|
};
|
|
|
|
|
2003-09-30 22:48:10 +00:00
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
struct _GtkToolItemPrivate
|
|
|
|
{
|
|
|
|
gchar *tip_text;
|
|
|
|
gchar *tip_private;
|
|
|
|
|
2011-04-12 16:49:16 +00:00
|
|
|
guint visible_horizontal : 1;
|
|
|
|
guint visible_vertical : 1;
|
|
|
|
guint homogeneous : 1;
|
|
|
|
guint expand : 1;
|
|
|
|
guint use_drag_window : 1;
|
|
|
|
guint is_important : 1;
|
|
|
|
guint use_action_appearance : 1;
|
2003-07-08 10:58:23 +00:00
|
|
|
|
|
|
|
GdkWindow *drag_window;
|
|
|
|
gchar *menu_item_id;
|
|
|
|
GtkWidget *menu_item;
|
2009-01-23 15:15:28 +00:00
|
|
|
|
|
|
|
GtkAction *action;
|
2003-07-08 10:58:23 +00:00
|
|
|
};
|
2011-04-12 16:49:16 +00:00
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
static void gtk_tool_item_finalize (GObject *object);
|
|
|
|
static void gtk_tool_item_dispose (GObject *object);
|
|
|
|
static void gtk_tool_item_parent_set (GtkWidget *toolitem,
|
|
|
|
GtkWidget *parent);
|
2003-06-29 23:34:20 +00:00
|
|
|
static void gtk_tool_item_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gtk_tool_item_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2004-02-20 18:02:21 +00:00
|
|
|
static void gtk_tool_item_property_notify (GObject *object,
|
|
|
|
GParamSpec *pspec);
|
2003-06-29 23:34:20 +00:00
|
|
|
static void gtk_tool_item_realize (GtkWidget *widget);
|
|
|
|
static void gtk_tool_item_unrealize (GtkWidget *widget);
|
|
|
|
static void gtk_tool_item_map (GtkWidget *widget);
|
|
|
|
static void gtk_tool_item_unmap (GtkWidget *widget);
|
2010-10-27 13:53:46 +00:00
|
|
|
static void gtk_tool_item_get_preferred_width
|
|
|
|
(GtkWidget *widget,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural);
|
|
|
|
static void gtk_tool_item_get_preferred_height
|
|
|
|
(GtkWidget *widget,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural);
|
2003-06-29 23:34:20 +00:00
|
|
|
static void gtk_tool_item_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation);
|
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
static void gtk_tool_item_activatable_interface_init (GtkActivatableIface *iface);
|
2009-02-22 05:20:14 +00:00
|
|
|
static void gtk_tool_item_update (GtkActivatable *activatable,
|
2009-01-23 15:15:28 +00:00
|
|
|
GtkAction *action,
|
|
|
|
const gchar *property_name);
|
2009-02-22 05:20:14 +00:00
|
|
|
static void gtk_tool_item_sync_action_properties (GtkActivatable *activatable,
|
2009-01-23 15:15:28 +00:00
|
|
|
GtkAction *action);
|
|
|
|
static void gtk_tool_item_set_related_action (GtkToolItem *item,
|
|
|
|
GtkAction *action);
|
|
|
|
static void gtk_tool_item_set_use_action_appearance (GtkToolItem *item,
|
|
|
|
gboolean use_appearance);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2006-05-14 04:25:34 +00:00
|
|
|
static guint toolitem_signals[LAST_SIGNAL] = { 0 };
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GtkToolItem, gtk_tool_item, GTK_TYPE_BIN,
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
|
|
|
|
gtk_tool_item_activatable_interface_init))
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_class_init (GtkToolItemClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
|
|
|
|
object_class = (GObjectClass *)klass;
|
|
|
|
widget_class = (GtkWidgetClass *)klass;
|
2010-10-27 13:53:46 +00:00
|
|
|
|
2003-06-29 23:34:20 +00:00
|
|
|
object_class->set_property = gtk_tool_item_set_property;
|
|
|
|
object_class->get_property = gtk_tool_item_get_property;
|
2009-01-23 15:15:28 +00:00
|
|
|
object_class->finalize = gtk_tool_item_finalize;
|
|
|
|
object_class->dispose = gtk_tool_item_dispose;
|
|
|
|
object_class->notify = gtk_tool_item_property_notify;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
widget_class->realize = gtk_tool_item_realize;
|
|
|
|
widget_class->unrealize = gtk_tool_item_unrealize;
|
|
|
|
widget_class->map = gtk_tool_item_map;
|
|
|
|
widget_class->unmap = gtk_tool_item_unmap;
|
2010-10-27 13:53:46 +00:00
|
|
|
widget_class->get_preferred_width = gtk_tool_item_get_preferred_width;
|
|
|
|
widget_class->get_preferred_height = gtk_tool_item_get_preferred_height;
|
2003-06-29 23:34:20 +00:00
|
|
|
widget_class->size_allocate = gtk_tool_item_size_allocate;
|
|
|
|
widget_class->parent_set = gtk_tool_item_parent_set;
|
|
|
|
|
2010-10-27 13:53:46 +00:00
|
|
|
gtk_container_class_handle_border_width (GTK_CONTAINER_CLASS (klass));
|
|
|
|
|
2009-01-26 03:01:01 +00:00
|
|
|
klass->create_menu_proxy = _gtk_tool_item_create_menu_proxy;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_VISIBLE_HORIZONTAL,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("visible-horizontal",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Visible when horizontal"),
|
|
|
|
P_("Whether the toolbar item is visible when the toolbar is in a horizontal orientation."),
|
2003-06-29 23:34:20 +00:00
|
|
|
TRUE,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2003-06-29 23:34:20 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_VISIBLE_VERTICAL,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("visible-vertical",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Visible when vertical"),
|
|
|
|
P_("Whether the toolbar item is visible when the toolbar is in a vertical orientation."),
|
2003-06-29 23:34:20 +00:00
|
|
|
TRUE,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2003-08-04 21:13:55 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_IS_IMPORTANT,
|
2005-03-09 06:15:13 +00:00
|
|
|
g_param_spec_boolean ("is-important",
|
2004-01-16 23:10:05 +00:00
|
|
|
P_("Is important"),
|
|
|
|
P_("Whether the toolbar item is considered important. When TRUE, toolbar buttons show text in GTK_TOOLBAR_BOTH_HORIZ mode"),
|
2003-08-04 21:13:55 +00:00
|
|
|
FALSE,
|
2005-03-22 02:14:55 +00:00
|
|
|
GTK_PARAM_READWRITE));
|
2003-08-04 21:13:55 +00:00
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
g_object_class_override_property (object_class, PROP_ACTIVATABLE_RELATED_ACTION, "related-action");
|
|
|
|
g_object_class_override_property (object_class, PROP_ACTIVATABLE_USE_ACTION_APPEARANCE, "use-action-appearance");
|
|
|
|
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* GtkToolItem::create-menu-proxy:
|
2007-07-12 01:13:42 +00:00
|
|
|
* @tool_item: the object the signal was emitted on
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
2004-09-14 21:40:41 +00:00
|
|
|
* This signal is emitted when the toolbar needs information from @tool_item
|
|
|
|
* about whether the item should appear in the toolbar overflow menu. In
|
|
|
|
* response the tool item should either
|
2003-08-04 21:13:55 +00:00
|
|
|
* <itemizedlist>
|
2007-07-12 01:13:42 +00:00
|
|
|
* <listitem>call gtk_tool_item_set_proxy_menu_item() with a %NULL
|
2003-08-04 21:13:55 +00:00
|
|
|
* pointer and return %TRUE to indicate that the item should not appear
|
|
|
|
* in the overflow menu
|
|
|
|
* </listitem>
|
|
|
|
* <listitem> call gtk_tool_item_set_proxy_menu_item() with a new menu
|
2003-10-01 00:16:11 +00:00
|
|
|
* item and return %TRUE, or
|
2003-08-04 21:13:55 +00:00
|
|
|
* </listitem>
|
2003-10-01 00:16:11 +00:00
|
|
|
* <listitem> return %FALSE to indicate that the signal was not
|
2003-08-04 21:13:55 +00:00
|
|
|
* handled by the item. This means that
|
|
|
|
* the item will not appear in the overflow menu unless a later handler
|
|
|
|
* installs a menu item.
|
|
|
|
* </listitem>
|
|
|
|
* </itemizedlist>
|
2004-09-14 21:40:41 +00:00
|
|
|
*
|
|
|
|
* The toolbar may cache the result of this signal. When the tool item changes
|
|
|
|
* how it will respond to this signal it must call gtk_tool_item_rebuild_menu()
|
|
|
|
* to invalidate the cache and ensure that the toolbar rebuilds its overflow
|
|
|
|
* menu.
|
|
|
|
*
|
2003-08-04 21:13:55 +00:00
|
|
|
* Return value: %TRUE if the signal was handled, %FALSE if not
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
toolitem_signals[CREATE_MENU_PROXY] =
|
2008-08-08 14:23:32 +00:00
|
|
|
g_signal_new (I_("create-menu-proxy"),
|
2003-06-29 23:34:20 +00:00
|
|
|
G_OBJECT_CLASS_TYPE (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkToolItemClass, create_menu_proxy),
|
2003-07-04 16:48:40 +00:00
|
|
|
_gtk_boolean_handled_accumulator, NULL,
|
2003-06-29 23:34:20 +00:00
|
|
|
_gtk_marshal_BOOLEAN__VOID,
|
|
|
|
G_TYPE_BOOLEAN, 0);
|
2003-08-04 21:13:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GtkToolItem::toolbar-reconfigured:
|
2007-07-12 01:13:42 +00:00
|
|
|
* @tool_item: the object the signal was emitted on
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* This signal is emitted when some property of the toolbar that the
|
|
|
|
* item is a child of changes. For custom subclasses of #GtkToolItem,
|
|
|
|
* the default handler of this signal use the functions
|
|
|
|
* <itemizedlist>
|
2007-12-14 10:57:46 +00:00
|
|
|
* <listitem>gtk_tool_shell_get_orientation()</listitem>
|
|
|
|
* <listitem>gtk_tool_shell_get_style()</listitem>
|
|
|
|
* <listitem>gtk_tool_shell_get_icon_size()</listitem>
|
|
|
|
* <listitem>gtk_tool_shell_get_relief_style()</listitem>
|
2003-08-04 21:13:55 +00:00
|
|
|
* </itemizedlist>
|
|
|
|
* to find out what the toolbar should look like and change
|
|
|
|
* themselves accordingly.
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
toolitem_signals[TOOLBAR_RECONFIGURED] =
|
2008-08-08 14:23:32 +00:00
|
|
|
g_signal_new (I_("toolbar-reconfigured"),
|
2003-06-29 23:34:20 +00:00
|
|
|
G_OBJECT_CLASS_TYPE (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkToolItemClass, toolbar_reconfigured),
|
|
|
|
NULL, NULL,
|
|
|
|
_gtk_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2003-07-08 10:58:23 +00:00
|
|
|
|
|
|
|
g_type_class_add_private (object_class, sizeof (GtkToolItemPrivate));
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_init (GtkToolItem *toolitem)
|
|
|
|
{
|
2010-03-02 03:40:38 +00:00
|
|
|
gtk_widget_set_can_focus (GTK_WIDGET (toolitem), FALSE);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2010-07-14 00:15:25 +00:00
|
|
|
toolitem->priv = G_TYPE_INSTANCE_GET_PRIVATE (toolitem,
|
|
|
|
GTK_TYPE_TOOL_ITEM,
|
|
|
|
GtkToolItemPrivate);
|
2003-07-08 10:58:23 +00:00
|
|
|
|
|
|
|
toolitem->priv->visible_horizontal = TRUE;
|
|
|
|
toolitem->priv->visible_vertical = TRUE;
|
|
|
|
toolitem->priv->homogeneous = FALSE;
|
|
|
|
toolitem->priv->expand = FALSE;
|
2009-01-23 15:15:28 +00:00
|
|
|
|
|
|
|
toolitem->priv->use_action_appearance = TRUE;
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkToolItem *item = GTK_TOOL_ITEM (object);
|
|
|
|
|
2007-03-09 21:57:37 +00:00
|
|
|
g_free (item->priv->menu_item_id);
|
2008-08-07 14:21:47 +00:00
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (item->priv->menu_item)
|
|
|
|
g_object_unref (item->priv->menu_item);
|
2008-08-07 14:21:47 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (gtk_tool_item_parent_class)->finalize (object);
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
2009-01-23 15:15:28 +00:00
|
|
|
static void
|
|
|
|
gtk_tool_item_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
GtkToolItem *item = GTK_TOOL_ITEM (object);
|
|
|
|
|
|
|
|
if (item->priv->action)
|
|
|
|
{
|
|
|
|
gtk_activatable_do_set_related_action (GTK_ACTIVATABLE (item), NULL);
|
|
|
|
item->priv->action = NULL;
|
|
|
|
}
|
|
|
|
G_OBJECT_CLASS (gtk_tool_item_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-29 23:34:20 +00:00
|
|
|
static void
|
2007-01-28 03:16:30 +00:00
|
|
|
gtk_tool_item_parent_set (GtkWidget *toolitem,
|
|
|
|
GtkWidget *prev_parent)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2010-08-11 20:51:44 +00:00
|
|
|
if (gtk_widget_get_parent (GTK_WIDGET (toolitem)) != NULL)
|
2008-01-13 23:41:46 +00:00
|
|
|
gtk_tool_item_toolbar_reconfigured (GTK_TOOL_ITEM (toolitem));
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkToolItem *toolitem = GTK_TOOL_ITEM (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_VISIBLE_HORIZONTAL:
|
|
|
|
gtk_tool_item_set_visible_horizontal (toolitem, g_value_get_boolean (value));
|
|
|
|
break;
|
|
|
|
case PROP_VISIBLE_VERTICAL:
|
2004-01-06 20:39:48 +00:00
|
|
|
gtk_tool_item_set_visible_vertical (toolitem, g_value_get_boolean (value));
|
2003-06-29 23:34:20 +00:00
|
|
|
break;
|
2003-08-04 21:13:55 +00:00
|
|
|
case PROP_IS_IMPORTANT:
|
|
|
|
gtk_tool_item_set_is_important (toolitem, g_value_get_boolean (value));
|
|
|
|
break;
|
2009-01-23 15:15:28 +00:00
|
|
|
case PROP_ACTIVATABLE_RELATED_ACTION:
|
|
|
|
gtk_tool_item_set_related_action (toolitem, g_value_get_object (value));
|
|
|
|
break;
|
|
|
|
case PROP_ACTIVATABLE_USE_ACTION_APPEARANCE:
|
|
|
|
gtk_tool_item_set_use_action_appearance (toolitem, g_value_get_boolean (value));
|
|
|
|
break;
|
2003-06-29 23:34:20 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2008-01-06 03:28:40 +00:00
|
|
|
break;
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkToolItem *toolitem = GTK_TOOL_ITEM (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_VISIBLE_HORIZONTAL:
|
2003-07-08 10:58:23 +00:00
|
|
|
g_value_set_boolean (value, toolitem->priv->visible_horizontal);
|
2003-06-29 23:34:20 +00:00
|
|
|
break;
|
|
|
|
case PROP_VISIBLE_VERTICAL:
|
2003-07-08 10:58:23 +00:00
|
|
|
g_value_set_boolean (value, toolitem->priv->visible_vertical);
|
2003-06-29 23:34:20 +00:00
|
|
|
break;
|
2003-08-04 21:13:55 +00:00
|
|
|
case PROP_IS_IMPORTANT:
|
|
|
|
g_value_set_boolean (value, toolitem->priv->is_important);
|
|
|
|
break;
|
2009-01-23 15:15:28 +00:00
|
|
|
case PROP_ACTIVATABLE_RELATED_ACTION:
|
|
|
|
g_value_set_object (value, toolitem->priv->action);
|
|
|
|
break;
|
|
|
|
case PROP_ACTIVATABLE_USE_ACTION_APPEARANCE:
|
|
|
|
g_value_set_boolean (value, toolitem->priv->use_action_appearance);
|
|
|
|
break;
|
2003-06-29 23:34:20 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2008-01-06 03:28:40 +00:00
|
|
|
break;
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-20 18:02:21 +00:00
|
|
|
static void
|
|
|
|
gtk_tool_item_property_notify (GObject *object,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkToolItem *tool_item = GTK_TOOL_ITEM (object);
|
|
|
|
|
|
|
|
if (tool_item->priv->menu_item && strcmp (pspec->name, "sensitive") == 0)
|
|
|
|
gtk_widget_set_sensitive (tool_item->priv->menu_item,
|
2010-03-01 04:58:37 +00:00
|
|
|
gtk_widget_get_sensitive (GTK_WIDGET (tool_item)));
|
2004-02-20 18:02:21 +00:00
|
|
|
}
|
|
|
|
|
2003-06-29 23:34:20 +00:00
|
|
|
static void
|
|
|
|
create_drag_window (GtkToolItem *toolitem)
|
|
|
|
{
|
2010-08-11 20:51:44 +00:00
|
|
|
GtkAllocation allocation;
|
2003-06-29 23:34:20 +00:00
|
|
|
GtkWidget *widget;
|
|
|
|
GdkWindowAttr attributes;
|
2010-10-27 13:53:46 +00:00
|
|
|
gint attributes_mask;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
g_return_if_fail (toolitem->priv->use_drag_window == TRUE);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
widget = GTK_WIDGET (toolitem);
|
2010-08-11 20:51:44 +00:00
|
|
|
|
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
attributes.window_type = GDK_WINDOW_CHILD;
|
2010-10-27 13:53:46 +00:00
|
|
|
attributes.x = allocation.x;
|
|
|
|
attributes.y = allocation.y;
|
|
|
|
attributes.width = allocation.width;
|
|
|
|
attributes.height = allocation.height;
|
2003-06-29 23:34:20 +00:00
|
|
|
attributes.wclass = GDK_INPUT_ONLY;
|
|
|
|
attributes.event_mask = gtk_widget_get_events (widget);
|
|
|
|
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
|
|
|
|
|
|
|
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
toolitem->priv->drag_window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
2003-06-29 23:34:20 +00:00
|
|
|
&attributes, attributes_mask);
|
2003-07-08 10:58:23 +00:00
|
|
|
gdk_window_set_user_data (toolitem->priv->drag_window, toolitem);
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_realize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkToolItem *toolitem;
|
2010-08-11 20:51:44 +00:00
|
|
|
GdkWindow *window;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
toolitem = GTK_TOOL_ITEM (widget);
|
2010-03-06 10:51:33 +00:00
|
|
|
gtk_widget_set_realized (widget, TRUE);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
window = gtk_widget_get_parent_window (widget);
|
|
|
|
gtk_widget_set_window (widget, window);
|
|
|
|
g_object_ref (window);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (toolitem->priv->use_drag_window)
|
2003-06-29 23:34:20 +00:00
|
|
|
create_drag_window(toolitem);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
destroy_drag_window (GtkToolItem *toolitem)
|
|
|
|
{
|
2003-07-08 10:58:23 +00:00
|
|
|
if (toolitem->priv->drag_window)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2003-07-08 10:58:23 +00:00
|
|
|
gdk_window_set_user_data (toolitem->priv->drag_window, NULL);
|
|
|
|
gdk_window_destroy (toolitem->priv->drag_window);
|
|
|
|
toolitem->priv->drag_window = NULL;
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_unrealize (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkToolItem *toolitem;
|
|
|
|
|
|
|
|
toolitem = GTK_TOOL_ITEM (widget);
|
|
|
|
|
|
|
|
destroy_drag_window (toolitem);
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->unrealize (widget);
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_map (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkToolItem *toolitem;
|
|
|
|
|
|
|
|
toolitem = GTK_TOOL_ITEM (widget);
|
2006-05-02 23:56:43 +00:00
|
|
|
GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->map (widget);
|
2003-07-08 10:58:23 +00:00
|
|
|
if (toolitem->priv->drag_window)
|
|
|
|
gdk_window_show (toolitem->priv->drag_window);
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_unmap (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GtkToolItem *toolitem;
|
|
|
|
|
|
|
|
toolitem = GTK_TOOL_ITEM (widget);
|
2003-07-08 10:58:23 +00:00
|
|
|
if (toolitem->priv->drag_window)
|
|
|
|
gdk_window_hide (toolitem->priv->drag_window);
|
2006-05-02 23:56:43 +00:00
|
|
|
GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->unmap (widget);
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-10-27 13:53:46 +00:00
|
|
|
gtk_tool_item_get_preferred_width (GtkWidget *widget,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2010-05-24 20:31:36 +00:00
|
|
|
GtkWidget *child;
|
2010-10-27 13:53:46 +00:00
|
|
|
|
|
|
|
*minimum = *natural = 0;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
2010-03-01 06:47:38 +00:00
|
|
|
if (child && gtk_widget_get_visible (child))
|
2010-10-27 13:53:46 +00:00
|
|
|
gtk_widget_get_preferred_width (child, minimum, natural);
|
|
|
|
}
|
2010-06-02 04:28:22 +00:00
|
|
|
|
2010-10-27 13:53:46 +00:00
|
|
|
static void
|
|
|
|
gtk_tool_item_get_preferred_height (GtkWidget *widget,
|
|
|
|
gint *minimum,
|
|
|
|
gint *natural)
|
|
|
|
{
|
|
|
|
GtkWidget *child;
|
|
|
|
|
|
|
|
*minimum = *natural = 0;
|
|
|
|
|
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
|
|
if (child && gtk_widget_get_visible (child))
|
|
|
|
gtk_widget_get_preferred_height (child, minimum, natural);
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation)
|
|
|
|
{
|
|
|
|
GtkToolItem *toolitem = GTK_TOOL_ITEM (widget);
|
|
|
|
GtkAllocation child_allocation;
|
2010-05-24 20:31:36 +00:00
|
|
|
GtkWidget *child;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
gtk_widget_set_allocation (widget, allocation);
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (toolitem->priv->drag_window)
|
|
|
|
gdk_window_move_resize (toolitem->priv->drag_window,
|
2010-10-27 13:53:46 +00:00
|
|
|
allocation->x,
|
|
|
|
allocation->y,
|
|
|
|
allocation->width,
|
|
|
|
allocation->height);
|
2010-08-11 20:51:44 +00:00
|
|
|
|
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
2010-03-01 06:47:38 +00:00
|
|
|
if (child && gtk_widget_get_visible (child))
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2010-10-27 13:53:46 +00:00
|
|
|
child_allocation.x = allocation->x;
|
|
|
|
child_allocation.y = allocation->y;
|
|
|
|
child_allocation.width = allocation->width;
|
|
|
|
child_allocation.height = allocation->height;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
gtk_widget_size_allocate (child, &child_allocation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-26 03:01:01 +00:00
|
|
|
gboolean
|
|
|
|
_gtk_tool_item_create_menu_proxy (GtkToolItem *item)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2009-01-23 15:15:28 +00:00
|
|
|
GtkWidget *menu_item;
|
|
|
|
gboolean visible_overflown;
|
|
|
|
|
|
|
|
if (item->priv->action)
|
|
|
|
{
|
|
|
|
g_object_get (item->priv->action, "visible-overflown", &visible_overflown, NULL);
|
|
|
|
|
|
|
|
if (visible_overflown)
|
|
|
|
{
|
|
|
|
menu_item = gtk_action_create_menu_item (item->priv->action);
|
|
|
|
|
|
|
|
g_object_ref_sink (menu_item);
|
|
|
|
gtk_tool_item_set_proxy_menu_item (item, "gtk-action-menu-item", menu_item);
|
|
|
|
g_object_unref (menu_item);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gtk_tool_item_set_proxy_menu_item (item, "gtk-action-menu-item", NULL);
|
2009-01-26 03:01:01 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2009-01-23 15:15:28 +00:00
|
|
|
}
|
|
|
|
|
2003-06-29 23:34:20 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-22 05:20:14 +00:00
|
|
|
static void
|
|
|
|
gtk_tool_item_activatable_interface_init (GtkActivatableIface *iface)
|
2009-01-23 15:15:28 +00:00
|
|
|
{
|
2009-02-22 05:20:14 +00:00
|
|
|
iface->update = gtk_tool_item_update;
|
|
|
|
iface->sync_action_properties = gtk_tool_item_sync_action_properties;
|
2009-01-23 15:15:28 +00:00
|
|
|
}
|
|
|
|
|
2009-02-22 05:20:14 +00:00
|
|
|
static void
|
|
|
|
gtk_tool_item_update (GtkActivatable *activatable,
|
|
|
|
GtkAction *action,
|
|
|
|
const gchar *property_name)
|
2009-01-23 15:15:28 +00:00
|
|
|
{
|
|
|
|
if (strcmp (property_name, "visible") == 0)
|
|
|
|
{
|
|
|
|
if (gtk_action_is_visible (action))
|
|
|
|
gtk_widget_show (GTK_WIDGET (activatable));
|
|
|
|
else
|
|
|
|
gtk_widget_hide (GTK_WIDGET (activatable));
|
|
|
|
}
|
|
|
|
else if (strcmp (property_name, "sensitive") == 0)
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action));
|
|
|
|
else if (strcmp (property_name, "tooltip") == 0)
|
|
|
|
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (activatable),
|
|
|
|
gtk_action_get_tooltip (action));
|
|
|
|
else if (strcmp (property_name, "visible-horizontal") == 0)
|
|
|
|
gtk_tool_item_set_visible_horizontal (GTK_TOOL_ITEM (activatable),
|
|
|
|
gtk_action_get_visible_horizontal (action));
|
|
|
|
else if (strcmp (property_name, "visible-vertical") == 0)
|
|
|
|
gtk_tool_item_set_visible_vertical (GTK_TOOL_ITEM (activatable),
|
|
|
|
gtk_action_get_visible_vertical (action));
|
|
|
|
else if (strcmp (property_name, "is-important") == 0)
|
|
|
|
gtk_tool_item_set_is_important (GTK_TOOL_ITEM (activatable),
|
|
|
|
gtk_action_get_is_important (action));
|
|
|
|
}
|
|
|
|
|
2009-02-22 05:20:14 +00:00
|
|
|
static void
|
|
|
|
gtk_tool_item_sync_action_properties (GtkActivatable *activatable,
|
|
|
|
GtkAction *action)
|
2009-01-23 15:15:28 +00:00
|
|
|
{
|
|
|
|
if (!action)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (gtk_action_is_visible (action))
|
|
|
|
gtk_widget_show (GTK_WIDGET (activatable));
|
|
|
|
else
|
|
|
|
gtk_widget_hide (GTK_WIDGET (activatable));
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action));
|
|
|
|
|
|
|
|
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (activatable),
|
|
|
|
gtk_action_get_tooltip (action));
|
|
|
|
gtk_tool_item_set_visible_horizontal (GTK_TOOL_ITEM (activatable),
|
|
|
|
gtk_action_get_visible_horizontal (action));
|
|
|
|
gtk_tool_item_set_visible_vertical (GTK_TOOL_ITEM (activatable),
|
|
|
|
gtk_action_get_visible_vertical (action));
|
|
|
|
gtk_tool_item_set_is_important (GTK_TOOL_ITEM (activatable),
|
|
|
|
gtk_action_get_is_important (action));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tool_item_set_related_action (GtkToolItem *item,
|
|
|
|
GtkAction *action)
|
|
|
|
{
|
|
|
|
if (item->priv->action == action)
|
|
|
|
return;
|
|
|
|
|
|
|
|
gtk_activatable_do_set_related_action (GTK_ACTIVATABLE (item), action);
|
|
|
|
|
|
|
|
item->priv->action = action;
|
|
|
|
|
|
|
|
if (action)
|
|
|
|
{
|
|
|
|
gtk_tool_item_rebuild_menu (item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-02-22 05:20:14 +00:00
|
|
|
gtk_tool_item_set_use_action_appearance (GtkToolItem *item,
|
2009-01-23 15:15:28 +00:00
|
|
|
gboolean use_appearance)
|
|
|
|
{
|
|
|
|
if (item->priv->use_action_appearance != use_appearance)
|
|
|
|
{
|
|
|
|
item->priv->use_action_appearance = use_appearance;
|
2009-02-22 05:20:14 +00:00
|
|
|
|
|
|
|
gtk_activatable_sync_action_properties (GTK_ACTIVATABLE (item), item->priv->action);
|
2009-01-23 15:15:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GtkToolItem
|
|
|
|
*
|
|
|
|
* Return value: the new #GtkToolItem
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
GtkToolItem *
|
|
|
|
gtk_tool_item_new (void)
|
|
|
|
{
|
|
|
|
GtkToolItem *item;
|
|
|
|
|
|
|
|
item = g_object_new (GTK_TYPE_TOOL_ITEM, NULL);
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2009-07-13 17:13:59 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_ellipsize_mode:
|
2009-11-29 01:59:56 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
|
|
|
*
|
2009-07-13 17:13:59 +00:00
|
|
|
* Returns the ellipsize mode used for @tool_item. Custom subclasses of
|
|
|
|
* #GtkToolItem should call this function to find out how text should
|
|
|
|
* be ellipsized.
|
2009-11-29 01:59:56 +00:00
|
|
|
*
|
2009-07-13 17:13:59 +00:00
|
|
|
* Return value: a #PangoEllipsizeMode indicating how text in @tool_item
|
|
|
|
* should be ellipsized.
|
2009-11-29 01:59:56 +00:00
|
|
|
*
|
|
|
|
* Since: 2.20
|
2009-07-13 17:13:59 +00:00
|
|
|
**/
|
|
|
|
PangoEllipsizeMode
|
|
|
|
gtk_tool_item_get_ellipsize_mode (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
2009-07-13 17:13:59 +00:00
|
|
|
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
|
|
|
return PANGO_ELLIPSIZE_NONE;
|
|
|
|
|
|
|
|
return gtk_tool_shell_get_ellipsize_mode (GTK_TOOL_SHELL (parent));
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_icon_size:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Returns the icon size used for @tool_item. Custom subclasses of
|
|
|
|
* #GtkToolItem should call this function to find out what size icons
|
|
|
|
* they should use.
|
|
|
|
*
|
2009-12-18 10:58:36 +00:00
|
|
|
* Return value: (type int): a #GtkIconSize indicating the icon size
|
|
|
|
* used for @tool_item
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
GtkIconSize
|
|
|
|
gtk_tool_item_get_icon_size (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ICON_SIZE_LARGE_TOOLBAR);
|
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
2007-12-14 10:57:46 +00:00
|
|
|
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
2003-06-29 23:34:20 +00:00
|
|
|
return GTK_ICON_SIZE_LARGE_TOOLBAR;
|
|
|
|
|
2007-12-14 10:57:46 +00:00
|
|
|
return gtk_tool_shell_get_icon_size (GTK_TOOL_SHELL (parent));
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_orientation:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Returns the orientation used for @tool_item. Custom subclasses of
|
|
|
|
* #GtkToolItem should call this function to find out what size icons
|
|
|
|
* they should use.
|
|
|
|
*
|
|
|
|
* Return value: a #GtkOrientation indicating the orientation
|
|
|
|
* used for @tool_item
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
GtkOrientation
|
|
|
|
gtk_tool_item_get_orientation (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
2007-12-14 10:57:46 +00:00
|
|
|
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
2003-06-29 23:34:20 +00:00
|
|
|
return GTK_ORIENTATION_HORIZONTAL;
|
|
|
|
|
2007-12-14 10:57:46 +00:00
|
|
|
return gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (parent));
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_toolbar_style:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Returns the toolbar style used for @tool_item. Custom subclasses of
|
|
|
|
* #GtkToolItem should call this function in the handler of the
|
|
|
|
* GtkToolItem::toolbar_reconfigured signal to find out in what style
|
|
|
|
* the toolbar is displayed and change themselves accordingly
|
|
|
|
*
|
|
|
|
* Possibilities are:
|
|
|
|
* <itemizedlist>
|
|
|
|
* <listitem> GTK_TOOLBAR_BOTH, meaning the tool item should show
|
|
|
|
* both an icon and a label, stacked vertically </listitem>
|
|
|
|
* <listitem> GTK_TOOLBAR_ICONS, meaning the toolbar shows
|
|
|
|
* only icons </listitem>
|
|
|
|
* <listitem> GTK_TOOLBAR_TEXT, meaning the tool item should only
|
|
|
|
* show text</listitem>
|
|
|
|
* <listitem> GTK_TOOLBAR_BOTH_HORIZ, meaning the tool item should show
|
|
|
|
* both an icon and a label, arranged horizontally (however, note the
|
|
|
|
* #GtkToolButton::has_text_horizontally that makes tool buttons not
|
|
|
|
* show labels when the toolbar style is GTK_TOOLBAR_BOTH_HORIZ.
|
|
|
|
* </listitem>
|
|
|
|
* </itemizedlist>
|
|
|
|
*
|
|
|
|
* Return value: A #GtkToolbarStyle indicating the toolbar style used
|
|
|
|
* for @tool_item.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
GtkToolbarStyle
|
|
|
|
gtk_tool_item_get_toolbar_style (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_TOOLBAR_ICONS);
|
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
2007-12-14 10:57:46 +00:00
|
|
|
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
2003-06-29 23:34:20 +00:00
|
|
|
return GTK_TOOLBAR_ICONS;
|
|
|
|
|
2007-12-14 10:57:46 +00:00
|
|
|
return gtk_tool_shell_get_style (GTK_TOOL_SHELL (parent));
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_relief_style:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Returns the relief style of @tool_item. See gtk_button_set_relief_style().
|
|
|
|
* Custom subclasses of #GtkToolItem should call this function in the handler
|
|
|
|
* of the #GtkToolItem::toolbar_reconfigured signal to find out the
|
|
|
|
* relief style of buttons.
|
|
|
|
*
|
|
|
|
* Return value: a #GtkReliefStyle indicating the relief style used
|
|
|
|
* for @tool_item.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
GtkReliefStyle
|
|
|
|
gtk_tool_item_get_relief_style (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_RELIEF_NONE);
|
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
2007-12-14 10:57:46 +00:00
|
|
|
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
2003-06-29 23:34:20 +00:00
|
|
|
return GTK_RELIEF_NONE;
|
|
|
|
|
2007-12-14 10:57:46 +00:00
|
|
|
return gtk_tool_shell_get_relief_style (GTK_TOOL_SHELL (parent));
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
2009-07-13 17:13:59 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_text_alignment:
|
|
|
|
* @tool_item: a #GtkToolItem:
|
|
|
|
*
|
|
|
|
* Returns the text alignment used for @tool_item. Custom subclasses of
|
|
|
|
* #GtkToolItem should call this function to find out how text should
|
|
|
|
* be aligned.
|
|
|
|
*
|
|
|
|
* Return value: a #gfloat indicating the horizontal text alignment
|
|
|
|
* used for @tool_item
|
|
|
|
*
|
2009-11-29 01:59:56 +00:00
|
|
|
* Since: 2.20
|
2009-07-13 17:13:59 +00:00
|
|
|
**/
|
|
|
|
gfloat
|
|
|
|
gtk_tool_item_get_text_alignment (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
2009-07-13 17:13:59 +00:00
|
|
|
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
|
|
|
return 0.5;
|
|
|
|
|
|
|
|
return gtk_tool_shell_get_text_alignment (GTK_TOOL_SHELL (parent));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_text_orientation:
|
2009-11-29 01:59:56 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
|
|
|
*
|
2009-07-13 17:13:59 +00:00
|
|
|
* Returns the text orientation used for @tool_item. Custom subclasses of
|
|
|
|
* #GtkToolItem should call this function to find out how text should
|
|
|
|
* be orientated.
|
2009-11-29 01:59:56 +00:00
|
|
|
*
|
2009-07-13 17:13:59 +00:00
|
|
|
* Return value: a #GtkOrientation indicating the text orientation
|
|
|
|
* used for @tool_item
|
2009-11-29 01:59:56 +00:00
|
|
|
*
|
|
|
|
* Since: 2.20
|
|
|
|
*/
|
2009-07-13 17:13:59 +00:00
|
|
|
GtkOrientation
|
|
|
|
gtk_tool_item_get_text_orientation (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
2009-07-13 17:13:59 +00:00
|
|
|
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
|
|
|
return GTK_ORIENTATION_HORIZONTAL;
|
|
|
|
|
|
|
|
return gtk_tool_shell_get_text_orientation (GTK_TOOL_SHELL (parent));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_text_size_group:
|
2009-11-29 01:59:56 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
* Returns the size group used for labels in @tool_item.
|
|
|
|
* Custom subclasses of #GtkToolItem should call this function
|
|
|
|
* and use the size group for labels.
|
2009-11-29 01:59:56 +00:00
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
* Return value: (transfer none): a #GtkSizeGroup
|
2009-11-29 01:59:56 +00:00
|
|
|
*
|
|
|
|
* Since: 2.20
|
|
|
|
*/
|
2009-07-13 17:13:59 +00:00
|
|
|
GtkSizeGroup *
|
|
|
|
gtk_tool_item_get_text_size_group (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
GtkWidget *parent;
|
|
|
|
|
2009-12-14 01:32:46 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), NULL);
|
2009-07-13 17:13:59 +00:00
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
2009-07-13 17:13:59 +00:00
|
|
|
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return gtk_tool_shell_get_text_size_group (GTK_TOOL_SHELL (parent));
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_set_expand:
|
2009-11-29 01:59:56 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
* @expand: Whether @tool_item is allocated extra space
|
2009-11-29 01:59:56 +00:00
|
|
|
*
|
2003-08-04 21:13:55 +00:00
|
|
|
* Sets whether @tool_item is allocated extra space when there
|
|
|
|
* is more room on the toolbar then needed for the items. The
|
|
|
|
* effect is that the item gets bigger when the toolbar gets bigger
|
|
|
|
* and smaller when the toolbar gets smaller.
|
2009-11-29 01:59:56 +00:00
|
|
|
*
|
2003-08-04 21:13:55 +00:00
|
|
|
* Since: 2.4
|
2009-11-29 01:59:56 +00:00
|
|
|
*/
|
2003-06-29 23:34:20 +00:00
|
|
|
void
|
|
|
|
gtk_tool_item_set_expand (GtkToolItem *tool_item,
|
|
|
|
gboolean expand)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
|
|
|
|
|
|
|
expand = expand != FALSE;
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (tool_item->priv->expand != expand)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2003-07-08 10:58:23 +00:00
|
|
|
tool_item->priv->expand = expand;
|
2003-06-29 23:34:20 +00:00
|
|
|
gtk_widget_child_notify (GTK_WIDGET (tool_item), "expand");
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_expand:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Returns whether @tool_item is allocated extra space.
|
|
|
|
* See gtk_tool_item_set_expand().
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if @tool_item is allocated extra space.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-07-08 10:58:23 +00:00
|
|
|
gboolean
|
|
|
|
gtk_tool_item_get_expand (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), FALSE);
|
|
|
|
|
|
|
|
return tool_item->priv->expand;
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_set_homogeneous:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
* @homogeneous: whether @tool_item is the same size as other homogeneous items
|
|
|
|
*
|
|
|
|
* Sets whether @tool_item is to be allocated the same size as other
|
|
|
|
* homogeneous items. The effect is that all homogeneous items will have
|
|
|
|
* the same width as the widest of the items.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
void
|
|
|
|
gtk_tool_item_set_homogeneous (GtkToolItem *tool_item,
|
|
|
|
gboolean homogeneous)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
|
|
|
|
|
|
|
homogeneous = homogeneous != FALSE;
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (tool_item->priv->homogeneous != homogeneous)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2003-07-08 10:58:23 +00:00
|
|
|
tool_item->priv->homogeneous = homogeneous;
|
2003-06-29 23:34:20 +00:00
|
|
|
gtk_widget_child_notify (GTK_WIDGET (tool_item), "homogeneous");
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_homogeneous:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Returns whether @tool_item is the same size as other homogeneous
|
|
|
|
* items. See gtk_tool_item_set_homogeneous().
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the item is the same size as other homogeneous
|
2008-11-22 14:26:00 +00:00
|
|
|
* items.
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-07-08 10:58:23 +00:00
|
|
|
gboolean
|
|
|
|
gtk_tool_item_get_homogeneous (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), FALSE);
|
|
|
|
|
|
|
|
return tool_item->priv->homogeneous;
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_is_important:
|
|
|
|
* @tool_item: a #GtkToolItem
|
|
|
|
*
|
|
|
|
* Returns whether @tool_item is considered important. See
|
2003-08-31 14:01:07 +00:00
|
|
|
* gtk_tool_item_set_is_important()
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Return value: %TRUE if @tool_item is considered important.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gtk_tool_item_get_is_important (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), FALSE);
|
|
|
|
|
|
|
|
return tool_item->priv->is_important;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tool_item_set_is_important:
|
|
|
|
* @tool_item: a #GtkToolItem
|
2003-09-30 22:48:10 +00:00
|
|
|
* @is_important: whether the tool item should be considered important
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Sets whether @tool_item should be considered important. The #GtkToolButton
|
|
|
|
* class uses this property to determine whether to show or hide its label
|
|
|
|
* when the toolbar style is %GTK_TOOLBAR_BOTH_HORIZ. The result is that
|
2003-08-31 14:01:07 +00:00
|
|
|
* only tool buttons with the "is_important" property set have labels, an
|
2003-08-04 21:13:55 +00:00
|
|
|
* effect known as "priority text"
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tool_item_set_is_important (GtkToolItem *tool_item, gboolean is_important)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
|
|
|
|
|
|
|
is_important = is_important != FALSE;
|
|
|
|
|
|
|
|
if (is_important != tool_item->priv->is_important)
|
|
|
|
{
|
|
|
|
tool_item->priv->is_important = is_important;
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
|
|
|
|
|
2005-03-26 05:49:15 +00:00
|
|
|
g_object_notify (G_OBJECT (tool_item), "is-important");
|
2003-08-04 21:13:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Replace non-deprecated API using old tooltips API, deprecate old tooltips
2007-07-09 Kristian Rietveld <kris@imendio.com>
Replace non-deprecated API using old tooltips API, deprecate
old tooltips API for real. (#451575).
* gtk/gtk.symbols: updated.
* gtk/gtkwidget.c (gtk_widget_real_show_help): don't call
_gtk_tooltips_toggle_keyboard_mode() anymore.
* gtk/gtkmenutoolbutton.[ch] (gtk_menu_tool_button_set_arrow_tooltip):
deprecated,
(gtk_menu_tool_button_set_arrow_tooltip_{text,markup}): replacements.
* gtk/gtktoolitem.[ch] (gtk_tool_item_real_set_tooltip): use
new API,
(gtk_tool_item_set_tooltip): deprecated,
(gtk_tool_item_set_tooltip_{text,markup): replacements.
(GtkToolItemClass:set_tooltip): deprecated.
* gtk/gtktooltips.[ch]: strip out all unused parts, made
gtk_tooltips_set_tip() call gtk_widget_set_tooltip_text(),
deprecate all of gtk_tooltips_*.
* gtk/gtktoolbar.[ch] (gtk_toolbar_get_tooltips): always return
TRUE,
(GtkToolbar:tooltips): deprecated, renamed.
* gtk/gtkaction.c (gtk_action_sync_tooltip): use new API to
set the tooltip text.
* tests/autotestfilechooser.c: #undef GTK_DISABLE_DEPRECATED for now,
will be removed GtkFileChooserDefault has been converted.
svn path=/trunk/; revision=18418
2007-07-09 19:23:18 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_set_tooltip_text:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
Replace non-deprecated API using old tooltips API, deprecate old tooltips
2007-07-09 Kristian Rietveld <kris@imendio.com>
Replace non-deprecated API using old tooltips API, deprecate
old tooltips API for real. (#451575).
* gtk/gtk.symbols: updated.
* gtk/gtkwidget.c (gtk_widget_real_show_help): don't call
_gtk_tooltips_toggle_keyboard_mode() anymore.
* gtk/gtkmenutoolbutton.[ch] (gtk_menu_tool_button_set_arrow_tooltip):
deprecated,
(gtk_menu_tool_button_set_arrow_tooltip_{text,markup}): replacements.
* gtk/gtktoolitem.[ch] (gtk_tool_item_real_set_tooltip): use
new API,
(gtk_tool_item_set_tooltip): deprecated,
(gtk_tool_item_set_tooltip_{text,markup): replacements.
(GtkToolItemClass:set_tooltip): deprecated.
* gtk/gtktooltips.[ch]: strip out all unused parts, made
gtk_tooltips_set_tip() call gtk_widget_set_tooltip_text(),
deprecate all of gtk_tooltips_*.
* gtk/gtktoolbar.[ch] (gtk_toolbar_get_tooltips): always return
TRUE,
(GtkToolbar:tooltips): deprecated, renamed.
* gtk/gtkaction.c (gtk_action_sync_tooltip): use new API to
set the tooltip text.
* tests/autotestfilechooser.c: #undef GTK_DISABLE_DEPRECATED for now,
will be removed GtkFileChooserDefault has been converted.
svn path=/trunk/; revision=18418
2007-07-09 19:23:18 +00:00
|
|
|
* @text: text to be used as tooltip for @tool_item
|
|
|
|
*
|
|
|
|
* Sets the text to be displayed as tooltip on the item.
|
|
|
|
* See gtk_widget_set_tooltip_text().
|
|
|
|
*
|
|
|
|
* Since: 2.12
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tool_item_set_tooltip_text (GtkToolItem *tool_item,
|
|
|
|
const gchar *text)
|
|
|
|
{
|
|
|
|
GtkWidget *child;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (tool_item));
|
Replace non-deprecated API using old tooltips API, deprecate old tooltips
2007-07-09 Kristian Rietveld <kris@imendio.com>
Replace non-deprecated API using old tooltips API, deprecate
old tooltips API for real. (#451575).
* gtk/gtk.symbols: updated.
* gtk/gtkwidget.c (gtk_widget_real_show_help): don't call
_gtk_tooltips_toggle_keyboard_mode() anymore.
* gtk/gtkmenutoolbutton.[ch] (gtk_menu_tool_button_set_arrow_tooltip):
deprecated,
(gtk_menu_tool_button_set_arrow_tooltip_{text,markup}): replacements.
* gtk/gtktoolitem.[ch] (gtk_tool_item_real_set_tooltip): use
new API,
(gtk_tool_item_set_tooltip): deprecated,
(gtk_tool_item_set_tooltip_{text,markup): replacements.
(GtkToolItemClass:set_tooltip): deprecated.
* gtk/gtktooltips.[ch]: strip out all unused parts, made
gtk_tooltips_set_tip() call gtk_widget_set_tooltip_text(),
deprecate all of gtk_tooltips_*.
* gtk/gtktoolbar.[ch] (gtk_toolbar_get_tooltips): always return
TRUE,
(GtkToolbar:tooltips): deprecated, renamed.
* gtk/gtkaction.c (gtk_action_sync_tooltip): use new API to
set the tooltip text.
* tests/autotestfilechooser.c: #undef GTK_DISABLE_DEPRECATED for now,
will be removed GtkFileChooserDefault has been converted.
svn path=/trunk/; revision=18418
2007-07-09 19:23:18 +00:00
|
|
|
if (child)
|
|
|
|
gtk_widget_set_tooltip_text (child, text);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gtk_tool_item_set_tooltip_markup:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
Replace non-deprecated API using old tooltips API, deprecate old tooltips
2007-07-09 Kristian Rietveld <kris@imendio.com>
Replace non-deprecated API using old tooltips API, deprecate
old tooltips API for real. (#451575).
* gtk/gtk.symbols: updated.
* gtk/gtkwidget.c (gtk_widget_real_show_help): don't call
_gtk_tooltips_toggle_keyboard_mode() anymore.
* gtk/gtkmenutoolbutton.[ch] (gtk_menu_tool_button_set_arrow_tooltip):
deprecated,
(gtk_menu_tool_button_set_arrow_tooltip_{text,markup}): replacements.
* gtk/gtktoolitem.[ch] (gtk_tool_item_real_set_tooltip): use
new API,
(gtk_tool_item_set_tooltip): deprecated,
(gtk_tool_item_set_tooltip_{text,markup): replacements.
(GtkToolItemClass:set_tooltip): deprecated.
* gtk/gtktooltips.[ch]: strip out all unused parts, made
gtk_tooltips_set_tip() call gtk_widget_set_tooltip_text(),
deprecate all of gtk_tooltips_*.
* gtk/gtktoolbar.[ch] (gtk_toolbar_get_tooltips): always return
TRUE,
(GtkToolbar:tooltips): deprecated, renamed.
* gtk/gtkaction.c (gtk_action_sync_tooltip): use new API to
set the tooltip text.
* tests/autotestfilechooser.c: #undef GTK_DISABLE_DEPRECATED for now,
will be removed GtkFileChooserDefault has been converted.
svn path=/trunk/; revision=18418
2007-07-09 19:23:18 +00:00
|
|
|
* @markup: markup text to be used as tooltip for @tool_item
|
|
|
|
*
|
|
|
|
* Sets the markup text to be displayed as tooltip on the item.
|
|
|
|
* See gtk_widget_set_tooltip_markup().
|
|
|
|
*
|
|
|
|
* Since: 2.12
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tool_item_set_tooltip_markup (GtkToolItem *tool_item,
|
|
|
|
const gchar *markup)
|
|
|
|
{
|
|
|
|
GtkWidget *child;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
|
|
|
|
2010-05-24 20:31:36 +00:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (tool_item));
|
Replace non-deprecated API using old tooltips API, deprecate old tooltips
2007-07-09 Kristian Rietveld <kris@imendio.com>
Replace non-deprecated API using old tooltips API, deprecate
old tooltips API for real. (#451575).
* gtk/gtk.symbols: updated.
* gtk/gtkwidget.c (gtk_widget_real_show_help): don't call
_gtk_tooltips_toggle_keyboard_mode() anymore.
* gtk/gtkmenutoolbutton.[ch] (gtk_menu_tool_button_set_arrow_tooltip):
deprecated,
(gtk_menu_tool_button_set_arrow_tooltip_{text,markup}): replacements.
* gtk/gtktoolitem.[ch] (gtk_tool_item_real_set_tooltip): use
new API,
(gtk_tool_item_set_tooltip): deprecated,
(gtk_tool_item_set_tooltip_{text,markup): replacements.
(GtkToolItemClass:set_tooltip): deprecated.
* gtk/gtktooltips.[ch]: strip out all unused parts, made
gtk_tooltips_set_tip() call gtk_widget_set_tooltip_text(),
deprecate all of gtk_tooltips_*.
* gtk/gtktoolbar.[ch] (gtk_toolbar_get_tooltips): always return
TRUE,
(GtkToolbar:tooltips): deprecated, renamed.
* gtk/gtkaction.c (gtk_action_sync_tooltip): use new API to
set the tooltip text.
* tests/autotestfilechooser.c: #undef GTK_DISABLE_DEPRECATED for now,
will be removed GtkFileChooserDefault has been converted.
svn path=/trunk/; revision=18418
2007-07-09 19:23:18 +00:00
|
|
|
if (child)
|
|
|
|
gtk_widget_set_tooltip_markup (child, markup);
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_set_use_drag_window:
|
2007-07-12 01:13:42 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
|
|
|
* @use_drag_window: Whether @tool_item has a drag window.
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
2007-07-12 01:13:42 +00:00
|
|
|
* Sets whether @tool_item has a drag window. When %TRUE the
|
2003-08-04 21:13:55 +00:00
|
|
|
* toolitem can be used as a drag source through gtk_drag_source_set().
|
2007-07-12 01:13:42 +00:00
|
|
|
* When @tool_item has a drag window it will intercept all events,
|
|
|
|
* even those that would otherwise be sent to a child of @tool_item.
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
void
|
|
|
|
gtk_tool_item_set_use_drag_window (GtkToolItem *toolitem,
|
|
|
|
gboolean use_drag_window)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (toolitem));
|
|
|
|
|
|
|
|
use_drag_window = use_drag_window != FALSE;
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (toolitem->priv->use_drag_window != use_drag_window)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2003-07-08 10:58:23 +00:00
|
|
|
toolitem->priv->use_drag_window = use_drag_window;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
if (use_drag_window)
|
|
|
|
{
|
2010-03-02 06:16:02 +00:00
|
|
|
if (!toolitem->priv->drag_window &&
|
|
|
|
gtk_widget_get_realized (GTK_WIDGET (toolitem)))
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
|
|
|
create_drag_window(toolitem);
|
2010-03-02 04:19:28 +00:00
|
|
|
if (gtk_widget_get_mapped (GTK_WIDGET (toolitem)))
|
2003-07-08 10:58:23 +00:00
|
|
|
gdk_window_show (toolitem->priv->drag_window);
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
destroy_drag_window (toolitem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_use_drag_window:
|
2007-07-12 01:13:42 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
2007-07-12 01:13:42 +00:00
|
|
|
* Returns whether @tool_item has a drag window. See
|
2003-08-04 21:13:55 +00:00
|
|
|
* gtk_tool_item_set_use_drag_window().
|
|
|
|
*
|
2007-07-12 01:13:42 +00:00
|
|
|
* Return value: %TRUE if @tool_item uses a drag window.
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-07-08 10:58:23 +00:00
|
|
|
gboolean
|
|
|
|
gtk_tool_item_get_use_drag_window (GtkToolItem *toolitem)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (toolitem), FALSE);
|
|
|
|
|
|
|
|
return toolitem->priv->use_drag_window;
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_set_visible_horizontal:
|
2007-07-12 01:13:42 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
|
|
|
* @visible_horizontal: Whether @tool_item is visible when in horizontal mode
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
2007-07-12 01:13:42 +00:00
|
|
|
* Sets whether @tool_item is visible when the toolbar is docked horizontally.
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
void
|
|
|
|
gtk_tool_item_set_visible_horizontal (GtkToolItem *toolitem,
|
|
|
|
gboolean visible_horizontal)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (toolitem));
|
|
|
|
|
|
|
|
visible_horizontal = visible_horizontal != FALSE;
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (toolitem->priv->visible_horizontal != visible_horizontal)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2003-07-08 10:58:23 +00:00
|
|
|
toolitem->priv->visible_horizontal = visible_horizontal;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2005-03-26 05:49:15 +00:00
|
|
|
g_object_notify (G_OBJECT (toolitem), "visible-horizontal");
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (toolitem));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_visible_horizontal:
|
2007-07-12 01:13:42 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
2007-07-12 01:13:42 +00:00
|
|
|
* Returns whether the @tool_item is visible on toolbars that are
|
2003-08-31 14:01:07 +00:00
|
|
|
* docked horizontally.
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
2007-07-12 01:13:42 +00:00
|
|
|
* Return value: %TRUE if @tool_item is visible on toolbars that are
|
2003-08-04 21:13:55 +00:00
|
|
|
* docked horizontally.
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
gboolean
|
|
|
|
gtk_tool_item_get_visible_horizontal (GtkToolItem *toolitem)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (toolitem), FALSE);
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
return toolitem->priv->visible_horizontal;
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_set_visible_vertical:
|
2007-07-12 01:13:42 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
|
|
|
* @visible_vertical: whether @tool_item is visible when the toolbar
|
2003-08-04 21:13:55 +00:00
|
|
|
* is in vertical mode
|
|
|
|
*
|
2007-07-12 01:13:42 +00:00
|
|
|
* Sets whether @tool_item is visible when the toolbar is docked
|
2003-08-04 21:13:55 +00:00
|
|
|
* vertically. Some tool items, such as text entries, are too wide to be
|
|
|
|
* useful on a vertically docked toolbar. If @visible_vertical is %FALSE
|
2007-07-12 01:13:42 +00:00
|
|
|
* @tool_item will not appear on toolbars that are docked vertically.
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
void
|
|
|
|
gtk_tool_item_set_visible_vertical (GtkToolItem *toolitem,
|
|
|
|
gboolean visible_vertical)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (toolitem));
|
|
|
|
|
|
|
|
visible_vertical = visible_vertical != FALSE;
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (toolitem->priv->visible_vertical != visible_vertical)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2003-07-08 10:58:23 +00:00
|
|
|
toolitem->priv->visible_vertical = visible_vertical;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2005-03-26 05:49:15 +00:00
|
|
|
g_object_notify (G_OBJECT (toolitem), "visible-vertical");
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (toolitem));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_visible_vertical:
|
2007-07-12 01:13:42 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
2007-07-12 01:13:42 +00:00
|
|
|
* Returns whether @tool_item is visible when the toolbar is docked vertically.
|
2003-08-04 21:13:55 +00:00
|
|
|
* See gtk_tool_item_set_visible_vertical().
|
|
|
|
*
|
2007-07-12 01:13:42 +00:00
|
|
|
* Return value: Whether @tool_item is visible when the toolbar is docked vertically
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
gboolean
|
|
|
|
gtk_tool_item_get_visible_vertical (GtkToolItem *toolitem)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (toolitem), FALSE);
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
return toolitem->priv->visible_vertical;
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_retrieve_proxy_menu_item:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
*
|
|
|
|
* Returns the #GtkMenuItem that was last set by
|
|
|
|
* gtk_tool_item_set_proxy_menu_item(), ie. the #GtkMenuItem
|
|
|
|
* that is going to appear in the overflow menu.
|
2009-12-10 10:23:40 +00:00
|
|
|
*
|
|
|
|
* Return value: (transfer none): The #GtkMenuItem that is going to appear in the
|
2003-08-04 21:13:55 +00:00
|
|
|
* overflow menu for @tool_item.
|
2009-12-10 10:23:40 +00:00
|
|
|
*
|
2003-08-04 21:13:55 +00:00
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
GtkWidget *
|
|
|
|
gtk_tool_item_retrieve_proxy_menu_item (GtkToolItem *tool_item)
|
|
|
|
{
|
|
|
|
gboolean retval;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), NULL);
|
|
|
|
|
2004-09-14 21:40:41 +00:00
|
|
|
g_signal_emit (tool_item, toolitem_signals[CREATE_MENU_PROXY], 0,
|
|
|
|
&retval);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
return tool_item->priv->menu_item;
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_get_proxy_menu_item:
|
2010-09-21 04:18:11 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
* @menu_item_id: a string used to identify the menu item
|
2010-09-21 04:18:11 +00:00
|
|
|
*
|
2003-08-04 21:13:55 +00:00
|
|
|
* If @menu_item_id matches the string passed to
|
|
|
|
* gtk_tool_item_set_proxy_menu_item() return the corresponding #GtkMenuItem.
|
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
* Custom subclasses of #GtkToolItem should use this function to
|
|
|
|
* update their menu item when the #GtkToolItem changes. That the
|
|
|
|
* @menu_item_id<!-- -->s must match ensures that a #GtkToolItem
|
|
|
|
* will not inadvertently change a menu item that they did not create.
|
|
|
|
*
|
|
|
|
* Return value: (transfer none): The #GtkMenuItem passed to
|
|
|
|
* gtk_tool_item_set_proxy_menu_item(), if the @menu_item_id<!-- -->s
|
|
|
|
* match.
|
|
|
|
*
|
2003-08-04 21:13:55 +00:00
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
GtkWidget *
|
|
|
|
gtk_tool_item_get_proxy_menu_item (GtkToolItem *tool_item,
|
|
|
|
const gchar *menu_item_id)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), NULL);
|
|
|
|
g_return_val_if_fail (menu_item_id != NULL, NULL);
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (tool_item->priv->menu_item_id && strcmp (tool_item->priv->menu_item_id, menu_item_id) == 0)
|
|
|
|
return tool_item->priv->menu_item;
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-09-14 21:40:41 +00:00
|
|
|
/**
|
2009-11-27 05:37:03 +00:00
|
|
|
* gtk_tool_item_rebuild_menu:
|
2004-09-14 21:40:41 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2009-11-27 05:37:03 +00:00
|
|
|
*
|
2004-09-14 21:40:41 +00:00
|
|
|
* Calling this function signals to the toolbar that the
|
|
|
|
* overflow menu item for @tool_item has changed. If the
|
|
|
|
* overflow menu is visible when this function it called,
|
|
|
|
* the menu will be rebuilt.
|
|
|
|
*
|
2009-11-27 05:37:03 +00:00
|
|
|
* The function must be called when the tool item changes what it
|
|
|
|
* will do in response to the #GtkToolItem::create-menu-proxy signal.
|
|
|
|
*
|
2004-09-14 21:40:41 +00:00
|
|
|
* Since: 2.6
|
2009-11-27 05:37:03 +00:00
|
|
|
*/
|
2004-09-14 21:40:41 +00:00
|
|
|
void
|
|
|
|
gtk_tool_item_rebuild_menu (GtkToolItem *tool_item)
|
|
|
|
{
|
2010-08-11 20:51:44 +00:00
|
|
|
GtkWidget *parent;
|
2004-09-14 21:40:41 +00:00
|
|
|
GtkWidget *widget;
|
2010-08-11 20:51:44 +00:00
|
|
|
|
2004-09-14 21:40:41 +00:00
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
|
|
|
|
|
|
|
widget = GTK_WIDGET (tool_item);
|
2008-02-06 09:53:34 +00:00
|
|
|
|
2010-08-11 20:51:44 +00:00
|
|
|
parent = gtk_widget_get_parent (widget);
|
|
|
|
if (GTK_IS_TOOL_SHELL (parent))
|
|
|
|
gtk_tool_shell_rebuild_menu (GTK_TOOL_SHELL (parent));
|
2004-09-14 21:40:41 +00:00
|
|
|
}
|
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
|
|
|
* gtk_tool_item_set_proxy_menu_item:
|
2008-11-22 14:26:00 +00:00
|
|
|
* @tool_item: a #GtkToolItem
|
2003-08-04 21:13:55 +00:00
|
|
|
* @menu_item_id: a string used to identify @menu_item
|
|
|
|
* @menu_item: a #GtkMenuItem to be used in the overflow menu
|
|
|
|
*
|
|
|
|
* Sets the #GtkMenuItem used in the toolbar overflow menu. The
|
|
|
|
* @menu_item_id is used to identify the caller of this function and
|
|
|
|
* should also be used with gtk_tool_item_get_proxy_menu_item().
|
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
2003-06-29 23:34:20 +00:00
|
|
|
void
|
|
|
|
gtk_tool_item_set_proxy_menu_item (GtkToolItem *tool_item,
|
|
|
|
const gchar *menu_item_id,
|
|
|
|
GtkWidget *menu_item)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
|
|
|
g_return_if_fail (menu_item == NULL || GTK_IS_MENU_ITEM (menu_item));
|
|
|
|
g_return_if_fail (menu_item_id != NULL);
|
|
|
|
|
2007-03-09 21:57:37 +00:00
|
|
|
g_free (tool_item->priv->menu_item_id);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
tool_item->priv->menu_item_id = g_strdup (menu_item_id);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
if (tool_item->priv->menu_item != menu_item)
|
2003-06-29 23:34:20 +00:00
|
|
|
{
|
2003-07-08 10:58:23 +00:00
|
|
|
if (tool_item->priv->menu_item)
|
2004-11-19 23:18:38 +00:00
|
|
|
g_object_unref (tool_item->priv->menu_item);
|
2003-06-29 23:34:20 +00:00
|
|
|
|
|
|
|
if (menu_item)
|
|
|
|
{
|
2005-11-23 18:06:58 +00:00
|
|
|
g_object_ref_sink (menu_item);
|
2004-02-20 18:02:21 +00:00
|
|
|
|
|
|
|
gtk_widget_set_sensitive (menu_item,
|
2010-03-01 04:58:37 +00:00
|
|
|
gtk_widget_get_sensitive (GTK_WIDGET (tool_item)));
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
|
2003-07-08 10:58:23 +00:00
|
|
|
tool_item->priv->menu_item = menu_item;
|
2003-06-29 23:34:20 +00:00
|
|
|
}
|
|
|
|
}
|
2003-07-08 10:58:23 +00:00
|
|
|
|
2003-08-04 21:13:55 +00:00
|
|
|
/**
|
2008-01-13 23:41:46 +00:00
|
|
|
* gtk_tool_item_toolbar_reconfigured:
|
|
|
|
* @tool_item: a #GtkToolItem
|
|
|
|
*
|
|
|
|
* Emits the signal #GtkToolItem::toolbar_reconfigured on @tool_item.
|
|
|
|
* #GtkToolbar and other #GtkToolShell implementations use this function
|
|
|
|
* to notify children, when some aspect of their configuration changes.
|
|
|
|
*
|
2008-02-15 23:42:42 +00:00
|
|
|
* Since: 2.14
|
2003-08-04 21:13:55 +00:00
|
|
|
**/
|
2003-07-30 20:14:54 +00:00
|
|
|
void
|
2008-01-13 23:41:46 +00:00
|
|
|
gtk_tool_item_toolbar_reconfigured (GtkToolItem *tool_item)
|
2003-07-08 10:58:23 +00:00
|
|
|
{
|
2008-01-14 00:12:53 +00:00
|
|
|
/* The slightely inaccurate name "gtk_tool_item_toolbar_reconfigured" was
|
|
|
|
* choosen over "gtk_tool_item_tool_shell_reconfigured", since the function
|
|
|
|
* emits the "toolbar-reconfigured" signal, not "tool-shell-reconfigured".
|
|
|
|
* Its not possible to rename the signal, and emitting another name than
|
|
|
|
* indicated by the function name would be quite confusing. That's the
|
|
|
|
* price of providing stable APIs.
|
|
|
|
*/
|
2003-07-30 20:14:54 +00:00
|
|
|
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
|
|
|
|
|
|
|
|
g_signal_emit (tool_item, toolitem_signals[TOOLBAR_RECONFIGURED], 0);
|
|
|
|
|
2005-11-07 16:31:48 +00:00
|
|
|
if (tool_item->priv->drag_window)
|
|
|
|
gdk_window_raise (tool_item->priv->drag_window);
|
2005-11-07 16:38:06 +00:00
|
|
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (tool_item));
|
2003-07-08 10:58:23 +00:00
|
|
|
}
|