913f91382b41857cbd0e2b8ed7320355a6b12d6c
[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             if (swigCPtr.Handle != global::System.IntPtr.Zero)
76             {
77                 if (swigCMemOwn)
78                 {
79                     swigCMemOwn = false;
80                     NDalicPINVOKE.delete_ProgressBar(swigCPtr);
81                 }
82                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
83             }
84
85             base.Dispose(type);
86         }
87
88
89         /// <summary>
90         /// Event arguments that passed via ValueChangedEventArgs
91         /// </summary>
92         public class ValueChangedEventArgs : EventArgs
93         {
94             private ProgressBar _progressBar;
95             private float _progressValue;
96             private float _secondaryProgressValue;
97
98             public ProgressBar ProgressBar
99             {
100                 get
101                 {
102                     return _progressBar;
103                 }
104                 set
105                 {
106                     _progressBar = value;
107                 }
108             }
109
110             public float ProgressValue
111             {
112                 get
113                 {
114                     return _progressValue;
115                 }
116                 set
117                 {
118                     _progressValue = value;
119                 }
120             }
121
122             public float SecondaryProgressValue
123             {
124                 get
125                 {
126                     return _secondaryProgressValue;
127                 }
128                 set
129                 {
130                     _secondaryProgressValue = value;
131                 }
132             }
133
134         }
135
136         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
137         private delegate void ValueChangedCallbackDelegate(IntPtr progressBar, float progressValue, float secondaryProgressValue);
138         private EventHandler<ValueChangedEventArgs> _progressBarValueChangedEventHandler;
139         private ValueChangedCallbackDelegate _progressBarValueChangedCallbackDelegate;
140
141         /// <summary>
142         /// Event is sent when the ProgressBar value changes.
143         /// </summary>
144         public event EventHandler<ValueChangedEventArgs> ValueChanged
145         {
146             add
147             {
148                 if (_progressBarValueChangedEventHandler == null)
149                 {
150                     _progressBarValueChangedCallbackDelegate = (OnValueChanged);
151                     ValueChangedSignal().Connect(_progressBarValueChangedCallbackDelegate);
152                 }
153                 _progressBarValueChangedEventHandler += value;
154             }
155             remove
156             {
157                 _progressBarValueChangedEventHandler -= value;
158                 if (_progressBarValueChangedEventHandler == null && ValueChangedSignal().Empty() == false)
159                 {
160                     ValueChangedSignal().Disconnect(_progressBarValueChangedCallbackDelegate);
161                 }
162             }
163         }
164
165         // Callback for ProgressBar ValueChanged signal
166         private void OnValueChanged(IntPtr progressBar, float progressValue, float secondaryProgressValue)
167         {
168             ValueChangedEventArgs e = new ValueChangedEventArgs();
169
170             // Populate all members of "e" (ValueChangedEventArgs) with real page
171             e.ProgressBar = Registry.GetManagedBaseHandleFromNativePtr(progressBar) as ProgressBar;
172             e.ProgressValue = progressValue;
173             e.SecondaryProgressValue = secondaryProgressValue;
174
175             if (_progressBarValueChangedEventHandler != null)
176             {
177                 _progressBarValueChangedEventHandler(this, e);
178             }
179         }
180
181         internal class Property
182         {
183             internal static readonly int PROGRESS_VALUE = NDalicPINVOKE.ProgressBar_Property_PROGRESS_VALUE_get();
184             internal static readonly int SECONDARY_PROGRESS_VALUE = NDalicPINVOKE.ProgressBar_Property_SECONDARY_PROGRESS_VALUE_get();
185             internal static readonly int INDETERMINATE = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_get();
186             internal static readonly int TRACK_VISUAL = NDalicPINVOKE.ProgressBar_Property_TRACK_VISUAL_get();
187             internal static readonly int PROGRESS_VISUAL = NDalicPINVOKE.ProgressBar_Property_PROGRESS_VISUAL_get();
188             internal static readonly int SECONDARY_PROGRESS_VISUAL = NDalicPINVOKE.ProgressBar_Property_SECONDARY_PROGRESS_VISUAL_get();
189             internal static readonly int INDETERMINATE_VISUAL = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_VISUAL_get();
190             internal static readonly int INDETERMINATE_VISUAL_ANIMATION = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_VISUAL_ANIMATION_get();
191             internal static readonly int LABEL_VISUAL = NDalicPINVOKE.ProgressBar_Property_LABEL_VISUAL_get();
192         }
193
194         /// <summary>
195         /// Creates the ProgressBar.
196         /// </summary>
197         public ProgressBar() : this(NDalicPINVOKE.ProgressBar_New(), true)
198         {
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200
201         }
202
203         internal ProgressBarValueChangedSignal ValueChangedSignal()
204         {
205             ProgressBarValueChangedSignal ret = new ProgressBarValueChangedSignal(NDalicPINVOKE.ProgressBar_ValueChangedSignal(swigCPtr), false);
206             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207             return ret;
208         }
209
210         /// <summary>
211         /// The progress value of progress bar, progress runs form 0 to 1.<br>
212         /// If Value is set to 0, progress bar will be set to beginning.<br>
213         /// If Value is set to 1, progress bar will be set to end.<br>
214         /// Any Value outside of the range is ignored.<br>
215         /// </summary>
216         public float ProgressValue
217         {
218             get
219             {
220                 float temp = 0.0f;
221                 GetProperty(ProgressBar.Property.PROGRESS_VALUE).Get(out temp);
222                 return temp;
223             }
224             set
225             {
226                 SetProperty(ProgressBar.Property.PROGRESS_VALUE, new Tizen.NUI.PropertyValue(value));
227             }
228         }
229         /// <summary>
230         /// The secondary progress value of progress bar, secondary progress runs form 0 to 1.<br>
231         /// Optional. If not supplied, the default is 0.<br>
232         /// If Value is set to 0, progress bar will be set secondary progress to beginning.<br>
233         /// If Value is set to 1, progress bar will be set secondary progress to end.<br>
234         /// Any Value outside of the range is ignored.<br>
235         /// </summary>
236         public float SecondaryProgressValue
237         {
238             get
239             {
240                 float temp = 0.0f;
241                 GetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VALUE).Get(out temp);
242                 return temp;
243             }
244             set
245             {
246                 SetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VALUE, new Tizen.NUI.PropertyValue(value));
247             }
248         }
249         /// <summary>
250         /// Sets the progress-bar as \e indeterminate state.
251         /// </summary>
252         public bool Indeterminate
253         {
254             get
255             {
256                 bool temp = false;
257                 GetProperty(ProgressBar.Property.INDETERMINATE).Get(out temp);
258                 return temp;
259             }
260             set
261             {
262                 SetProperty(ProgressBar.Property.INDETERMINATE, new Tizen.NUI.PropertyValue(value));
263             }
264         }
265         /// <summary>
266         /// The track Visual value of progress bar, it's a full progress area and it's shown behind PROGRESS_VISUAL.<br>
267         /// Optional. If not supplied, the default track visual will be shown.<br>
268         /// </summary>
269         public Tizen.NUI.PropertyMap TrackVisual
270         {
271             get
272             {
273                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
274                 GetProperty(ProgressBar.Property.TRACK_VISUAL).Get(temp);
275                 return temp;
276             }
277             set
278             {
279                 SetProperty(ProgressBar.Property.TRACK_VISUAL, new Tizen.NUI.PropertyValue(value));
280             }
281         }
282         /// <summary>
283         /// The progress Visual value of progress bar, size of the progress visual is changed based on PROGRESS_VALUE.<br>
284         /// Optional. If not supplied, the default progress visual will be shown.<br>
285         /// </summary>
286         public Tizen.NUI.PropertyMap ProgressVisual
287         {
288             get
289             {
290                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
291                 GetProperty(ProgressBar.Property.PROGRESS_VISUAL).Get(temp);
292                 return temp;
293             }
294             set
295             {
296                 SetProperty(ProgressBar.Property.PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value));
297             }
298         }
299         /// <summary>
300         /// The secondary progress visual of progress bar, size of the secondary progress visual is changed based on SECONDARY_PROGRESS_VALUE.<br>
301         /// Optional. If not supplied, the secondary progress visual will not be shown.<br>
302         /// </summary>
303         public Tizen.NUI.PropertyMap SecondaryProgressVisual
304         {
305             get
306             {
307                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
308                 GetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VISUAL).Get(temp);
309                 return temp;
310             }
311             set
312             {
313                 SetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value));
314             }
315         }
316         /// <summary>
317         /// The indeterminate visual of progress bar.<br>
318         /// Optional. If not supplied, the default inditerminate visual will be shown.<br>
319         /// </summary>
320         public Tizen.NUI.PropertyMap IndeterminateVisual
321         {
322             get
323             {
324                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
325                 GetProperty(ProgressBar.Property.INDETERMINATE_VISUAL).Get(temp);
326                 return temp;
327             }
328             set
329             {
330                 SetProperty(ProgressBar.Property.INDETERMINATE_VISUAL, new Tizen.NUI.PropertyValue(value));
331             }
332         }
333         /// <summary>
334         /// The transition data for indeterminate visual animation.<br>
335         /// Optional. If not supplied, default animation will be played.<br>
336         /// </summary>
337         public Tizen.NUI.PropertyArray IndeterminateVisualAnimation
338         {
339             get
340             {
341                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
342                 GetProperty(ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION).Get(temp);
343                 return temp;
344             }
345             set
346             {
347                 SetProperty(ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION, new Tizen.NUI.PropertyValue(value));
348             }
349         }
350         /// <summary>
351         /// The Label visual of progress bar.
352         /// </summary>
353         public Tizen.NUI.PropertyMap LabelVisual
354         {
355             get
356             {
357                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
358                 GetProperty(ProgressBar.Property.LABEL_VISUAL).Get(temp);
359                 return temp;
360             }
361             set
362             {
363                 SetProperty(ProgressBar.Property.LABEL_VISUAL, new Tizen.NUI.PropertyValue(value));
364             }
365         }
366
367     }
368
369 }