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 |
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.
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) => a -> m SingleSelection
- singleSelectionSetAutoselect :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> Bool -> m ()
- singleSelectionSetCanUnselect :: (HasCallStack, MonadIO m, IsSingleSelection a) => a -> Bool -> 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 ()
- constructSingleSelectionModel :: (IsSingleSelection o, MonadIO m, IsListModel a) => a -> m (GValueConstruct o)
- getSingleSelectionModel :: (MonadIO m, IsSingleSelection o) => o -> m ListModel
- 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.
Instances
Eq SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection (==) :: SingleSelection -> SingleSelection -> Bool # (/=) :: SingleSelection -> SingleSelection -> Bool # | |
IsGValue SingleSelection Source # | Convert |
Defined in GI.Gtk.Objects.SingleSelection toGValue :: SingleSelection -> IO GValue # fromGValue :: GValue -> IO SingleSelection # | |
ManagedPtrNewtype SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection | |
TypedObject SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection | |
GObject SingleSelection Source # | |
Defined in GI.Gtk.Objects.SingleSelection | |
HasParentTypes SingleSelection Source # | |
Defined in GI.Gtk.Objects.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
Overloaded methods
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 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,
GTK_INVALID_LIST_POSITION
is returned.
getSelectedItem
singleSelectionGetSelectedItem Source #
:: (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
:: (HasCallStack, MonadIO m, IsListModel a) | |
=> a |
|
-> m SingleSelection | Returns: a new |
Creates a new selection to handle model
.
setAutoselect
singleSelectionSetAutoselect Source #
:: (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 #
:: (HasCallStack, MonadIO m, IsSingleSelection a) | |
=> a |
|
-> Bool |
|
-> m () |
If True
, unselecting the current item via
selectionModelUnselectItem
is supported.
Note that setting GtkSingleSelection:autoselect will cause the unselecting to not work, so it practically makes no sense to set both at the same time the same time..
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 GTK_INVALID_LIST_POSITION
is given, the behavior depends on the
value of the GtkSingleSelection: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 ]
model
The model being managed
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
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