Class: Gtk::Popover

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#bind_model(model, action_namespace) ⇒ nil

Establishes a binding between a Gtk::Popover and a #GMenuModel.

The contents of popover are removed and then refilled with menu items according to model. When model changes, popover is updated. Calling this function twice on popover with different model will cause the first binding to be replaced with a binding to the new model. If model is nil then any previous binding is undone and all children are removed.

If action_namespace is non-nil 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 Gtk::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 Gtk::MenuShell outside of a #GtkApplicationWindow, then you will need to attach your own action group to the widget hierarchy using gtk_widget_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 GMenu::Model.

Parameters:

  • model (Gio::MenuModel)

    the GMenu::Model to bind to or nil to remove binding

  • action_namespace (String)

    the namespace for actions in model

Returns:

  • (nil)

#constrain_toGtk::PopoverConstraint

Sets a constraint for the popover position.

Returns:

#constrain_to=(constrain_to) ⇒ Gtk::PopoverConstraint

Sets a constraint for the popover position.

Parameters:

Returns:

#default_widgetGtk::Widget

Gets the widget that should be set as the default while the popover is shown. or nil if there is none

Returns:

#default_widget=(widget) ⇒ nil

Sets the widget that should be set as default widget while the popover is shown (see gtk_window_set_default()). Gtk::Popover remembers the previous default widget and reestablishes it when the popover is dismissed.

Parameters:

  • widget (Gtk::Widget)

    the new default widget, or nil

Returns:

  • (nil)

#get_pointing_to(rect) ⇒ TrueClass

If a rectangle to point to has been set, this function will return true and fill in rect with such rectangle, otherwise it will return false and fill in rect with the attached widget coordinates.

Parameters:

  • rect (Gdk::Rectangle)

    location to store the rectangle

Returns:

  • (TrueClass)

    true if a rectangle to point to was set.

Returns whether the popover is modal, see gtk_popover_set_modal to see the implications of this.

Returns:

  • (TrueClass)

    #TRUE if popover is modal

#modal=(modal) ⇒ TrueClass

Sets whether the popover is modal (so other elements in the window do not receive input while the popover is visible).

Parameters:

  • modal (TrueClass)

Returns:

  • (TrueClass)

    modal

  • (TrueClass)

    modal

#modal?TrueClass

Sets whether the popover is modal (so other elements in the window do not receive input while the popover is visible).

Returns:

  • (TrueClass)

    modal

#new(relative_to) ⇒ Gtk::Widget

Creates a new popover to point to relative_to

Parameters:

  • relative_to (Gtk::Widget)

    Gtk::Widget the popover is related to

Returns:

#new_from_model(relative_to, model) ⇒ Gtk::Widget

Creates a Gtk::Popover and populates it according to model. The popover is pointed to the relative_to widget.

The created buttons are connected to actions found in the Gtk::ApplicationWindow to which the popover belongs - typically by means of being attached to a widget that is contained within the Gtk::ApplicationWindows widget hierarchy.

Actions can also be added using gtk_widget_insert_action_group() on the menus attach widget or on any of its parent widgets.

Parameters:

Returns:

#pointing_toGdk::Rectangle

Marks a specific rectangle to be pointed.

Returns:

  • (Gdk::Rectangle)

    pointing-to

#pointing_to=(pointing_to) ⇒ Gdk::Rectangle

Marks a specific rectangle to be pointed.

Parameters:

  • pointing_to (Gdk::Rectangle)

Returns:

  • (Gdk::Rectangle)

    pointing-to

  • (Gdk::Rectangle)

    pointing-to

#popdownnil

Pops popover down.This is different than a gtk_widget_hide() call in that it shows the popover with a transition. If you want to hide the popover without a transition, use gtk_widget_hide().

Returns:

  • (nil)

Pops popover up. This is different than a gtk_widget_show() call in that it shows the popover with a transition. If you want to show the popover without a transition, use gtk_widget_show().

Returns:

  • (nil)

#positionGtk::PositionType

Sets the preferred position of the popover.

Returns:

#position=(position) ⇒ Gtk::PositionType

Sets the preferred position of the popover.

Parameters:

Returns:

#relative_toGtk::Widget

Sets the attached widget.

Returns:

#relative_to=(relative_to) ⇒ Gtk::Widget

Sets the attached widget.

Parameters:

Returns:

#transitions_enabledTrueClass

Returns whether show/hide transitions are enabled on this popover.

Returns:

  • (TrueClass)

    #TRUE if the show and hide transitions of the given popover are enabled, #FALSE otherwise.

#transitions_enabled=(transitions_enabled) ⇒ TrueClass

Whether show/hide transitions are enabled for this popover.

Parameters:

  • transitions_enabled (TrueClass)

Returns:

  • (TrueClass)

    transitions-enabled

  • (TrueClass)

    transitions-enabled

#transitions_enabled?TrueClass

Whether show/hide transitions are enabled for this popover.

Returns:

  • (TrueClass)

    transitions-enabled