Merge remote-tracking branch 'origin/master' into tizen
authorTizenAPI-Bot <tizenapi@samsung.com>
Mon, 11 Sep 2023 07:36:17 +0000 (07:36 +0000)
committerTizenAPI-Bot <tizenapi@samsung.com>
Mon, 11 Sep 2023 07:36:17 +0000 (07:36 +0000)
27 files changed:
packaging/csapi-tizenfx.spec
packaging/depends/Tizen.NET.10.0.0.17744.nupkg [new file with mode: 0644]
packaging/depends/Tizen.NET.API10.10.0.0.17744.nupkg [new file with mode: 0644]
packaging/depends/Tizen.NET.Internals.10.0.0.17744.nupkg [new file with mode: 0644]
packaging/depends/tizen.net.api10.10.0.0.17508.nupkg [new file with mode: 0755]
packaging/version.txt
src/Tizen.Applications.ComponentBased/Interop/Interop.CBApplication.cs
src/Tizen.Applications.ComponentBased/Tizen.Applications.ComponentBased.Common/BaseComponent.cs
src/Tizen.Applications.ComponentBased/Tizen.Applications.ComponentBased.Common/ComponentStateManger.cs
src/Tizen.Applications.ComponentBased/Tizen.Applications.ComponentBased.Common/FrameComponentStateManager.cs
src/Tizen.Applications.ComponentBased/Tizen.Applications.ComponentBased.Common/ServiceComponentStateManager.cs
src/Tizen.Applications.ComponentBased/Tizen.Applications.ComponentBased.Common/WidgetComponentStateManager.cs
src/Tizen.NUI.Components/Controls/Popup.cs
src/Tizen.NUI.Wearable/src/public/Title.cs
src/Tizen.NUI/src/internal/Interop/Interop.Clipboard.cs
src/Tizen.NUI/src/internal/Interop/Interop.PointerConstraints.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Interop/Interop.WindowPointerConstraintsSignal.cs [new file with mode: 0755]
src/Tizen.NUI/src/internal/Window/WindowPointerConstraintsSignal.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/Clipboard/Clipboard.cs
src/Tizen.NUI/src/public/Clipboard/ClipboardEvent.cs
src/Tizen.NUI/src/public/Window/PointerConstraints.cs [new file with mode: 0755]
src/Tizen.NUI/src/public/Window/WindowEvent.cs
test/NUIClipboard/Clipboard.cs
test/NUIClipboardDataSelected/ClipboardDataSelected.cs [new file with mode: 0644]
test/NUIClipboardDataSelected/NUIClipboardDataSelected.csproj [new file with mode: 0644]
test/NUIClipboardDataSelected/shared/res/NUIClipboardDataSelected.png [new file with mode: 0644]
test/NUIClipboardDataSelected/tizen-manifest.xml [new file with mode: 0644]

index dd8b0d2..4843a39 100644 (file)
@@ -1,8 +1,8 @@
 # Auto-generated from csapi-tizenfx.spec.in by makespec.sh
 
 %define TIZEN_NET_API_VERSION 11
-%define TIZEN_NET_RPM_VERSION 11.0.0.17999+nui22241
-%define TIZEN_NET_NUGET_VERSION 11.0.0.17999
+%define TIZEN_NET_RPM_VERSION 11.0.0.999+nui22243
+%define TIZEN_NET_NUGET_VERSION 11.0.0.99999
 
 %define DOTNET_ASSEMBLY_PATH /usr/share/dotnet.tizen/framework
 %define DOTNET_ASSEMBLY_DUMMY_PATH %{DOTNET_ASSEMBLY_PATH}/ref
diff --git a/packaging/depends/Tizen.NET.10.0.0.17744.nupkg b/packaging/depends/Tizen.NET.10.0.0.17744.nupkg
new file mode 100644 (file)
index 0000000..0c7b8ec
Binary files /dev/null and b/packaging/depends/Tizen.NET.10.0.0.17744.nupkg differ
diff --git a/packaging/depends/Tizen.NET.API10.10.0.0.17744.nupkg b/packaging/depends/Tizen.NET.API10.10.0.0.17744.nupkg
new file mode 100644 (file)
index 0000000..5a34f50
Binary files /dev/null and b/packaging/depends/Tizen.NET.API10.10.0.0.17744.nupkg differ
diff --git a/packaging/depends/Tizen.NET.Internals.10.0.0.17744.nupkg b/packaging/depends/Tizen.NET.Internals.10.0.0.17744.nupkg
new file mode 100644 (file)
index 0000000..fd7f125
Binary files /dev/null and b/packaging/depends/Tizen.NET.Internals.10.0.0.17744.nupkg differ
diff --git a/packaging/depends/tizen.net.api10.10.0.0.17508.nupkg b/packaging/depends/tizen.net.api10.10.0.0.17508.nupkg
new file mode 100755 (executable)
index 0000000..56d781e
Binary files /dev/null and b/packaging/depends/tizen.net.api10.10.0.0.17508.nupkg differ
index 9db03db..fb2e713 100755 (executable)
@@ -6,4 +6,4 @@ RPM_VERSION=11.0.0.999
 NUGET_VERSION=11.0.0.99999
 
 # RPM Version Suffix
-RPM_VERSION_SUFFIX=nui22241
+RPM_VERSION_SUFFIX=nui22243
index eaad727..4cf77ea 100644 (file)
@@ -84,6 +84,7 @@ internal static partial class Interop
         internal delegate void FrameLowBatteryCallback(IntPtr context, int status, IntPtr userData);
         internal delegate void FrameLowMemoryCallback(IntPtr context, int status, IntPtr userData);
         internal delegate void FrameSuspendedStateCallback(IntPtr context, int state, IntPtr userData);
+        internal delegate void FrameTimeZoneChangedCallback(IntPtr context, string timeZone, string timeZoneId, IntPtr userData);
 
         internal struct FrameLifecycleCallbacks
         {
@@ -102,6 +103,7 @@ internal static partial class Interop
             public FrameLowBatteryCallback OnLowBattery;
             public FrameLowMemoryCallback OnLowMemory;
             public FrameSuspendedStateCallback OnSuspendedState;
+            public FrameTimeZoneChangedCallback OnTimeZoneChanged;
         }
 
         internal delegate bool ServiceCreateCallback(IntPtr context, IntPtr userData);
@@ -116,6 +118,7 @@ internal static partial class Interop
         internal delegate void ServiceLowBatteryCallback(IntPtr context, int status, IntPtr userData);
         internal delegate void ServiceLowMemoryCallback(IntPtr context, int status, IntPtr userData);
         internal delegate void ServiceSuspendedStateCallback(IntPtr context, int state, IntPtr userData);
