using System;
using System.Collections;
using System.Collections.Generic;
namespace Core.Common.Controls.Swf.TreeViewControls
{
///
/// Interface for visual TreeView to display hierarchical data.
///
public interface ITreeView : IView
{
///
/// Event to notify observers of changes in the selection
///
event EventHandler SelectedNodeChanged;
///
/// Event to notify observers of changes in the tree structure
///
event EventHandler OnUpdate;
event Action BeforeWaitUntilAllEventsAreProcessed;
///
/// All nodes contained in the tree
///
IList Nodes { get; }
///
/// Currently selected node.
///
ITreeNode SelectedNode { get; set; }
///
/// Show / hide check boxes.
///
bool CheckBoxes { get; set; }
///
/// Node presenters, sitting between specific data objects and the tree view
///
ICollection NodePresenters { get; }
IComparer TreeViewNodeSorter { get; set; }
IEnumerable AllLoadedNodes { get; }
///
/// Returns a specific node presenter for the given data object.
///
///
///
ITreeNodePresenter GetTreeViewNodePresenter(object nodeData, ITreeNode node);
///
/// Creates a new node (not added to the tree yet)
///
///
ITreeNode NewNode();
///
/// Creates a new node and adds it to the tree
///
///
ITreeNode AddNewNode(ITreeNode parentNode, object nodeData, int insertionIndex = -1);
///
/// Returns the node which tag is set to the given data object
///
///
///
///
ITreeNode GetNodeByTag(object nodeData, bool skipUnLoadedNodes = true);
///
/// Refreshes the tree view based on the underlying data.
///
void Refresh();
///
/// TODO: move to node
///
///
[Obsolete("YAGNI")]
void RefreshChildNodes(ITreeNode treeNode);
void UpdateNode(ITreeNode treeNode);
///
/// Tree view may perform some updates asynchroneously.
/// This method allows to wait until all pending asynchroneous events are processed.
///
void WaitUntilAllEventsAreProcessed();
///
/// Collapses all nodes and their child nodes (recursively).
///
void CollapseAll();
///
/// Collapses a given node and all its child nodes (recursively).
///
///
void CollapseAll(ITreeNode node);
///
/// Expands all nodes and their child nodes (recursively).
///
void ExpandAll();
///
/// Expands a given node and all its child nodes (recursively).
///
///
void ExpandAll(ITreeNode node);
///
/// Gets node and all its child nodes (if loaded).
///
///
///
IEnumerable GetAllLoadedNodes(ITreeNode node);
///
/// Suspend tree view refreshes (long running actions), sets IsUpdateSuspended to true.
///
void BeginUpdate();
///
/// Ends updates, sets IsUpdateSuspended to false.
///
void EndUpdate();
///
/// Checks if label of current node can be edited and starts edit mode if this is the case.
///
void StartLabelEdit();
///
/// Attempts to delete the currently selected data.
///
void TryDeleteSelectedNodeData();
///
/// Attempts to delete the given .
///
/// The to try and delete.
void TryDeleteNodeData(ITreeNode node);
}
}