Trait gtk::prelude::MenuButtonExt
source · [−]pub trait MenuButtonExt: 'static {
Show 18 methods
fn align_widget(&self) -> Option<Widget>;
fn direction(&self) -> ArrowType;
fn menu_model(&self) -> Option<MenuModel>;
fn popover(&self) -> Option<Popover>;
fn popup(&self) -> Option<Menu>;
fn uses_popover(&self) -> bool;
fn set_align_widget(&self, align_widget: Option<&impl IsA<Widget>>);
fn set_direction(&self, direction: ArrowType);
fn set_menu_model(&self, menu_model: Option<&impl IsA<MenuModel>>);
fn set_popover(&self, popover: Option<&impl IsA<Widget>>);
fn set_popup(&self, menu: Option<&impl IsA<Widget>>);
fn set_use_popover(&self, use_popover: bool);
fn connect_align_widget_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_direction_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_menu_model_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_popover_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_popup_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_use_popover_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
fn align_widget(&self) -> Option<Widget>
fn align_widget(&self) -> Option<Widget>
fn uses_popover(&self) -> bool
fn uses_popover(&self) -> bool
fn set_align_widget(&self, align_widget: Option<&impl IsA<Widget>>)
fn set_align_widget(&self, align_widget: Option<&impl IsA<Widget>>)
Sets the Widget
to use to line the menu with when popped up.
Note that the align_widget
must contain the MenuButton
itself.
Setting it to None
means that the menu will be aligned with the
button itself.
Note that this property is only used with menus currently, and not for popovers.
align_widget
a Widget
fn set_direction(&self, direction: ArrowType)
fn set_direction(&self, direction: ArrowType)
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.
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 ArrowType::None
for a direction
, the popup will behave
as if you passed ArrowType::Down
(although you won’t see any arrows).
direction
Sets the gio::MenuModel
from which the popup will be constructed,
or None
to dissociate any existing menu model and disable the button.
Depending on the value of property::MenuButton::use-popover
, either a
Menu
will be created with Menu::from_model()
, or a
Popover
with Popover::from_model()
. In either case,
actions will be connected as documented for these functions.
If property::MenuButton::popup
or property::MenuButton::popover
are already set, those
widgets are dissociated from the self
, and those properties are set
to None
.
menu_model
a gio::MenuModel
, or None
to unset and disable the
button
fn set_popover(&self, popover: Option<&impl IsA<Widget>>)
fn set_popover(&self, popover: Option<&impl IsA<Widget>>)
fn set_use_popover(&self, use_popover: bool)
fn set_use_popover(&self, use_popover: bool)
Sets whether to construct a Popover
instead of Menu
when set_menu_model()
is called. Note that
this property is only consulted when a new menu model is set.
use_popover
true
to construct a popover from the menu model