Add Tab navigation for Editor UI

This commit is contained in:
Wojciech Figat
2021-12-21 18:13:45 +01:00
parent c178afdf6b
commit af75751bf1
15 changed files with 293 additions and 195 deletions

View File

@@ -83,7 +83,7 @@ namespace FlaxEditor.Content.Import
Offsets = new Margin(-ButtonsWidth - ButtonsMargin, ButtonsWidth, -ButtonsHeight - ButtonsMargin, ButtonsHeight),
Parent = this
};
importButton.Clicked += OnImport;
importButton.Clicked += OnSubmit;
var cancelButton = new Button
{
Text = "Cancel",
@@ -223,24 +223,6 @@ namespace FlaxEditor.Content.Import
}
}
private void OnImport()
{
var entries = new List<ImportFileEntry>(_rootNode.ChildrenCount);
for (int i = 0; i < _rootNode.ChildrenCount; i++)
{
if (_rootNode.Children[i].Tag is ImportFileEntry fileEntry)
entries.Add(fileEntry);
}
Editor.Instance.ContentImporting.LetThemBeImportedxD(entries);
Close(DialogResult.OK);
}
private void OnCancel()
{
Close(DialogResult.Cancel);
}
private void OnSelectedChanged(List<TreeNode> before, List<TreeNode> after)
{
var selection = new List<object>(after.Count);
@@ -253,6 +235,20 @@ namespace FlaxEditor.Content.Import
_settingsEditor.Select(selection);
}
/// <inheritdoc />
public override void OnSubmit()
{
var entries = new List<ImportFileEntry>(_rootNode.ChildrenCount);
for (int i = 0; i < _rootNode.ChildrenCount; i++)
{
if (_rootNode.Children[i].Tag is ImportFileEntry fileEntry)
entries.Add(fileEntry);
}
Editor.Instance.ContentImporting.LetThemBeImportedxD(entries);
base.OnSubmit();
}
/// <inheritdoc />
protected override void SetupWindowSettings(ref CreateWindowSettings settings)
{
@@ -261,24 +257,5 @@ namespace FlaxEditor.Content.Import
settings.MinimumSize = new Vector2(300, 400);
settings.HasSizingFrame = true;
}
/// <inheritdoc />
public override bool OnKeyDown(KeyboardKeys key)
{
if (base.OnKeyDown(key))
return true;
switch (key)
{
case KeyboardKeys.Escape:
OnCancel();
return true;
case KeyboardKeys.Return:
OnImport();
return true;
}
return false;
}
}
}