nui 0.2.32 manual merge, mapping to dali 1.2.32
[platform/core/csapi/tizenfx.git] / NUISamples / Tizen.NUI / src / public / VideoView.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
33     /// <summary>
34     /// VideoView is a control for video playback and display.
35     /// </summary>
36     public class VideoView : View
37     {
38         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
39
40         internal VideoView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.VideoView_SWIGUpcast(cPtr), cMemoryOwn)
41         {
42             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
43         }
44
45         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VideoView obj)
46         {
47             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
48         }
49
50         ~VideoView()
51         {
52             DisposeQueue.Instance.Add(this);
53         }
54
55         public override void Dispose()
56         {
57             if (!Stage.IsInstalled())
58             {
59                 DisposeQueue.Instance.Add(this);
60                 return;
61             }
62
63             lock (this)
64             {
65                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
66                 {
67                     if (swigCMemOwn)
68                     {
69                         swigCMemOwn = false;
70                         NDalicPINVOKE.delete_VideoView(swigCPtr);
71                     }
72                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
73                 }
74                 global::System.GC.SuppressFinalize(this);
75                 base.Dispose();
76             }
77         }
78
79         /// <summary>
80         /// Event arguments that passed via Finished signal
81         /// </summary>
82         public class FinishedEventArgs : EventArgs
83         {
84             private VideoView _videoView;
85
86             /// <summary>
87             /// The view for video playback and display.
88             /// </summary>
89             public VideoView VideoView
90             {
91                 get
92                 {
93                     return _videoView;
94                 }
95                 set
96                 {
97                     _videoView = value;
98                 }
99             }
100         }
101
102
103         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
104         private delegate void FinishedCallbackDelegate(IntPtr data);
105         private EventHandler<FinishedEventArgs> _videoViewFinishedEventHandler;
106         private FinishedCallbackDelegate _videoViewFinishedCallbackDelegate;
107
108
109         /// <summary>
110         /// Event for Finished signal which can be used to subscribe/unsubscribe the event handler
111         /// (in the type of FinishedEventHandler-DaliEventHandler<object,FinishedEventArgs>) provided by the user.
112         /// Finished signal is emitted when a video playback have finished.
113         /// </summary>
114         public event EventHandler<FinishedEventArgs> Finished
115         {
116             add
117             {
118                 if (_videoViewFinishedEventHandler == null)
119                 {
120                     _videoViewFinishedCallbackDelegate = (OnFinished);
121                     FinishedSignal().Connect(_videoViewFinishedCallbackDelegate);
122                 }
123                 _videoViewFinishedEventHandler += value;
124             }
125             remove
126             {
127                 _videoViewFinishedEventHandler -= value;
128                 if (_videoViewFinishedEventHandler == null && _videoViewFinishedCallbackDelegate != null)
129                 {
130                     FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate);
131                 }
132             }
133         }
134
135         // Callback for VideoView Finished signal
136         private void OnFinished(IntPtr data)
137         {
138             FinishedEventArgs e = new FinishedEventArgs();
139
140             // Populate all members of "e" (FinishedEventArgs) with real data
141             e.VideoView = VideoView.GetVideoViewFromPtr(data);
142
143             if (_videoViewFinishedEventHandler != null)
144             {
145                 //here we send all data to user event handlers
146                 _videoViewFinishedEventHandler(this, e);
147             }
148         }
149
150         internal static VideoView GetVideoViewFromPtr(global::System.IntPtr cPtr)
151         {
152             VideoView ret = new VideoView(cPtr, false);
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154             return ret;
155         }
156
157
158         internal class Property : global::System.IDisposable
159         {
160             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
161             protected bool swigCMemOwn;
162
163             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
164             {
165                 swigCMemOwn = cMemoryOwn;
166                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
167             }
168
169             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
170             {
171                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
172             }
173
174             ~Property()
175             {
176                 Dispose();
177             }
178
179             public virtual void Dispose()
180             {
181                 lock (this)
182                 {
183                     if (swigCPtr.Handle != global::System.IntPtr.Zero)
184                     {
185                         if (swigCMemOwn)
186                         {
187                             swigCMemOwn = false;
188                             NDalicPINVOKE.delete_VideoView_Property(swigCPtr);
189                         }
190                         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
191                     }
192                     global::System.GC.SuppressFinalize(this);
193                 }
194             }
195
196             internal Property() : this(NDalicPINVOKE.new_VideoView_Property(), true)
197             {
198                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
199             }
200
201             internal static readonly int VIDEO = NDalicPINVOKE.VideoView_Property_VIDEO_get();
202             internal static readonly int LOOPING = NDalicPINVOKE.VideoView_Property_LOOPING_get();
203             internal static readonly int MUTED = NDalicPINVOKE.VideoView_Property_MUTED_get();
204             internal static readonly int VOLUME = NDalicPINVOKE.VideoView_Property_VOLUME_get();
205
206         }
207
208         /// <summary>
209         /// Creates an initialized VideoView.
210         /// </summary>
211         public VideoView() : this(NDalicPINVOKE.VideoView_New__SWIG_0(), true)
212         {
213             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214
215         }
216
217         /// <summary>
218         /// Creates an initialized VideoView.
219         /// If the string is empty, VideoView will not display anything.
220         /// </summary>
221         /// <param name="url">The url of the video resource to display</param>
222         public VideoView(string url) : this(NDalicPINVOKE.VideoView_New__SWIG_1(url), true)
223         {
224             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225
226         }
227         internal VideoView(VideoView videoView) : this(NDalicPINVOKE.new_VideoView__SWIG_1(VideoView.getCPtr(videoView)), true)
228         {
229             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230         }
231
232         internal VideoView Assign(VideoView videoView)
233         {
234             VideoView ret = new VideoView(NDalicPINVOKE.VideoView_Assign(swigCPtr, VideoView.getCPtr(videoView)), false);
235             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
236             return ret;
237         }
238
239         /// <summary>
240         /// Downcasts a handle to VideoView handle.
241         /// If handle points to a VideoView, the downcast produces valid handle.
242         /// If not, the returned handle is left uninitialized.
243         /// </summary>
244         /// <param name="handle">Handle to an object</param>
245         /// <returns>Handle to a VideoView or an uninitialized handle</returns>
246         public new static VideoView DownCast(BaseHandle handle)
247         {
248             VideoView ret = new VideoView(NDalicPINVOKE.VideoView_DownCast(BaseHandle.getCPtr(handle)), true);
249             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
250             return ret;
251         }
252
253         /// <summary>
254         /// Starts the video playback.
255         /// </summary>
256         public void Play()
257         {
258             NDalicPINVOKE.VideoView_Play(swigCPtr);
259             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
260         }
261
262         /// <summary>
263         /// Pauses the video playback.
264         /// </summary>
265         public void Pause()
266         {
267             NDalicPINVOKE.VideoView_Pause(swigCPtr);
268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269         }
270
271         /// <summary>
272         /// Stops the video playback.
273         /// </summary>
274         public void Stop()
275         {
276             NDalicPINVOKE.VideoView_Stop(swigCPtr);
277             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
278         }
279
280         /// <summary>
281         /// Seeks forward by the specified number of milliseconds.
282         /// </summary>
283         /// <param name="millisecond">The position for forward playback</param>
284         public void Forward(int millisecond)
285         {
286             NDalicPINVOKE.VideoView_Forward(swigCPtr, millisecond);
287             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288         }
289
290         /// <summary>
291         /// Seeks backward by the specified number of milliseconds.
292         /// </summary>
293         /// <param name="millisecond">The position for backward playback</param>
294         public void Backward(int millisecond)
295         {
296             NDalicPINVOKE.VideoView_Backward(swigCPtr, millisecond);
297             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298         }
299
300         internal VideoViewSignal FinishedSignal()
301         {
302             VideoViewSignal ret = new VideoViewSignal(NDalicPINVOKE.VideoView_FinishedSignal(swigCPtr), false);
303             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
304             return ret;
305         }
306
307         internal enum PropertyRange
308         {
309             PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX
310         }
311
312         /// <summary>
313         /// video file url as string type or PropertyMap.
314         /// </summary>
315         public PropertyMap Video
316         {
317             get
318             {
319                 PropertyMap temp = new PropertyMap();
320                 GetProperty(VideoView.Property.VIDEO).Get(temp);
321                 return temp;
322             }
323             set
324             {
325                 SetProperty(VideoView.Property.VIDEO, new Tizen.NUI.PropertyValue(value));
326             }
327         }
328
329         /// <summary>
330         /// looping status, true or false.
331         /// </summary>
332         public bool Looping
333         {
334             get
335             {
336                 bool temp = false;
337                 GetProperty(VideoView.Property.LOOPING).Get(ref temp);
338                 return temp;
339             }
340             set
341             {
342                 SetProperty(VideoView.Property.LOOPING, new Tizen.NUI.PropertyValue(value));
343             }
344         }
345
346         /// <summary>
347         /// mute status, true or false.
348         /// </summary>
349         public bool Muted
350         {
351             get
352             {
353                 bool temp = false;
354                 GetProperty(VideoView.Property.MUTED).Get(ref temp);
355                 return temp;
356             }
357             set
358             {
359                 SetProperty(VideoView.Property.MUTED, new Tizen.NUI.PropertyValue(value));
360             }
361         }
362
363         /// <summary>
364         /// left and right volume scalar as float type, PropertyMap with two values ( "left" and "right" ).
365         /// </summary>
366         public PropertyMap Volume
367         {
368             get
369             {
370                 PropertyMap temp = new PropertyMap();
371                 GetProperty(VideoView.Property.VOLUME).Get(temp);
372                 return temp;
373             }
374             set
375             {
376                 SetProperty(VideoView.Property.VOLUME, new PropertyValue(value));
377             }
378         }
379
380     }
381
382 }