[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Table.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 Table is a container widget to arrange other widgets in a table where items can span multiple columns or rows.
23     /// Inherits <see cref="Container"/>.
24     /// </summary>
25     /// <since_tizen> preview </since_tizen>
26     [Obsolete("This has been deprecated in API12")]
27     public class Table : Container
28     {
29         int _paddingX = 0;
30         int _paddingY = 0;
31
32         /// <summary>
33         /// Creates and initializes a new instance of the Table class.
34         /// </summary>
35         /// <param name="parent">
36         /// A <see cref="EvasObject"/> to which the new Table instance will be attached.
37         /// </param>
38         /// <since_tizen> preview </since_tizen>
39         [Obsolete("This has been deprecated in API12")]
40         public Table(EvasObject parent) : base(parent)
41         {
42         }
43
44         /// <summary>
45         /// Sets or gets whether the layout of this table is homogeneous.
46         /// </summary>
47         /// <remarks>True for homogeneous, False for no homogeneous.</remarks>
48         /// <since_tizen> preview </since_tizen>
49         [Obsolete("This has been deprecated in API12")]
50         public bool Homogeneous
51         {
52             get
53             {
54                 return Interop.Elementary.elm_table_homogeneous_get(RealHandle);
55             }
56             set
57             {
58                 Interop.Elementary.elm_table_homogeneous_set(RealHandle, value);
59             }
60         }
61
62         /// <summary>
63         /// Sets or gets the horizontal padding between the cells.
64         /// </summary>
65         /// <since_tizen> preview </since_tizen>
66         [Obsolete("This has been deprecated in API12")]
67         public int PaddingX
68         {
69             get
70             {
71                 return _paddingX;
72             }
73             set
74             {
75                 _paddingX = value;
76                 Interop.Elementary.elm_table_padding_set(RealHandle, _paddingX, _paddingY);
77             }
78         }
79
80         /// <summary>
81         /// Sets or gets the vertical padding between the cells.
82         /// </summary>
83         /// <since_tizen> preview </since_tizen>
84         [Obsolete("This has been deprecated in API12")]
85         public int PaddingY
86         {
87             get
88             {
89                 return _paddingY;
90             }
91             set
92             {
93                 _paddingY = value;
94                 Interop.Elementary.elm_table_padding_set(RealHandle, _paddingX, _paddingY);
95             }
96         }
97         /// <summary>
98         /// Adds a subobject on the table with the coordinates passed.
99         /// </summary>
100         /// <param name="obj">The subobject to be added to the table.</param>
101         /// <param name="col">The column number.</param>
102         /// <param name="row">The row number.</param>
103         /// <param name="colspan">The column span.</param>
104         /// <param name="rowspan">The row span.</param>
105         /// <since_tizen> preview </since_tizen>
106         [Obsolete("This has been deprecated in API12")]
107         public void Pack(EvasObject obj, int col, int row, int colspan, int rowspan)
108         {
109             if (obj == null)
110                 throw new ArgumentNullException("obj");
111             Interop.Elementary.elm_table_pack(RealHandle, obj, col, row, colspan, rowspan);
112             AddChild(obj);
113         }
114
115         /// <summary>
116         /// Removes the child from the table.
117         /// </summary>
118         /// <param name="obj">The subobject.</param>
119         /// <since_tizen> preview </since_tizen>
120         [Obsolete("This has been deprecated in API12")]
121         public void Unpack(EvasObject obj)
122         {
123             if (obj == null)
124                 throw new ArgumentNullException("obj");
125             Interop.Elementary.elm_table_unpack(RealHandle, obj);
126             RemoveChild(obj);
127         }
128
129         /// <summary>
130         /// Removes all the child objects from a table object.
131         /// </summary>
132         /// <since_tizen> preview </since_tizen>
133         [Obsolete("This has been deprecated in API12")]
134         public void Clear()
135         {
136             Interop.Elementary.elm_table_clear(RealHandle, false);
137             ClearChildren();
138         }
139
140         /// <summary>
141         /// Sets the color for a particular part of the table.
142         /// </summary>
143         /// <param name="part">The name of part class.</param>
144         /// <param name="color">The color.</param>
145         /// <since_tizen> preview </since_tizen>
146         [Obsolete("This has been deprecated in API12")]
147         public override void SetPartColor(string part, Color color)
148         {
149             Interop.Elementary.elm_object_color_class_color_set(Handle, part, color.R * color.A / 255,
150                                                                               color.G * color.A / 255,
151                                                                               color.B * color.A / 255,
152                                                                               color.A);
153         }
154
155         /// <summary>
156         /// Gets the color of a particular part of the table.
157         /// </summary>
158         /// <param name="part">The name of part class, it could be 'bg', 'elm.swllow.content'.</param>
159         /// <returns>The color of a particular part.</returns>
160         /// <since_tizen> preview </since_tizen>
161         [Obsolete("This has been deprecated in API12")]
162         public override Color GetPartColor(string part)
163         {
164             int r, g, b, a;
165             Interop.Elementary.elm_object_color_class_color_get(Handle, part, out r, out g, out b, out a);
166             return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a);
167         }
168
169         /// <summary>
170         /// Creates a widget handle.
171         /// </summary>
172         /// <param name="parent">Parent EvasObject.</param>
173         /// <returns>Handle IntPtr.</returns>
174         /// <since_tizen> preview </since_tizen>
175         [Obsolete("This has been deprecated in API12")]
176         protected override IntPtr CreateHandle(EvasObject parent)
177         {
178             IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
179             Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default");
180
181             RealHandle = Interop.Elementary.elm_table_add(handle);
182             Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
183
184             return handle;
185         }
186     }
187 }