gi-gtk4-4.0.12: Gtk 4.x 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.Gtk.Objects.Viewport

Contents

- Exported types
- Methods
  - getChild
  - getScrollToFocus
  - new
  - scrollTo
  - setChild
  - setScrollToFocus
- Properties
  - child
  - scrollToFocus

Description

Implements scrollability for widgets that don't support scrolling on their own.

Use `GtkViewport` to scroll child widgets such as `GtkGrid`, `GtkBox`, and so on.

The `GtkViewport` will start scrolling content only if allocated less than the child widget’s minimum size in a given orientation.

# CSS nodes

`GtkViewport` has a single CSS node with name `viewport`.

# Accessibility

Until GTK 4.10, `GtkViewport` used the `AccessibleRoleGroup` role.

Starting from GTK 4.12, `GtkViewport` uses the `AccessibleRoleGeneric` role.

Synopsis

- newtype Viewport = Viewport (ManagedPtr Viewport)
- class (GObject o, IsDescendantOf Viewport o) => IsViewport o
- toViewport :: (MonadIO m, IsViewport o) => o -> m Viewport
- viewportGetChild :: (HasCallStack, MonadIO m, IsViewport a) => a -> m (Maybe Widget)
- viewportGetScrollToFocus :: (HasCallStack, MonadIO m, IsViewport a) => a -> m Bool
- viewportNew :: (HasCallStack, MonadIO m, IsAdjustment a, IsAdjustment b) => Maybe a -> Maybe b -> m Viewport
- viewportScrollTo :: (HasCallStack, MonadIO m, IsViewport a, IsWidget b) => a -> b -> Maybe ScrollInfo -> m ()
- viewportSetChild :: (HasCallStack, MonadIO m, IsViewport a, IsWidget b) => a -> Maybe b -> m ()
- viewportSetScrollToFocus :: (HasCallStack, MonadIO m, IsViewport a) => a -> Bool -> m ()
- clearViewportChild :: (MonadIO m, IsViewport o) => o -> m ()
- constructViewportChild :: (IsViewport o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o)
- getViewportChild :: (MonadIO m, IsViewport o) => o -> m (Maybe Widget)
- setViewportChild :: (MonadIO m, IsViewport o, IsWidget a) => o -> a -> m ()
- constructViewportScrollToFocus :: (IsViewport o, MonadIO m) => Bool -> m (GValueConstruct o)
- getViewportScrollToFocus :: (MonadIO m, IsViewport o) => o -> m Bool
- setViewportScrollToFocus :: (MonadIO m, IsViewport o) => o -> Bool -> m ()

# Exported types

newtype Viewport Source #

Memory-managed wrapper type.

Constructors

Viewport (ManagedPtr Viewport) |

#### Instances

Instances details

Eq Viewport Source # |
Instance details Defined in GI.Gtk.Objects.Viewport Methods (==) :: Viewport -> Viewport -> Bool Source # (/=) :: Viewport -> Viewport -> Bool Source #
GObject Viewport Source # |
Instance details Defined in GI.Gtk.Objects.Viewport
ManagedPtrNewtype Viewport Source # |
Instance details Defined in GI.Gtk.Objects.Viewport Methods toManagedPtr :: Viewport -> ManagedPtr Viewport Source #
TypedObject Viewport Source # |
Instance details Defined in GI.Gtk.Objects.Viewport Methods glibType :: IO GType Source #
HasParentTypes Viewport Source # |
Instance details Defined in GI.Gtk.Objects.Viewport
IsGValue (Maybe Viewport) Source # | Convert `Viewport` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.Viewport Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Viewport -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Viewport) Source #
type ParentTypes Viewport Source # |
Instance details Defined in GI.Gtk.Objects.Viewport type ParentTypes Viewport = '[Widget, Object, Accessible, Buildable, ConstraintTarget, Scrollable]

class (GObject o, IsDescendantOf Viewport o) => IsViewport o Source #

Type class for types which can be safely cast to `Viewport`, for instance with `toViewport`.

#### Instances

Instances details

(GObject o, IsDescendantOf Viewport o) => IsViewport o Source # |
Instance details Defined in GI.Gtk.Objects.Viewport

toViewport :: (MonadIO m, IsViewport o) => o -> m Viewport Source #

