[NUI] Add layer children of window 55/158755/1
authorhuiyu,eun <huiyu.eun@samsung.com>
Thu, 2 Nov 2017 04:16:35 +0000 (13:16 +0900)
committerhuiyu,eun <huiyu.eun@samsung.com>
Fri, 3 Nov 2017 01:17:47 +0000 (10:17 +0900)
manage child layers.

Change-Id: I79b07ac3942dbf5596a794950a61197c0c8ced0a
Signed-off-by: huiyu,eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/public/Window.cs

index bf53c0a..caaf6ec 100644 (file)
@@ -18,6 +18,7 @@ using System;
 using System.Runtime.InteropServices;
 using Tizen.NUI.BaseComponents;
 using System.ComponentModel;
+using System.Collections.Generic;
 
 namespace Tizen.NUI
 {
@@ -33,6 +34,15 @@ namespace Tizen.NUI
         private Layer _rootLayer;
         private string _windowTitle;
 
+        private List<Layer> _childLayers = new List<Layer>();
+        private List<Layer> LayersChildren
+        {
+            get
+            {
+                return _childLayers;
+            }
+        }
+
         internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
         {
             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
@@ -652,12 +662,16 @@ namespace Tizen.NUI
         {
             NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+            LayersChildren.Add(layer);
         }
 
         internal void Remove(Layer layer)
         {
             NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+            LayersChildren.Remove(layer);
         }
 
         /// <summary>
@@ -701,9 +715,10 @@ namespace Tizen.NUI
         /// <remarks>Note that a default layer is always provided (count >= 1).</remarks>
         internal uint GetLayerCount()
         {
-            uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
+            if (LayersChildren == null || LayersChildren.Count < 0)
+                return 0;
+
+            return (uint) LayersChildren.Count;
         }
 
         /// <summary>
@@ -729,6 +744,7 @@ namespace Tizen.NUI
             {
                 _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                LayersChildren.Add(_rootLayer);
             }
             return _rootLayer;
         }
@@ -1535,6 +1551,8 @@ namespace Tizen.NUI
         {
             NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+            LayersChildren.Add(layer);
         }
 
         /// <summary>
@@ -1546,6 +1564,8 @@ namespace Tizen.NUI
         {
             NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer));
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+            LayersChildren.Remove(layer);
         }
 
         /// <summary>