2 * Copyright(c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.ComponentModel;
19 using System.Runtime.InteropServices;
20 using Tizen.NUI.BaseComponents;
21 using Tizen.NUI.Binding;
23 namespace Tizen.NUI.UIComponents
26 /// The ProgressBar is a control to give the user an indication of the progress of an operation.
28 /// <since_tizen> 3 </since_tizen>
29 /// This will be deprecated
30 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
31 [EditorBrowsable(EditorBrowsableState.Never)]
32 public class ProgressBar : View
34 /// This will be deprecated
35 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public static readonly BindableProperty ProgressValueProperty = BindableProperty.Create("ProgressValue", typeof(float), typeof(ProgressBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
39 var progressBar = (ProgressBar)bindable;
42 Tizen.NUI.Object.SetProperty(progressBar.swigCPtr, ProgressBar.Property.PROGRESS_VALUE, new Tizen.NUI.PropertyValue((float)newValue));
45 defaultValueCreator: (bindable) =>
47 var progressBar = (ProgressBar)bindable;
49 Tizen.NUI.Object.GetProperty(progressBar.swigCPtr, ProgressBar.Property.PROGRESS_VALUE).Get(out temp);
52 /// This will be deprecated
53 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
54 [EditorBrowsable(EditorBrowsableState.Never)]
55 public static readonly BindableProperty SecondaryProgressValueProperty = BindableProperty.Create("SecondaryProgressValue", typeof(float), typeof(ProgressBar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
57 var progressBar = (ProgressBar)bindable;
60 Tizen.NUI.Object.SetProperty(progressBar.swigCPtr, ProgressBar.Property.SECONDARY_PROGRESS_VALUE, new Tizen.NUI.PropertyValue((float)newValue));
63 defaultValueCreator: (bindable) =>
65 var progressBar = (ProgressBar)bindable;
67 Tizen.NUI.Object.GetProperty(progressBar.swigCPtr, ProgressBar.Property.SECONDARY_PROGRESS_VALUE).Get(out temp);
70 /// This will be deprecated
71 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public static readonly BindableProperty IndeterminateProperty = BindableProperty.Create("Indeterminate", typeof(bool), typeof(ProgressBar), false, propertyChanged: (bindable, oldValue, newValue) =>
75 var progressBar = (ProgressBar)bindable;
78 Tizen.NUI.Object.SetProperty(progressBar.swigCPtr, ProgressBar.Property.INDETERMINATE, new Tizen.NUI.PropertyValue((bool)newValue));
81 defaultValueCreator: (bindable) =>
83 var progressBar = (ProgressBar)bindable;
85 Tizen.NUI.Object.GetProperty(progressBar.swigCPtr, ProgressBar.Property.INDETERMINATE).Get(out temp);
88 /// This will be deprecated
89 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
90 [EditorBrowsable(EditorBrowsableState.Never)]
91 public static readonly BindableProperty TrackVisualProperty = BindableProperty.Create("TrackVisual", typeof(PropertyMap), typeof(ProgressBar), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
93 var progressBar = (ProgressBar)bindable;
96 Tizen.NUI.Object.SetProperty(progressBar.swigCPtr, ProgressBar.Property.TRACK_VISUAL, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
99 defaultValueCreator: (bindable) =>
101 var progressBar = (ProgressBar)bindable;
102 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
103 Tizen.NUI.Object.GetProperty(progressBar.swigCPtr, ProgressBar.Property.TRACK_VISUAL).Get(temp);
106 /// This will be deprecated
107 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
108 [EditorBrowsable(EditorBrowsableState.Never)]
109 public static readonly BindableProperty ProgressVisualProperty = BindableProperty.Create("ProgressVisual", typeof(PropertyMap), typeof(ProgressBar), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
111 var progressBar = (ProgressBar)bindable;
112 if (newValue != null)
114 Tizen.NUI.Object.SetProperty(progressBar.swigCPtr, ProgressBar.Property.PROGRESS_VISUAL, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
117 defaultValueCreator: (bindable) =>
119 var progressBar = (ProgressBar)bindable;
120 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
121 Tizen.NUI.Object.GetProperty(progressBar.swigCPtr, ProgressBar.Property.PROGRESS_VISUAL).Get(temp);
124 /// This will be deprecated
125 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
126 [EditorBrowsable(EditorBrowsableState.Never)]
127 public static readonly BindableProperty SecondaryProgressVisualProperty = BindableProperty.Create("SecondaryProgressVisual", typeof(PropertyMap), typeof(ProgressBar), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
129 var progressBar = (ProgressBar)bindable;
130 if (newValue != null)
132 Tizen.NUI.Object.SetProperty(progressBar.swigCPtr, ProgressBar.Property.SECONDARY_PROGRESS_VISUAL, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
135 defaultValueCreator: (bindable) =>
137 var progressBar = (ProgressBar)bindable;
138 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
139 Tizen.NUI.Object.GetProperty(progressBar.swigCPtr, ProgressBar.Property.SECONDARY_PROGRESS_VISUAL).Get(temp);
142 /// This will be deprecated
143 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 public static readonly BindableProperty IndeterminateVisualProperty = BindableProperty.Create("IndeterminateVisual", typeof(PropertyMap), typeof(ProgressBar), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
147 var progressBar = (ProgressBar)bindable;
148 if (newValue != null)
150 Tizen.NUI.Object.SetProperty(progressBar.swigCPtr, ProgressBar.Property.INDETERMINATE_VISUAL, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
153 defaultValueCreator: (bindable) =>
155 var progressBar = (ProgressBar)bindable;
156 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
157 Tizen.NUI.Object.GetProperty(progressBar.swigCPtr, ProgressBar.Property.INDETERMINATE_VISUAL).Get(temp);
160 /// This will be deprecated
161 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
162 [EditorBrowsable(EditorBrowsableState.Never)]
163 public static readonly BindableProperty IndeterminateVisualAnimationProperty = BindableProperty.Create("IndeterminateVisualAnimation", typeof(PropertyArray), typeof(ProgressBar), new PropertyArray(), propertyChanged: (bindable, oldValue, newValue) =>
165 var progressBar = (ProgressBar)bindable;
166 if (newValue != null)
168 Tizen.NUI.Object.SetProperty(progressBar.swigCPtr, ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION, new Tizen.NUI.PropertyValue((PropertyArray)newValue));
171 defaultValueCreator: (bindable) =>
173 var progressBar = (ProgressBar)bindable;
174 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
175 Tizen.NUI.Object.GetProperty(progressBar.swigCPtr, ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION).Get(temp);
178 /// This will be deprecated
179 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
180 [EditorBrowsable(EditorBrowsableState.Never)]
181 public static readonly BindableProperty LabelVisualProperty = BindableProperty.Create("LabelVisual", typeof(PropertyMap), typeof(ProgressBar), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
183 var progressBar = (ProgressBar)bindable;
184 if (newValue != null)
186 Tizen.NUI.Object.SetProperty(progressBar.swigCPtr, ProgressBar.Property.LABEL_VISUAL, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
189 defaultValueCreator: (bindable) =>
191 var progressBar = (ProgressBar)bindable;
192 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
193 Tizen.NUI.Object.GetProperty(progressBar.swigCPtr, ProgressBar.Property.LABEL_VISUAL).Get(temp);
197 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
198 private EventHandler<ValueChangedEventArgs> _progressBarValueChangedEventHandler;
199 private ValueChangedCallbackDelegate _progressBarValueChangedCallbackDelegate;
202 /// Creates the ProgressBar.
204 /// <since_tizen> 3 </since_tizen>
205 /// This will be deprecated
206 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
207 [EditorBrowsable(EditorBrowsableState.Never)]
208 public ProgressBar() : this(Interop.ProgressBar.ProgressBar_New(), true)
210 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214 internal ProgressBar(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.ProgressBar.ProgressBar_SWIGUpcast(cPtr), cMemoryOwn)
216 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
219 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
220 private delegate void ValueChangedCallbackDelegate(IntPtr progressBar, float progressValue, float secondaryProgressValue);
223 /// The event is sent when the ProgressBar value changes.
225 /// <since_tizen> 3 </since_tizen>
226 /// This will be deprecated
227 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
228 [EditorBrowsable(EditorBrowsableState.Never)]
229 public event EventHandler<ValueChangedEventArgs> ValueChanged
233 if (_progressBarValueChangedEventHandler == null)
235 _progressBarValueChangedCallbackDelegate = (OnValueChanged);
236 ValueChangedSignal().Connect(_progressBarValueChangedCallbackDelegate);
238 _progressBarValueChangedEventHandler += value;
242 _progressBarValueChangedEventHandler -= value;
243 if (_progressBarValueChangedEventHandler == null && ValueChangedSignal().Empty() == false)
245 ValueChangedSignal().Disconnect(_progressBarValueChangedCallbackDelegate);
251 /// The progress value of the progress bar, the progress runs from 0 to 1.<br />
252 /// If the value is set to 0, then the progress bar will be set to beginning.<br />
253 /// If the value is set to 1, then the progress bar will be set to end.<br />
254 /// Any value outside the range is ignored.<br />
256 /// <since_tizen> 3 </since_tizen>
257 /// This will be deprecated
258 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
259 [EditorBrowsable(EditorBrowsableState.Never)]
260 public float ProgressValue
264 return (float)GetValue(ProgressValueProperty);
268 SetValue(ProgressValueProperty, value);
273 /// The secondary progress value of the progress bar, the secondary progress runs from 0 to 1.<br />
274 /// Optional. If not supplied, the default is 0.<br />
275 /// If the value is set to 0, then the progress bar will be set secondary progress to beginning.<br />
276 /// If the value is set to 1, then the progress bar will be set secondary progress to end.<br />
277 /// Any value outside of the range is ignored.<br />
279 /// <since_tizen> 3 </since_tizen>
280 /// This will be deprecated
281 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
282 [EditorBrowsable(EditorBrowsableState.Never)]
283 public float SecondaryProgressValue
287 return (float)GetValue(SecondaryProgressValueProperty);
291 SetValue(SecondaryProgressValueProperty, value);
296 /// Sets the progress bar as \e indeterminate state.
298 /// <since_tizen> 3 </since_tizen>
299 /// This will be deprecated
300 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
301 [EditorBrowsable(EditorBrowsableState.Never)]
302 public bool Indeterminate
306 return (bool)GetValue(IndeterminateProperty);
310 SetValue(IndeterminateProperty, value);
315 /// The track visual value of progress bar, it's full progress area, and it's shown behind the PROGRESS_VISUAL.<br />
316 /// Optional. If not supplied, the default track visual will be shown.<br />
318 /// <since_tizen> 3 </since_tizen>
319 /// This will be deprecated
320 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
321 [EditorBrowsable(EditorBrowsableState.Never)]
322 public Tizen.NUI.PropertyMap TrackVisual
326 return (PropertyMap)GetValue(TrackVisualProperty);
330 SetValue(TrackVisualProperty, value);
335 /// The progress visual value of the progress bar, the size of the progress visual is changed based on the PROGRESS_VALUE.<br />
336 /// Optional. If not supplied, then the default progress visual will be shown.<br />
338 /// <since_tizen> 3 </since_tizen>
339 /// This will be deprecated
340 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
341 [EditorBrowsable(EditorBrowsableState.Never)]
342 public Tizen.NUI.PropertyMap ProgressVisual
346 return (PropertyMap)GetValue(ProgressVisualProperty);
350 SetValue(ProgressVisualProperty, value);
355 /// The secondary progress visual of the progress bar, the size of the secondary progress visual is changed based on the SECONDARY_PROGRESS_VALUE.<br />
356 /// Optional. If not supplied, then the secondary progress visual will not be shown.<br />
358 /// <since_tizen> 3 </since_tizen>
359 /// This will be deprecated
360 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
361 [EditorBrowsable(EditorBrowsableState.Never)]
362 public Tizen.NUI.PropertyMap SecondaryProgressVisual
366 return (PropertyMap)GetValue(SecondaryProgressVisualProperty);
370 SetValue(SecondaryProgressVisualProperty, value);
375 /// The indeterminate visual of the progress bar.<br />
376 /// Optional. If not supplied, then the default indeterminate visual will be shown.<br />
378 /// <since_tizen> 3 </since_tizen>
379 /// This will be deprecated
380 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
381 [EditorBrowsable(EditorBrowsableState.Never)]
382 public Tizen.NUI.PropertyMap IndeterminateVisual
386 return (PropertyMap)GetValue(IndeterminateVisualProperty);
390 SetValue(IndeterminateVisualProperty, value);
395 /// The transition data for the indeterminate visual animation.<br />
396 /// Optional. If not supplied, then the default animation will be played.<br />
398 /// <since_tizen> 3 </since_tizen>
399 /// This will be deprecated
400 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
401 [EditorBrowsable(EditorBrowsableState.Never)]
402 public Tizen.NUI.PropertyArray IndeterminateVisualAnimation
406 return (PropertyArray)GetValue(IndeterminateVisualAnimationProperty);
410 SetValue(IndeterminateVisualAnimationProperty, value);
415 /// The label visual of the progress bar.
417 /// <since_tizen> 3 </since_tizen>
418 /// This will be deprecated
419 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
420 [EditorBrowsable(EditorBrowsableState.Never)]
421 public Tizen.NUI.PropertyMap LabelVisual
425 return (PropertyMap)GetValue(LabelVisualProperty);
429 SetValue(LabelVisualProperty, value);
433 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ProgressBar obj)
435 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
438 internal ProgressBarValueChangedSignal ValueChangedSignal()
440 ProgressBarValueChangedSignal ret = new ProgressBarValueChangedSignal(Interop.ProgressBar.ProgressBar_ValueChangedSignal(swigCPtr), false);
441 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
446 /// To dispose the ProgressBar instance.
448 /// <since_tizen> 3 </since_tizen>
449 /// This will be deprecated
450 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
451 [EditorBrowsable(EditorBrowsableState.Never)]
452 protected override void Dispose(DisposeTypes type)
459 //Release your own unmanaged resources here.
460 //You should not access any managed member here except static instance.
461 //because the execution order of Finalizes is non-deterministic.
463 if (this != null && _progressBarValueChangedCallbackDelegate != null)
465 ValueChangedSignal().Disconnect(_progressBarValueChangedCallbackDelegate);
468 if (swigCPtr.Handle != global::System.IntPtr.Zero)
473 Interop.ProgressBar.delete_ProgressBar(swigCPtr);
475 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
481 // Callback for ProgressBar ValueChanged signal
482 private void OnValueChanged(IntPtr progressBar, float progressValue, float secondaryProgressValue)
484 ValueChangedEventArgs e = new ValueChangedEventArgs();
486 // Populate all members of "e" (ValueChangedEventArgs) with real page
487 e.ProgressBar = Registry.GetManagedBaseHandleFromNativePtr(progressBar) as ProgressBar;
488 e.ProgressValue = progressValue;
489 e.SecondaryProgressValue = secondaryProgressValue;
491 if (_progressBarValueChangedEventHandler != null)
493 _progressBarValueChangedEventHandler(this, e);
498 /// Event arguments that passed via the ValueChangedEventArgs.
500 /// <since_tizen> 3 </since_tizen>
501 /// This will be deprecated
502 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
503 [EditorBrowsable(EditorBrowsableState.Never)]
504 public class ValueChangedEventArgs : EventArgs
506 private ProgressBar _progressBar;
507 private float _progressValue;
508 private float _secondaryProgressValue;
513 /// <since_tizen> 3 </since_tizen>
514 /// This will be deprecated
515 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
516 [EditorBrowsable(EditorBrowsableState.Never)]
517 public ProgressBar ProgressBar
525 _progressBar = value;
530 /// The progress value of the progress bar, the progress runs from 0 to 1.
532 /// <since_tizen> 3 </since_tizen>
533 /// This will be deprecated
534 [EditorBrowsable(EditorBrowsableState.Never)]
535 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
536 public float ProgressValue
540 return _progressValue;
544 _progressValue = value;
549 /// The secondary progress value of the progress bar, the secondary progress runs from 0 to 1.
551 /// <since_tizen> 3 </since_tizen>
552 /// This will be deprecated
553 [EditorBrowsable(EditorBrowsableState.Never)]
554 [Obsolete("Deprecated in API6; Will be removed in API9. Please use Tizen.NUI.Components")]
555 public float SecondaryProgressValue
559 return _secondaryProgressValue;
563 _secondaryProgressValue = value;
569 internal new class Property
571 internal static readonly int PROGRESS_VALUE = Interop.ProgressBar.ProgressBar_Property_PROGRESS_VALUE_get();
572 internal static readonly int SECONDARY_PROGRESS_VALUE = Interop.ProgressBar.ProgressBar_Property_SECONDARY_PROGRESS_VALUE_get();
573 internal static readonly int INDETERMINATE = Interop.ProgressBar.ProgressBar_Property_INDETERMINATE_get();
574 internal static readonly int TRACK_VISUAL = Interop.ProgressBar.ProgressBar_Property_TRACK_VISUAL_get();
575 internal static readonly int PROGRESS_VISUAL = Interop.ProgressBar.ProgressBar_Property_PROGRESS_VISUAL_get();
576 internal static readonly int SECONDARY_PROGRESS_VISUAL = Interop.ProgressBar.ProgressBar_Property_SECONDARY_PROGRESS_VISUAL_get();
577 internal static readonly int INDETERMINATE_VISUAL = Interop.ProgressBar.ProgressBar_Property_INDETERMINATE_VISUAL_get();
578 internal static readonly int INDETERMINATE_VISUAL_ANIMATION = Interop.ProgressBar.ProgressBar_Property_INDETERMINATE_VISUAL_ANIMATION_get();
579 internal static readonly int LABEL_VISUAL = Interop.ProgressBar.ProgressBar_Property_LABEL_VISUAL_get();