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