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 |
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
- newtype SortListModel = SortListModel (ManagedPtr SortListModel)
- class (GObject o, IsDescendantOf SortListModel o) => IsSortListModel o
- toSortListModel :: (MonadIO m, IsSortListModel o) => o -> m SortListModel
- noSortListModel :: Maybe SortListModel
- sortListModelGetModel :: (HasCallStack, MonadIO m, IsSortListModel a) => a -> m (Maybe ListModel)
- sortListModelHasSort :: (HasCallStack, MonadIO m, IsSortListModel a) => a -> m Bool
- sortListModelNew :: (HasCallStack, MonadIO m, IsListModel a) => a -> Maybe CompareDataFunc -> m SortListModel
- sortListModelNewForType :: (HasCallStack, MonadIO m) => GType -> m SortListModel
- sortListModelResort :: (HasCallStack, MonadIO m, IsSortListModel a) => a -> m ()
- sortListModelSetModel :: (HasCallStack, MonadIO m, IsSortListModel a, IsListModel b) => a -> Maybe b -> m ()
- sortListModelSetSortFunc :: (HasCallStack, MonadIO m, IsSortListModel a) => a -> Maybe CompareDataFunc -> m ()
- getSortListModelHasSort :: (MonadIO m, IsSortListModel o) => o -> m Bool
- constructSortListModelItemType :: IsSortListModel o => GType -> IO (GValueConstruct o)
- getSortListModelItemType :: (MonadIO m, IsSortListModel o) => o -> m GType
- constructSortListModelModel :: (IsSortListModel o, IsListModel a) => a -> IO (GValueConstruct o)
- getSortListModelModel :: (MonadIO m, IsSortListModel o) => o -> m (Maybe ListModel)
Exported types
newtype SortListModel Source #
Memory-managed wrapper type.
Instances
Eq SortListModel Source # | |
Defined in GI.Gtk.Objects.SortListModel (==) :: SortListModel -> SortListModel -> Bool # (/=) :: SortListModel -> SortListModel -> Bool # | |
IsGValue SortListModel Source # | Convert |
Defined in GI.Gtk.Objects.SortListModel toGValue :: SortListModel -> IO GValue # fromGValue :: GValue -> IO SortListModel # | |
GObject SortListModel Source # | |
Defined in GI.Gtk.Objects.SortListModel gobjectType :: IO GType # | |
HasParentTypes SortListModel Source # | |
Defined in GI.Gtk.Objects.SortListModel | |
type ParentTypes SortListModel Source # | |
Defined in GI.Gtk.Objects.SortListModel |
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
(GObject o, IsDescendantOf SortListModel o) => IsSortListModel o Source # | |
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
.
noSortListModel :: Maybe SortListModel Source #
A convenience alias for Nothing
:: Maybe
SortListModel
.
Methods
Overloaded methods
getModel
sortListModelGetModel Source #
:: (HasCallStack, MonadIO m, IsSortListModel a) | |
=> a |
|
-> m (Maybe ListModel) | Returns: The model that gets sorted |
Gets the model currently sorted or Nothing
if none.
hasSort
:: (HasCallStack, MonadIO m, IsSortListModel a) | |
=> a |
|
-> m Bool | Returns: |
Checks if a sort function is currently set on self
new
:: (HasCallStack, MonadIO m, IsListModel a) | |
=> a |
|
-> Maybe CompareDataFunc |
|
-> m SortListModel | Returns: a new |
Creates a new sort list model that uses the sortFunc
to sort model
.
newForType
sortListModelNewForType Source #
:: (HasCallStack, MonadIO m) | |
=> GType |
|
-> m SortListModel | Returns: a new |
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
:: (HasCallStack, MonadIO m, IsSortListModel a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsSortListModel a, IsListModel b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the model to be sorted. The model
's item type must conform to
the item type of self
.
setSortFunc
sortListModelSetSortFunc Source #
:: (HasCallStack, MonadIO m, IsSortListModel a) | |
=> a |
|
-> Maybe CompareDataFunc |
|
-> 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