implement ability to close a specific DockingWindow instead of just the current one
This commit is contained in:
parent
107cde359c
commit
d6e939c993
@ -21,6 +21,7 @@ using MBS.Framework.UserInterface.Input.Keyboard;
|
||||
using MBS.Framework.Drawing;
|
||||
using UniversalEditor.UserInterface.Panels;
|
||||
using MBS.Framework.UserInterface.Controls;
|
||||
using MBS.Framework.UserInterface.Controls.Docking;
|
||||
|
||||
namespace UniversalEditor.UserInterface
|
||||
{
|
||||
@ -535,6 +536,25 @@ namespace UniversalEditor.UserInterface
|
||||
#endregion
|
||||
|
||||
|
||||
Application.AttachCommandEventHandler("DockingContainerContextMenu_Close", delegate (object sender, EventArgs e)
|
||||
{
|
||||
CommandEventArgs ce = (e as CommandEventArgs);
|
||||
if (ce != null)
|
||||
{
|
||||
DockingWindow dw = ce.GetNamedParameter<DockingWindow>("Item");
|
||||
LastWindow?.CloseFile(dw);
|
||||
}
|
||||
});
|
||||
Application.AttachCommandEventHandler("DockingContainerContextMenu_CloseAll", delegate (object sender, EventArgs e)
|
||||
{
|
||||
LastWindow?.CloseWindow();
|
||||
});
|
||||
Application.AttachCommandEventHandler("DockingContainerContextMenu_CloseAllButThis", delegate (object sender, EventArgs e)
|
||||
{
|
||||
MessageDialog.ShowDialog("Not implemented ... yet", "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
|
||||
});
|
||||
|
||||
|
||||
#region Dynamic Commands
|
||||
#region View
|
||||
#region Panels
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Controls.Docking;
|
||||
|
||||
namespace UniversalEditor.UserInterface
|
||||
{
|
||||
@ -35,7 +36,7 @@ namespace UniversalEditor.UserInterface
|
||||
/// <param name="index">The index of the perspective to switch to.</param>
|
||||
void SwitchPerspective(int index);
|
||||
|
||||
void CloseFile();
|
||||
void CloseFile(DockingWindow dw = null);
|
||||
void CloseProject();
|
||||
void CloseWindow();
|
||||
|
||||
|
||||
@ -1029,16 +1029,18 @@ namespace UniversalEditor.UserInterface
|
||||
}
|
||||
|
||||
private System.Collections.Generic.List<Window> Windows = new System.Collections.Generic.List<Window>();
|
||||
public void CloseFile()
|
||||
public void CloseFile(DockingWindow dw = null)
|
||||
{
|
||||
DockingWindow dw = (dckContainer.CurrentItem as DockingWindow);
|
||||
if (dw == null)
|
||||
dw = (dckContainer.CurrentItem as DockingWindow);
|
||||
|
||||
EditorPage ep = (dw?.ChildControl as EditorPage);
|
||||
if (ep != null && !ConfirmExit(ep))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dckContainer.Items.Remove(dckContainer.CurrentItem);
|
||||
dckContainer.Items.Remove(dw);
|
||||
documentWindowCount--;
|
||||
|
||||
if (documentWindowCount == 0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user