[ElmSharp] Added Parent property to ItemObject and new event for automation test...
authorarosis78 <35049857+arosis78@users.noreply.github.com>
Mon, 28 Jan 2019 08:43:28 +0000 (17:43 +0900)
committerKangho Hur <rookiejava+github@gmail.com>
Mon, 28 Jan 2019 08:43:28 +0000 (17:43 +0900)
* [ElmSharp] Added new event for automation test

* [ElmSharp] Added parent property to ItemObject

* [ElmSharp] modified to create new constructor

* Update TestRunner.cs

* Update MultiButtonEntry.cs

* Update ListItem.cs

* Update NaviItem.cs

* Update MultiButtonEntry.cs

* [ElmSharp] changed Parent parameter location

* [ElmSharp] Update NaviItem.c

28 files changed:
src/ElmSharp/ElmSharp/ColorSelector.cs
src/ElmSharp/ElmSharp/ColorSelectorItem.cs
src/ElmSharp/ElmSharp/ContextPopup.cs
src/ElmSharp/ElmSharp/ContextPopupItem.cs
src/ElmSharp/ElmSharp/Elementary.cs
src/ElmSharp/ElmSharp/FlipSelector.cs
src/ElmSharp/ElmSharp/FlipSelectorItem.cs
src/ElmSharp/ElmSharp/GenGrid.cs
src/ElmSharp/ElmSharp/GenGridItem.cs
src/ElmSharp/ElmSharp/GenItem.cs
src/ElmSharp/ElmSharp/GenList.cs
src/ElmSharp/ElmSharp/GenListItem.cs
src/ElmSharp/ElmSharp/Hoversel.cs
src/ElmSharp/ElmSharp/HoverselItem.cs
src/ElmSharp/ElmSharp/Index.cs
src/ElmSharp/ElmSharp/IndexItem.cs
src/ElmSharp/ElmSharp/ItemObject.cs
src/ElmSharp/ElmSharp/List.cs
src/ElmSharp/ElmSharp/ListItem.cs
src/ElmSharp/ElmSharp/MultiButtonEntry.cs
src/ElmSharp/ElmSharp/MultiButtonEntryItem.cs
src/ElmSharp/ElmSharp/NaviItem.cs
src/ElmSharp/ElmSharp/Naviframe.cs
src/ElmSharp/ElmSharp/Popup.cs
src/ElmSharp/ElmSharp/PopupItem.cs
src/ElmSharp/ElmSharp/Toolbar.cs
src/ElmSharp/ElmSharp/ToolbarItem.cs
test/ElmSharp.Test/TestRunner.cs

index eb7210e6f0ced7f2dae2adc02b2727208190cfb9..ce86f7560d05d98329e60bfc1beadd3e89a64ba1 100644 (file)
@@ -177,7 +177,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public ColorSelectorItem AddPaletteColor(Color color)
         {
-            ColorSelectorItem item = new ColorSelectorItem();
+            ColorSelectorItem item = new ColorSelectorItem(this);
             item.Handle = Interop.Elementary.elm_colorselector_palette_color_add(Handle, color.R, color.G, color.B, color.A);
             return item;
         }
index 4ec12c4be669f1fd90abdf5d72726157577f9e48..87cd28a068cbfec0cd41e5227f1102bbb9b51190 100644 (file)
@@ -28,6 +28,10 @@ namespace ElmSharp
         {
         }
 
+        internal ColorSelectorItem(EvasObject parent) : base(IntPtr.Zero, parent)
+        {
+        }
+
         /// <summary>
         /// Gets or sets the palette item's color.
         /// </summary>
index 5b89aea9875f3f84b8605e866062dad271fc258e..db1a00e2208dfc6cce752028039eb60970eb58cd 100644 (file)
@@ -201,7 +201,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public ContextPopupItem Append(string label, EvasObject icon)
         {
-            ContextPopupItem item = new ContextPopupItem(label, icon);
+            ContextPopupItem item = new ContextPopupItem(label, icon, this);
             item.Handle = Interop.Elementary.elm_ctxpopup_item_append(RealHandle, label, icon, _onSelected, (IntPtr)item.Id);
             AddInternal(item);
             return item;
index 91c62d67ec2e23e88a8d7260b8034dd86d96f96b..0478f0561da1bc654d77e7cea047b2216d9c3d72 100644 (file)
@@ -31,6 +31,12 @@ namespace ElmSharp
             Icon = icon;
         }
 
