Release 4.0.0-preview1-00304
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / WidgetData.cs
1 /*
2  * Copyright(c) 2017 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 namespace Tizen.NUI
19 {
20     /// <summary>
21     /// Widget data.
22     /// </summary>
23     public class WidgetData : BaseHandle
24     {
25         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26
27         internal WidgetData(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetData_SWIGUpcast(cPtr), cMemoryOwn)
28         {
29             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
30         }
31
32         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetData obj)
33         {
34             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
35         }
36
37         /// <summary>
38         /// To make Window instance be disposed.
39         /// </summary>
40         protected override void Dispose(DisposeTypes type)
41         {
42             if(disposed)
43             {
44                 return;
45             }
46
47             if(type == DisposeTypes.Explicit)
48             {
49                 //Called by User
50                 //Release your own managed resources here.
51                 //You should release all of your own disposable objects here.
52             }
53
54             //Release your own unmanaged resources here.
55             //You should not access any managed member here except static instance.
56             //because the execution order of Finalizes is non-deterministic.
57
58             if (swigCPtr.Handle != global::System.IntPtr.Zero)
59             {
60                 if (swigCMemOwn)
61                 {
62                     swigCMemOwn = false;
63                     NDalicManualPINVOKE.delete_WidgetData(swigCPtr);
64                 }
65                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
66             }
67
68             base.Dispose(type);
69         }
70
71         internal static WidgetData GetWidgetDataFromPtr(global::System.IntPtr cPtr)
72         {
73             WidgetData ret = new WidgetData(cPtr, false);
74             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
75             return ret;
76         }
77
78         internal WidgetData(string instanceId, SWIGTYPE_p_bundle args, string content) : this(NDalicManualPINVOKE.WidgetData_New(instanceId, SWIGTYPE_p_bundle.getCPtr(args), content), true)
79         {
80             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81         }
82
83         internal WidgetData(WidgetData widgetData) : this(NDalicManualPINVOKE.new_WidgetData__SWIG_1(WidgetData.getCPtr(widgetData)), true)
84         {
85             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86         }
87
88         internal WidgetData Assign(WidgetData widgetData)
89         {
90             WidgetData ret = new WidgetData(NDalicManualPINVOKE.WidgetData_Assign(swigCPtr, WidgetData.getCPtr(widgetData)), false);
91             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
92             return ret;
93         }
94
95         /// <summary>
96         /// Get widget instance id.
97         /// </summary>
98         /// <returns>Id of widget instance.</returns>
99         /// <since_tizen> 4 </since_tizen>
100         public string GetInstanceId()
101         {
102             string ret = NDalicManualPINVOKE.WidgetData_GetInstanceId(swigCPtr);
103             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104             return ret;
105         }
106
107         internal SWIGTYPE_p_bundle GetArgs()
108         {
109             global::System.IntPtr cPtr = NDalicManualPINVOKE.WidgetData_GetArgs(swigCPtr);
110             SWIGTYPE_p_bundle ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_bundle(cPtr, false);
111             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112             return ret;
113         }
114
115         /// <summary>
116         /// Get widget instance content.
117         /// </summary>
118         /// <returns>Content of widget instance.</returns>
119         /// <since_tizen> 4 </since_tizen>
120         public string GetContent()
121         {
122             string ret = NDalicManualPINVOKE.WidgetData_GetContent(swigCPtr);
123             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124             return ret;
125         }
126
127         /// <summary>
128         /// Get widget instance Window.
129         /// </summary>
130         /// <returns>Window of widget instance</returns>
131         /// <since_tizen> 4 </since_tizen>
132         public Window GetWindow()
133         {
134             Window ret = new Window(NDalicManualPINVOKE.WidgetData_GetWindow(swigCPtr), false);
135             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136             return ret;
137         }
138
139         internal void SetArgs(SWIGTYPE_p_bundle args)
140         {
141             NDalicManualPINVOKE.WidgetData_SetArgs(swigCPtr, SWIGTYPE_p_bundle.getCPtr(args));
142             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143         }
144
145         /// <summary>
146         /// Set widget instance arguments.
147         /// </summary>
148         /// <param name="content">Content of widget instance</param>
149         /// <since_tizen> 4 </since_tizen>
150         public void SetContent(string content)
151         {
152             NDalicManualPINVOKE.WidgetData_SetContent(swigCPtr, content);
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154         }
155
156         /// <summary>
157         /// Set widget instance arguments.
158         /// </summary>
159         /// <param name="window">Window of widget instance.</param>
160         /// <since_tizen> 4 </since_tizen>
161         public void SetWindow(Window window)
162         {
163             NDalicManualPINVOKE.WidgetData_SetWindow(swigCPtr, Window.getCPtr(window));
164             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165         }
166     }
167 }