Class TreeSelection
- All Implemented Interfaces:
Proxy
The GtkTreeSelection
object is a helper object to manage the selection
for a GtkTreeView
widget. The GtkTreeSelection
object is
automatically created when a new GtkTreeView
widget is created, and
cannot exist independently of this widget. The primary reason the
GtkTreeSelection
objects exists is for cleanliness of code and API.
That is, there is no conceptual reason all these functions could not be
methods on the GtkTreeView
widget instead of a separate function.
The GtkTreeSelection
object is gotten from a GtkTreeView
by calling
gtk_tree_view_get_selection(). It can be manipulated to check the
selection status of the tree, as well as select and deselect individual
rows. Selection is done completely view side. As a result, multiple
views of the same model can have completely different selections.
Additionally, you cannot change the selection of a row on the model that
is not currently displayed by the view without expanding its parents
first.
One of the important things to remember when monitoring the selection of
a view is that the GtkTreeSelection
::changed signal is mostly a hint.
That is, it may only emit one signal when a range of rows is selected.
Additionally, it may on occasion emit a GtkTreeSelection
::changed signal
when nothing has happened (mostly as a result of programmers calling
select_row on an already selected row).
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
TreeSelection.Builder<B extends TreeSelection.Builder<B>>
Deprecated.Inner class implementing a builder pattern to construct a GObject with properties.static interface
Deprecated.Functional interface declaration of theChangedCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionTreeSelection
(MemorySegment address) Deprecated.Create a TreeSelection proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected TreeSelection
asParent()
Deprecated.Returns this instance as if it were its parent type.static TreeSelection.Builder
<? extends TreeSelection.Builder> builder()
Deprecated.ATreeSelection.Builder
object constructs aTreeSelection
with the specified properties.int
Deprecated.Use GtkListView or GtkColumnViewvoid
Deprecated.Emits the "changed" signal.getMode()
Deprecated.Use GtkListView or GtkColumnViewboolean
getSelected
(@Nullable Out<TreeModel> model, @Nullable TreeIter iter) Deprecated.Use GtkListView or GtkColumnViewgetSelectedRows
(@Nullable Out<TreeModel> model) Deprecated.Use GtkListView or GtkColumnViewDeprecated.Use GtkListView or GtkColumnViewDeprecated.Use GtkListView or GtkColumnViewstatic Type
getType()
Deprecated.Get the GType of the TreeSelection classDeprecated.Use GtkListView or GtkColumnViewboolean
iterIsSelected
(TreeIter iter) Deprecated.Use GtkListView or GtkColumnViewonChanged
(TreeSelection.ChangedCallback handler) Deprecated.Emitted whenever the selection has (possibly) changed.boolean
pathIsSelected
(TreePath path) Deprecated.Use GtkListView or GtkColumnViewvoid
Deprecated.Use GtkListView or GtkColumnViewvoid
Deprecated.Use GtkListView or GtkColumnViewvoid
selectIter
(TreeIter iter) Deprecated.Use GtkListView or GtkColumnViewvoid
selectPath
(TreePath path) Deprecated.Use GtkListView or GtkColumnViewvoid
selectRange
(TreePath startPath, TreePath endPath) Deprecated.Use GtkListView or GtkColumnViewvoid
setMode
(SelectionMode type) Deprecated.Use GtkListView or GtkColumnViewvoid
setSelectFunction
(@Nullable TreeSelectionFunc func) Deprecated.Use GtkListView or GtkColumnViewvoid
Deprecated.Use GtkListView or GtkColumnViewvoid
unselectIter
(TreeIter iter) Deprecated.Use GtkListView or GtkColumnViewvoid
unselectPath
(TreePath path) Deprecated.Use GtkListView or GtkColumnViewvoid
unselectRange
(TreePath startPath, TreePath endPath) Deprecated.Use GtkListView or GtkColumnViewMethods 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
-
TreeSelection
Deprecated.Create a TreeSelection proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
Deprecated.Get the GType of the TreeSelection class- Returns:
- the GType
-
asParent
Deprecated.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. -
countSelectedRows
Deprecated.Use GtkListView or GtkColumnViewReturns the number of rows that have been selected intree
.- Returns:
- The number of rows selected.
-
getMode
Deprecated.Use GtkListView or GtkColumnViewGets the selection mode for this TreeSelection. See gtk_tree_selection_set_mode().- Returns:
- the current selection mode
-
getSelectFunction
Deprecated.Use GtkListView or GtkColumnViewReturns the current selection function.- Returns:
- The function.
-
getSelected
@Deprecated public boolean getSelected(@Nullable @Nullable Out<TreeModel> model, @Nullable @Nullable TreeIter iter) Deprecated.Use GtkListView or GtkColumnViewSetsiter
to the currently selected node if this TreeSelection is set toSelectionMode.SINGLE
orSelectionMode.BROWSE
.iter
may be NULL if you just want to test if this TreeSelection has any selected nodes.model
is filled with the current model as a convenience. This function will not work if you use this TreeSelection isSelectionMode.MULTIPLE
.- Parameters:
model
- A pointer to set to theGtkTreeModel
iter
- TheGtkTreeIter
- Returns:
- TRUE, if there is a selected node.
-
getSelectedRows
Deprecated.Use GtkListView or GtkColumnViewCreates a list of path of all selected rows. Additionally, if you are planning on modifying the model after calling this function, you may want to convert the returned list into a list ofGtkTreeRowReference
s. To do this, you can use gtk_tree_row_reference_new().To free the return value, use:
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
- Parameters:
model
- A pointer to set to theGtkTreeModel
- Returns:
- A
GList
containing aGtkTreePath
for each selected row.
-
getTreeView
Deprecated.Use GtkListView or GtkColumnViewReturns the tree view associated with this TreeSelection.- Returns:
- A
GtkTreeView
-
getUserData
Deprecated.Use GtkListView or GtkColumnViewReturns the user data for the selection function.- Returns:
- The user data.
-
iterIsSelected
Deprecated.Use GtkListView or GtkColumnViewReturnstrue
if the row atiter
is currently selected.- Parameters:
iter
- A validGtkTreeIter
- Returns:
true
, ifiter
is selected
-
pathIsSelected
Deprecated.Use GtkListView or GtkColumnViewReturnstrue
if the row pointed to bypath
is currently selected. Ifpath
does not point to a valid location,false
is returned- Parameters:
path
- AGtkTreePath
to check selection on.- Returns:
true
ifpath
is selected.
-
selectAll
Deprecated.Use GtkListView or GtkColumnViewSelects all the nodes. this TreeSelection must be set toSelectionMode.MULTIPLE
mode. -
selectIter
Deprecated.Use GtkListView or GtkColumnViewSelects the specified iterator.- Parameters:
iter
- TheGtkTreeIter
to be selected.
-
selectPath
Deprecated.Use GtkListView or GtkColumnViewSelect the row atpath
.- Parameters:
path
- TheGtkTreePath
to be selected.
-
selectRange
Deprecated.Use GtkListView or GtkColumnViewSelects a range of nodes, determined bystartPath
andendPath
inclusive. this TreeSelection must be set toSelectionMode.MULTIPLE
mode.- Parameters:
startPath
- The initial node of the range.endPath
- The final node of the range.
-
selectedForeach
Deprecated.Use GtkListView or GtkColumnViewCalls a function for each selected node. Note that you cannot modify the tree or selection from within this function. As a result, gtk_tree_selection_get_selected_rows() might be more useful.- Parameters:
func
- The function to call for each selected node.
-
setMode
Deprecated.Use GtkListView or GtkColumnViewSets the selection mode of the this TreeSelection. If the previous type wasSelectionMode.MULTIPLE
, then the anchor is kept selected, if it was previously selected.- Parameters:
type
- The selection mode
-
setSelectFunction
Deprecated.Use GtkListView or GtkColumnViewSets the selection function.If set, this function is called before any node is selected or unselected, giving some control over which nodes are selected. The select function should return
true
if the state of the node may be toggled, andfalse
if the state of the node should be left unchanged.- Parameters:
func
- The selection function. May benull
-
unselectAll
Deprecated.Use GtkListView or GtkColumnViewUnselects all the nodes. -
unselectIter
Deprecated.Use GtkListView or GtkColumnViewUnselects the specified iterator.- Parameters:
iter
- TheGtkTreeIter
to be unselected.
-
unselectPath
Deprecated.Use GtkListView or GtkColumnViewUnselects the row atpath
.- Parameters:
path
- TheGtkTreePath
to be unselected.
-
unselectRange
Deprecated.Use GtkListView or GtkColumnViewUnselects a range of nodes, determined bystartPath
andendPath
inclusive.- Parameters:
startPath
- The initial node of the range.endPath
- The initial node of the range.
-
onChanged
public SignalConnection<TreeSelection.ChangedCallback> onChanged(TreeSelection.ChangedCallback handler) Deprecated.Emitted whenever the selection has (possibly) changed. Please note that this signal is mostly a hint. It may only be emitted once when a range of rows are selected, and it may occasionally be emitted when nothing has happened.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitChanged
public void emitChanged()Deprecated.Emits the "changed" signal. SeeonChanged(org.gnome.gtk.TreeSelection.ChangedCallback)
. -
builder
Deprecated.ATreeSelection.Builder
object constructs aTreeSelection
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withTreeSelection.Builder.build()
.
-