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.SliceListModel

Contents

- Exported types
- Methods
  - getModel
  - getOffset
  - getSize
  - new
  - setModel
  - setOffset
  - setSize
- Properties
  - itemType
  - model
  - nItems
  - offset
  - size

Description

A list model that presents a slice of another model.

This is useful when implementing paging by setting the size to the number of elements per page and updating the offset whenever a different page is opened.

`GtkSliceListModel` passes through sections from the underlying model.

Synopsis

- newtype SliceListModel = SliceListModel (ManagedPtr SliceListModel)
- class (GObject o, IsDescendantOf SliceListModel o) => IsSliceListModel o
- toSliceListModel :: (MonadIO m, IsSliceListModel o) => o -> m SliceListModel
- sliceListModelGetModel :: (HasCallStack, MonadIO m, IsSliceListModel a) => a -> m (Maybe ListModel)
- sliceListModelGetOffset :: (HasCallStack, MonadIO m, IsSliceListModel a) => a -> m Word32
- sliceListModelGetSize :: (HasCallStack, MonadIO m, IsSliceListModel a) => a -> m Word32
- sliceListModelNew :: (HasCallStack, MonadIO m, IsListModel a) => Maybe a -> Word32 -> Word32 -> m SliceListModel
- sliceListModelSetModel :: (HasCallStack, MonadIO m, IsSliceListModel a, IsListModel b) => a -> Maybe b -> m ()
- sliceListModelSetOffset :: (HasCallStack, MonadIO m, IsSliceListModel a) => a -> Word32 -> m ()
- sliceListModelSetSize :: (HasCallStack, MonadIO m, IsSliceListModel a) => a -> Word32 -> m ()
- getSliceListModelItemType :: (MonadIO m, IsSliceListModel o) => o -> m GType
- clearSliceListModelModel :: (MonadIO m, IsSliceListModel o) => o -> m ()
- constructSliceListModelModel :: (IsSliceListModel o, MonadIO m, IsListModel a) => a -> m (GValueConstruct o)
- getSliceListModelModel :: (MonadIO m, IsSliceListModel o) => o -> m (Maybe ListModel)
- setSliceListModelModel :: (MonadIO m, IsSliceListModel o, IsListModel a) => o -> a -> m ()
- getSliceListModelNItems :: (MonadIO m, IsSliceListModel o) => o -> m Word32
- constructSliceListModelOffset :: (IsSliceListModel o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getSliceListModelOffset :: (MonadIO m, IsSliceListModel o) => o -> m Word32
- setSliceListModelOffset :: (MonadIO m, IsSliceListModel o) => o -> Word32 -> m ()
- constructSliceListModelSize :: (IsSliceListModel o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getSliceListModelSize :: (MonadIO m, IsSliceListModel o) => o -> m Word32
- setSliceListModelSize :: (MonadIO m, IsSliceListModel o) => o -> Word32 -> m ()

# Exported types

newtype SliceListModel Source #

Memory-managed wrapper type.

Constructors

SliceListModel (ManagedPtr SliceListModel) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf SliceListModel o) => IsSliceListModel o Source #

Type class for types which can be safely cast to `SliceListModel`, for instance with `toSliceListModel`.

#### Instances

Instances details

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

toSliceListModel :: (MonadIO m, IsSliceListModel o) => o -> m SliceListModel Source #

Cast to `SliceListModel`, 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

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, itemsChanged, notify, notifyByPspec, ref, refSink, runDispose, sectionsChanged, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getData, getItem, getItemType, getModel, getNItems, getOffset, getProperty, getQdata, getSection, getSize.

#### Setters

setData, setDataFull, setModel, setOffset, setProperty, setSize.

## getModel

sliceListModelGetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsSliceListModel a) |
=> a | `self`: a `GtkSliceListModel`
-> m (Maybe ListModel) | Returns: The model in use

Gets the model that is currently being used or `Nothing` if none.

## getOffset

sliceListModelGetOffset Source #

Arguments

:: (HasCallStack, MonadIO m, IsSliceListModel a) |
=> a | `self`: a `GtkSliceListModel`
-> m Word32 | Returns: The offset

Gets the offset set via `sliceListModelSetOffset`.

## getSize

sliceListModelGetSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsSliceListModel a) |
=> a | `self`: a `GtkSliceListModel`
-> m Word32 | Returns: The size

Gets the size set via `sliceListModelSetSize`.

## new

sliceListModelNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsListModel a) |
=> Maybe a | `model`: The model to use
-> Word32 | `offset`: the offset of the slice
-> Word32 | `size`: maximum size of the slice
-> m SliceListModel | Returns: A new `GtkSliceListModel`

Creates a new slice model.

It presents the slice from `offset` to offset + `size` of the given `model`.

## setModel

sliceListModelSetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsSliceListModel a, IsListModel b) |
=> a | `self`: a `GtkSliceListModel`
-> Maybe b | `model`: The model to be sliced
-> m () |

Sets the model to show a slice of.

The model's item type must conform to `self`'s item type.

## setOffset

sliceListModelSetOffset Source #

Arguments

:: (HasCallStack, MonadIO m, IsSliceListModel a) |
=> a | `self`: a `GtkSliceListModel`
-> Word32 | `offset`: the new offset to use
-> m () |

Sets the offset into the original model for this slice.

If the offset is too large for the sliced model, `self` will end up empty.

## setSize

sliceListModelSetSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsSliceListModel a) |
=> a | `self`: a `GtkSliceListModel`
-> Word32 | `size`: the maximum size
-> m () |

Sets the maximum size. `self` will never have more items than `size`.

It can however have fewer items if the offset is too large or the model sliced from doesn't have enough items.

# Properties

## itemType

The type of items. See `listModelGetItemType`.

Since: 4.8

getSliceListModelItemType :: (MonadIO m, IsSliceListModel o) => o -> m GType Source #

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

    get sliceListModel #itemType

## model

Child model to take slice from.

clearSliceListModelModel :: (MonadIO m, IsSliceListModel o) => o -> m () Source #

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

    clear #model

constructSliceListModelModel :: (IsSliceListModel o, MonadIO m, IsListModel a) => a -> m (GValueConstruct o) Source #

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

getSliceListModelModel :: (MonadIO m, IsSliceListModel o) => o -> m (Maybe ListModel) Source #

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

    get sliceListModel #model

setSliceListModelModel :: (MonadIO m, IsSliceListModel o, IsListModel a) => o -> a -> m () Source #

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

    set sliceListModel [ #model := value ]

## nItems

The number of items. See `listModelGetNItems`.

Since: 4.8

getSliceListModelNItems :: (MonadIO m, IsSliceListModel o) => o -> m Word32 Source #

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

    get sliceListModel #nItems

## offset

Offset of slice.

constructSliceListModelOffset :: (IsSliceListModel o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

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

getSliceListModelOffset :: (MonadIO m, IsSliceListModel o) => o -> m Word32 Source #

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

    get sliceListModel #offset

setSliceListModelOffset :: (MonadIO m, IsSliceListModel o) => o -> Word32 -> m () Source #

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

    set sliceListModel [ #offset := value ]

## size

Maximum size of slice.

constructSliceListModelSize :: (IsSliceListModel o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #

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

getSliceListModelSize :: (MonadIO m, IsSliceListModel o) => o -> m Word32 Source #

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

    get sliceListModel #size

setSliceListModelSize :: (MonadIO m, IsSliceListModel o) => o -> Word32 -> m () Source #

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

    set sliceListModel [ #size := value ]