gtk3-0.15.10: Binding to the Gtk+ 3 graphical user interface library

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.UI.Gtk.ModelView.TreeSelection

Contents

- Detail
- Class Hierarchy
- Types
- Methods
- Attributes
- Signals

Description

The selection object for `TreeView`

Synopsis

- data TreeSelection
- class GObjectClass o => TreeSelectionClass o
- castToTreeSelection :: GObjectClass obj => obj -> TreeSelection
- gTypeTreeSelection :: GType
- toTreeSelection :: TreeSelectionClass o => o -> TreeSelection
- data SelectionMode
  - = SelectionNone
  - | SelectionSingle
  - | SelectionBrowse
  - | SelectionMultiple
- type TreeSelectionCB = TreePath -> IO Bool
- type TreeSelectionForeachCB = TreeIter -> IO ()
- treeSelectionSetMode :: TreeSelectionClass self => self -> SelectionMode -> IO ()
- treeSelectionGetMode :: TreeSelectionClass self => self -> IO SelectionMode
- treeSelectionSetSelectFunction :: TreeSelectionClass self => self -> TreeSelectionCB -> IO ()
- treeSelectionGetTreeView :: TreeSelectionClass self => self -> IO TreeView
- treeSelectionGetSelected :: TreeSelectionClass self => self -> IO (Maybe TreeIter)
- treeSelectionSelectedForeach :: TreeSelectionClass self => self -> TreeSelectionForeachCB -> IO ()
- treeSelectionGetSelectedRows :: TreeSelectionClass self => self -> IO [TreePath]
- treeSelectionCountSelectedRows :: TreeSelectionClass self => self -> IO Int
- treeSelectionSelectPath :: TreeSelectionClass self => self -> TreePath -> IO ()
- treeSelectionUnselectPath :: TreeSelectionClass self => self -> TreePath -> IO ()
- treeSelectionPathIsSelected :: TreeSelectionClass self => self -> TreePath -> IO Bool
- treeSelectionSelectIter :: TreeSelectionClass self => self -> TreeIter -> IO ()
- treeSelectionUnselectIter :: TreeSelectionClass self => self -> TreeIter -> IO ()
- treeSelectionIterIsSelected :: TreeSelectionClass self => self -> TreeIter -> IO Bool
- treeSelectionSelectAll :: TreeSelectionClass self => self -> IO ()
- treeSelectionUnselectAll :: TreeSelectionClass self => self -> IO ()
- treeSelectionSelectRange :: TreeSelectionClass self => self -> TreePath -> TreePath -> IO ()
- treeSelectionUnselectRange :: TreeSelectionClass self => self -> TreePath -> TreePath -> IO ()
- treeSelectionMode :: TreeSelectionClass self => Attr self SelectionMode
- treeSelectionSelectionChanged :: TreeSelectionClass self => Signal self (IO ())

# Detail

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 independentally 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 on the `TreeView` 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 "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 "changed" signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).

# Class Hierarchy

    | GObject
    | +----TreeSelection

# Types

data TreeSelection Source #

#### Instances

Instances details

Eq TreeSelection Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods (==) :: TreeSelection -> TreeSelection -> Bool Source # (/=) :: TreeSelection -> TreeSelection -> Bool Source #
Ord TreeSelection Source # |

Instance details

Defined in Graphics.UI.Gtk.Types

Methods

compare :: TreeSelection -> TreeSelection -> Ordering Source #

(<) :: TreeSelection -> TreeSelection -> Bool Source #

(<=) :: TreeSelection -> TreeSelection -> Bool Source #

(>) :: TreeSelection -> TreeSelection -> Bool Source #

(>=) :: TreeSelection -> TreeSelection -> Bool Source #

max :: TreeSelection -> TreeSelection -> TreeSelection Source #

min :: TreeSelection -> TreeSelection -> TreeSelection Source #

GObjectClass TreeSelection Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods toGObject :: TreeSelection -> GObject Source # unsafeCastGObject :: GObject -> TreeSelection Source #
TreeSelectionClass TreeSelection Source # |
Instance details Defined in Graphics.UI.Gtk.Types

class GObjectClass o => TreeSelectionClass o Source #

#### Instances

Instances details

TreeSelectionClass TreeSelection Source # |
Instance details Defined in Graphics.UI.Gtk.Types

castToTreeSelection :: GObjectClass obj => obj -> TreeSelection Source #

gTypeTreeSelection :: GType Source #

toTreeSelection :: TreeSelectionClass o => o -> TreeSelection Source #

data SelectionMode Source #

Mode in which selections can be performed

- There is a deprecated entry SelectionExtended which should have the same value as SelectionMultiple. C2HS chokes on that construct.

Constructors

SelectionNone |
SelectionSingle |
SelectionBrowse |
SelectionMultiple |

#### Instances

Instances details

Enum SelectionMode Source # |

Instance details

Defined in Graphics.UI.Gtk.General.Enums