+        internal ContextPopupItem(string text, EvasObject icon, EvasObject parent) : base(IntPtr.Zero, parent)
+        {
+            Text = text;
+            Icon = icon;
+        }
+
         /// <summary>
         /// Gets the Text property of the given ContextPopupItem.
         /// </summary>
index 1fbd4ebc32063bbf7358a31111c7d5bb2d20924a..b12d5f4de667a498df6aeba50462783abb130736 100644 (file)
@@ -55,12 +55,23 @@ namespace ElmSharp
         /// </summary>
         /// <since_tizen> preview </since_tizen>
         public static event EventHandler EvasObjectRealized;
-        
+
+        /// <summary>
+        /// ItemObjectRealized will be triggered when the ItemObject is realized.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
+        public static event EventHandler ItemObjectRealized;
+
         internal static void SendEvasObjectRealized(EvasObject obj)
         {
             EvasObjectRealized?.Invoke(obj, EventArgs.Empty);
         }
 
+        internal static void SendItemObjectRealized(ItemObject obj)
+        {
+            ItemObjectRealized?.Invoke(obj, EventArgs.Empty);
+        }
+
         /// <summary>
         /// Gets or sets the configured finger size.
         /// </summary>
index 760798e547bd9e417b9e188f013ca2f1eafa36a5..969c4e0e32bfe96a11dffc48c59b013c00e5cce8 100644 (file)
@@ -130,7 +130,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public FlipSelectorItem Append(string text)
         {
-            FlipSelectorItem item = new FlipSelectorItem(text);
+            FlipSelectorItem item = new FlipSelectorItem(text, this);
             item.Handle = Interop.Elementary.elm_flipselector_item_append(Handle, text, null, (IntPtr)item.Id);
             return item;
         }
@@ -146,7 +146,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public FlipSelectorItem Prepend(string text)
         {
-            FlipSelectorItem item = new FlipSelectorItem(text);
+            FlipSelectorItem item = new FlipSelectorItem(text, this);
             item.Handle = Interop.Elementary.elm_flipselector_item_prepend(Handle, text, null, (IntPtr)item.Id);
             return item;
         }
index 82ef1246b18d0cd8e14a9ab95678dc0645635373..7abe5821330be0ac8a89f98bb5ad1c056096a730 100644 (file)
@@ -46,6 +46,17 @@ namespace ElmSharp
             Text = text;
         }
 
