2014-02-28 14:32:20 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Windows.Forms.Design;
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Controls
|
|
|
|
|
{
|
|
|
|
|
[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip)]
|
|
|
|
|
public class ToolStripCheckBox : ToolStripControlHost
|
|
|
|
|
{
|
|
|
|
|
public event EventHandler CheckedChanged;
|
|
|
|
|
|
|
|
|
|
public bool Checked { get { return cb.Checked; } set { cb.Checked = value; } }
|
|
|
|
|
new public string Text { get { return cb.Text; } set { cb.Text = value; } }
|
|
|
|
|
private CheckBox cb;
|
|
|
|
|
|
|
|
|
|
public ToolStripCheckBox() : base(new CheckBox()) { }
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
protected override void OnSubscribeControlEvents(Control control)
|
|
|
|
|
{
|
2014-02-28 14:32:20 +00:00
|
|
|
|
base.OnSubscribeControlEvents(control);
|
|
|
|
|
cb = control as CheckBox;
|
|
|
|
|
cb.CheckedChanged += OnCheckedChanged;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
protected override void OnUnsubscribeControlEvents(Control control)
|
|
|
|
|
{
|
2014-02-28 14:32:20 +00:00
|
|
|
|
base.OnUnsubscribeControlEvents(control);
|
|
|
|
|
cb.CheckedChanged -= OnCheckedChanged;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void OnCheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-02-28 14:32:20 +00:00
|
|
|
|
if(CheckedChanged != null) CheckedChanged(this, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|