Release 4.0.0-preview1-00235
[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     using Tizen.NUI.BaseComponents;
26
27     /// <summary>
28     /// Provides the functionality of handling keyboard navigation and maintaining the two-dimensional keyboard focus chain.<br>
29     /// It provides functionality of setting the focus and moving the focus in four directions( i.e., left, right, up, and down).<br>
30     /// It also draws a highlight for the focused view and sends an event when the focus is changed.<br>
31     /// </summary>
32     public class FocusManager : BaseHandle
33     {
34         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35         private CustomAlgorithmInterfaceWrapper _customAlgorithmInterfaceWrapper;
36
37         internal FocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.FocusManager_SWIGUpcast(cPtr), cMemoryOwn)
38         {
39             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40         }
41
42         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FocusManager obj)
43         {
44             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
45         }
46
47         /// <summary>
48         /// To make the FocusManager instance be disposed.
49         /// </summary>
50         protected override void Dispose(DisposeTypes type)
51         {
52             if(disposed)
53             {
54                 return;
55             }
56
57             if(type == DisposeTypes.Explicit)
58             {
59                 //Called by User
60                 //Release your own managed resources here.
61                 //You should release all of your own disposable objects here.
62             }
63
64             //Release your own unmanaged resources here.
65             //You should not access any managed member here except static instance.
66             //because the execution order of Finalizes is non-deterministic.
67
68             if (_focusedViewEnterKeyEventCallback2 != null)
69             {
70                 FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback2);
71             }
72
73             if (_focusedViewEnterKeyEventCallback != null)
74             {
75                 FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback);
76             }
77
78             if (_focusGroupChangedEventCallback != null)
79             {
80                 FocusGroupChangedSignal().Disconnect(_focusGroupChangedEventCallback);
81             }
82
83             if (_focusChangedEventCallback != null)
84             {
85                 FocusChangedSignal().Disconnect(_focusChangedEventCallback);
86             }
87
88             if (_preFocusChangeCallback != null)
89             {
90                 PreFocusChangeSignal().Disconnect(_preFocusChangeCallback);
91             }
92
93             if (swigCPtr.Handle != global::System.IntPtr.Zero)
94             {
95                 if (swigCMemOwn)
96                 {
97                     swigCMemOwn = false;
98                     NDalicManualPINVOKE.delete_FocusManager(swigCPtr);
99                 }
100                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
101             }
102
103             base.Dispose(type);
104         }
105
106
107         ///<summary>
108         /// Event arguments that passed via the PreFocusChange signal.
109         /// </summary>
110         public class PreFocusChangeEventArgs : EventArgs
111         {
112             private View _current;
113             private View _proposed;
114             private View.FocusDirection _direction;
115
116             public View CurrentView
117             {
118                 get
119                 {
120                     return _current;
121                 }
122                 set
123                 {
124                     _current = value;
125                 }
126             }
127
128             public View ProposedView
129             {
130                 get
131                 {
132                     return _proposed;
133                 }
134                 set
135                 {
136                     _proposed = value;
137                 }
138             }
139
140             public View.FocusDirection Direction
141             {
142                 get
143                 {
144                     return _direction;
145                 }
146                 set
147                 {
148                     _direction = value;
149                 }
150             }
151         }
152
153         private EventHandlerWithReturnType<object, PreFocusChangeEventArgs, View> _preFocusChangeEventHandler;
154         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
155         internal delegate IntPtr PreFocusChangeEventCallback(IntPtr current, IntPtr proposed, View.FocusDirection direction);
156         private PreFocusChangeEventCallback _preFocusChangeCallback;
157
158         /// <summary>
159         /// PreFocusChange will be triggered before the focus is going to be changed.<br>
160         /// The FocusManager makes the best guess for which view to focus towards the given direction, but applications might want to change that.<br>
161         /// By connecting with this event, they can check the proposed view to focus and return a different view if they wish.<br>
162         /// This event is only triggered when the navigation key is pressed and KeyboardFocusManager tries to move the focus automatically.<br>
163         /// It won't be emitted for focus movement by calling the SetCurrentFocusView directly.<br>
164         /// </summary>
165         public event EventHandlerWithReturnType<object, PreFocusChangeEventArgs, View> PreFocusChange
166         {
167             add
168             {
169                 if (_preFocusChangeEventHandler == null)
170                 {
171 #if DEBUG_ON
172                     Tizen.Log.Debug("NUI", "con1) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty());
173                     Tizen.Log.Debug("NUI", "con2) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount());
174 #endif
175                     _preFocusChangeCallback = OnPreFocusChange;
176                     PreFocusChangeSignal().Connect(_preFocusChangeCallback);
177 #if DEBUG_ON
178                     Tizen.Log.Debug("NUI", "con3) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty());
179                     Tizen.Log.Debug("NUI", "con4) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount());
180 #endif
181                 }
182                 _preFocusChangeEventHandler += value;
183             }
184             remove
185             {
186                 _preFocusChangeEventHandler -= value;
187                 if (_preFocusChangeEventHandler == null && PreFocusChangeSignal().Empty() == false)
188                 {
189 #if DEBUG_ON
190                     Tizen.Log.Debug("NUI", "discon1) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty());
191                     Tizen.Log.Debug("NUI", "discon2) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount());
192 #endif
193                     PreFocusChangeSignal().Disconnect(_preFocusChangeCallback);
194 #if DEBUG_ON
195                     Tizen.Log.Debug("NUI", "discon3) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty());
196                     Tizen.Log.Debug("NUI", "discon4) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount());
197 #endif
198                 }
199             }
200         }
201
202         private IntPtr OnPreFocusChange(IntPtr current, IntPtr proposed, View.FocusDirection direction)
203         {
204             View view = null;
205             PreFocusChangeEventArgs e = new PreFocusChangeEventArgs();
206
207             if (current != global::System.IntPtr.Zero)
208             {
209                 e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View;
210             }
211             if (proposed != global::System.IntPtr.Zero)
212             {
213                 e.ProposedView = Registry.GetManagedBaseHandleFromNativePtr(proposed) as View;
214             }
215             e.Direction = direction;
216
217             if (_preFocusChangeEventHandler != null)
218             {
219                 view = _preFocusChangeEventHandler(this, e);
220             }
221
222             if (view)
223             {
224                 return view.GetPtrfromView();
225             }
226             else
227             {
228                 //if (e.ProposedView) return proposed;
229                 //else return current;
230                 return current; //xb.teng
231             }
232         }
233
234         ///<summary>
235         /// Event arguments that passed via the FocusChanged signal.
236         /// </summary>
237         public class FocusChangedEventArgs : EventArgs
238         {
239             private View _current;
240             private View _next;
241
242             public View CurrentView
243             {
244                 get
245                 {
246                     return _current;
247                 }
248                 set
249                 {
250                     _current = value;
251                 }
252             }
253
254             public View NextView
255             {
256                 get
257                 {
258                     return _next;
259                 }
260                 set
261                 {
262                     _next = value;
263                 }
264             }
265         }
266
267         private EventHandler<FocusChangedEventArgs> _focusChangedEventHandler;
268         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
269         internal delegate void FocusChangedEventCallback(IntPtr current, IntPtr next);
270         private FocusChangedEventCallback _focusChangedEventCallback;
271
272         /// <summary>
273         /// The FocusGroupChanged will be triggered after the current focused view has been changed.
274         /// </summary>
275         public event EventHandler<FocusChangedEventArgs> FocusChanged
276         {
277             add
278             {
279                 if (_focusChangedEventCallback == null)
280                 {
281                     _focusChangedEventCallback = OnFocusChanged;
282                     FocusChangedSignal().Connect(_focusChangedEventCallback);
283                 }
284                 _focusChangedEventHandler += value;
285             }
286             remove
287             {
288                 _focusChangedEventHandler -= value;
289
290                 if (_focusChangedEventCallback == null && FocusChangedSignal().Empty() == false)
291                 {
292                     FocusChangedSignal().Disconnect(_focusChangedEventCallback);
293                 }
294             }
295         }
296
297         private void OnFocusChanged(IntPtr current, IntPtr next)
298         {
299             FocusChangedEventArgs e = new FocusChangedEventArgs();
300
301             e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View;
302             e.NextView = Registry.GetManagedBaseHandleFromNativePtr(next) as View;
303
304             if (_focusChangedEventHandler != null)
305             {
306                 _focusChangedEventHandler(this, e);
307             }
308         }
309
310         ///<summary>
311         /// Event arguments that passed via the FocusGroupChanged signal.
312         /// </summary>
313         public class FocusGroupChangedEventArgs : EventArgs
314         {
315             private View _current;
316             private bool _forwardDirection;
317
318             public View CurrentView
319             {
320                 get
321                 {
322                     return _current;
323                 }
324                 set
325                 {
326                     _current = value;
327                 }
328             }
329
330             public bool ForwardDirection
331             {
332                 get
333                 {
334                     return _forwardDirection;
335                 }
336                 set
337                 {
338                     _forwardDirection = value;
339                 }
340             }
341         }
342
343         private EventHandler<FocusGroupChangedEventArgs> _focusGroupChangedEventHandler;
344         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
345         private delegate void FocusGroupChangedEventCallback(IntPtr current, bool forwardDirection);
346         private FocusGroupChangedEventCallback _focusGroupChangedEventCallback;
347
348         /// <summary>
349         /// The FocusGroupChanged will be triggered when the focus group has been changed.<br>
350         /// 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>
351         /// If not, the application has to set the new focus.<br>
352         /// </summary>
353         public event EventHandler<FocusGroupChangedEventArgs> FocusGroupChanged
354         {
355             add
356             {
357                 if (_focusGroupChangedEventCallback == null)
358                 {
359                     _focusGroupChangedEventCallback = OnFocusGroupChanged;
360                     FocusGroupChangedSignal().Connect(_focusGroupChangedEventCallback);
361                 }
362                 _focusGroupChangedEventHandler += value;
363             }
364             remove
365             {
366                 _focusGroupChangedEventHandler -= value;
367
368                 if (_focusGroupChangedEventCallback == null && FocusGroupChangedSignal().Empty() == false)
369                 {
370                     FocusGroupChangedSignal().Disconnect(_focusGroupChangedEventCallback);
371                 }
372             }
373         }
374
375         private void OnFocusGroupChanged(IntPtr current, bool forwardDirection)
376         {
377             FocusGroupChangedEventArgs e = new FocusGroupChangedEventArgs();
378
379             e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View;
380             e.ForwardDirection = forwardDirection;
381
382             if (_focusGroupChangedEventHandler != null)
383             {
384                 _focusGroupChangedEventHandler(this, e);
385             }
386         }
387
388         ///<summary>
389         /// Event arguments that passed via the FocusedViewEnterKey signal.
390         /// </summary>
391         public class FocusedViewActivatedEventArgs : EventArgs
392         {
393             private View _view;
394
395             public View View
396             {
397                 get
398                 {
399                     return _view;
400                 }
401                 set
402                 {
403                     _view = value;
404                 }
405             }
406         }
407
408         private EventHandler<FocusedViewActivatedEventArgs> _focusedViewEnterKeyEventHandler;
409         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
410         private delegate void FocusedViewEnterKeyEventCallback(IntPtr view);
411         private FocusedViewEnterKeyEventCallback _focusedViewEnterKeyEventCallback;
412
413         /// <summary>
414         /// The FocusedViewActivated will be triggered when the current focused view has the enter key pressed on it.
415         /// </summary>
416         public event EventHandler<FocusedViewActivatedEventArgs> FocusedViewActivated
417         {
418             add
419             {
420                 if (_focusedViewEnterKeyEventCallback == null)
421                 {
422                     _focusedViewEnterKeyEventCallback = OnFocusedViewEnterKey;
423                     FocusedViewEnterKeySignal().Connect(_focusedViewEnterKeyEventCallback);
424                 }
425                 _focusedViewEnterKeyEventHandler += value;
426             }
427             remove
428             {
429                 _focusedViewEnterKeyEventHandler -= value;
430
431                 if (_focusedViewEnterKeyEventCallback != null && FocusedViewEnterKeySignal().Empty() == false)
432                 {
433                     FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback);
434                 }
435             }
436         }
437
438         private void OnFocusedViewEnterKey(IntPtr view)
439         {
440             FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs();
441
442             e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View;
443
444             if (_focusedViewEnterKeyEventHandler != null)
445             {
446                 _focusedViewEnterKeyEventHandler(this, e);
447             }
448         }
449
450
451         internal FocusManager() : this(NDalicManualPINVOKE.new_FocusManager(), true)
452         {
453             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
454         }
455
456         internal static FocusManager Get()
457         {
458             FocusManager ret = new FocusManager(NDalicManualPINVOKE.FocusManager_Get(), true);
459             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
460             return ret;
461         }
462
463         /// <summary>
464         /// Moves the keyboard focus to the given view.<br>
465         /// Only one view can be focused at the same time.<br>
466         /// The view must be in the stage already and keyboard focusable.<br>
467         /// </summary>
468         /// <param name="view">The view to be focused.</param>
469         /// <returns>Whether the focus is successful or not.</returns>
470         public bool SetCurrentFocusView(View view)
471         {
472             if(view == null)
473             {
474                 throw new ArgumentNullException("the target view should not be null");
475             }
476
477             bool ret = NDalicManualPINVOKE.FocusManager_SetCurrentFocusActor(swigCPtr, View.getCPtr(view));
478             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
479             return ret;
480         }
481
482         /// <summary>
483         /// Gets the current focused view.
484         /// </summary>
485         /// <returns>A handle to the current focused view or an empty handle if no view is focused.</returns>
486         public View GetCurrentFocusView()
487         {
488             IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetCurrentFocusActor(swigCPtr);
489
490             View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
491             return ret;
492         }
493
494         /// <summary>
495         /// Moves the focus to the next focusable view in the focus chain in the given direction (according to the focus traversal order).
496         /// </summary>
497         /// <param name="direction">The direction of the focus movement.</param>
498         /// <returns>True if the movement was successful.</returns>
499         public bool MoveFocus(View.FocusDirection direction)
500         {
501             bool ret = NDalicManualPINVOKE.FocusManager_MoveFocus(swigCPtr, (int)direction);
502             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
503             return ret;
504         }
505
506         /// <summary>
507         /// Clears the focus from the current focused view if any, so that no view is focused in the focus chain.<br>
508         /// It will emit the FocusChanged event without the current focused view.<br>
509         /// </summary>
510         public void ClearFocus()
511         {
512             NDalicManualPINVOKE.FocusManager_ClearFocus(swigCPtr);
513             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
514         }
515
516         /// <summary>
517         /// Move the focus to previous focused view.
518         /// </summary>
519         public void MoveFocusBackward()
520         {
521             NDalicManualPINVOKE.FocusManager_MoveFocusBackward(swigCPtr);
522             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
523         }
524
525         /// <summary>
526         /// Gets or sets the status of whether the focus movement should be looped within the same focus group.<br>
527         /// The focus movement is not looped by default.<br>
528         /// </summary>
529         public bool FocusGroupLoop
530         {
531             set
532             {
533                 SetFocusGroupLoop(value);
534             }
535             get
536             {
537                 return GetFocusGroupLoop();
538             }
539         }
540
541         internal void SetFocusGroupLoop(bool enabled)
542         {
543             NDalicManualPINVOKE.FocusManager_SetFocusGroupLoop(swigCPtr, enabled);
544             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
545         }
546
547         internal bool GetFocusGroupLoop()
548         {
549             bool ret = NDalicManualPINVOKE.FocusManager_GetFocusGroupLoop(swigCPtr);
550             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
551             return ret;
552         }
553
554         /// <summary>
555         /// 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>
556         /// Layout controls set themselves as focus groups by default.<br>
557         /// </summary>
558         /// <param name="view">The view to be set as a focus group.</param>
559         /// <param name="isFocusGroup">Whether to set the view as a focus group or not.</param>
560         public void SetAsFocusGroup(View view, bool isFocusGroup)
561         {
562             NDalicManualPINVOKE.FocusManager_SetAsFocusGroup(swigCPtr, View.getCPtr(view), isFocusGroup);
563             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
564         }
565
566         /// <summary>
567         /// Checks whether the view is set as a focus group or not.
568         /// </summary>
569         /// <param name="view">The view to be checked.</param>
570         /// <returns>Whether the view is set as a focus group.</returns>
571         public bool IsFocusGroup(View view)
572         {
573             bool ret = NDalicManualPINVOKE.FocusManager_IsFocusGroup(swigCPtr, View.getCPtr(view));
574             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
575             return ret;
576         }
577
578         /// <summary>
579         /// Returns the closest ancestor of the given view that is a focus group.
580         /// </summary>
581         /// <param name="view">The view to be checked for its focus group.</param>
582         /// <returns>The focus group the given view belongs to or an empty handle if the given view.</returns>
583         public View GetFocusGroup(View view)
584         {
585             IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, View.getCPtr(view));
586
587             View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
588
589
590             /*View ret = new View(NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, View.getCPtr(view)), true);
591             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
592             if (ret.HasBody() == false)
593             {
594                 return null;
595             }*/
596
597             return ret;
598         }
599
600         /// <summary>
601         /// Gets or sets the focus indicator view.<br>
602         /// This will replace the default focus indicator view in the FocusManager and will be added to the focused view as a highlight.<br>
603         /// </summary>
604         public View FocusIndicator
605         {
606             set
607             {
608                 SetFocusIndicatorView(value);
609             }
610             get
611             {
612                 return GetFocusIndicatorView();
613             }
614         }
615
616         internal void SetFocusIndicatorView(View indicator)
617         {
618             NDalicManualPINVOKE.FocusManager_SetFocusIndicatorActor(swigCPtr, View.getCPtr(indicator));
619             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620         }
621
622         internal View GetFocusIndicatorView()
623         {
624             IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetFocusIndicatorActor(swigCPtr);
625
626             View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
627
628             return ret;
629         }
630
631         /// <summary>
632         /// Provides the implementation of a custom focus algorithm interface to allow the application to define the focus logic.<br>
633         /// </summary>
634         /// <param name="arg0">The user's implementation of ICustomFocusAlgorithm.</param>
635         public void SetCustomAlgorithm(ICustomFocusAlgorithm arg0)
636         {
637             _customAlgorithmInterfaceWrapper = new CustomAlgorithmInterfaceWrapper();
638             _customAlgorithmInterfaceWrapper.SetFocusAlgorithm(arg0);
639
640             NDalicPINVOKE.SetCustomAlgorithm(swigCPtr, CustomAlgorithmInterface.getCPtr(_customAlgorithmInterfaceWrapper));
641             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
642         }
643
644         internal PreFocusChangeSignal PreFocusChangeSignal()
645         {
646             PreFocusChangeSignal ret = new PreFocusChangeSignal(NDalicManualPINVOKE.FocusManager_PreFocusChangeSignal(swigCPtr), false);
647             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
648             return ret;
649         }
650
651         internal FocusChangedSignal FocusChangedSignal()
652         {
653             FocusChangedSignal ret = new FocusChangedSignal(NDalicManualPINVOKE.FocusManager_FocusChangedSignal(swigCPtr), false);
654             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
655             return ret;
656         }
657
658         internal FocusGroupChangedSignal FocusGroupChangedSignal()
659         {
660             FocusGroupChangedSignal ret = new FocusGroupChangedSignal(NDalicManualPINVOKE.FocusManager_FocusGroupChangedSignal(swigCPtr), false);
661             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
662             return ret;
663         }
664
665         internal ViewSignal FocusedViewEnterKeySignal()
666         {
667             ViewSignal ret = new ViewSignal(NDalicManualPINVOKE.FocusManager_FocusedActorEnterKeySignal(swigCPtr), false);
668             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
669             return ret;
670         }
671
672         private static readonly FocusManager instance = FocusManager.Get();
673
674         /// <summary>
675         /// Gets the singleton of the FocusManager object.
676         /// </summary>
677         public static FocusManager Instance
678         {
679             get
680             {
681                 return instance;
682             }
683         }
684
685         /// <summary>
686         /// ICustomFocusAlgorithm is used to provide the custom keyboard focus algorithm for retrieving the next focusable view.<br>
687         /// The application can implement the interface and override the keyboard focus behavior.<br>
688         /// If the focus is changing within a layout container, then the layout container is queried first to provide the next focusable view.<br>
689         /// If this does not provide a valid view, then the Keyboard FocusManager will check focusable properties to determine the next focusable actor.<br>
690         /// If focusable properties are not set, then the keyboard FocusManager calls the GetNextFocusableView() method of this interface.<br>
691         /// </summary>
692         public interface ICustomFocusAlgorithm
693         {
694             View GetNextFocusableView(View current, View proposed, View.FocusDirection direction);
695         }
696
697         private class CustomAlgorithmInterfaceWrapper : CustomAlgorithmInterface
698         {
699             private FocusManager.ICustomFocusAlgorithm _customFocusAlgorithm;
700
701             public CustomAlgorithmInterfaceWrapper()
702             {
703             }
704
705             public void SetFocusAlgorithm(FocusManager.ICustomFocusAlgorithm customFocusAlgorithm)
706             {
707                 _customFocusAlgorithm = customFocusAlgorithm;
708             }
709
710             public override View GetNextFocusableView(View current, View proposed, View.FocusDirection direction)
711             {
712                 return _customFocusAlgorithm.GetNextFocusableView(current, proposed, direction);
713             }
714         }
715
716
717
718         [Obsolete("Please do not use! this will be deprecated")]
719         public class FocusedViewEnterKeyEventArgs : EventArgs
720         {
721             private View _view;
722
723             public View View
724             {
725                 get
726                 {
727                     return _view;
728                 }
729                 set
730                 {
731                     _view = value;
732                 }
733             }
734         }
735
736         private EventHandler<FocusedViewEnterKeyEventArgs> _focusedViewEnterKeyEventHandler2;
737         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
738         private delegate void FocusedViewEnterKeyEventCallback2(IntPtr view);
739         private FocusedViewEnterKeyEventCallback2 _focusedViewEnterKeyEventCallback2;
740
741         [Obsolete("Please do not use! this will be deprecated")]
742         public event EventHandler<FocusedViewEnterKeyEventArgs> FocusedViewEnterKeyPressed
743         {
744             add
745             {
746                 if (_focusedViewEnterKeyEventCallback2 == null)
747                 {
748                     _focusedViewEnterKeyEventCallback2 = OnFocusedViewEnterKey2;
749                     FocusedViewEnterKeySignal().Connect(_focusedViewEnterKeyEventCallback2);
750                 }
751                 _focusedViewEnterKeyEventHandler2 += value;
752             }
753             remove
754             {
755                 _focusedViewEnterKeyEventHandler2 -= value;
756
757                 if (_focusedViewEnterKeyEventCallback2 != null && FocusedViewEnterKeySignal().Empty() == false)
758                 {
759                     FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback2);
760                 }
761             }
762         }
763
764         [Obsolete("Please do not use! this will be deprecated")]
765         private void OnFocusedViewEnterKey2(IntPtr view)
766         {
767             FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs();
768
769             e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View;
770
771             if (_focusedViewEnterKeyEventHandler != null)
772             {
773                 _focusedViewEnterKeyEventHandler(this, e);
774             }
775         }
776     }
777 }