Merge "Fix some bugs: (1)Change the return type of Window.IsVisible() form void to...
[platform/core/csapi/nui.git] / Tizen.NUI / src / public / ProgressBar.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
34     /// <summary>
35     /// ProgressBar is a control to give the user an indication of the progress of an operation.
36     /// </summary>
37     public class ProgressBar : View
38     {
39         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
40
41         internal ProgressBar(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ProgressBar_SWIGUpcast(cPtr), cMemoryOwn)
42         {
43             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
44         }
45
46         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ProgressBar obj)
47         {
48             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
49         }
50
51         ~ProgressBar()
52         {
53             DisposeQueue.Instance.Add(this);
54         }
55
56         /// <summary>
57         /// To make ProgressBar instance be disposed.
58         /// </summary>
59         public override void Dispose()
60         {
61             if (!Stage.IsInstalled())
62             {
63                 DisposeQueue.Instance.Add(this);
64                 return;
65             }
66
67             lock (this)
68             {
69                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
70                 {
71                     if (swigCMemOwn)
72                     {
73                         swigCMemOwn = false;
74                         NDalicPINVOKE.delete_ProgressBar(swigCPtr);
75                     }
76                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
77                 }
78                 global::System.GC.SuppressFinalize(this);
79                 base.Dispose();
80             }
81         }
82
83
84
85         /// <summary>
86         /// Event arguments that passed via ValueChangedEventArgs
87         /// </summary>
88         public class ValueChangedEventArgs : EventArgs
89         {
90             private ProgressBar _progressBar;
91             private float _progressValue;
92             private float _secondaryProgressValue;
93
94             public ProgressBar ProgressBar
95             {
96                 get
97                 {
98                     return _progressBar;
99                 }
100                 set
101                 {
102                     _progressBar = value;
103                 }
104             }
105
106             public float ProgressValue
107             {
108                 get
109                 {
110                     return _progressValue;
111                 }
112                 set
113                 {
114                     _progressValue = value;
115                 }
116             }
117
118             public float SecondaryProgressValue
119             {
120                 get
121                 {
122                     return _secondaryProgressValue;
123                 }
124                 set
125                 {
126                     _secondaryProgressValue = value;
127                 }
128             }
129
130         }
131
132         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
133         private delegate void ValueChangedCallbackDelegate(IntPtr progressBar, float progressValue, float secondaryProgressValue);
134         private EventHandler<ValueChangedEventArgs> _progressBarValueChangedEventHandler;
135         private ValueChangedCallbackDelegate _progressBarValueChangedCallbackDelegate;
136
137         /// <summary>
138         /// Event is sent when the ProgressBar value changes.
139         /// </summary>
140         public event EventHandler<ValueChangedEventArgs> ValueChanged
141         {
142             add
143             {
144                 if (_progressBarValueChangedEventHandler == null)
145                 {
146                     _progressBarValueChangedCallbackDelegate = (OnValueChanged);
147                     ValueChangedSignal().Connect(_progressBarValueChangedCallbackDelegate);
148                 }
149                 _progressBarValueChangedEventHandler += value;
150             }
151             remove
152             {
153                 _progressBarValueChangedEventHandler -= value;
154                 if (_progressBarValueChangedEventHandler == null && ValueChangedSignal().Empty() == false)
155                 {
156                     ValueChangedSignal().Disconnect(_progressBarValueChangedCallbackDelegate);
157                 }
158             }
159         }
160
161         // Callback for ProgressBar ValueChanged signal
162         private void OnValueChanged(IntPtr progressBar, float progressValue, float secondaryProgressValue)
163         {
164             ValueChangedEventArgs e = new ValueChangedEventArgs();
165
166             // Populate all members of "e" (ValueChangedEventArgs) with real page
167             e.ProgressBar = ProgressBar.GetProgressBarFromPtr(progressBar);
168             e.ProgressValue = progressValue;
169             e.SecondaryProgressValue = secondaryProgressValue;
170
171             if (_progressBarValueChangedEventHandler != null)
172             {
173                 _progressBarValueChangedEventHandler(this, e);
174             }
175         }
176
177         /// <summary>
178         /// </summary>
179         internal static ProgressBar GetProgressBarFromPtr(global::System.IntPtr cPtr)
180         {
181             ProgressBar ret = new ProgressBar(cPtr, false);
182             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183             return ret;
184         }
185
186
187         internal class Property : global::System.IDisposable
188         {
189             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
190             protected bool swigCMemOwn;
191
192             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
193             {
194                 swigCMemOwn = cMemoryOwn;
195                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
196             }
197
198             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
199             {
200                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
201             }
202
203             ~Property()
204             {
205                 Dispose();
206             }
207
208             public virtual void Dispose()
209             {
210                 lock (this)
211                 {
212                     if (swigCPtr.Handle != global::System.IntPtr.Zero)
213                     {
214                         if (swigCMemOwn)
215                         {
216                             swigCMemOwn = false;
217                             NDalicPINVOKE.delete_ProgressBar_Property(swigCPtr);
218                         }
219                         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
220                     }
221                     global::System.GC.SuppressFinalize(this);
222                 }
223             }
224
225             internal Property() : this(NDalicPINVOKE.new_ProgressBar_Property(), true)
226             {
227                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228             }
229
230             internal static readonly int PROGRESS_VALUE = NDalicPINVOKE.ProgressBar_Property_PROGRESS_VALUE_get();
231             internal static readonly int SECONDARY_PROGRESS_VALUE = NDalicPINVOKE.ProgressBar_Property_SECONDARY_PROGRESS_VALUE_get();
232             internal static readonly int INDETERMINATE = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_get();
233             internal static readonly int TRACK_VISUAL = NDalicPINVOKE.ProgressBar_Property_TRACK_VISUAL_get();
234             internal static readonly int PROGRESS_VISUAL = NDalicPINVOKE.ProgressBar_Property_PROGRESS_VISUAL_get();
235             internal static readonly int SECONDARY_PROGRESS_VISUAL = NDalicPINVOKE.ProgressBar_Property_SECONDARY_PROGRESS_VISUAL_get();
236             internal static readonly int INDETERMINATE_VISUAL = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_VISUAL_get();
237             internal static readonly int INDETERMINATE_VISUAL_ANIMATION = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_VISUAL_ANIMATION_get();
238             internal static readonly int LABEL_VISUAL = NDalicPINVOKE.ProgressBar_Property_LABEL_VISUAL_get();
239
240         }
241
242         /// <summary>
243         /// Creates the ProgressBar.
244         /// </summary>
245         public ProgressBar() : this(NDalicPINVOKE.ProgressBar_New(), true)
246         {
247             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
248
249         }
250         internal ProgressBar(ProgressBar handle) : this(NDalicPINVOKE.new_ProgressBar__SWIG_1(ProgressBar.getCPtr(handle)), true)
251         {
252             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253         }
254
255         internal ProgressBar Assign(ProgressBar handle)
256         {
257             ProgressBar ret = new ProgressBar(NDalicPINVOKE.ProgressBar_Assign(swigCPtr, ProgressBar.getCPtr(handle)), false);
258             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259             return ret;
260         }
261
262         /// <summary>
263         /// Downcasts a handle to ProgressBar handle.<br>
264         /// If handle points to a ProgressBar, the downcast produces valid handle.<br>
265         /// If not the returned handle is left uninitialized.<br>
266         /// </summary>
267         /// <param name="handle">Handle to an object</param>
268         /// <returns>handle to a ProgressBar or an uninitialized handle</returns>
269         public new static ProgressBar DownCast(BaseHandle handle)
270         {
271             ProgressBar ret = new ProgressBar(NDalicPINVOKE.ProgressBar_DownCast(BaseHandle.getCPtr(handle)), true);
272             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273             return ret;
274         }
275
276         internal ProgressBarValueChangedSignal ValueChangedSignal()
277         {
278             ProgressBarValueChangedSignal ret = new ProgressBarValueChangedSignal(NDalicPINVOKE.ProgressBar_ValueChangedSignal(swigCPtr), false);
279             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
280             return ret;
281         }
282
283         internal enum PropertyRange
284         {
285             PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
286             PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000
287         }
288
289         /// <summary>
290         /// The progress value of progress bar, progress runs form 0 to 1.<br>
291         /// If Value is set to 0, progress bar will be set to beginning.<br>
292         /// If Value is set to 1, progress bar will be set to end.<br>
293         /// Any Value outside of the range is ignored.<br>
294         /// </summary>
295         public float ProgressValue
296         {
297             get
298             {
299                 float temp = 0.0f;
300                 GetProperty(ProgressBar.Property.PROGRESS_VALUE).Get(ref temp);
301                 return temp;
302             }
303             set
304             {
305                 SetProperty(ProgressBar.Property.PROGRESS_VALUE, new Tizen.NUI.PropertyValue(value));
306             }
307         }
308         /// <summary>
309         /// The secondary progress value of progress bar, secondary progress runs form 0 to 1.<br>
310         /// Optional. If not supplied, the default is 0.<br>
311         /// If Value is set to 0, progress bar will be set secondary progress to beginning.<br>
312         /// If Value is set to 1, progress bar will be set secondary progress to end.<br>
313         /// Any Value outside of the range is ignored.<br>
314         /// </summary>
315         public float SecondaryProgressValue
316         {
317             get
318             {
319                 float temp = 0.0f;
320                 GetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VALUE).Get(ref temp);
321                 return temp;
322             }
323             set
324             {
325                 SetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VALUE, new Tizen.NUI.PropertyValue(value));
326             }
327         }
328         /// <summary>
329         /// Sets the progress-bar as \e indeterminate state.
330         /// </summary>
331         public bool Indeterminate
332         {
333             get
334             {
335                 bool temp = false;
336                 GetProperty(ProgressBar.Property.INDETERMINATE).Get(ref temp);
337                 return temp;
338             }
339             set
340             {
341                 SetProperty(ProgressBar.Property.INDETERMINATE, new Tizen.NUI.PropertyValue(value));
342             }
343         }
344         /// <summary>
345         /// The track Visual value of progress bar, it's a full progress area and it's shown behind PROGRESS_VISUAL.<br>
346         /// Optional. If not supplied, the default track visual will be shown.<br>
347         /// </summary>
348         public Tizen.NUI.PropertyMap TrackVisual
349         {
350             get
351             {
352                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
353                 GetProperty(ProgressBar.Property.TRACK_VISUAL).Get(temp);
354                 return temp;
355             }
356             set
357             {
358                 SetProperty(ProgressBar.Property.TRACK_VISUAL, new Tizen.NUI.PropertyValue(value));
359             }
360         }
361         /// <summary>
362         /// The progress Visual value of progress bar, size of the progress visual is changed based on PROGRESS_VALUE.<br>
363         /// Optional. If not supplied, the default progress visual will be shown.<br>
364         /// </summary>
365         public Tizen.NUI.PropertyMap ProgressVisual
366         {
367             get
368             {
369                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
370                 GetProperty(ProgressBar.Property.PROGRESS_VISUAL).Get(temp);
371                 return temp;
372             }
373             set
374             {
375                 SetProperty(ProgressBar.Property.PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value));
376             }
377         }
378         /// <summary>
379         /// The secondary progress visual of progress bar, size of the secondary progress visual is changed based on SECONDARY_PROGRESS_VALUE.<br>
380         /// Optional. If not supplied, the secondary progress visual will not be shown.<br>
381         /// </summary>
382         public Tizen.NUI.PropertyMap SecondaryProgressVisual
383         {
384             get
385             {
386                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
387                 GetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VISUAL).Get(temp);
388                 return temp;
389             }
390             set
391             {
392                 SetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value));
393             }
394         }
395         /// <summary>
396         /// The indeterminate visual of progress bar.<br>
397         /// Optional. If not supplied, the default inditerminate visual will be shown.<br>
398         /// </summary>
399         public Tizen.NUI.PropertyMap IndeterminateVisual
400         {
401             get
402             {
403                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
404                 GetProperty(ProgressBar.Property.INDETERMINATE_VISUAL).Get(temp);
405                 return temp;
406             }
407             set
408             {
409                 SetProperty(ProgressBar.Property.INDETERMINATE_VISUAL, new Tizen.NUI.PropertyValue(value));
410             }
411         }
412         /// <summary>
413         /// The transition data for indeterminate visual animation.<br>
414         /// Optional. If not supplied, default animation will be played.<br>
415         /// </summary>
416         public Tizen.NUI.PropertyArray IndeterminateVisualAnimation
417         {
418             get
419             {
420                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
421                 GetProperty(ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION).Get(temp);
422                 return temp;
423             }
424             set
425             {
426                 SetProperty(ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION, new Tizen.NUI.PropertyValue(value));
427             }
428         }
429         /// <summary>
430         /// The Label visual of progress bar.
431         /// </summary>
432         public Tizen.NUI.PropertyMap LabelVisual
433         {
434             get
435             {
436                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
437                 GetProperty(ProgressBar.Property.LABEL_VISUAL).Get(temp);
438                 return temp;
439             }
440             set
441             {
442                 SetProperty(ProgressBar.Property.LABEL_VISUAL, new Tizen.NUI.PropertyValue(value));
443             }
444         }
445
446     }
447
448 }