Class TreeStore
- All Implemented Interfaces:
Buildable,TreeDragDest,TreeDragSource,TreeModel,TreeSortable,Proxy
TreeView.
The GtkTreeStore object is a list model for use with a GtkTreeView
widget. It implements the TreeModel interface, and consequently,
can use all of the methods available there. It also implements the
TreeSortable interface so it can be sorted by the view.
Finally, it also implements the tree Gtk.TreeDragSource
and Gtk.TreeDragDest interfaces.
GtkTreeStore is deprecated since GTK 4.10, and should not be used in newly
written code. You should use TreeListModel for a tree-like model
object.
GtkTreeStore as GtkBuildable
The GtkTreeStore implementation of the GtkBuildable interface allows
to specify the model columns with a <columns> element that may contain
multiple <column> elements, each specifying one model column. The “type”
attribute specifies the data type for the column.
An example of a UI Definition fragment for a tree store:
<object class="GtkTreeStore">
<columns>
<column type="gchararray"/>
<column type="gchararray"/>
<column type="gint"/>
</columns>
</object>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTreeStore.Builder<B extends TreeStore.Builder<B>>Deprecated.Inner class implementing a builder pattern to construct a GObject with properties.static classDeprecated.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface org.gnome.gtk.TreeDragDest
TreeDragDest.TreeDragDest$Impl, TreeDragDest.TreeDragDestIfaceNested classes/interfaces inherited from interface org.gnome.gtk.TreeDragSource
TreeDragSource.TreeDragSource$Impl, TreeDragSource.TreeDragSourceIfaceNested classes/interfaces inherited from interface org.gnome.gtk.TreeModel
TreeModel.RowChangedCallback, TreeModel.RowDeletedCallback, TreeModel.RowHasChildToggledCallback, TreeModel.RowInsertedCallback, TreeModel.RowsReorderedCallback, TreeModel.TreeModel$Impl, TreeModel.TreeModelIfaceNested classes/interfaces inherited from interface org.gnome.gtk.TreeSortable
TreeSortable.SortColumnChangedCallback, TreeSortable.TreeSortable$Impl, TreeSortable.TreeSortableIface -
Field Summary
Fields inherited from class org.javagi.base.ProxyInstance
address -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new TreeStore.TreeStore(MemorySegment address) Deprecated.Create a TreeStore proxy instance for the provided memory address.Deprecated.UseTreeListModelinstead -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.UseTreeListModelinsteadprotected TreeStoreasParent()Deprecated.Returns this instance as if it were its parent type.static TreeStore.Builder<? extends TreeStore.Builder> builder()Deprecated.ATreeStore.Builderobject constructs aTreeStorewith the specified properties.voidclear()Deprecated.UseTreeListModelinsteadstatic MemoryLayoutDeprecated.The memory layout of the native struct.static TypegetType()Deprecated.Get the GType of the TreeStore classvoidDeprecated.UseTreeListModelinsteadvoidinsertAfter(TreeIter iter, @Nullable TreeIter parent, @Nullable TreeIter sibling) Deprecated.UseTreeListModelinsteadvoidinsertBefore(TreeIter iter, @Nullable TreeIter parent, @Nullable TreeIter sibling) Deprecated.UseTreeListModelinsteadvoidinsertWithValues(@Nullable TreeIter iter, @Nullable TreeIter parent, int position, int[] columns, Value[] values) Deprecated.UseTreeListModelinsteadbooleanisAncestor(TreeIter iter, TreeIter descendant) Deprecated.UseTreeListModelinsteadintDeprecated.UseTreeListModelinsteadbooleaniterIsValid(TreeIter iter) Deprecated.UseTreeListModelinsteadvoidDeprecated.UseTreeListModelinsteadvoidmoveBefore(TreeIter iter, @Nullable TreeIter position) Deprecated.UseTreeListModelinsteadvoidDeprecated.UseTreeListModelinsteadbooleanDeprecated.UseTreeListModelinsteadvoidDeprecated.UseTreeListModelinsteadvoidDeprecated.UseTreeListModelinsteadvoidsetColumnTypes(Type[] types) Deprecated.UseTreeListModelinsteadvoidDeprecated.UseTreeListModelinsteadvoidDeprecated.UseTreeListModelinsteadMethods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Buildable
getBuildableIdMethods inherited from interface org.gnome.gtk.TreeDragDest
dragDataReceived, rowDropPossibleMethods inherited from interface org.gnome.gtk.TreeDragSource
dragDataDelete, dragDataGet, rowDraggableMethods inherited from interface org.gnome.gtk.TreeModel
emitRowChanged, emitRowDeleted, emitRowHasChildToggled, emitRowInserted, emitRowsReordered, filterNew, foreach, get, getColumnType, getFlags, getIter, getIterFirst, getIterFromString, getNColumns, getPath, getStringFromIter, getValue, iterChildren, iterHasChild, iterNChildren, iterNext, iterNthChild, iterParent, iterPrevious, onRowChanged, onRowDeleted, onRowHasChildToggled, onRowInserted, onRowsReordered, refNode, rowChanged, rowDeleted, rowHasChildToggled, rowInserted, rowsReordered, unrefNodeMethods inherited from interface org.gnome.gtk.TreeSortable
emitSortColumnChanged, getSortColumnId, hasDefaultSortFunc, onSortColumnChanged, setDefaultSortFunc, setSortColumnId, setSortFunc, sortColumnChanged
-
Constructor Details
-
TreeStore
Deprecated.Create a TreeStore proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
TreeStore
Deprecated.UseTreeListModelinsteadCreates a new tree store.This constructor is meant for language bindings.
- Parameters:
types- an array ofGTypetypes for the columns, from first to last
-
TreeStore
public TreeStore()Deprecated.Creates a new TreeStore.
-
-
Method Details
-
getType
-
getMemoryLayout
Deprecated.The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Deprecated.Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
append
Deprecated.UseTreeListModelinsteadAppends a new row to this TreeStore.If
parentis non-null, then it will append the new row after the last child ofparent, otherwise it will append a row to the top level.The
iterparameter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_tree_store_set() or gtk_tree_store_set_value().- Parameters:
iter- An unsetGtkTreeIterto set to the appended rowparent- A validGtkTreeIter
-
clear
Deprecated.UseTreeListModelinsteadRemoves all rows from this TreeStore -
insert
Deprecated.UseTreeListModelinsteadCreates a new row atposition.If parent is non-
null, then the row will be made a child ofparent. Otherwise, the row will be created at the toplevel.If
positionis-1or is larger than the number of rows at that level, then the new row will be inserted to the end of the list.The
iterparameter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_tree_store_set() or gtk_tree_store_set_value().- Parameters:
iter- An unsetGtkTreeIterto set to the new rowparent- A validGtkTreeIterposition- position to insert the new row, or -1 for last
-
insertAfter
@Deprecated public void insertAfter(TreeIter iter, @Nullable @Nullable TreeIter parent, @Nullable @Nullable TreeIter sibling) Deprecated.UseTreeListModelinsteadInserts a new row aftersibling.If
siblingisnull, then the row will be prepended toparent’s children.If
parentandsiblingarenull, then the row will be prepended to the toplevel.If both
siblingandparentare set, thenparentmust be the parent ofsibling. Whensiblingis set,parentis optional.The
iterparameter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_tree_store_set() or gtk_tree_store_set_value().- Parameters:
iter- An unsetGtkTreeIterto set to the new rowparent- A validGtkTreeItersibling- A validGtkTreeIter
-
insertBefore
@Deprecated public void insertBefore(TreeIter iter, @Nullable @Nullable TreeIter parent, @Nullable @Nullable TreeIter sibling) Deprecated.UseTreeListModelinsteadInserts a new row beforesibling.If
siblingisnull, then the row will be appended toparent’s children.If
parentandsiblingarenull, then the row will be appended to the toplevel.If both
siblingandparentare set, thenparentmust be the parent ofsibling. Whensiblingis set,parentis optional.The
iterparameter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_tree_store_set() or gtk_tree_store_set_value().- Parameters:
iter- An unsetGtkTreeIterto set to the new rowparent- A validGtkTreeItersibling- A validGtkTreeIter
-
insertWithValues
@Deprecated public void insertWithValues(@Nullable @Nullable TreeIter iter, @Nullable @Nullable TreeIter parent, int position, int[] columns, Value[] values) Deprecated.UseTreeListModelinsteadA variant of gtk_tree_store_insert_with_values() which takes the columns and values as two arrays, instead of varargs.This function is mainly intended for language bindings.
- Parameters:
iter- An unsetGtkTreeIterto set the new rowparent- A validGtkTreeIterposition- position to insert the new row, or -1 for lastcolumns- an array of column numbersvalues- an array of GValues
-
isAncestor
Deprecated.UseTreeListModelinsteadChecks ifiteris an ancestor ofdescendant.- Parameters:
iter- A validGtkTreeIterdescendant- A validGtkTreeIter- Returns:
- true if
iteris an ancestor ofdescendant, and false otherwise
-
iterDepth
Deprecated.UseTreeListModelinsteadReturns the depth of the position pointed by the iteratorThe depth will be 0 for anything on the root level, 1 for anything down a level, etc.
- Parameters:
iter- A validGtkTreeIter- Returns:
- The depth of the position pointed by the iterator
-
iterIsValid
Deprecated.UseTreeListModelinsteadChecks if the given iter is a valid iter for thisGtkTreeStore.This function is slow. Only use it for debugging and/or testing purposes.
- Parameters:
iter- the iterator to check- Returns:
- true if the iter is valid, and false otherwise
-
moveAfter
Deprecated.UseTreeListModelinsteadMovesiterin this TreeStore to the position afterposition.iterandpositionshould be in the same level.Note that this function only works with unsorted stores.
If
positionisnull,iterwill be moved to the start of the level.- Parameters:
iter- AGtkTreeIter.position- AGtkTreeIter.
-
moveBefore
Deprecated.UseTreeListModelinsteadMovesiterin this TreeStore to the position beforeposition.iterandpositionshould be in the same level.Note that this function only works with unsorted stores.
If
positionisnull,iterwill be moved to the end of the level.- Parameters:
iter- AGtkTreeIterposition- AGtkTreeIter
-
prepend
Deprecated.UseTreeListModelinsteadPrepends a new row to this TreeStore.If
parentis non-null, then it will prepend the new row before the first child ofparent, otherwise it will prepend a row to the top level. Theiterparameter will be changed to point to this new row. The row will be empty after this function is called. To fill in values, you need to call gtk_tree_store_set() or gtk_tree_store_set_value().- Parameters:
iter- An unsetGtkTreeIterto set to the prepended rowparent- A validGtkTreeIter
-
remove
Deprecated.UseTreeListModelinsteadRemovesiterfrom this TreeStore.After being removed,
iteris set to the next valid row at that level, or invalidated if it previously pointed to the last one.- Parameters:
iter- A validGtkTreeIter- Returns:
- true if
iteris still valid, and false otherwise
-
reorder
Deprecated.UseTreeListModelinsteadReorders the children ofparentin this TreeStore to follow the order indicated bynewOrder.Note that this function only works with unsorted stores.
- Parameters:
parent- the parent of the children to re-ordernewOrder- an array of integers mapping the new position of each child to its old position before the re-ordering, i.e.new_order[newpos] = oldpos
-
setColumnTypes
Deprecated.UseTreeListModelinsteadSets the type of the columns in a tree store.This function is meant primarily for types that inherit from
GtkTreeStore, and should only be used when constructing a newGtkTreeStore.This functions cannot be called after a row has been added, or a method on the
GtkTreeModelinterface is called on the tree store.- Parameters:
types- An array ofGTypetypes, one for each column
-
setValue
Deprecated.UseTreeListModelinsteadSets the data in the cell specified byiterandcolumn.The type of
valuemust be convertible to the type of the column.- Parameters:
iter- A validGtkTreeIterfor the row being modifiedcolumn- column number to modifyvalue- new value for the cell
-
set
Deprecated.UseTreeListModelinsteadA variant of gtk_tree_store_set_valist() which takes the columns and values as two arrays, instead of using variadic arguments.This function is mainly intended for language bindings or in case the number of columns to change is not known until run-time.
- Parameters:
iter- A validGtkTreeIterfor the row being modifiedcolumns- an array of column numbersvalues- an array of GValues
-
swap
Deprecated.UseTreeListModelinsteadSwapsaandbin the same level of this TreeStore.Note that this function only works with unsorted stores.
- Parameters:
a- AGtkTreeIter.b- AnotherGtkTreeIter.
-
builder
Deprecated.ATreeStore.Builderobject constructs aTreeStorewith the specified properties. Use the variousset...()methods to set properties, and finish construction withTreeStore.Builder.build().
-
TreeListModelinstead