2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 using System.Runtime.InteropServices;
23 using Tizen.NUI.BaseComponents;
26 internal class Builder : BaseHandle
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30 internal Builder(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Builder.Builder_SWIGUpcast(cPtr), cMemoryOwn)
32 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
35 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Builder obj)
37 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
40 protected override void Dispose(DisposeTypes type)
47 if (type == DisposeTypes.Explicit)
50 //Release your own managed resources here.
51 //You should release all of your own disposable objects here.
55 //Release your own unmanaged resources here.
56 //You should not access any managed member here except static instance.
57 //because the execution order of Finalizes is non-deterministic.
60 if (swigCPtr.Handle != global::System.IntPtr.Zero)
65 Interop.Builder.delete_Builder(swigCPtr);
67 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
75 /// <since_tizen> 3 </since_tizen>
76 public class QuitEventArgs : EventArgs
80 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
81 private delegate void QuitEventCallbackDelegate();
82 private DaliEventHandler<object, QuitEventArgs> _builderQuitEventHandler;
83 private QuitEventCallbackDelegate _builderQuitEventCallbackDelegate;
85 public event DaliEventHandler<object, QuitEventArgs> Quit
91 // Restricted to only one listener
92 if (_builderQuitEventHandler == null)
94 _builderQuitEventHandler += value;
96 _builderQuitEventCallbackDelegate = new QuitEventCallbackDelegate(OnQuit);
97 this.QuitSignal().Connect(_builderQuitEventCallbackDelegate);
106 if (_builderQuitEventHandler != null)
108 this.QuitSignal().Disconnect(_builderQuitEventCallbackDelegate);
111 _builderQuitEventHandler -= value;
116 // Callback for Builder QuitSignal
117 private void OnQuit()
119 QuitEventArgs e = new QuitEventArgs();
121 if (_builderQuitEventHandler != null)
123 //here we send all data to user event handlers
124 _builderQuitEventHandler(this, e);
129 public void LoadFromFile(string fileName)
133 string json = System.IO.File.ReadAllText(fileName);
136 LoadFromString(json);
140 throw new global::System.InvalidOperationException("Failed to load file " + fileName);
144 catch (System.Exception e)
146 NUILog.Error(e.Message);
147 throw new global::System.InvalidOperationException("Failed to parse " + fileName);
153 public Builder() : this(Interop.Builder.Builder_New(), true)
155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158 public void LoadFromString(string data, Builder.UIFormat format)
160 Interop.Builder.Builder_LoadFromString__SWIG_0(swigCPtr, data, (int)format);
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164 public void LoadFromString(string data)
166 Interop.Builder.Builder_LoadFromString__SWIG_1(swigCPtr, data);
167 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 public void AddConstants(PropertyMap map)
172 Interop.Builder.Builder_AddConstants(swigCPtr, PropertyMap.getCPtr(map));
173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176 public void AddConstant(string key, PropertyValue value)
178 Interop.Builder.Builder_AddConstant(swigCPtr, key, PropertyValue.getCPtr(value));
179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 public PropertyMap GetConstants()
184 PropertyMap ret = new PropertyMap(Interop.Builder.Builder_GetConstants(swigCPtr), false);
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 public PropertyValue GetConstant(string key)
191 PropertyValue ret = new PropertyValue(Interop.Builder.Builder_GetConstant(swigCPtr, key), false);
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 public Animation CreateAnimation(string animationName)
198 Animation ret = new Animation(Interop.Builder.Builder_CreateAnimation__SWIG_0(swigCPtr, animationName), true);
199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203 public Animation CreateAnimation(string animationName, PropertyMap map)
205 Animation ret = new Animation(Interop.Builder.Builder_CreateAnimation__SWIG_1(swigCPtr, animationName, PropertyMap.getCPtr(map)), true);
206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210 public Animation CreateAnimation(string animationName, View sourceActor)
212 Animation ret = new Animation(Interop.Builder.Builder_CreateAnimation__SWIG_2(swigCPtr, animationName, View.getCPtr(sourceActor)), true);
213 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217 public Animation CreateAnimation(string animationName, PropertyMap map, View sourceActor)
219 Animation ret = new Animation(Interop.Builder.Builder_CreateAnimation__SWIG_3(swigCPtr, animationName, PropertyMap.getCPtr(map), View.getCPtr(sourceActor)), true);
220 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224 public View Create(string templateName)
226 View ret = new View(Interop.Builder.Builder_Create__SWIG_0(swigCPtr, templateName), true);
227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
231 public BaseHandle Create(string templateName, PropertyMap map)
233 BaseHandle ret = new BaseHandle(Interop.Builder.Builder_Create__SWIG_1(swigCPtr, templateName, PropertyMap.getCPtr(map)), true);
234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238 public BaseHandle CreateFromJson(string json)
240 BaseHandle ret = new BaseHandle(Interop.Builder.Builder_CreateFromJson(swigCPtr, json), true);
241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
245 public bool ApplyStyle(string styleName, Animatable handle)
247 bool ret = Interop.Builder.Builder_ApplyStyle(swigCPtr, styleName, Animatable.getCPtr(handle));
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
252 public bool ApplyFromJson(Animatable handle, string json)
254 bool ret = Interop.Builder.Builder_ApplyFromJson(swigCPtr, Animatable.getCPtr(handle), json);
255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259 public void AddViews(View toActor)
261 Interop.Builder.Builder_AddActors__SWIG_0(swigCPtr, View.getCPtr(toActor));
262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265 public void AddViews(string sectionName, View toActor)
267 Interop.Builder.Builder_AddActors__SWIG_1(swigCPtr, sectionName, View.getCPtr(toActor));
268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271 public void CreateRenderTask(string name)
273 Interop.Builder.Builder_CreateRenderTask(swigCPtr, name);
274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277 public Path GetPath(string name)
279 Path ret = new Path(Interop.Builder.Builder_GetPath(swigCPtr, name), true);
280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284 internal PathConstrainer GetPathConstrainer(string pathConstrainerName)
286 PathConstrainer ret = new PathConstrainer(Interop.Builder.Builder_GetPathConstrainer(swigCPtr, pathConstrainerName), true);
287 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
291 internal LinearConstrainer GetLinearConstrainer(string linearConstrainerName)
293 LinearConstrainer ret = new LinearConstrainer(Interop.Builder.Builder_GetLinearConstrainer(swigCPtr, linearConstrainerName), true);
294 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 internal VoidSignal QuitSignal()
300 VoidSignal ret = new VoidSignal(Interop.Builder.Builder_QuitSignal(swigCPtr), false);
301 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305 /// <since_tizen> 3 </since_tizen>