f0f492f50fdf0b9d6db97adabfdaf9d91afb6a5c
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / Circle / CircleProgressBar.cs
1 using System;
2 using System.ComponentModel;
3 using System.Diagnostics;
4
5 namespace Efl
6 {
7     namespace Ui
8     {
9         namespace Wearable
10         {
11             /// <summary>
12             /// CircleProgressBarBar is a part used to set the color of the bar.
13             /// </summary>
14             /// <since_tizen> 6 </since_tizen>
15             public class CircleProgressBarBar : ICircleColor
16             {
17                 IntPtr _handle;
18                 public CircleProgressBarBar(IntPtr CircleHandle) { _handle = CircleHandle; }
19
20                 /// <summary>
21                 /// Sets the color of the bar on the circle progressbar.
22                 /// </summary>
23                 /// <since_tizen> 6 </since_tizen>
24                 public void SetColor(int r, int g, int b, int a)
25                 {
26                     if (_handle != null)
27                         Interop.Eext.eext_circle_object_color_set(_handle, r, g, b, a);
28                 }
29
30                 /// <summary>
31                 /// Gets the color of the bar on the circle progressbar.
32                 /// </summary>
33                 /// <since_tizen> 6 </since_tizen>
34                 public void GetColor(out int r, out int g, out int b, out int a)
35                 {
36                     r = g = b = a = -1;
37                     if (_handle != null)
38                         Interop.Eext.eext_circle_object_color_get(_handle, out r, out g, out b, out a);
39                 }
40             }
41
42             /// <summary>
43             /// CircleProgressBarBarBackground is a part used to set the background color of the bar.
44             /// </summary>
45             /// <since_tizen> 6 </since_tizen>
46             public class CircleProgressBarBarBackground : ICircleColor
47             {
48                 IntPtr _handle;
49                 public CircleProgressBarBarBackground(IntPtr CircleHandle) { _handle = CircleHandle; }
50
51                 /// <summary>
52                 /// Sets the background color of the bar on the circle progressbar.
53                 /// </summary>
54                 /// <since_tizen> 6 </since_tizen>
55                 public void SetColor(int r, int g, int b, int a)
56                 {
57                     if (_handle != null)
58                         Interop.Eext.eext_circle_object_item_color_set(_handle, "bg", r, g, b, a);
59                 }
60
61                 /// <summary>
62                 /// Gets the background color of the bar on the circle progressbar.
63                 /// </summary>
64                 /// <since_tizen> 6 </since_tizen>
65                 public void GetColor(out int r, out int g, out int b, out int a)
66                 {
67                     r = g = b = a = -1;
68                     if (_handle != null)
69                         Interop.Eext.eext_circle_object_item_color_get(_handle, "bg", out r, out g, out b, out a);
70                 }
71             }
72
73             /// <summary>
74             /// The CircleProgressBar is a widget for visually representing the progress status of a given job or task with the circular design.
75             /// </summary>
76             /// <since_tizen> 6 </since_tizen>
77             public class CircleProgressBar : Efl.Ui.Layout, ICircleWidget
78             {
79                 IntPtr _handle;
80
81                 /// <summary>
82                 /// Get the handle for the circle widget.
83                 /// </summary>
84                 /// <since_tizen> 6 </since_tizen>
85                 public virtual IntPtr CircleHandle => _handle;
86
87                 /// <summary>
88                 /// Sets or gets the color of the bar.
89                 /// </summary>
90                 /// <since_tizen> 6 </since_tizen>
91                 public CircleProgressBarBar Bar;
92
93                 /// <summary>
94                 /// Sets or gets the background color of the bar.
95                 /// </summary>
96                 /// <since_tizen> 6 </since_tizen>
97                 public CircleProgressBarBarBackground BarBackground;
98
99                 /// <summary>
100                 /// Creates and initializes a new instance of the CircleProgressBar class.
101                 /// </summary>
102                 /// <param name="parent">The Efl.Ui.Widget to which the new CircleProgressBar will be attached as a child.</param>
103                 /// <since_tizen> 6 </since_tizen>
104                 public CircleProgressBar(Efl.Ui.Widget parent) : base(parent)
105                 {
106                     _handle = Interop.Eext.eext_circle_object_progressbar_add(parent.NativeHandle, IntPtr.Zero);
107
108                     Bar = new CircleProgressBarBar(_handle);
109                     BarBackground = new CircleProgressBarBarBackground(_handle);
110
111                     elm_layout_content_set(this.NativeHandle, "efl.swallow.vg", CircleHandle);
112                 }
113
114                 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)]
115                 internal static extern bool elm_layout_content_set(IntPtr obj, string swallow, IntPtr content);
116
117                 public override Efl.Object FinalizeAdd()
118                 {
119                     this.SetTheme("circle_progressbar", null, null);
120                     return this;
121                 }
122
123                 /// <summary>
124                 /// Sets or gets the disabled state of the circle progressbar.
125                 /// </summary>
126                 /// <since_tizen> 6 </since_tizen>
127                 public bool Disable
128                 {
129                     get => !IsEnable;
130                     set => IsEnable = !value;
131                 }
132
133                 /// <summary>
134                 /// Sets or gets the enabled state of the circle progressbar.
135                 /// </summary>
136                 /// <since_tizen> 6 </since_tizen>
137                 public bool IsEnable
138                 {
139                     get
140                     {
141                         return !Interop.Eext.eext_circle_object_disabled_get(CircleHandle);
142                     }
143                     set
144                     {
145                         Interop.Eext.eext_circle_object_disabled_set(CircleHandle, !value);
146                     }
147                 }
148
149                 /// <summary>
150                 /// Gets or sets the value displayed by the circle progressbar.
151                 /// </summary>
152                 /// <since_tizen> 6 </since_tizen>
153                 public double Value
154                 {
155                     get
156                     {
157                         return Interop.Eext.eext_circle_object_value_get(CircleHandle);
158                     }
159                     set
160                     {
161                         Interop.Eext.eext_circle_object_value_set(CircleHandle, value);
162                     }
163                 }
164
165                 /// <summary>
166                 /// Sets or gets the maximum values for the circle progressbar.
167                 /// </summary>
168                 /// <since_tizen> 6 </since_tizen>
169                 public double Maximum
170                 {
171                     get
172                     {
173                         double max = 0;
174                         double min = 0;
175                         Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
176                         return max;
177                     }
178                     set
179                     {
180                         double min = Minimum;
181                         Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, min, value);
182                     }
183                 }
184
185                 /// <summary>
186                 /// Sets or gets the minimum values for the circle progressbar.
187                 /// </summary>
188                 /// <since_tizen> 6 </since_tizen>
189                 public double Minimum
190                 {
191                     get
192                     {
193                         double max = 0;
194                         double min = 0;
195                         Interop.Eext.eext_circle_object_value_min_max_get(CircleHandle, out min, out max);
196                         return min;
197                     }
198                     set
199                     {
200                         double max = Maximum;
201                         Interop.Eext.eext_circle_object_value_min_max_set(CircleHandle, value, max);
202                     }
203                 }
204
205                 /// <summary>
206                 /// Sets or gets the angle in degree of the circle progressbar bar.
207                 /// </summary>
208                 /// <since_tizen> 6 </since_tizen>
209                 public double BarAngle
210                 {
211                     get
212                     {
213                         return Interop.Eext.eext_circle_object_angle_get(CircleHandle);
214                     }
215                     set
216                     {
217                         Interop.Eext.eext_circle_object_angle_set(CircleHandle, value);
218                     }
219                 }
220
221                 /// <summary>
222                 /// Sets or gets the angle in degree of the circle progressbar background.
223                 /// </summary>
224                 /// <since_tizen> 6 </since_tizen>
225                 public double BackgroundAngle
226                 {
227                     get
228                     {
229                         return Interop.Eext.eext_circle_object_item_angle_get(CircleHandle, "bg");
230                     }
231                     set
232                     {
233                         Interop.Eext.eext_circle_object_item_angle_set(CircleHandle, "bg", value);
234                     }
235                 }
236
237                 /// <summary>
238                 /// Sets or gets the angle offset for the circle progressbar bar.
239                 /// Offset value means start position of the circle progressbar bar.
240                 /// </summary>
241                 /// <since_tizen> 6 </since_tizen>
242                 public double BarAngleOffset
243                 {
244                     get
245                     {
246                         return Interop.Eext.eext_circle_object_angle_offset_get(CircleHandle);
247                     }
248                     set
249                     {
250                         Interop.Eext.eext_circle_object_angle_offset_set(CircleHandle, value);
251                     }
252                 }
253
254                 /// <summary>
255                 /// Sets or gets the angle offset for the circle progressbar background.
256                 /// Offset value means start position of the circle progressbar background.
257                 /// </summary>
258                 /// <since_tizen> 6 </since_tizen>
259                 public double BackgroundAngleOffset
260                 {
261                     get
262                     {
263                         return Interop.Eext.eext_circle_object_item_angle_offset_get(CircleHandle, "bg");
264                     }
265                     set
266                     {
267                         Interop.Eext.eext_circle_object_item_angle_offset_set(CircleHandle, "bg", value);
268                     }
269                 }
270
271                 /// <summary>
272                 /// Sets or gets the maximum angle of the circle progressbar bar.
273                 /// </summary>
274                 /// <since_tizen> 6 </since_tizen>
275                 public double BarAngleMaximum
276                 {
277                     get
278                     {
279                         double max = 0;
280                         double min = 0;
281                         Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
282                         return max;
283                     }
284                     set
285                     {
286                         double min = BarAngleMinimum;
287                         Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, min, value);
288                     }
289                 }
290
291                 /// <summary>
292                 /// Sets or gets the minimum angle of the circle progressbar bar.
293                 /// </summary>
294                 /// <since_tizen> 6 </since_tizen>
295                 public double BarAngleMinimum
296                 {
297                     get
298                     {
299                         double max = 0;
300                         double min = 0;
301                         Interop.Eext.eext_circle_object_angle_min_max_get(CircleHandle, out min, out max);
302                         return min;
303                     }
304                     set
305                     {
306                         double max = BarAngleMaximum;
307                         Interop.Eext.eext_circle_object_angle_min_max_set(CircleHandle, value, max);
308                     }
309                 }
310
311                 /// <summary>
312                 /// Sets or gets the line width of the circle progressbar bar.
313                 /// </summary>
314                 /// <since_tizen> 6 </since_tizen>
315                 public int BarLineWidth
316                 {
317                     get
318                     {
319                         return Interop.Eext.eext_circle_object_line_width_get(CircleHandle);
320                     }
321                     set
322                     {
323                         Interop.Eext.eext_circle_object_line_width_set(CircleHandle, value);
324                     }
325                 }
326
327                 /// <summary>
328                 /// Sets or gets the line width of the circle progressbar background.
329                 /// </summary>
330                 /// <since_tizen> 6 </since_tizen>
331                 public int BackgroundLineWidth
332                 {
333                     get
334                     {
335                         return Interop.Eext.eext_circle_object_item_line_width_get(CircleHandle, "bg");
336                     }
337                     set
338                     {
339                         Interop.Eext.eext_circle_object_item_line_width_set(CircleHandle, "bg", value);
340                     }
341                 }
342
343                 /// <summary>
344                 /// Gets or sets the radius value for the circle progressbar bar.
345                 /// </summary>
346                 /// <since_tizen> 6 </since_tizen>
347                 public double BarRadius
348                 {
349                     get
350                     {
351                         return Interop.Eext.eext_circle_object_radius_get(CircleHandle);
352                     }
353                     set
354                     {
355                         Interop.Eext.eext_circle_object_radius_set(CircleHandle, value);
356                     }
357                 }
358
359                 /// <summary>
360                 /// Gets or sets the radius value for the circle progressbar background.
361                 /// </summary>
362                 /// <since_tizen> 6 </since_tizen>
363                 public double BackgroundRadius
364                 {
365                     get
366                     {
367                         return Interop.Eext.eext_circle_object_item_radius_get(CircleHandle, "bg");
368                     }
369                     set
370                     {
371                         Interop.Eext.eext_circle_object_item_radius_set(CircleHandle, "bg", value);
372                     }
373                 }
374             }
375         }
376     }
377 }