Methods

succ :: SelectionMode -> SelectionMode Source #

pred :: SelectionMode -> SelectionMode Source #

toEnum :: Int -> SelectionMode Source #

fromEnum :: SelectionMode -> Int Source #

enumFrom :: SelectionMode -> [SelectionMode] Source #

enumFromThen :: SelectionMode -> SelectionMode -> [SelectionMode] Source #

enumFromTo :: SelectionMode -> SelectionMode -> [SelectionMode] Source #

enumFromThenTo :: SelectionMode -> SelectionMode -> SelectionMode -> [SelectionMode] Source #

Show SelectionMode Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods showsPrec :: Int -> SelectionMode -> ShowS Source # show :: SelectionMode -> String Source # showList :: [SelectionMode] -> ShowS Source #
Eq SelectionMode Source # |
Instance details Defined in Graphics.UI.Gtk.General.Enums Methods (==) :: SelectionMode -> SelectionMode -> Bool Source # (/=) :: SelectionMode -> SelectionMode -> Bool Source #

type TreeSelectionCB = TreePath -> IO Bool Source #

Callback type for a function that is called every time the selection changes. This function is set with `treeSelectionSetSelectFunction`.

type TreeSelectionForeachCB = TreeIter -> IO () Source #

Callback function type for `treeSelectionSelectedForeach`.

# Methods

treeSelectionSetMode :: TreeSelectionClass self => self -> SelectionMode -> IO () Source #

Set single or multiple choice.

treeSelectionGetMode :: TreeSelectionClass self => self -> IO SelectionMode Source #

Gets the selection mode.

treeSelectionSetSelectFunction :: TreeSelectionClass self => self -> TreeSelectionCB -> IO () Source #

Set a callback function if selection changes.

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

treeSelectionGetTreeView :: TreeSelectionClass self => self -> IO TreeView Source #

Retrieve the `TreeView` widget that this `TreeSelection` works on.

treeSelectionGetSelected :: TreeSelectionClass self => self -> IO (Maybe TreeIter) Source #

Retrieves the selection of a single choice `TreeSelection`.

treeSelectionSelectedForeach :: TreeSelectionClass self => self -> TreeSelectionForeachCB -> IO () Source #

Execute a function for each selected node.

- Note that you cannot modify the tree or selection from within this function. Hence, `treeSelectionGetSelectedRows` might be more useful.

treeSelectionGetSelectedRows Source #

Arguments

:: TreeSelectionClass self |
=> self |
-> IO [TreePath] | returns a list containing a `TreePath` for each selected row.

Creates a list of paths 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 `TreeRowReference`s. To do this, you can use `treeRowReferenceNew`.
- Available since Gtk+ version 2.2

treeSelectionCountSelectedRows Source #

Arguments

:: TreeSelectionClass self |
=> self |
-> IO Int | returns The number of rows selected.

Returns the number of rows that are selected.

- Available since Gtk+ version 2.2

treeSelectionSelectPath :: TreeSelectionClass self => self -> TreePath -> IO () Source #

Select a specific item by `TreePath`.

treeSelectionUnselectPath :: TreeSelectionClass self => self -> TreePath -> IO () Source #

Deselect a specific item by `TreePath`.

treeSelectionPathIsSelected :: TreeSelectionClass self => self -> TreePath -> IO Bool Source #

Returns True if the row at the given path is currently selected.

treeSelectionSelectIter :: TreeSelectionClass self => self -> TreeIter -> IO () Source #

Select a specific item by `TreeIter`.

treeSelectionUnselectIter :: TreeSelectionClass self => self -> TreeIter -> IO () Source #

Deselect a specific item by `TreeIter`.

treeSelectionIterIsSelected :: TreeSelectionClass self => self -> TreeIter -> IO Bool Source #

Returns True if the row at the given iter is currently selected.

treeSelectionSelectAll :: TreeSelectionClass self => self -> IO () Source #

Selects all the nodes. The tree selection must be set to `SelectionMultiple` mode.

treeSelectionUnselectAll :: TreeSelectionClass self => self -> IO () Source #

Unselects all the nodes.

treeSelectionSelectRange Source #

Arguments

:: TreeSelectionClass self |
=> self |
-> TreePath | `startPath` - The initial node of the range.
-> TreePath | `endPath` - The final node of the range.
-> IO () |

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

treeSelectionUnselectRange Source #

Arguments

:: TreeSelectionClass self |
=> self |
-> TreePath | `startPath` - The initial node of the range.
-> TreePath | `endPath` - The initial node of the range.
-> IO () |

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

- Available since Gtk+ version 2.2

# Attributes

treeSelectionMode :: TreeSelectionClass self => Attr self SelectionMode Source #

'mode' property. See `treeSelectionGetMode` and `treeSelectionSetMode`

# Signals

treeSelectionSelectionChanged :: TreeSelectionClass self => Signal self (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.