| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte | 
|---|---|
| License | LGPL-2.1 | 
| Maintainer | Iñaki García Etxebarria | 
| Safe Haskell | Safe-Inferred | 
| Language | Haskell2010 | 
GI.Gtk.Objects.SingleSelection
Description
GtkSingleSelection is an implementation of the SelectionModel interface
 that allows selecting a single element. It is the default selection method
 used by list widgets in GTK.
Note that the selection is *persistent* -- if the selected item is removed and re-added in the same 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 ListModel
- singleSelectionGetSelected :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> m Word32
- singleSelectionGetSelectedItem :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> m (Ptr ())
- 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 ()
- 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 ListModel
- setSingleSelectionModel :: (MonadIO m, IsSingleSelection o, IsListModel a) => o -> a -> m ()
- 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.
Constructors
| SingleSelection (ManagedPtr SingleSelection) | 
Instances
| Eq SingleSelection Source # | |
| Defined in GI.Gtk.Objects.SingleSelection Methods (==) :: SingleSelection -> SingleSelection -> Bool # (/=) :: SingleSelection -> SingleSelection -> Bool # | |
| GObject SingleSelection Source # | |
| Defined in GI.Gtk.Objects.SingleSelection | |
| ManagedPtrNewtype SingleSelection Source # | |
| Defined in GI.Gtk.Objects.SingleSelection Methods 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 Methods 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 #
Arguments
| :: (HasCallStack, MonadIO m, IsSingleSelection a) | |
| => a | 
 | 
| -> m Bool | Returns:  | 
Checks if autoselect has been enabled or disabled via
 singleSelectionSetAutoselect.
getCanUnselect
singleSelectionGetCanUnselect Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSingleSelection a) | |
| => a | 
 | 
| -> m Bool | Returns:  | 
If True, selectionModelUnselectItem is supported and allows
 unselecting the selected item.
getModel
singleSelectionGetModel Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSingleSelection a) | |
| => a | 
 | 
| -> m ListModel | Returns: The model being wrapped | 
Gets the model that self is wrapping.
getSelected
singleSelectionGetSelected Source #
Arguments
| :: (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,
 GTK_INVALID_LIST_POSITION is returned.
getSelectedItem
singleSelectionGetSelectedItem Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSingleSelection a) | |
| => a | 
 | 
| -> m (Ptr ()) | Returns: The selected item | 
Gets the selected item.
If no item is selected, Nothing is returned.
new
Arguments
| :: (HasCallStack, MonadIO m, IsListModel a) | |
| => Maybe a | |
| -> m SingleSelection | Returns: a new  | 
Creates a new selection to handle model.
setAutoselect
singleSelectionSetAutoselect Source #
Arguments
| :: (HasCallStack, MonadIO m, IsSingleSelection a) | |
| => a | 
 | 
| -> Bool | 
 | 
| -> m () | 
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 #
Arguments
| :: (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 the
 unselecting to not work, so it practically makes no sense to set
 both at the same time the same time.
setModel
singleSelectionSetModel Source #
Arguments
| :: (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 #
Arguments
| :: (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
 GTK_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
setsingleSelection [ #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
setsingleSelection [ #canUnselect:=value ]
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 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
setsingleSelection [ #model:=value ]
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
setsingleSelection [ #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