[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Container.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 using System.Collections.Generic;
19
20 namespace ElmSharp
21 {
22     /// <summary>
23     /// It inherits <see cref="Widget"/>.
24     /// The Container is an abstract class.
25     /// The other class inherits it to elementary, which is about displaying
26     /// its widgets in a nice layout.
27     /// </summary>
28     /// <since_tizen> preview </since_tizen>
29     [Obsolete("This has been deprecated in API12")]
30     public abstract class Container : Widget
31     {
32         HashSet<EvasObject> _children = new HashSet<EvasObject>();
33
34         /// <summary>
35         /// Creates and initializes a new instance of the class, which inherit from the Container.
36         /// </summary>
37         /// <param name="parent">The parent is a given object, which will be attached by the Container
38         /// as a child. It's <see cref="EvasObject"/> type.</param>
39         /// <since_tizen> preview </since_tizen>
40         [Obsolete("This has been deprecated in API12")]
41         protected Container(EvasObject parent) : base(parent)
42         {
43         }
44
45         /// <summary>
46         /// Creates and initializes a new instance of the Container class.
47         /// </summary>
48         /// <since_tizen> preview </since_tizen>
49         [Obsolete("This has been deprecated in API12")]
50         protected Container()
51         {
52         }
53
54         /// <summary>
55         /// Sets the background color of a given Container.
56         /// </summary>
57         /// <since_tizen> preview </since_tizen>
58         [Obsolete("This has been deprecated in API12")]
59         public override Color BackgroundColor
60         {
61             set
62             {
63                 if (value.IsDefault)
64                 {
65                     SetPartColor("bg", Color.Transparent);
66                 }
67                 else
68                 {
69                     SetPartColor("bg", value);
70                 }
71                 _backgroundColor = value;
72             }
73         }
74
75         /// <summary>
76         /// Gets the collection of a child EvasObject of the Container.
77         /// </summary>
78         /// <since_tizen> preview </since_tizen>
79         [Obsolete("This has been deprecated in API12")]
80         protected IEnumerable<EvasObject> Children => _children;
81
82         /// <summary>
83         /// Add the EvasObject object as a child of the Container.
84         /// </summary>
85         /// <param name="obj">The EvasObject object to be added.</param>
86         /// <since_tizen> preview </since_tizen>
87         [Obsolete("This has been deprecated in API12")]
88         protected void AddChild(EvasObject obj)
89         {
90             _children.Add(obj);
91             obj.Deleted += OnChildDeleted;
92         }
93
94         /// <summary>
95         /// Removes the EvasObject object as a child of the Container.
96         /// </summary>
97         /// <param name="obj">The EvasObject object to be removed.</param>
98         /// <since_tizen> preview </since_tizen>
99         [Obsolete("This has been deprecated in API12")]
100         protected void RemoveChild(EvasObject obj)
101         {
102             _children.Remove(obj);
103         }
104
105         /// <summary>
106         /// Clears all the children of the Container.
107         /// </summary>
108         /// <since_tizen> preview </since_tizen>
109         [Obsolete("This has been deprecated in API12")]
110         protected void ClearChildren()
111         {
112             _children.Clear();
113         }
114
115         /// <summary>
116         /// The Container callback that is invoked when a child is removed.
117         /// </summary>
118         /// <param name="sender">The called Container.</param>
119         /// <param name="a"><see cref="EventArgs"/></param>
120         void OnChildDeleted(object sender, EventArgs a)
121         {
122             _children.Remove((EvasObject)sender);
123         }
124     }
125 }