initial commit of window switcher

This commit is contained in:
Michael Becker 2021-12-14 22:25:49 -05:00
parent 3e09aa7f4c
commit 45929884b8
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C
2 changed files with 42 additions and 3 deletions

View File

@ -8,6 +8,7 @@ using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls.Docking;
using MBS.Framework.UserInterface.Controls.ListView;
using MBS.Framework.UserInterface.Dialogs;
using MBS.Framework.UserInterface.Input.Keyboard;
using UniversalEditor.Accessors;
using UniversalEditor.ObjectModels.Markup;
using UniversalEditor.ObjectModels.PropertyList;
@ -45,6 +46,44 @@ namespace UniversalEditor.UserInterface
base.InitializeInternal();
InitializePanels();
InitializeWindowSwitcher();
}
private void InitializeWindowSwitcher()
{
// FIXME: this should be implemented as a plugin or directly in the UI Framework codebase
this.EventFilters.Add(new EventFilter<KeyEventArgs>(delegate (ref KeyEventArgs e)
{
if (e.Key == KeyboardKey.Tab && (e.ModifierKeys & KeyboardModifierKey.Control) == KeyboardModifierKey.Control)
{
MainWindow mw = (CurrentWindow as MainWindow);
if (mw != null)
{
mw.SetWindowListVisible(true, false);
}
else
{
Console.WriteLine("got tab but no main window");
}
return true;
}
return false;
}, EventFilterType.KeyDown));
this.EventFilters.Add(new EventFilter<KeyEventArgs>(delegate (ref KeyEventArgs e)
{
if (e.Key == KeyboardKey.LControlKey || e.Key == KeyboardKey.RControlKey)
{
MainWindow mw = (CurrentWindow as MainWindow);
if (mw != null)
{
mw.SetWindowListVisible(false, false);
}
Console.WriteLine("window switch");
Console.WriteLine("current window: {0}", CurrentWindow?.ToString() ?? "(null)");
return true;
}
return false;
}, EventFilterType.KeyUp));
}
/// <summary>

View File

@ -1897,17 +1897,17 @@ namespace UniversalEditor.UserInterface
// this calls out to the DockingContainerControl in WF
if (modal)
{
// dckContainer.ShowWindowListPopupDialog();
dckContainer.ShowWindowListPopupDialog();
}
else
{
if (visible)
{
// dckContainer.ShowWindowListPopup();
dckContainer.ShowWindowListPopup();
}
else
{
// dckContainer.HideWindowListPopup();
dckContainer.HideWindowListPopup();
}
}
}