feat(dock): add core data models for docking system
This commit is contained in:
@@ -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<DockNode> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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<object> Items { get; } = new();
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _selectedIndex = -1;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private object? _selectedItem;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user