[]Struct gtk::PopoverMenu

pub struct PopoverMenu(_, _);

PopoverMenu is a subclass of Popover that treats its children like menus and allows switching between them. It is meant to be used primarily together with ModelButton, but any widget can be used, such as SpinButton or Scale. In this respect, PopoverMenu is more flexible than popovers that are created from a gio::MenuModel with Popover::new_from_model.

To add a child as a submenu, set the PopoverMenu:submenu child property to the name of the submenu. To let the user open this submenu, add a ModelButton whose ModelButton:menu-name property is set to the name you've given to the submenu.

By convention, the first child of a submenu should be a ModelButton to switch back to the parent menu. Such a button should use the ModelButton:inverted and ModelButton:centered properties to achieve a title-like appearance and place the submenu indicator at the opposite side. To switch back to the main menu, use "main" as the menu name.

Example

<object class="GtkPopoverMenu">
  <child>
    <object class="GtkBox">
      <property name="visible">True</property>
      <property name="margin">10</property>
      <child>
        <object class="GtkModelButton">
          <property name="visible">True</property>
          <property name="action-name">win.frob</property>
          <property name="text" translatable="yes">Frob</property>
        </object>
      </child>
      <child>
        <object class="GtkModelButton">
          <property name="visible">True</property>
          <property name="menu-name">more</property>
          <property name="text" translatable="yes">More</property>
        </object>
      </child>
    </object>
  </child>
  <child>
    <object class="GtkBox">
      <property name="visible">True</property>
      <property name="margin">10</property>
      <child>
        <object class="GtkModelButton">
          <property name="visible">True</property>
          <property name="action-name">win.foo</property>
          <property name="text" translatable="yes">Foo</property>
        </object>
      </child>
      <child>
        <object class="GtkModelButton">
          <property name="visible">True</property>
          <property name="action-name">win.bar</property>
          <property name="text" translatable="yes">Bar</property>
        </object>
      </child>
    </object>
    <packing>
      <property name="submenu">more</property>
    </packing>
  </child>
</object>

Just like normal popovers created using gtk_popover_new_from_model, PopoverMenu instances have a single css node called "popover" and get the .menu style class.

Feature: v3_16

Implements

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

Implementations

impl PopoverMenu[src]

pub fn new() -> PopoverMenu[src]

Creates a new popover menu.

Feature: v3_16

Returns

a new PopoverMenu

Trait Implementations

impl Clone for PopoverMenu

impl Debug for PopoverMenu

impl Default for PopoverMenu[src]

impl Display for PopoverMenu[src]

impl Eq for PopoverMenu

impl Hash for PopoverMenu

impl IsA<Bin> for PopoverMenu

impl IsA<Buildable> for PopoverMenu

impl IsA<Container> for PopoverMenu

impl IsA<Popover> for PopoverMenu

impl IsA<Widget> for PopoverMenu

impl Ord for PopoverMenu

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

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

impl StaticType for PopoverMenu

Auto Trait Implementations

impl RefUnwindSafe for PopoverMenu

impl !Send for PopoverMenu

impl !Sync for PopoverMenu

impl Unpin for PopoverMenu

impl UnwindSafe for PopoverMenu

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> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

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.