[ElmSharp] Mark ElmSharp API as API Level: preview
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Polygon.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18
19 namespace ElmSharp
20 {
21     /// <summary>
22     /// The Polygon is a widget that used to draw a polygon (filled).
23     /// </summary>
24     /// <since_tizen> preview </since_tizen>
25     public class Polygon : EvasObject
26     {
27         /// <summary>
28         /// Creates and initializes a new instance of the Polygon class.
29         /// <param name="parent">The EvasObject to which the new Polygon will be attached as a child.</param>
30         /// </summary>
31         /// <since_tizen> preview </since_tizen>
32         public Polygon(EvasObject parent) : base(parent)
33         {
34         }
35
36         /// <summary>
37         /// Adds a new vertex to the Polygon.
38         /// <param name="x">The X coordinate of the new vertex.</param>
39         /// <param name="y">The Y coordinate of the new vertex.</param>
40         /// </summary>
41         /// <since_tizen> preview </since_tizen>
42         public void AddPoint(int x, int y)
43         {
44             Interop.Evas.evas_object_polygon_point_add(Handle, x, y);
45         }
46
47         /// <summary>
48         /// Adds a new vertex to the Polygon.
49         /// <param name="p">The coordinates of the new vertex.</param>
50         /// </summary>
51         /// <since_tizen> preview </since_tizen>
52         public void AddPoint(Point p)
53         {
54             AddPoint(p.X, p.Y);
55         }
56
57         /// <summary>
58         /// Removes all the vertices of the Polygon, making it empty.
59         /// </summary>
60         /// <since_tizen> preview </since_tizen>
61         public void ClearPoints()
62         {
63             Interop.Evas.evas_object_polygon_points_clear(Handle);
64         }
65
66         /// <summary>
67         /// Creates a widget handle.
68         /// </summary>
69         /// <param name="parent">Parent EvasObject</param>
70         /// <returns>Handle IntPtr</returns>
71         /// <since_tizen> preview </since_tizen>
72         protected override IntPtr CreateHandle(EvasObject parent)
73         {
74             IntPtr evas = Interop.Evas.evas_object_evas_get(parent.Handle);
75             return Interop.Evas.evas_object_polygon_add(evas);
76         }
77     }
78 }