gi-gtk-4.0.8: Gtk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.TreeSelection

Description

The selection object for GtkTreeView

The GtkTreeSelection object is a helper object to manage the selection for a GtkTreeView widget. The GtkTreeSelection object is automatically created when a new GtkTreeView widget is created, and cannot exist independently of this widget. The primary reason the GtkTreeSelection objects exists is for cleanliness of code and API. That is, there is no conceptual reason all these functions could not be methods on the GtkTreeView widget instead of a separate function.

The GtkTreeSelection object is gotten from a GtkTreeView by calling treeViewGetSelection. It can be manipulated to check the selection status of the tree, as well as select and deselect individual rows. Selection is done completely view side. As a result, multiple views of the same model can have completely different selections. Additionally, you cannot change the selection of a row on the model that is not currently displayed by the view without expanding its parents first.

One of the important things to remember when monitoring the selection of a view is that the GtkTreeSelectionchanged signal is mostly a hint. That is, it may only emit one signal when a range of rows is selected. Additionally, it may on occasion emit a GtkTreeSelectionchanged signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).

Synopsis

Exported types

newtype TreeSelection Source #

Memory-managed wrapper type.

Constructors

TreeSelection (ManagedPtr TreeSelection) 

Instances

Instances details
Eq TreeSelection Source # 
Instance details

Defined in GI.Gtk.Objects.TreeSelection

GObject TreeSelection Source # 
Instance details

Defined in GI.Gtk.Objects.TreeSelection

ManagedPtrNewtype TreeSelection Source # 
Instance details

Defined in GI.Gtk.Objects.TreeSelection

Methods

toManagedPtr :: TreeSelection -> ManagedPtr TreeSelection

TypedObject TreeSelection Source # 
Instance details

Defined in GI.Gtk.Objects.TreeSelection

Methods

glibType :: IO GType

HasParentTypes TreeSelection Source # 
Instance details

Defined in GI.Gtk.Objects.TreeSelection

IsGValue (Maybe TreeSelection) Source #

Convert TreeSelection to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.TreeSelection

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe TreeSelection -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe TreeSelection)

type ParentTypes TreeSelection Source # 
Instance details

Defined in GI.Gtk.Objects.TreeSelection

type ParentTypes TreeSelection = '[Object]

class (GObject o, IsDescendantOf TreeSelection o) => IsTreeSelection o Source #

Type class for types which can be safely cast to TreeSelection, for instance with toTreeSelection.

Instances

Instances details
(GObject o, IsDescendantOf TreeSelection o) => IsTreeSelection o Source # 
Instance details

Defined in GI.Gtk.Objects.TreeSelection

toTreeSelection :: (MonadIO m, IsTreeSelection o) => o -> m TreeSelection Source #

Cast to TreeSelection, for types for which this is known to be safe. For general casts, use castTo.

Methods

countSelectedRows

treeSelectionCountSelectedRows Source #

Arguments

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

selection: A GtkTreeSelection.

-> m Int32

Returns: The number of rows selected.

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Returns the number of rows that have been selected in tree.

getMode

treeSelectionGetMode Source #

Arguments

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

selection: a GtkTreeSelection

-> m SelectionMode

Returns: the current selection mode

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Gets the selection mode for selection. See treeSelectionSetMode.

getSelected

treeSelectionGetSelected Source #

Arguments

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

selection: A GtkTreeSelection.

-> m (Bool, TreeModel, TreeIter)

Returns: TRUE, if there is a selected node.

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Sets iter to the currently selected node if selection is set to SelectionModeSingle or SelectionModeBrowse. iter may be NULL if you just want to test if selection has any selected nodes. model is filled with the current model as a convenience. This function will not work if you use selection is SelectionModeMultiple.

getSelectedRows

treeSelectionGetSelectedRows Source #

Arguments

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

selection: A GtkTreeSelection.

-> m ([TreePath], TreeModel)

Returns: A GList containing a GtkTreePath for each selected row.

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Creates a list of path of all selected rows. Additionally, if you are planning on modifying the model after calling this function, you may want to convert the returned list into a list of GtkTreeRowReferences. To do this, you can use treeRowReferenceNew.

To free the return value, use:

C code

g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);

getTreeView

treeSelectionGetTreeView Source #

Arguments

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

selection: A GtkTreeSelection

-> m TreeView

Returns: A GtkTreeView

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Returns the tree view associated with selection.

iterIsSelected

treeSelectionIterIsSelected Source #

Arguments

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

selection: A GtkTreeSelection

