2 using System.Collections.Generic;
6 public class Index : Layout
8 HashSet<IndexItem> _children = new HashSet<IndexItem>();
9 Interop.SmartEvent _delayedChanged;
11 public Index(EvasObject parent) : base(parent)
13 _delayedChanged = new Interop.SmartEvent(this, Handle, "delay,changed");
14 _delayedChanged.On += _delayedChanged_On;
17 public event EventHandler Changed;
23 return !Interop.Elementary.elm_index_autohide_disabled_get(Handle);
27 Interop.Elementary.elm_index_autohide_disabled_set(Handle, !value);
31 public bool IsHorizontal
35 return Interop.Elementary.elm_index_horizontal_get(Handle);
39 Interop.Elementary.elm_index_horizontal_set(Handle, value);
43 public bool IndicatorVisible
47 return !Interop.Elementary.elm_index_indicator_disabled_get(Handle);
51 Interop.Elementary.elm_index_indicator_disabled_set(Handle, !value);
55 public bool OmitEnabled
59 return Interop.Elementary.elm_index_omit_enabled_get(Handle);
63 Interop.Elementary.elm_index_omit_enabled_set(Handle, value);
67 public IndexItem SelectedItem
71 IntPtr handle = Interop.Elementary.elm_index_selected_item_get(Handle, 0);
72 return ItemObject.GetItemByHandle(handle) as IndexItem;
76 public IndexItem Append(string label)
78 IndexItem item = new IndexItem(label);
79 item.Handle = Interop.Elementary.elm_index_item_append(Handle, label, null, (IntPtr)item.Id);
83 public IndexItem Prepend(string label)
85 IndexItem item = new IndexItem(label);
86 item.Handle = Interop.Elementary.elm_index_item_prepend(Handle, label, null, (IntPtr)item.Id);
90 public IndexItem InsertBefore(string label, IndexItem before)
92 IndexItem item = new IndexItem(label);
93 item.Handle = Interop.Elementary.elm_index_item_insert_before(Handle, before, label, null, (IntPtr)item.Id);
97 public void Update(int level)
99 Interop.Elementary.elm_index_level_go(Handle, level);
102 protected override IntPtr CreateHandle(EvasObject parent)
104 return Interop.Elementary.elm_index_add(parent);
107 void _delayedChanged_On(object sender, EventArgs e)
109 SelectedItem?.SendSelected();
110 Changed?.Invoke(this, e);
113 void AddInternal(IndexItem item)
116 item.Deleted += Item_Deleted;
119 void Item_Deleted(object sender, EventArgs e)
121 _children.Remove((IndexItem)sender);