Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
The TreeSelection
object is a helper object to manage the selection
for a TreeView
widget. The TreeSelection
object is
automatically created when a new TreeView
widget is created, and
cannot exist independently of this widget. The primary reason the
TreeSelection
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 TreeView
widget instead of a separate function.
The TreeSelection
object is gotten from a TreeView
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 TreeSelection
::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 TreeSelection
::changed
signal
when nothing has happened (mostly as a result of programmers calling
select_row on an already selected row).
- newtype TreeSelection = TreeSelection (ManagedPtr TreeSelection)
- class GObject o => IsTreeSelection o
- toTreeSelection :: IsTreeSelection o => o -> IO TreeSelection
- noTreeSelection :: Maybe TreeSelection
- data TreeSelectionCountSelectedRowsMethodInfo
- treeSelectionCountSelectedRows :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m Int32
- data TreeSelectionGetModeMethodInfo
- treeSelectionGetMode :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m SelectionMode
- data TreeSelectionGetSelectedMethodInfo
- treeSelectionGetSelected :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m (Bool, TreeModel, TreeIter)
- data TreeSelectionGetSelectedRowsMethodInfo
- treeSelectionGetSelectedRows :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m ([TreePath], TreeModel)
- data TreeSelectionGetTreeViewMethodInfo
- treeSelectionGetTreeView :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m TreeView
- data TreeSelectionIterIsSelectedMethodInfo
- treeSelectionIterIsSelected :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreeIter -> m Bool
- data TreeSelectionPathIsSelectedMethodInfo
- treeSelectionPathIsSelected :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> m Bool
- data TreeSelectionSelectAllMethodInfo
- treeSelectionSelectAll :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m ()
- data TreeSelectionSelectIterMethodInfo
- treeSelectionSelectIter :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreeIter -> m ()
- data TreeSelectionSelectPathMethodInfo
- treeSelectionSelectPath :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> m ()
- data TreeSelectionSelectRangeMethodInfo
- treeSelectionSelectRange :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> TreePath -> m ()
- data TreeSelectionSelectedForeachMethodInfo
- treeSelectionSelectedForeach :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreeSelectionForeachFunc -> m ()
- data TreeSelectionSetModeMethodInfo
- treeSelectionSetMode :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> SelectionMode -> m ()
- data TreeSelectionSetSelectFunctionMethodInfo
- treeSelectionSetSelectFunction :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreeSelectionFunc -> m ()
- data TreeSelectionUnselectAllMethodInfo
- treeSelectionUnselectAll :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> m ()
- data TreeSelectionUnselectIterMethodInfo
- treeSelectionUnselectIter :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreeIter -> m ()
- data TreeSelectionUnselectPathMethodInfo
- treeSelectionUnselectPath :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> m ()
- data TreeSelectionUnselectRangeMethodInfo
- treeSelectionUnselectRange :: (HasCallStack, MonadIO m, IsTreeSelection a) => a -> TreePath -> TreePath -> m ()
- data TreeSelectionModePropertyInfo
- constructTreeSelectionMode :: IsTreeSelection o => SelectionMode -> IO (GValueConstruct o)
- getTreeSelectionMode :: (MonadIO m, IsTreeSelection o) => o -> m SelectionMode
- setTreeSelectionMode :: (MonadIO m, IsTreeSelection o) => o -> SelectionMode -> m ()
- treeSelectionMode :: AttrLabelProxy "mode"
- type C_TreeSelectionChangedCallback = Ptr () -> Ptr () -> IO ()
- type TreeSelectionChangedCallback = IO ()
- data TreeSelectionChangedSignalInfo
- afterTreeSelectionChanged :: (GObject a, MonadIO m) => a -> TreeSelectionChangedCallback -> m SignalHandlerId
- genClosure_TreeSelectionChanged :: TreeSelectionChangedCallback -> IO Closure
- mk_TreeSelectionChangedCallback :: C_TreeSelectionChangedCallback -> IO (FunPtr C_TreeSelectionChangedCallback)
- noTreeSelectionChangedCallback :: Maybe TreeSelectionChangedCallback
- onTreeSelectionChanged :: (GObject a, MonadIO m) => a -> TreeSelectionChangedCallback -> m SignalHandlerId
- wrap_TreeSelectionChangedCallback :: TreeSelectionChangedCallback -> Ptr () -> Ptr () -> IO ()
Exported types
newtype TreeSelection Source #
GObject TreeSelection Source # | |
IsObject TreeSelection Source # | |
IsTreeSelection TreeSelection Source # | |
((~) * info (ResolveTreeSelectionMethod t TreeSelection), MethodInfo * info TreeSelection p) => IsLabel t (TreeSelection -> p) Source # | |
((~) * info (ResolveTreeSelectionMethod t TreeSelection), MethodInfo * info TreeSelection p) => IsLabelProxy t (TreeSelection -> p) Source # | |
HasAttributeList * TreeSelection Source # | |
type AttributeList TreeSelection Source # | |
type SignalList TreeSelection Source # | |
class GObject o => IsTreeSelection o Source #
toTreeSelection :: IsTreeSelection o => o -> IO TreeSelection Source #
Methods
countSelectedRows
data TreeSelectionCountSelectedRowsMethodInfo Source #
((~) * signature (m Int32), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionCountSelectedRowsMethodInfo a signature Source # | |
treeSelectionCountSelectedRows Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m Int32 | Returns: The number of rows selected. |
Returns the number of rows that have been selected in tree
.
Since: 2.2
getMode
data TreeSelectionGetModeMethodInfo Source #
((~) * signature (m SelectionMode), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionGetModeMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m SelectionMode | Returns: the current selection mode |
Gets the selection mode for selection
. See
treeSelectionSetMode
.
getSelected
data TreeSelectionGetSelectedMethodInfo Source #
((~) * signature (m (Bool, TreeModel, TreeIter)), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionGetSelectedMethodInfo a signature Source # | |
treeSelectionGetSelected Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m (Bool, TreeModel, TreeIter) | Returns: TRUE, if there is a selected node. |
Sets iter
to the currently selected node if selection
is set to
GTK_SELECTION_SINGLE
or GTK_SELECTION_BROWSE
. 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 GTK_SELECTION_MULTIPLE
.
getSelectedRows
data TreeSelectionGetSelectedRowsMethodInfo Source #
((~) * signature (m ([TreePath], TreeModel)), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionGetSelectedRowsMethodInfo a signature Source # | |
treeSelectionGetSelectedRows Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m ([TreePath], TreeModel) | Returns: A |
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);
Since: 2.2
getTreeView
data TreeSelectionGetTreeViewMethodInfo Source #
((~) * signature (m TreeView), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionGetTreeViewMethodInfo a signature Source # | |
treeSelectionGetTreeView Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m TreeView | Returns: A |
Returns the tree view associated with selection
.
iterIsSelected
data TreeSelectionIterIsSelectedMethodInfo Source #
((~) * signature (TreeIter -> m Bool), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionIterIsSelectedMethodInfo a signature Source # | |
treeSelectionIterIsSelected Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreeIter |
|
-> m Bool | Returns: |
Returns True
if the row at iter
is currently selected.
pathIsSelected
data TreeSelectionPathIsSelectedMethodInfo Source #
((~) * signature (TreePath -> m Bool), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionPathIsSelectedMethodInfo a signature Source # | |
treeSelectionPathIsSelected Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> m Bool | Returns: |
selectAll
data TreeSelectionSelectAllMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionSelectAllMethodInfo a signature Source # | |
treeSelectionSelectAll Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m () |
Selects all the nodes. selection
must be set to GTK_SELECTION_MULTIPLE
mode.
selectIter
data TreeSelectionSelectIterMethodInfo Source #
((~) * signature (TreeIter -> m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionSelectIterMethodInfo a signature Source # | |
treeSelectionSelectIter Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreeIter |
|
-> m () |
Selects the specified iterator.
selectPath
data TreeSelectionSelectPathMethodInfo Source #
((~) * signature (TreePath -> m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionSelectPathMethodInfo a signature Source # | |
treeSelectionSelectPath Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> m () |
Select the row at path
.
selectRange
data TreeSelectionSelectRangeMethodInfo Source #
((~) * signature (TreePath -> TreePath -> m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionSelectRangeMethodInfo a signature Source # | |
treeSelectionSelectRange Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> TreePath |
|
-> m () |
Selects a range of nodes, determined by startPath
and endPath
inclusive.
selection
must be set to GTK_SELECTION_MULTIPLE
mode.
selectedForeach
data TreeSelectionSelectedForeachMethodInfo Source #
((~) * signature (TreeSelectionForeachFunc -> m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionSelectedForeachMethodInfo a signature Source # | |
treeSelectionSelectedForeach Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreeSelectionForeachFunc |
|
-> m () |
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
data TreeSelectionSetModeMethodInfo Source #
((~) * signature (SelectionMode -> m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionSetModeMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> SelectionMode |
|
-> m () |
Sets the selection mode of the selection
. If the previous type was
GTK_SELECTION_MULTIPLE
, then the anchor is kept selected, if it was
previously selected.
setSelectFunction
data TreeSelectionSetSelectFunctionMethodInfo Source #
((~) * signature (TreeSelectionFunc -> m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionSetSelectFunctionMethodInfo a signature Source # | |
treeSelectionSetSelectFunction Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreeSelectionFunc |
|
-> m () |
unselectAll
data TreeSelectionUnselectAllMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionUnselectAllMethodInfo a signature Source # | |
treeSelectionUnselectAll Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> m () |
Unselects all the nodes.
unselectIter
data TreeSelectionUnselectIterMethodInfo Source #
((~) * signature (TreeIter -> m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionUnselectIterMethodInfo a signature Source # | |
treeSelectionUnselectIter Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreeIter |
|
-> m () |
Unselects the specified iterator.
unselectPath
data TreeSelectionUnselectPathMethodInfo Source #
((~) * signature (TreePath -> m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionUnselectPathMethodInfo a signature Source # | |
treeSelectionUnselectPath Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> m () |
Unselects the row at path
.
unselectRange
data TreeSelectionUnselectRangeMethodInfo Source #
((~) * signature (TreePath -> TreePath -> m ()), MonadIO m, IsTreeSelection a) => MethodInfo * TreeSelectionUnselectRangeMethodInfo a signature Source # | |
treeSelectionUnselectRange Source #
:: (HasCallStack, MonadIO m, IsTreeSelection a) | |
=> a |
|
-> TreePath |
|
-> TreePath |
|
-> m () |
Unselects a range of nodes, determined by startPath
and endPath
inclusive.
Since: 2.2
Properties
mode
data TreeSelectionModePropertyInfo Source #
constructTreeSelectionMode :: IsTreeSelection o => SelectionMode -> IO (GValueConstruct o) Source #
getTreeSelectionMode :: (MonadIO m, IsTreeSelection o) => o -> m SelectionMode Source #
setTreeSelectionMode :: (MonadIO m, IsTreeSelection o) => o -> SelectionMode -> m () Source #
treeSelectionMode :: AttrLabelProxy "mode" Source #
Signals
changed
type TreeSelectionChangedCallback = IO () Source #
afterTreeSelectionChanged :: (GObject a, MonadIO m) => a -> TreeSelectionChangedCallback -> m SignalHandlerId Source #
mk_TreeSelectionChangedCallback :: C_TreeSelectionChangedCallback -> IO (FunPtr C_TreeSelectionChangedCallback) Source #
onTreeSelectionChanged :: (GObject a, MonadIO m) => a -> TreeSelectionChangedCallback -> m SignalHandlerId Source #
wrap_TreeSelectionChangedCallback :: TreeSelectionChangedCallback -> Ptr () -> Ptr () -> IO () Source #