gi-gtk-4.0.2: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

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.

Synopsis

Exported types

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

Instances details
(GObject o, IsDescendantOf SingleSelection o) => IsSingleSelection o Source # 
Instance details

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 #

Arguments

:: (HasCallStack, MonadIO m, IsSingleSelection a) 
=> a

self: a SingleSelection

-> m Bool

Returns: True if autoselect is enabled

Checks if autoselect has been enabled or disabled via singleSelectionSetAutoselect.

getCanUnselect

singleSelectionGetCanUnselect Source #

Arguments

:: (HasCallStack, MonadIO m, IsSingleSelection a) 
=> a

self: a SingleSelection

-> m Bool

Returns: True to support unselecting

If True, selectionModelUnselectItem is supported and allows unselecting the selected item.

getModel

singleSelectionGetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsSingleSelection a) 
=> a

self: a SingleSelection

-> m ListModel

Returns: The model being wrapped

Gets the model that self is wrapping.

getSelected

singleSelectionGetSelected Source #

Arguments

:: (HasCallStack, MonadIO m, IsSingleSelection a) 
=> a

self: a SingleSelection

-> 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

self: a SingleSelection

-> m (Ptr ())

Returns: The selected item

Gets the selected item. If no item is selected, Nothing is returned.

new

singleSelectionNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsListModel a) 
=> a

model: the ListModel to manage

-> m SingleSelection

Returns: a new SingleSelection

Creates a new selection to handle model.

setAutoselect

singleSelectionSetAutoselect Source #

Arguments

:: (HasCallStack, MonadIO m, IsSingleSelection a) 
=> a

self: a SingleSelection

-> Bool

autoselect: True to always select an item

-> 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

self: a SingleSelection

-> Bool

canUnselect: True to allow unselecting

-> 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 #

Arguments

:: (HasCallStack, MonadIO m, IsSingleSelection a) 
=> a

self: a SingleSelection

-> Word32

position: the item to select or GTK_INVALID_LIST_POSITION

-> 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