gtkTreeModelSortNewWithModel(child.model = NULL)
gtkTreeModelSortGetModel(object)
gtkTreeModelSortConvertChildPathToPath(object, child.path)
gtkTreeModelSortConvertChildIterToIter(object, child.iter)
gtkTreeModelSortConvertPathToChildPath(object, sorted.path)
gtkTreeModelSortConvertIterToChildIter(object, sorted.iter)
gtkTreeModelSortResetDefaultSortFunc(object)
gtkTreeModelSortClearCache(object)
gtkTreeModelSortIterIsValid(object, iter)
gtkTreeModelSort(child.model = NULL)
GtkTreeModelSort
## Using a GtkTreeModel sort## get the child model child_model <- get_my_model()
## Create the first tree sort_model1 <- gtkTreeModelSort(child_model) tree_view1 <- gtkTreeView(sort_model1)
## Create the second tree sort_model2 <- gtkTreeModelSort(child_model) tree_view2 <- gtkTreeView(sort_model2)
## Now we can sort the two models independently
sort_model1$setSortColumnId(0, "ascending")
sort_model2$setSortColumnId(0, "descending")
To demonstrate how to access the underlying child model from the sort
model, the next example will be a callback for the
selection_changed <- function(selection, data) { # Get the current selected row and the model. selected <- selection$getSelected() if (!selected[[1]]) return()
## Look up the current value on the selected row and get a new value ## to change it to. some_data <- selected$model$get(selected$iter, COLUMN_1) modified_data <- change_the_data(some_data)
## Get an iterator on the child model, instead of the sort model. child_iter <- sort_model$convertIterToChildIter(selected$iter)$iter
## Get the child model and change the value of the row. In this ## example, the child model is a GtkListStore. It could be any other ## type of model, though. child_model <- sort_model$getModel() child_model$set(child_iter, COLUMN_1, modified_data) }
gtkTreeModelSort
is the equivalent of gtkTreeModelSortNewWithModel
.