gi-gtk-3.0.11: Gtk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.Popover

Contents

Description

GtkPopover 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 popoverNew, or updated afterwards through popoverSetRelativeTo, by default they will point to the whole widget area, although this behavior can be changed through popoverSetPointingTo.

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

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, popoverSetModal may be called on it to tweak its behavior.

GtkPopover as menu replacement

GtkPopover is often used to replace menus. To facilitate this, it supports being populated from a MenuModel, using popoverNewFromModel. 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

GtkPopover 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 popoverNewFromModel.

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

Synopsis

Exported types

Methods

bindModel

data PopoverBindModelMethodInfo Source #

Instances

((~) * signature (Maybe b -> Maybe Text -> m ()), MonadIO m, IsPopover a, IsMenuModel b) => MethodInfo * PopoverBindModelMethodInfo a signature Source # 

popoverBindModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a, IsMenuModel b) 
=> a

popover: a Popover

-> Maybe b

model: the MenuModel to bind to or Nothing to remove binding

-> Maybe Text

actionNamespace: the namespace for actions in model

-> m () 

Establishes a binding between a Popover and a MenuModel.

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 Nothing then any previous binding is undone and all children are removed.

If actionNamespace is non-Nothing 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 actionNamespace 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 widgetInsertActionGroup. 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 MenuModel.

Since: 3.12

getConstrainTo

popoverGetConstrainTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> m PopoverConstraint

Returns: the constraint for placing this popover.

Returns the constraint for placing this popover. See popoverSetConstrainTo.

Since: 3.20

getDefaultWidget

popoverGetDefaultWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> m (Maybe Widget)

Returns: the default widget, or Nothing if there is none

Gets the widget that should be set as the default while the popover is shown.

Since: 3.18

getModal

data PopoverGetModalMethodInfo Source #

Instances

((~) * signature (m Bool), MonadIO m, IsPopover a) => MethodInfo * PopoverGetModalMethodInfo a signature Source # 

popoverGetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> m Bool

Returns: TRUE if popover is modal

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

Since: 3.12

getPointingTo

popoverGetPointingTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> m (Bool, Rectangle)

Returns: True if a rectangle to point to was set.

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.

getPosition

popoverGetPosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> m PositionType

Returns: The preferred position.

Returns the preferred position of popover.

getRelativeTo

popoverGetRelativeTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> m Widget

Returns: a Widget

Returns the widget popover is currently attached to

Since: 3.12

getTransitionsEnabled

popoverGetTransitionsEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> m Bool

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

Deprecated: (Since version 3.22)You can show or hide the popover without transitions using widgetShow and widgetHide while popoverPopup and popoverPopdown will use transitions.

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

Since: 3.16

new

popoverNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a) 
=> Maybe a

relativeTo: Widget the popover is related to

-> m Popover

Returns: a new Popover

Creates a new popover to point to relativeTo

Since: 3.12

newFromModel

popoverNewFromModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsWidget a, IsMenuModel b) 
=> Maybe a

relativeTo: Widget the popover is related to

-> b

model: a MenuModel

-> m Popover

Returns: the new Popover

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

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

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

Since: 3.12

popdown

data PopoverPopdownMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsPopover a) => MethodInfo * PopoverPopdownMethodInfo a signature Source # 

popoverPopdown Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> m () 

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

Since: 3.22

popup

data PopoverPopupMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsPopover a) => MethodInfo * PopoverPopupMethodInfo a signature Source # 

popoverPopup Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> m () 

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

Since: 3.22

setConstrainTo

popoverSetConstrainTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> PopoverConstraint

constraint: the new constraint

-> m () 

Sets a constraint for positioning this popover.

Note that not all platforms support placing popovers freely, and may already impose constraints.

Since: 3.20

setDefaultWidget

popoverSetDefaultWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a, IsWidget b) 
=> a

popover: a Popover

-> Maybe b

widget: the new default widget, or Nothing

-> m () 

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

Since: 3.18

setModal

data PopoverSetModalMethodInfo Source #

Instances

((~) * signature (Bool -> m ()), MonadIO m, IsPopover a) => MethodInfo * PopoverSetModalMethodInfo a signature Source # 

popoverSetModal Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> Bool

modal: TRUE to make popover claim all input within the toplevel

-> m () 

Sets whether popover is modal, a modal popover will grab all input within the toplevel and grab the keyboard focus on it when being displayed. Clicking outside the popover area or pressing Esc will dismiss the popover and ungrab input.

Since: 3.12

setPointingTo

popoverSetPointingTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> Rectangle

rect: rectangle to point to

-> m () 

Sets the rectangle that popover will point to, in the coordinate space of the widget popover is attached to, see popoverSetRelativeTo.

Since: 3.12

setPosition

popoverSetPosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> PositionType

position: preferred popover position

-> m () 

Sets the preferred position for popover to appear. If the popover 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

Since: 3.12

