3609769e24e259cff0f59e8a4545fc5d506656e7
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Common / KeyInputFocusManager.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using Tizen.NUI.BaseComponents;
19
20 namespace Tizen.NUI
21 {
22     internal class KeyInputFocusManager : BaseHandle
23     {
24         internal KeyInputFocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
25         {
26         }
27
28         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
29         {
30             Interop.KeyInputFocusManager.DeleteKeyInputFocusManager(swigCPtr);
31         }
32
33         private KeyInputFocusManager() : this(Interop.KeyInputFocusManager.NewKeyInputFocusManager(), true)
34         {
35             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36         }
37
38         public static KeyInputFocusManager Get()
39         {
40             KeyInputFocusManager ret = new KeyInputFocusManager(Interop.KeyInputFocusManager.Get(), true);
41             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
42             return ret;
43         }
44
45         public void SetFocus(View control)
46         {
47             Interop.KeyInputFocusManager.SetFocus(SwigCPtr, View.getCPtr(control));
48             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49         }
50
51         public View GetCurrentFocusControl()
52         {
53             View ret = new View(Interop.KeyInputFocusManager.GetCurrentFocusControl(SwigCPtr), true);
54             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
55             return ret;
56         }
57
58         public void RemoveFocus(View control)
59         {
60             Interop.KeyInputFocusManager.RemoveFocus(SwigCPtr, View.getCPtr(control));
61             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
62         }
63
64         internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t KeyInputFocusChangedSignal()
65         {
66             SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t(Interop.KeyInputFocusManager.KeyInputFocusChangedSignal(SwigCPtr));
67             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
68             return ret;
69         }
70     }
71 }