Class TreeListRow
- All Implemented Interfaces:
Proxy
GtkTreeListRow
is used by GtkTreeListModel
to represent items.
It allows navigating the model as a tree and modify the state of rows.
GtkTreeListRow
instances are created by a GtkTreeListModel
only
when the Gtk.TreeListModel:passthrough
property is not set.
There are various support objects that can make use of GtkTreeListRow
objects, such as the TreeExpander
widget that allows displaying
an icon to expand or collapse a row or TreeListRowSorter
that
makes it possible to sort trees properly.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
TreeListRow.Builder<B extends TreeListRow.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionTreeListRow
(MemorySegment address) Create a TreeListRow proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected TreeListRow
asParent()
Returns this instance as if it were its parent type.static TreeListRow.Builder
<? extends TreeListRow.Builder> builder()
ATreeListRow.Builder
object constructs aTreeListRow
with the specified properties.If the row is expanded, gets the model holding the children of this TreeListRow.getChildRow
(int position) If this TreeListRow is not expanded orposition
is greater than the number of children,null
is returned.int
getDepth()
Gets the depth of this row.boolean
Gets if a row is currently expanded.getItem()
Gets the item corresponding to this row,Gets the row representing the parent for this TreeListRow.int
Returns the position in theGtkTreeListModel
that this TreeListRow occupies at the moment.static Type
getType()
Get the GType of the TreeListRow classboolean
Checks if a row can be expanded.void
setExpanded
(boolean expanded) Expands or collapses a row.Methods 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, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
TreeListRow
Create a TreeListRow proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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. -
getChildRow
If this TreeListRow is not expanded orposition
is greater than the number of children,null
is returned.- Parameters:
position
- position of the child to get- Returns:
- the child in
position
-
getChildren
If the row is expanded, gets the model holding the children of this TreeListRow.This model is the model created by the
Gtk.TreeListModelCreateModelFunc
and contains the original items, no matter what valueGtk.TreeListModel:passthrough
is set to.- Returns:
- The model containing the children
-
getDepth
public int getDepth()Gets the depth of this row.Rows that correspond to items in the root model have a depth of zero, rows corresponding to items of models of direct children of the root model have a depth of 1 and so on.
The depth of a row never changes until the row is removed from its model at which point it will forever return 0.
- Returns:
- The depth of this row
-
getExpanded
public boolean getExpanded()Gets if a row is currently expanded.- Returns:
true
if the row is expanded
-
getItem
Gets the item corresponding to this row,- Returns:
- The item of this row. This function is only marked as nullable for backwards compatibility reasons.
-
getParent
Gets the row representing the parent for this TreeListRow.That is the row that would need to be collapsed to make this row disappear.
If this TreeListRow is a row corresponding to the root model,
null
is returned.The value returned by this function never changes until the row is removed from its model at which point it will forever return
null
.- Returns:
- The parent of this TreeListRow
-
getPosition
public int getPosition()Returns the position in theGtkTreeListModel
that this TreeListRow occupies at the moment.- Returns:
- The position in the model
-
isExpandable
public boolean isExpandable()Checks if a row can be expanded.This does not mean that the row is actually expanded, this can be checked with
getExpanded()
.If a row is expandable never changes until the row is removed from its model at which point it will forever return
false
.- Returns:
true
if the row is expandable
-
setExpanded
public void setExpanded(boolean expanded) Expands or collapses a row.If a row is expanded, the model of calling the
Gtk.TreeListModelCreateModelFunc
for the row's item will be inserted after this row. If a row is collapsed, those items will be removed from the model.If the row is not expandable, this function does nothing.
- Parameters:
expanded
-true
if the row should be expanded
-
builder
ATreeListRow.Builder
object constructs aTreeListRow
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withTreeListRow.Builder.build()
.
-