//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// /// <summary> /// Adds a component or a control to the manager. /// </summary> /// <param name="component"> /// The component or control being added. /// </param> public virtual void Add(Component component) { if (component != null) { if (component is Control && !controls.Contains(component as Control)) { Control c = (Control)component; if (c.Parent != null) c.Parent.Remove(c); controls.Add(c); c.Manager = this; c.Parent = null; if (focusedControl == null) c.Focused = true; DeviceSettingsChanged += new DeviceEventHandler((component as Control).OnDeviceSettingsChanged); SkinChanging += new SkinEventHandler((component as Control).OnSkinChanging); SkinChanged += new SkinEventHandler((component as Control).OnSkinChanged); } else if (!(component is Control) && !components.Contains(component)) { components.Add(component); component.Manager = this; } } }
public SkinEventListener(SkinEventType type, SkinEventHandler e) { _Type = type; _skinEvent = e; }
public SkinEventListener(SkinEventType type, SkinEventHandler e) { EventType = type; SkinEvent = e; }
/// <summary> /// Initializes a new instance of the <see cref="SkinEventListener"/> class. /// </summary> /// <param name="type"></param> /// <param name="e"></param> public SkinEventListener(SkinEventType type, SkinEventHandler e) { this.EventType = type; this.SkinEvent = e; }
/// <summary> /// Adds a component or a control to the manager. /// </summary> /// <param name="component"> /// The component or control being added. /// </param> public virtual void Add(Component component) { // Component exists? if (component != null) { // Component is a Control not already in the list? if (component is Control && !controls.Contains(component as Control)) { Control c = (Control)component; // Remove control from parent list because it's under new management now. if (c.Parent != null) c.Parent.Remove(c); controls.Add(c); c.Manager = this; c.Parent = null; // New control gains focus unless another control already has it. if (focusedControl == null) c.Focused = true; DeviceSettingsChanged += new DeviceEventHandler((component as Control).OnDeviceSettingsChanged); SkinChanging += new SkinEventHandler((component as Control).OnSkinChanging); SkinChanged += new SkinEventHandler((component as Control).OnSkinChanged); } // Component is not a control and doesn't already exist in the component list? else if (!(component is Control) && !components.Contains(component)) { components.Add(component); component.Manager = this; } } }