Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/ProxyRowResponder.cs')
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/ProxyRowResponder.cs48
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..406bde4
--- /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 ProxyResponder
+ {
+ protected WeakReference<PropertyEditorControl> editorControl;
+
+ readonly ProxyRowType rowType;
+
+ public ProxyResponder (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 (false);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool PreviousResponder ()
+ {
+ if (this.editorControl.TryGetTarget (out var editor))
+ {
+ if (this.rowType == ProxyRowType.FirstView || this.rowType == ProxyRowType.SingleView) {
+ editor.OnNextResponderRequested (true);
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+}