feat(docking): add core enums and base classes

This commit is contained in:
2026-03-28 21:43:30 +09:00
parent 5f0eea49cf
commit 47ffc01524
3 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
using System.Collections.ObjectModel;
namespace Ghost.Editor.View.Controls.Docking;
public abstract class DockContainer : DockModule
{
public ObservableCollection<DockModule> Children { get; } = new();
protected DockContainer()
{
Children.CollectionChanged += OnChildrenChanged;
}
private void OnChildrenChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.OldItems != null)
{
foreach (DockModule module in e.OldItems)
{
module.Owner = null;
}
}
if (e.NewItems != null)
{
foreach (DockModule module in e.NewItems)
{
module.Owner = this;
// module.Root = Root;
}
}
OnChildrenUpdated();
}
protected virtual void OnChildrenUpdated() { }
}

View File

@@ -0,0 +1,16 @@
using Microsoft.UI.Xaml.Controls;
namespace Ghost.Editor.View.Controls.Docking;
public abstract class DockModule : Control
{
public DockContainer? Owner { get; internal set; }
// Note: DockingLayout will be implemented in a later task
// public DockingLayout? Root { get; internal set; }
public void Detach()
{
// Owner?.Children.Remove(this);
Owner = null;
}
}

View File

@@ -0,0 +1,10 @@
namespace Ghost.Editor.View.Controls.Docking;
public enum DockTarget
{
Center,
Left,
Right,
Top,
Bottom
}