GtkTreeSortable {RGtk2} | R Documentation

## GtkTreeSortable

### Description

The interface for sortable models used by GtkTreeView

### Methods and Functions

`gtkTreeSortableSortColumnChanged(object)`
`gtkTreeSortableGetSortColumnId(object)`
`gtkTreeSortableSetSortColumnId(object, sort.column.id, order)`
`gtkTreeSortableSetSortFunc(object, sort.column.id, sort.func, user.data = NULL)`
`gtkTreeSortableSetDefaultSortFunc(object, sort.func, user.data = NULL)`
`gtkTreeSortableHasDefaultSortFunc(object)`

### Hierarchy

    GInterface
       +----GtkTreeSortable

### Implementations

GtkTreeSortable is implemented by `GtkListStore`, `GtkTreeModelSort` and `GtkTreeStore`.

### Detailed Description

`GtkTreeSortable` is an interface to be implemented by tree models which support sorting. The `GtkTreeView` uses the methods provided by this interface to sort the model.

### Structures

`GtkTreeSortable`

  undocumented

### User Functions

`GtkTreeIterCompareFunc(model, a, b, user.data)`

  A GtkTreeIterCompareFunc should return a negative integer, zero, or a positive integer if `a` sorts before `b`, `a` sorts with `b`, or `a` sorts after `b` respectively. If two iters compare as equal, their order in the sorted model is undefined. In order to ensure that the `GtkTreeSortable` behaves as expected, the GtkTreeIterCompareFunc must define a partial order on the model, i.e. it must be reflexive, antisymmetric and transitive.

  For example, if `model` is a product catalogue, then a compare function for the "price" column could be one which returns `price_of( a ) - price_of( b )`.

  `model`

    The `GtkTreeModel` the comparison is within

  `a`

    A `GtkTreeIter` in `model`

  `b`

    Another `GtkTreeIter` in `model`

  `user.data`

    Data passed when the compare func is assigned e.g. by `gtkTreeSortableSetSortFunc`

  Returns: [integer] a negative integer, zero or a positive integer depending on whether `a` sorts before, with or after `b`

### Signals

`sort-column-changed(sortable, user.data)`

  The ::sort-column-changed signal is emitted when the sort column or sort order of `sortable` is changed. The signal is emitted before the contents of `sortable` are resorted.

  `sortable`

    the object on which the signal is emitted

  `user.data`

    user data set when the signal handler was connected.

### Author(s)

Derived by RGtkGen from GTK+ documentation

### References

https://developer.gnome.org/gtk2/stable/GtkTreeSortable.html

### See Also

`GtkTreeModel` `GtkTreeView`

[Package RGtk2 version 2.20.36.3 Index]