setRelativeTo

popoverSetRelativeTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a, IsWidget b) 
=> a

popover: a Popover

-> Maybe b

relativeTo: a Widget

-> m () 

Sets a new widget to be attached to popover. If popover is visible, the position will be updated.

Note: the ownership of popovers is always given to their relativeTo widget, so if relativeTo is set to Nothing on an attached popover, it will be detached from its previous widget, and consequently destroyed unless extra references are kept.

Since: 3.12

setTransitionsEnabled

popoverSetTransitionsEnabled Source #

Arguments

:: (HasCallStack, MonadIO m, IsPopover a) 
=> a

popover: a Popover

-> Bool

transitionsEnabled: Whether transitions are enabled

-> m () 

Deprecated: (Since version 3.22)You can show or hide the popover without transitions using widgetShow and widgetHide while popoverPopup and popoverPopdown will use transitions.

Sets whether show/hide transitions are enabled on this popover

Since: 3.16

Properties

constrainTo

data PopoverConstrainToPropertyInfo Source #

Instances

AttrInfo PopoverConstrainToPropertyInfo Source # 
type AttrOrigin PopoverConstrainToPropertyInfo Source # 
type AttrLabel PopoverConstrainToPropertyInfo Source # 
type AttrGetType PopoverConstrainToPropertyInfo Source # 
type AttrBaseTypeConstraint PopoverConstrainToPropertyInfo Source # 
type AttrSetTypeConstraint PopoverConstrainToPropertyInfo Source # 
type AttrAllowedOps PopoverConstrainToPropertyInfo Source # 

modal

data PopoverModalPropertyInfo Source #

Instances

AttrInfo PopoverModalPropertyInfo Source # 
type AttrOrigin PopoverModalPropertyInfo Source # 
type AttrLabel PopoverModalPropertyInfo Source # 
type AttrGetType PopoverModalPropertyInfo Source # 
type AttrBaseTypeConstraint PopoverModalPropertyInfo Source # 
type AttrSetTypeConstraint PopoverModalPropertyInfo Source # 
type AttrAllowedOps PopoverModalPropertyInfo Source # 

setPopoverModal :: (MonadIO m, IsPopover o) => o -> Bool -> m () Source #

pointingTo

data PopoverPointingToPropertyInfo Source #

Instances

AttrInfo PopoverPointingToPropertyInfo Source # 
type AttrOrigin PopoverPointingToPropertyInfo Source # 
type AttrLabel PopoverPointingToPropertyInfo Source # 
type AttrGetType PopoverPointingToPropertyInfo Source # 
type AttrBaseTypeConstraint PopoverPointingToPropertyInfo Source # 
type AttrSetTypeConstraint PopoverPointingToPropertyInfo Source # 
type AttrAllowedOps PopoverPointingToPropertyInfo Source # 

position

data PopoverPositionPropertyInfo Source #

Instances

AttrInfo PopoverPositionPropertyInfo Source # 
type AttrOrigin PopoverPositionPropertyInfo Source # 
type AttrLabel PopoverPositionPropertyInfo Source # 
type AttrGetType PopoverPositionPropertyInfo Source # 
type AttrBaseTypeConstraint PopoverPositionPropertyInfo Source # 
type AttrSetTypeConstraint PopoverPositionPropertyInfo Source # 
type AttrAllowedOps PopoverPositionPropertyInfo Source # 

relativeTo

data PopoverRelativeToPropertyInfo Source #

Instances

AttrInfo PopoverRelativeToPropertyInfo Source # 
type AttrOrigin PopoverRelativeToPropertyInfo Source # 
type AttrLabel PopoverRelativeToPropertyInfo Source # 
type AttrGetType PopoverRelativeToPropertyInfo Source # 
type AttrBaseTypeConstraint PopoverRelativeToPropertyInfo Source # 
type AttrSetTypeConstraint PopoverRelativeToPropertyInfo Source # 
type AttrAllowedOps PopoverRelativeToPropertyInfo Source # 

setPopoverRelativeTo :: (MonadIO m, IsPopover o, IsWidget a) => o -> a -> m () Source #

transitionsEnabled

data PopoverTransitionsEnabledPropertyInfo Source #

Instances

AttrInfo PopoverTransitionsEnabledPropertyInfo Source # 
type AttrOrigin PopoverTransitionsEnabledPropertyInfo Source # 
type AttrLabel PopoverTransitionsEnabledPropertyInfo Source # 
type AttrGetType PopoverTransitionsEnabledPropertyInfo Source # 
type AttrBaseTypeConstraint PopoverTransitionsEnabledPropertyInfo Source # 
type AttrSetTypeConstraint PopoverTransitionsEnabledPropertyInfo Source # 
type AttrAllowedOps PopoverTransitionsEnabledPropertyInfo Source # 

Signals

closed

type C_PopoverClosedCallback = Ptr () -> Ptr () -> IO () Source #