2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Runtime.InteropServices;
20 using Tizen.NUI.BaseComponents;
21 using System.ComponentModel;
26 /// Provides the functionality of handling keyboard navigation and maintaining the two-dimensional keyboard focus chain.<br />
27 /// It provides functionality of setting the focus and moving the focus in four directions( i.e., left, right, up, and down).<br />
28 /// It also draws a highlight for the focused view and sends an event when the focus is changed.<br />
30 /// <since_tizen> 3 </since_tizen>
31 public class FocusManager : BaseHandle
33 private static readonly FocusManager instance = FocusManager.Get();
34 private CustomAlgorithmInterfaceWrapper customAlgorithmInterfaceWrapper;
36 private EventHandlerWithReturnType<object, PreFocusChangeEventArgs, View> preFocusChangeEventHandler;
37 private PreFocusChangeEventCallback preFocusChangeCallback;
39 private EventHandler<FocusChangedEventArgs> focusChangedEventHandler;
40 private FocusChangedEventCallback focusChangedEventCallback;
42 private EventHandler<FocusGroupChangedEventArgs> focusGroupChangedEventHandler;
43 private FocusGroupChangedEventCallback focusGroupChangedEventCallback;
45 private EventHandler<FocusedViewActivatedEventArgs> focusedViewEnterKeyEventHandler;
46 private FocusedViewEnterKeyEventCallback focusedViewEnterKeyEventCallback;
48 private EventHandler<FocusedViewActivatedEventArgs> focusedViewEnterKeyEventHandler2;
49 private FocusedViewEnterKeyEventCallback2 focusedViewEnterKeyEventCallback2;
51 internal FocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
55 internal FocusManager() : this(Interop.FocusManager.NewFocusManager(), true)
57 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
60 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
61 internal delegate IntPtr PreFocusChangeEventCallback(IntPtr current, IntPtr proposed, View.FocusDirection direction);
63 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
64 internal delegate void FocusChangedEventCallback(IntPtr current, IntPtr next);
66 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
67 private delegate void FocusGroupChangedEventCallback(IntPtr current, bool forwardDirection);
69 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
70 private delegate void FocusedViewEnterKeyEventCallback(IntPtr view);
72 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
73 private delegate void FocusedViewEnterKeyEventCallback2(IntPtr view);
75 private View internalFocusIndicator = null;
78 /// PreFocusChange will be triggered before the focus is going to be changed.<br />
79 /// The FocusManager makes the best guess for which view to focus towards the given direction, but applications might want to change that.<br />
80 /// By connecting with this event, they can check the proposed view to focus and return a different view if they wish.<br />
81 /// This event is only triggered when the navigation key is pressed and KeyboardFocusManager tries to move the focus automatically.<br />
82 /// It won't be emitted for focus movement by calling the SetCurrentFocusView directly.<br />
84 /// <since_tizen> 3 </since_tizen>
85 public event EventHandlerWithReturnType<object, PreFocusChangeEventArgs, View> PreFocusChange
89 if (preFocusChangeEventHandler == null)
91 preFocusChangeCallback = OnPreFocusChange;
92 PreFocusChangeSignal().Connect(preFocusChangeCallback);
94 preFocusChangeEventHandler += value;
98 preFocusChangeEventHandler -= value;
99 if (preFocusChangeEventHandler == null && PreFocusChangeSignal().Empty() == false)
101 PreFocusChangeSignal().Disconnect(preFocusChangeCallback);
107 /// The FocusGroupChanged will be triggered after the current focused view has been changed.
109 /// <since_tizen> 3 </since_tizen>
110 public event EventHandler<FocusChangedEventArgs> FocusChanged
114 if (focusChangedEventCallback == null)
116 focusChangedEventCallback = OnFocusChanged;
117 FocusChangedSignal().Connect(focusChangedEventCallback);
119 focusChangedEventHandler += value;
123 focusChangedEventHandler -= value;
125 if (focusChangedEventCallback == null && FocusChangedSignal().Empty() == false)
127 FocusChangedSignal().Disconnect(focusChangedEventCallback);
133 /// The FocusGroupChanged will be triggered when the focus group has been changed.<br />
134 /// If the current focus group has a parent layout control, the FocusManager will make the best guess for the next focus group to move the focus to in the given direction (forward or backward).<br />
135 /// If not, the application has to set the new focus.<br />
137 /// <since_tizen> 3 </since_tizen>
138 public event EventHandler<FocusGroupChangedEventArgs> FocusGroupChanged
142 if (focusGroupChangedEventCallback == null)
144 focusGroupChangedEventCallback = OnFocusGroupChanged;
145 FocusGroupChangedSignal().Connect(focusGroupChangedEventCallback);
147 focusGroupChangedEventHandler += value;
151 focusGroupChangedEventHandler -= value;
153 if (focusGroupChangedEventCallback == null && FocusGroupChangedSignal().Empty() == false)
155 FocusGroupChangedSignal().Disconnect(focusGroupChangedEventCallback);
161 /// The FocusedViewActivated will be triggered when the current focused view has the enter key pressed on it.
163 /// <since_tizen> 3 </since_tizen>
164 public event EventHandler<FocusedViewActivatedEventArgs> FocusedViewActivated
168 if (focusedViewEnterKeyEventCallback == null)
170 focusedViewEnterKeyEventCallback = OnFocusedViewEnterKey;
171 FocusedViewEnterKeySignal().Connect(focusedViewEnterKeyEventCallback);
173 focusedViewEnterKeyEventHandler += value;
177 focusedViewEnterKeyEventHandler -= value;
179 if (focusedViewEnterKeyEventCallback != null && FocusedViewEnterKeySignal().Empty() == false)
181 FocusedViewEnterKeySignal().Disconnect(focusedViewEnterKeyEventCallback);
187 /// [Obsolete("Please do not use! this will be deprecated")]
189 /// <since_tizen> 3 </since_tizen>
190 /// Please do not use! this will be deprecated!
191 /// Instead please use FocusedViewActivated.
192 [Obsolete("Please do not use! This will be deprecated! Please use FocusManager.FocusedViewActivated instead! " +
194 "FocusManager.Instance.FocusedViewActivated = OnFocusedViewActivated; " +
195 "private void OnFocusedViewActivated(object source, FocusManager.FocusedViewActivatedEventArgs args) {...}")]
196 [EditorBrowsable(EditorBrowsableState.Never)]
197 public event EventHandler<FocusedViewActivatedEventArgs> FocusedViewEnterKeyPressed
201 if (focusedViewEnterKeyEventCallback2 == null)
203 focusedViewEnterKeyEventCallback2 = OnFocusedViewEnterKey2;
204 FocusedViewEnterKeySignal().Connect(focusedViewEnterKeyEventCallback2);
206 focusedViewEnterKeyEventHandler2 += value;
210 focusedViewEnterKeyEventHandler2 -= value;
212 if (focusedViewEnterKeyEventCallback2 != null && FocusedViewEnterKeySignal().Empty() == false)
214 FocusedViewEnterKeySignal().Disconnect(focusedViewEnterKeyEventCallback2);
220 /// ICustomFocusAlgorithm is used to provide the custom keyboard focus algorithm for retrieving the next focusable view.<br />
221 /// The application can implement the interface and override the keyboard focus behavior.<br />
222 /// If the focus is changing within a layout container, then the layout container is queried first to provide the next focusable view.<br />
223 /// If this does not provide a valid view, then the Keyboard FocusManager will check focusable properties to determine the next focusable actor.<br />
224 /// If focusable properties are not set, then the keyboard FocusManager calls the GetNextFocusableView() method of this interface.<br />
226 /// <since_tizen> 3 </since_tizen>
227 public interface ICustomFocusAlgorithm
230 /// Get the next focus actor.
232 /// <param name="current">The current focus view.</param>
233 /// <param name="proposed">The proposed focus view</param>
234 /// <param name="direction">The focus move direction</param>
235 /// <returns>The next focus actor.</returns>
236 /// <since_tizen> 3 </since_tizen>
237 View GetNextFocusableView(View current, View proposed, View.FocusDirection direction);
242 /// Gets or sets the status of whether the focus movement should be looped within the same focus group.<br />
243 /// The focus movement is not looped by default.<br />
245 /// <since_tizen> 3 </since_tizen>
246 public bool FocusGroupLoop
250 SetFocusGroupLoop(value);
254 return GetFocusGroupLoop();
259 /// Gets or sets the focus indicator view.<br />
260 /// This will replace the default focus indicator view in the FocusManager and will be added to the focused view as a highlight.<br />
262 /// <since_tizen> 3 </since_tizen>
263 public View FocusIndicator
267 SetFocusIndicatorView(value);
271 return GetFocusIndicatorView();
276 /// Gets the singleton of the FocusManager object.
278 /// <since_tizen> 3 </since_tizen>
279 public static FocusManager Instance
288 /// Moves the keyboard focus to the given view.<br />
289 /// Only one view can be focused at the same time.<br />
290 /// The view must be in the stage already and keyboard focusable.<br />
292 /// <param name="view">The view to be focused.</param>
293 /// <returns>Whether the focus is successful or not.</returns>
294 /// <since_tizen> 3 </since_tizen>
295 public bool SetCurrentFocusView(View view)
299 throw new ArgumentNullException(nameof(view), "the target view should not be null");
302 bool ret = Interop.FocusManager.SetCurrentFocusActor(SwigCPtr, View.getCPtr(view));
303 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
308 /// Gets the current focused view.
310 /// <returns>A handle to the current focused view or an empty handle if no view is focused.</returns>
311 /// <since_tizen> 3 </since_tizen>
312 public View GetCurrentFocusView()
314 //to fix memory leak issue, match the handle count with native side.
315 IntPtr cPtr = Interop.FocusManager.GetCurrentFocusActor(SwigCPtr);
316 View ret = this.GetInstanceSafely<View>(cPtr);
321 /// Moves the focus to the next focusable view in the focus chain in the given direction (according to the focus traversal order).
323 /// <param name="direction">The direction of the focus movement.</param>
324 /// <returns>True if the movement was successful.</returns>
325 /// <since_tizen> 3 </since_tizen>
326 public bool MoveFocus(View.FocusDirection direction)
328 bool ret = Interop.FocusManager.MoveFocus(SwigCPtr, (int)direction);
329 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
334 /// Clears the focus from the current focused view if any, so that no view is focused in the focus chain.<br />
335 /// It will emit the FocusChanged event without the current focused view.<br />
337 /// <since_tizen> 3 </since_tizen>
338 public void ClearFocus()
340 Interop.FocusManager.ClearFocus(SwigCPtr);
341 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
345 /// Move the focus to previous focused view.
347 /// <since_tizen> 3 </since_tizen>
348 public void MoveFocusBackward()
350 Interop.FocusManager.MoveFocusBackward(SwigCPtr);
351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355 /// Sets whether the view is a focus group that can limit the scope of the focus movement to its child views in the focus chain.<br />
356 /// Layout controls set themselves as focus groups by default.<br />
358 /// <param name="view">The view to be set as a focus group.</param>
359 /// <param name="isFocusGroup">Whether to set the view as a focus group or not.</param>
360 /// <since_tizen> 3 </since_tizen>
361 public void SetAsFocusGroup(View view, bool isFocusGroup)
363 Interop.FocusManager.SetAsFocusGroup(SwigCPtr, View.getCPtr(view), isFocusGroup);
364 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368 /// Checks whether the view is set as a focus group or not.
370 /// <param name="view">The view to be checked.</param>
371 /// <returns>Whether the view is set as a focus group.</returns>
372 /// <since_tizen> 3 </since_tizen>
373 public bool IsFocusGroup(View view)
375 bool ret = Interop.FocusManager.IsFocusGroup(SwigCPtr, View.getCPtr(view));
376 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381 /// Returns the closest ancestor of the given view that is a focus group.
383 /// <param name="view">The view to be checked for its focus group.</param>
384 /// <returns>The focus group the given view belongs to or an empty handle if the given view.</returns>
385 /// <since_tizen> 3 </since_tizen>
386 public View GetFocusGroup(View view)
388 //to fix memory leak issue, match the handle count with native side.
389 IntPtr cPtr = Interop.FocusManager.GetFocusGroup(SwigCPtr, View.getCPtr(view));
390 View ret = this.GetInstanceSafely<View>(cPtr);
395 /// Provides the implementation of a custom focus algorithm interface to allow the application to define the focus logic.<br />
397 /// <param name="arg0">The user's implementation of ICustomFocusAlgorithm.</param>
398 /// <since_tizen> 3 </since_tizen>
399 public void SetCustomAlgorithm(ICustomFocusAlgorithm arg0)
403 customAlgorithmInterfaceWrapper = new CustomAlgorithmInterfaceWrapper();
404 customAlgorithmInterfaceWrapper.SetFocusAlgorithm(arg0);
406 Interop.NDalic.SetCustomAlgorithm(SwigCPtr, CustomAlgorithmInterface.getCPtr(customAlgorithmInterfaceWrapper));
407 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
411 Interop.NDalic.SetCustomAlgorithm(SwigCPtr, new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero));
412 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
417 /// Sets to use the automatic focus moveing algorithm. <br />
418 /// It moves the focus to the view closest to the keyboard movement direction.
420 /// <param name="enable">Whether using default focus algorithm or not</param>
421 [EditorBrowsable(EditorBrowsableState.Never)]
422 public void EnableDefaultAlgorithm(bool enable)
424 Interop.FocusManager.EnableDefaultAlgorithm(SwigCPtr, enable);
425 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
429 /// Checks default focus moveing algorithm is enabled or not
431 /// <returns>Whether default focus algorithm is enabled</returns>
432 [EditorBrowsable(EditorBrowsableState.Never)]
433 public bool IsDefaultAlgorithmEnabled()
435 bool ret = Interop.FocusManager.IsDefaultAlgorithmEnabled(SwigCPtr);
436 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
441 /// Get the nearest focusable view.
443 /// <param name="rootView">The view group in which to find the next focusable view.</param>
444 /// <param name="focusedView">The current focused view.</param>
445 /// <param name="direction">The direction.</param>
446 /// <returns>The nearest focusable view, or an empty handle if none exists.</returns>
447 [EditorBrowsable(EditorBrowsableState.Never)]
448 public View GetNearestFocusableActor(View rootView, View focusedView, View.FocusDirection direction)
450 //to fix memory leak issue, match the handle count with native side.
451 IntPtr cPtr = Interop.FocusManager.GetNearestFocusableActor(View.getCPtr(rootView), View.getCPtr(focusedView), (int)direction);
452 View ret = this.GetInstanceSafely<View>(cPtr);
456 internal static FocusManager Get()
458 FocusManager ret = new FocusManager(Interop.FocusManager.Get(), true);
459 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
463 internal void SetFocusGroupLoop(bool enabled)
465 Interop.FocusManager.SetFocusGroupLoop(SwigCPtr, enabled);
466 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
469 internal bool GetFocusGroupLoop()
471 bool ret = Interop.FocusManager.GetFocusGroupLoop(SwigCPtr);
472 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
476 internal void SetFocusIndicatorView(View indicator)
478 Interop.FocusManager.SetFocusIndicatorActor(SwigCPtr, View.getCPtr(indicator));
479 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
480 internalFocusIndicator = indicator;
483 internal View GetFocusIndicatorView()
485 //to fix memory leak issue, match the handle count with native side.
486 IntPtr cPtr = Interop.FocusManager.GetFocusIndicatorActor(SwigCPtr);
487 internalFocusIndicator = this.GetInstanceSafely<View>(cPtr);
488 return internalFocusIndicator;
491 internal PreFocusChangeSignal PreFocusChangeSignal()
493 PreFocusChangeSignal ret = new PreFocusChangeSignal(Interop.FocusManager.PreFocusChangeSignal(SwigCPtr), false);
494 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
498 internal FocusChangedSignal FocusChangedSignal()
500 FocusChangedSignal ret = new FocusChangedSignal(Interop.FocusManager.FocusChangedSignal(SwigCPtr), false);
501 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
505 internal FocusGroupChangedSignal FocusGroupChangedSignal()
507 FocusGroupChangedSignal ret = new FocusGroupChangedSignal(Interop.FocusManager.FocusGroupChangedSignal(SwigCPtr), false);
508 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
512 internal ViewSignal FocusedViewEnterKeySignal()
514 ViewSignal ret = new ViewSignal(Interop.FocusManager.FocusedActorEnterKeySignal(SwigCPtr), false);
515 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
519 private IntPtr OnPreFocusChange(IntPtr current, IntPtr proposed, View.FocusDirection direction)
522 PreFocusChangeEventArgs e = new PreFocusChangeEventArgs();
524 if (current != global::System.IntPtr.Zero)
526 e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View;
528 if (proposed != global::System.IntPtr.Zero)
530 e.ProposedView = Registry.GetManagedBaseHandleFromNativePtr(proposed) as View;
532 e.Direction = direction;
534 if (preFocusChangeEventHandler != null)
536 view = preFocusChangeEventHandler(this, e);
541 return view.GetPtrfromView();
545 if (e.ProposedView != null) return proposed;
550 private void OnFocusChanged(IntPtr current, IntPtr next)
552 if (focusChangedEventHandler != null)
554 FocusChangedEventArgs e = new FocusChangedEventArgs();
556 e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View;
557 e.NextView = Registry.GetManagedBaseHandleFromNativePtr(next) as View;
558 focusChangedEventHandler(this, e);
562 private void OnFocusGroupChanged(IntPtr current, bool forwardDirection)
564 if (focusGroupChangedEventHandler != null)
566 FocusGroupChangedEventArgs e = new FocusGroupChangedEventArgs();
568 e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View;
569 e.ForwardDirection = forwardDirection;
570 focusGroupChangedEventHandler(this, e);
574 private void OnFocusedViewEnterKey(IntPtr view)
576 if (focusedViewEnterKeyEventHandler != null)
578 FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs();
579 e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View;
580 focusedViewEnterKeyEventHandler(this, e);
585 /// Please do not use! this will be deprecated!
587 /// Please do not use! this will be deprecated!
588 /// Instead please use OnFocusedViewEnterKey.
589 [Obsolete("Please do not use! This will be deprecated! Please use FocusManager.OnFocusedViewEnterKey instead!")]
590 [EditorBrowsable(EditorBrowsableState.Never)]
591 private void OnFocusedViewEnterKey2(IntPtr view)
593 if (focusedViewEnterKeyEventHandler != null)
595 FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs();
596 e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View;
597 focusedViewEnterKeyEventHandler(this, e);
602 /// Event arguments that passed via the PreFocusChange signal.
604 /// <since_tizen> 3 </since_tizen>
605 public class PreFocusChangeEventArgs : EventArgs
607 private View current;
608 private View proposed;
609 private View.FocusDirection direction;
612 /// The current focus view.
614 /// <since_tizen> 3 </since_tizen>
615 public View CurrentView
628 /// The proposed view.
630 /// <since_tizen> 3 </since_tizen>
631 public View ProposedView
644 /// The focus move direction.
646 /// <since_tizen> 3 </since_tizen>
647 public View.FocusDirection Direction
661 /// Event arguments that passed via the FocusChanged signal.
663 /// <since_tizen> 3 </since_tizen>
664 public class FocusChangedEventArgs : EventArgs
666 private View current;
670 /// The current focus view.
672 /// <since_tizen> 3 </since_tizen>
673 public View CurrentView
685 /// The next focus view.
687 /// <since_tizen> 3 </since_tizen>
702 /// Event arguments that passed via the FocusGroupChanged signal.
704 /// <since_tizen> 3 </since_tizen>
705 public class FocusGroupChangedEventArgs : EventArgs
707 private View current;
708 private bool forwardDirection;
711 /// The current focus view.
713 /// <since_tizen> 3 </since_tizen>
714 public View CurrentView
727 /// The forward direction.
729 /// <since_tizen> 3 </since_tizen>
730 public bool ForwardDirection
734 return forwardDirection;
738 forwardDirection = value;
744 /// Event arguments that passed via the FocusedViewEnterKey signal.
746 /// <since_tizen> 3 </since_tizen>
747 public class FocusedViewActivatedEventArgs : EventArgs
754 /// <since_tizen> 3 </since_tizen>
769 /// Please do not use! this will be deprecated
771 /// <since_tizen> 3 </since_tizen>
772 /// Please do not use! this will be deprecated.
773 /// Instead please use FocusedViewActivatedEventArgs.
774 [Obsolete("Please do not use! This will be deprecated! Please use FocusedViewActivatedEventArgs instead! " +
776 "FocusManager.Instance.FocusedViewActivated = OnFocusedViewActivated; " +
777 "private void OnFocusedViewActivated(object source, FocusManager.FocusedViewActivatedEventArgs arg)" +
779 [EditorBrowsable(EditorBrowsableState.Never)]
780 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
781 public class FocusedViewEnterKeyEventArgs : EventArgs
788 /// <since_tizen> 3 </since_tizen>
802 private class CustomAlgorithmInterfaceWrapper : CustomAlgorithmInterface
804 private FocusManager.ICustomFocusAlgorithm customFocusAlgorithm;
806 public CustomAlgorithmInterfaceWrapper()
810 public void SetFocusAlgorithm(FocusManager.ICustomFocusAlgorithm customFocusAlgorithm)
812 this.customFocusAlgorithm = customFocusAlgorithm;
815 public override View GetNextFocusableView(View current, View proposed, View.FocusDirection direction, string deviceName)
817 if (customFocusAlgorithm == null)
819 Tizen.Log.Error("NUI", $"[ERROR] User defined ICustomFocusAlgorithm interface class becomes unreachable. Null will be proposed for next focusing!");
822 if (customFocusAlgorithm is ICustomAwareDeviceFocusAlgorithm deviceAwared)
824 return deviceAwared.GetNextFocusableView(current, proposed, direction, deviceName);
828 return customFocusAlgorithm.GetNextFocusableView(current, proposed, direction);