Add Tab navigation for Editor UI
This commit is contained in:
@@ -24,6 +24,11 @@ namespace FlaxEditor.Windows
|
||||
/// </summary>
|
||||
protected virtual bool CanOpenContentFinder => true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this window can use UI navigation (tab/enter).
|
||||
/// </summary>
|
||||
protected virtual bool CanUseNavigation => true;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EditorWindow"/> class.
|
||||
/// </summary>
|
||||
@@ -184,6 +189,32 @@ namespace FlaxEditor.Windows
|
||||
|
||||
#endregion
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnKeyDown(KeyboardKeys key)
|
||||
{
|
||||
if (base.OnKeyDown(key))
|
||||
return true;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case KeyboardKeys.Return:
|
||||
if (CanUseNavigation && Root?.FocusedControl != null)
|
||||
{
|
||||
Root.SubmitFocused();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case KeyboardKeys.Tab:
|
||||
if (CanUseNavigation && Root != null)
|
||||
{
|
||||
Root.Navigate(NavDirection.Next);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnDestroy()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user