[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Box.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 Box is a container that is used to arrange UI components in a linear order.
23     /// </summary>
24     /// <since_tizen> preview </since_tizen>
25     [Obsolete("This has been deprecated in API12")]
26     public class Box : Container
27     {
28         private Interop.Elementary.BoxLayoutCallback _layoutCallback;
29
30         /// <summary>
31         /// Creates and initializes a new instance of the Box class.
32         /// </summary>
33         /// <param name="parent">The EvasObject to which the new Box will be attached as a child.</param>
34         /// <since_tizen> preview </since_tizen>
35         [Obsolete("This has been deprecated in API12")]
36         public Box(EvasObject parent) : base(parent)
37         {
38         }
39
40         /// <summary>
41         /// Sets or gets the IsHorizontal value, which describe the pack direction. Vertical is default.
42         /// </summary>
43         /// <since_tizen> preview </since_tizen>
44         [Obsolete("This has been deprecated in API12")]
45         public bool IsHorizontal
46         {
47             get
48             {
49                 return Interop.Elementary.elm_box_horizontal_get(RealHandle);
50             }
51             set
52             {
53                 Interop.Elementary.elm_box_horizontal_set(RealHandle, value);
54             }
55         }
56
57         /// <summary>
58         /// Sets or gets whether the box has to arrange its children homogeneously.
59         /// </summary>
60         /// <since_tizen> preview </since_tizen>
61         [Obsolete("This has been deprecated in API12")]
62         public bool IsHomogeneous
63         {
64             get
65             {
66                 return Interop.Elementary.elm_box_homogeneous_get(RealHandle);
67             }
68             set
69             {
70                 Interop.Elementary.elm_box_homogeneous_set(RealHandle, value);
71             }
72         }
73
74         /// <summary>
75         /// Adds an object at the end of the pack list.
76         /// </summary>
77         /// <remarks>
78         /// Packs the "content" object into the Box, placing it last in the list of children objects.
79         /// The actual position of the object will get on the screen depending on the layout used.
80         /// If no custom layout is set, it will be at the bottom or right,
81         /// depending if the Box is vertical or horizontal, respectively.
82         /// </remarks>
83         /// <param name="content">The oject to be packed.</param>
84         /// <since_tizen> preview </since_tizen>
85         [Obsolete("This has been deprecated in API12")]
86         public void PackEnd(EvasObject content)
87         {
88             Interop.Elementary.elm_box_pack_end(RealHandle, content);
89             AddChild(content);
90         }
91
92         /// <summary>
93         /// Adds a "content" object to the beginning of the pack list.
94         /// </summary>
95         /// <remarks>
96         /// Packs the "content" object into the box object, placing it first in the list of children objects.
97         /// The actual position of the object will get on the screen depending on the layout used.
98         /// If no custom layout is set, it will be at the top or left,
99         /// depending if the Box is vertical or horizontal, respectively.
100         /// </remarks>
101         /// <param name="content">The object to be packed.</param>
102         /// <since_tizen> preview </since_tizen>
103         [Obsolete("This has been deprecated in API12")]
104         public void PackStart(EvasObject content)
105         {
106             Interop.Elementary.elm_box_pack_start(RealHandle, content);
107             AddChild(content);
108         }
109
110         /// <summary>
111         /// Adds a "content" object to the box after the "after" object.
112         /// </summary>
113         /// <remarks>
114         /// This will add the "content" to the box indicated after the object indicated with "after".
115         /// If "after" is not already in the box, the results are undefined.
116         /// After means either to the right of the "after" object or below it, depending on orientation.
117         /// </remarks>
118         /// <param name="content">The object will be added in the box.</param>
119         /// <param name="after">The object has been added in the box.</param>
120         /// <since_tizen> preview </since_tizen>
121         [Obsolete("This has been deprecated in API12")]
122         public void PackAfter(EvasObject content, EvasObject after)
123         {
124             Interop.Elementary.elm_box_pack_after(RealHandle, content, after);
125             AddChild(content);
126         }
127
128         /// <summary>
129         /// Adds a "content" object to the box before the "before" object.
130         /// </summary>
131         /// <remarks>
132         /// This will add the "content" to the box indicated before the object indicated with "before".
133         /// If "before" is not already in the box, the results are undefined.
134         /// Before means either to the left of the "before" object or below it, depending on orientation.
135         /// </remarks>
136         /// <param name="content">The object will be added in the box.</param>
137         /// <param name="before">The object has been added in the box.</param>
138         /// <since_tizen> preview </since_tizen>
139         [Obsolete("This has been deprecated in API12")]
140         public void PackBefore(EvasObject content, EvasObject before)
141         {
142             Interop.Elementary.elm_box_pack_before(RealHandle, content, before);
143             AddChild(content);
144         }
145
146         /// <summary>
147         /// Removes the "content" object from the box without deleting it.
148         /// </summary>
149         /// <param name="content">The object to unpack.</param>
150         /// <since_tizen> preview </since_tizen>
151         [Obsolete("This has been deprecated in API12")]
152         public void UnPack(EvasObject content)
153         {
154             Interop.Elementary.elm_box_unpack(RealHandle, content);
155             RemoveChild(content);
156         }
157
158         /// <summary>
159         /// Removes all the objects from the Box container.
160         /// </summary>
161         /// <since_tizen> preview </since_tizen>
162         [Obsolete("This has been deprecated in API12")]
163         public void UnPackAll()
164         {
165             Interop.Elementary.elm_box_unpack_all(RealHandle);
166             ClearChildren();
167         }
168
169         /// <summary>
170         /// Whenever any changes that requires the box in object to recalculate the size and position of its elements,
171         /// the function cb will be called to determine what the layout of the children will be.
172         /// </summary>
173         /// <param name="action">The callback function used for layout.</param>
174         /// <since_tizen> preview </since_tizen>
175         [Obsolete("This has been deprecated in API12")]
176         public void SetLayoutCallback(Action action)
177         {
178             _layoutCallback = (obj, priv, data) =>
179             {
180                 action();
181             };
182             Interop.Elementary.elm_box_layout_set(RealHandle, _layoutCallback, IntPtr.Zero, null);
183         }
184
185         /// <summary>
186         /// Sets the color of the exact part to the box's layout parent.
187         /// </summary>
188         /// <param name="part">The name of part class, it could be 'bg', 'elm.swllow.content'.</param>
189         /// <param name="color">The color value.</param>
190         /// <since_tizen> preview </since_tizen>
191         [Obsolete("This has been deprecated in API12")]
192         public override void SetPartColor(string part, Color color)
193         {
194             Interop.Elementary.elm_object_color_class_color_set(Handle, part, color.R * color.A / 255,
195                                                                               color.G * color.A / 255,
196                                                                               color.B * color.A / 255,
197                                                                               color.A);
198         }
199
200         /// <summary>
201         /// Gets the color of the exact part of the box's layout parent.
202         /// </summary>
203         /// <param name="part">The name of part class, it could be 'bg', 'elm.swllow.content'.</param>
204         /// <returns></returns>
205         /// <since_tizen> preview </since_tizen>
206         [Obsolete("This has been deprecated in API12")]
207         public override Color GetPartColor(string part)
208         {
209             int r, g, b, a;
210             Interop.Elementary.elm_object_color_class_color_get(Handle, part, out r, out g, out b, out a);
211             return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a);
212         }
213
214         /// <summary>
215         /// Forces the box to recalculate its children packing.
216         /// If any children were added or removed, the box will not calculate the values immediately, rather leaving it to the next main loop iteration.
217         /// While this is great as it would save lots of recalculation, whenever you need to get the position of a just added item, you must force recalculate before doing so.
218         /// </summary>
219         /// <since_tizen> preview </since_tizen>
220         [Obsolete("This has been deprecated in API12")]
221         public void Recalculate()
222         {
223             Interop.Elementary.elm_box_recalculate(RealHandle);
224         }
225
226         /// <summary>
227         /// Clears the box's of all the children.
228         /// Remove all the elements contained by the box, deleting the respective objects.
229         /// </summary>
230         /// <since_tizen> preview </since_tizen>
231         [Obsolete("This has been deprecated in API12")]
232         public void Clear()
233         {
234             Interop.Elementary.elm_box_clear(RealHandle);
235             ClearChildren();
236         }
237
238         /// <summary>
239         /// Sets or gets the alignment of the whole bounding box of contents.
240         /// </summary>
241         /// <param name="horizontal">Horizontal alignment.</param>
242         /// <param name="vertical">Vertical alignment.</param>
243         /// <since_tizen> preview </since_tizen>
244         [Obsolete("This has been deprecated in API12")]
245         public void SetBoxAlignment(double horizontal, double vertical)
246         {
247             Interop.Elementary.elm_box_align_set(RealHandle, horizontal, vertical);
248         }
249
250         /// <summary>
251         /// Sets or gets the space (padding) between the box's elements.
252         /// </summary>
253         /// <param name="horizontal">Horizontal padding.</param>
254         /// <param name="vertical">Vertical padding.</param>
255         /// <since_tizen> preview </since_tizen>
256         [Obsolete("This has been deprecated in API12")]
257         public void SetPadding(int horizontal, int vertical)
258         {
259             Interop.Elementary.elm_box_padding_set(RealHandle, horizontal, vertical);
260         }
261
262         /// <summary>
263         /// Creates a widget handle.
264         /// </summary>
265         /// <param name="parent">Parent EvasObject.</param>
266         /// <returns>Handle IntPtr.</returns>
267         /// <since_tizen> preview </since_tizen>
268         [Obsolete("This has been deprecated in API12")]
269         protected override IntPtr CreateHandle(EvasObject parent)
270         {
271             IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
272             Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default");
273
274             RealHandle = Interop.Elementary.elm_box_add(handle);
275             Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
276
277             return handle;
278         }
279     }
280 }