Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
The GdkPopupLayout
struct 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.
Instances
Eq PopupLayout Source # | |
Defined in GI.Gdk.Structs.PopupLayout (==) :: PopupLayout -> PopupLayout -> Bool # (/=) :: PopupLayout -> PopupLayout -> Bool # | |
GBoxed PopupLayout Source # | |
Defined in GI.Gdk.Structs.PopupLayout | |
ManagedPtrNewtype PopupLayout Source # | |
Defined in GI.Gdk.Structs.PopupLayout | |
TypedObject PopupLayout Source # | |
Defined in GI.Gdk.Structs.PopupLayout | |
HasParentTypes PopupLayout Source # | |
Defined in GI.Gdk.Structs.PopupLayout | |
IsGValue (Maybe PopupLayout) Source # | Convert |
Defined in GI.Gdk.Structs.PopupLayout gvalueGType_ :: IO GType # gvalueSet_ :: Ptr GValue -> Maybe PopupLayout -> IO () # gvalueGet_ :: Ptr GValue -> IO (Maybe PopupLayout) # | |
type ParentTypes PopupLayout Source # | |
Defined in GI.Gdk.Structs.PopupLayout |
Methods
Click to display all available methods, including inherited ones
Methods
Getters
getAnchorHints, getAnchorRect, getOffset, getRectAnchor, getShadowWidth, getSurfaceAnchor.
Setters
setAnchorHints, setAnchorRect, setOffset, setRectAnchor, setShadowWidth, setSurfaceAnchor.
copy
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> m PopupLayout | Returns: a copy of |
Makes a copy of layout
.
equal
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> PopupLayout |
|
-> m Bool | Returns: |
Check whether layout
and other
has identical layout properties.
getAnchorHints
popupLayoutGetAnchorHints Source #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> m [AnchorHints] | Returns: the |
Get the GdkAnchorHints
.
getAnchorRect
popupLayoutGetAnchorRect Source #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> m Rectangle | Returns: The anchor rectangle |
Get the anchor rectangle.
getOffset
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> m (Int32, Int32) |
Retrieves the offset for the anchor rectangle.
getRectAnchor
popupLayoutGetRectAnchor Source #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> m Gravity | Returns: the anchor on the anchor rectangle. |
Returns the anchor position on the anchor rectangle.
getShadowWidth
popupLayoutGetShadowWidth Source #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> m (Int32, Int32, Int32, Int32) |
Obtains the shadow widths of this layout.
Since: 4.2
getSurfaceAnchor
popupLayoutGetSurfaceAnchor Source #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> m Gravity | Returns: the anchor on the popup surface. |
Returns the anchor position on the popup surface.
new
:: (HasCallStack, MonadIO m) | |
=> Rectangle |
|
-> Gravity |
|
-> Gravity |
|
-> m PopupLayout | Returns: newly created instance of |
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
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> m PopupLayout | Returns: the same |
Increases the reference count of value
.
setAnchorHints
popupLayoutSetAnchorHints Source #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> [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 #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> Rectangle |
|
-> m () |
Set the anchor rectangle.
setOffset
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> Int32 |
|
-> Int32 |
|
-> m () |
Offset the position of the anchor rectangle with the given delta.
setRectAnchor
popupLayoutSetRectAnchor Source #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> Gravity |
|
-> m () |
Set the anchor on the anchor rectangle.
setShadowWidth
popupLayoutSetShadowWidth Source #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> 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 #
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> Gravity |
|
-> m () |
Set the anchor on the popup surface.
unref
:: (HasCallStack, MonadIO m) | |
=> PopupLayout |
|
-> m () |
Decreases the reference count of value
.