expose the Editors and Documents in a given UE MainWindow

This commit is contained in:
Michael Becker 2021-01-09 22:39:57 -05:00
parent 9ef4d183e6
commit 97c9e605c4
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C
4 changed files with 56 additions and 0 deletions

View File

@ -32,6 +32,15 @@ namespace UniversalEditor
/// </summary>
public class Document : IDisposable
{
public class ReadOnlyDocumentCollection : System.Collections.ObjectModel.ReadOnlyCollection<Document>
{
public ReadOnlyDocumentCollection(System.Collections.Generic.IList<Document> list)
: base(list)
{
}
}
/// <summary>
/// The <see cref="Accessor" /> which determines where the data is read from.
/// </summary>

View File

@ -36,6 +36,14 @@ namespace UniversalEditor.UserInterface
/// </summary>
public abstract class Editor : MBS.Framework.UserInterface.Container, IDocumentPropertiesProviderControl
{
public class ReadOnlyEditorCollection
: System.Collections.ObjectModel.ReadOnlyCollection<Editor>
{
public ReadOnlyEditorCollection(IList<Editor> list) : base(list)
{
}
}
public EditorContext Context { get; private set; } = null;
private EditorDocumentExplorer _EditorDocumentExplorer = null;

View File

@ -87,6 +87,9 @@ namespace UniversalEditor.UserInterface
ProjectObjectModel CurrentProject { get; set; }
SolutionObjectModel CurrentSolution { get; set; }
Document.ReadOnlyDocumentCollection Documents { get; }
Editor.ReadOnlyEditorCollection Editors { get; }
}
public class IHostApplicationWindowCollection
: System.Collections.ObjectModel.Collection<IHostApplicationWindow>

View File

@ -1457,6 +1457,42 @@ namespace UniversalEditor.UserInterface
}
}
public Document.ReadOnlyDocumentCollection Documents
{
get
{
// retrieve all documents currently loaded in this window
EditorPage[] pages = GetEditorPages();
List<Document> list = new List<Document>();
for (int i = 0; i < pages.Length; i++)
{
list.Add(pages[i].Document);
}
return new Document.ReadOnlyDocumentCollection(list);
}
}
public Editor.ReadOnlyEditorCollection Editors
{
get
{
// retrieve all editors currently loaded in this window
EditorPage[] pages = GetEditorPages();
List<Editor> list = new List<Editor>();
for (int i = 0; i < pages.Length; i++)
{
for (int j = 0; j < pages[i].Controls.Count; j++)
{
if (pages[i].Controls[j] is Editor)
{
list.Add(pages[i].Controls[j] as Editor);
}
}
}
return new Editor.ReadOnlyEditorCollection(list);
}
}
#endregion
public IDocumentPropertiesProvider FindDocumentPropertiesProvider(IControl control)