UltimateZoneBuilder/Source/Core/Controls/ToolStripCheckBox.cs
MaxED 15b2adfe30 Texture Browser Form: swapped foreground and background colors of texture size labels.
Fixed, Texture Browser Form: well, I broke "Tab" key functionality again (in previous commit)...
Maintenance: changed curly braces style to match DB2 one (hopefully not breaking anything in the process...).
Maintenance: changed private method names casing to match DB2 one.
2014-12-03 23:15:26 +00:00

36 lines
1 KiB
C#

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()) { }
protected override void OnSubscribeControlEvents(Control control)
{
base.OnSubscribeControlEvents(control);
cb = control as CheckBox;
cb.CheckedChanged += OnCheckedChanged;
}
protected override void OnUnsubscribeControlEvents(Control control)
{
base.OnUnsubscribeControlEvents(control);
cb.CheckedChanged -= OnCheckedChanged;
}
private void OnCheckedChanged(object sender, EventArgs e)
{
if(CheckedChanged != null) CheckedChanged(this, e);
}
}
}