using System.Runtime.InteropServices; using Decal.Interop.Controls; using Decal.Interop.Inject; namespace Decal.DecalControls { [ComVisible(true)] [Guid("5AE37451-F79C-478A-834E-EDCF95F01B0E")] [ClassInterface(ClassInterfaceType.None)] [ComSourceInterfaces("Decal.Interop.Controls.ICheckboxEvents\0\0")] [ProgId("DecalControls.Checkbox")] public class CheckboxImpl : ControlBase, ICheckbox { public event ICheckboxEvents_DestroyEventHandler Destroy; public event ICheckboxEvents_ChangeEventHandler Change; private IFontCache _font; private string _text = ""; private int _textColor; private bool _checked; private bool _rightToLeft; public IFontCache Font { get => _font; set { _font = value; Invalidate(); } } public string Text { get => _text; set { _text = value; Invalidate(); } } public int TextColor { get => _textColor; set { _textColor = value; Invalidate(); } } public bool Checked { get => _checked; set { if (_checked != value) { _checked = value; Invalidate(); Change?.Invoke(ID, _checked); } } } public bool RightToLeft { get => _rightToLeft; set { _rightToLeft = value; Invalidate(); } } protected override void OnDestroy() => Destroy?.Invoke(ID); } }