using System; using System.Collections.Generic; using Chernobyl.Update; namespace Chernobyl.Input.Controls { /// /// An interface for working with controls. Controls are forms of input that /// interact with the application such as buttons, analog sticks, gamepads, /// etc. /// public interface IControl : IUpdateable, INamed { /// /// The parent of this control. /// IControl ControlParent { get; set; } /// /// Controls that are part of this control. For /// example, the "Left Button" or "Scroll Wheel" /// might be a part of a mouse control. Some controls /// will not have children controls. /// ICollection ControlChildren { get; } /// /// An event that is raised when this is /// disconnected from the device it was previously connected to and is /// no longer available for use. Actions performed on the /// after it has been disconnected may result /// is an being thrown. /// event EventHandler Disconnected; } /// /// A helper class which is used to pass data on the /// invocation of an event of the IControl interface. /// Note that this class does not have to be used by /// classes deriving from IControl. /// public class ControlEventArgs : EventArgs where TControl : IControl { /// /// Initializes a new instance of the /// class. /// /// The control that was affected by the event. public ControlEventArgs(TControl control) { Control = control; } /// /// The control where the event was fired from. /// public TControl Control { get; private set; } } }