[ElmSharp.Wearable] Add Delete to CircleSurface
[platform/core/csapi/tizenfx.git] / src / ElmSharp.Wearable / ElmSharp.Wearable / CircleSurface.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace ElmSharp.Wearable
6 {
7     /// <summary>
8     /// The CircleSurface presents a surface for drawing circular feature of circle widgets
9     /// </summary>
10     public class CircleSurface
11     {
12         IntPtr _handle;
13
14         /// <summary>
15         /// Creates and initializes a new instance of the CircleSurface class with surface on the Conformant widget.
16         /// </summary>
17         /// <param name="conformant">Conformant widget to create a surface.</param>
18         public CircleSurface(Conformant conformant)
19         {
20             _handle = Interop.Eext.eext_circle_surface_conformant_add(conformant);
21         }
22
23         /// <summary>
24         /// Creates and initializes a new instance of the CircleSurface class with surface on the Layout widget.
25         /// </summary>
26         /// <param name="layout">Layout widget to create a surface.</param>
27         public CircleSurface(Layout layout)
28         {
29             _handle = Interop.Eext.eext_circle_surface_layout_add(layout);
30         }
31
32         /// <summary>
33         /// Creates and initializes a new instance of the CircleSurface class with surface on the Naviframe widget.
34         /// </summary>
35         /// <param name="naviframe">Naviframe widget to create a surface.</param>
36         public CircleSurface(Naviframe naviframe)
37         {
38             _handle = Interop.Eext.eext_circle_surface_naviframe_add(naviframe);
39         }
40
41         /// <summary>
42         /// Creates and initializes a new instance of the CircleSurface class with no surface
43         /// </summary>
44         public CircleSurface()
45         {
46             _handle = IntPtr.Zero;
47         }
48
49         /// <summary>
50         /// Gets the handle for CircleSurface
51         /// </summary>
52         public IntPtr Handle => _handle;
53
54         /// <summary>
55         /// Delete the given CirclrSurface
56         /// </summary>
57         public void Delete()
58         {
59             if (Handle != IntPtr.Zero)
60             {
61                 Interop.Eext.eext_circle_surface_del(Handle);
62                 _handle = IntPtr.Zero;
63             }
64         }
65
66         internal static CircleSurface CreateCircleSurface(EvasObject obj)
67         {
68             if (obj is Conformant) return new CircleSurface(obj as Conformant);
69             else if (obj is Naviframe) return new CircleSurface(obj as Naviframe);
70             else if (obj is Layout) return new CircleSurface(obj as Layout);
71             else return new CircleSurface();
72         }
73     }
74 }