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 |
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 GtkTreeSelection
changed 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 GtkTreeSelection
changed signal
when nothing has happened (mostly as a result of programmers calling
select_row on an already selected row).
Synopsis
- newtype TreeSelection = TreeSelection (ManagedPtr TreeSelection)
- class (GObject o, IsDescendantOf TreeSelection o) => IsTreeSelection o
- toTreeSelection :: (MonadIO m, IsTreeSelection o) => o -> m TreeSelection
- treeSelectionCountSelectedRows :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m Int32
- treeSelectionGetMode :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m SelectionMode
- treeSelectionGetSelected :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m (Bool, TreeModel, TreeIter)
- treeSelectionGetSelectedRows :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m ([TreePath], TreeModel)
- treeSelectionGetTreeView :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m TreeView
- treeSelectionIterIsSelected :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreeIter -> m Bool
- treeSelectionPathIsSelected :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> m Bool
- treeSelectionSelectAll :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m ()
- treeSelectionSelectIter :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreeIter -> m ()
- treeSelectionSelectPath :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> m ()
- treeSelectionSelectRange :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> TreePath -> m ()
- treeSelectionSelectedForeach :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreeSelectionForeachFunc -> m ()
- treeSelectionSetMode :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> SelectionMode -> m ()
- treeSelectionSetSelectFunction :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> Maybe TreeSelectionFunc -> m ()
- treeSelectionUnselectAll :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m ()
- treeSelectionUnselectIter :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreeIter -> m ()
- treeSelectionUnselectPath :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> m ()
- treeSelectionUnselectRange :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> TreePath -> m ()
- constructTreeSelectionMode :: (IsTreeSelection o, MonadIO m) => SelectionMode -> m (GValueConstruct o)
- getTreeSelectionMode :: (MonadIO m, IsTreeSelection o) => o -> m SelectionMode
- setTreeSelectionMode :: (MonadIO m, IsTreeSelection o) => o -> SelectionMode -> m ()
- type TreeSelectionChangedCallback = IO ()
- afterTreeSelectionChanged :: (IsTreeSelection a, MonadIO m) => a -> ((?self :: a) => TreeSelectionChangedCallback) -> m SignalHandlerId
- onTreeSelectionChanged :: (IsTreeSelection a, MonadIO m) => a -> ((?self :: a) => TreeSelectionChangedCallback) -> m SignalHandlerId
Exported types
newtype TreeSelection Source #
Memory-managed wrapper type.
TreeSelection (ManagedPtr TreeSelection) |
Instances
Eq TreeSelection Source # | |
Defined in GI.Gtk.Objects.TreeSelection (==) :: TreeSelection -> TreeSelection -> Bool # (/=) :: TreeSelection -> TreeSelection -> Bool # | |
GObject TreeSelection Source # | |
Defined in GI.Gtk.Objects.TreeSelection | |
ManagedPtrNewtype TreeSelection Source # | |
Defined in GI.Gtk.Objects.TreeSelection toManagedPtr :: TreeSelection -> ManagedPtr TreeSelection | |
TypedObject TreeSelection Source # | |
Defined in GI.Gtk.Objects.TreeSelection | |
HasParentTypes TreeSelection Source # | |
Defined in GI.Gtk.Objects.TreeSelection | |
IsGValue (Maybe TreeSelection) Source # | Convert |
Defined in GI.Gtk.Objects.TreeSelection gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe TreeSelection -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe TreeSelection) | |
type ParentTypes TreeSelection Source # | |
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
(GObject o, IsDescendantOf TreeSelection o) => IsTreeSelection o Source # | |
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
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, countSelectedRows, forceFloating, freezeNotify, getv, isFloating, iterIsSelected, notify, notifyByPspec, pathIsSelected, ref, refSink, runDispose, selectAll, selectIter, selectPath, selectRange, selectedForeach, stealData, stealQdata, thawNotify, unref, unselectAll, unselectIter, unselectPath, unselectRange, watchClosure.
Getters
getData, getMode, getProperty, getQdata, getSelected, getSelectedRows, getTreeView.
Setters
setData, setDataFull, setMode, setProperty, setSelectFunction.
countSelectedRows
treeSelectionCountSelectedRows Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m ([TreePath], TreeModel) | Returns: A |
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 GtkTreeRowReference
s.
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 #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m TreeView | Returns: A |
Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView
Returns the tree view associated with selection
.
iterIsSelected
treeSelectionIterIsSelected Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreeIter |
|
-> m Bool | Returns: |
Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView
Returns True
if the row at iter
is currently selected.
pathIsSelected
treeSelectionPathIsSelected Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> m Bool | Returns: |
selectAll
treeSelectionSelectAll Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m () |
Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView
Selects all the nodes. selection
must be set to SelectionModeMultiple
mode.
selectIter
treeSelectionSelectIter Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreeIter |
|
-> m () |
Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView
Selects the specified iterator.
selectPath
treeSelectionSelectPath Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> m () |
Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView
Select the row at path
.
selectRange
treeSelectionSelectRange Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> TreePath |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreeSelectionForeachFunc |
|
-> 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
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> SelectionMode |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> Maybe TreeSelectionFunc |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m () |
Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView
Unselects all the nodes.
unselectIter
treeSelectionUnselectIter Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreeIter |
|
-> m () |
Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView
Unselects the specified iterator.
unselectPath
treeSelectionUnselectPath Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> m () |
Deprecated: (Since version 4.10)Use GtkListView or GtkColumnView
Unselects the row at path
.
unselectRange
treeSelectionUnselectRange Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> TreePath |
|
-> 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