Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added ActiveAutoHideContentChanged event to DockPanel (with underlyin…
…g ActiveContentChanged event in inner/private AutoHideWindowControl class)
  • Loading branch information
Lockszmith-GH committed Dec 13, 2012
1 parent 3932566 commit 4b6671b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions WinFormsUI/Docking/DockPanel.AutoHideWindow.cs
Expand Up @@ -82,6 +82,20 @@ private void SetActivePane()
m_activePane = value;
}

#region ActiveContentChanged Event
private static readonly object ActiveContentChangedEvent = new object();
public event EventHandler ActiveContentChanged
{
add { Events.AddHandler(ActiveContentChangedEvent, value); }
remove { Events.RemoveHandler(ActiveContentChangedEvent, value); }
}
protected virtual void OnActiveContentChanged(EventArgs e)
{
EventHandler handler = (EventHandler)Events[ActiveContentChangedEvent];
if (handler != null)
handler(this, e);
}
#endregion
private IDockContent m_activeContent = null;
public IDockContent ActiveContent
{
Expand Down Expand Up @@ -119,6 +133,8 @@ public IDockContent ActiveContent
DockPanel.RefreshAutoHideStrip();

SetTimerMouseTrack();

OnActiveContentChanged(EventArgs.Empty);
}
}

Expand Down
21 changes: 21 additions & 0 deletions WinFormsUI/Docking/DockPanel.cs
Expand Up @@ -49,6 +49,7 @@ public DockPanel()
SuspendLayout();

m_autoHideWindow = new AutoHideWindowControl(this);
m_autoHideWindow.ActiveContentChanged += m_autoHideWindow_ActiveContentChanged;
m_autoHideWindow.Visible = false;
SetAutoHideWindowParent();

Expand Down Expand Up @@ -1047,6 +1048,25 @@ private bool IsClipRectsChanged(Rectangle[] clipRects)
return false;
}

#region Events
private static readonly object ActiveAutoHideContentChangedEvent = new object();
public event EventHandler ActiveAutoHideContentChanged
{
add { Events.AddHandler(ActiveAutoHideContentChangedEvent, value); }
remove { Events.RemoveHandler(ActiveAutoHideContentChangedEvent, value); }
}
protected virtual void OnActiveAutoHideContentChanged(EventArgs e)
{
EventHandler handler = (EventHandler)Events[ActiveAutoHideContentChangedEvent];
if (handler != null)
handler(this, e);
}
private void m_autoHideWindow_ActiveContentChanged(object sender, EventArgs e)
{
OnActiveAutoHideContentChanged(e);
}


private static readonly object ContentAddedEvent = new object();
[LocalizedCategory("Category_DockingNotification")]
[LocalizedDescription("DockPanel_ContentAdded_Description")]
Expand Down Expand Up @@ -1076,5 +1096,6 @@ protected virtual void OnContentRemoved(DockContentEventArgs e)
if (handler != null)
handler(this, e);
}
#endregion
}
}

0 comments on commit 4b6671b

Please sign in to comment.