[NUI] Add license, delete unnecessary code(public)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Common / Adaptor.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 using System;
18 using System.ComponentModel;
19
20 namespace Tizen.NUI
21 {
22     /// <summary>
23     /// An Adaptor object is used to initialize and control how Dali runs.
24     ///
25     /// It provides the lifecycle interface that allows the application
26     /// writer to provide their own main loop and other platform related
27     /// features.
28     ///
29     /// The Adaptor class provides a means for initialising the resources required by the Dali::Core.
30     ///
31     /// When dealing with platform events, the application writer must ensure that DALi is called in a
32     /// thread-safe manner.
33     ///
34     /// As soon as the Adaptor class is created and started, the application writer can initialise their
35     /// view objects straight away or as required by the main loop they intend to use (there is no
36     /// need to wait for an initialize signal as per the Tizen.NUI.Application class).
37     ///
38     /// </summary>
39     /// <since_tizen> 4 </since_tizen>
40     [Obsolete("Deprecated in API8, will be removed in API10. This is not used anymore, please do not use.")]
41     public class Adaptor : Disposable
42     {
43         private static readonly Adaptor instance = Adaptor.Get();
44
45         internal Adaptor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
46         {
47         }
48
49         /// <summary>
50         /// Returns a reference to the instance of the adaptor used by the current thread.
51         /// </summary>
52         /// <remarks>The adaptor has been initialized. This is only valid in the main thread.</remarks>
53         /// <since_tizen> 4 </since_tizen>
54         [Obsolete("Deprecated in API8, will be removed in API10. This is not used anymore, please do not use.")]
55         public static Adaptor Instance
56         {
57             get
58             {
59                 return instance;
60             }
61         }
62
63         /// <summary>
64         /// Feeds a wheel event to the adaptor.
65         /// </summary>
66         /// <param name="wheelEvent">The wheel event.</param>
67         /// <since_tizen> 4 </since_tizen>
68         [Obsolete("Deprecated in API8, will be removed in API10. This is not used anymore, please do not use.")]
69         public void FeedWheelEvent(Wheel wheelEvent)
70         {
71             Interop.Adaptor.FeedWheelEvent(SwigCPtr, Wheel.getCPtr(wheelEvent));
72             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
73         }
74
75         /// <summary>
76         /// Feeds a key event to the adaptor.
77         /// </summary>
78         /// <param name="keyEvent">The key event holding the key information.</param>
79         /// <since_tizen> 4 </since_tizen>
80         [Obsolete("Deprecated in API8, will be removed in API10. This is not used anymore, please do not use.")]
81         public void FeedKeyEvent(Key keyEvent)
82         {
83             Interop.Adaptor.FeedKeyEvent(SwigCPtr, Key.getCPtr(keyEvent));
84             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85         }
86
87         internal static Adaptor Get()
88         {
89             Adaptor ret = new Adaptor(Interop.Adaptor.Get(), false);
90             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91             return ret;
92         }
93
94         /// <summary>
95         /// Sets the number of frames per render.
96         /// </summary>
97         /// <param name="numberOfVSyncsPerRender">The number of vsyncs between successive renders.</param>
98         /// <remarks>
99         /// Suggest this is a power of two:
100         /// 1 - render each vsync frame.
101         /// 2 - render every other vsync frame.
102         /// 4 - render every fourth vsync frame.
103         /// 8 - render every eighth vsync frame.
104         ///</remarks>
105         internal void SetRenderRefreshRate(uint numberOfVSyncsPerRender)
106         {
107             Interop.Adaptor.SetRenderRefreshRate(SwigCPtr, numberOfVSyncsPerRender);
108             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109         }
110
111         /// <summary>
112         /// ReleaseSwigCPtr
113         /// </summary>
114         /// <param name="swigCPtr"></param>
115         [Obsolete("Deprecated in API8, will be removed in API10. This is not used anymore, please do not use.")]
116         // This will not be public opened.
117         [EditorBrowsable(EditorBrowsableState.Never)]
118         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
119         {
120             Interop.Adaptor.DeleteAdaptor(swigCPtr);
121         }
122     }
123 }