Trait gtk::prelude::PopoverExt [−][src]
pub trait PopoverExt: 'static {}Show methods
fn bind_model<P: IsA<MenuModel>>(
&self,
model: Option<&P>,
action_namespace: Option<&str>
); fn constrain_to(&self) -> PopoverConstraint; fn default_widget(&self) -> Option<Widget>; fn is_modal(&self) -> bool; fn pointing_to(&self) -> Option<Rectangle>; fn position(&self) -> PositionType; fn relative_to(&self) -> Option<Widget>; fn is_transitions_enabled(&self) -> bool; fn popdown(&self); fn popup(&self); fn set_constrain_to(&self, constraint: PopoverConstraint); fn set_default_widget<P: IsA<Widget>>(&self, widget: Option<&P>); fn set_modal(&self, modal: bool); fn set_pointing_to(&self, rect: &Rectangle); fn set_position(&self, position: PositionType); fn set_relative_to<P: IsA<Widget>>(&self, relative_to: Option<&P>); fn set_transitions_enabled(&self, transitions_enabled: bool); fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_constrain_to_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId; fn connect_modal_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId; fn connect_pointing_to_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId; fn connect_position_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId; fn connect_relative_to_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId; fn connect_transitions_enabled_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
Expand description
Required methods
Establishes a binding between a Popover
and a gio::MenuModel
.
The contents of self
are removed and then refilled with menu items
according to model
. When model
changes, self
is updated.
Calling this function twice on self
with different model
will
cause the first binding to be replaced with a binding to the new
model. If model
is None
then any previous binding is undone and
all children are removed.
If action_namespace
is non-None
then the effect is as if all
actions mentioned in the model
have their names prefixed with the
namespace, plus a dot. For example, if the action “quit” is
mentioned and action_namespace
is “app” then the effective action
name is “app.quit”.
This function uses Actionable
to define the action name and
target values on the created menu items. If you want to use an
action group other than “app” and “win”, or if you want to use a
MenuShell
outside of a ApplicationWindow
, then you will need
to attach your own action group to the widget hierarchy using
WidgetExt::insert_action_group()
. As an example, if you created a
group with a “quit” action and inserted it with the name “mygroup”
then you would use the action name “mygroup.quit” in your
gio::MenuModel
.
model
the gio::MenuModel
to bind to or None
to remove
binding
action_namespace
the namespace for actions in model
fn constrain_to(&self) -> PopoverConstraint
fn constrain_to(&self) -> PopoverConstraint
v3_20
only.Returns the constraint for placing this popover.
See set_constrain_to()
.
Returns
the constraint for placing this popover.
fn default_widget(&self) -> Option<Widget>
fn default_widget(&self) -> Option<Widget>
fn pointing_to(&self) -> Option<Rectangle>
fn pointing_to(&self) -> Option<Rectangle>
fn position(&self) -> PositionType
fn position(&self) -> PositionType
fn relative_to(&self) -> Option<Widget>
fn relative_to(&self) -> Option<Widget>
fn is_transitions_enabled(&self) -> bool
fn is_transitions_enabled(&self) -> bool
Returns whether show/hide transitions are enabled on this popover.
Deprecated since 3.22
You can show or hide the popover without transitions
using WidgetExt::show()
and WidgetExt::hide()
while popup()
and popdown()
will use transitions.
Returns
true
if the show and hide transitions of the given
popover are enabled, false
otherwise.
v3_22
only.Pops self
down.This is different than a WidgetExt::hide()
call
in that it shows the popover with a transition. If you want to hide
the popover without a transition, use WidgetExt::hide()
.
v3_22
only.Pops self
up. This is different than a WidgetExt::show()
call
in that it shows the popover with a transition. If you want to show
the popover without a transition, use WidgetExt::show()
.
fn set_constrain_to(&self, constraint: PopoverConstraint)
fn set_constrain_to(&self, constraint: PopoverConstraint)
v3_20
only.Sets a constraint for positioning this popover.
Note that not all platforms support placing popovers freely, and may already impose constraints.
constraint
the new constraint
Sets the widget that should be set as default widget while
the popover is shown (see GtkWindowExt::set_default()
). Popover
remembers the previous default widget and reestablishes it
when the popover is dismissed.
widget
the new default widget, or None
fn set_pointing_to(&self, rect: &Rectangle)
fn set_pointing_to(&self, rect: &Rectangle)
Sets the rectangle that self
will point to, in the
coordinate space of the widget self
is attached to,
see set_relative_to()
.
rect
rectangle to point to
fn set_position(&self, position: PositionType)
fn set_position(&self, position: PositionType)
Sets the preferred position for self
to appear. If the self
is currently visible, it will be immediately updated.
This preference will be respected where possible, although
on lack of space (eg. if close to the window edges), the
Popover
may choose to appear on the opposite side
position
preferred popover position
Sets a new widget to be attached to self
. If self
is
visible, the position will be updated.
Note: the ownership of popovers is always given to their relative_to
widget, so if relative_to
is set to None
on an attached self
, it
will be detached from its previous widget, and consequently destroyed
unless extra references are kept.
relative_to
a Widget
fn set_transitions_enabled(&self, transitions_enabled: bool)
fn set_transitions_enabled(&self, transitions_enabled: bool)
Sets whether show/hide transitions are enabled on this popover
Deprecated since 3.22
You can show or hide the popover without transitions
using WidgetExt::show()
and WidgetExt::hide()
while popup()
and popdown()
will use transitions.
transitions_enabled
Whether transitions are enabled
fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
This signal is emitted when the popover is dismissed either through API or user interaction.
fn connect_constrain_to_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_constrain_to_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
v3_20
only.fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_pointing_to_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_position_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_relative_to_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_transitions_enabled_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId