Add Tab navigation for Editor UI
This commit is contained in:
@@ -62,7 +62,7 @@ namespace FlaxEditor.Content.Create
|
||||
Offsets = new Margin(-ButtonsWidth - ButtonsMargin, ButtonsWidth, -ButtonsHeight - ButtonsMargin, ButtonsHeight),
|
||||
Parent = this
|
||||
};
|
||||
createButton.Clicked += OnCreate;
|
||||
createButton.Clicked += OnSubmit;
|
||||
var cancelButton = new Button
|
||||
{
|
||||
Text = "Cancel",
|
||||
@@ -89,27 +89,12 @@ namespace FlaxEditor.Content.Create
|
||||
_settingsEditor.Select(_entry.Settings);
|
||||
}
|
||||
|
||||
private void OnCreate()
|
||||
/// <inheritdoc />
|
||||
public override void OnSubmit()
|
||||
{
|
||||
Editor.Instance.ContentImporting.LetThemBeCreatedxD(_entry);
|
||||
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);
|
||||
for (int i = 0; i < after.Count; i++)
|
||||
{
|
||||
if (after[i].Tag is CreateFileEntry fileEntry && fileEntry.HasSettings)
|
||||
selection.Add(fileEntry.Settings);
|
||||
}
|
||||
|
||||
_settingsEditor.Select(selection);
|
||||
base.OnSubmit();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,6 +612,15 @@ namespace FlaxEditor.Content
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void NavigationFocus()
|
||||
{
|
||||
base.NavigationFocus();
|
||||
|
||||
if (IsFocused)
|
||||
(Parent as ContentView)?.Select(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
{
|
||||
@@ -738,6 +747,15 @@ namespace FlaxEditor.Content
|
||||
base.OnMouseLeave();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSubmit()
|
||||
{
|
||||
// Open
|
||||
(Parent as ContentView).OnItemDoubleClick(this);
|
||||
|
||||
base.OnSubmit();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int Compare(Control other)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user