[]Struct gtk::Popover

pub struct Popover(_, _);

Popover is a bubble-like context window, primarily meant to provide context-dependent information or options. Popovers are attached to a widget, passed at construction time on Popover::new, or updated afterwards through PopoverExt::set_relative_to, by default they will point to the whole widget area, although this behavior can be changed through PopoverExt::set_pointing_to.

The position of a popover relative to the widget it is attached to can also be changed through PopoverExt::set_position.

By default, Popover performs a GTK+ grab, in order to ensure input events get redirected to it while it is shown, and also so the popover is dismissed in the expected situations (clicks outside the popover, or the Esc key being pressed). If no such modal behavior is desired on a popover, PopoverExt::set_modal may be called on it to tweak its behavior.

Popover as menu replacement

Popover is often used to replace menus. To facilitate this, it supports being populated from a gio::MenuModel, using Popover::new_from_model. In addition to all the regular menu model features, this function supports rendering sections in the model in a more compact form, as a row of icon buttons instead of menu items.

To use this rendering, set the ”display-hint” attribute of the section to ”horizontal-buttons” and set the icons of your items with the ”verb-icon” attribute.

<section>
  <attribute name="display-hint">horizontal-buttons</attribute>
  <item>
    <attribute name="label">Cut</attribute>
    <attribute name="action">app.cut</attribute>
    <attribute name="verb-icon">edit-cut-symbolic</attribute>
  </item>
  <item>
    <attribute name="label">Copy</attribute>
    <attribute name="action">app.copy</attribute>
    <attribute name="verb-icon">edit-copy-symbolic</attribute>
  </item>
  <item>
    <attribute name="label">Paste</attribute>
    <attribute name="action">app.paste</attribute>
    <attribute name="verb-icon">edit-paste-symbolic</attribute>
  </item>
</section>

CSS nodes

Popover has a single css node called popover. It always gets the .background style class and it gets the .menu style class if it is menu-like (e.g. PopoverMenu or created using Popover::new_from_model.

Particular uses of Popover, such as touch selection popups or magnifiers in Entry or TextView get style classes like .touch-selection or .magnifier to differentiate from plain popovers.

Implements

PopoverExt, BinExt, ContainerExt, WidgetExt, glib::object::ObjectExt, BuildableExt, WidgetExtManual, BuildableExtManual

Implementations

impl Popover[src]

pub fn new<P: IsA<Widget>>(relative_to: Option<&P>) -> Popover[src]

Creates a new popover to point to relative_to

relative_to

Widget the popover is related to

Returns

a new Popover

pub fn from_model<P: IsA<Widget>, Q: IsA<MenuModel>>(
    relative_to: Option<&P>,
    model: &Q
) -> Popover
[src]

Trait Implementations

impl Clone for Popover

impl Debug for Popover

impl Display for Popover[src]

impl Eq for Popover

impl Hash for Popover

impl IsA<Bin> for Popover

impl IsA<Buildable> for Popover

impl IsA<Container> for Popover

impl IsA<Popover> for PopoverMenu

impl IsA<Widget> for Popover

impl Ord for Popover

impl<T: ObjectType> PartialEq<T> for Popover

impl<T: ObjectType> PartialOrd<T> for Popover

impl StaticType for Popover

Auto Trait Implementations

impl RefUnwindSafe for Popover

impl !Send for Popover

impl !Sync for Popover

impl Unpin for Popover

impl UnwindSafe for Popover

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.