6e5a521049fa6b3ac931fa5fcdb72dcaac999249
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Builder.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 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI
28 {
29
30     using System;
31     using System.Runtime.InteropServices;
32     using Tizen.NUI.BaseComponents;
33
34
35     public class Builder : BaseHandle
36     {
37         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
38
39         internal Builder(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Builder_SWIGUpcast(cPtr), cMemoryOwn)
40         {
41             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
42         }
43
44         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Builder obj)
45         {
46             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
47         }
48
49         protected override void Dispose(DisposeTypes type)
50         {
51             if (disposed)
52             {
53                 return;
54             }
55
56             if (type == DisposeTypes.Explicit)
57             {
58                 //Called by User
59                 //Release your own managed resources here.
60                 //You should release all of your own disposable objects here.
61
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
69             if (swigCPtr.Handle != global::System.IntPtr.Zero)
70             {
71                 if (swigCMemOwn)
72                 {
73                     swigCMemOwn = false;
74                     NDalicPINVOKE.delete_Builder(swigCPtr);
75                 }
76                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
77             }
78
79             base.Dispose(type);
80         }
81
82
83
84         public class QuitEventArgs : EventArgs
85         {
86         }
87
88         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
89         private delegate void QuitEventCallbackDelegate();
90         private DaliEventHandler<object, QuitEventArgs> _builderQuitEventHandler;
91         private QuitEventCallbackDelegate _builderQuitEventCallbackDelegate;
92
93         public event DaliEventHandler<object, QuitEventArgs> Quit
94         {
95             add
96             {
97                 lock (this)
98                 {
99                     // Restricted to only one listener
100                     if (_builderQuitEventHandler == null)
101                     {
102                         _builderQuitEventHandler += value;
103
104                         _builderQuitEventCallbackDelegate = new QuitEventCallbackDelegate(OnQuit);
105                         this.QuitSignal().Connect(_builderQuitEventCallbackDelegate);
106                     }
107                 }
108             }
109
110             remove
111             {
112                 lock (this)
113                 {
114                     if (_builderQuitEventHandler != null)
115                     {
116                         this.QuitSignal().Disconnect(_builderQuitEventCallbackDelegate);
117                     }
118
119                     _builderQuitEventHandler -= value;
120                 }
121             }
122         }
123
124         // Callback for Builder QuitSignal
125         private void OnQuit()
126         {
127             QuitEventArgs e = new QuitEventArgs();
128
129             if (_builderQuitEventHandler != null)
130             {
131                 //here we send all data to user event handlers
132                 _builderQuitEventHandler(this, e);
133             }
134         }
135
136         ///
137         public void LoadFromFile(string fileName)
138         {
139             try
140             {
141                 string json = System.IO.File.ReadAllText(fileName);
142                 if (json.Length > 0)
143                 {
144                     LoadFromString(json);
145                 }
146                 else
147                 {
148                     throw new global::System.InvalidOperationException("Failed to load file " + fileName);
149
150                 }
151             }
152             catch (System.Exception e)
153             {
154                 throw new global::System.InvalidOperationException("Failed to parse " + fileName);
155             }
156         }
157
158
159
160         public Builder() : this(NDalicPINVOKE.Builder_New(), true)
161         {
162             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163
164         }
165         public void LoadFromString(string data, Builder.UIFormat format)
166         {
167             NDalicPINVOKE.Builder_LoadFromString__SWIG_0(swigCPtr, data, (int)format);
168             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169         }
170
171         public void LoadFromString(string data)
172         {
173             NDalicPINVOKE.Builder_LoadFromString__SWIG_1(swigCPtr, data);
174             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
175         }
176
177         public void AddConstants(PropertyMap map)
178         {
179             NDalicPINVOKE.Builder_AddConstants(swigCPtr, PropertyMap.getCPtr(map));
180             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181         }
182
183         public void AddConstant(string key, PropertyValue value)
184         {
185             NDalicPINVOKE.Builder_AddConstant(swigCPtr, key, PropertyValue.getCPtr(value));
186             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187         }
188
189         public PropertyMap GetConstants()
190         {
191             PropertyMap ret = new PropertyMap(NDalicPINVOKE.Builder_GetConstants(swigCPtr), false);
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193             return ret;
194         }
195
196         public PropertyValue GetConstant(string key)
197         {
198             PropertyValue ret = new PropertyValue(NDalicPINVOKE.Builder_GetConstant(swigCPtr, key), false);
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200             return ret;
201         }
202
203         public Animation CreateAnimation(string animationName)
204         {
205             Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_0(swigCPtr, animationName), true);
206             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207             return ret;
208         }
209
210         public Animation CreateAnimation(string animationName, PropertyMap map)
211         {
212             Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_1(swigCPtr, animationName, PropertyMap.getCPtr(map)), true);
213             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214             return ret;
215         }
216
217         public Animation CreateAnimation(string animationName, View sourceActor)
218         {
219             Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_2(swigCPtr, animationName, View.getCPtr(sourceActor)), true);
220             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221             return ret;
222         }
223
224         public Animation CreateAnimation(string animationName, PropertyMap map, View sourceActor)
225         {
226             Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_3(swigCPtr, animationName, PropertyMap.getCPtr(map), View.getCPtr(sourceActor)), true);
227             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228             return ret;
229         }
230
231         public BaseHandle Create(string templateName)
232         {
233             BaseHandle ret = new BaseHandle(NDalicPINVOKE.Builder_Create__SWIG_0(swigCPtr, templateName), true);
234             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235             return ret;
236         }
237
238         public BaseHandle Create(string templateName, PropertyMap map)
239         {
240             BaseHandle ret = new BaseHandle(NDalicPINVOKE.Builder_Create__SWIG_1(swigCPtr, templateName, PropertyMap.getCPtr(map)), true);
241             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
242             return ret;
243         }
244
245         public BaseHandle CreateFromJson(string json)
246         {
247             BaseHandle ret = new BaseHandle(NDalicPINVOKE.Builder_CreateFromJson(swigCPtr, json), true);
248             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
249             return ret;
250         }
251
252         public bool ApplyStyle(string styleName, Animatable handle)
253         {
254             bool ret = NDalicPINVOKE.Builder_ApplyStyle(swigCPtr, styleName, Animatable.getCPtr(handle));
255             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
256             return ret;
257         }
258
259         public bool ApplyFromJson(Animatable handle, string json)
260         {
261             bool ret = NDalicPINVOKE.Builder_ApplyFromJson(swigCPtr, Animatable.getCPtr(handle), json);
262             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
263             return ret;
264         }
265
266         public void AddViews(View toActor)
267         {
268             NDalicPINVOKE.Builder_AddActors__SWIG_0(swigCPtr, View.getCPtr(toActor));
269             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
270         }
271
272         public void AddViews(string sectionName, View toActor)
273         {
274             NDalicPINVOKE.Builder_AddActors__SWIG_1(swigCPtr, sectionName, View.getCPtr(toActor));
275             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
276         }
277
278         public void CreateRenderTask(string name)
279         {
280             NDalicPINVOKE.Builder_CreateRenderTask(swigCPtr, name);
281             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282         }
283
284         internal FrameBufferImage GetFrameBufferImage(string name)
285         {
286             FrameBufferImage ret = new FrameBufferImage(NDalicPINVOKE.Builder_GetFrameBufferImage(swigCPtr, name), true);
287             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288             return ret;
289         }
290
291         public Path GetPath(string name)
292         {
293             Path ret = new Path(NDalicPINVOKE.Builder_GetPath(swigCPtr, name), true);
294             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
295             return ret;
296         }
297
298         internal PathConstrainer GetPathConstrainer(string pathConstrainerName)
299         {
300             PathConstrainer ret = new PathConstrainer(NDalicPINVOKE.Builder_GetPathConstrainer(swigCPtr, pathConstrainerName), true);
301             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
302             return ret;
303         }
304
305         internal LinearConstrainer GetLinearConstrainer(string linearConstrainerName)
306         {
307             LinearConstrainer ret = new LinearConstrainer(NDalicPINVOKE.Builder_GetLinearConstrainer(swigCPtr, linearConstrainerName), true);
308             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
309             return ret;
310         }
311
312         internal VoidSignal QuitSignal()
313         {
314             VoidSignal ret = new VoidSignal(NDalicPINVOKE.Builder_QuitSignal(swigCPtr), false);
315             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
316             return ret;
317         }
318
319         public enum UIFormat
320         {
321             JSON
322         }
323
324     }
325
326 }