MenuButtonProtocol
public protocol MenuButtonProtocol : WidgetProtocol
The GtkMenuButton widget is used to display a popup when clicked.

This popup can be provided either as a GtkPopover or as an abstract
GMenuModel.
The GtkMenuButton widget can show either an icon (set with the
[propertyGtk.MenuButton:icon-name] property) or a label (set with the
[propertyGtk.MenuButton:label] property). If neither is explicitly set,
a [classGtk.Image] is automatically created, using an arrow image oriented
according to [propertyGtk.MenuButton:direction] or the generic
“open-menu-symbolic” icon if the direction is not set.
The positioning of the popup is determined by the
[propertyGtk.MenuButton:direction] property of the menu button.
For menus, the [propertyGtk.Widget:halign] and [propertyGtk.Widget: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”.
| start | center | end | |
|---|---|---|---|
| down | ![]() |
![]() |
![]() |
| up | ![]() |
![]() |
![]() |
| left | ![]() |
![]() |
![]() |
| right | ![]() |
![]() |
![]() |
CSS nodes
menubutton
╰── button.toggle
╰── <content>
╰── [arrow]
GtkMenuButton has a single CSS node with name menubutton
which contains a button node with a .toggle style class.
If the button contains only an icon or an arrow, it will have the
.image-button style class, if it contains both, it will have the
.arrow-button style class.
Inside the toggle button content, there is an arrow node for
the indicator, which will carry one of the .none, .up, .down,
.left or .right style classes to indicate the direction that
the menu will appear in. The CSS is expected to provide a suitable
image for each of these cases using the -gtk-icon-source property.
Optionally, the menubutton node can carry the .circular style class
to request a round appearance.
Accessibility
GtkMenuButton uses the GTK_ACCESSIBLE_ROLE_BUTTON role.
The MenuButtonProtocol protocol exposes the methods and properties of an underlying GtkMenuButton instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see MenuButton.
Alternatively, use MenuButtonRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkMenuButtoninstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
menu_button_ptrDefault implementationTyped pointer to the underlying
GtkMenuButtoninstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkMenuButtoninstance.Declaration
Swift
var menu_button_ptr: UnsafeMutablePointer<GtkMenuButton>! { get } -
Required Initialiser for types conforming to
MenuButtonProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
MenuButtonPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: MenuButtonPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a MenuButton property
Declaration
Swift
@inlinable func get(property: MenuButtonPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a MenuButton property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: MenuButtonPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
MenuButtonSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: MenuButtonSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe Swift signal handler (function or callback) to invoke on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
connect(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
MenuButtonSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: MenuButtonSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onActivate(flags:Extension methodhandler: ) Emitted to when the menu button is activated.
The
activatesignal onGtkMenuButtonis an action signal and emitting it causes the button to pop up its menu.Note
This represents the underlyingactivatesignalDeclaration
Swift
@discardableResult @inlinable func onActivate(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
activatesignal is emitted -
activateSignalExtension methodTyped
activatesignal for using theconnect(signal:)methodsDeclaration
Swift
static var activateSignal: MenuButtonSignalName { get } -
onNotifyAlwaysShowArrow(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::always-show-arrowsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyAlwaysShowArrow(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyAlwaysShowArrowsignal is emitted -
notifyAlwaysShowArrowSignalExtension methodTyped
notify::always-show-arrowsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyAlwaysShowArrowSignal: MenuButtonSignalName { get } -
onNotifyDirection(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::directionsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyDirection(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyDirectionsignal is emitted -
notifyDirectionSignalExtension methodTyped
notify::directionsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyDirectionSignal: MenuButtonSignalName { get } -
onNotifyHasFrame(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::has-framesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyHasFrame(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyHasFramesignal is emitted -
notifyHasFrameSignalExtension methodTyped
notify::has-framesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyHasFrameSignal: MenuButtonSignalName { get } -
onNotifyIconName(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::icon-namesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyIconName(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyIconNamesignal is emitted -
notifyIconNameSignalExtension methodTyped
notify::icon-namesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyIconNameSignal: MenuButtonSignalName { get } -
onNotifyLabel(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::labelsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyLabel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyLabelsignal is emitted -
notifyLabelSignalExtension methodTyped
notify::labelsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyLabelSignal: MenuButtonSignalName { get } -
onNotifyMenuModel(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::menu-modelsignalDeclaration
Swift
@discardableResult @inlinable func onNotifyMenuModel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyMenuModelsignal is emitted -
notifyMenuModelSignalExtension methodTyped
notify::menu-modelsignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyMenuModelSignal: MenuButtonSignalName { get } -
onNotifyPopover(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::popoversignalDeclaration
Swift
@discardableResult @inlinable func onNotifyPopover(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyPopoversignal is emitted -
notifyPopoverSignalExtension methodTyped
notify::popoversignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyPopoverSignal: MenuButtonSignalName { get } -
onNotifyPrimary(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::primarysignalDeclaration
Swift
@discardableResult @inlinable func onNotifyPrimary(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyPrimarysignal is emitted -
notifyPrimarySignalExtension methodTyped
notify::primarysignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyPrimarySignal: MenuButtonSignalName { get } -
onNotifyUseUnderline(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::use-underlinesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyUseUnderline(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: MenuButtonRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyUseUnderlinesignal is emitted -
notifyUseUnderlineSignalExtension methodTyped
notify::use-underlinesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyUseUnderlineSignal: MenuButtonSignalName { get }
-
getAlwaysShowArrow()Extension methodGets whether to show a dropdown arrow even when using an icon.
Declaration
Swift
@inlinable func getAlwaysShowArrow() -> Bool -
getDirection()Extension methodReturns the direction the popup will be pointing at when popped up.
Declaration
Swift
@inlinable func getDirection() -> GtkArrowType -
getHasFrame()Extension methodReturns whether the button has a frame.
Declaration
Swift
@inlinable func getHasFrame() -> Bool -
getIconName()Extension methodGets the name of the icon shown in the button.
Declaration
Swift
@inlinable func getIconName() -> String! -
getLabel()Extension methodGets the label shown in the button
Declaration
Swift
@inlinable func getLabel() -> String! -
getMenuModel()Extension methodReturns the
GMenuModelused to generate the popup.Declaration
Swift
@inlinable func getMenuModel() -> GIO.MenuModelRef! -
getPopover()Extension methodReturns the
GtkPopoverthat pops out of the button.If the button is not using a
GtkPopover, this function returnsnil.Declaration
Swift
@inlinable func getPopover() -> PopoverRef! -
getPrimary()Extension methodReturns whether the menu button acts as a primary menu.
Declaration
Swift
@inlinable func getPrimary() -> Bool -
getUseUnderline()Extension methodReturns whether an embedded underline in the text indicates a mnemonic.
Declaration
Swift
@inlinable func getUseUnderline() -> Bool -
popdown()Extension methodDismiss the menu.
Declaration
Swift
@inlinable func popdown() -
popup()Extension methodPop up the menu.
Declaration
Swift
@inlinable func popup() -
set(alwaysShowArrow:Extension method) Sets whether to show a dropdown arrow even when using an icon.
Declaration
Swift
@inlinable func set(alwaysShowArrow: Bool) -
setCreatePopupFunc(func:Extension methoduserData: destroyNotify: ) Sets
functo be called when a popup is about to be shown.funcshould use one of- [method
Gtk.MenuButton.set_popover] - [method
Gtk.MenuButton.set_menu_model]
to set a popup for
menu_button. Iffuncis non-nil,menu_buttonwill always be sensitive.Using this function will not reset the menu widget attached to
menu_button. Instead, this can be done manually infunc.Declaration
Swift
@inlinable func setCreatePopupFunc(func: GtkMenuButtonCreatePopupFunc? = nil, userData: gpointer! = nil, destroyNotify: GDestroyNotify? = nil) - [method
-
set(direction:Extension method) 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_NONEfor adirection, the popup will behave as if you passedGTK_ARROW_DOWN(although you won’t see any arrows).Declaration
Swift
@inlinable func set(direction: GtkArrowType) -
set(hasFrame:Extension method) Sets the style of the button.
Declaration
Swift
@inlinable func set(hasFrame: Bool) -
set(iconName:Extension method) Sets the name of an icon to show inside the menu button.
Declaration
Swift
@inlinable func set(iconName: UnsafePointer<CChar>!) -
set(label:Extension method) Sets the label to show inside the menu button.
Declaration
Swift
@inlinable func set(label: UnsafePointer<CChar>!) -
set(menuModel:Extension method) Sets the
GMenuModelfrom which the popup will be constructed.If
menu_modelisnil, the button is disabled.A [class
Gtk.Popover] will be created from the menu model with [ctorGtk.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 themenu_button, and the property is set tonil.Declaration
Swift
@inlinable func set(menuModel: GIO.MenuModelRef? = nil) -
set(menuModel:Extension method) Sets the
GMenuModelfrom which the popup will be constructed.If
menu_modelisnil, the button is disabled.A [class
Gtk.Popover] will be created from the menu model with [ctorGtk.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 themenu_button, and the property is set tonil.Declaration
Swift
@inlinable func set<MenuModelT>(menuModel: MenuModelT?) where MenuModelT : MenuModelProtocol -
set(popover:Extension method) Sets the
GtkPopoverthat will be popped up when themenu_buttonis clicked.If
popoverisnil, the button is disabled.If [property
Gtk.MenuButton:menu-model] is set, the menu model is dissociated from themenu_button, and the property is set tonil.Declaration
Swift
@inlinable func set(popover: WidgetRef? = nil) -
set(popover:Extension method) Sets the
GtkPopoverthat will be popped up when themenu_buttonis clicked.If
popoverisnil, the button is disabled.If [property
Gtk.MenuButton:menu-model] is set, the menu model is dissociated from themenu_button, and the property is set tonil.Declaration
Swift
@inlinable func set<WidgetT>(popover: WidgetT?) where WidgetT : WidgetProtocol -
set(primary:Extension method) Sets whether menu button acts as a primary menu.
Primary menus can be opened with the <kbd>F10</kbd> key.
Declaration
Swift
@inlinable func set(primary: Bool) -
set(useUnderline:Extension method) If true, an underline in the text indicates a mnemonic.
Declaration
Swift
@inlinable func set(useUnderline: Bool) -
alwaysShowArrowExtension methodGets whether to show a dropdown arrow even when using an icon.
Declaration
Swift
@inlinable var alwaysShowArrow: Bool { get nonmutating set } -
directionExtension methodThe
GtkArrowTyperepresenting the direction in which the menu or popover will be popped out.Declaration
Swift
@inlinable var direction: GtkArrowType { get nonmutating set } -
hasFrameExtension methodReturns whether the button has a frame.
Declaration
Swift
@inlinable var hasFrame: Bool { get nonmutating set } -
iconNameExtension methodGets the name of the icon shown in the button.
Declaration
Swift
@inlinable var iconName: String! { get nonmutating set } -
labelExtension methodThe label for the button.
Declaration
Swift
@inlinable var label: String! { get nonmutating set } -
menuModelExtension methodReturns the
GMenuModelused to generate the popup.Declaration
Swift
@inlinable var menuModel: GIO.MenuModelRef! { get nonmutating set } -
popoverExtension methodThe
GtkPopoverthat will be popped up when the button is clicked.Declaration
Swift
@inlinable var popover: PopoverRef! { get nonmutating set } -
primaryExtension methodWhether the menu button acts as a primary menu.
Primary menus can be opened using the <kbd>F10</kbd> key
Declaration
Swift
@inlinable var primary: Bool { get nonmutating set } -
useUnderlineExtension methodReturns whether an embedded underline in the text indicates a mnemonic.
Declaration
Swift
@inlinable var useUnderline: Bool { get nonmutating set }
View on GitHub
Install in Dash
MenuButtonProtocol Protocol Reference











