package ocgtk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Wrappers.Menu_button

type t = [ `menu_button | `widget | `initially_unowned | `object_ ] Gobject.obj
val new_ : unit -> t

Create a new MenuButton

val set_use_underline : t -> bool -> unit

If true, an underline in the text indicates a mnemonic.

val set_primary : t -> bool -> unit

Sets whether menu button acts as a primary menu.

Primary menus can be opened with the <kbd>F10</kbd> key.

val set_popover : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj option -> unit

Sets the `GtkPopover` that will be popped up when the @menu_button is clicked.

If @popover is %NULL, the button is disabled.

If property@Gtk.MenuButton:menu-model is set, the menu model is dissociated from the @menu_button, and the property is set to %NULL.

val set_menu_model : t -> Ocgtk_gio.Gio.Wrappers.Menu_model.t option -> unit

Sets the `GMenuModel` from which the popup will be constructed.

If @menu_model is %NULL, the button is disabled.

A class@Gtk.Popover will be created from the menu model with ctor@Gtk.PopoverMenu.new_from_model. Actions will be connected as documented for this function.

If property@Gtk.MenuButton:popover is already set, it will be dissociated from the @menu_button, and the property is set to %NULL.

val set_label : t -> string -> unit

Sets the label to show inside the menu button.

Setting a label resets property@Gtk.MenuButton:icon-name and property@Gtk.MenuButton:child.

If property@Gtk.MenuButton:direction is not `GTK_ARROW_NONE`, a dropdown arrow will be shown next to the label.

val set_icon_name : t -> string -> unit

Sets the name of an icon to show inside the menu button.

Setting icon name resets property@Gtk.MenuButton:label and property@Gtk.MenuButton:child.

If property@Gtk.MenuButton:always-show-arrow is set to `TRUE` and property@Gtk.MenuButton:direction is not `GTK_ARROW_NONE`, a dropdown arrow will be shown next to the icon.

val set_has_frame : t -> bool -> unit

Sets the style of the button.

val set_direction : t -> Gtk_enums.arrowtype -> unit

Sets the direction in which the popup will be popped up.

If the button is automatically populated with an arrow icon, its direction will be changed to match.

If the does not fit in the available space in the given direction, GTK will its best to keep it inside the screen and fully visible.

If you pass %GTK_ARROW_NONE for a @direction, the popup will behave as if you passed %GTK_ARROW_DOWN (although you won’t see any arrows).

val set_child : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj option -> unit

Sets the child widget of @menu_button.

Setting a child resets property@Gtk.MenuButton:label and property@Gtk.MenuButton:icon-name.

If property@Gtk.MenuButton:always-show-arrow is set to `TRUE` and property@Gtk.MenuButton:direction is not `GTK_ARROW_NONE`, a dropdown arrow will be shown next to the child.

val set_can_shrink : t -> bool -> unit

Sets whether the button size can be smaller than the natural size of its contents.

For text buttons, setting @can_shrink to true will ellipsize the label.

For icon buttons, this function has no effect.

val set_always_show_arrow : t -> bool -> unit

Sets whether to show a dropdown arrow even when using an icon or a custom child.

val set_active : t -> bool -> unit

Sets whether the menu button is active.

val popup : t -> unit

Pop up the menu.

val popdown : t -> unit

Dismiss the menu.

val get_use_underline : t -> bool

Returns whether an embedded underline in the text indicates a mnemonic.

val get_primary : t -> bool

Returns whether the menu button acts as a primary menu.

val get_popover : t -> [ `popover | `widget | `initially_unowned | `object_ ] Gobject.obj option

Returns the `GtkPopover` that pops out of the button.

If the button is not using a `GtkPopover`, this function returns %NULL.

val get_menu_model : t -> Ocgtk_gio.Gio.Wrappers.Menu_model.t option

Returns the `GMenuModel` used to generate the popup.

val get_label : t -> string option

Gets the label shown in the button

val get_icon_name : t -> string option

Gets the name of the icon shown in the button.

val get_has_frame : t -> bool

Returns whether the button has a frame.

val get_direction : t -> Gtk_enums.arrowtype

Returns the direction the popup will be pointing at when popped up.

val get_child : t -> [ `widget | `initially_unowned | `object_ ] Gobject.obj option

Gets the child widget of @menu_button.

val get_can_shrink : t -> bool

Retrieves whether the button can be smaller than the natural size of its contents.

val get_always_show_arrow : t -> bool

Gets whether to show a dropdown arrow even when using an icon or a custom child.

val get_active : t -> bool

Returns whether the menu button is active.

val on_activate : ?after:bool -> t -> callback:(unit -> unit) -> Gobject.Signal.handler_id