+        /// <summary>
+        /// Creates and initializes a new instance of the FlipSelectorItem.
+        /// </summary>
+        /// <param name="text">FlipSelectorItem's text</param>
+        /// <param name="parent">Parent EvasObject</param>
+        /// <since_tizen> preview </since_tizen>
+        public FlipSelectorItem(string text, EvasObject parent) : base(IntPtr.Zero, parent)
+        {
+            Text = text;
+        }
+
         internal void SendSelected()
         {
             Selected?.Invoke(this, EventArgs.Empty);
index 34074caca79d3b00e498156a0b1a6c4b8828152f..5976b99d092c5f697ea4638f22c7867027544132 100644 (file)
@@ -451,9 +451,8 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenGridItem Append(GenItemClass itemClass, object data)
         {
-            GenGridItem item = new GenGridItem(data, itemClass);
-            IntPtr handle = Interop.Elementary.elm_gengrid_item_append(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, null, (IntPtr)item.Id);
-            item.Handle = handle;
+            GenGridItem item = new GenGridItem(data, itemClass, this);
+            item.Handle = Interop.Elementary.elm_gengrid_item_append(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
         }
@@ -469,9 +468,8 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenGridItem Prepend(GenItemClass itemClass, object data)
         {
-            GenGridItem item = new GenGridItem(data, itemClass);
-            IntPtr handle = Interop.Elementary.elm_gengrid_item_prepend(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, null, (IntPtr)item.Id);
-            item.Handle = handle;
+            GenGridItem item = new GenGridItem(data, itemClass, this);
+            item.Handle = Interop.Elementary.elm_gengrid_item_prepend(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
         }
@@ -488,9 +486,8 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenGridItem InsertBefore(GenItemClass itemClass, object data, GenGridItem before)
         {
-            GenGridItem item = new GenGridItem(data, itemClass);
-            IntPtr handle = Interop.Elementary.elm_gengrid_item_insert_before(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, before, null, (IntPtr)item.Id);
-            item.Handle = handle;
+            GenGridItem item = new GenGridItem(data, itemClass, this);
+            item.Handle = Interop.Elementary.elm_gengrid_item_insert_before(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, before, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
         }
@@ -507,9 +504,8 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenGridItem InsertAfter(GenItemClass itemClass, object data, GenGridItem after)
         {
-            GenGridItem item = new GenGridItem(data, itemClass);
-            IntPtr handle = Interop.Elementary.elm_gengrid_item_insert_after(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, after, null, (IntPtr)item.Id);
-            item.Handle = handle;
+            GenGridItem item = new GenGridItem(data, itemClass, this);
+            item.Handle = Interop.Elementary.elm_gengrid_item_insert_after(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, after, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
         }
@@ -524,7 +520,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenGridItem InsertSorted(GenItemClass itemClass, object data, Comparison<object> comparison)
         {
-            GenGridItem item = new GenGridItem(data, itemClass);
+            GenGridItem item = new GenGridItem(data, itemClass, this);
 
             Interop.Elementary.Eina_Compare_Cb compareCallback = (handle1, handle2) =>
             {
@@ -533,8 +529,7 @@ namespace ElmSharp
                 return comparison(first.Data, second.Data);
             };
 
-            IntPtr handle = Interop.Elementary.elm_gengrid_item_sorted_insert(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, compareCallback, null, (IntPtr)item.Id);
-            item.Handle = handle;
+            item.Handle = Interop.Elementary.elm_gengrid_item_sorted_insert(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, compareCallback, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
         }
index ef2ac83cec9b2ec4ab8759b0ef1595447108e0ed..cdec871434f6a2c1fe795366f10d3195dce52921 100644 (file)
@@ -31,6 +31,10 @@ namespace ElmSharp
         {
         }
 
+        internal GenGridItem(object data, GenItemClass itemClass, EvasObject parent) : base(data, itemClass, parent)
+        {
+        }
+
         /// <summary>
         /// Gets or sets whether a given gengrid item is selected.
         /// If one gengrid item is selected, any other previously selected items get unselected in favor of this new one.
index 944849ed1643ac1914fa2cf022ca87dad8f93f4e..0742d58f93e338f9b17fb55fc30a18794fb656ea 100644 (file)
@@ -69,6 +69,13 @@ namespace ElmSharp
             _tooltipCb = (d, obj, tooltip, item) => { return TooltipContentDelegate(); };
         }
 
+        internal GenItem(object data, GenItemClass itemClass, EvasObject parent) : base(IntPtr.Zero, parent)
+        {
+            Data = data;
+            ItemClass = itemClass;
+            _tooltipCb = (d, obj, tooltip, item) => { return TooltipContentDelegate(); };
+        }
+
         /// <summary>
         /// Gets the item class that defines how to display data. It returns <see cref="GenItemClass"/> type.
         /// </summary>
index cfcc4ef7070852744e807f2e85a350ae5e125b79..7896b8fae05a52d228ea7ff7fd8f29aa0edc21ab 100644 (file)
@@ -580,9 +580,8 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenListItem Append(GenItemClass itemClass, object data, GenListItemType type, GenListItem parent)
         {
-            GenListItem item = new GenListItem(data, itemClass);
-            IntPtr handle = Interop.Elementary.elm_genlist_item_append(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, parent, (int)type, null, (IntPtr)item.Id);
-            item.Handle = handle;
+            GenListItem item = new GenListItem(data, itemClass, this);
+            item.Handle = Interop.Elementary.elm_genlist_item_append(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, parent, (int)type, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
         }
@@ -623,9 +622,8 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenListItem Prepend(GenItemClass itemClass, object data, GenListItemType type, GenListItem parent)
         {
-            GenListItem item = new GenListItem(data, itemClass);
-            IntPtr handle = Interop.Elementary.elm_genlist_item_prepend(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, parent, (int)type, null, (IntPtr)item.Id);
-            item.Handle = handle;
+            GenListItem item = new GenListItem(data, itemClass, this);
+            item.Handle = Interop.Elementary.elm_genlist_item_prepend(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, parent, (int)type, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
         }
@@ -671,9 +669,9 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before, GenListItemType type, GenListItem parent)
         {
-            GenListItem item = new GenListItem(data, itemClass);
+            GenListItem item = new GenListItem(data, itemClass, this);
             // insert before the `before` list item
-            IntPtr handle = Interop.Elementary.elm_genlist_item_insert_before(
+            item.Handle = Interop.Elementary.elm_genlist_item_insert_before(
                 RealHandle, // genlist handle
                 itemClass.UnmanagedPtr, // item class
                 (IntPtr)item.Id, // data
@@ -682,7 +680,6 @@ namespace ElmSharp
                 (int)type, // item type
                 null, // select callback
                 (IntPtr)item.Id); // callback data
-            item.Handle = handle;
             AddInternal(item);
             return item;
         }
@@ -699,9 +696,9 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenListItem InsertAfter(GenItemClass itemClass, object data, GenListItem after, GenListItemType type, GenListItem parent)
         {
-            GenListItem item = new GenListItem(data, itemClass);
+            GenListItem item = new GenListItem(data, itemClass, this);
             // insert before the `before` list item
-            IntPtr handle = Interop.Elementary.elm_genlist_item_insert_before(
+            item.Handle = Interop.Elementary.elm_genlist_item_insert_before(
                 RealHandle, // genlist handle
                 itemClass.UnmanagedPtr, // item class
                 (IntPtr)item.Id, // data
@@ -710,7 +707,6 @@ namespace ElmSharp
                 (int)type, // item type
                 null, // select callback
                 (IntPtr)item.Id); // callback data
-            item.Handle = handle;
             AddInternal(item);
             return item;
         }
@@ -727,7 +723,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public GenListItem InsertSorted(GenItemClass itemClass, object data, Comparison<object> comparison, GenListItemType type, GenListItem parent)
         {
-            GenListItem item = new GenListItem(data, itemClass);
+            GenListItem item = new GenListItem(data, itemClass, this);
 
             Interop.Elementary.Eina_Compare_Cb compareCallback = (handle1, handle2) =>
             {
@@ -736,7 +732,7 @@ namespace ElmSharp
                 return comparison(first.Data, second.Data);
             };
 
-            IntPtr handle = Interop.Elementary.elm_genlist_item_sorted_insert(
+            item.Handle = Interop.Elementary.elm_genlist_item_sorted_insert(
                 RealHandle, // genlist handle
                 itemClass.UnmanagedPtr, // item clas
                 (IntPtr)item.Id, // data
@@ -745,7 +741,6 @@ namespace ElmSharp
                 compareCallback, // compare callback
                 null, //select callback
                 (IntPtr)item.Id); // callback data
-            item.Handle = handle;
             AddInternal(item);
             return item;
         }
index 92845153a5184d5f825b8eccf605a70d867bc8b9..1b1bef97fd421e99ad436feddd8bd628c817b887 100644 (file)
@@ -64,6 +64,10 @@ namespace ElmSharp
         {
         }
 
+        internal GenListItem(object data, GenItemClass itemClass, EvasObject parent) : base(data, itemClass, parent)
+        {
+        }
+
         /// <summary>
         /// Gets or sets whether a given genlist item is selected.
         /// </summary>
index 54ae7f499c9ba9d41f4943e6d9140b24b40ef44d..a560a07cebb81d9968e219e714e639d2ba80aa8e 100644 (file)
@@ -203,7 +203,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public HoverselItem AddItem(string label)
         {
-            HoverselItem item = new HoverselItem();
+            HoverselItem item = new HoverselItem(this);
             item.Label = label;
             item.Handle = Interop.Elementary.elm_hoversel_item_add(RealHandle, label, null, 0, _onItemSelected, (IntPtr)item.Id);
             return item;
index 797481d553896df3facf3ecd6f18864b67c14370..94cb475cf7dc7137c15e0372b2f1bcec86ed87a3 100644 (file)
@@ -28,6 +28,10 @@ namespace ElmSharp
         {
         }
 
+        internal HoverselItem(EvasObject parent) : base(IntPtr.Zero, parent)
+        {
+        }
+
         /// <summary>
         /// The HoverselItem's label.
         /// </summary>
index cbe78c4f71fad35d19d6169e195c665cc3f8cdf3..6033916def9772597878a91c5f477059a434a1de 100644 (file)
@@ -181,7 +181,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public IndexItem Append(string label)
         {
-            IndexItem item = new IndexItem(label);
+            IndexItem item = new IndexItem(label, this);
             item.Handle = Interop.Elementary.elm_index_item_append(RealHandle, label, null, (IntPtr)item.Id);
             return item;
         }
@@ -194,7 +194,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public IndexItem Prepend(string label)
         {
-            IndexItem item = new IndexItem(label);
+            IndexItem item = new IndexItem(label, this);
             item.Handle = Interop.Elementary.elm_index_item_prepend(RealHandle, label, null, (IntPtr)item.Id);
             return item;
         }
@@ -208,7 +208,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public IndexItem InsertBefore(string label, IndexItem before)
         {
-            IndexItem item = new IndexItem(label);
+            IndexItem item = new IndexItem(label, this);
             item.Handle = Interop.Elementary.elm_index_item_insert_before(RealHandle, before, label, null, (IntPtr)item.Id);
             return item;
         }
@@ -222,7 +222,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public IndexItem InsertAfter(string label, IndexItem after)
         {
-            IndexItem item = new IndexItem(label);
+            IndexItem item = new IndexItem(label, this);
             item.Handle = Interop.Elementary.elm_index_item_insert_after(RealHandle, after, label, null, (IntPtr)item.Id);
             return item;
         }
index 110c62750b3eae274724723fd898cb2c8febfc5c..dc57d6041f7692e9e9c162e982076f92d736cd0c 100644 (file)
@@ -34,6 +34,17 @@ namespace ElmSharp
             Text = text;
         }
 
+        /// <summary>
+        /// Creates and initializes a new instance of the IndexItem class with parent
+        /// </summary>
+        /// <param name="text">The text is set to the Text. It's the 'string' type.</param>
+        /// <param name="parent">Parent EvasObject</param>
+        /// <since_tizen> preview </since_tizen>
+        public IndexItem(string text, EvasObject parent) : base(IntPtr.Zero, parent)
+        {
+            Text = text;
+        }
+
         /// <summary>
         /// Selected will be triggered when the index item is selected.
         /// </summary>
index b97f521ff2fdb5572618bcf344d03e0d4d1a4909..113ece4c8f16e214f3ba9fbad76854c51ac05932 100644 (file)
@@ -35,6 +35,12 @@ namespace ElmSharp
         Dictionary<SignalData, Interop.Elementary.Elm_Object_Item_Signal_Cb> _signalDatas = new Dictionary<SignalData, Interop.Elementary.Elm_Object_Item_Signal_Cb>();
         EvasObject _trackObject = null;
 
+        /// <summary>
+        /// Gets the parent object for ItemObject.
+        /// </summary>
+        /// <since_tizen> preview </since_tizen>
+        public EvasObject Parent { get; internal set; }
+
         /// <summary>
         /// Creates and initializes a new instance of the ItemObject class.
         /// </summary>
@@ -45,6 +51,22 @@ namespace ElmSharp
             _deleteCallback = DeleteCallbackHandler;
             Id = GetNextId();
             s_IdToItemTable[Id] = this;
+            Parent = null;
+            Handle = handle;
+        }
+
+        /// <summary>
+        /// Creates and initializes a new instance of the ItemObject class with parent object.
+        /// </summary>
+        /// <param name="handle">IntPtr</param>
+        /// <param name="parent">Parent EvasObject</param>
+        /// <since_tizen> preview </since_tizen>
+        protected ItemObject(IntPtr handle, EvasObject parent)
+        {
+            _deleteCallback = DeleteCallbackHandler;
+            Id = GetNextId();
+            s_IdToItemTable[Id] = this;
+            Parent = parent;
             Handle = handle;
         }
 
@@ -123,6 +145,10 @@ namespace ElmSharp
                 _handle = value;
                 SetDeleteCallback();
                 s_HandleToItemTable[Handle] = this;
+                if (_handle != IntPtr.Zero)
+                {
+                    Elementary.SendItemObjectRealized(this);
+                }
             }
         }
 
@@ -323,6 +349,7 @@ namespace ElmSharp
         void DeleteCallbackHandler(IntPtr data, IntPtr obj, IntPtr info)
         {
             Deleted?.Invoke(this, EventArgs.Empty);
+            Parent = null;
             OnInvalidate();
             if (s_IdToItemTable.ContainsKey(Id))
             {
index be147b7aa0f40095d53b2688d33813dbabafb9ae..c21e35823370499d76ab8c94f06aebfcbfa6fa4e 100644 (file)
@@ -198,7 +198,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public ListItem Append(string label, EvasObject leftIcon, EvasObject rightIcon)
         {
-            ListItem item = new ListItem(label, leftIcon, rightIcon);
+            ListItem item = new ListItem(label, leftIcon, rightIcon, this);
             item.Handle = Interop.Elementary.elm_list_item_append(RealHandle, label, leftIcon, rightIcon, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
@@ -225,7 +225,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public ListItem Prepend(string label, EvasObject leftIcon, EvasObject rigthIcon)
         {
-            ListItem item = new ListItem(label, leftIcon, rigthIcon);
+            ListItem item = new ListItem(label, leftIcon, rigthIcon, this);
             item.Handle = Interop.Elementary.elm_list_item_prepend(RealHandle, label, leftIcon, rigthIcon, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
index 00b5c62b9d5296d4576a1f5ca00ab72754822c21..646fdc59a600d56a24f6b66dd380f5cfc4421bca 100644 (file)
@@ -32,6 +32,13 @@ namespace ElmSharp
             LeftIcon = leftIcon;
             RightIcon = rightIcon;
         }
+        
+        internal ListItem(string text, EvasObject leftIcon, EvasObject rightIcon, EvasObject parent) : base(IntPtr.Zero, parent)
+        {
+            Text = text;
+            LeftIcon = leftIcon;
+            RightIcon = rightIcon;
+        }
 
         /// <summary>
         /// Gets the text for the list item.
@@ -51,4 +58,4 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public EvasObject RightIcon { get; internal set; }
     }
-}
\ No newline at end of file
+}
index 11b19d50ae9bc189ded429118dd3c850e437c3b2..914593e61002e12c2832bfbc3bc715e759388bf5 100644 (file)
@@ -380,6 +380,7 @@ namespace ElmSharp
 
         void OnItemAdded(object sender, MultiButtonEntryItemEventArgs e)
         {
+            e.Item.Parent = this;
             _children.Add(e.Item);
             e.Item.Deleted += Item_Deleted;
             ItemAdded?.Invoke(this, e);
@@ -443,8 +444,9 @@ namespace ElmSharp
             // And since "item.added" event will be called before xx_append() method returns,
             // ItemObject does NOT have an item that contains handle matched to "info" at this time.
             // So, item should be created and added internally here.
+
             MultiButtonEntryItem item = new MultiButtonEntryItem(info);
             return new MultiButtonEntryItemEventArgs { Item = item };
         }
     }
-}
\ No newline at end of file
+}
index 1337f58390237da92eac0dbd500c948480e13703..8f80e21e8c98530f77677f2591f13f2095aebc81 100644 (file)
@@ -41,6 +41,11 @@ namespace ElmSharp
             Label = Interop.Elementary.elm_object_item_part_text_get(handle, null);
         }
 
+        internal MultiButtonEntryItem(IntPtr handle, EvasObject parent) : base(handle, parent)
+        {
+            Label = Interop.Elementary.elm_object_item_part_text_get(handle, null);
+        }
+
         /// <summary>
         /// Gets the label of this item.
         /// </summary>
index 179e7212d8825e669bc89030c2066f4feb4e0c38..fbf014a976aa0e39182ba1a1760328907f82dbbf 100644 (file)
@@ -31,6 +31,16 @@ namespace ElmSharp
         Interop.Elementary.Elm_Naviframe_Item_Pop_Cb _popped;
 
         NaviItem(IntPtr handle, EvasObject content) : base(handle)
+        {
+            InitializeItem(handle, content);
+        }
+
+        NaviItem(IntPtr handle, EvasObject content, EvasObject parent) : base(handle, parent)
+        {
+            InitializeItem(handle, content);
+        }
+
+        void InitializeItem(IntPtr handle, EvasObject content)
         {
             _isPopped = false;
             _content = content;
@@ -125,9 +135,9 @@ namespace ElmSharp
                 Popped?.Invoke(this, EventArgs.Empty);
         }
 
-        internal static NaviItem FromNativeHandle(IntPtr handle, EvasObject content)
+        internal static NaviItem FromNativeHandle(IntPtr handle, EvasObject content, EvasObject parent)
         {
-            return new NaviItem(handle, content);
+            return new NaviItem(handle, content, parent);
         }
     }
 }
index 579a28da040a70d7d1a38441b6adc88a223f1eca..fcf3942970cc9888bacc6d215e053ec7f45be7ca 100644 (file)
@@ -148,7 +148,7 @@ namespace ElmSharp
         public NaviItem Push(EvasObject content, string title, string style)
         {
             IntPtr item = Interop.Elementary.elm_naviframe_item_push(RealHandle, title, IntPtr.Zero, IntPtr.Zero, content.Handle, style);
-            NaviItem naviItem = NaviItem.FromNativeHandle(item, content);
+            NaviItem naviItem = NaviItem.FromNativeHandle(item, content, this);
             _itemStack.Add(naviItem);
             naviItem.Popped += ItemPoppedHandler;
             return naviItem;
@@ -193,7 +193,7 @@ namespace ElmSharp
         public NaviItem InsertBefore(NaviItem before, EvasObject content, string title, string style)
         {
             IntPtr item = Interop.Elementary.elm_naviframe_item_insert_before(RealHandle, before, title, IntPtr.Zero, IntPtr.Zero, content, null);
-            NaviItem naviItem = NaviItem.FromNativeHandle(item, content);
+            NaviItem naviItem = NaviItem.FromNativeHandle(item, content, this);
             int idx = _itemStack.IndexOf(before);
             _itemStack.Insert(idx, naviItem);
             naviItem.Popped += ItemPoppedHandler;
@@ -239,7 +239,7 @@ namespace ElmSharp
         public NaviItem InsertAfter(NaviItem after, EvasObject content, string title, string style)
         {
             IntPtr item = Interop.Elementary.elm_naviframe_item_insert_after(RealHandle, after, title, IntPtr.Zero, IntPtr.Zero, content, null);
-            NaviItem naviItem = NaviItem.FromNativeHandle(item, content);
+            NaviItem naviItem = NaviItem.FromNativeHandle(item, content, this);
             int idx = _itemStack.IndexOf(after);
             _itemStack.Insert(idx + 1, naviItem);
             naviItem.Popped += ItemPoppedHandler;
index 0defeed6b772cd8d91ec7faea3919426e2c3e5ca..f8726bf7fa21067baec3740d18fa548e3db6d37e 100644 (file)
@@ -278,7 +278,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public PopupItem Append(string label, EvasObject icon)
         {
-            PopupItem item = new PopupItem(label, icon);
+            PopupItem item = new PopupItem(label, icon, this);
             item.Handle = Interop.Elementary.elm_popup_item_append(Handle, label, icon, null, (IntPtr)item.Id);
             AddInternal(item);
             return item;
index 8f347e546fe7df4444b2d497842d52bea94c5c25..765146611b24b546e510f65014dee7fdf6e971e6 100644 (file)
@@ -30,6 +30,12 @@ namespace ElmSharp
             Icon = icon;
         }
 
+        internal PopupItem(string text, EvasObject icon, EvasObject parent) : base(IntPtr.Zero, parent)
+        {
+            Text = text;
+            Icon = icon;
+        }
+
         /// <summary>
         /// Gets the text label of the popupitem. Return value is string.
         /// </summary>
index 4c8eb08d204b0413ad0954c06c174d36e1f10d2a..2ac10693dc685bc567eb1b298dcec7a0432a7cec 100644 (file)
@@ -348,7 +348,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public ToolbarItem Append(string label, string icon)
         {
-            ToolbarItem item = new ToolbarItem(label, icon);
+            ToolbarItem item = new ToolbarItem(label, icon, this);
             item.Handle = Interop.Elementary.elm_toolbar_item_append(RealHandle, icon, label, null, (IntPtr)item.Id);
             return item;
         }
@@ -379,7 +379,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public ToolbarItem Prepend(string label, string icon)
         {
-            ToolbarItem item = new ToolbarItem(label, icon);
+            ToolbarItem item = new ToolbarItem(label, icon, this);
             item.Handle = Interop.Elementary.elm_toolbar_item_prepend(RealHandle, icon, label, null, (IntPtr)item.Id);
             return item;
         }
@@ -408,7 +408,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public ToolbarItem InsertBefore(ToolbarItem before, string label, string icon)
         {
-            ToolbarItem item = new ToolbarItem(label, icon);
+            ToolbarItem item = new ToolbarItem(label, icon, this);
             item.Handle = Interop.Elementary.elm_toolbar_item_insert_before(RealHandle, before, icon, label, null, (IntPtr)item.Id);
             return item;
         }
@@ -423,7 +423,7 @@ namespace ElmSharp
         /// <since_tizen> preview </since_tizen>
         public ToolbarItem InsertAfter(ToolbarItem after, string label, string icon)
         {
-            ToolbarItem item = new ToolbarItem(label, icon);
+            ToolbarItem item = new ToolbarItem(label, icon, this);
             item.Handle = Interop.Elementary.elm_toolbar_item_insert_after(RealHandle, after, icon, label, null, (IntPtr)item.Id);
             return item;
         }
index f92961dc240cbb55acada80cc313db93b0b26d71..382808ce59ece3edaed450dea4e8195e0b43bc7c 100644 (file)
@@ -26,12 +26,19 @@ namespace ElmSharp
     {
         string _icon;
         string _text;
+
         internal ToolbarItem(string text, string icon) : base(IntPtr.Zero)
         {
             _text = text;
             _icon = icon;
         }
 
+        internal ToolbarItem(string text, string icon, EvasObject parent) : base(IntPtr.Zero, parent)
+        {
+            _text = text;
+            _icon = icon;
+        }
+
         /// <summary>
         /// Sets or gets the icon path of the item.
         /// </summary>
index 182fd602c4b7a0afa038ad0bceb267347bd7d067..08c3b8f910201b894aed5b31eaedeb0232050c56 100644 (file)
@@ -220,12 +220,18 @@ namespace ElmSharp.Test
             Console.WriteLine("ELM_PROFILE : {0}", profile);
             Console.WriteLine("ELM_SCALE : {0}", Elementary.GetScale());
 
-            Elementary.EvasObjectRealized += (s, e) =>
+            /*Elementary.EvasObjectRealized += (s, e) =>
             {
                 var obj = (EvasObject)s;
-                //Console.WriteLine("EvasObject Realized : ClassName = {0}", obj.ClassName);
+                Console.WriteLine("EvasObject Realized : {0}", obj.GetType());
             };
 
+            Elementary.ItemObjectRealized += (s, e) =>
+            {
+                var obj = (ItemObject)s;
+                Console.WriteLine("ItemObject Realized : {0} (Parent : {1})", obj.GetType(), obj.Parent != null? obj.Parent.GetType() : null);
+            };*/
+
             TestRunner testRunner = new TestRunner();
             testRunner.Profile = profile;
             testRunner.Run(args);