Updates to DropDownPanel, Baseline, & Controls
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AT.STO.UI.Win
|
||||
@@ -22,7 +21,7 @@ namespace AT.STO.UI.Win
|
||||
|
||||
private Form _dropDown = null;
|
||||
private bool _dropDownShowing = false;
|
||||
private DropDownMessageFilter _filter = null;
|
||||
private readonly DropDownMessageFilter _filter = null;
|
||||
private Form _owner = null;
|
||||
private bool _skipClose = false;
|
||||
#endregion
|
||||
@@ -42,31 +41,25 @@ namespace AT.STO.UI.Win
|
||||
_filter.DropDownCancel -= new DropDownCancelEventHandler(Popup_Cancel);
|
||||
_filter.DropDownCancel += new DropDownCancelEventHandler(Popup_Cancel);
|
||||
}
|
||||
#endregion
|
||||
#region Event Handler
|
||||
private void Popup_Cancel(object sender, DropDownCancelEventArgs e)
|
||||
{
|
||||
OnDropDownCancel(e);
|
||||
}
|
||||
#endregion
|
||||
#region Event Handler
|
||||
private void Popup_Cancel(object sender, DropDownCancelEventArgs e) => OnDropDownCancel(e);
|
||||
|
||||
/// <summary>
|
||||
/// Responds to the <see cref="System.Windows.Forms.Form.Closed"/>
|
||||
/// event from the popup form.
|
||||
/// </summary>
|
||||
/// <param name="sender">Popup form that has been closed.</param>
|
||||
/// <param name="e">Not used.</param>
|
||||
private void Popup_Closed(object sender, EventArgs e)
|
||||
{
|
||||
CloseDropDown();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subclasses the owning form's existing Window Procedure to enables the
|
||||
/// title bar to remain active when a popup is show, and to detect if
|
||||
/// the user clicks onto another application whilst the popup is visible.
|
||||
/// </summary>
|
||||
/// <param name="m">Window Procedure Message</param>
|
||||
protected override void WndProc(ref Message m)
|
||||
/// <summary>
|
||||
/// Responds to the <see cref="System.Windows.Forms.Form.Closed"/>
|
||||
/// event from the popup form.
|
||||
/// </summary>
|
||||
/// <param name="sender">Popup form that has been closed.</param>
|
||||
/// <param name="e">Not used.</param>
|
||||
private void Popup_Closed(object sender, EventArgs e) => CloseDropDown();
|
||||
|
||||
/// <summary>
|
||||
/// Subclasses the owning form's existing Window Procedure to enables the
|
||||
/// title bar to remain active when a popup is show, and to detect if
|
||||
/// the user clicks onto another application whilst the popup is visible.
|
||||
/// </summary>
|
||||
/// <param name="m">Window Procedure Message</param>
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
|
||||
@@ -76,7 +69,7 @@ namespace AT.STO.UI.Win
|
||||
{
|
||||
if (((int)m.WParam) == 0) // Check if the title bar will made inactive:
|
||||
{ // Note it's no good to try and consume this message; if you try to do that you'll end up with windows
|
||||
UIApiCalls.SendMessage(this.Handle, UIApiCalls.WM_NCACTIVATE, 1, IntPtr.Zero); // If so reactivate it.
|
||||
UIApiCalls.SendMessage(Handle, UIApiCalls.WM_NCACTIVATE, 1, IntPtr.Zero); // If so reactivate it.
|
||||
}
|
||||
}
|
||||
else if (m.Msg == UIApiCalls.WM_ACTIVATEAPP)
|
||||
@@ -84,7 +77,7 @@ namespace AT.STO.UI.Win
|
||||
if ((int)m.WParam == 0) // Check if the application is being deactivated.
|
||||
{
|
||||
CloseDropDown(); // It is so cancel the popup:
|
||||
UIApiCalls.PostMessage(this.Handle, UIApiCalls.WM_NCACTIVATE, 0, IntPtr.Zero); // And put the title bar into the inactive state:
|
||||
UIApiCalls.PostMessage(Handle, UIApiCalls.WM_NCACTIVATE, 0, IntPtr.Zero); // And put the title bar into the inactive state:
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,22 +161,19 @@ namespace AT.STO.UI.Win
|
||||
_owner = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Public Properties
|
||||
/// <summary>
|
||||
/// Indicator weither the DropDown is showing.
|
||||
/// </summary>
|
||||
public bool DropDownShowing
|
||||
#endregion
|
||||
#region Public Properties
|
||||
/// <summary>
|
||||
/// Indicator weither the DropDown is showing.
|
||||
/// </summary>
|
||||
public bool DropDownShowing => _dropDownShowing;
|
||||
#endregion
|
||||
#region Event Implementation
|
||||
protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
|
||||
{
|
||||
get { return _dropDownShowing; }
|
||||
}
|
||||
#endregion
|
||||
#region Event Implementation
|
||||
protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
|
||||
{
|
||||
if (this.DropDownCancel != null)
|
||||
if (DropDownCancel != null)
|
||||
{
|
||||
this.DropDownCancel(this, e);
|
||||
DropDownCancel(this, e);
|
||||
|
||||
if (!e.Cancel)
|
||||
{
|
||||
@@ -191,14 +181,8 @@ namespace AT.STO.UI.Win
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnPDropDownClosed(DropDownClosedEventArgs e)
|
||||
{
|
||||
if (this.DropDownClosed != null)
|
||||
{
|
||||
this.DropDownClosed(this, e);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
protected virtual void OnPDropDownClosed(DropDownClosedEventArgs e) => DropDownClosed?.Invoke(this, e);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user