return;
}
- Container oldParent = child.GetParent();
+ Container oldParent = child.Parent;
if (oldParent != this)
{
if (oldParent != null)
{
oldParent.Remove(child);
}
- else
- {
- child.InternalParent = this;
- }
if (layoutSet == true && child.Layout == null) // Only give children a layout if parent an explicit container
{
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
Children.Remove(child);
- child.InternalParent = null;
-
if (Layout)
{
if(child.Layout)
/// <since_tizen> 4 </since_tizen>
public override Container GetParent()
{
- return this.InternalParent as Container;
+ //to fix memory leak issue, match the handle count with native side.
+ IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr);
+ HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
+ BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
+ NDalicPINVOKE.delete_BaseHandle(CPtr);
+ CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ return basehandle as Container;
}
internal bool IsTopLevelView()
/// <since_tizen> 4 </since_tizen>
public override void Add(View child)
{
- Container oldParent = child.GetParent();
+ Container oldParent = child.Parent;
if (oldParent != this)
{
if (oldParent != null)
{
oldParent.Remove(child);
}
- else
- {
- child.InternalParent = this;
- }
-
NDalicPINVOKE.Actor_Add( rootLayoutCPtr , View.getCPtr(child));
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
Children.Remove(child);
- child.InternalParent = null;
}
/// <summary>
if (currentIdx >= 0 && currentIdx < parentChildren.Count - 1)
{
- var upper = parentChildren[currentIdx + 1];
- RaiseAbove(upper);
+ RaiseAbove(parentChildren[currentIdx + 1]);
+
+ Layer temp = parentChildren[currentIdx + 1];
+ parentChildren[currentIdx + 1] = this;
+ parentChildren[currentIdx] = temp;
+
+ NDalicPINVOKE.Layer_Raise(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
if (currentIdx > 0 && currentIdx < parentChildren.Count)
{
- var low = parentChildren[currentIdx - 1];
- LowerBelow(low);
+ LowerBelow(parentChildren[currentIdx - 1]);
+
+ Layer temp = parentChildren[currentIdx - 1];
+ parentChildren[currentIdx - 1] = this;
+ parentChildren[currentIdx] = temp;
+
+ NDalicPINVOKE.Layer_Lower(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
parentChildren.Remove(this);
parentChildren.Insert(targetIndex, this);
- NDalicPINVOKE.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target));
+ NDalicPINVOKE.Layer_RaiseAbove(swigCPtr, Layer.getCPtr(target));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
parentChildren.Remove(this);
parentChildren.Insert(targetIndex, this);
- NDalicPINVOKE.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target));
+ NDalicPINVOKE.Layer_LowerBelow(swigCPtr, Layer.getCPtr(target));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
+++ /dev/null
-using System;
-using Tizen.NUI;
-using Tizen.NUI.BaseComponents;
-
-namespace MyRaiseToTopTest
-{
- class Example : NUIApplication
- {
- TextLabel layer1Text, layer2Text, rootLayerText;
- Window window;
- View[] layer1Views = new View[3];
- View[] layer2Views = new View[3];
- View[] rootLayerViews = new View[3];
- Layer layer1, layer2, rootLayer;
-
- protected override void OnCreate()
- {
- base.OnCreate();
- Initialize();
- }
- public void Initialize()
- {
- window = Window.Instance;
- window.KeyEvent += OnWindowKeyEvent;
- window.BackgroundColor = Color.Yellow;
-
- const int viewSize = 80;
- const int startPos = 30;
-
- //rootLayer
- rootLayer = window.GetDefaultLayer();
- for(int i = 0; i < 3; i++)
- {
- rootLayerViews[i] = new View();
- rootLayerViews[i].Size2D = new Size2D(viewSize, viewSize);
- rootLayerViews[i].Position2D = new Position2D(1 + i*viewSize/3, startPos + i*viewSize/3);
- rootLayerViews[i].BackgroundColor = new Color( (255.0f - i*85.0f)/255.0f, 0.0f, 0.0f, 1.0f);
- rootLayer.Add(rootLayerViews[i]);
- }
- rootLayerText = new TextLabel(rootLayer.Name);
- rootLayerText.PointSize = 10;
- rootLayerText.Position2D = new Position2D(1, 1);
- rootLayerText.BackgroundColor = new Color(1.0f, 0.0f, 0.0f, 1.0f);
- rootLayer.Add(rootLayerText);
-
- //layer1
- layer1 = new Layer();
- layer1.Name = "Layer1";
- for(int i = 0; i < 3; i++)
- {
- layer1Views[i] = new View();
- layer1Views[i].Size2D = new Size2D(viewSize, viewSize);
- layer1Views[i].Position2D = new Position2D(startPos + i*viewSize/3, startPos + i*viewSize/3);
- layer1Views[i].BackgroundColor = new Color( 0.0f, (255.0f - i*85.0f)/255.0f, 0.0f, 1.0f);
- layer1.Add(layer1Views[i]);
- }
- layer1Text = new TextLabel(layer1.Name);
- layer1Text.PointSize = 10;
- layer1Text.Position2D = new Position2D(2, 1);
- layer1Text.BackgroundColor = new Color(0.0f, 1.0f, 0.0f, 1.0f);
- layer1.Add(layer1Text);
- window.AddLayer(layer1);
-
- //layer2
- layer2 = new Layer();
- layer2.Name = "Layer2";
- for(int i = 0; i < 3; i++)
- {
- layer2Views[i] = new View();
- layer2Views[i].Size2D = new Size2D(viewSize, viewSize);
- layer2Views[i].Position2D = new Position2D(startPos*2 + i*viewSize/3, startPos + i*viewSize/3);
- layer2Views[i].BackgroundColor = new Color( 0.0f, 0.0f, (255.0f - i*85.0f)/255.0f, 1.0f);
- layer2.Add(layer2Views[i]);
- }
- layer2Text = new TextLabel(layer2.Name);
- layer2Text.PointSize = 10;
- layer2Text.Position2D = new Position2D(3, 1);
- layer2Text.BackgroundColor = new Color(0.0f, 0.0f, 1.0f, 1.0f);
- layer2.Add(layer2Text);
- window.AddLayer(layer2);
-
- }
-
- int win_test;
- public void OnWindowKeyEvent(object sender, Window.KeyEventArgs e)
- {
- if (e.Key.State == Key.StateType.Down)
- {
- if (e.Key.KeyPressedName == "Up")
- {
- layer1.Raise();
- }
- else if (e.Key.KeyPressedName == "Down")
- {
- layer1.Lower();
- }
- else if (e.Key.KeyPressedName == "Right")
- {
- layer1.RaiseToTop();
- }
- else if (e.Key.KeyPressedName == "Left")
- {
- layer1.LowerToBottom();
- }
- else if (e.Key.KeyPressedName == "Return")
- {
- }
- else if (e.Key.KeyPressedName == "1")
- {
- layer1Views[0].RaiseToTop();
- }
- else if (e.Key.KeyPressedName == "2")
- {
- layer1Views[0].Raise();
- }
- else if (e.Key.KeyPressedName == "3")
- {
- layer1Views[0].Lower();
- }
- else if (e.Key.KeyPressedName == "4")
- {
- layer1Views[0].LowerToBottom();
- }
- }
- }
-
- [STAThread]
- static void _Main(string[] args)
- {
- Example example = new Example();
- example.Run(args);
- }
- }
-}
-