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