Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
The Viewport
widget acts as an adaptor class, implementing
scrollability for child widgets that lack their own scrolling
capabilities. Use GtkViewport to scroll child widgets such as
Grid
, Box
, and so on.
If a widget has native scrolling abilities, such as TextView
,
TreeView
or IconView
, it can be added to a ScrolledWindow
with gtk_container_add()
. If a widget does not, you must first add the
widget to a Viewport
, then add the viewport to the scrolled window.
gtk_container_add()
does this automatically if a child that does not
implement Scrollable
is added to a ScrolledWindow
, so you can
ignore the presence of the viewport.
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.
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
- 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
Memory-managed wrapper type.
Instances
Eq Viewport Source # | |
IsGValue Viewport Source # | Convert |
ManagedPtrNewtype Viewport Source # | |
Defined in GI.Gtk.Objects.Viewport toManagedPtr :: Viewport -> ManagedPtr Viewport # | |
TypedObject Viewport Source # | |
Defined in GI.Gtk.Objects.Viewport | |
GObject Viewport Source # | |
Defined in GI.Gtk.Objects.Viewport | |
HasParentTypes Viewport Source # | |
Defined in GI.Gtk.Objects.Viewport | |
type ParentTypes Viewport Source # | |
Defined in GI.Gtk.Objects.Viewport type ParentTypes Viewport = '[Widget, Object, ImplementorIface, 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
(GObject o, IsDescendantOf Viewport o) => IsViewport o Source # | |
Defined in GI.Gtk.Objects.Viewport |
toViewport :: (MonadIO m, IsViewport o) => o -> m Viewport Source #
Methods
Overloaded methods
getChild
:: (HasCallStack, MonadIO m, IsViewport a) | |
=> a |
|
-> m (Maybe Widget) | Returns: the child widget of |
Gets the child widget of viewport
.
getScrollToFocus
viewportGetScrollToFocus Source #
:: (HasCallStack, MonadIO m, IsViewport a) | |
=> a |
|
-> m Bool | Returns: |
Gets whether the viewport is scrolling to keep the focused
child in view. See viewportSetScrollToFocus
.
new
:: (HasCallStack, MonadIO m, IsAdjustment a, IsAdjustment b) | |
=> Maybe a |
|
-> Maybe b |
|
-> m Viewport | Returns: a new |
Creates a new Viewport
with the given adjustments, or with default
adjustments if none are given.
setChild
:: (HasCallStack, MonadIO m, IsViewport a, IsWidget b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the child widget of viewport
.
setScrollToFocus
viewportSetScrollToFocus Source #
:: (HasCallStack, MonadIO m, IsViewport a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the viewport should automatically scroll to keep the focused child in view.
Properties
child
No description available in the introspection data.
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
No description available in the introspection data.
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 ]