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;
23 /// Enumeration for the popup orientation types.
25 /// <since_tizen> preview </since_tizen>
26 [Obsolete("This has been deprecated in API12")]
27 public enum PopupOrientation
30 /// Appears in the top of parent, by default.
34 /// Appears in the center of parent.
38 /// Appears in the bottom of parent.
42 /// Appears in the left of parent.
46 /// Appears in the right of parent.
50 /// Appears in the top left of parent.
54 /// Appears in the top right of parent.
58 /// Appears in the bottom left of parent.
62 /// Appears in the bottom right of parent.
68 /// The Popup is a widget that is an enhancement of notify.
69 /// In addition to content area, there are two optional sections, namely title area and action area.
71 /// <since_tizen> preview </since_tizen>
72 [Obsolete("This has been deprecated in API12")]
73 public class Popup : Layout
75 HashSet<PopupItem> _children = new HashSet<PopupItem>();
76 SmartEvent _dismissed;
77 SmartEvent _blockClicked;
79 SmartEvent _showFinished;
82 /// Creates and initializes a new instance of the Popup class.
84 /// <param name="parent">The EvasObject to which the new popup will be attached as a child.</param>
85 /// <since_tizen> preview </since_tizen>
86 [Obsolete("This has been deprecated in API12")]
87 public Popup(EvasObject parent) : base(parent)
89 _dismissed = new SmartEvent(this, "dismissed");
90 _dismissed.On += (sender, e) =>
92 Dismissed?.Invoke(this, EventArgs.Empty);
95 _blockClicked = new SmartEvent(this, "block,clicked");
96 _blockClicked.On += (sender, e) =>
98 OutsideClicked?.Invoke(this, EventArgs.Empty);
101 _timeout = new SmartEvent(this, "timeout");
102 _timeout.On += (sender, e) =>
104 TimedOut?.Invoke(this, EventArgs.Empty);
107 _showFinished = new SmartEvent(this, "show,finished");
108 _showFinished.On += (sender, e) =>
110 ShowAnimationFinished?.Invoke(this, EventArgs.Empty);
115 /// Dismissed will be triggered when the popup has been dismissed.
117 /// <since_tizen> preview </since_tizen>
118 [Obsolete("This has been deprecated in API12")]
119 public event EventHandler Dismissed;
122 /// OutsideClicked will be triggered when users taps on the outside of Popup.
124 /// <since_tizen> preview </since_tizen>
125 [Obsolete("This has been deprecated in API12")]
126 public event EventHandler OutsideClicked;
129 /// OutsideClicked will be triggered when the popup is closed as a result of timeout.
131 /// <since_tizen> preview </since_tizen>
132 [Obsolete("This has been deprecated in API12")]
133 public event EventHandler TimedOut;
136 /// OutsideClicked will be triggered when the popup transition has finished in showing.
138 /// <since_tizen> preview </since_tizen>
139 [Obsolete("This has been deprecated in API12")]
140 public event EventHandler ShowAnimationFinished;
143 /// Sets or gets the position in which the popup will appear in its parent.
145 /// <since_tizen> preview </since_tizen>
146 [Obsolete("This has been deprecated in API12")]
147 public PopupOrientation Orientation
151 return (PopupOrientation)Interop.Elementary.elm_popup_orient_get(Handle);
155 Interop.Elementary.elm_popup_orient_set(Handle, (int)value);
160 /// Sets or gets the wrapping type of content text packed in the content area of Popup widget.
163 /// Popup need to wrap the content text, so not allowing WrapType.None.
165 /// <since_tizen> preview </since_tizen>
166 [Obsolete("This has been deprecated in API12")]
167 public WrapType ContentTextWrapType
171 return (WrapType)Interop.Elementary.elm_popup_content_text_wrap_type_get(Handle);
175 Interop.Elementary.elm_popup_content_text_wrap_type_set(Handle, (int)value);
180 /// Sets or gets the timeout value set to the popup (in seconds).
183 /// Since calling Show() on a popup restarts the timer controlling when it is hidden,
184 /// setting this before the popup is shown, will in effect mean starting the timer when the popup is shown.
185 /// TimedOut is called afterwards, which can be handled, if needed.
186 /// <![CDATA[Set a value <= 0.0 to disable a running timer. If the value is > 0.0 and the popup is previously visible,]]>
187 /// the timer will be started with this value, canceling any running timer.
189 /// <since_tizen> preview </since_tizen>
190 [Obsolete("This has been deprecated in API12")]
191 public double Timeout
195 return Interop.Elementary.elm_popup_timeout_get(Handle);
199 Interop.Elementary.elm_popup_timeout_set(Handle, value);
204 /// Sets or gets whether events should be passed to the event blocked area by a click outside.
207 /// The visible region of the popup is surrounded by a translucent region called the Blocked event area.
209 /// <since_tizen> preview </since_tizen>
210 [Obsolete("This has been deprecated in API12")]
211 public bool AllowEvents
215 return Interop.Elementary.elm_popup_allow_events_get(Handle);
219 Interop.Elementary.elm_popup_allow_events_set(Handle, value);
224 /// Sets or gets the AlignmentX in which the popup will appear in its parent.
226 /// <since_tizen> preview </since_tizen>
227 [Obsolete("This has been deprecated in API12")]
228 public override double AlignmentX
232 return Interop.Elementary.GetPopupAlignX(Handle);
236 Interop.Elementary.SetPopupAlignX(Handle, value);
241 /// Sets or gets the AlignmentY in which the popup will appear in its parent.
243 /// <since_tizen> preview </since_tizen>
244 [Obsolete("This has been deprecated in API12")]
245 public override double AlignmentY
249 return Interop.Elementary.GetPopupAlignY(Handle);
253 Interop.Elementary.SetPopupAlignY(Handle, value);
258 /// Gets the opacity value of the popup.
260 /// <since_tizen> preview </since_tizen>
261 [Obsolete("This has been deprecated in API12")]
262 public override int Opacity
266 return Color.Default.A;
271 Console.WriteLine("Popup instance doesn't support to set Opacity.");
276 /// Adds the label to a Popup widget.
278 /// <param name="label"></param>
279 /// <returns>The new PopupItem which contains a label.</returns>
280 /// <since_tizen> preview </since_tizen>
281 [Obsolete("This has been deprecated in API12")]
282 public PopupItem Append(string label)
284 return Append(label, null);
288 /// Adds the Label and icon to a Popup widget.
290 /// <param name="label">The Label, which will be added into a new PopupItem.</param>
291 /// <param name="icon">The icon, which will be added into a new PopupItem. </param>
292 /// <returns>The new PopupItem, which contains the label and icon.</returns>
293 /// <since_tizen> preview </since_tizen>
294 [Obsolete("This has been deprecated in API12")]
295 public PopupItem Append(string label, EvasObject icon)
297 PopupItem item = new PopupItem(label, icon, this);
298 item.Handle = Interop.Elementary.elm_popup_item_append(Handle, label, icon, null, (IntPtr)item.Id);
304 /// Uses this function to dismiss the popup in hide effect.
305 /// When the Popup is dismissed, the "dismissed" signal will be emitted.
307 /// <since_tizen> preview </since_tizen>
308 [Obsolete("This has been deprecated in API12")]
309 public void Dismiss()
311 Interop.Elementary.elm_popup_dismiss(Handle);
315 /// Creates a widget handle.
317 /// <param name="parent">Parent EvasObject.</param>
318 /// <returns>Handle IntPtr.</returns>
319 /// <since_tizen> preview </since_tizen>
320 [Obsolete("This has been deprecated in API12")]
321 protected override IntPtr CreateHandle(EvasObject parent)
323 return Interop.Elementary.elm_popup_add(parent.Handle);
325 void AddInternal(PopupItem item)
328 item.Deleted += Item_Deleted;
330 void Item_Deleted(object sender, EventArgs e)
332 _children.Remove((PopupItem)sender);