diff --git a/src/Editor/Ghost.Editor.Core/Controls/Internal/Docking/DockGroupNode.cs b/src/Editor/Ghost.Editor.Core/Controls/Internal/Docking/DockGroupNode.cs new file mode 100644 index 0000000..02ea774 --- /dev/null +++ b/src/Editor/Ghost.Editor.Core/Controls/Internal/Docking/DockGroupNode.cs @@ -0,0 +1,27 @@ +using System.Collections.ObjectModel; +using CommunityToolkit.Mvvm.ComponentModel; +using Microsoft.UI.Xaml.Controls; + +namespace Ghost.Editor.Core.Controls.Internal.Docking; + +public partial class DockGroupNode : DockNode +{ + [ObservableProperty] + private Orientation _orientation = Orientation.Horizontal; + + public ObservableCollection Children { get; } = new(); + + public void AddChild(DockNode node) + { + node.Parent = this; + Children.Add(node); + } + + public void RemoveChild(DockNode node) + { + if (Children.Remove(node)) + { + node.Parent = null; + } + } +} diff --git a/src/Editor/Ghost.Editor.Core/Controls/Internal/Docking/DockNode.cs b/src/Editor/Ghost.Editor.Core/Controls/Internal/Docking/DockNode.cs new file mode 100644 index 0000000..ba0aa3a --- /dev/null +++ b/src/Editor/Ghost.Editor.Core/Controls/Internal/Docking/DockNode.cs @@ -0,0 +1,9 @@ +using CommunityToolkit.Mvvm.ComponentModel; + +namespace Ghost.Editor.Core.Controls.Internal.Docking; + +public abstract partial class DockNode : ObservableObject +{ + [ObservableProperty] + private DockGroupNode? _parent; +} diff --git a/src/Editor/Ghost.Editor.Core/Controls/Internal/Docking/DockPanelNode.cs b/src/Editor/Ghost.Editor.Core/Controls/Internal/Docking/DockPanelNode.cs new file mode 100644 index 0000000..6d3f471 --- /dev/null +++ b/src/Editor/Ghost.Editor.Core/Controls/Internal/Docking/DockPanelNode.cs @@ -0,0 +1,15 @@ +using System.Collections.ObjectModel; +using CommunityToolkit.Mvvm.ComponentModel; + +namespace Ghost.Editor.Core.Controls.Internal.Docking; + +public partial class DockPanelNode : DockNode +{ + public ObservableCollection Items { get; } = new(); + + [ObservableProperty] + private int _selectedIndex = -1; + + [ObservableProperty] + private object? _selectedItem; +}