From eff795357566793ac33b35a09d1197a25560edd8 Mon Sep 17 00:00:00 2001 From: SungHyun Min Date: Tue, 18 Apr 2017 20:26:09 +0900 Subject: [PATCH] Add Entry property in MultiButtonEntry - to provide the functionalities of the entry in MultiButtonEntry Change-Id: Ib6935a385685f68554f0364dacd032254409eec2 Signed-off-by: SungHyun Min --- src/ElmSharp/ElmSharp/MultiButtonEntry.cs | 59 +++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/src/ElmSharp/ElmSharp/MultiButtonEntry.cs b/src/ElmSharp/ElmSharp/MultiButtonEntry.cs index 1414559..475f01f 100755 --- a/src/ElmSharp/ElmSharp/MultiButtonEntry.cs +++ b/src/ElmSharp/ElmSharp/MultiButtonEntry.cs @@ -30,6 +30,7 @@ namespace ElmSharp { HashSet _children = new HashSet(); List> _filters = new List>(); + Entry _entry = null; Interop.Elementary.MultiButtonEntryItemFilterCallback _filtercallback; @@ -124,7 +125,7 @@ namespace ElmSharp { get { - IntPtr handle = Interop.Elementary.elm_multibuttonentry_selected_item_get(Handle); + IntPtr handle = Interop.Elementary.elm_multibuttonentry_selected_item_get(RealHandle); return ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; } } @@ -136,11 +137,11 @@ namespace ElmSharp { get { - return Interop.Elementary.elm_multibuttonentry_editable_get(Handle); + return Interop.Elementary.elm_multibuttonentry_editable_get(RealHandle); } set { - Interop.Elementary.elm_multibuttonentry_editable_set(Handle, value); + Interop.Elementary.elm_multibuttonentry_editable_set(RealHandle, value); } } @@ -153,11 +154,11 @@ namespace ElmSharp { get { - return Interop.Elementary.elm_multibuttonentry_expanded_get(Handle); + return Interop.Elementary.elm_multibuttonentry_expanded_get(RealHandle); } set { - Interop.Elementary.elm_multibuttonentry_expanded_set(Handle, value); + Interop.Elementary.elm_multibuttonentry_expanded_set(RealHandle, value); } } @@ -168,7 +169,7 @@ namespace ElmSharp { get { - IntPtr handle = Interop.Elementary.elm_multibuttonentry_first_item_get(Handle); + IntPtr handle = Interop.Elementary.elm_multibuttonentry_first_item_get(RealHandle); return ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; } } @@ -180,11 +181,27 @@ namespace ElmSharp { get { - IntPtr handle = Interop.Elementary.elm_multibuttonentry_last_item_get(Handle); + IntPtr handle = Interop.Elementary.elm_multibuttonentry_last_item_get(RealHandle); return ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; } } + /// + /// Gets the entry object int the multibuttonentry. + /// + public Entry Entry + { + get + { + if (_entry == null) + { + _entry = new EntryInner(this); + } + + return _entry; + } + } + protected override IntPtr CreateHandle(EvasObject parent) { return Interop.Elementary.elm_multibuttonentry_add(parent.Handle); @@ -197,7 +214,7 @@ namespace ElmSharp /// A MultiButtonEntryItem to the item added. public MultiButtonEntryItem Append(string label) { - var handle = Interop.Elementary.elm_multibuttonentry_item_append(Handle, label, null, IntPtr.Zero); + var handle = Interop.Elementary.elm_multibuttonentry_item_append(RealHandle, label, null, IntPtr.Zero); MultiButtonEntryItem item = ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; return item; } @@ -209,7 +226,7 @@ namespace ElmSharp /// A MultiButtonEntryItem to the item added. public MultiButtonEntryItem Prepend(string label) { - var handle = Interop.Elementary.elm_multibuttonentry_item_prepend(Handle, label, null, IntPtr.Zero); + var handle = Interop.Elementary.elm_multibuttonentry_item_prepend(RealHandle, label, null, IntPtr.Zero); MultiButtonEntryItem item = ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; return item; } @@ -222,7 +239,7 @@ namespace ElmSharp /// A MultiButtonEntryItem to the item added. public MultiButtonEntryItem InsertBefore(MultiButtonEntryItem before, string label) { - var handle = Interop.Elementary.elm_multibuttonentry_item_insert_before(Handle, before.Handle, label, null, IntPtr.Zero); + var handle = Interop.Elementary.elm_multibuttonentry_item_insert_before(RealHandle, before.Handle, label, null, IntPtr.Zero); MultiButtonEntryItem item = ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; return item; } @@ -235,7 +252,7 @@ namespace ElmSharp /// A MultiButtonEntryItem to the item added. public MultiButtonEntryItem InsertAfter(MultiButtonEntryItem after, string label) { - var handle = Interop.Elementary.elm_multibuttonentry_item_insert_after(Handle, after.Handle, label, null, IntPtr.Zero); + var handle = Interop.Elementary.elm_multibuttonentry_item_insert_after(RealHandle, after.Handle, label, null, IntPtr.Zero); MultiButtonEntryItem item = ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; return item; } @@ -245,7 +262,7 @@ namespace ElmSharp /// public void Clear() { - Interop.Elementary.elm_multibuttonentry_clear(Handle); + Interop.Elementary.elm_multibuttonentry_clear(RealHandle); _children.Clear(); } @@ -258,7 +275,7 @@ namespace ElmSharp _filters.Add(func); if (_filters.Count == 1) { - Interop.Elementary.elm_multibuttonentry_item_filter_append(Handle, _filtercallback, IntPtr.Zero); + Interop.Elementary.elm_multibuttonentry_item_filter_append(RealHandle, _filtercallback, IntPtr.Zero); } } @@ -271,7 +288,7 @@ namespace ElmSharp _filters.Insert(0, func); if (_filters.Count == 1) { - Interop.Elementary.elm_multibuttonentry_item_filter_prepend(Handle, _filtercallback, IntPtr.Zero); + Interop.Elementary.elm_multibuttonentry_item_filter_prepend(RealHandle, _filtercallback, IntPtr.Zero); } } @@ -284,7 +301,7 @@ namespace ElmSharp _filters.Remove(func); if (_filters.Count == 0) { - Interop.Elementary.elm_multibuttonentry_item_filter_remove(Handle, _filtercallback, IntPtr.Zero); + Interop.Elementary.elm_multibuttonentry_item_filter_remove(RealHandle, _filtercallback, IntPtr.Zero); } } @@ -315,6 +332,18 @@ namespace ElmSharp } return true; } + + internal class EntryInner : Entry + { + internal EntryInner(EvasObject parent) : base(parent) + { + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_multibuttonentry_entry_get(parent.Handle); + } + } } /// -- 2.7.4