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