From 0def3828b956ae4a07c579cb48d8c09f7809bcc1 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 27 Nov 2019 20:26:03 -0600 Subject: [PATCH] Simplify ToolStripEx --- .../CustomControls/ToolStripEx.cs | 60 ++++--------------- 1 file changed, 12 insertions(+), 48 deletions(-) diff --git a/BizHawk.Client.EmuHawk/CustomControls/ToolStripEx.cs b/BizHawk.Client.EmuHawk/CustomControls/ToolStripEx.cs index bfe6182d4b..1149c41b73 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/ToolStripEx.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/ToolStripEx.cs @@ -8,30 +8,18 @@ using System.Windows.Forms; /// public class ToolStripEx : ToolStrip { - private bool clickThrough = true; - /// /// Gets or sets whether the ToolStripEx honors item clicks when its containing form does /// not have input focus. /// - public bool ClickThrough - { - get - { - return clickThrough; - } - set - { - clickThrough = value; - } - } + public bool ClickThrough { get; set; } = true; protected override void WndProc(ref Message m) { base.WndProc(ref m); - if (clickThrough && - m.Msg == NativeConstants.WM_MOUSEACTIVATE && - m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) + if (ClickThrough + && m.Msg == NativeConstants.WM_MOUSEACTIVATE + && m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) { m.Result = (IntPtr)NativeConstants.MA_ACTIVATE; } @@ -43,30 +31,18 @@ public class ToolStripEx : ToolStrip /// public class MenuStripEx : MenuStrip { - private bool clickThrough = true; - /// /// Gets or sets whether the ToolStripEx honors item clicks when its containing form does /// not have input focus. /// - public bool ClickThrough - { - get - { - return clickThrough; - } - set - { - clickThrough = value; - } - } + public bool ClickThrough { get; set; } = true; protected override void WndProc(ref Message m) { base.WndProc(ref m); - if (clickThrough && - m.Msg == NativeConstants.WM_MOUSEACTIVATE && - m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) + if (ClickThrough + && m.Msg == NativeConstants.WM_MOUSEACTIVATE + && m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) { m.Result = (IntPtr)NativeConstants.MA_ACTIVATE; } @@ -78,30 +54,18 @@ public class MenuStripEx : MenuStrip /// public class StatusStripEx : StatusStrip { - private bool clickThrough = true; - /// /// Gets or sets whether the ToolStripEx honors item clicks when its containing form does /// not have input focus. /// - public bool ClickThrough - { - get - { - return clickThrough; - } - set - { - clickThrough = value; - } - } + public bool ClickThrough { get; set; } = true; protected override void WndProc(ref Message m) { base.WndProc(ref m); - if (clickThrough && - m.Msg == NativeConstants.WM_MOUSEACTIVATE && - m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) + if (ClickThrough + && m.Msg == NativeConstants.WM_MOUSEACTIVATE + && m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT) { m.Result = (IntPtr)NativeConstants.MA_ACTIVATE; }