[Tizen] changes for preview#4 release
[platform/core/csapi/tizenfx.git] / src / 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.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         internal class Property
194         {
195             internal static readonly int PROGRESS_VALUE = NDalicPINVOKE.ProgressBar_Property_PROGRESS_VALUE_get();
196             internal static readonly int SECONDARY_PROGRESS_VALUE = NDalicPINVOKE.ProgressBar_Property_SECONDARY_PROGRESS_VALUE_get();
197             internal static readonly int INDETERMINATE = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_get();
198             internal static readonly int TRACK_VISUAL = NDalicPINVOKE.ProgressBar_Property_TRACK_VISUAL_get();
199             internal static readonly int PROGRESS_VISUAL = NDalicPINVOKE.ProgressBar_Property_PROGRESS_VISUAL_get();
200             internal static readonly int SECONDARY_PROGRESS_VISUAL = NDalicPINVOKE.ProgressBar_Property_SECONDARY_PROGRESS_VISUAL_get();
201             internal static readonly int INDETERMINATE_VISUAL = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_VISUAL_get();
202             internal static readonly int INDETERMINATE_VISUAL_ANIMATION = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_VISUAL_ANIMATION_get();
203             internal static readonly int LABEL_VISUAL = NDalicPINVOKE.ProgressBar_Property_LABEL_VISUAL_get();
204         }
205
206         /// <summary>
207         /// Creates the ProgressBar.
208         /// </summary>
209         public ProgressBar() : this(NDalicPINVOKE.ProgressBar_New(), true)
210         {
211             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
212
213         }
214
215         internal ProgressBarValueChangedSignal ValueChangedSignal()
216         {
217             ProgressBarValueChangedSignal ret = new ProgressBarValueChangedSignal(NDalicPINVOKE.ProgressBar_ValueChangedSignal(swigCPtr), false);
218             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219             return ret;
220         }
221
222         /// <summary>
223         /// The progress value of progress bar, progress runs form 0 to 1.<br>
224         /// If Value is set to 0, progress bar will be set to beginning.<br>
225         /// If Value is set to 1, progress bar will be set to end.<br>
226         /// Any Value outside of the range is ignored.<br>
227         /// </summary>
228         public float ProgressValue
229         {
230             get
231             {
232                 float temp = 0.0f;
233                 GetProperty(ProgressBar.Property.PROGRESS_VALUE).Get(out temp);
234                 return temp;
235             }
236             set
237             {
238                 SetProperty(ProgressBar.Property.PROGRESS_VALUE, new Tizen.NUI.PropertyValue(value));
239             }
240         }
241         /// <summary>
242         /// The secondary progress value of progress bar, secondary progress runs form 0 to 1.<br>
243         /// Optional. If not supplied, the default is 0.<br>
244         /// If Value is set to 0, progress bar will be set secondary progress to beginning.<br>
245         /// If Value is set to 1, progress bar will be set secondary progress to end.<br>
246         /// Any Value outside of the range is ignored.<br>
247         /// </summary>
248         public float SecondaryProgressValue
249         {
250             get
251             {
252                 float temp = 0.0f;
253                 GetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VALUE).Get(out temp);
254                 return temp;
255             }
256             set
257             {
258                 SetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VALUE, new Tizen.NUI.PropertyValue(value));
259             }
260         }
261         /// <summary>
262         /// Sets the progress-bar as \e indeterminate state.
263         /// </summary>
264         public bool Indeterminate
265         {
266             get
267             {
268                 bool temp = false;
269                 GetProperty(ProgressBar.Property.INDETERMINATE).Get(out temp);
270                 return temp;
271             }
272             set
273             {
274                 SetProperty(ProgressBar.Property.INDETERMINATE, new Tizen.NUI.PropertyValue(value));
275             }
276         }
277         /// <summary>
278         /// The track Visual value of progress bar, it's a full progress area and it's shown behind PROGRESS_VISUAL.<br>
279         /// Optional. If not supplied, the default track visual will be shown.<br>
280         /// </summary>
281         public Tizen.NUI.PropertyMap TrackVisual
282         {
283             get
284             {
285                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
286                 GetProperty(ProgressBar.Property.TRACK_VISUAL).Get(temp);
287                 return temp;
288             }
289             set
290             {
291                 SetProperty(ProgressBar.Property.TRACK_VISUAL, new Tizen.NUI.PropertyValue(value));
292             }
293         }
294         /// <summary>
295         /// The progress Visual value of progress bar, size of the progress visual is changed based on PROGRESS_VALUE.<br>
296         /// Optional. If not supplied, the default progress visual will be shown.<br>
297         /// </summary>
298         public Tizen.NUI.PropertyMap ProgressVisual
299         {
300             get
301             {
302                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
303                 GetProperty(ProgressBar.Property.PROGRESS_VISUAL).Get(temp);
304                 return temp;
305             }
306             set
307             {
308                 SetProperty(ProgressBar.Property.PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value));
309             }
310         }
311         /// <summary>
312         /// The secondary progress visual of progress bar, size of the secondary progress visual is changed based on SECONDARY_PROGRESS_VALUE.<br>
313         /// Optional. If not supplied, the secondary progress visual will not be shown.<br>
314         /// </summary>
315         public Tizen.NUI.PropertyMap SecondaryProgressVisual
316         {
317             get
318             {
319                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
320                 GetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VISUAL).Get(temp);
321                 return temp;
322             }
323             set
324             {
325                 SetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value));
326             }
327         }
328         /// <summary>
329         /// The indeterminate visual of progress bar.<br>
330         /// Optional. If not supplied, the default inditerminate visual will be shown.<br>
331         /// </summary>
332         public Tizen.NUI.PropertyMap IndeterminateVisual
333         {
334             get
335             {
336                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
337                 GetProperty(ProgressBar.Property.INDETERMINATE_VISUAL).Get(temp);
338                 return temp;
339             }
340             set
341             {
342                 SetProperty(ProgressBar.Property.INDETERMINATE_VISUAL, new Tizen.NUI.PropertyValue(value));
343             }
344         }
345         /// <summary>
346         /// The transition data for indeterminate visual animation.<br>
347         /// Optional. If not supplied, default animation will be played.<br>
348         /// </summary>
349         public Tizen.NUI.PropertyArray IndeterminateVisualAnimation
350         {
351             get
352             {
353                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
354                 GetProperty(ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION).Get(temp);
355                 return temp;
356             }
357             set
358             {
359                 SetProperty(ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION, new Tizen.NUI.PropertyValue(value));
360             }
361         }
362         /// <summary>
363         /// The Label visual of progress bar.
364         /// </summary>
365         public Tizen.NUI.PropertyMap LabelVisual
366         {
367             get
368             {
369                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
370                 GetProperty(ProgressBar.Property.LABEL_VISUAL).Get(temp);
371                 return temp;
372             }
373             set
374             {
375                 SetProperty(ProgressBar.Property.LABEL_VISUAL, new Tizen.NUI.PropertyValue(value));
376             }
377         }
378
379     }
380
381 }