[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Check.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 Check is a widget that allows for toggling a value between true and false.
23     /// </summary>
24     /// <since_tizen> preview </since_tizen>
25     [Obsolete("This has been deprecated in API12")]
26     public class Check : Layout
27     {
28         private SmartEvent _changed;
29         private bool _currentState;
30
31         /// <summary>
32         /// Creates and initializes a new instance of the Check class.
33         /// </summary>
34         /// <param name="parent">
35         /// The EvasObject to which the new check will be attached as a child.
36         /// </param>
37         /// <since_tizen> preview </since_tizen>
38         [Obsolete("This has been deprecated in API12")]
39         public Check(EvasObject parent) : base(parent)
40         {
41             _changed = new SmartEvent(this, this.RealHandle, "changed");
42             _changed.On += (sender, e) =>
43             {
44                 StateChanged?.Invoke(this, new CheckStateChangedEventArgs(_currentState, IsChecked));
45             };
46         }
47
48         /// <summary>
49         /// StateChanged will be triggered when the IsChecked in the check is changed.
50         /// </summary>
51         /// <since_tizen> preview </since_tizen>
52         [Obsolete("This has been deprecated in API12")]
53         public event EventHandler<CheckStateChangedEventArgs> StateChanged;
54
55         /// <summary>
56         /// Sets or gets whether the given check is checked or not.
57         /// </summary>
58         /// <remarks>
59         /// When an object is checked, the value will be set to true. Conversely, will be set to false.
60         /// </remarks>
61         /// <since_tizen> preview </since_tizen>
62         [Obsolete("This has been deprecated in API12")]
63         public bool IsChecked
64         {
65             get
66             {
67                 _currentState = Interop.Elementary.elm_check_state_get(RealHandle);
68                 return _currentState;
69             }
70             set
71             {
72                 Interop.Elementary.elm_check_state_set(RealHandle, value);
73             }
74         }
75
76         /// <summary>
77         /// Creates a widget handle.
78         /// </summary>
79         /// <param name="parent">Parent EvasObject.</param>
80         /// <returns>Handle IntPtr.</returns>
81         /// <since_tizen> preview </since_tizen>
82         [Obsolete("This has been deprecated in API12")]
83         protected override IntPtr CreateHandle(EvasObject parent)
84         {
85             IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
86             Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
87
88             RealHandle = Interop.Elementary.elm_check_add(handle);
89             Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
90
91             return handle;
92         }
93     }
94 }