Files
SourceCode/PROMS/DropDownPanel/Events/Events.cs
T

130 lines
4.0 KiB
C#

using System;
using System.Drawing;
using System.Windows.Forms;
namespace AT.STO.UI.Win
{
/// <summary>
/// Represents the method which responds to a <see cref="DropDownCancel"/> event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public delegate void DropDownCancelEventHandler(object sender, DropDownCancelEventArgs e);
/// <summary>
/// Represents the method which responds to a <see cref="DropDownClosed"/> event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public delegate void DropDownClosedEventHandler(object sender, DropDownClosedEventArgs e);
/// <summary>
///
/// </summary>
/// <param name="sender">The object firing the event.</param>
/// <param name="e"></param>
public delegate void DropDownValueChangedEventHandler(object sender, DropDownValueChangedEventArgs e);
/// <summary>
/// Arguments to a <see cref="DropDownCancelEvent"/>. Provides a
/// reference to the popup form that is to be closed and
/// allows the operation to be cancelled.
///
/// Thousand thanks to Steve McMahon:
/// http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/Popup_Form_Demonstration.asp
/// </summary>
public class DropDownCancelEventArgs : EventArgs
{
#region Private Variable Declarations
private Point _cursorLocation;
private readonly Form _dropDown = null;
#endregion
#region Constructor / Destructor
/// <summary>
/// Constructs a new instance of this class.
/// </summary>
/// <param name="DropDown">The popup form</param>
/// <param name="CursorLocation">The mouse location, if any, where the
/// mouse event that would cancel the popup occured.</param>
public DropDownCancelEventArgs(Form DropDown, Point CursorLocation)
{
_dropDown = DropDown;
_cursorLocation = CursorLocation;
Cancel = false;
}
#endregion
#region Public Properties
/// <summary>
///
/// </summary>
public bool Cancel { get; set; } = false;
/// <summary>
///
/// </summary>
public Point CursorLocation => _cursorLocation;
/// <summary>
///
/// </summary>
public Form DropDown => _dropDown;
#endregion
}
/// <summary>
/// Contains event information for a <see cref="DropDownClosed"/> event.
///
/// Thousand thanks to Steve McMahon:
/// http://www.vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/Popup_Form_Demonstration.asp
/// </summary>
public class DropDownClosedEventArgs : EventArgs
{
#region Private Variable Declarations
private readonly Form _dropDown = null;
#endregion
#region Constructor / Destructor
/// <summary>
/// Constructs a new instance of this class for the specified
/// popup form.
/// </summary>
/// <param name="DropDown">DropDown Form which is being closed.</param>
public DropDownClosedEventArgs(Form DropDown) => _dropDown = DropDown;
#endregion
#region Public Properties
/// <summary>
/// Gets the dropdown form which is being closed.
/// </summary>
public Form DropDown => _dropDown;
#endregion
}
/// <summary>
/// Contains event information for DropDownValueChangedEventHandler.
/// </summary>
public class DropDownValueChangedEventArgs : EventArgs
{
#region Private Variable Declarations
#endregion
#region Constructor / Destructor
/// <summary>
/// Default Constructor
/// </summary>
public DropDownValueChangedEventArgs()
{
}
/// <summary>
/// Initialization with the control's value.
/// </summary>
/// <param name="Value"></param>
public DropDownValueChangedEventArgs(object Value) => this.Value = Value;
#endregion
#region Public Properties
/// <summary>
/// Gets or sets the control's value.
/// </summary>
public object Value { get; set; } = null;
#endregion
}
}