gi-gdk4-4.0.10: Gdk bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gdk.Structs.PopupLayout

Contents

- Exported types
- Methods
  - copy
  - equal
  - getAnchorHints
  - getAnchorRect
  - getOffset
  - getRectAnchor
  - getShadowWidth
  - getSurfaceAnchor
  - new
  - ref
  - setAnchorHints
  - setAnchorRect
  - setOffset
  - setRectAnchor
  - setShadowWidth
  - setSurfaceAnchor
  - unref

Description

Contains information that is necessary position a `Popup` relative to its parent.

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

- newtype PopupLayout = PopupLayout (ManagedPtr PopupLayout)
- popupLayoutCopy :: (HasCallStack, MonadIO m) => PopupLayout -> m PopupLayout
- popupLayoutEqual :: (HasCallStack, MonadIO m) => PopupLayout -> PopupLayout -> m Bool
- popupLayoutGetAnchorHints :: (HasCallStack, MonadIO m) => PopupLayout -> m [AnchorHints]
- popupLayoutGetAnchorRect :: (HasCallStack, MonadIO m) => PopupLayout -> m Rectangle
- popupLayoutGetOffset :: (HasCallStack, MonadIO m) => PopupLayout -> m (Int32, Int32)
- popupLayoutGetRectAnchor :: (HasCallStack, MonadIO m) => PopupLayout -> m Gravity
- popupLayoutGetShadowWidth :: (HasCallStack, MonadIO m) => PopupLayout -> m (Int32, Int32, Int32, Int32)
- popupLayoutGetSurfaceAnchor :: (HasCallStack, MonadIO m) => PopupLayout -> m Gravity
- popupLayoutNew :: (HasCallStack, MonadIO m) => Rectangle -> Gravity -> Gravity -> m PopupLayout
- popupLayoutRef :: (HasCallStack, MonadIO m) => PopupLayout -> m PopupLayout
- popupLayoutSetAnchorHints :: (HasCallStack, MonadIO m) => PopupLayout -> [AnchorHints] -> m ()
- popupLayoutSetAnchorRect :: (HasCallStack, MonadIO m) => PopupLayout -> Rectangle -> m ()
- popupLayoutSetOffset :: (HasCallStack, MonadIO m) => PopupLayout -> Int32 -> Int32 -> m ()
- popupLayoutSetRectAnchor :: (HasCallStack, MonadIO m) => PopupLayout -> Gravity -> m ()
- popupLayoutSetShadowWidth :: (HasCallStack, MonadIO m) => PopupLayout -> Int32 -> Int32 -> Int32 -> Int32 -> m ()
- popupLayoutSetSurfaceAnchor :: (HasCallStack, MonadIO m) => PopupLayout -> Gravity -> m ()
- popupLayoutUnref :: (HasCallStack, MonadIO m) => PopupLayout -> m ()

# 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 Methods (==) :: PopupLayout -> PopupLayout -> Bool Source # (/=) :: PopupLayout -> PopupLayout -> Bool Source #
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 Source #
TypedObject PopupLayout Source # |
Instance details Defined in GI.Gdk.Structs.PopupLayout Methods glibType :: IO GType Source #
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 Source # gvalueSet_ :: Ptr GValue -> Maybe PopupLayout -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe PopupLayout) Source #
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, getShadowWidth, getSurfaceAnchor.

#### Setters

setAnchorHints, setAnchorRect, setOffset, setRectAnchor, setShadowWidth, setSurfaceAnchor.

## copy

popupLayoutCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> m PopupLayout | Returns: a copy of `layout`.

Makes a copy of `layout`.

## equal

popupLayoutEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> PopupLayout | `other`: another popup layout
-> m Bool | Returns: true if `layout` and `other` have identical layout properties, otherwise false.

Check whether `layout` and `other` has identical layout properties.

## getAnchorHints

popupLayoutGetAnchorHints Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> m [AnchorHints] | Returns: the anchor hints

Get the anchor hints.

## getAnchorRect

popupLayoutGetAnchorRect Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> m Rectangle | Returns: The anchor rectangle

Get the anchor rectangle.

## getOffset

popupLayoutGetOffset Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> m (Int32, Int32) |

Retrieves the offset for the anchor rectangle.

## getRectAnchor

popupLayoutGetRectAnchor Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> m Gravity | Returns: the anchor on the anchor rectangle.

Returns the anchor position on the anchor rectangle.

## getShadowWidth

popupLayoutGetShadowWidth Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> m (Int32, Int32, Int32, Int32) |

Obtains the shadow widths of this layout.

Since: 4.2

## getSurfaceAnchor

popupLayoutGetSurfaceAnchor Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> 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 `GdkPopupLayout`

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 popup layout
-> m PopupLayout | Returns: the same `layout`

Increases the reference count of `value`.

## setAnchorHints

popupLayoutSetAnchorHints Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> [AnchorHints] | `anchorHints`: the new anchor hints
-> 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, `GDK_ANCHOR_FLIP_X` will replace `GDK_GRAVITY_NORTH_WEST` with `GDK_GRAVITY_NORTH_EAST` 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 popup layout
-> Rectangle | `anchorRect`: the new anchor rectangle
-> m () |

Set the anchor rectangle.

## setOffset

popupLayoutSetOffset Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> 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 popup layout
-> Gravity | `anchor`: the new rect anchor
-> m () |

Set the anchor on the anchor rectangle.

## setShadowWidth

popupLayoutSetShadowWidth Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> Int32 | `left`: width of the left part of the shadow
-> Int32 | `right`: width of the right part of the shadow
-> Int32 | `top`: height of the top part of the shadow
-> Int32 | `bottom`: height of the bottom part of the shadow
-> m () |

Sets the shadow width of the popup.

The shadow width corresponds to the part of the computed surface size that would consist of the shadow margin surrounding the window, would there be any.

Since: 4.2

## setSurfaceAnchor

popupLayoutSetSurfaceAnchor Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> PopupLayout | `layout`: a popup layout
-> 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 popup layout
-> m () |

Decreases the reference count of `value`.