Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add open/close LayoutFlayoutingWindowsControl events #399

Merged
merged 1 commit into from
Dec 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion source/Components/AvalonDock/DockingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ public DockingManager()
/// <seealso cref="ActiveContent"/>
public event EventHandler ActiveContentChanged;

/// <summary>
/// Event is raised when LayoutFloatingWindowControl created
/// </summary>
public event EventHandler<LayoutFloatingWindowControlCreatedEventArgs> LayoutFloatingWindowControlCreated;

/// <summary>
/// Event is raised when LayoutFloatingWindowControl closed
/// </summary>
public event EventHandler<LayoutFloatingWindowControlClosedEventArgs> LayoutFloatingWindowControlClosed;


#endregion Events

#region Public Properties
Expand Down Expand Up @@ -1736,8 +1747,12 @@ internal void StartDraggingFloatingWindowForContent(LayoutContent contentModel,

var show = fwc == null; // Do not show already visible floating window
if (fwc == null)
{
fwc = CreateFloatingWindow(contentModel, false);

LayoutFloatingWindowControlCreated?.Invoke(this, new LayoutFloatingWindowControlCreatedEventArgs(fwc));
}

if (fwc != null)
{
Dispatcher.BeginInvoke(new Action(() =>
Expand All @@ -1758,6 +1773,9 @@ internal void StartDraggingFloatingWindowForPane(LayoutAnchorablePane paneModel)
{
var fwc = CreateFloatingWindowForLayoutAnchorableWithoutParent(paneModel, false);
if (fwc == null) return;

LayoutFloatingWindowControlCreated?.Invoke(this, new LayoutFloatingWindowControlCreatedEventArgs(fwc));

fwc.AttachDrag();
fwc.Show();
}
Expand Down Expand Up @@ -1815,7 +1833,12 @@ internal void GetOverlayWindowHostsByZOrder(ref List<IOverlayWindowHost> overlay
overlayWindowHosts.AddRange(bottomFloatingWindows);
}

internal void RemoveFloatingWindow(LayoutFloatingWindowControl floatingWindow) => _fwList.Remove(floatingWindow);
internal void RemoveFloatingWindow(LayoutFloatingWindowControl floatingWindow)
{
_fwList.Remove(floatingWindow);

LayoutFloatingWindowControlClosed?.Invoke(this, new LayoutFloatingWindowControlClosedEventArgs(floatingWindow));
}

internal void ExecuteCloseCommand(LayoutDocument document)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using AvalonDock.Controls;

namespace AvalonDock
{
public sealed class LayoutFloatingWindowControlClosedEventArgs : EventArgs
{
public LayoutFloatingWindowControlClosedEventArgs(LayoutFloatingWindowControl layoutFloatingWindowControl)
{
LayoutFloatingWindowControl = layoutFloatingWindowControl;
}

public LayoutFloatingWindowControl LayoutFloatingWindowControl { get; }
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using AvalonDock.Controls;
using System;

namespace AvalonDock
{
public sealed class LayoutFloatingWindowControlCreatedEventArgs : EventArgs
{
public LayoutFloatingWindowControlCreatedEventArgs(LayoutFloatingWindowControl layoutFloatingWindowControl)
{
LayoutFloatingWindowControl = layoutFloatingWindowControl;
}

public LayoutFloatingWindowControl LayoutFloatingWindowControl { get; }
}

}