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 |
MapListModel
is a list model that takes a list model and maps the items
in that model to different items according to a MapListModelMapFunc
.
FIXME: Add useful examples here, like turning File
into FileInfo
or GdkPixmap
.
MapListModel
will attempt to discard the mapped objects as soon as they are no
longer needed and recreate them if necessary.
Synopsis
- newtype MapListModel = MapListModel (ManagedPtr MapListModel)
- class (GObject o, IsDescendantOf MapListModel o) => IsMapListModel o
- toMapListModel :: (MonadIO m, IsMapListModel o) => o -> m MapListModel
- noMapListModel :: Maybe MapListModel
- mapListModelGetModel :: (HasCallStack, MonadIO m, IsMapListModel a) => a -> m (Maybe ListModel)
- mapListModelHasMap :: (HasCallStack, MonadIO m, IsMapListModel a) => a -> m Bool
- mapListModelNew :: (HasCallStack, MonadIO m, IsListModel a) => GType -> Maybe a -> Maybe MapListModelMapFunc -> m MapListModel
- mapListModelSetMapFunc :: (HasCallStack, MonadIO m, IsMapListModel a) => a -> Maybe MapListModelMapFunc -> m ()
- mapListModelSetModel :: (HasCallStack, MonadIO m, IsMapListModel a, IsListModel b) => a -> Maybe b -> m ()
- getMapListModelHasMap :: (MonadIO m, IsMapListModel o) => o -> m Bool
- constructMapListModelItemType :: IsMapListModel o => GType -> IO (GValueConstruct o)
- getMapListModelItemType :: (MonadIO m, IsMapListModel o) => o -> m GType
- constructMapListModelModel :: (IsMapListModel o, IsListModel a) => a -> IO (GValueConstruct o)
- getMapListModelModel :: (MonadIO m, IsMapListModel o) => o -> m (Maybe ListModel)
Exported types
newtype MapListModel Source #
Memory-managed wrapper type.
Instances
Eq MapListModel Source # | |
Defined in GI.Gtk.Objects.MapListModel (==) :: MapListModel -> MapListModel -> Bool # (/=) :: MapListModel -> MapListModel -> Bool # | |
IsGValue MapListModel Source # | Convert |
Defined in GI.Gtk.Objects.MapListModel toGValue :: MapListModel -> IO GValue # fromGValue :: GValue -> IO MapListModel # | |
GObject MapListModel Source # | |
Defined in GI.Gtk.Objects.MapListModel gobjectType :: IO GType # | |
HasParentTypes MapListModel Source # | |
Defined in GI.Gtk.Objects.MapListModel | |
type ParentTypes MapListModel Source # | |
Defined in GI.Gtk.Objects.MapListModel |
class (GObject o, IsDescendantOf MapListModel o) => IsMapListModel o Source #
Type class for types which can be safely cast to MapListModel
, for instance with toMapListModel
.
Instances
(GObject o, IsDescendantOf MapListModel o) => IsMapListModel o Source # | |
Defined in GI.Gtk.Objects.MapListModel |
toMapListModel :: (MonadIO m, IsMapListModel o) => o -> m MapListModel Source #
Cast to MapListModel
, for types for which this is known to be safe. For general casts, use castTo
.
noMapListModel :: Maybe MapListModel Source #
A convenience alias for Nothing
:: Maybe
MapListModel
.
Methods
Overloaded methods
getModel
:: (HasCallStack, MonadIO m, IsMapListModel a) | |
=> a |
|
-> m (Maybe ListModel) | Returns: The model that gets mapped |
Gets the model that is curently being mapped or Nothing
if none.
hasMap
:: (HasCallStack, MonadIO m, IsMapListModel a) | |
=> a |
|
-> m Bool | Returns: |
Checks if a map function is currently set on self
new
:: (HasCallStack, MonadIO m, IsListModel a) | |
=> GType |
|
-> Maybe a |
|
-> Maybe MapListModelMapFunc |
|
-> m MapListModel | Returns: a new |
Creates a new MapListModel
for the given arguments.
setMapFunc
mapListModelSetMapFunc Source #
:: (HasCallStack, MonadIO m, IsMapListModel a) | |
=> a |
|
-> Maybe MapListModelMapFunc |
|
-> m () |
Sets the function used to map items. The function will be called whenever an item needs to be mapped and must return the item to use for the given input item.
Note that MapListModel
may call this function multiple times on the
same item, because it may delete items it doesn't need anymore.
GTK makes no effort to ensure that mapFunc
conforms to the item type
of self
. It assumes that the caller knows what they are doing and the map
function returns items of the appropriate type.
setModel
:: (HasCallStack, MonadIO m, IsMapListModel a, IsListModel b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the model to be mapped.
GTK makes no effort to ensure that model
conforms to the item type
expected by the map function. It assumes that the caller knows what
they are doing and have set up an appropriate map function.
Properties
hasMap
If a map is set for this model
getMapListModelHasMap :: (MonadIO m, IsMapListModel o) => o -> m Bool Source #
Get the value of the “has-map
” property.
When overloading is enabled, this is equivalent to
get
mapListModel #hasMap
itemType
The GType
for elements of this object
constructMapListModelItemType :: IsMapListModel 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
.
getMapListModelItemType :: (MonadIO m, IsMapListModel o) => o -> m GType Source #
Get the value of the “item-type
” property.
When overloading is enabled, this is equivalent to
get
mapListModel #itemType
model
The model being mapped
constructMapListModelModel :: (IsMapListModel 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
.
getMapListModelModel :: (MonadIO m, IsMapListModel o) => o -> m (Maybe ListModel) Source #
Get the value of the “model
” property.
When overloading is enabled, this is equivalent to
get
mapListModel #model