-/* GTK - The GTK+ Toolkit
+/* GTK - The GIMP Toolkit
*
* Copyright (C) 2003 Ricardo Fernandez Pascual
* Copyright (C) 2004 Paolo Borelli
GtkMenuToolButton *button = GTK_MENU_TOOL_BUTTON (widget);
GtkMenuToolButtonPrivate *priv = button->priv;
- if (!GTK_WIDGET_IS_SENSITIVE (widget) && priv->menu)
+ if (!gtk_widget_is_sensitive (widget) && priv->menu)
{
gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->menu));
}
widget_class->state_changed = gtk_menu_tool_button_state_changed;
toolitem_class->toolbar_reconfigured = gtk_menu_tool_button_toolbar_reconfigured;
+ /**
+ * GtkMenuToolButton::show-menu:
+ * @button: the object on which the signal is emitted
+ *
+ * The ::show-menu signal is emitted before the menu is shown.
+ *
+ * It can be used to populate the menu on demand, using
+ * gtk_menu_tool_button_get_menu().
+
+ * Note that even if you populate the menu dynamically in this way,
+ * you must set an empty menu on the #GtkMenuToolButton beforehand,
+ * since the arrow is made insensitive if the menu is not set.
+ */
signals[SHOW_MENU] =
g_signal_new (I_("show-menu"),
G_OBJECT_CLASS_TYPE (klass),
return;
if (gtk_toggle_button_get_active (togglebutton) &&
- !GTK_WIDGET_VISIBLE (priv->menu))
+ !gtk_widget_get_visible (GTK_WIDGET (priv->menu)))
{
/* we get here only when the menu is activated by a key
* press, so that we can select the first menu item */
g_signal_connect (arrow_button, "toggled",
G_CALLBACK (arrow_button_toggled_cb), button);
- g_signal_connect (arrow_button, "button_press_event",
+ g_signal_connect (arrow_button, "button-press-event",
G_CALLBACK (arrow_button_button_press_event_cb), button);
}
arrow_button_button_press_event_cb,
button);
}
-
- if (GTK_OBJECT_CLASS (gtk_menu_tool_button_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (gtk_menu_tool_button_parent_class)->destroy) (object);
+
+ GTK_OBJECT_CLASS (gtk_menu_tool_button_parent_class)->destroy (object);
}
/**
* gtk_menu_tool_button_new:
- * @icon_widget: a widget that will be used as icon widget, or %NULL
- * @label: a string that will be used as label, or %NULL
+ * @icon_widget: (allow-none): a widget that will be used as icon widget, or %NULL
+ * @label: (allow-none): a string that will be used as label, or %NULL
*
* Creates a new #GtkMenuToolButton using @icon_widget as icon and
* @label as label.
if (priv->menu != GTK_MENU (menu))
{
- if (priv->menu && GTK_WIDGET_VISIBLE (priv->menu))
+ if (priv->menu && gtk_widget_get_visible (GTK_WIDGET (priv->menu)))
gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->menu));
if (priv->menu)
* gtk_menu_tool_button_set_arrow_tooltip:
* @button: a #GtkMenuToolButton
* @tooltips: the #GtkTooltips object to be used
- * @tip_text: text to be used as tooltip text for tool_item
- * @tip_private: text to be used as private tooltip text
+ * @tip_text: (allow-none): text to be used as tooltip text for tool_item
+ * @tip_private: (allow-none): text to be used as private tooltip text
*
* Sets the #GtkTooltips object to be used for arrow button which
* pops up the menu. See gtk_tool_item_set_tooltip() for setting