/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see .
*/
using System;
using System.Collections.Generic;
using System.Windows.Controls;
namespace dnSpy.Contracts.TreeView {
///
/// A treeview
///
public interface ITreeView : IDisposable {
///
/// Guid of this treeview
///
Guid Guid { get; }
///
/// Gets the invisible root node
///
ITreeNode Root { get; }
///
/// Creates a new instance that can be inserted into this, and only
/// this, treeview.
///
/// User data
///
ITreeNode Create(TreeNodeData data);
///
/// Gets the treeview UI object
///
Control UIObject { get; }
///
/// Select items
///
/// Items to select
void SelectItems(IEnumerable items);
///
/// Selects all visible items
///
void SelectAll();
///
/// Raised when selection has changed
///
event EventHandler? SelectionChanged;
///
/// Raised when a node has been removed
///
event EventHandler? NodeRemoved;
///
/// Gets the selected node or null
///
TreeNodeData? SelectedItem { get; }
///
/// Gets all selected items
///
TreeNodeData[] SelectedItems { get; }
///
/// Gets the selected items which don't have any of their ancestors selected
///
TreeNodeData[] TopLevelSelection { get; }
///
/// Focuses the treeview, possibly getting keyboard focus
///
void Focus();
///
/// Scrolls the current node into view
///
void ScrollIntoView();
///
/// Calls all nodes' method
///
void RefreshAllNodes();
///
/// Converts the selected item to a . Should rarely be called.
///
/// Selected item
///
TreeNodeData? FromImplNode(object? selectedItem);
///
/// Converts to the real tree node
///
/// Node
///
object? ToImplNode(TreeNodeData node);
///
/// Collapses all unselected nodes
///
void CollapseUnusedNodes();
}
}