Sets our main struct and passes it to the parent class.
Creates a new #GtkMenuButton widget with downwards-pointing arrow as the only child. You can replace the child widget with another #GtkWidget should you wish to.
Returns the parent #GtkWidget to use to line up with menu.
Get the main Gtk struct
Returns the direction the popup will be pointing at when popped up.
Returns the #GMenuModel used to generate the popup.
Returns the #GtkPopover that pops out of the button. If the button is not using a #GtkPopover, this function returns %NULL.
Returns the #GtkMenu that pops out of the button. If the button does not use a #GtkMenu, this function returns %NULL.
the main Gtk struct as a void*
Returns whether a #GtkPopover or a #GtkMenu will be constructed from the menu model.
Sets the #GtkWidget to use to line the menu with when popped up. Note that the @align_widget must contain the #GtkMenuButton itself.
Sets the direction in which the popup will be popped up, as well as changing the arrow’s direction. The child will not be changed to an arrow if it was customized.
Sets the #GMenuModel from which the popup will be constructed, or %NULL to disable the button.
Sets the #GtkPopover that will be popped up when the button is clicked, or %NULL to disable the button. If #GtkMenuButton:menu-model or #GtkMenuButton:popup are set, they will be set to %NULL.
Sets the #GtkMenu that will be popped up when the button is clicked, or %NULL to disable the button. If #GtkMenuButton:menu-model or #GtkMenuButton:popover are set, they will be set to %NULL.
Sets whether to construct a #GtkPopover instead of #GtkMenu when gtk_menu_button_set_menu_model() is called. Note that this property is only consulted when a new menu model is set.
the main Gtk struct
the main Gtk struct
Get the main Gtk struct
the main Gtk struct as a void*
Queries a #GtkToggleButton and returns its current state. Returns %TRUE if the toggle button is pressed in and %FALSE if it is raised.
Gets the value set by gtk_toggle_button_set_inconsistent().
Retrieves whether the button is displayed as a separate indicator and label. See gtk_toggle_button_set_mode().
Sets the status of the toggle button. Set to %TRUE if you want the GtkToggleButton to be “pressed in”, and %FALSE to raise it. This action causes the #GtkToggleButton::toggled signal and the #GtkButton::clicked signal to be emitted.
If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a toggle button, and the current values in that range are inconsistent, you may want to display the toggle in an “in between” state. This function turns on “in between” display. Normally you would turn off the inconsistent state again if the user toggles the toggle button. This has to be done manually, gtk_toggle_button_set_inconsistent() only affects visual appearance, it doesn’t affect the semantics of the button.
Sets whether the button is displayed as a separate indicator and label. You can call this function on a checkbutton or a radiobutton with @draw_indicator = %FALSE to make the button look like a normal button.
Emits the #GtkToggleButton::toggled signal on the #GtkToggleButton. There is no good reason for an application ever to call this function.
Should be connected if you wish to perform an action whenever the #GtkToggleButton's state is changed.
The #GtkMenuButton widget is used to display a popup when clicked on. This popup can be provided either as a #GtkMenu, a #GtkPopover or an abstract #GMenuModel.
The #GtkMenuButton widget can hold any valid child widget. That is, it can hold almost any other standard #GtkWidget. The most commonly used child is #GtkImage. If no widget is explicitely added to the #GtkMenuButton, a #GtkImage is automatically created, using an arrow image oriented according to #GtkMenuButton:direction or the generic "view-context-menu" icon if the direction is not set.
The positioning of the popup is determined by the #GtkMenuButton:direction property of the menu button.
For menus, the #GtkWidget:halign and #GtkWidget:valign properties of the menu are also taken into account. For example, when the direction is %GTK_ARROW_DOWN and the horizontal alignment is %GTK_ALIGN_START, the menu will be positioned below the button, with the starting edge (depending on the text direction) of the menu aligned with the starting edge of the button. If there is not enough space below the button, the menu is popped up above the button instead. If the alignment would move part of the menu offscreen, it is “pushed in”.
Direction = Down
- halign = start
- halign = center
- halign = end
Direction = Up
- halign = start
- halign = center
- halign = end
Direction = Left
- valign = start
- valign = center
- valign = end
Direction = Right
- valign = start
- valign = center
- valign = end
CSS nodes
GtkMenuButton has a single CSS node with name button. To differentiate it from a plain #GtkButton, it gets the .popup style class.