diff options
author | Jose Medrano <josmed@microsoft.com> | 2022-02-16 20:18:33 +0300 |
---|---|---|
committer | vs-mobiletools-engineering-service2 <valco@microsoft.com> | 2022-03-01 18:01:15 +0300 |
commit | 0f4a14a4c2968b212a4109cfc1eb89867cab1bdc (patch) | |
tree | 67bed69fa1c6a42b60eb334a8680eb1e98124284 | |
parent | 54f1bc4e7e4f20263df70e86ebf6c1ea5fd603a9 (diff) |
Creates ProxyRowResponder manage responder between rows in NSOutlineView
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/ProxyRowResponder.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/ProxyRowResponder.cs b/Xamarin.PropertyEditing.Mac/Controls/ProxyRowResponder.cs new file mode 100644 index 0000000..6f0784e --- /dev/null +++ b/Xamarin.PropertyEditing.Mac/Controls/ProxyRowResponder.cs @@ -0,0 +1,48 @@ +using System; + +namespace Xamarin.PropertyEditing.Mac +{ + internal enum ProxyRowType + { + SingleView, + FirstView, + LastView + } + + internal class ProxyRowResponder + { + protected WeakReference<PropertyEditorControl> editorControl; + + readonly ProxyRowType rowType; + + public ProxyRowResponder (PropertyEditorControl editorControl, ProxyRowType rowType) + { + this.rowType = rowType; + this.editorControl = new WeakReference<PropertyEditorControl> (editorControl); + } + + public bool NextResponder() + { + if (this.editorControl.TryGetTarget (out var editor)) + { + if (this.rowType == ProxyRowType.LastView || this.rowType == ProxyRowType.SingleView) { + editor.OnNextResponderRequested (); + return true; + } + } + return false; + } + + public bool PreviousResponder () + { + if (this.editorControl.TryGetTarget (out var editor)) + { + if (this.rowType == ProxyRowType.FirstView || this.rowType == ProxyRowType.SingleView) { + editor.OnPreviousResponderRequested (); + return true; + } + } + return false; + } + } +} |