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