gi-gdk-4.0.3: Gdk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gdk.Structs.PopupLayout

Description

Popups are positioned relative to their parent surface. The GdkPopupLayout struct contains information that is necessary to do so.

The positioning requires a negotiation with the windowing system, since it depends on external constraints, such as the position of the parent surface, and the screen dimensions.

The basic ingredients are a rectangle on the parent surface, and the anchor on both that rectangle and the popup. The anchors specify a side or corner to place next to each other.

For cases where placing the anchors next to each other would make the popup extend offscreen, the layout includes some hints for how to resolve this problem. The hints may suggest to flip the anchor position to the other side, or to 'slide' the popup along a side, or to resize it.

These hints may be combined.

Ultimatively, it is up to the windowing system to determine the position and size of the popup. You can learn about the result by calling popupGetPositionX, popupGetPositionY, popupGetRectAnchor and popupGetSurfaceAnchor after the popup has been presented. This can be used to adjust the rendering. For example, GtkPopover changes its arrow position accordingly. But you have to be careful avoid changing the size of the popover, or it has to be presented again.

Synopsis

Exported types

newtype PopupLayout Source #

Memory-managed wrapper type.

Constructors

PopupLayout (ManagedPtr PopupLayout) 

Instances

Instances details
Eq PopupLayout Source # 
Instance details

Defined in GI.Gdk.Structs.PopupLayout

GBoxed PopupLayout Source # 
Instance details

Defined in GI.Gdk.Structs.PopupLayout

ManagedPtrNewtype PopupLayout Source # 
Instance details

Defined in GI.Gdk.Structs.PopupLayout

Methods

toManagedPtr :: PopupLayout -> ManagedPtr PopupLayout

TypedObject PopupLayout Source # 
Instance details

Defined in GI.Gdk.Structs.PopupLayout

Methods

glibType :: IO GType

HasParentTypes PopupLayout Source # 
Instance details

Defined in GI.Gdk.Structs.PopupLayout

IsGValue (Maybe PopupLayout) Source #

Convert PopupLayout to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gdk.Structs.PopupLayout

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe PopupLayout -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe PopupLayout)

type ParentTypes PopupLayout Source # 
Instance details

Defined in GI.Gdk.Structs.PopupLayout

type ParentTypes PopupLayout = '[] :: [Type]

Methods

Click to display all available methods, including inherited ones

Expand

Methods

copy, equal, ref, unref.

Getters

getAnchorHints, getAnchorRect, getOffset, getRectAnchor, getSurfaceAnchor.

Setters

setAnchorHints, setAnchorRect, setOffset, setRectAnchor, setSurfaceAnchor.

copy

popupLayoutCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> m PopupLayout

Returns: a copy of layout.

Create a new PopupLayout and copy the contents of layout into it.

equal

popupLayoutEqual Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> PopupLayout

other: another PopupLayout

-> m Bool

Returns: True if layout and other have identical layout properties, otherwise False.

Check whether layout and other has identical layout properties.

getAnchorHints

getAnchorRect

popupLayoutGetAnchorRect Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> m Rectangle

Returns: The anchor rectangle.

Get the anchor rectangle.

getOffset

popupLayoutGetOffset Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> m (Int32, Int32) 

Retrieves the offset for the anchor rectangle.

getRectAnchor

popupLayoutGetRectAnchor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> m Gravity

Returns: the anchor on the anchor rectangle.

Returns the anchor position on the anchor rectangle.

getSurfaceAnchor

popupLayoutGetSurfaceAnchor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> m Gravity

Returns: the anchor on the popup surface.

Returns the anchor position on the popup surface.

new

popupLayoutNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Rectangle

anchorRect: the anchor Rectangle to align surface with

-> Gravity

rectAnchor: the point on anchorRect to align with surface's anchor point

-> Gravity

surfaceAnchor: the point on surface to align with rect's anchor point

-> m PopupLayout

Returns: newly created instance of PopupLayout

Create a popup layout description. Used together with popupPresent to describe how a popup surface should be placed and behave on-screen.

anchorRect is relative to the top-left corner of the surface's parent. rectAnchor and surfaceAnchor determine anchor points on anchorRect and surface to pin together.

The position of anchorRect's anchor point can optionally be offset using popupLayoutSetOffset, which is equivalent to offsetting the position of surface.

ref

popupLayoutRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> m PopupLayout

Returns: the same layout

Increases the reference count of value.

setAnchorHints

popupLayoutSetAnchorHints Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> [AnchorHints]

anchorHints: the new AnchorHints

-> m () 

Set new anchor hints.

The set anchorHints determines how surface will be moved if the anchor points cause it to move off-screen. For example, AnchorHintsFlipX will replace GravityNorthWest with GravityNorthEast and vice versa if surface extends beyond the left or right edges of the monitor.

setAnchorRect

popupLayoutSetAnchorRect Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> Rectangle

anchorRect: the new anchor rectangle

-> m () 

Set the anchor rectangle.

setOffset

popupLayoutSetOffset Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> Int32

dx: x delta to offset the anchor rectangle with

-> Int32

dy: y delta to offset the anchor rectangle with

-> m () 

Offset the position of the anchor rectangle with the given delta.

setRectAnchor

popupLayoutSetRectAnchor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> Gravity

anchor: the new rect anchor

-> m () 

Set the anchor on the anchor rectangle.

setSurfaceAnchor

popupLayoutSetSurfaceAnchor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> Gravity

anchor: the new popup surface anchor

-> m () 

Set the anchor on the popup surface.

unref

popupLayoutUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> PopupLayout

layout: a PopupLayout

-> m () 

Decreases the reference count of value.