From 0a7bce75f503fb8847030b9a62a1acce3ef359e5 Mon Sep 17 00:00:00 2001 From: Jose Medrano Date: Wed, 16 Feb 2022 18:22:39 +0100 Subject: Creates ProxyResponderButton and makes base of FocusableBooleanButton --- .../Controls/Custom/FocusableBooleanButton.cs | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs index f8ed20d..01ad5e0 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/FocusableBooleanButton.cs @@ -3,7 +3,28 @@ using AppKit; namespace Xamarin.PropertyEditing.Mac { - internal class FocusableBooleanButton : NSButton + internal class ProxyResponderButton : NSButton + { + public ProxyRowResponder ResponderProxy { get; set; } + + public override void KeyDown (NSEvent theEvent) + { + switch (theEvent.KeyCode) { + case (int)NSKey.Tab: + if (ResponderProxy != null) { + if (theEvent.ModifierFlags.HasFlag(NSEventModifierMask.ShiftKeyMask)) { + ResponderProxy.PreviousResponder (); + } else { + ResponderProxy.NextResponder (); + } + } + return; + } + base.KeyDown (theEvent); + } + } + + internal class FocusableBooleanButton : ProxyResponderButton { public override bool CanBecomeKeyView { get { return Enabled; } } -- cgit v1.2.3