I have no idea what I'm doing
This commit is contained in:
parent
59476f2718
commit
fa8f14ca6a
@ -82,7 +82,8 @@ namespace UniversalEditor.UserInterface
|
||||
}
|
||||
public void Delete()
|
||||
{
|
||||
foreach (EditorSelection sel in Selections)
|
||||
EditorSelection[] sels = GetSelections();
|
||||
foreach (EditorSelection sel in sels)
|
||||
{
|
||||
sel.Content = null;
|
||||
}
|
||||
|
||||
@ -36,7 +36,20 @@ namespace UniversalEditor.Editors.FileSystem
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
internal void ClearSelectionContent(FileSystemSelection sel)
|
||||
{
|
||||
while (tv.SelectedRows.Count > 0)
|
||||
{
|
||||
if (tv.SelectedRows[0].GetExtraData<IFileSystemObject>("item") == sel.Item)
|
||||
{
|
||||
tmTreeView.Rows.Remove(tv.SelectedRows[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void OnCreated(EventArgs e)
|
||||
{
|
||||
this.tv.RegisterDragSource(new DragDropTarget[]
|
||||
@ -67,9 +80,9 @@ namespace UniversalEditor.Editors.FileSystem
|
||||
for (int i = 0; i < tv.SelectedRows.Count; i++)
|
||||
{
|
||||
TreeModelRow row = tv.SelectedRows[i];
|
||||
if (row == null) continue;
|
||||
|
||||
FileSystemSelection sel = new FileSystemSelection(row.GetExtraData<IFileSystemObject>("item"));
|
||||
Selections.Add(sel);
|
||||
Selections.Add(new FileSystemSelection(this, row.GetExtraData<IFileSystemObject>("item")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -26,10 +26,22 @@ namespace UniversalEditor.Editors.FileSystem
|
||||
internal class FileSystemSelection : EditorSelection
|
||||
{
|
||||
public IFileSystemObject Item { get; set; } = null;
|
||||
public override object Content { get => Item; set => Item = (value is IFileSystemObject ? (value as IFileSystemObject) : null); }
|
||||
|
||||
public FileSystemSelection(IFileSystemObject item)
|
||||
public override object Content
|
||||
{
|
||||
get => Item;
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
_parent.ClearSelectionContent(this);
|
||||
|
||||
Item = (value is IFileSystemObject ? (value as IFileSystemObject) : null);
|
||||
}
|
||||
}
|
||||
|
||||
private FileSystemEditor _parent = null;
|
||||
internal FileSystemSelection(FileSystemEditor parent, IFileSystemObject item)
|
||||
{
|
||||
_parent = parent;
|
||||
Item = item;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user