2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Collections.Generic;
21 namespace ElmSharp.Wearable
24 /// The MoreOption is a widget composed of the toggle (cue button) and more option view that can change a visibility through the toggle.
27 /// <since_tizen> preview </since_tizen>
28 [Obsolete("This has been deprecated in API12")]
29 public class MoreOption : Layout
32 /// Sets or gets the list of the more option item.
34 /// <since_tizen> preview </since_tizen>
35 [Obsolete("This has been deprecated in API12")]
36 public IList<MoreOptionItem> Items { get; private set; }
39 /// Selected will be triggered when the user selects an item.
41 /// <since_tizen> preview </since_tizen>
42 [Obsolete("This has been deprecated in API12")]
43 public event EventHandler<MoreOptionItemEventArgs> Selected;
45 /// Clicked will be triggered when the user selects the already selected item again or selects a selector.
47 /// <since_tizen> preview </since_tizen>
48 [Obsolete("This has been deprecated in API12")]
49 public event EventHandler<MoreOptionItemEventArgs> Clicked;
51 /// Opened will be triggered when the more option view is shown.
53 /// <since_tizen> preview </since_tizen>
54 [Obsolete("This has been deprecated in API12")]
55 public event EventHandler Opened;
57 /// Closed will be triggered when the more option view is hidden.
59 /// <since_tizen> preview </since_tizen>
60 [Obsolete("This has been deprecated in API12")]
61 public event EventHandler Closed;
63 SmartEvent<PointerEventArgs> _selectedEvent;
64 SmartEvent<PointerEventArgs> _clickedEvent;
65 SmartEvent _openedEvent;
66 SmartEvent _closedEvent;
69 /// Creates and initializes a new instance of the MoreOption class.
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)
76 Items = new MoreOptionList(this);
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");
83 _selectedEvent.On += (s, e) =>
85 MoreOptionItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer);
86 Selected?.Invoke(this, new MoreOptionItemEventArgs() { Item = selected });
89 _clickedEvent.On += (s, e) =>
91 MoreOptionItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer);
92 Clicked?.Invoke(this, new MoreOptionItemEventArgs() { Item = selected });
95 _openedEvent.On += (s, e) => Opened?.Invoke(this, EventArgs.Empty);
96 _closedEvent.On += (s, e) => Closed?.Invoke(this, EventArgs.Empty);
101 /// Creates a widget handle.
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)
109 return Interop.Eext.eext_more_option_add(parent);
113 /// Sets or gets the direction of more option.
115 /// <since_tizen> preview </since_tizen>
116 [Obsolete("This has been deprecated in API12")]
117 public MoreOptionDirection Direction
121 int dir = Interop.Eext.eext_more_option_direction_get(this);
122 return (MoreOptionDirection)dir;
127 Interop.Eext.eext_more_option_direction_set(this, (int)value);
132 /// Sets or gets the visibility of the more option view.
134 /// <since_tizen> preview </since_tizen>
135 [Obsolete("This has been deprecated in API12")]
140 return Interop.Eext.eext_more_option_opened_get(this);
145 Interop.Eext.eext_more_option_opened_set(this, value);
151 /// Enumeration for the more option direction types.
153 /// <since_tizen> preview </since_tizen>
154 [Obsolete("This has been deprecated in API12")]
155 public enum MoreOptionDirection
162 /// Bottom direction.