Cast to `Viewport`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, scrollTo, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBorder, getBounds, getBuildableId, getCanFocus, getCanTarget, getChild, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHadjustment, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getHscrollPolicy, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getScrollToFocus, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getVadjustment, getValign, getVexpand, getVexpandSet, getVisible, getVscrollPolicy, getWidth.

#### Setters

setAccessibleParent, setCanFocus, setCanTarget, setChild, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHadjustment, setHalign, setHasTooltip, setHexpand, setHexpandSet, setHscrollPolicy, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setProperty, setReceivesDefault, setScrollToFocus, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setVadjustment, setValign, setVexpand, setVexpandSet, setVisible, setVscrollPolicy.

## getChild

viewportGetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsViewport a) |
=> a | `viewport`: a `GtkViewport`
-> m (Maybe Widget) | Returns: the child widget of `viewport`

Gets the child widget of `viewport`.

## getScrollToFocus

viewportGetScrollToFocus Source #

Arguments

:: (HasCallStack, MonadIO m, IsViewport a) |
=> a | `viewport`: a `GtkViewport`
-> m Bool | Returns: `True` if the viewport keeps the focus child scrolled to view

Gets whether the viewport is scrolling to keep the focused child in view.

## new

viewportNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsAdjustment a, IsAdjustment b) |
=> Maybe a | `hadjustment`: horizontal adjustment
-> Maybe b | `vadjustment`: vertical adjustment
-> m Viewport | Returns: a new `GtkViewport`

Creates a new `GtkViewport`.

The new viewport uses the given adjustments, or default adjustments if none are given.

## scrollTo

viewportScrollTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsViewport a, IsWidget b) |
=> a | `viewport`: a `GtkViewport`
-> b | `descendant`: a descendant widget of the viewport
-> Maybe ScrollInfo | `scroll`: details of how to perform the scroll operation or NULL to scroll into view
-> m () |

Scrolls a descendant of the viewport into view.

The viewport and the descendant must be visible and mapped for this function to work, otherwise no scrolling will be performed.

Since: 4.12

## setChild

viewportSetChild Source #

Arguments

:: (HasCallStack, MonadIO m, IsViewport a, IsWidget b) |
=> a | `viewport`: a `GtkViewport`
-> Maybe b | `child`: the child widget
-> m () |

Sets the child widget of `viewport`.

## setScrollToFocus

viewportSetScrollToFocus Source #

Arguments

:: (HasCallStack, MonadIO m, IsViewport a) |
=> a | `viewport`: a `GtkViewport`
-> Bool | `scrollToFocus`: whether to keep the focus widget scrolled to view
-> m () |

Sets whether the viewport should automatically scroll to keep the focused child in view.

# Properties

## child

The child widget.

clearViewportChild :: (MonadIO m, IsViewport o) => o -> m () Source #

Set the value of the “`child`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #child

constructViewportChild :: (IsViewport o, MonadIO m, IsWidget a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`child`” property. This is rarely needed directly, but it is used by `new`.

getViewportChild :: (MonadIO m, IsViewport o) => o -> m (Maybe Widget) Source #

Get the value of the “`child`” property. When overloading is enabled, this is equivalent to

    get viewport #child

setViewportChild :: (MonadIO m, IsViewport o, IsWidget a) => o -> a -> m () Source #

Set the value of the “`child`” property. When overloading is enabled, this is equivalent to

    set viewport [ #child := value ]

## scrollToFocus

Whether to scroll when the focus changes.

Before 4.6.2, this property was mistakenly defaulting to FALSE, so if your code needs to work with older versions, consider setting it explicitly to TRUE.

constructViewportScrollToFocus :: (IsViewport o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`scroll-to-focus`” property. This is rarely needed directly, but it is used by `new`.

getViewportScrollToFocus :: (MonadIO m, IsViewport o) => o -> m Bool Source #

Get the value of the “`scroll-to-focus`” property. When overloading is enabled, this is equivalent to

    get viewport #scrollToFocus

setViewportScrollToFocus :: (MonadIO m, IsViewport o) => o -> Bool -> m () Source #

Set the value of the “`scroll-to-focus`” property. When overloading is enabled, this is equivalent to

    set viewport [ #scrollToFocus := value ]