Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GtkSingleSelection
is a GtkSelectionModel
that allows selecting a single
item.
Note that the selection is *persistent* -- if the selected item is removed and re-added in the same ListModel::itemsChanged emission, it stays selected. In particular, this means that changing the sort order of an underlying sort model will preserve the selection.
Synopsis
- newtype SingleSelection = SingleSelection (ManagedPtr SingleSelection)
- class (GObject o, IsDescendantOf SingleSelection o) => IsSingleSelection o
- toSingleSelection :: (MonadIO m, IsSingleSelection o) => o -> m SingleSelection
- singleSelectionGetAutoselect :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> m Bool
- singleSelectionGetCanUnselect :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> m Bool
- singleSelectionGetModel :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> m (Maybe ListModel)
- singleSelectionGetSelected :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> m Word32
- singleSelectionGetSelectedItem :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> m (Maybe Object)
- singleSelectionNew :: (HasCallStack, MonadIO m, IsListModel a) => Maybe a -> m SingleSelection
- singleSelectionSetAutoselect :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> Bool -> m ()
- singleSelectionSetCanUnselect :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> Bool -> m ()
- singleSelectionSetModel :: (HasCallStack, MonadIO m, IsSingleSelection a, IsListModel b) => a -> Maybe b -> m ()
- singleSelectionSetSelected :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> Word32 -> m ()
- constructSingleSelectionAutoselect :: (IsSingleSelection o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSingleSelectionAutoselect :: (MonadIO m, IsSingleSelection o) => o -> m Bool
- setSingleSelectionAutoselect :: (MonadIO m, IsSingleSelection o) => o -> Bool -> m ()
- constructSingleSelectionCanUnselect :: (IsSingleSelection o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSingleSelectionCanUnselect :: (MonadIO m, IsSingleSelection o) => o -> m Bool
- setSingleSelectionCanUnselect :: (MonadIO m, IsSingleSelection o) => o -> Bool -> m ()
- getSingleSelectionItemType :: (MonadIO m, IsSingleSelection o) => o -> m GType
- clearSingleSelectionModel :: (MonadIO m, IsSingleSelection o) => o -> m ()
- constructSingleSelectionModel :: (IsSingleSelection o, MonadIO m, IsListModel a) => a -> m (GValueConstruct o)
- getSingleSelectionModel :: (MonadIO m, IsSingleSelection o) => o -> m (Maybe ListModel)
- setSingleSelectionModel :: (MonadIO m, IsSingleSelection o, IsListModel a) => o -> a -> m ()
- getSingleSelectionNItems :: (MonadIO m, IsSingleSelection o) => o -> m Word32
- constructSingleSelectionSelected :: (IsSingleSelection o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getSingleSelectionSelected :: (MonadIO m, IsSingleSelection o) => o -> m Word32
- setSingleSelectionSelected :: (MonadIO m, IsSingleSelection o) => o -> Word32 -> m ()
- getSingleSelectionSelectedItem :: (MonadIO m, IsSingleSelection o) => o -> m (Maybe Object)
Exported types
newtype SingleSelection Source #
Memory-managed wrapper type.
SingleSelection (ManagedPtr SingleSelection) |
Instances
Eq SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection (==) :: SingleSelection -> SingleSelection -> Bool # (/=) :: SingleSelection -> SingleSelection -> Bool # | |
GObject SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection | |
ManagedPtrNewtype SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection toManagedPtr :: SingleSelection -> ManagedPtr SingleSelection | |
TypedObject SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection | |
HasParentTypes SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection | |
IsGValue (Maybe SingleSelection) Source # | Convert |
Defined in GI.Gtk.Objects.SingleSelection gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe SingleSelection -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe SingleSelection) | |
type ParentTypes SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection |
class (GObject o, IsDescendantOf SingleSelection o) => IsSingleSelection o Source #
Type class for types which can be safely cast to SingleSelection
, for instance with toSingleSelection
.
Instances
(GObject o, IsDescendantOf SingleSelection o) => IsSingleSelection o Source # | |
Defined in GI.Gtk.Objects.SingleSelection |
toSingleSelection :: (MonadIO m, IsSingleSelection o) => o -> m SingleSelection Source #
Cast to SingleSelection
, 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
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, isSelected, itemsChanged, notify, notifyByPspec, ref, refSink, runDispose, selectAll, selectItem, selectRange, selectionChanged, stealData, stealQdata, thawNotify, unref, unselectAll, unselectItem, unselectRange, watchClosure.
Getters
getAutoselect, getCanUnselect, getData, getItem, getItemType, getModel, getNItems, getProperty, getQdata, getSelected, getSelectedItem, getSelection, getSelectionInRange.
Setters
setAutoselect, setCanUnselect, setData, setDataFull, setModel, setProperty, setSelected, setSelection.
getAutoselect
singleSelectionGetAutoselect Source #
:: (HasCallStack, MonadIO m, IsSingleSelection a) | |
=> a |
|
-> m Bool | Returns: |
Checks if autoselect has been enabled or disabled via
singleSelectionSetAutoselect
.
getCanUnselect
singleSelectionGetCanUnselect Source #
:: (HasCallStack, MonadIO m, IsSingleSelection a) | |
=> a |
|
-> m Bool | Returns: |
If True
, selectionModelUnselectItem
is supported and allows
unselecting the selected item.
getModel
singleSelectionGetModel Source #
:: (HasCallStack, MonadIO m, IsSingleSelection a) | |
=> a |
|
-> m (Maybe ListModel) | Returns: The model being wrapped |
Gets the model that self
is wrapping.
getSelected
singleSelectionGetSelected Source #
:: (HasCallStack, MonadIO m, IsSingleSelection a) | |
=> a |
|
-> m Word32 | Returns: The position of the selected item |
Gets the position of the selected item.
If no item is selected, INVALID_LIST_POSITION
is returned.
getSelectedItem
singleSelectionGetSelectedItem Source #
:: (HasCallStack, MonadIO m, IsSingleSelection a) | |
=> a |
|
-> m (Maybe Object) | Returns: The selected item |
Gets the selected item.
If no item is selected, Nothing
is returned.
new
:: (HasCallStack, MonadIO m, IsListModel a) | |
=> Maybe a |
|
-> m SingleSelection | Returns: a new |
Creates a new selection to handle model
.
setAutoselect
singleSelectionSetAutoselect Source #
:: (HasCallStack, MonadIO m, IsSingleSelection a) | |
=> a |
|
-> Bool |
|
-> m () |
Enables or disables autoselect.
If autoselect
is True
, self
will enforce that an item is always
selected. It will select a new item when the currently selected
item is deleted and it will disallow unselecting the current item.
setCanUnselect
singleSelectionSetCanUnselect Source #
:: (HasCallStack, MonadIO m, IsSingleSelection a) | |
=> a |
|
-> Bool |
|
-> m () |
If True
, unselecting the current item via
selectionModelUnselectItem
is supported.
Note that setting SingleSelection:autoselect will cause unselecting to not work, so it practically makes no sense to set both at the same time the same time.
setModel
singleSelectionSetModel Source #
:: (HasCallStack, MonadIO m, IsSingleSelection a, IsListModel b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the model that self
should wrap.
If model
is Nothing
, self
will be empty.
setSelected
singleSelectionSetSelected Source #
:: (HasCallStack, MonadIO m, IsSingleSelection a) | |
=> a |
|
-> Word32 |
|
-> m () |
Selects the item at the given position.
If the list does not have an item at position
or
INVALID_LIST_POSITION
is given, the behavior depends on the
value of the SingleSelection:autoselect property:
If it is set, no change will occur and the old item will stay
selected. If it is unset, the selection will be unset and no item
will be selected.
Properties
autoselect
If the selection will always select an item.
constructSingleSelectionAutoselect :: (IsSingleSelection o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “autoselect
” property. This is rarely needed directly, but it is used by new
.
getSingleSelectionAutoselect :: (MonadIO m, IsSingleSelection o) => o -> m Bool Source #
Get the value of the “autoselect
” property.
When overloading is enabled, this is equivalent to
get
singleSelection #autoselect
setSingleSelectionAutoselect :: (MonadIO m, IsSingleSelection o) => o -> Bool -> m () Source #
Set the value of the “autoselect
” property.
When overloading is enabled, this is equivalent to
set
singleSelection [ #autoselect:=
value ]
canUnselect
If unselecting the selected item is allowed.
constructSingleSelectionCanUnselect :: (IsSingleSelection o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “can-unselect
” property. This is rarely needed directly, but it is used by new
.
getSingleSelectionCanUnselect :: (MonadIO m, IsSingleSelection o) => o -> m Bool Source #
Get the value of the “can-unselect
” property.
When overloading is enabled, this is equivalent to
get
singleSelection #canUnselect
setSingleSelectionCanUnselect :: (MonadIO m, IsSingleSelection o) => o -> Bool -> m () Source #
Set the value of the “can-unselect
” property.
When overloading is enabled, this is equivalent to
set
singleSelection [ #canUnselect:=
value ]
itemType
The type of items. See listModelGetItemType
.
Since: 4.8
getSingleSelectionItemType :: (MonadIO m, IsSingleSelection o) => o -> m GType Source #
Get the value of the “item-type
” property.
When overloading is enabled, this is equivalent to
get
singleSelection #itemType
model
The model being managed.
clearSingleSelectionModel :: (MonadIO m, IsSingleSelection o) => o -> m () Source #
Set the value of the “model
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#model
constructSingleSelectionModel :: (IsSingleSelection 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
.
getSingleSelectionModel :: (MonadIO m, IsSingleSelection o) => o -> m (Maybe ListModel) Source #
Get the value of the “model
” property.
When overloading is enabled, this is equivalent to
get
singleSelection #model
setSingleSelectionModel :: (MonadIO m, IsSingleSelection o, IsListModel a) => o -> a -> m () Source #
Set the value of the “model
” property.
When overloading is enabled, this is equivalent to
set
singleSelection [ #model:=
value ]
nItems
The number of items. See listModelGetNItems
.
Since: 4.8
getSingleSelectionNItems :: (MonadIO m, IsSingleSelection o) => o -> m Word32 Source #
Get the value of the “n-items
” property.
When overloading is enabled, this is equivalent to
get
singleSelection #nItems
selected
Position of the selected item.
constructSingleSelectionSelected :: (IsSingleSelection o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “selected
” property. This is rarely needed directly, but it is used by new
.
getSingleSelectionSelected :: (MonadIO m, IsSingleSelection o) => o -> m Word32 Source #
Get the value of the “selected
” property.
When overloading is enabled, this is equivalent to
get
singleSelection #selected
setSingleSelectionSelected :: (MonadIO m, IsSingleSelection o) => o -> Word32 -> m () Source #
Set the value of the “selected
” property.
When overloading is enabled, this is equivalent to
set
singleSelection [ #selected:=
value ]
selectedItem
The selected item.
getSingleSelectionSelectedItem :: (MonadIO m, IsSingleSelection o) => o -> m (Maybe Object) Source #
Get the value of the “selected-item
” property.
When overloading is enabled, this is equivalent to
get
singleSelection #selectedItem