GtkMenuToolButton

GtkMenuToolButton — A GtkToolItem containing a button with an additional dropdown menu

Functions

Properties

GtkMenu * menu Read / Write

Signals

void show-menu Run First

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkObject
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBin
                        ╰── GtkToolItem
                            ╰── GtkToolButton
                                ╰── GtkMenuToolButton

Implemented Interfaces

GtkMenuToolButton implements AtkImplementorIface, GtkBuildable and GtkActivatable.

Includes

#include <gtk/gtk.h>

Description

A GtkMenuToolButton is a GtkToolItem that contains a button and a small additional button with an arrow. When clicked, the arrow button pops up a dropdown menu.

Use gtk_menu_tool_button_new() to create a new GtkMenuToolButton. Use gtk_menu_tool_button_new_from_stock() to create a new GtkMenuToolButton containing a stock item.

GtkMenuToolButton as GtkBuildable

The GtkMenuToolButton implementation of the GtkBuildable interface supports adding a menu by specifying "menu" as the "type" attribute of a <child> element.

Example 35. A UI definition fragment with menus

1
2
3
4
5
<object class="GtkMenuToolButton">
  <child type="menu">
    <object class="GtkMenu"/>
  </child>
</object>

Functions

gtk_menu_tool_button_new ()

GtkToolItem *
gtk_menu_tool_button_new (GtkWidget *icon_widget,
                          const gchar *label);

Creates a new GtkMenuToolButton using icon_widget as icon and label as label.

Parameters

icon_widget

a widget that will be used as icon widget, or NULL.

[allow-none]

label

a string that will be used as label, or NULL.

[allow-none]

Returns

the new GtkMenuToolButton

Since 2.6


gtk_menu_tool_button_new_from_stock ()

GtkToolItem *
gtk_menu_tool_button_new_from_stock (const gchar *stock_id);

Creates a new GtkMenuToolButton. The new GtkMenuToolButton will contain an icon and label from the stock item indicated by stock_id .

Parameters

stock_id

the name of a stock item

 

Returns

the new GtkMenuToolButton

Since 2.6


gtk_menu_tool_button_set_menu ()

void
gtk_menu_tool_button_set_menu (GtkMenuToolButton *button,
                               GtkWidget *menu);

Sets the GtkMenu that is popped up when the user clicks on the arrow. If menu is NULL, the arrow button becomes insensitive.

Parameters

button

a GtkMenuToolButton

 

menu

the GtkMenu associated with GtkMenuToolButton

 

Since 2.6


gtk_menu_tool_button_get_menu ()

GtkWidget *
gtk_menu_tool_button_get_menu (GtkMenuToolButton *button);

Gets the GtkMenu associated with GtkMenuToolButton.

Parameters

button

a GtkMenuToolButton

 

Returns

the GtkMenu associated with GtkMenuToolButton.

[transfer none]

Since 2.6


gtk_menu_tool_button_set_arrow_tooltip ()

void
gtk_menu_tool_button_set_arrow_tooltip
                               (GtkMenuToolButton *button,
                                GtkTooltips *tooltips,
                                const gchar *tip_text,
                                const gchar *tip_private);

gtk_menu_tool_button_set_arrow_tooltip has been deprecated since version 2.12 and should not be used in newly-written code.

Use gtk_menu_tool_button_set_arrow_tooltip_text() instead.

Sets the GtkTooltips object to be used for arrow button which pops up the menu. See gtk_tool_item_set_tooltip() for setting a tooltip on the whole GtkMenuToolButton.

Parameters

button

a GtkMenuToolButton

 

tooltips

the GtkTooltips object to be used

 

tip_text

text to be used as tooltip text for tool_item.

[allow-none]

tip_private

text to be used as private tooltip text.

[allow-none]

Since 2.6


gtk_menu_tool_button_set_arrow_tooltip_text ()

void
gtk_menu_tool_button_set_arrow_tooltip_text
                               (GtkMenuToolButton *button,
                                const gchar *text);

gtk_menu_tool_button_set_arrow_tooltip_text is deprecated and should not be used in newly-written code.

Sets the tooltip text to be used as tooltip for the arrow button which pops up the menu. See gtk_tool_item_set_tooltip() for setting a tooltip on the whole GtkMenuToolButton.

Parameters

button

a GtkMenuToolButton

 

text

text to be used as tooltip text for button's arrow button

 

Since 2.12


gtk_menu_tool_button_set_arrow_tooltip_markup ()

void
gtk_menu_tool_button_set_arrow_tooltip_markup
                               (GtkMenuToolButton *button,
                                const gchar *markup);

Sets the tooltip markup text to be used as tooltip for the arrow button which pops up the menu. See gtk_tool_item_set_tooltip() for setting a tooltip on the whole GtkMenuToolButton.

Parameters

button

a GtkMenuToolButton

 

markup

markup text to be used as tooltip text for button's arrow button

 

Since 2.12

Types and Values

struct GtkMenuToolButton

struct GtkMenuToolButton;

The GtkMenuToolButton struct contains only private data and should only be accessed through the functions described below.

Property Details

The “menu” property

  “menu”                     GtkMenu *

The dropdown menu.

Flags: Read / Write

Signal Details

The “show-menu” signal

void
user_function (GtkMenuToolButton *button,
               gpointer           user_data)

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.

Parameters

button

the object on which the signal is emitted

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

See Also

GtkToolbar, GtkToolButton

The toolbar widget

The parent class of GtkMenuToolButton. The properties "label_widget", "label", "icon_widget", and "stock_id" on GtkToolButton determine the label and icon used on GtkMenuToolButtons.