CtkMenuToolButton: CTK+ 3 Reference Manual

## CtkMenuToolButton CtkMenuToolButton — A CtkToolItem containing a button with an additional dropdown menu |

## Functions

CtkToolItem * | ctk_menu_tool_button_new ()
CtkToolItem * | ctk_menu_tool_button_new_from_stock ()
void | ctk_menu_tool_button_set_menu ()
CtkWidget * | ctk_menu_tool_button_get_menu ()
void | ctk_menu_tool_button_set_arrow_tooltip_text ()
void | ctk_menu_tool_button_set_arrow_tooltip_markup ()

## Properties

CtkMenu * | menu | Read / Write

## Signals

void | show-menu | Run First

## Types and Values

struct | CtkMenuToolButton
struct | CtkMenuToolButtonClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── CtkWidget
                ╰── CtkContainer
                    ╰── CtkBin
                        ╰── CtkToolItem
                            ╰── CtkToolButton
                                ╰── CtkMenuToolButton

## Implemented Interfaces

CtkMenuToolButton implements AtkImplementorIface, CtkBuildable, CtkActivatable and CtkActionable.

## Includes

    #include <ctk/ctk.h>

## Description

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

Use `ctk_menu_tool_button_new()` to create a new CtkMenuToolButton.

### CtkMenuToolButton as CtkBuildable

The CtkMenuToolButton implementation of the CtkBuildable interface supports adding a menu by specifying “menu” as the “type” attribute of a <child> element.

An example for a UI definition fragment with menus:

    1
    2
    3
    4
    5
    <object class="CtkMenuToolButton">
      <child type="menu">
        <object class="CtkMenu"/>
      </child>
    </object>

## Functions

### ctk_menu_tool_button_new ()

    CtkToolItem *
    ctk_menu_tool_button_new (CtkWidget *icon_widget,
                              const gchar *label);

Creates a new CtkMenuToolButton 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 CtkMenuToolButton

Since: 2.6

### ctk_menu_tool_button_new_from_stock ()

    CtkToolItem *
    ctk_menu_tool_button_new_from_stock (const gchar *stock_id);

Creates a new CtkMenuToolButton. The new CtkMenuToolButton 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 CtkMenuToolButton

Since: 2.6

### ctk_menu_tool_button_set_menu ()

    void
    ctk_menu_tool_button_set_menu (CtkMenuToolButton *button,
                                   CtkWidget *menu);

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

#### Parameters

button | a CtkMenuToolButton |
menu | the CtkMenu associated with CtkMenuToolButton |

Since: 2.6

### ctk_menu_tool_button_get_menu ()

    CtkWidget *
    ctk_menu_tool_button_get_menu (CtkMenuToolButton *button);

Gets the CtkMenu associated with CtkMenuToolButton.

#### Parameters

button | a CtkMenuToolButton |

#### Returns

the CtkMenu associated with CtkMenuToolButton.

[transfer none]

Since: 2.6

### ctk_menu_tool_button_set_arrow_tooltip_text ()

    void
    ctk_menu_tool_button_set_arrow_tooltip_text
                                   (CtkMenuToolButton *button,
                                    const gchar *text);

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

#### Parameters

button | a CtkMenuToolButton |
text | text to be used as tooltip text for button’s arrow button |

Since: 2.12

### ctk_menu_tool_button_set_arrow_tooltip_markup ()

    void
    ctk_menu_tool_button_set_arrow_tooltip_markup
                                   (CtkMenuToolButton *button,
                                    const gchar *markup);

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

#### Parameters

button | a CtkMenuToolButton |
markup | markup text to be used as tooltip text for button’s arrow button |

Since: 2.12

## Types and Values

### struct CtkMenuToolButton

    struct CtkMenuToolButton;

### struct CtkMenuToolButtonClass

    struct CtkMenuToolButtonClass {
      CtkToolButtonClass parent_class;

      void (*show_menu) (CtkMenuToolButton *button);
    };

#### Members

`show_menu` () | Signal emitted before the menu is shown. |

## Property Details

### The `“menu”` property

      “menu”                     CtkMenu *

The dropdown menu.

Owner: CtkMenuToolButton

Flags: Read / Write

## Signal Details

### The `“show-menu”` signal

    void
    user_function (CtkMenuToolButton *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 `ctk_menu_tool_button_set_menu()`.

Note that even if you populate the menu dynamically in this way, you must set an empty menu on the CtkMenuToolButton 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

CtkToolbar, CtkToolButton