+        internal delegate void ServiceTimeZoneChangedCallback(IntPtr context, string timeZone, string timeZoneId, IntPtr userData);
 
         internal struct ServiceLifecycleCallbacks
         {
@@ -131,6 +134,7 @@ internal static partial class Interop
             public ServiceLowBatteryCallback OnLowBattery;
             public ServiceLowMemoryCallback OnLowMemory;
             public ServiceSuspendedStateCallback OnSuspendedState;
+            public ServiceTimeZoneChangedCallback OnTimeZoneChanged;
         }
 
         internal delegate IntPtr WidgetCreateCallback(IntPtr context, int width, int height, IntPtr userData);
@@ -147,6 +151,7 @@ internal static partial class Interop
         internal delegate void WidgetLowBatteryCallback(IntPtr context, int status, IntPtr userData);
         internal delegate void WidgetLowMemoryCallback(IntPtr context, int status, IntPtr userData);
         internal delegate void WidgetSuspendedStateCallback(IntPtr context, int state, IntPtr userData);
+        internal delegate void WidgetTimeZoneChangedCallback(IntPtr context, string timeZone, string timeZoneId, IntPtr userData);
 
         internal struct WidgetLifecycleCallbacks
         {
@@ -164,6 +169,7 @@ internal static partial class Interop
             public WidgetLowBatteryCallback OnLowBattery;
             public WidgetLowMemoryCallback OnLowMemory;
             public WidgetSuspendedStateCallback OnSuspendedState;
+            public WidgetTimeZoneChangedCallback OnTimeZoneChanged;
         }
 
         internal delegate IntPtr BaseCreateCallback(IntPtr context, IntPtr userData);
@@ -176,6 +182,7 @@ internal static partial class Interop
         internal delegate void BaseLowBatteryCallback(IntPtr context, int status, IntPtr userData);
         internal delegate void BaseLowMemoryCallback(IntPtr context, int status, IntPtr userData);
         internal delegate void BaseSuspendedStateCallback(IntPtr context, int state, IntPtr userData);
+        internal delegate void BaseTimeZoneChangedCallback(IntPtr context, string timeZone, string timeZoneId, IntPtr userData);
 
         [DllImport(Libraries.CompCoreBase, EntryPoint = "component_based_app_base_main")]
         internal static extern ErrorCode BaseMain(int argc, string[] argv, ref CBAppLifecycleCallbacks callback, IntPtr userData);
index 8724be0..1940a3f 100755 (executable)
@@ -69,6 +69,12 @@ namespace Tizen.Applications.ComponentBased.Common
         public event EventHandler<SuspendedStateEventArgs> SuspendedStateChanged;
 
         /// <summary>
+        /// Occurs when the time zone is changed.
+        /// </summary>
+        /// <since_tizen> 11 </since_tizen>
+        public event EventHandler<TimeZoneChangedEventArgs> TimeZoneChanged;
+
+        /// <summary>
         /// A component instance ID.
         /// It will be created after OnCreate method is invoked.
         /// </summary>
@@ -169,6 +175,11 @@ namespace Tizen.Applications.ComponentBased.Common
             SuspendedStateChanged?.Invoke(this, new SuspendedStateEventArgs((SuspendedState)state));
         }
 
+        internal void OnTimeZoneChangedCallback(string timeZone, string timeZoneId)
+        {
+            TimeZoneChanged?.Invoke(this, new TimeZoneChangedEventArgs(timeZone, timeZoneId));
+        }
+
         /// <summary>
         /// Sends the launch request asynchronously.
         /// </summary>
index 936f23b..1653329 100644 (file)
@@ -114,6 +114,17 @@ namespace Tizen.Applications.ComponentBased.Common
             }
         }
 
+        protected void OnTimeZoneChangedCallback(IntPtr context, string timeZone, string timeZoneId, IntPtr userData)
+        {
+            foreach (BaseComponent com in ComponentInstances)
+            {
+                if (com.Handle == context)
+                {
+                    com.OnTimeZoneChangedCallback(timeZone, timeZoneId);
+                }
+            }
+        }
+
         protected void OnRestoreCallback(IntPtr context, IntPtr content, IntPtr userData)
         {
             foreach (BaseComponent com in ComponentInstances)
index b4c5de1..b332839 100644 (file)
@@ -42,6 +42,7 @@ namespace Tizen.Applications.ComponentBased.Common
             _callbacks.OnResume = new Interop.CBApplication.FrameResumeCallback(OnResumeCallback);
             _callbacks.OnStart = new Interop.CBApplication.FrameStartCallback(OnStartCallback);
             _callbacks.OnStop = new Interop.CBApplication.FrameStopCallback(OnStopCallback);
+            _callbacks.OnTimeZoneChanged = new Interop.CBApplication.FrameTimeZoneChangedCallback(OnTimeZoneChangedCallback);
             Parent = parent;
         }
 
