[ACR-564] deprecate unused API
[platform/core/csapi/tizenfx.git] / src / ElmSharp.Wearable / ElmSharp.Wearable / MoreOption.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 using System.Linq;
20
21 namespace ElmSharp.Wearable
22 {
23     /// <summary>
24     /// The MoreOption is a widget composed of the toggle (cue button) and more option view that can change a visibility through the toggle.
25     /// Inherits Layout
26     /// </summary>
27     /// <since_tizen> preview </since_tizen>
28     [Obsolete("This has been deprecated in API12")]
29     public class MoreOption : Layout
30     {
31         /// <summary>
32         /// Sets or gets the list of the more option item.
33         /// </summary>
34         /// <since_tizen> preview </since_tizen>
35         [Obsolete("This has been deprecated in API12")]
36         public IList<MoreOptionItem> Items { get; private set; }
37
38         /// <summary>
39         /// Selected will be triggered when the user selects an item.
40         /// </summary>
41         /// <since_tizen> preview </since_tizen>
42         [Obsolete("This has been deprecated in API12")]
43         public event EventHandler<MoreOptionItemEventArgs> Selected;
44         /// <summary>
45         /// Clicked will be triggered when the user selects the already selected item again or selects a selector.
46         /// </summary>
47         /// <since_tizen> preview </since_tizen>
48         [Obsolete("This has been deprecated in API12")]
49         public event EventHandler<MoreOptionItemEventArgs> Clicked;
50         /// <summary>
51         /// Opened will be triggered when the more option view is shown.
52         /// </summary>
53         /// <since_tizen> preview </since_tizen>
54         [Obsolete("This has been deprecated in API12")]
55         public event EventHandler Opened;
56         /// <summary>
57         /// Closed will be triggered when the more option view is hidden.
58         /// </summary>
59         /// <since_tizen> preview </since_tizen>
60         [Obsolete("This has been deprecated in API12")]
61         public event EventHandler Closed;
62
63         SmartEvent<PointerEventArgs> _selectedEvent;
64         SmartEvent<PointerEventArgs> _clickedEvent;
65         SmartEvent _openedEvent;
66         SmartEvent _closedEvent;
67
68         /// <summary>
69         /// Creates and initializes a new instance of the MoreOption class.
70         /// </summary>
71         /// <param name="parent">The parent is a given container, which will be attached by the MoreOption as a child. It's <see cref="EvasObject"/> type.</param>
72         /// <since_tizen> preview </since_tizen>
73         [Obsolete("This has been deprecated in API12")]
74         public MoreOption(EvasObject parent) : base(parent)
75         {
76             Items = new MoreOptionList(this);
77
78             _selectedEvent = new SmartEvent<PointerEventArgs>(this, "item,selected", (d, o, info) => new PointerEventArgs { Pointer = info });
79             _clickedEvent = new SmartEvent<PointerEventArgs>(this, "item,clicked", (d, o, info) => new PointerEventArgs { Pointer = info });
80             _openedEvent = new SmartEvent(this, "more,option,opened");
81             _closedEvent = new SmartEvent(this, "more,option,closed");
82
83             _selectedEvent.On += (s, e) =>
84             {
85                 MoreOptionItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer);
86                 Selected?.Invoke(this, new MoreOptionItemEventArgs() { Item = selected });
87             };
88
89             _clickedEvent.On += (s, e) =>
90             {
91                 MoreOptionItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer);
92                 Clicked?.Invoke(this, new MoreOptionItemEventArgs() { Item = selected });
93             };
94
95             _openedEvent.On += (s, e) => Opened?.Invoke(this, EventArgs.Empty);
96             _closedEvent.On += (s, e) => Closed?.Invoke(this, EventArgs.Empty);
97
98         }
99
100         /// <summary>
101         /// Creates a widget handle.
102         /// </summary>
103         /// <param name="parent">Parent EvasObject.</param>
104         /// <returns>Handle IntPtr.</returns>
105         /// <since_tizen> preview </since_tizen>
106         [Obsolete("This has been deprecated in API12")]
107         protected override IntPtr CreateHandle(EvasObject parent)
108         {
109             return Interop.Eext.eext_more_option_add(parent);
110         }
111
112         /// <summary>
113         /// Sets or gets the direction of more option.
114         /// </summary>
115         /// <since_tizen> preview </since_tizen>
116         [Obsolete("This has been deprecated in API12")]
117         public MoreOptionDirection Direction
118         {
119             get
120             {
121                 int dir = Interop.Eext.eext_more_option_direction_get(this);
122                 return (MoreOptionDirection)dir;
123             }
124
125             set
126             {
127                 Interop.Eext.eext_more_option_direction_set(this, (int)value);
128             }
129         }
130
131         /// <summary>
132         /// Sets or gets the visibility of the more option view.
133         /// </summary>
134         /// <since_tizen> preview </since_tizen>
135         [Obsolete("This has been deprecated in API12")]
136         public bool IsOpened
137         {
138             get
139             {
140                 return Interop.Eext.eext_more_option_opened_get(this);
141             }
142
143             set
144             {
145                 Interop.Eext.eext_more_option_opened_set(this, value);
146             }
147         }
148     }
149
150     /// <summary>
151     /// Enumeration for the more option direction types.
152     /// </summary>
153     /// <since_tizen> preview </since_tizen>
154     [Obsolete("This has been deprecated in API12")]
155     public enum MoreOptionDirection
156     {
157         /// <summary>
158         /// Top direction.
159         /// </summary>
160         Top,
161         /// <summary>
162         /// Bottom direction.
163         /// </summary>
164         Bottom,
165         /// <summary>
166         /// Left direction.
167         /// </summary>
168         Left,
169         /// <summary>
170         /// Right direction.
171         /// </summary>
172         Right
173     }
174 }