Merge "[NUI-252] change string type of property to enum type of property" into tizen
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / FocusManager.cs
1 // Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 //
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 // Some have been manually changed
18
19
20 namespace Tizen.NUI
21 {
22
23     using System;
24     using System.Runtime.InteropServices;
25
26     /// <summary>
27     /// Provides the functionality of handling keyboard navigation and maintaining the two dimensional keyboard focus chain.<br>
28     /// It provides functionality of setting the focus and moving the focus in four directions(i.e.Left, Right, Up and Down).<br>
29     /// It also draws a highlight for the focused View and sends a event when the focus is changed.<br>
30     /// </summary>
31     public class FocusManager : BaseHandle
32     {
33         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
34         private CustomAlgorithmInterfaceWrapper _customAlgorithmInterfaceWrapper;
35
36         internal FocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.FocusManager_SWIGUpcast(cPtr), cMemoryOwn)
37         {
38             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
39         }
40
41         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FocusManager obj)
42         {
43             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
44         }
45
46         ~FocusManager()
47         {
48             DisposeQueue.Instance.Add(this);
49         }
50
51         /// <summary>
52         /// To make FocusManager instance be disposed.
53         /// </summary>
54         public override void Dispose()
55         {
56             if (!Stage.IsInstalled())
57             {
58                 DisposeQueue.Instance.Add(this);
59                 return;
60             }
61
62             lock (this)
63             {
64                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
65                 {
66                     if (swigCMemOwn)
67                     {
68                         swigCMemOwn = false;
69                         NDalicManualPINVOKE.delete_FocusManager(swigCPtr);
70                     }
71                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
72                 }
73                 global::System.GC.SuppressFinalize(this);
74                 base.Dispose();
75             }
76         }
77
78
79         ///<summary>
80         ///Event arguments that passed via PreFocusChange signal
81         /// </summary>
82         public class PreFocusChangeEventArgs : EventArgs
83         {
84             private View _current;
85             private View _proposed;
86             private View.FocusDirection _direction;
87
88             public View CurrentView
89             {
90                 get
91                 {
92                     return _current;
93                 }
94                 set
95                 {
96                     _current = value;
97                 }
98             }
99
100             public View ProposedView
101             {
102                 get
103                 {
104                     return _proposed;
105                 }
106                 set
107                 {
108                     _proposed = value;
109                 }
110             }
111
112             public View.FocusDirection Direction
113             {
114                 get
115                 {
116                     return _direction;
117                 }
118                 set
119                 {
120                     _direction = value;
121                 }
122             }
123         }
124
125         private EventHandlerWithReturnType<object, PreFocusChangeEventArgs, View> _preFocusChangeEventHandler;
126         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
127         internal delegate IntPtr PreFocusChangeEventCallback(IntPtr current, IntPtr proposed, View.FocusDirection direction);
128         private PreFocusChangeEventCallback _preFocusChangeCallback;
129
130         /// <summary>
131         /// PreFocusChange will be triggered before the focus is going to be changed.<br>
132         /// FocusManager makes the best guess for which actor to focus towards the given direction, but applications might want to change that.<br>
133         /// By connecting with this event, they can check the proposed actor to focus and return a different actor if they wish.<br>
134         /// This event is only triggered when the navigation key is pressed and KeyboardFocusManager tries to move the focus automatically.<br>
135         /// It won't be emitted for focus movement by calling SetCurrentFocusView directly.<br>
136         /// </summary>
137         public event EventHandlerWithReturnType<object, PreFocusChangeEventArgs, View> PreFocusChange
138         {
139             add
140             {
141                 if (_preFocusChangeEventHandler == null)
142                 {
143 #if DEBUG_ON
144                     Tizen.Log.Debug("NUI", "con1) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty());
145                     Tizen.Log.Debug("NUI", "con2) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount());
146 #endif
147                     _preFocusChangeCallback = OnPreFocusChange;
148                     PreFocusChangeSignal().Connect(_preFocusChangeCallback);
149 #if DEBUG_ON
150                     Tizen.Log.Debug("NUI", "con3) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty());
151                     Tizen.Log.Debug("NUI", "con4) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount());
152 #endif
153                 }
154                 _preFocusChangeEventHandler += value;
155             }
156             remove
157             {
158                 _preFocusChangeEventHandler -= value;
159                 if (_preFocusChangeEventHandler == null && PreFocusChangeSignal().Empty() == false)
160                 {
161 #if DEBUG_ON
162                     Tizen.Log.Debug("NUI", "discon1) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty());
163                     Tizen.Log.Debug("NUI", "discon2) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount());
164 #endif
165                     PreFocusChangeSignal().Disconnect(_preFocusChangeCallback);
166 #if DEBUG_ON
167                     Tizen.Log.Debug("NUI", "discon3) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty());
168                     Tizen.Log.Debug("NUI", "discon4) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount());
169 #endif
170                 }
171             }
172         }
173
174         private IntPtr OnPreFocusChange(IntPtr current, IntPtr proposed, View.FocusDirection direction)
175         {
176             View view = null;
177             PreFocusChangeEventArgs e = new PreFocusChangeEventArgs();
178
179             e.CurrentView = View.GetViewFromPtr(current);
180             e.ProposedView = View.GetViewFromPtr(proposed);
181             e.Direction = direction;
182
183             if (_preFocusChangeEventHandler != null)
184             {
185                 view = _preFocusChangeEventHandler(this, e);
186             }
187
188             if (view)
189             {
190                 return view.GetPtrfromActor();
191             }
192             else
193             {
194                 if (e.ProposedView) return proposed;
195                 else return current;
196             }
197         }
198
199         ///<summary>
200         ///Event arguments that passed via FocusChanged signal.
201         /// </summary>
202         public class FocusChangedEventArgs : EventArgs
203         {
204             private View _current;
205             private View _next;
206
207             public View CurrentView
208             {
209                 get
210                 {
211                     return _current;
212                 }
213                 set
214                 {
215                     _current = value;
216                 }
217             }
218
219             public View NextView
220             {
221                 get
222                 {
223                     return _next;
224                 }
225                 set
226                 {
227                     _next = value;
228                 }
229             }
230         }
231
232         private EventHandler<FocusChangedEventArgs> _focusChangedEventHandler;
233         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
234         internal delegate void FocusChangedEventCallback(IntPtr current, IntPtr next);
235         private FocusChangedEventCallback _focusChangedEventCallback;
236
237         /// <summary>
238         /// FocusGroupChanged will be triggered after the current focused actor has been changed.
239         /// </summary>
240         public event EventHandler<FocusChangedEventArgs> FocusChanged
241         {
242             add
243             {
244                 if (_focusChangedEventCallback == null)
245                 {
246                     _focusChangedEventCallback = OnFocusChanged;
247                     FocusChangedSignal().Connect(_focusChangedEventCallback);
248                 }
249                 _focusChangedEventHandler += value;
250             }
251             remove
252             {
253                 _focusChangedEventHandler -= value;
254
255                 if (_focusChangedEventCallback == null && FocusChangedSignal().Empty() == false)
256                 {
257                     FocusChangedSignal().Disconnect(_focusChangedEventCallback);
258                 }
259             }
260         }
261
262         private void OnFocusChanged(IntPtr current, IntPtr next)
263         {
264             FocusChangedEventArgs e = new FocusChangedEventArgs();
265
266             e.CurrentView = View.GetViewFromPtr(current);
267             e.NextView = View.GetViewFromPtr(next);
268
269             if (_focusChangedEventHandler != null)
270             {
271                 _focusChangedEventHandler(this, e);
272             }
273         }
274
275         ///<summary>
276         ///Event arguments that passed via FocusGroupChanged signal.
277         /// </summary>
278         public class FocusGroupChangedEventArgs : EventArgs
279         {
280             private View _current;
281             private bool _forwardDirection;
282
283             public View CurrentView
284             {
285                 get
286                 {
287                     return _current;
288                 }
289                 set
290                 {
291                     _current = value;
292                 }
293             }
294
295             public bool ForwardDirection
296             {
297                 get
298                 {
299                     return _forwardDirection;
300                 }
301                 set
302                 {
303                     _forwardDirection = value;
304                 }
305             }
306         }
307
308         private EventHandler<FocusGroupChangedEventArgs> _focusGroupChangedEventHandler;
309         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
310         private delegate void FocusGroupChangedEventCallback(IntPtr current, bool forwardDirection);
311         private FocusGroupChangedEventCallback _focusGroupChangedEventCallback;
312
313         /// <summary>
314         /// FocusGroupChanged will be triggered when the focus group has been changed.<br>
315         /// If the current focus group has a parent layout control, FocusManager will make the best guess for the next focus group to move the focus to in the given direction (forward or backward).<br>
316         /// If not, the application has to set the new focus.<br>
317         /// </summary>
318         public event EventHandler<FocusGroupChangedEventArgs> FocusGroupChanged
319         {
320             add
321             {
322                 if (_focusGroupChangedEventCallback == null)
323                 {
324                     _focusGroupChangedEventCallback = OnFocusGroupChanged;
325                     FocusGroupChangedSignal().Connect(_focusGroupChangedEventCallback);
326                 }
327                 _focusGroupChangedEventHandler += value;
328             }
329             remove
330             {
331                 _focusGroupChangedEventHandler -= value;
332
333                 if (_focusGroupChangedEventCallback == null && FocusGroupChangedSignal().Empty() == false)
334                 {
335                     FocusGroupChangedSignal().Disconnect(_focusGroupChangedEventCallback);
336                 }
337             }
338         }
339
340         private void OnFocusGroupChanged(IntPtr current, bool forwardDirection)
341         {
342             FocusGroupChangedEventArgs e = new FocusGroupChangedEventArgs();
343
344             e.CurrentView = View.GetViewFromPtr(current);
345             e.ForwardDirection = forwardDirection;
346
347             if (_focusGroupChangedEventHandler != null)
348             {
349                 _focusGroupChangedEventHandler(this, e);
350             }
351         }
352
353         ///<summary>
354         ///Event arguments that passed via FocusedViewEnterKey signal
355         /// </summary>
356         public class FocusedViewEnterKeyEventArgs : EventArgs
357         {
358             private View _view;
359
360             public View View
361             {
362                 get
363                 {
364                     return _view;
365                 }
366                 set
367                 {
368                     _view = value;
369                 }
370             }
371         }
372
373         private EventHandler<FocusedViewEnterKeyEventArgs> _focusedViewEnterKeyEventHandler;
374         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
375         private delegate void FocusedViewEnterKeyEventCallback(IntPtr view);
376         private FocusedViewEnterKeyEventCallback _focusedViewEnterKeyEventCallback;
377
378         /// <summary>
379         /// FocusedViewEnterKeyPressed will be triggered when the current focused actor has the enter key pressed on it.
380         /// </summary>
381         public event EventHandler<FocusedViewEnterKeyEventArgs> FocusedViewEnterKeyPressed
382         {
383             add
384             {
385                 if (_focusedViewEnterKeyEventCallback == null)
386                 {
387                     _focusedViewEnterKeyEventCallback = OnFocusedViewEnterKey;
388                     FocusedActorEnterKeySignal().Connect(_focusedViewEnterKeyEventCallback);
389                 }
390                 _focusedViewEnterKeyEventHandler += value;
391             }
392             remove
393             {
394                 _focusedViewEnterKeyEventHandler -= value;
395
396                 if (_focusedViewEnterKeyEventCallback == null && FocusedActorEnterKeySignal().Empty() == false)
397                 {
398                     FocusedActorEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback);
399                 }
400             }
401         }
402
403         private void OnFocusedViewEnterKey(IntPtr view)
404         {
405             FocusedViewEnterKeyEventArgs e = new FocusedViewEnterKeyEventArgs();
406
407             e.View = View.GetViewFromPtr(view);
408
409             if (_focusedViewEnterKeyEventHandler != null)
410             {
411                 _focusedViewEnterKeyEventHandler(this, e);
412             }
413         }
414
415
416         internal FocusManager() : this(NDalicManualPINVOKE.new_FocusManager(), true)
417         {
418             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
419         }
420
421         internal static FocusManager Get()
422         {
423             FocusManager ret = new FocusManager(NDalicManualPINVOKE.FocusManager_Get(), true);
424             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
425             return ret;
426         }
427
428         /// <summary>
429         /// Moves the keyboard focus to the given View.<br>
430         /// Only one View can be focused at the same time.<br>
431         /// The View must be in the stage already and keyboard focusable.<br>
432         /// </summary>
433         /// <param name="view">The View to be focused</param>
434         /// <returns>Whether the focus is successful or not</returns>
435         public bool SetCurrentFocusView(View view)
436         {
437             bool ret = NDalicManualPINVOKE.FocusManager_SetCurrentFocusActor(swigCPtr, Actor.getCPtr(view));
438             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
439             return ret;
440         }
441
442         /// <summary>
443         /// Gets the current focused actor.
444         /// </summary>
445         /// <returns>A handle to the current focused View or an empty handle if no View is focused</returns>
446         public View GetCurrentFocusView()
447         {
448             View ret = View.DownCast(new Actor(NDalicManualPINVOKE.FocusManager_GetCurrentFocusActor(swigCPtr), true));
449             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
450             if (ret.HasBody() == false)
451             {
452                 return null;
453             }
454             return ret;
455         }
456
457         /// <summary>
458         /// Moves the focus to the next focusable View in the focus chain in the given direction(according to the focus traversal order).
459         /// </summary>
460         /// <param name="direction">The direction of focus movement</param>
461         /// <returns>true if the movement was successful</returns>
462         public bool MoveFocus(View.FocusDirection direction)
463         {
464             bool ret = NDalicManualPINVOKE.FocusManager_MoveFocus(swigCPtr, (int)direction);
465             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
466             return ret;
467         }
468
469         /// <summary>
470         /// Clears the focus from the current focused actor if any, so that no actor is focused in the focus chain.<br>
471         /// It will emit FocusChanged event without current focused View.<br>
472         /// </summary>
473         public void ClearFocus()
474         {
475             NDalicManualPINVOKE.FocusManager_ClearFocus(swigCPtr);
476             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
477         }
478
479         /// <summary>
480         /// Sets/Gets the status of whether the focus movement should be looped within the same focus group.<br>
481         /// The focus movement is not looped by default.<br>
482         /// </summary>
483         public bool FocusGroupLoop
484         {
485             set
486             {
487                 SetFocusGroupLoop(value);
488             }
489             get
490             {
491                 return GetFocusGroupLoop();
492             }
493         }
494
495         internal void SetFocusGroupLoop(bool enabled)
496         {
497             NDalicManualPINVOKE.FocusManager_SetFocusGroupLoop(swigCPtr, enabled);
498             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
499         }
500
501         internal bool GetFocusGroupLoop()
502         {
503             bool ret = NDalicManualPINVOKE.FocusManager_GetFocusGroupLoop(swigCPtr);
504             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
505             return ret;
506         }
507
508         /// <summary>
509         /// Sets whether an View is a focus group that can limit the scope of focus movement to its child actors in the focus chain.<br>
510         /// Layout controls set themselves as focus groups by default.<br>
511         /// </summary>
512         /// <param name="view">The View to be set as a focus group</param>
513         /// <param name="isFocusGroup">Whether to set the View as a focus group or not</param>
514         public void SetAsFocusGroup(View view, bool isFocusGroup)
515         {
516             NDalicManualPINVOKE.FocusManager_SetAsFocusGroup(swigCPtr, Actor.getCPtr(view), isFocusGroup);
517             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
518         }
519
520         /// <summary>
521         /// Checks whether the actor is set as a focus group or not.
522         /// </summary>
523         /// <param name="view">The View to be checked</param>
524         /// <returns>Whether the View is set as a focus group</returns>
525         public bool IsFocusGroup(View view)
526         {
527             bool ret = NDalicManualPINVOKE.FocusManager_IsFocusGroup(swigCPtr, Actor.getCPtr(view));
528             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
529             return ret;
530         }
531
532         /// <summary>
533         /// Returns the closest ancestor of the given actor that is a focus group.
534         /// </summary>
535         /// <param name="view">The View to be checked for its focus group</param>
536         /// <returns>The focus group the given view belongs to or an empty handle if the given view</returns>
537         public View GetFocusGroup(View view)
538         {
539             View ret = View.DownCast(new Actor(NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, Actor.getCPtr(view)), true));
540             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
541             if (ret.HasBody() == false)
542             {
543                 return null;
544             }
545             return ret;
546         }
547
548         /// <summary>
549         /// Sets/Gets the focus indicator View.<br>
550         /// This will replace the default focus indicator view in FocusManager and will be added to the focused view as a highlight.<br>
551         /// </summary>
552         public View FocusIndicator
553         {
554             set
555             {
556                 SetFocusIndicatorView(value);
557             }
558             get
559             {
560                 return GetFocusIndicatorView();
561             }
562         }
563
564         internal void SetFocusIndicatorView(View indicator)
565         {
566             NDalicManualPINVOKE.FocusManager_SetFocusIndicatorActor(swigCPtr, Actor.getCPtr(indicator));
567             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
568         }
569
570         internal View GetFocusIndicatorView()
571         {
572             View ret = View.DownCast(new Actor(NDalicManualPINVOKE.FocusManager_GetFocusIndicatorActor(swigCPtr), true));
573             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
574             if (ret.HasBody() == false)
575             { 
576                 return null;
577             }
578             return ret;
579         }
580
581         /// <summary>
582         /// Provide the implementation of custom Focus algorithm interface to allow the app define the focus logic.<br>
583         /// </summary>
584         /// <param name="arg0">The user's implementation of ICustomFocusAlgorithm</param>
585         public void SetCustomAlgorithm(ICustomFocusAlgorithm arg0)
586         {
587             _customAlgorithmInterfaceWrapper = new CustomAlgorithmInterfaceWrapper();
588             _customAlgorithmInterfaceWrapper.SetFocusAlgorithm(arg0);
589
590             NDalicPINVOKE.SetCustomAlgorithm(swigCPtr, CustomAlgorithmInterface.getCPtr(_customAlgorithmInterfaceWrapper));
591             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
592         }
593
594         internal PreFocusChangeSignal PreFocusChangeSignal()
595         {
596             PreFocusChangeSignal ret = new PreFocusChangeSignal(NDalicManualPINVOKE.FocusManager_PreFocusChangeSignal(swigCPtr), false);
597             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598             return ret;
599         }
600
601         internal FocusChangedSignal FocusChangedSignal()
602         {
603             FocusChangedSignal ret = new FocusChangedSignal(NDalicManualPINVOKE.FocusManager_FocusChangedSignal(swigCPtr), false);
604             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
605             return ret;
606         }
607
608         internal FocusGroupChangedSignal FocusGroupChangedSignal()
609         {
610             FocusGroupChangedSignal ret = new FocusGroupChangedSignal(NDalicManualPINVOKE.FocusManager_FocusGroupChangedSignal(swigCPtr), false);
611             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612             return ret;
613         }
614
615         internal ActorSignal FocusedActorEnterKeySignal()
616         {
617             ActorSignal ret = new ActorSignal(NDalicManualPINVOKE.FocusManager_FocusedActorEnterKeySignal(swigCPtr), false);
618             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
619             return ret;
620         }
621
622         private static readonly FocusManager instance = FocusManager.Get();
623
624         /// <summary>
625         /// Gets the singleton of FocusManager object.
626         /// </summary>
627         public static FocusManager Instance
628         {
629             get
630             {
631                 return instance;
632             }
633         }
634
635         /// <summary>
636         /// ICustomFocusAlgorithm is used to provide custom keyboard focus algorithm for retrieving the next focusable actor.<br>
637         /// The application can implement the interface and override the keyboard focus behaviour.<br>
638         /// If focus is changing within a layout container, then the layout container is queried first to provide the next focusable actor.<br>
639         /// If this does not provide a valid actor, then the Keyboard FocusManager will check focusable properties to determine next focusable actor.<br>
640         /// If focusable properties are not set, then the Keyboard FocusManager calls the GetNextFocusableActor() method of this interface.<br>
641         /// </summary>
642         public interface ICustomFocusAlgorithm
643         {
644             View GetNextFocusableActor(View current, View proposed, View.FocusDirection direction);
645         }
646
647         private class CustomAlgorithmInterfaceWrapper : CustomAlgorithmInterface
648         {
649             private FocusManager.ICustomFocusAlgorithm _customFocusAlgorithm;
650
651             public CustomAlgorithmInterfaceWrapper()
652             {
653             }
654
655             public void SetFocusAlgorithm(FocusManager.ICustomFocusAlgorithm customFocusAlgorithm)
656             {
657                 _customFocusAlgorithm = customFocusAlgorithm;
658             }
659
660             public override Actor GetNextFocusableActor(Actor current, Actor proposed, View.FocusDirection direction)
661             {
662                 View currentView = View.DownCast<View>(current);
663                 View proposedView = View.DownCast<View>(proposed);
664                 return _customFocusAlgorithm.GetNextFocusableActor(currentView, proposedView, direction);
665             }
666         }
667     }
668 }