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 /// The NaviframeEventArgs is an event arguments class for naviframe.
24 /// Inherits EventArgs.
26 /// <since_tizen> preview </since_tizen>
27 [Obsolete("This has been deprecated in API12")]
28 public class NaviframeEventArgs : EventArgs
31 /// Sets or gets the content object. The name of the content part is "elm.swallow.content".
33 /// <since_tizen> preview </since_tizen>
34 [Obsolete("This has been deprecated in API12")]
35 public EvasObject Content { get; set; }
38 /// The Naviframe is a widget to stand for the navigation frame. It's a views manager for applications.
41 /// <since_tizen> preview </since_tizen>
42 [Obsolete("This has been deprecated in API12")]
43 public class Naviframe : Widget
45 SmartEvent _transitionFinished;
46 readonly List<NaviItem> _itemStack = new List<NaviItem>();
49 /// Creates and initializes a new instance of the Naviframe class.
51 /// <param name="parent">The parent is a given container which will be attached by Naviframe as a child. It's <see cref="EvasObject"/> type.</param>
52 /// <since_tizen> preview </since_tizen>
53 [Obsolete("This has been deprecated in API12")]
54 public Naviframe(EvasObject parent) : base(parent)
56 _transitionFinished = new SmartEvent(this, this.RealHandle, "transition,finished");
57 _transitionFinished.On += (s, e) => AnimationFinished?.Invoke(this, EventArgs.Empty);
61 /// Popped will be triggered when the NaviItem is removed.
64 /// It is always called when the NaviItem is removed.
65 /// (even if removed by NaviItem.Delete())
66 /// This event will be invoked in progress of the Pop/Delete operation.
67 /// After calling the Popped event, the Pop/Delete method will be returned.
69 /// <since_tizen> preview </since_tizen>
70 [Obsolete("This has been deprecated in API12")]
71 public event EventHandler<NaviframeEventArgs> Popped;
74 /// AnimationFinished will be triggered when the animation is finished.
76 /// <since_tizen> preview </since_tizen>
77 [Obsolete("This has been deprecated in API12")]
78 public event EventHandler AnimationFinished;
81 /// Gets the list of the navi item.
83 /// <since_tizen> preview </since_tizen>
84 [Obsolete("This has been deprecated in API12")]
85 public IReadOnlyList<NaviItem> NavigationStack
87 get { return _itemStack; }
91 /// Sets or gets the preserve content objects when items are popped.
93 /// <since_tizen> preview </since_tizen>
94 [Obsolete("This has been deprecated in API12")]
95 public bool PreserveContentOnPop
99 return Interop.Elementary.elm_naviframe_content_preserve_on_pop_get(RealHandle);
103 Interop.Elementary.elm_naviframe_content_preserve_on_pop_set(RealHandle, value);
108 /// Sets or gets whether the default back button is enabled.
110 /// <since_tizen> preview </since_tizen>
111 [Obsolete("This has been deprecated in API12")]
112 public bool DefaultBackButtonEnabled
116 return Interop.Elementary.elm_naviframe_prev_btn_auto_pushed_get(RealHandle);
120 Interop.Elementary.elm_naviframe_prev_btn_auto_pushed_set(RealHandle, value);
125 /// Pushes a new item to the top of the naviframe stack and shows it.
126 /// The title and style are null.
128 /// <param name="content">The main content object. The name of the content part is "elm.swallow.content".</param>
129 /// <returns>The created item, or null upon failure.</returns>
130 /// <since_tizen> preview </since_tizen>
131 [Obsolete("This has been deprecated in API12")]
132 public NaviItem Push(EvasObject content)
134 return Push(content, null);
138 /// Pushes a new item to the top of the naviframe stack and shows it.
139 /// The style is null.
141 /// <param name="content">The main content object. The name of the content part is "elm.swallow.content".</param>
142 /// <param name="title">The current item title. Null would be default.</param>
143 /// <returns></returns>
144 /// <since_tizen> preview </since_tizen>
145 [Obsolete("This has been deprecated in API12")]
146 public NaviItem Push(EvasObject content, string title)
148 return Push(content, title, null);
152 /// Pushes a new item to the top of the naviframe stack and shows it.
154 /// <param name="content">The main content object. The name of the content part is "elm.swallow.content".</param>
155 /// <param name="title">The current item title. Null would be default.</param>
156 /// <param name="style">The current item style name. Null would be default.</param>
157 /// <returns>The created item, or null upon failure.</returns>
158 /// <since_tizen> preview </since_tizen>
159 [Obsolete("This has been deprecated in API12")]
160 public NaviItem Push(EvasObject content, string title, string style)
162 IntPtr item = Interop.Elementary.elm_naviframe_item_push(RealHandle, title, IntPtr.Zero, IntPtr.Zero, content.Handle, style);
163 NaviItem naviItem = NaviItem.FromNativeHandle(item, content, this);
164 _itemStack.Add(naviItem);
165 naviItem.Popped += ItemPoppedHandler;
170 /// Inserts a new item into the naviframe before the item.
171 /// The title is "" and the style is null.
173 /// <param name="before">The item for which a new item is inserted before.</param>
174 /// <param name="content">The main content object. The name of the content part is "elm.swallow.content".</param>
175 /// <returns>The created item, or null upon failure.</returns>
176 /// <since_tizen> preview </since_tizen>
177 [Obsolete("This has been deprecated in API12")]
178 public NaviItem InsertBefore(NaviItem before, EvasObject content)
180 return InsertBefore(before, content, "");
184 /// Inserts a new item into the naviframe before the item.
185 /// The style is null.
187 /// <param name="before">The item for which a new item is inserted before.</param>
188 /// <param name="content">The main content object. The name of the content part is "elm.swallow.content".</param>
189 /// <param name="title">The current item title. Null would be default.</param>
190 /// <returns>The created item, or null upon failure.</returns>
191 /// <since_tizen> preview </since_tizen>
192 [Obsolete("This has been deprecated in API12")]
193 public NaviItem InsertBefore(NaviItem before, EvasObject content, string title)
195 return InsertBefore(before, content, title, null);
199 /// Inserts a new item into the naviframe before the item.
201 /// <param name="before">The item for which a new item is inserted before.</param>
202 /// <param name="content">The main content object. The name of the content part is "elm.swallow.content".</param>
203 /// <param name="title">The current item title. Null would be default.</param>
204 /// <param name="style">The current item style name. Null would be default.</param>
205 /// <returns>The created item, or null upon failure.</returns>
206 /// <since_tizen> preview </since_tizen>
207 [Obsolete("This has been deprecated in API12")]
208 public NaviItem InsertBefore(NaviItem before, EvasObject content, string title, string style)
210 IntPtr item = Interop.Elementary.elm_naviframe_item_insert_before(RealHandle, before, title, IntPtr.Zero, IntPtr.Zero, content, null);
211 NaviItem naviItem = NaviItem.FromNativeHandle(item, content, this);
212 int idx = _itemStack.IndexOf(before);
213 _itemStack.Insert(idx, naviItem);
214 naviItem.Popped += ItemPoppedHandler;
219 /// Inserts a new item into the naviframe after the item.
220 /// The title is "" and the style is null.
222 /// <param name="after">The item for which a new item is inserted after.</param>
223 /// <param name="content">The main content object. The name of the content part is "elm.swallow.content".</param>
224 /// <returns>The created item, or null upon failure.</returns>
225 /// <since_tizen> preview </since_tizen>
226 [Obsolete("This has been deprecated in API12")]
227 public NaviItem InsertAfter(NaviItem after, EvasObject content)
229 return InsertAfter(after, content, "");
233 /// Inserts a new item into the naviframe after the item.
234 /// The style is null.
236 /// <param name="after">The item which a new item is inserted after.</param>
237 /// <param name="content">The main content object. The name of the content part is "elm.swallow.content".</param>
238 /// <param name="title">The current item title. Null would be default.</param>
239 /// <returns>The created item, or null upon failure.</returns>
240 /// <since_tizen> preview </since_tizen>
241 [Obsolete("This has been deprecated in API12")]
242 public NaviItem InsertAfter(NaviItem after, EvasObject content, string title)
244 return InsertAfter(after, content, title, null);
248 /// Inserts a new item into the naviframe after the item.
250 /// <param name="after">The item for which a new item is inserted after.</param>
251 /// <param name="content">The main content object. The name of the content part is "elm.swallow.content".</param>
252 /// <param name="title">The current item title. Null would be default.</param>
253 /// <param name="style">The current item style name. Null would be default.</param>
254 /// <returns>The created item, or null upon failure.</returns>
255 /// <since_tizen> preview </since_tizen>
256 [Obsolete("This has been deprecated in API12")]
257 public NaviItem InsertAfter(NaviItem after, EvasObject content, string title, string style)
259 IntPtr item = Interop.Elementary.elm_naviframe_item_insert_after(RealHandle, after, title, IntPtr.Zero, IntPtr.Zero, content, null);
260 NaviItem naviItem = NaviItem.FromNativeHandle(item, content, this);
261 int idx = _itemStack.IndexOf(after);
262 _itemStack.Insert(idx + 1, naviItem);
263 naviItem.Popped += ItemPoppedHandler;
268 /// Pops an item that is on top of the stack.
270 /// <since_tizen> preview </since_tizen>
271 [Obsolete("This has been deprecated in API12")]
274 Interop.Elementary.elm_naviframe_item_pop(RealHandle);
278 /// Creates a widget handle.
280 /// <param name="parent">Parent EvasObject.</param>
281 /// <returns>Handle IntPtr.</returns>
282 /// <since_tizen> preview </since_tizen>
283 [Obsolete("This has been deprecated in API12")]
284 protected override IntPtr CreateHandle(EvasObject parent)
286 IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle);
287 Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default");
289 RealHandle = Interop.Elementary.elm_naviframe_add(handle);
290 Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle);
295 void ItemPoppedHandler(object sender, EventArgs e)
297 NaviItem item = sender as NaviItem;
300 _itemStack.Remove(item);
301 Popped?.Invoke(this, new NaviframeEventArgs { Content = item.Content });