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
Nested ClassesModifier and TypeClassDescriptionstatic classTreeSelection.Builder<B extends TreeSelection.Builder<B>>Deprecated.Inner class implementing a builder pattern to construct a GObject with properties.static interfaceDeprecated.Functional interface declaration of theChangedCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new TreeSelection.TreeSelection(MemorySegment address) Deprecated.Create a TreeSelection proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected TreeSelectionasParent()Deprecated.Returns this instance as if it were its parent type.static TreeSelection.Builder<? extends TreeSelection.Builder> builder()Deprecated.ATreeSelection.Builderobject constructs aTreeSelectionwith the specified properties.intDeprecated.Use GtkListView or GtkColumnViewvoidDeprecated.Emits the "changed" signal.getMode()Deprecated.Use GtkListView or GtkColumnViewbooleangetSelected(@Nullable Out<TreeModel> model, @Nullable TreeIter iter) Deprecated.Use GtkListView or GtkColumnViewgetSelectedRows(@Nullable Out<TreeModel> model) Deprecated.Use GtkListView or GtkColumnView@Nullable TreeSelectionFuncDeprecated.Use GtkListView or GtkColumnViewDeprecated.Use GtkListView or GtkColumnViewstatic @Nullable TypegetType()Deprecated.Get the GType of the TreeSelection class@Nullable MemorySegmentDeprecated.Use GtkListView or GtkColumnViewbooleaniterIsSelected(TreeIter iter) Deprecated.Use GtkListView or GtkColumnViewonChanged(TreeSelection.ChangedCallback handler) Deprecated.Emitted whenever the selection has (possibly) changed.booleanpathIsSelected(TreePath path) Deprecated.Use GtkListView or GtkColumnViewvoidDeprecated.Use GtkListView or GtkColumnViewvoidselectedForeach(@Nullable TreeSelectionForeachFunc func) Deprecated.Use GtkListView or GtkColumnViewvoidselectIter(TreeIter iter) Deprecated.Use GtkListView or GtkColumnViewvoidselectPath(TreePath path) Deprecated.Use GtkListView or GtkColumnViewvoidselectRange(TreePath startPath, TreePath endPath) Deprecated.Use GtkListView or GtkColumnViewvoidsetMode(SelectionMode type) Deprecated.Use GtkListView or GtkColumnViewvoidsetSelectFunction(@Nullable TreeSelectionFunc func) Deprecated.Use GtkListView or GtkColumnViewvoidDeprecated.Use GtkListView or GtkColumnViewvoidunselectIter(TreeIter iter) Deprecated.Use GtkListView or GtkColumnViewvoidunselectPath(TreePath path) Deprecated.Use GtkListView or GtkColumnViewvoidunselectRange(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, 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, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.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
-
TreeSelection
public TreeSelection()Deprecated.Creates a new TreeSelection.
-
-
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 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. -
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 forselection.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.Use GtkListView or GtkColumnViewSetsiterto the currently selected node if this TreeSelection is set toSelectionMode.SINGLEorSelectionMode.BROWSE.itermay be NULL if you just want to test if this TreeSelection has any selected nodes.modelis 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 theGtkTreeModeliter- 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 ofGtkTreeRowReferences. 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
GListcontaining aGtkTreePathfor each selected row.
-
getTreeView
Deprecated.Use GtkListView or GtkColumnViewReturns the tree view associated withselection.- 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 GtkColumnViewReturnstrueif the row atiteris currently selected.- Parameters:
iter- A validGtkTreeIter- Returns:
true, ifiteris selected
-
pathIsSelected
Deprecated.Use GtkListView or GtkColumnViewReturnstrueif the row pointed to bypathis currently selected. Ifpathdoes not point to a valid location,falseis returned- Parameters:
path- AGtkTreePathto check selection on.- Returns:
trueifpathis selected.
-
selectAll
Deprecated.Use GtkListView or GtkColumnViewSelects all the nodes. this TreeSelection must be set toSelectionMode.MULTIPLEmode. -
selectIter
Deprecated.Use GtkListView or GtkColumnViewSelects the specified iterator.- Parameters:
iter- TheGtkTreeIterto be selected.
-
selectPath
Deprecated.Use GtkListView or GtkColumnViewSelect the row atpath.- Parameters:
path- TheGtkTreePathto be selected.
-
selectRange
Deprecated.Use GtkListView or GtkColumnViewSelects a range of nodes, determined bystartPathandendPathinclusive. this TreeSelection must be set toSelectionMode.MULTIPLEmode.- 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 theselection.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
trueif the state of the node may be toggled, andfalseif 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- TheGtkTreeIterto be unselected.
-
unselectPath
Deprecated.Use GtkListView or GtkColumnViewUnselects the row atpath.- Parameters:
path- TheGtkTreePathto be unselected.
-
unselectRange
Deprecated.Use GtkListView or GtkColumnViewUnselects a range of nodes, determined bystartPathandendPathinclusive.- 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.Builderobject constructs aTreeSelectionwith the specified properties. Use the variousset...()methods to set properties, and finish construction withTreeSelection.Builder.build().- Returns:
- the builder object
-
SelectionModelinstead