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

Contents

- Detail
- Class Hierarchy
- Types
- Constants
- Methods
- Signals

Description

The interface for sortable models used by `TreeView`

Synopsis

- data TreeSortable
- class GObjectClass o => TreeSortableClass o
- castToTreeSortable :: GObjectClass obj => obj -> TreeSortable
- gTypeTreeSortable :: GType
- toTreeSortable :: TreeSortableClass o => o -> TreeSortable
- type SortColumnId = Int
- treeSortableDefaultSortColumnId :: SortColumnId
- treeSortableGetSortColumnId :: TreeSortableClass self => self -> IO (SortType, Bool, SortColumnId)
- treeSortableSetSortColumnId :: TreeSortableClass self => self -> SortColumnId -> SortType -> IO ()
- treeSortableSetSortFunc :: TreeSortableClass self => self -> SortColumnId -> (TreeIter -> TreeIter -> IO Ordering) -> IO ()
- treeSortableSetDefaultSortFunc :: TreeSortableClass self => self -> Maybe (TreeIter -> TreeIter -> IO Ordering) -> IO ()
- treeSortableHasDefaultSortFunc :: TreeSortableClass self => self -> IO Bool
- treeSortableSortColumnChanged :: TreeSortableClass self => self -> IO ()
- sortColumnChanged :: TreeSortableClass self => Signal self (IO ())

# Detail

`TreeSortable` is an interface to be implemented by tree models which support sorting. The `TreeView` uses the methods provided by this interface to sort the model. As of now, only the `TreeModelSort` proxy supports the sortable interface. Thus, in order to enable sortable columns in a `TreeView`, it is necessary to wrap a `ListStore` or `TreeStore` model in a `TreeModelSort`.

A `TreeViewColumn` can be sorted by the user though clicking into the column's header. The rows in the view will then be sorted by the sorting function set for that column. Specifically, a set of sorting functions must be set using the interface provided in this module. Each sorting function is associated with a `SortColumnId`, which is some positive number. A tree view column is then associated with the sorting function by passing the `SortColumnId` to `treeViewColumnSetSortColumnId`. There exists one special `SortColumnId`, namely `treeSortableDefaultSortColumnId` for which a default sorting function can be set. If no such function is set, the order of the rows is the order in which they are stored in the model.

# Class Hierarchy

    | GInterface
    | +----TreeSortable

# Types

data TreeSortable Source #

#### Instances

Instances details

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

Instance details

Defined in Graphics.UI.Gtk.Types

Methods

compare :: TreeSortable -> TreeSortable -> Ordering Source #

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

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

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

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

max :: TreeSortable -> TreeSortable -> TreeSortable Source #

min :: TreeSortable -> TreeSortable -> TreeSortable Source #

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

class GObjectClass o => TreeSortableClass o Source #

#### Instances

Instances details

TreeSortableClass TreeModelSort Source # |
Instance details Defined in Graphics.UI.Gtk.ModelView.TreeModelSort
TreeSortableClass TreeSortable Source # |
Instance details Defined in Graphics.UI.Gtk.Types
TreeSortableClass (TypedTreeModelSort row) Source # |
Instance details Defined in Graphics.UI.Gtk.ModelView.TreeModelSort

castToTreeSortable :: GObjectClass obj => obj -> TreeSortable Source #

gTypeTreeSortable :: GType Source #

toTreeSortable :: TreeSortableClass o => o -> TreeSortable Source #

type SortColumnId = Int Source #

ID number of a sort column.

- A `SortColumnId` is a logical number to which a sorting function can be associated. The number does not have to coincide with any column number.

# Constants

treeSortableDefaultSortColumnId :: SortColumnId Source #

A special `SortColumnId` to indicated that the default sorting function is used.

# Methods

treeSortableGetSortColumnId Source #

Arguments

:: TreeSortableClass self |
=> self |
-> IO (SortType, Bool, SortColumnId) | `(type, columnSet, sortColumnId)` returns `True` in `columnSet` if `sortColumnId` is not `treeSortableDefaultSortColumnId`. The `type` value indicates increasing or decreasing ordering.

Query the sort column id that is currently in use. The return value may be the special constant `treeSortableDefaultSortColumnId` in which case the returned Boolean flag is `False`.

treeSortableSetSortColumnId Source #

Arguments

:: TreeSortableClass self |
=> self |
-> SortColumnId | `sortColumnId` - the sort column id to set
-> SortType | `order` - The sort order of the column
-> IO () |

Sets the current sort column to be `sortColumnId`. The `sortable` will resort itself to reflect this change, after emitting a `sortColumnChanged` signal. If `sortColumnId` is `treeSortableDefaultSortColumnId`, then the default sort function will be used, if it is set. Note that this function is mainly used by the view and that the user program should simply set the `SortColumnId` of the `TreeViewColumn`s.

treeSortableSetSortFunc Source #

Arguments

:: TreeSortableClass self |
=> self |
-> SortColumnId | `sortColumnId` - the sort column id to set the function for
-> (TreeIter -> TreeIter -> IO Ordering) | `sortFunc` - The comparison function
-> IO () |

Sets the comparison function used when sorting to be `sortFunc`. If the current sort column id of `self` is the same as `sortColumnId`, then the model will sort using this function.

treeSortableSetDefaultSortFunc Source #

Arguments

:: TreeSortableClass self |
=> self |
-> Maybe (TreeIter -> TreeIter -> IO Ordering) | `sortFunc` - The comparison function or `Nothing` to use default comparison function.
-> IO () |

Sets the default comparison function used when sorting to be `sortFunc`. If the current sort column id of `self` is `treeSortableDefaultSortColumnId` then the model will sort using this function.

| If `sortFunc` is `Nothing`, then there will be no default comparison function. This means that once the model has been sorted, it can't go back to the default state. In this case, when the current sort column id of sortable is `TreeSortableDefaultSortColumnId`, the model will be unsorted.

treeSortableHasDefaultSortFunc Source #

Arguments

:: TreeSortableClass self |
=> self |
-> IO Bool | returns `True`, if the model has a default sort function

Returns `True` if the model has a default sort function. This is used primarily by `TreeViewColumn`s in order to determine if a model has a default ordering or if the entries are retrieved in the sequence in which they are stored in the model.

treeSortableSortColumnChanged :: TreeSortableClass self => self -> IO () Source #

Emits a `sortColumnChanged` signal on the model.

# Signals

sortColumnChanged :: TreeSortableClass self => Signal self (IO ()) Source #