/* 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 dnSpy.Contracts.Documents.TreeView; using dnSpy.Contracts.Tabs; namespace dnSpy.Contracts.Documents.Tabs { /// /// Manages the document tabs and treeview /// public interface IDocumentTabService { /// /// Gets the instance /// IDocumentTreeView DocumentTreeView { get; } /// /// Gets the instance /// ITabGroupService TabGroupService { get; } /// /// Gets all instances /// IEnumerable SortedTabs { get; } /// /// Same as except that visible tabs are returned first /// IEnumerable VisibleFirstTabs { get; } /// /// Gets the active tab or null if none, see also /// IDocumentTab? ActiveTab { get; set; } /// /// Gets the active tab or creates a new one if is null /// /// IDocumentTab GetOrCreateActiveTab(); /// /// Opens a new empty tab and sets it as the active tab () /// /// IDocumentTab OpenEmptyTab(); /// /// Gives keyboard focus /// /// Tab void SetFocus(IDocumentTab tab); /// /// Forces a refresh of the selected tabs /// /// Tabs to refresh void Refresh(IEnumerable tabs); /// /// Refreshes all tabs that contain nodes of type /// /// Node type void Refresh() where T : DocumentTreeNodeData; /// /// Refreshes all tabs that contain certain nodes /// /// Returns true if the node should be included void Refresh(Predicate pred); /// /// Refreshes all tabs that use /// /// Modified document void RefreshModifiedDocument(IDsDocument document); /// /// Raised when gets called /// event EventHandler? DocumentModified; /// /// Notified when the document collection gets changed /// event EventHandler? DocumentCollectionChanged; /// /// Returns true if is owned by this instance /// /// Tab group /// bool Owns(ITabGroup tabGroup); /// /// Closes the tab /// /// void Close(IDocumentTab tab); /// /// Tries to get the /// /// Tab content /// IDocumentTab? TryGetDocumentTab(ITabContent? content); /// /// Closes all tabs /// void CloseAll(); /// /// Follows the reference in the active tab or a new tab /// /// Reference /// true to open a new tab /// true to give the tab keyboard focus /// Called after the content has been shown. Can be null. void FollowReference(object @ref, bool newTab = false, bool setFocus = true, Action? onShown = null); /// /// Creates a new instance. Returns null if it couldn't be created /// /// Nodes /// DocumentTabContent? TryCreateContent(DocumentTreeNodeData[] nodes); } }