diff --git a/src/Tizen.NUI/src/internal/Common/VisualObjectsContainer.cs b/src/Tizen.NUI/src/internal/Common/VisualObjectsContainer.cs new file mode 100644 index 00000000000..29b92e896e7 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Common/VisualObjectsContainer.cs @@ -0,0 +1,85 @@ +// Copyright (c) 2019 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +using System; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Linq; +using System.ComponentModel; + +namespace Tizen.NUI.Visuals +{ + /// + /// TODO : Summary description for VisualObjectsContainer. + /// + internal class VisualObjectsContainer : BaseHandle + { + /// + /// Creates an empty visual object handle. + /// + public VisualObjectsContainer() : this(Interop.VisualObjectsContainer.NewVisualObjectsContainer(), true, false) + { + NDalicPINVOKE.ThrowExceptionIfExists(); + } + + /// + /// Creates an visual object with VisualObjectsContainer. + /// + public VisualObjectsContainer(Tizen.NUI.BaseComponents.View view) : this(Interop.VisualObjectsContainer.VisualObjectsContainerNew(Tizen.NUI.BaseComponents.View.getCPtr(view)), true) + { + NDalicPINVOKE.ThrowExceptionIfExists(); + } + + internal VisualObjectsContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn) + { + } + + internal VisualObjectsContainer(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister) + { + } + + public void AddVisualObject(Tizen.NUI.Visuals.VisualObject visualObject) + { + Interop.VisualObjectsContainer.AddVisualObject(SwigCPtr, Tizen.NUI.Visuals.VisualObject.getCPtr(visualObject)); + } + + public void RemoveVisualObject(Tizen.NUI.Visuals.VisualObject visualObject) + { + Interop.VisualObjectsContainer.RemoveVisualObject(SwigCPtr, Tizen.NUI.Visuals.VisualObject.getCPtr(visualObject)); + } + + /// + /// Dispose for VisualObjectsContainer + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + base.Dispose(type); + } + } +} \ No newline at end of file diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.VisualObject.cs b/src/Tizen.NUI/src/internal/Interop/Interop.VisualObject.cs new file mode 100755 index 00000000000..2dc2bbb5477 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.VisualObject.cs @@ -0,0 +1,34 @@ +/* + * Copyright(c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class VisualObject + { + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_VisualObject__SWIG_0")] + public static extern global::System.IntPtr NewVisualObject(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_VisualObject")] + public static extern void DeleteVisualObject(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualObject_New")] + public static extern global::System.IntPtr VisualObjectNew(global::System.Runtime.InteropServices.HandleRef container); + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.VisualObjectsContainer.cs b/src/Tizen.NUI/src/internal/Interop/Interop.VisualObjectsContainer.cs new file mode 100755 index 00000000000..a8b92142f37 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.VisualObjectsContainer.cs @@ -0,0 +1,40 @@ +/* + * Copyright(c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class VisualObjectsContainer + { + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_VisualObjectsContainer__SWIG_0")] + public static extern global::System.IntPtr NewVisualObjectsContainer(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_VisualObjectsContainer")] + public static extern void DeleteVisualObjectsContainer(global::System.Runtime.InteropServices.HandleRef container); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualObjectsContainer_New")] + public static extern global::System.IntPtr VisualObjectsContainerNew(global::System.Runtime.InteropServices.HandleRef view); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualObjectsContainer_AddVisualObject")] + public static extern void AddVisualObject(global::System.Runtime.InteropServices.HandleRef container, global::System.Runtime.InteropServices.HandleRef viewObject); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualObjectsContainer_RemoveVisualObject")] + public static extern void RemoveVisualObject(global::System.Runtime.InteropServices.HandleRef container, global::System.Runtime.InteropServices.HandleRef viewObject); + } + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index 206cc9acdfa..48e3bd5e56b 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -1425,6 +1425,9 @@ protected override void Dispose(DisposeTypes type) internalCurrentScreenPosition?.Dispose(); internalCurrentScreenPosition = null; + visualContainer?.Dispose(); + visualContainer = null; + if (type == DisposeTypes.Explicit) { //Called by User diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewVisual.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewVisual.cs new file mode 100755 index 00000000000..a5d922d7810 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewVisual.cs @@ -0,0 +1,69 @@ +/* + * Copyright(c) 2022 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.InteropServices; +using Tizen.NUI.Binding; + +namespace Tizen.NUI.BaseComponents +{ + /// + /// View is the base class for all views. + /// + /// 3 + public partial class View + { + private Tizen.NUI.Visuals.VisualObjectsContainer visualContainer = null; + + /// + /// Add a visual object to the view. + /// + /// + /// The visual is added to the top of the visuals. + /// + /// The visual object to add. + [EditorBrowsable(EditorBrowsableState.Never)] + public void AddVisualObject(Tizen.NUI.Visuals.VisualObject visualObject) + { + EnsureVisualContainer(); + visualContainer.AddVisualObject(visualObject); + } + + /// + /// Remove a visual object from the view. + /// + /// + /// The all other VisualObject's SiblingOrder value will be changed automatically. + /// + /// The visual object to remove. + [EditorBrowsable(EditorBrowsableState.Never)] + public void RemoveVisualObject(Tizen.NUI.Visuals.VisualObject visualObject) + { + EnsureVisualContainer(); + visualContainer.AddVisualObject(visualObject); + } + + private void EnsureVisualContainer() + { + if(visualContainer == null) + { + visualContainer = new Visuals.VisualObjectsContainer(this); + } + } + } +} diff --git a/src/Tizen.NUI/src/public/Visuals/VisualObject/VisualObject.cs b/src/Tizen.NUI/src/public/Visuals/VisualObject/VisualObject.cs new file mode 100644 index 00000000000..381dc00b8df --- /dev/null +++ b/src/Tizen.NUI/src/public/Visuals/VisualObject/VisualObject.cs @@ -0,0 +1,90 @@ +// Copyright (c) 2019 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +using System; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Linq; +using System.ComponentModel; + +namespace Tizen.NUI.Visuals +{ + /// + /// TODO : Summary description for VisualObject. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class VisualObject : BaseHandle + { + /// + /// Creates an empty visual object handle. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public VisualObject() : this(Interop.VisualObject.NewVisualObject(), true, false) + { + NDalicPINVOKE.ThrowExceptionIfExists(); + } + + /// + /// Creates an visual object with VisualObjectsContainer. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public VisualObject(VisualObjectsContainer container) : this(Interop.VisualObject.VisualObjectNew(VisualObjectsContainer.getCPtr(container)), true) + { + NDalicPINVOKE.ThrowExceptionIfExists(); + } + + internal VisualObject(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn) + { + } + + internal VisualObject(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister) + { + } + + public uint SiblingOrder + { + set + { + + } + get + { + return Interop.VisualObject.GetSiblingOrder(SwigCPtr); + } + } + + /// + /// Dispose for VisualObject + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + base.Dispose(type); + } + } +} \ No newline at end of file