PopoverMenu

open class PopoverMenu : Popover, PopoverMenuProtocol

GtkPopoverMenu is a subclass of GtkPopover that treats its children like menus and allows switching between them. It is meant to be used primarily together with GtkModelButton, but any widget can be used, such as GtkSpinButton or GtkScale. In this respect, GtkPopoverMenu is more flexible than popovers that are created from a GMenuModel with gtk_popover_new_from_model().

To add a child as a submenu, set the GtkPopoverMenu:submenu child property to the name of the submenu. To let the user open this submenu, add a GtkModelButton whose GtkModelButton: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 GtkModelButton to switch back to the parent menu. Such a button should use the GtkModelButton:inverted and GtkModelButton: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, GtkPopoverMenu instances have a single css node called “popover” and get the .menu style class.

The PopoverMenu type acts as a reference-counted owner of an underlying GtkPopoverMenu instance. It provides the methods that can operate on this data type through PopoverMenuProtocol conformance. Use PopoverMenu as a strong reference or owner of a GtkPopoverMenu instance.

  • Designated initialiser from the underlying `C` data type.
    

    This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PopoverMenu instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafeMutablePointer<GtkPopoverMenu>)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PopoverMenu instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafePointer<GtkPopoverMenu>)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a non-mutating gpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PopoverMenu instance.

    Declaration

    Swift

    @inlinable
    override public init!(gpointer op: gpointer?)

    Parameters

    op

    gpointer to the underlying object

  • Optional initialiser from a non-mutating gconstpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PopoverMenu instance.

    Declaration

    Swift

    @inlinable
    override public init!(gconstpointer op: gconstpointer?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PopoverMenu instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafePointer<GtkPopoverMenu>?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the PopoverMenu instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafeMutablePointer<GtkPopoverMenu>?)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from the underlying C data type. Will retain GtkPopoverMenu. i.e., ownership is transferred to the PopoverMenu instance.

    Declaration

    Swift

    @inlinable
    public init(retaining op: UnsafeMutablePointer<GtkPopoverMenu>)

    Parameters

    op

    pointer to the underlying object

  • Reference intialiser for a related type that implements PopoverMenuProtocol Will retain GtkPopoverMenu.

    Declaration

    Swift

    @inlinable
    public init<T>(popoverMenu other: T) where T : PopoverMenuProtocol

    Parameters

    other

    an instance of a related type that implements PopoverMenuProtocol

  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PopoverMenuProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(cPointer p: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PopoverMenuProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PopoverMenuProtocol.

    Declaration

    Swift

    @inlinable
    override public init(raw p: UnsafeRawPointer)

    Parameters

    p

    raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PopoverMenuProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingRaw raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PopoverMenuProtocol.

    Declaration

    Swift

    @inlinable
    public required init(raw p: UnsafeMutableRawPointer)

    Parameters

    p

    mutable raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PopoverMenuProtocol.

    Declaration

    Swift

    @inlinable
    required public init(retainingRaw raw: UnsafeMutableRawPointer)

    Parameters

    raw

    mutable raw pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PopoverMenuProtocol.

    Declaration

    Swift

    @inlinable
    override public init(opaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to PopoverMenuProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingOpaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Creates a new popover menu.

    Declaration

    Swift

    @inlinable
    public init()