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