2 using System.Collections.Generic;
6 public class NaviframeEventArgs : EventArgs
8 public EvasObject Content { get; set; }
10 public class Naviframe : Widget
12 Interop.SmartEvent _transitionFinished;
13 readonly List<NaviItem> _itemStack = new List<NaviItem>();
14 public Naviframe(EvasObject parent) : base(parent)
16 _transitionFinished = new Interop.SmartEvent(this, Handle, "transition,finished");
17 _transitionFinished.On += (s, e) => AnimationFinished?.Invoke(this, EventArgs.Empty);
20 public event EventHandler<NaviframeEventArgs> Popped;
21 public event EventHandler AnimationFinished;
22 public IReadOnlyList<NaviItem> NavigationStack
24 get { return _itemStack; }
27 public bool PreserveContentOnPop
31 return Interop.Elementary.elm_naviframe_content_preserve_on_pop_get(Handle);
35 Interop.Elementary.elm_naviframe_content_preserve_on_pop_set(Handle, value);
39 public bool DefaultBackButtonEnabled
43 return Interop.Elementary.elm_naviframe_prev_btn_auto_pushed_get(Handle);
47 Interop.Elementary.elm_naviframe_prev_btn_auto_pushed_set(Handle, value);
51 public NaviItem Push(EvasObject content)
53 return Push(content, null);
55 public NaviItem Push(EvasObject content, string title)
57 IntPtr item = Interop.Elementary.elm_naviframe_item_push(Handle, title, IntPtr.Zero, IntPtr.Zero, content.Handle, null);
58 NaviItem naviItem = NaviItem.FromNativeHandle(item, content);
59 _itemStack.Add(naviItem);
60 naviItem.Popped += (s, e) =>
62 _itemStack.Remove(naviItem);
63 Popped?.Invoke(this, new NaviframeEventArgs() { Content = naviItem.Content });
68 public NaviItem InsertBefore(NaviItem before, EvasObject content)
70 return InsertBefore(before, content);
72 public NaviItem InsertBefore(NaviItem before, EvasObject content, string title)
74 IntPtr item = Interop.Elementary.elm_naviframe_item_insert_before(Handle, before, title, IntPtr.Zero, IntPtr.Zero, content, null);
75 NaviItem naviItem = NaviItem.FromNativeHandle(item, content);
76 int idx = _itemStack.IndexOf(before);
77 _itemStack.Insert(idx, naviItem);
83 Interop.Elementary.elm_naviframe_item_pop(Handle);
86 protected override IntPtr CreateHandle(EvasObject parent)
88 return Interop.Elementary.elm_naviframe_add(parent.Handle);