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.
22 /// The HoverselItemEventArgs is a HoverselItem's EventArgs.
24 /// <since_tizen> preview </since_tizen>
25 [Obsolete("This has been deprecated in API12")]
26 public class HoverselItemEventArgs : EventArgs
29 /// The hoversel's item.
31 /// <since_tizen> preview </since_tizen>
32 [Obsolete("This has been deprecated in API12")]
33 public HoverselItem Item { get; set; }
35 internal static HoverselItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)
37 HoverselItem item = ItemObject.GetItemByHandle(info) as HoverselItem;
38 return new HoverselItemEventArgs { Item = item };
43 /// The hoversel is a button that pops up a list of items.
45 /// <since_tizen> preview </since_tizen>
46 [Obsolete("This has been deprecated in API12")]
47 public class Hoversel : Layout
51 SmartEvent _dismissed;
52 SmartEvent<HoverselItemEventArgs> _selected;
53 Interop.Evas.SmartCallback _onItemSelected;
56 /// Creates and initializes a new instance of the Hoversel class.
58 /// <param name="parent">The parent is a given container, which will be attached by Hoversel as a child. It's <see cref="EvasObject"/> type.</param>
59 /// <since_tizen> preview </since_tizen>
60 [Obsolete("This has been deprecated in API12")]
61 public Hoversel(EvasObject parent) : base(parent)
63 _clicked = new SmartEvent(this, "clicked");
64 _clicked.On += (sender, e) =>
66 Clicked?.Invoke(this, EventArgs.Empty);
68 _expanded = new SmartEvent(this, "expanded");
69 _expanded.On += (sender, e) =>
71 Expanded?.Invoke(this, EventArgs.Empty);
73 _dismissed = new SmartEvent(this, "dismissed");
74 _dismissed.On += (sender, e) =>
76 Dismissed?.Invoke(this, EventArgs.Empty);
78 _selected = new SmartEvent<HoverselItemEventArgs>(this, RealHandle, "selected", HoverselItemEventArgs.CreateFromSmartEvent);
79 _selected.On += (s, e) =>
81 if (e.Item != null) ItemSelected?.Invoke(this, e);
83 _onItemSelected = (data, obj, info) =>
85 HoverselItem item = ItemObject.GetItemById((int)data) as HoverselItem;
86 item?.SendItemSelected();
91 /// Clicked will be triggered when the hoversel is clicked.
93 /// <since_tizen> preview </since_tizen>
94 [Obsolete("This has been deprecated in API12")]
95 public event EventHandler Clicked;
98 /// Expanded will be triggered when the hoversel is activated by clicking the hoversel, or by a function.
100 /// <since_tizen> preview </since_tizen>
101 [Obsolete("This has been deprecated in API12")]
102 public event EventHandler Expanded;
105 /// Dismissed will be triggered when the hoversel is dismissed.
107 /// <since_tizen> preview </since_tizen>
108 [Obsolete("This has been deprecated in API12")]
109 public event EventHandler Dismissed;
112 /// ItemSelected will be triggered when the hoversel's item is selected.
114 /// <since_tizen> preview </since_tizen>
115 [Obsolete("This has been deprecated in API12")]
116 public event EventHandler<HoverselItemEventArgs> ItemSelected;
119 /// Gets or sets the status to control whether the hoversel should expand horizontally.
121 /// <since_tizen> preview </since_tizen>
122 [Obsolete("This has been deprecated in API12")]
123 public bool IsHorizontal
127 return Interop.Elementary.elm_hoversel_horizontal_get(RealHandle);
131 Interop.Elementary.elm_hoversel_horizontal_set(RealHandle, value);
136 /// Gets or sets the hover parent.
138 /// <since_tizen> preview </since_tizen>
139 [Obsolete("This has been deprecated in API12")]
140 public IntPtr HoverParent
144 return Interop.Elementary.elm_hoversel_hover_parent_get(RealHandle);
148 Interop.Elementary.elm_hoversel_hover_parent_set(RealHandle, value);
153 /// Gets the flag of whether the hoversel is expanded.
155 /// <since_tizen> preview </since_tizen>
156 [Obsolete("This has been deprecated in API12")]
157 public bool IsExpanded
161 return Interop.Elementary.elm_hoversel_expanded_get(RealHandle);
166 /// Gets or sets the status of whether to update the icon and text of hoversel same to those of the selected item automatically.
168 /// <since_tizen> preview </since_tizen>
169 [Obsolete("This has been deprecated in API12")]
170 public bool AutoUpdate
174 return Interop.Elementary.elm_hoversel_auto_update_get(RealHandle);
178 Interop.Elementary.elm_hoversel_auto_update_set(RealHandle, value);
183 /// This triggers the hoversel popup from the code, the same as if the user had clicked the button.
185 /// <since_tizen> preview </since_tizen>
186 [Obsolete("This has been deprecated in API12")]
187 public void HoverBegin()
189 Interop.Elementary.elm_hoversel_hover_begin(RealHandle);
193 /// This dismisses the hoversel popup as if the user had clicked outside the hover.
195 /// <since_tizen> preview </since_tizen>
196 [Obsolete("This has been deprecated in API12")]
197 public void HoverEnd()
199 Interop.Elementary.elm_hoversel_hover_end(RealHandle);
203 /// This will remove all the children items from the hoversel.
205 /// <since_tizen> preview </since_tizen>
206 [Obsolete("This has been deprecated in API12")]
209 Interop.Elementary.elm_hoversel_clear(RealHandle);
213 /// Adds an item to the hoversel button.
214 /// This adds an item to the hoversel to show when it is clicked.
216 /// <param name="label">Item's label.</param>
217 /// <returns>A handle to the added item.</returns>
218 /// <since_tizen> preview </since_tizen>
219 [Obsolete("This has been deprecated in API12")]
220 public HoverselItem AddItem(string label)
222 HoverselItem item = new HoverselItem(this);
224 item.Handle = Interop.Elementary.elm_hoversel_item_add(RealHandle, label, null, 0, _onItemSelected, (IntPtr)item.Id);
229 /// Creates a widget handle.
231 /// <param name="parent">Parent EvasObject.</param>
232 /// <returns>Handle IntPtr.</returns>
233 /// <since_tizen> preview </since_tizen>
234 [Obsolete("This has been deprecated in API12")]
235 protected override IntPtr CreateHandle(EvasObject parent)
237 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
238 Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default");
240 RealHandle = Interop.Elementary.elm_hoversel_add(handle);
241 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);