@@ -81,7 +82,7 @@ namespace Tizen.Applications.ComponentBased.Common
             {
                 if (fc.Handle == context)
                 {
-                    SafeAppControlHandle handle = new SafeAppControlHandle(appControl, false);
+                    using SafeAppControlHandle handle = new SafeAppControlHandle(appControl, false);
                     AppControl control = new AppControl(handle);
                     fc.OnStart(control, restarted);
                     break;
index fc918a1..690fa7f 100644 (file)
@@ -36,6 +36,7 @@ namespace Tizen.Applications.ComponentBased.Common
             _callbacks.OnCreate = new Interop.CBApplication.ServiceCreateCallback(OnCreateCallback);
             _callbacks.OnDestroy = new Interop.CBApplication.ServiceDestroyCallback(OnDestroyCallback);
             _callbacks.OnStart = new Interop.CBApplication.ServiceStartCommandCallback(OnStartCallback);
+            _callbacks.OnTimeZoneChanged = new Interop.CBApplication.ServiceTimeZoneChangedCallback(OnTimeZoneChangedCallback);
             Parent = parent;
         }
 
@@ -64,7 +65,7 @@ namespace Tizen.Applications.ComponentBased.Common
             {
                 if (sc.Handle == context)
                 {
-                    SafeAppControlHandle handle = new SafeAppControlHandle(appControl, false);
+                    using SafeAppControlHandle handle = new SafeAppControlHandle(appControl, false);
                     AppControl control = new AppControl(handle);
                     sc.OnStartCommand(control, restarted);
                     break;
index 8e6512c..c0f4026 100644 (file)
@@ -41,6 +41,7 @@ namespace Tizen.Applications.ComponentBased.Common
             _callbacks.OnResume = new Interop.CBApplication.WidgetResumeCallback(OnResumeCallback);
             _callbacks.OnStart = new Interop.CBApplication.WidgetStartCallback(OnStartCallback);
             _callbacks.OnStop = new Interop.CBApplication.WidgetStopCallback(OnStopCallback);
+            _callbacks.OnTimeZoneChanged = new Interop.CBApplication.WidgetTimeZoneChangedCallback(OnTimeZoneChangedCallback);
             Parent = parent;
         }
 
index cbf4022..f046782 100755 (executable)
@@ -844,7 +844,7 @@ namespace Tizen.NUI.Components
 
         private void PopupStylePropertyChanged(object sender, PropertyChangedEventArgs e)
         {
-            if (e.PropertyName.Equals("LayoutDirection"))
+            if (e.PropertyName is var propName && propName != null && propName.Equals("LayoutDirection"))
             {
                 btGroup.UpdateButton(buttonStyle);
             }
index 5d3fb1e..7934030 100755 (executable)
@@ -247,7 +247,7 @@ namespace Tizen.NUI.Components
 
         private void TitlePropertyChanged(object sender, PropertyChangedEventArgs e)
         {
-            if (isFadeOutColorSet == false  && e.PropertyName.Equals("BackgroundColor") )
+            if (isFadeOutColorSet == false  && e.PropertyName is var propName && propName != null && propName.Equals("BackgroundColor") )
             {
                 fadeOutColor = this.BackgroundColor;
                 UpdateImage();
index 1a306d3..afcac17 100755 (executable)
@@ -25,6 +25,7 @@ namespace Tizen.NUI
             public static extern global::System.IntPtr Get();
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Clipboard_SetData")]
+            [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
             public static extern bool SetData(global::System.Runtime.InteropServices.HandleRef clipboard, string mimeType, string data);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Clipboard_GetData")]
@@ -36,6 +37,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Clipboard_DataReceivedSignal")]
             public static extern global::System.IntPtr ClipboardDataReceivedSignal(global::System.Runtime.InteropServices.HandleRef clipboard);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Clipboard_DataSelectedSignal")]
+            public static extern global::System.IntPtr ClipboardDataSelectedSignal(global::System.Runtime.InteropServices.HandleRef clipboard);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_ClipboardSignal_Empty")]
             [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
             public static extern bool ClipboardSignalEmpty(global::System.Runtime.InteropServices.HandleRef signal);
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.PointerConstraints.cs b/src/Tizen.NUI/src/internal/Interop/Interop.PointerConstraints.cs
new file mode 100755 (executable)
index 0000000..6766cd5
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright(c) 2023 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 PointerConstraints
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_PointerConstraintsEvent__SWIG_0")]
+            public static extern global::System.IntPtr NewPointerConstraints(int x, int y, bool locked, bool confined);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_PointerConstraintsEvent")]
+            public static extern void DeletePointerConstraints(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_PointerConstraintsEvent_x_get")]
+            public static extern int XGet(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_PointerConstraintsEvent_y_get")]
+            public static extern int YGet(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_PointerConstraintsEvent_locked_get")]
+            [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+            public static extern bool LockedGet(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_PointerConstraintsEvent_confined_get")]
+            [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+            public static extern bool ConfinedGet(global::System.Runtime.InteropServices.HandleRef jarg1);
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.WindowPointerConstraintsSignal.cs b/src/Tizen.NUI/src/internal/Interop/Interop.WindowPointerConstraintsSignal.cs
new file mode 100755 (executable)
index 0000000..063301a
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright(c) 2023 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 WindowPointerConstraintsSignal
+        {
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WindowPointerConstraintsEventSignal")]
+            public static extern global::System.IntPtr GetSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WindowPointerConstraintsEventSignal_Empty")]
+            [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
+            public static extern bool Empty(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WindowPointerConstraintsEventSignal_GetConnectionCount")]
+            public static extern uint GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WindowPointerConstraintsEventSignal_Connect")]
+            public static extern void Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WindowPointerConstraintsEventSignal_Disconnect")]
+            public static extern void Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WindowPointerConstraintsEventSignal_Emit")]
+            public static extern void Emit(global::System.Runtime.InteropServices.HandleRef signalType, global::System.Runtime.InteropServices.HandleRef window, global::System.Runtime.InteropServices.HandleRef mouseEvent);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WindowPointerConstraintsEventSignal")]
+            public static extern global::System.IntPtr NewWindowPointerConstraintsSignal();
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WindowPointerConstraintsEventSignal")]
+            public static extern void DeleteWindowPointerConstraintsSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+        }
+    }
+}
diff --git a/src/Tizen.NUI/src/internal/Window/WindowPointerConstraintsSignal.cs b/src/Tizen.NUI/src/internal/Window/WindowPointerConstraintsSignal.cs
new file mode 100755 (executable)
index 0000000..8165e46
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright(c) 2023 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 Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI
+{
+    internal class WindowPointerConstraintsSignal : Disposable
+    {
+        internal WindowPointerConstraintsSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+        }
+
+        /// <summary>
+        /// Dispose
+        /// </summary>
+        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+        {
+            Interop.WindowPointerConstraintsSignal.DeleteWindowPointerConstraintsSignal(swigCPtr);
+        }
+
+        /// <summary>
+        /// Queries whether there are any connected slots.
+        /// </summary>
+        /// <returns>True if there are any slots connected to the signal</returns>
+        public bool Empty()
+        {
+            bool ret = Interop.WindowPointerConstraintsSignal.Empty(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Queries the number of slots.
+        /// </summary>
+        /// <returns>The number of slots connected to this signal</returns>
+        public uint GetConnectionCount()
+        {
+            uint ret = Interop.WindowPointerConstraintsSignal.GetConnectionCount(SwigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// Connects a function.
+        /// </summary>
+        /// <param name="func">The function to connect</param>
+        public void Connect(System.Delegate func)
+        {
+            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
+            {
+                Interop.WindowPointerConstraintsSignal.Connect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
+        }
+
+        /// <summary>
+        /// Disconnects a function.
+        /// </summary>
+        /// <param name="func">The function to disconnect</param>
+        public void Disconnect(System.Delegate func)
+        {
+            System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
+            {
+                Interop.WindowPointerConstraintsSignal.Disconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
+        }
+
+        /// <summary>
+        /// Emits the signal.
+        /// </summary>
+        /// <param name="window">The first value to pass to callbacks</param>
+        /// <param name="pointerConstraints">The second value to pass to callbacks</param>
+        public void Emit(Window window, PointerConstraints pointerConstraints)
+        {
+            Interop.WindowPointerConstraintsSignal.Emit(SwigCPtr, Window.getCPtr(window), PointerConstraints.getCPtr(pointerConstraints));
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// The constructor.
+        /// </summary>
+        public WindowPointerConstraintsSignal(Window window) : this(Interop.WindowPointerConstraintsSignal.GetSignal(Window.getCPtr(window)), false)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+    }
+}
index b7aff8b..887ca9a 100755 (executable)
@@ -170,6 +170,11 @@ namespace Tizen.NUI
                 {
                     this.ClipboardDataReceivedSignal().Disconnect(clipboardDataReceivedCallback);
                 }
+
+                if (clipboardDataSelectedCallback != null)
+                {
+                    this.ClipboardDataSelectedSignal().Disconnect(clipboardDataSelectedCallback);
+                }
             }
 
             base.Dispose(type);
index 7c812d9..5ff6443 100755 (executable)
@@ -39,6 +39,19 @@ namespace Tizen.NUI
     }
 
     /// <summary>
+    /// ClipboardDataSelectedEventArgs is a class to record clipboard selected event arguments which will be sent to user.<br/>
+    /// This is to catch data selection event.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class ClipboardDataSelectedEventArgs : EventArgs
+    {
+        /// <summary>
+        /// The mime type of clipboard selected data.
+        /// </summary>
+        public string MimeType { get; set; }
+    }
+
+    /// <summary>
     /// ClipboardEventArgs is a class to record clipboard event arguments which will be sent to user.<br/>
     /// This is for internal use only.
     /// </summary>
@@ -68,9 +81,53 @@ namespace Tizen.NUI
         private EventHandler<ClipboardEventArgs> clipboardDataReceivedEventHandler;
         private ClipboardDataReceivedCallback clipboardDataReceivedCallback;
 
+        private EventHandler<ClipboardDataSelectedEventArgs> clipboardDataSelectedEventHandler;
+        private ClipboardDataSelectedCallback clipboardDataSelectedCallback;
+
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void ClipboardDataReceivedCallback(uint id, string mimeType, string data);
 
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        private delegate void ClipboardDataSelectedCallback(string mimeType);
+
+        /// <summary>
+        /// The DataSelected event is emitted when a copy event occurs somewhere.<br/>
+        /// In order for this event to operate normally,<br/>
+        /// the process using this event must be Secondary Selection.
+        /// </summary>
+        /// <example>
+        /// The following example demonstrates how to use the DataSelected.
+        /// <code>
+        /// kvmService.SetSecondarySelction(); // precondition
+        ///
+        /// Clipboard.Instance.DataSelected += (s, e) =>
+        /// {
+        ///     string selectedType = e.MimeType;
+        /// };
+        /// </code>
+        /// </example>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public event EventHandler<ClipboardDataSelectedEventArgs> DataSelected
+        {
+            add
+            {
+                if (clipboardDataSelectedEventHandler == null)
+                {
+                    clipboardDataSelectedCallback = (OnClipboardDataSelected);
+                    ClipboardDataSelectedSignal().Connect(clipboardDataSelectedCallback);
+                }
+                clipboardDataSelectedEventHandler += value;
+            }
+            remove
+            {
+                clipboardDataSelectedEventHandler -= value;
+                if (clipboardDataSelectedEventHandler == null && ClipboardDataSelectedSignal().Empty() == false)
+                {
+                    ClipboardDataSelectedSignal().Disconnect(clipboardDataSelectedCallback);
+                }
+            }
+        }
+
         private event EventHandler<ClipboardEventArgs> ClipboardDataReceived
         {
             add
@@ -92,6 +149,20 @@ namespace Tizen.NUI
             }
         }
 
+        internal ClipboardSignal ClipboardDataSelectedSignal()
+        {
+            var ret = new ClipboardSignal(Interop.Clipboard.ClipboardDataSelectedSignal(SwigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        private void OnClipboardDataSelected(string mimeType)
+        {
+            var e = new ClipboardDataSelectedEventArgs();
+            e.MimeType = mimeType;
+            clipboardDataSelectedEventHandler?.Invoke(this, e);
+        }
+
         internal ClipboardSignal ClipboardDataReceivedSignal()
         {
             var ret = new ClipboardSignal(Interop.Clipboard.ClipboardDataReceivedSignal(SwigCPtr), false);
diff --git a/src/Tizen.NUI/src/public/Window/PointerConstraints.cs b/src/Tizen.NUI/src/public/Window/PointerConstraints.cs
new file mode 100755 (executable)
index 0000000..c3b623a
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright(c) 2023 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.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// PointerConstraints is used when pointer is locked/unlocked
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public class PointerConstraints : Disposable
+    {
+
+        /// <summary>
+        /// The default constructor.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public PointerConstraints() : this(Interop.PointerConstraints.NewPointerConstraints(0, 0, false, false), true)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        /// <summary>
+        /// The constructor.
+        /// </summary>
+        /// <param name="x">The x coordinate relative to window where event happened.</param>
+        /// <param name="y">The y coordinate relative to window where event happened.</param>
+        /// <param name="locked">The status whether pointer is locked/unlocked.</param>
+        /// <param name="confined">The status whether pointer is confined/unconfined.</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public PointerConstraints(int x, int y, bool locked, bool confined): this(Interop.PointerConstraints.NewPointerConstraints(x, y, locked, confined), true)
+        {
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
+
+        internal PointerConstraints(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
+        {
+        }
+
+        /// <summary>
+        /// Gets the x, y position,
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Position2D Position
+        {
+            get
+            {
+                return position;
+            }
+        }
+
+        /// <summary>
+        /// Gets the status whether pointer is locked/unlocked.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Locked
+        {
+            get
+            {
+                return locked;
+            }
+        }
+
+        /// <summary>
+        /// Gets the status whether pointer is confined/unconfined.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool Confined
+        {
+            get
+            {
+                return confined;
+            }
+        }
+
+        private Position2D position
+        {
+            get
+            {
+                Position2D ret = new Position2D(Interop.PointerConstraints.XGet(SwigCPtr), Interop.PointerConstraints.YGet(SwigCPtr));
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
+        }
+
+        private bool locked
+        {
+            get
+            {
+                bool ret = Interop.PointerConstraints.LockedGet(SwigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
+        }
+
+        private bool confined
+        {
+            get
+            {
+                bool ret = Interop.PointerConstraints.ConfinedGet(SwigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
+        }
+
+        internal static PointerConstraints GetPointerConstraintsFromPtr(global::System.IntPtr cPtr)
+        {
+            PointerConstraints ret = new PointerConstraints(cPtr, false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// This will not be public opened.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+        {
+            Interop.PointerConstraints.DeletePointerConstraints(swigCPtr);
+        }
+    }
+}
index 5fe725e..b278409 100755 (executable)
@@ -56,6 +56,7 @@ namespace Tizen.NUI
         private MoveCompletedEventCallbackType moveCompletedEventCallback;
         private ResizeCompletedEventCallbackType resizeCompletedEventCallback;
         private InsetsChangedEventCallbackType insetsChangedEventCallback;
+        private WindowPointerConstraintsEventCallback windowPointerConstraintsEventCallback;
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void WindowFocusChangedEventCallbackType(IntPtr window, bool focusGained);
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
@@ -88,6 +89,8 @@ namespace Tizen.NUI
         private delegate void ResizeCompletedEventCallbackType(IntPtr window, IntPtr size);
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         private delegate void InsetsChangedEventCallbackType(int partType, int partState, IntPtr extents);
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        private delegate void WindowPointerConstraintsEventCallback(IntPtr window, IntPtr constraintsEvent);
 
 
         /// <summary>
@@ -605,6 +608,34 @@ namespace Tizen.NUI
             }
         }
 
+        /// <summary>
+        /// Emits the event when pointer is locked/unlocked<br />
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public event EventHandler<PointerConstraintsEventArgs> PointerConstraintsEvent
+        {
+            add
+            {
+                if (windowPointerConstraintsEventHandler == null)
+                {
+                    windowPointerConstraintsEventCallback = OnWindowPointerConstraintsEvent;
+                    using WindowPointerConstraintsSignal signal = new WindowPointerConstraintsSignal(Interop.WindowPointerConstraintsSignal.GetSignal(SwigCPtr), false);
+                    signal?.Connect(windowPointerConstraintsEventCallback);
+                }
+                windowPointerConstraintsEventHandler += value;
+            }
+            remove
+            {
+                windowPointerConstraintsEventHandler -= value;
+                if (windowPointerConstraintsEventHandler == null && windowPointerConstraintsEventCallback != null)
+                {
+                    using WindowPointerConstraintsSignal signal = new WindowPointerConstraintsSignal(Interop.WindowPointerConstraintsSignal.GetSignal(SwigCPtr), false);
+                    signal?.Disconnect(windowMouseRelativeEventCallback);
+                    windowPointerConstraintsEventCallback = null;
+                }
+            }
+        }
+
         private event EventHandler<FocusChangedEventArgs> windowFocusChangedEventHandler;
         private event EventHandler<TouchEventArgs> rootLayerTouchDataEventHandler;
         private ReturnTypeEventHandler<object, TouchEventArgs, bool> rootLayerInterceptTouchDataEventHandler;
@@ -625,6 +656,7 @@ namespace Tizen.NUI
         private event EventHandler<WindowMoveCompletedEventArgs> moveCompletedHandler;
         private event EventHandler<WindowResizeCompletedEventArgs> resizeCompletedHandler;
         private event EventHandler<InsetsChangedEventArgs> insetsChangedEventHandler;
+        private event EventHandler<PointerConstraintsEventArgs> windowPointerConstraintsEventHandler;
 
 
         internal event EventHandler EventProcessingFinished
@@ -916,6 +948,13 @@ namespace Tizen.NUI
                 signal?.Disconnect(insetsChangedEventCallback);
                 insetsChangedEventCallback = null;
             }
+
+            if (windowPointerConstraintsEventCallback != null)
+            {
+                using WindowPointerConstraintsSignal signal = new WindowPointerConstraintsSignal(Interop.WindowPointerConstraintsSignal.GetSignal(GetBaseHandleCPtrHandleRef), false);
+                signal?.Disconnect(windowPointerConstraintsEventCallback);
+                windowPointerConstraintsEventCallback = null;
+            }
         }
 
         private void OnWindowFocusedChanged(IntPtr window, bool focusGained)
@@ -1210,6 +1249,22 @@ namespace Tizen.NUI
             }
         }
 
+        private void OnWindowPointerConstraintsEvent(IntPtr view, IntPtr constraintsEvent)
+        {
+            if (constraintsEvent == global::System.IntPtr.Zero)
+            {
+                NUILog.Error("constraintsEvent should not be null!");
+                return;
+            }
+
+            if (windowPointerConstraintsEventHandler != null)
+            {
+                PointerConstraintsEventArgs e = new PointerConstraintsEventArgs();
+                e.PointerConstraints = Tizen.NUI.PointerConstraints.GetPointerConstraintsFromPtr(constraintsEvent);
+                windowPointerConstraintsEventHandler(this, e);
+            }
+        }
+
         /// <summary>
         /// The focus changed event argument.
         /// </summary>
@@ -1378,6 +1433,32 @@ namespace Tizen.NUI
             }
         }
 
+
+        /// <summary>
+        /// PointerConstraints evnet arguments.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public class PointerConstraintsEventArgs : EventArgs
+        {
+            private PointerConstraints constraintsEvent;
+
+            /// <summary>
+            /// PointerConstraints event.
+            /// </summary>
+            [EditorBrowsable(EditorBrowsableState.Never)]
+            public PointerConstraints PointerConstraints
+            {
+                get
+                {
+                    return constraintsEvent;
+                }
+                set
+                {
+                    constraintsEvent = value;
+                }
+            }
+        }
+
         /// <summary>
         /// Do not use this, that will be deprecated.
         /// </summary>
index 34fce57..f6b91ab 100644 (file)
@@ -7,17 +7,24 @@ namespace NUIClipboard
 {
     class Program : NUIApplication
     {
-        const string TAG = "NUIClipboard";
+        const string TAG = "clipboard";
+
+        // Below are the MIME Types used in Tizen World(NUI, EFL).
         const string MIME_TYPE_PLAIN_TEXT = "text/plain;charset=utf-8";
-        const string MIME_TYPE_TEXT_URI = "text/uri-list";
         const string MIME_TYPE_HTML = "application/xhtml+xml";
+        const string MIME_TYPE_TEXT_URI = "text/uri-list";
 
         TextField fieldCopy;
-        TextField fieldPaste;
-
         TextLabel labelType;
         TextLabel labelData;
 
+        Button buttonCopy;
+        Button buttonPaste;
+        Button buttonCopyHtml;
+        Button buttonPasteHtml;
+        Button buttonCopyUri;
+        Button buttonPasteUri;
+
         protected override void OnCreate()
         {
             base.OnCreate();
@@ -26,96 +33,177 @@ namespace NUIClipboard
 
         void Initialize()
         {
-            Window.Instance.WindowSize = new Size(900, 1080);
-            Window.Instance.BackgroundColor = Color.White;
-            View mainView = NewView(false);
-            Window.Instance.GetDefaultLayer().Add(mainView);
+            GenerateUI(900, 1080);
 
-            TextLabel title = NewTextLabel("Tizen.NUI.Clipboard Test", LayoutParamPolicies.MatchParent);
-            title.HorizontalAlignment = HorizontalAlignment.Center;
-            title.PointSize = 30.0f;
-            mainView.Add(title);
-
-            string descriptionText = "[Description]\n" +
-                                     "* Copy : Copy the text entered in the TextField using the Clipboard's SetData() API.\n" +
-                                     "* This sample uses the 'text/plain;charset=utf-8' MIME type to send and receive data.\n" + 
-                                     "* Paste : Paste the text using the Clipboard's GetData() API.\n" +
-                                     "* Clear : Clear Information.";
+            // The API used by the application is Clipboard's SetData() and GetData() methods.
+            // Please refer to the code in the button Clicked event below.
 
-            TextLabel description = NewTextLabel(descriptionText, LayoutParamPolicies.MatchParent);
-            description.PointSize = 20.0f;
-            mainView.Add(description);
-
-            View vertView1 = NewView(true);
-            mainView.Add(vertView1);
-
-            fieldCopy = NewTextField("Enter text to copy", LayoutParamPolicies.MatchParent);
-            vertView1.Add(fieldCopy);
-
-            Button buttonCopy = NewButton("Copy");
-            vertView1.Add(buttonCopy);
+            // TEXT type test : "text/plain;charset=utf-8"
             buttonCopy.Clicked += (s, e) =>
             {
                 string data = fieldCopy.Text;
+                Tizen.Log.Info(TAG, $"SetData type:{MIME_TYPE_PLAIN_TEXT}, data:{data}\n");
+
+                // Set "text/plain;charset=utf-8" type data on the clipboard.
                 Clipboard.Instance.SetData(MIME_TYPE_PLAIN_TEXT, data);
-                Tizen.Log.Debug(TAG, $"SetData type:{MIME_TYPE_PLAIN_TEXT}, data:{data}");
             };
 
-
-            View vertView2 = NewView(true);
-            mainView.Add(vertView2);
-
-            Button buttonPaste = NewButton("Paste");
-            vertView2.Add(buttonPaste);
             buttonPaste.Clicked += (s, e) =>
             {
+                Tizen.Log.Info(TAG, $"GetData request type:{MIME_TYPE_PLAIN_TEXT}\n");
+
+                // Request to receive "text/plain;charset=utf-8" type data from clipboard.
+                // The results can be received through the OnClipboardDataReceived callback.
                 Clipboard.Instance.GetData(MIME_TYPE_PLAIN_TEXT, OnClipboardDataReceived);
-                Tizen.Log.Debug(TAG, $"GetData request type:{MIME_TYPE_PLAIN_TEXT}");
             };
 
-            Button buttonCopyClear = NewButton("Clear");
-            vertView2.Add(buttonCopyClear);
-            buttonCopyClear.Clicked += (s, e) =>
+            // HTML type test : "application/xhtml+xml"
+            buttonCopyHtml.Clicked += (s, e) =>
             {
-                fieldCopy.Text = "";
-                labelType.Text = " ";
-                labelData.Text = " ";
+                string data = fieldCopy.Text;
+                Tizen.Log.Info(TAG, $"SetData type:{MIME_TYPE_HTML}, data:{data}\n");
+                Clipboard.Instance.SetData(MIME_TYPE_HTML, data);
             };
 
-            View vertView3 = NewView(true);
-            mainView.Add(vertView3);
-
-            TextLabel pastedType = NewTextLabel("MIME type", 300);
-            vertView3.Add(pastedType);
-
-            labelType = NewTextLabel(" ", LayoutParamPolicies.MatchParent);
-            vertView3.Add(labelType);
-
-            View vertView4 = NewView(true);
-            mainView.Add(vertView4);
+            buttonPasteHtml.Clicked += (s, e) =>
+            {
+                Tizen.Log.Info(TAG, $"GetData request type:{MIME_TYPE_HTML}\n");
+                Clipboard.Instance.GetData(MIME_TYPE_HTML, OnClipboardDataReceived);
+            };
 
-            TextLabel pastedData = NewTextLabel("Data", 300);
-            vertView4.Add(pastedData);
+            // URI type test : "text/uri-list"
+            buttonCopyUri.Clicked += (s, e) =>
+            {
+                string data = fieldCopy.Text;
+                Tizen.Log.Info(TAG, $"SetData type:{MIME_TYPE_TEXT_URI}, data:{data}\n");
+                Clipboard.Instance.SetData(MIME_TYPE_TEXT_URI, data);
+            };
 
-            labelData = NewTextLabel(" ", LayoutParamPolicies.MatchParent);
-            vertView4.Add(labelData);
+            buttonPasteUri.Clicked += (s, e) =>
+            {
+                Tizen.Log.Info(TAG, $"GetData request type:{MIME_TYPE_TEXT_URI}\n");
+                Clipboard.Instance.GetData(MIME_TYPE_TEXT_URI, OnClipboardDataReceived);
+            };
         }
 
         public void OnClipboardDataReceived(bool success, ClipEvent clipEvent)
         {
             if (!success)
             {
-                Tizen.Log.Debug(TAG, $"Data receive fail");
+                Tizen.Log.Error(TAG, $"Data receive fail");
                 return;
             }
 
-            Tizen.Log.Debug(TAG, $"OnClipboardDataReceived type:{clipEvent.MimeType}, data{clipEvent.Data}");
+            Tizen.Log.Info(TAG, $"OnClipboardDataReceived type:{clipEvent.MimeType}, data:{clipEvent.Data}\n");
 
             // info update
             labelType.Text = clipEvent.MimeType;
             labelData.Text = clipEvent.Data;
         }
 
+        // UI code
+        public void GenerateUI(int width, int height)
+        {
+            Window.Instance.WindowSize = new Size(width, height);
+            Window.Instance.BackgroundColor = Color.White;
+
+            // Top UI
+            View mainView = NewView(false);
+            Window.Instance.GetDefaultLayer().Add(mainView);
+
+            mainView.Add(NewTitle("Tizen.NUI.Clipboard Test"));
+            mainView.Add(NewPadding(5));
+            mainView.Add(NewInfo(" ▼ Description"));
+
+            string descriptionText = "* <u>Copy</u> : Copy the text entered in the TextField using the Clipboard's <u><i>SetData()</i></u> API.\n" +
+                                     "* <u>Paste</u> : Paste the text using the Clipboard's <u><i>GetData()</i></u> API.\n" +
+                                     "* <u>Clear</u> : Clear Information.\n" +
+                                     "* This sample uses three different <u><i>MIME types(TEXT, HTML, URI)</i></u> to send and receive data.\n" + 
+                                     "* In order to send and receive data, the requested <u><i>MIME type must be the same.</i></u>\n" +
+                                     "* For example, if copy the TEXT type and try to paste the HTML type, may receive a failure callback.";
+
+            mainView.Add(NewInfo(descriptionText, true));
+            mainView.Add(NewPadding(5));
+            mainView.Add(NewInfo(" ▼ Enter the text you want copy into the TextField"));
+
+            View vertView1 = NewView(true);
+            mainView.Add(vertView1);
+
+            fieldCopy = NewTextField("Enter text to copy", LayoutParamPolicies.MatchParent);
+            vertView1.Add(fieldCopy);
+
+            Button buttonCopyClear = NewButton("Clear");
+            vertView1.Add(buttonCopyClear);
+            buttonCopyClear.Clicked += (s, e) =>
+            {
+                fieldCopy.Text = "";
+                labelType.Text = " ";
+                labelData.Text = " ";
+            };
+
+            //Copy & Paste Button
+            mainView.Add(NewPadding(5));
+            mainView.Add(NewInfo(" ▼ Select Copy or Paste with MIME type"));
+
+            // plain text
+            View vertView4 = NewView(true);
+            mainView.Add(vertView4);
+
+            vertView4.Add(NewTextLabel($"MIME type : {MIME_TYPE_PLAIN_TEXT}", LayoutParamPolicies.MatchParent));
+
+            buttonCopy = NewButton("Copy");
+            vertView4.Add(buttonCopy);
+
+            buttonPaste = NewButton("Paste");
+            vertView4.Add(buttonPaste);
+
+            // html
+            View vertView5 = NewView(true);
+            mainView.Add(vertView5);
+
+            vertView5.Add(NewTextLabel($"MIME type : {MIME_TYPE_HTML}", LayoutParamPolicies.MatchParent));
+
+            buttonCopyHtml = NewButton("Copy");
+            vertView5.Add(buttonCopyHtml);
+
+            buttonPasteHtml = NewButton("Paste");
+            vertView5.Add(buttonPasteHtml);
+
+            // text uri
+            View vertView6 = NewView(true);
+            mainView.Add(vertView6);
+
+            vertView6.Add(NewTextLabel($"MIME type : {MIME_TYPE_TEXT_URI}", LayoutParamPolicies.MatchParent));
+
+            buttonCopyUri = NewButton("Copy");
+            vertView6.Add(buttonCopyUri);
+
+            buttonPasteUri = NewButton("Paste");
+            vertView6.Add(buttonPasteUri);
+
+            // Bottom UI
+            mainView.Add(NewPadding(5));
+            mainView.Add(NewInfo(" ▼ Pasted information"));
+
+            // info type
+            View vertView2 = NewView(true);
+            mainView.Add(vertView2);
+
+            vertView2.Add(NewTextLabel("MIME type", 300));
+
+            labelType = NewTextLabel(" ", LayoutParamPolicies.MatchParent);
+            vertView2.Add(labelType);
+
+            // info data
+            View vertView3 = NewView(true);
+            mainView.Add(vertView3);
+
+            vertView3.Add(NewTextLabel("Data", 300));
+
+            labelData = NewTextLabel(" ", LayoutParamPolicies.MatchParent);
+            vertView3.Add(labelData);
+        }
+
         public View NewView(bool horizontal)
         {
             var view = new View()
@@ -124,7 +212,7 @@ namespace NUIClipboard
                 {
                     LinearOrientation = horizontal ? LinearLayout.Orientation.Horizontal : LinearLayout.Orientation.Vertical,
                     LinearAlignment = LinearLayout.Alignment.Begin,
-                    CellPadding = new Size2D(10, 20),
+                    CellPadding = new Size2D(10, 10),
                 },
                 WidthSpecification = LayoutParamPolicies.MatchParent,
                 HeightSpecification = LayoutParamPolicies.WrapContent,
@@ -133,7 +221,17 @@ namespace NUIClipboard
             return view;
         }
 
-        public TextLabel NewTextLabel(string text, int width)
+        public View NewPadding(int height)
+        {
+            var view = new View()
+            {
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = height,
+            };
+            return view;
+        }
+
+        public TextLabel NewTextLabel(string text, int width, bool borderLine = true)
         {
             var label = new TextLabel
             {
@@ -141,13 +239,29 @@ namespace NUIClipboard
                 MultiLine = true,
                 WidthSpecification = width,
                 HeightSpecification = LayoutParamPolicies.WrapContent,
-                PointSize = 25.0f,
+                PointSize = 20.0f,
                 BackgroundColor = Color.White,
-                BorderlineWidth = 1.0f,
+                BorderlineWidth = borderLine ? 1.0f : 0.0f,
+                EnableMarkup = true,
             };
             return label;
         }
 
+        public TextLabel NewInfo(string text, bool borderLine = false)
+        {
+            var info = NewTextLabel(text, LayoutParamPolicies.MatchParent, borderLine);
+            info.PointSize = 16.0f;
+            return info;
+        }
+
+        public TextLabel NewTitle(string text)
+        {
+            var title = NewTextLabel(text, LayoutParamPolicies.MatchParent);
+            title.HorizontalAlignment = HorizontalAlignment.Center;
+            title.PointSize = 25.0f;
+            return title;
+        }
+
         public TextField NewTextField(string placeholderText, int width)
         {
             var field = new TextField
@@ -156,9 +270,10 @@ namespace NUIClipboard
                 PlaceholderTextFocused = placeholderText,
                 WidthSpecification = width,
                 HeightSpecification = LayoutParamPolicies.WrapContent,
-                PointSize = 25.0f,
+                PointSize = 20.0f,
                 BackgroundColor = Color.White,
                 BorderlineWidth = 1.0f,
+                MaxLength = 1000,
             };
             return field;
         }
@@ -168,9 +283,10 @@ namespace NUIClipboard
             var button = new Button(NewButtonStyle())
             {
                 Text = text,
-                PointSize = 25.0f,
+                PointSize = 20.0f,
                 WidthSpecification = 200,
                 HeightSpecification = LayoutParamPolicies.WrapContent,
+                ItemHorizontalAlignment = HorizontalAlignment.Center,
             };
             return button;
         }
diff --git a/test/NUIClipboardDataSelected/ClipboardDataSelected.cs b/test/NUIClipboardDataSelected/ClipboardDataSelected.cs
new file mode 100644 (file)
index 0000000..80ff348
--- /dev/null
@@ -0,0 +1,117 @@
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.WindowSystem;
+
+/*
+ * This app has no UI.
+ * After the app is launched, it is hidden and the focus is skipped.
+ * This is a sample app that becomes SecondarySelection and catches the Copy event of another process.
+ * If there is another SecondarySelection already running on the device, this sample will not work properly.
+ */
+
+namespace NUIClipboardDataSelected
+{
+    class Program : NUIApplication
+    {
+        const string TAG = "clipboard";
+        const string MIME_TYPE_PLAIN_TEXT = "text/plain;charset=utf-8";
+
+        protected override void OnCreate()
+        {
+            base.OnCreate();
+            Initialize();
+        }
+
+        void Initialize()
+        {
+            Window.Instance.WindowSize = new Size(1, 1);
+            Window.Instance.BackgroundColor = Color.White;
+
+            Tizen.NUI.WindowSystem.Shell.TizenShell tzShell;
+            tzShell = new Tizen.NUI.WindowSystem.Shell.TizenShell();
+            Window.Instance.SetAcceptFocus(false);
+
+            Tizen.NUI.WindowSystem.Shell.KVMService kvmService;
+            // Window that will act as KVM Service.
+            kvmService = new Tizen.NUI.WindowSystem.Shell.KVMService(tzShell, Window.Instance); 
+            kvmService.SetSecondarySelction();
+
+            // This view has nothing to do with this test, just for easy debugging.
+            // If there is a view, it is exposed to the process monitor.
+            View view = NewView();
+            Window.Instance.GetDefaultLayer().Add(view);
+
+            // Register event handler.
+            Clipboard.Instance.DataSelected += OnClipboardDataSelected;
+
+            // Self copy test.
+            CopyTest();
+        }
+
+        // When copy occurs somewhere, this callback is invoked.
+        public void OnClipboardDataSelected(object sender, ClipboardDataSelectedEventArgs e)
+        {
+            // e.MimeType is the MIME type of the copy data that invoked this callback.
+            string selectedType = e.MimeType;
+            Tizen.Log.Info(TAG, $"OnClipboardDataSelected type:{selectedType}\n");
+
+            // Do something here.
+            // For example, MC app can call Clipboard's GetData() with the MIME type of the event argument.
+            Clipboard.Instance.GetData(selectedType, OnClipboardDataReceived);
+        }
+
+        // When call Clipboard's GetData(), the user callback is called.
+        public void OnClipboardDataReceived(bool success, ClipEvent clipEvent)
+        {
+            if (!success)
+            {
+                Tizen.Log.Error(TAG, $"Data receive fail");
+                return;
+            }
+
+            Tizen.Log.Info(TAG, $"OnClipboardDataReceived type:{clipEvent.MimeType}, data:{clipEvent.Data}\n");
+        }
+
+        public void CopyTest()
+        {
+            // Self copy test.
+            // * SetData() is called 5 seconds after app execution.
+            // * Observe the Log of OnClipboardDataSelected.
+            // * If the log is output, there is a problem somewhere.
+            // * DataSelected event should not be invoked
+            // * by the SetData() called within the SecondarySelection.
+            Timer timer = new Timer(5000);
+            timer.Tick += (s, e) =>
+            {
+                string data = "Lorem ipsum dolor sit amet consectetuer";
+                Tizen.Log.Info(TAG, $"SetData type:{MIME_TYPE_PLAIN_TEXT}, data:{data}\n");
+                Clipboard.Instance.SetData(MIME_TYPE_PLAIN_TEXT, data);
+                return false;
+            };
+            timer.Start();
+        }
+
+        public View NewView()
+        {
+            var view = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                    LinearAlignment = LinearLayout.Alignment.Begin,
+                },
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+                BackgroundColor = Color.White,
+            };
+            return view;
+        }
+
+        static void Main(string[] args)
+        {
+            var app = new Program();
+            app.Run(args);
+        }
+    }
+}
diff --git a/test/NUIClipboardDataSelected/NUIClipboardDataSelected.csproj b/test/NUIClipboardDataSelected/NUIClipboardDataSelected.csproj
new file mode 100644 (file)
index 0000000..d6260df
--- /dev/null
@@ -0,0 +1,28 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+    <PropertyGroup>
+        <OutputType>Exe</OutputType>
+        <TargetFramework>net6.0</TargetFramework>
+    </PropertyGroup>
+
+    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+        <DebugType>portable</DebugType>
+    </PropertyGroup>
+    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+        <DebugType>None</DebugType>
+    </PropertyGroup>
+
+    <ItemGroup>
+        <PackageReference Include="Tizen.NET.Sdk" Version="1.0.9" />
+        <ProjectReference Include="../../src/Tizen/Tizen.csproj" />
+        <ProjectReference Include="../../src/Tizen.NUI.Components/Tizen.NUI.Components.csproj" />
+        <ProjectReference Include="../../src/Tizen.NUI/Tizen.NUI.csproj" />
+        <ProjectReference Include="../../src/Tizen.NUI.WindowSystem/Tizen.NUI.WindowSystem.csproj" />
+    </ItemGroup>
+
+    <PropertyGroup>
+        <NeedInjection>True</NeedInjection>
+    </PropertyGroup>
+
+</Project>
+
diff --git a/test/NUIClipboardDataSelected/shared/res/NUIClipboardDataSelected.png b/test/NUIClipboardDataSelected/shared/res/NUIClipboardDataSelected.png
new file mode 100644 (file)
index 0000000..62d0dff
Binary files /dev/null and b/test/NUIClipboardDataSelected/shared/res/NUIClipboardDataSelected.png differ
diff --git a/test/NUIClipboardDataSelected/tizen-manifest.xml b/test/NUIClipboardDataSelected/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..0feb628
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="6" package="org.tizen.example.NUIClipboardDataSelected" version="1.0.0">
+  <profile name="common" />
+  <ui-application appid="org.tizen.example.NUIClipboardDataSelected"
+                                       exec="NUIClipboardDataSelected.dll"
+                                       type="dotnet-nui"
+                                       multiple="false"
+                                       taskmanage="true"
+                                       nodisplay="false"
+                                       launch_mode="single"
+          >
+    <label>NUIClipboardDataSelected</label>
+    <icon>NUIClipboardDataSelected.png</icon>
+    <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
+  </ui-application>
+</manifest>