Interface

Gtk-3.0GtkTreeSortableInterface

Interface for implementing TreeSortable. Contains only the virtual methods that need to be implemented.

interface Interface {
    vfunc_get_column_type(index_: number): GType;
    vfunc_get_flags(): Gtk.TreeModelFlags;
    vfunc_get_iter(path: Gtk.TreePath): [boolean, Gtk.TreeIter];
    vfunc_get_n_columns(): number;
    vfunc_get_path(iter: Gtk.TreeIter): Gtk.TreePath;
    vfunc_get_sort_column_id(): [boolean, number, Gtk.SortType];
    vfunc_get_value(iter: Gtk.TreeIter, column: number): unknown;
    vfunc_has_default_sort_func(): boolean;
    vfunc_iter_children(parent?: Gtk.TreeIter): [boolean, Gtk.TreeIter];
    vfunc_iter_has_child(iter: Gtk.TreeIter): boolean;
    vfunc_iter_n_children(iter?: Gtk.TreeIter): number;
    vfunc_iter_next(iter: Gtk.TreeIter): boolean;
    vfunc_iter_nth_child(
        parent: Gtk.TreeIter,
        n: number,
    ): [boolean, Gtk.TreeIter];
    vfunc_iter_parent(child: Gtk.TreeIter): [boolean, Gtk.TreeIter];
    vfunc_iter_previous(iter: Gtk.TreeIter): boolean;
    vfunc_ref_node(iter: Gtk.TreeIter): void;
    vfunc_row_changed(path: Gtk.TreePath, iter: Gtk.TreeIter): void;
    vfunc_row_deleted(path: Gtk.TreePath): void;
    vfunc_row_has_child_toggled(path: Gtk.TreePath, iter: Gtk.TreeIter): void;
    vfunc_row_inserted(path: Gtk.TreePath, iter: Gtk.TreeIter): void;
    vfunc_set_default_sort_func(
        sort_func: Gtk.TreeIterCompareFunc,
        destroy?: DestroyNotify,
    ): void;
    vfunc_set_sort_column_id(sort_column_id: number, order: Gtk.SortType): void;
    vfunc_set_sort_func(
        sort_column_id: number,
        sort_func: Gtk.TreeIterCompareFunc,
        destroy?: DestroyNotify,
    ): void;
    vfunc_sort_column_changed(): void;
    vfunc_unref_node(iter: Gtk.TreeIter): void;
}

Hierarchy (View Summary)

Index

Methods

  • Fills in sort_column_id and order with the current sort column and the order. It returns true unless the sort_column_id is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.

    Returns [boolean, number, Gtk.SortType]

  • Returns true if the model has a default sort function. This is used primarily by GtkTreeViewColumns in order to determine if a model can go back to the default state, or not.

    Returns boolean

  • Sets the default comparison function used when sorting to be sort_func. If the current sort column id of sortable is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using this function.

    If sort_func is null, 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 GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted.

    Parameters

    Returns void

  • Sets the current sort column to be sort_column_id. The sortable will resort itself to reflect this change, after emitting a Gtk.TreeSortable.SignalSignatures.sort_column_changed | Gtk.TreeSortable::sort-column-changed signal. sort_column_id may either be a regular column id, or one of the following special values:

    • GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID: the default sort function will be used, if it is set

    • GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur

    Parameters

    • sort_column_id: number

      the sort column id to set

    • order: Gtk.SortType

      The sort order of the column

    Returns void

  • Sets the comparison function used when sorting to be sort_func. If the current sort column id of sortable is the same as sort_column_id, then the model will sort using this function.

    Parameters

    • sort_column_id: number

      the sort column id to set the function for

    • sort_func: Gtk.TreeIterCompareFunc

      The comparison function

    • Optionaldestroy: DestroyNotify

      Destroy notifier of user_data, or null

    Returns void

  • Emits a Gtk.TreeSortable.SignalSignatures.sort_column_changed | Gtk.TreeSortable::sort-column-changed signal on sortable.

    Returns void

Methods - Inherited from Gtk.TreeModel.Interface

  • Sets iter to be the child of parent, using the given index.

    The first index is 0. If n is too big, or parent has no children, iter is set to an invalid iterator and false is returned. parent will remain a valid node after this function has been called. As a special case, if parent is null, then the n-th root node is set.

    Parameters

    • parent: Gtk.TreeIter

      the Gtk.TreeIter-struct to get the child from, or null.

    • n: number

      the index of the desired child

    Returns [boolean, Gtk.TreeIter]

  • Sets iter to be the parent of child.

    If child is at the toplevel, and doesn’t have a parent, then iter is set to an invalid iterator and false is returned. child will remain a valid node after this function has been called.

    iter will be initialized before the lookup is performed, so child and iter cannot point to the same memory location.

    Parameters

    Returns [boolean, Gtk.TreeIter]

  • Lets the tree ref the node.

    This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons.

    This function is primarily meant as a way for views to let caching models know when nodes are being displayed (and hence, whether or not to cache that node). Being displayed means a node is in an expanded branch, regardless of whether the node is currently visible in the viewport. For example, a file-system based model would not want to keep the entire file-hierarchy in memory, just the sections that are currently being displayed by every current view.

    A model should be expected to be able to get an iter independent of its reffed state.

    Parameters

    Returns void

  • Emits the Gtk.TreeModel.SignalSignatures.row_deleted | Gtk.TreeModel::row-deleted signal on tree_model.

    This should be called by models after a row has been removed. The location pointed to by path should be the location that the row previously was at. It may not be a valid location anymore.

    Nodes that are deleted are not unreffed, this means that any outstanding references on the deleted node should not be released.

    Parameters

    Returns void

  • Lets the tree unref the node.

    This is an optional method for models to implement. To be more specific, models may ignore this call as it exists primarily for performance reasons. For more information on what this means, see gtk_tree_model_ref_node().

    Please note that nodes that are deleted are not unreffed.

    Parameters

    Returns void