Separate C# classes into Internal and Public
[platform/core/uifw/dali-toolkit.git] / plugins / dali-sharp / sharp / 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.10
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 Dali {
28
29     using System;
30     using System.Runtime.InteropServices;
31
32
33 internal class Builder : BaseHandle {
34   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35
36   internal Builder(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Builder_SWIGUpcast(cPtr), cMemoryOwn) {
37     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
38   }
39
40   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Builder obj) {
41     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42   }
43
44   ~Builder() {
45     DisposeQueue.Instance.Add(this);
46   }
47
48   public override void Dispose() {
49     if (!Window.IsInstalled()) {
50       DisposeQueue.Instance.Add(this);
51       return;
52     }
53
54     lock(this) {
55       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
56         if (swigCMemOwn) {
57           swigCMemOwn = false;
58           NDalicPINVOKE.delete_Builder(swigCPtr);
59         }
60         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
61       }
62       global::System.GC.SuppressFinalize(this);
63       base.Dispose();
64     }
65   }
66
67
68
69     public class QuitEventArgs : EventArgs
70     {
71     }
72
73     [UnmanagedFunctionPointer(CallingConvention.StdCall)]
74     private delegate void QuitEventCallbackDelegate();
75     private DaliEventHandler<object,QuitEventArgs> _builderQuitEventHandler;
76     private QuitEventCallbackDelegate _builderQuitEventCallbackDelegate;
77
78     public event DaliEventHandler<object,QuitEventArgs> Quit
79     {
80       add
81       {
82         lock(this)
83         {
84           // Restricted to only one listener
85           if (_builderQuitEventHandler == null)
86           {
87             _builderQuitEventHandler += value;
88
89             _builderQuitEventCallbackDelegate = new QuitEventCallbackDelegate(OnQuit);
90             this.QuitSignal().Connect(_builderQuitEventCallbackDelegate);
91           }
92         }
93       }
94
95       remove
96       {
97         lock(this)
98         {
99           if (_builderQuitEventHandler != null)
100           {
101             this.QuitSignal().Disconnect(_builderQuitEventCallbackDelegate);
102           }
103
104           _builderQuitEventHandler -= value;
105         }
106       }
107     }
108
109     // Callback for Builder QuitSignal
110     private void OnQuit()
111     {
112       QuitEventArgs e = new QuitEventArgs();
113
114       if (_builderQuitEventHandler != null)
115       {
116         //here we send all data to user event handlers
117         _builderQuitEventHandler(this, e);
118       }
119     }
120
121     ///
122   public void LoadFromFile( string fileName )
123   {
124     try
125     {
126       string json = System.IO.File.ReadAllText( fileName );
127       if( json.Length > 0 )
128       {
129         LoadFromString( json );
130       }
131       else
132       {
133         throw new global::System.InvalidOperationException("Failed to load file " +fileName);
134
135       }
136     }
137     catch ( System.Exception e)
138     {
139       throw new global::System.InvalidOperationException("Failed to parse " +fileName);
140     }
141   }
142
143
144     
145   public Builder () : this (NDalicPINVOKE.Builder_New(), true) {
146       if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147
148   }
149   public void LoadFromString(string data, Builder.UIFormat format) {
150     NDalicPINVOKE.Builder_LoadFromString__SWIG_0(swigCPtr, data, (int)format);
151     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
152   }
153
154   public void LoadFromString(string data) {
155     NDalicPINVOKE.Builder_LoadFromString__SWIG_1(swigCPtr, data);
156     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157   }
158
159   public void AddConstants(Property.Map map) {
160     NDalicPINVOKE.Builder_AddConstants(swigCPtr, Property.Map.getCPtr(map));
161     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162   }
163
164   public void AddConstant(string key, Property.Value value) {
165     NDalicPINVOKE.Builder_AddConstant(swigCPtr, key, Property.Value.getCPtr(value));
166     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167   }
168
169   public Property.Map GetConstants() {
170     Property.Map ret = new Property.Map(NDalicPINVOKE.Builder_GetConstants(swigCPtr), false);
171     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172     return ret;
173   }
174
175   public Property.Value GetConstant(string key) {
176     Property.Value ret = new Property.Value(NDalicPINVOKE.Builder_GetConstant(swigCPtr, key), false);
177     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178     return ret;
179   }
180
181   public Animation CreateAnimation(string animationName) {
182     Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_0(swigCPtr, animationName), true);
183     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184     return ret;
185   }
186
187   public Animation CreateAnimation(string animationName, Property.Map map) {
188     Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_1(swigCPtr, animationName, Property.Map.getCPtr(map)), true);
189     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190     return ret;
191   }
192
193   public Animation CreateAnimation(string animationName, View sourceActor) {
194     Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_2(swigCPtr, animationName, View.getCPtr(sourceActor)), true);
195     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196     return ret;
197   }
198
199   public Animation CreateAnimation(string animationName, Property.Map map, View sourceActor) {
200     Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_3(swigCPtr, animationName, Property.Map.getCPtr(map), View.getCPtr(sourceActor)), true);
201     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202     return ret;
203   }
204
205   public BaseHandle Create(string templateName) {
206     BaseHandle ret = new BaseHandle(NDalicPINVOKE.Builder_Create__SWIG_0(swigCPtr, templateName), true);
207     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208     return ret;
209   }
210
211   public BaseHandle Create(string templateName, Property.Map map) {
212     BaseHandle ret = new BaseHandle(NDalicPINVOKE.Builder_Create__SWIG_1(swigCPtr, templateName, Property.Map.getCPtr(map)), true);
213     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214     return ret;
215   }
216
217   public BaseHandle CreateFromJson(string json) {
218     BaseHandle ret = new BaseHandle(NDalicPINVOKE.Builder_CreateFromJson(swigCPtr, json), true);
219     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
220     return ret;
221   }
222
223   public bool ApplyStyle(string styleName, Animatable handle) {
224     bool ret = NDalicPINVOKE.Builder_ApplyStyle(swigCPtr, styleName, Animatable.getCPtr(handle));
225     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
226     return ret;
227   }
228
229   public bool ApplyFromJson(Animatable handle, string json) {
230     bool ret = NDalicPINVOKE.Builder_ApplyFromJson(swigCPtr, Animatable.getCPtr(handle), json);
231     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
232     return ret;
233   }
234
235   public void AddViews(View toView) {
236     NDalicPINVOKE.Builder_AddActors__SWIG_0(swigCPtr, View.getCPtr(toView));
237     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238   }
239
240   public void AddViews(string sectionName, View toView) {
241     NDalicPINVOKE.Builder_AddActors__SWIG_1(swigCPtr, sectionName, View.getCPtr(toView));
242     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243   }
244
245   public void CreateRenderTask(string name) {
246     NDalicPINVOKE.Builder_CreateRenderTask(swigCPtr, name);
247     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248   }
249
250   public FrameBufferImage GetFrameBufferImage(string name) {
251     FrameBufferImage ret = new FrameBufferImage(NDalicPINVOKE.Builder_GetFrameBufferImage(swigCPtr, name), true);
252     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253     return ret;
254   }
255
256   public Path GetPath(string name) {
257     Path ret = new Path(NDalicPINVOKE.Builder_GetPath(swigCPtr, name), true);
258     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259     return ret;
260   }
261
262   public PathConstrainer GetPathConstrainer(string pathConstrainerName) {
263     PathConstrainer ret = new PathConstrainer(NDalicPINVOKE.Builder_GetPathConstrainer(swigCPtr, pathConstrainerName), true);
264     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
265     return ret;
266   }
267
268   public LinearConstrainer GetLinearConstrainer(string linearConstrainerName) {
269     LinearConstrainer ret = new LinearConstrainer(NDalicPINVOKE.Builder_GetLinearConstrainer(swigCPtr, linearConstrainerName), true);
270     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271     return ret;
272   }
273
274   public VoidSignal QuitSignal() {
275     VoidSignal ret = new VoidSignal(NDalicPINVOKE.Builder_QuitSignal(swigCPtr), false);
276     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
277     return ret;
278   }
279
280   public enum UIFormat {
281     JSON
282   }
283
284 }
285
286 }