-> TreeIter

iter: A valid GtkTreeIter

-> m Bool

Returns: True, if iter is selected

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Returns True if the row at iter is currently selected.

pathIsSelected

treeSelectionPathIsSelected Source #

Arguments

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

selection: A GtkTreeSelection.

-> TreePath

path: A GtkTreePath to check selection on.

-> m Bool

Returns: True if path is selected.

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Returns True if the row pointed to by path is currently selected. If path does not point to a valid location, False is returned

selectAll

treeSelectionSelectAll Source #

Arguments

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

selection: A GtkTreeSelection.

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Selects all the nodes. selection must be set to SelectionModeMultiple mode.

selectIter

treeSelectionSelectIter Source #

Arguments

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

selection: A GtkTreeSelection.

-> TreeIter

iter: The GtkTreeIter to be selected.

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Selects the specified iterator.

selectPath

treeSelectionSelectPath Source #

Arguments

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

selection: A GtkTreeSelection.

-> TreePath

path: The GtkTreePath to be selected.

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Select the row at path.

selectRange

treeSelectionSelectRange Source #

Arguments

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

selection: A GtkTreeSelection.

-> TreePath

startPath: The initial node of the range.

-> TreePath

endPath: The final node of the range.

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Selects a range of nodes, determined by startPath and endPath inclusive. selection must be set to SelectionModeMultiple mode.

selectedForeach

treeSelectionSelectedForeach Source #

Arguments

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

selection: A GtkTreeSelection.

-> TreeSelectionForeachFunc

func: The function to call for each selected node.

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Calls a function for each selected node. Note that you cannot modify the tree or selection from within this function. As a result, treeSelectionGetSelectedRows might be more useful.

setMode

treeSelectionSetMode Source #

Arguments

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

selection: A GtkTreeSelection.

-> SelectionMode

type: The selection mode

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Sets the selection mode of the selection. If the previous type was SelectionModeMultiple, then the anchor is kept selected, if it was previously selected.

setSelectFunction

treeSelectionSetSelectFunction Source #

Arguments

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

selection: A GtkTreeSelection.

-> Maybe TreeSelectionFunc

func: The selection function. May be Nothing

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Sets the selection function.

If set, this function is called before any node is selected or unselected, giving some control over which nodes are selected. The select function should return True if the state of the node may be toggled, and False if the state of the node should be left unchanged.

unselectAll

treeSelectionUnselectAll Source #

Arguments

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

selection: A GtkTreeSelection.

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Unselects all the nodes.

unselectIter

treeSelectionUnselectIter Source #

Arguments

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

selection: A GtkTreeSelection.

-> TreeIter

iter: The GtkTreeIter to be unselected.

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Unselects the specified iterator.

unselectPath

treeSelectionUnselectPath Source #

Arguments

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

selection: A GtkTreeSelection.

-> TreePath

path: The GtkTreePath to be unselected.

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Unselects the row at path.

unselectRange

treeSelectionUnselectRange Source #

Arguments

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

selection: A GtkTreeSelection.

-> TreePath

startPath: The initial node of the range.

-> TreePath

endPath: The initial node of the range.

-> m () 

Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView

Unselects a range of nodes, determined by startPath and endPath inclusive.

Properties

mode

Selection mode. See treeSelectionSetMode for more information on this property.

constructTreeSelectionMode :: (IsTreeSelection o, MonadIO m) => SelectionMode -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “mode” property. This is rarely needed directly, but it is used by new.

getTreeSelectionMode :: (MonadIO m, IsTreeSelection o) => o -> m SelectionMode Source #

Get the value of the “mode” property. When overloading is enabled, this is equivalent to

get treeSelection #mode

setTreeSelectionMode :: (MonadIO m, IsTreeSelection o) => o -> SelectionMode -> m () Source #

Set the value of the “mode” property. When overloading is enabled, this is equivalent to

set treeSelection [ #mode := value ]

Signals

changed

type TreeSelectionChangedCallback = IO () Source #

Emitted whenever the selection has (possibly) changed. Please note that this signal is mostly a hint. It may only be emitted once when a range of rows are selected, and it may occasionally be emitted when nothing has happened.

afterTreeSelectionChanged :: (IsTreeSelection a, MonadIO m) => a -> ((?self :: a) => TreeSelectionChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after treeSelection #changed callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onTreeSelectionChanged :: (IsTreeSelection a, MonadIO m) => a -> ((?self :: a) => TreeSelectionChangedCallback) -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on treeSelection #changed callback