gi-gtk-4.0.1: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.SortListModel

Description

SortListModel is a list model that takes a list model and sorts its elements according to a compare function.

SortListModel is a generic model and because of that it cannot take advantage of any external knowledge when sorting. If you run into performance issues with SortListModel, it is strongly recommended that you write your own sorting list model.

Synopsis

Exported types

class (GObject o, IsDescendantOf SortListModel o) => IsSortListModel o Source #

Type class for types which can be safely cast to SortListModel, for instance with toSortListModel.

Instances

Instances details
(GObject o, IsDescendantOf SortListModel o) => IsSortListModel o Source # 
Instance details

Defined in GI.Gtk.Objects.SortListModel

toSortListModel :: (MonadIO m, IsSortListModel o) => o -> m SortListModel Source #

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

Methods

Overloaded methods

getModel

sortListModelGetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsSortListModel a) 
=> a

self: a SortListModel

-> m (Maybe ListModel)

Returns: The model that gets sorted

Gets the model currently sorted or Nothing if none.

hasSort

sortListModelHasSort Source #

Arguments

:: (HasCallStack, MonadIO m, IsSortListModel a) 
=> a

self: a SortListModel

-> m Bool

Returns: True if a sort function is set

Checks if a sort function is currently set on self

new

sortListModelNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsListModel a) 
=> a

model: the model to sort

-> Maybe CompareDataFunc

sortFunc: sort function or Nothing to not sort items

-> m SortListModel

Returns: a new SortListModel

Creates a new sort list model that uses the sortFunc to sort model.

newForType

sortListModelNewForType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GType

itemType: the type of the items that will be returned

-> m SortListModel

Returns: a new SortListModel

Creates a new empty sort list model set up to return items of type itemType. It is up to the application to set a proper sort function and model to ensure the item type is matched.

resort

sortListModelResort Source #

Arguments

:: (HasCallStack, MonadIO m, IsSortListModel a) 
=> a

self: a SortListModel

-> m () 

Causes self to resort all items in the model.

Calling this function is necessary when data used by the sort function has changed.

setModel

sortListModelSetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsSortListModel a, IsListModel b) 
=> a

self: a SortListModel

-> Maybe b

model: The model to be sorted

-> m () 

Sets the model to be sorted. The model's item type must conform to the item type of self.

setSortFunc

sortListModelSetSortFunc Source #

Arguments

:: (HasCallStack, MonadIO m, IsSortListModel a) 
=> a

self: a SortListModel

-> Maybe CompareDataFunc

sortFunc: sort function or Nothing to not sort items

-> m () 

Sets the function used to sort items. The function will be called for every item and must return an integer less than, equal to, or greater than zero if for two items from the model if the first item is considered to be respectively less than, equal to, or greater than the second.

Properties

hasSort

If a sort function is set for this model

getSortListModelHasSort :: (MonadIO m, IsSortListModel o) => o -> m Bool Source #

Get the value of the “has-sort” property. When overloading is enabled, this is equivalent to

get sortListModel #hasSort

itemType

The GType for items of this model

constructSortListModelItemType :: IsSortListModel o => GType -> IO (GValueConstruct o) Source #

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

getSortListModelItemType :: (MonadIO m, IsSortListModel o) => o -> m GType Source #

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

get sortListModel #itemType

model

The model being sorted

constructSortListModelModel :: (IsSortListModel o, IsListModel a) => a -> IO (GValueConstruct o) Source #

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

getSortListModelModel :: (MonadIO m, IsSortListModel o) => o -> m (Maybe ListModel) Source #

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

get sortListModel #model