[NUI][API12] Add creation option to visual factory
authorEunki Hong <eunkiki.hong@samsung.com>
Wed, 21 May 2025 22:47:40 +0000 (07:47 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Thu, 22 May 2025 00:33:23 +0000 (09:33 +0900)
This is backport PR of #6925

Signed-off-by: Eunki Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/internal/Interop/Interop.VisualFactory.cs
src/Tizen.NUI/src/public/Visuals/VisualFactory.cs
src/Tizen.NUI/src/public/Visuals/VisualFactoryCreationOptions.cs [new file with mode: 0644]

index 3db470b1879e5a399cd464ecbb7c198f56357222..c7b9602f4aa3db9ebd904c68385bf6dd9424d59b 100755 (executable)
@@ -31,6 +31,12 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualFactory_CreateVisual__SWIG_0")]
             public static extern global::System.IntPtr CreateVisual(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualFactory_SetDefaultCreationOptions")]
+            public static extern void SetDefaultCreationOptions(global::System.Runtime.InteropServices.HandleRef jarg1, int creationOptions);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualFactory_GetDefaultCreationOptions")]
+            public static extern int GetDefaultCreationOptions(global::System.Runtime.InteropServices.HandleRef jarg1);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_VisualFactory_AddPrecompileShader")]
             [return: global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.U1)]
             public static extern bool AddPrecompileShader(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
index 0ca06449da4deb2cd4b4fd6ad577f5bb341280e4..ecca8520a60f43ad3855a02178b628a967a9b7fb 100755 (executable)
@@ -94,6 +94,24 @@ namespace Tizen.NUI
             return ret;
         }
 
+        /// <summary>
+        /// Default creation options for the visual factory.
+        /// </summary>
+        /// <remarks>
+        /// All Visuals will got efforts when we call <see cref="CreateVisual"/>.
+        /// Default value is <see cref="VisualFactoryCreationOptions.None"/>.
+        /// </remarks>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public VisualFactoryCreationOptions DefaultCreationOptions
+        {
+            get => (VisualFactoryCreationOptions)Interop.VisualFactory.GetDefaultCreationOptions(SwigCPtr);
+            set
+            {
+                Interop.VisualFactory.SetDefaultCreationOptions(SwigCPtr, (int)value);
+                NDalicPINVOKE.ThrowExceptionIfExists();
+            }
+        }
+
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected override void Dispose(bool disposing)
         {
diff --git a/src/Tizen.NUI/src/public/Visuals/VisualFactoryCreationOptions.cs b/src/Tizen.NUI/src/public/Visuals/VisualFactoryCreationOptions.cs
new file mode 100644 (file)
index 0000000..01c4684
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright(c) 2025 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.ComponentModel;
+
+namespace Tizen.NUI
+{
+    /// <summary>
+    /// The hint options to determine the behavior how to create Visual at VisualFactory.
+    /// </summary>
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public enum VisualFactoryCreationOptions
+    {
+        /// <summary>
+        /// Do not give any hint to visual creation.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        None,
+
+        /// <summary>
+        /// Give hint to factory that it is static image if visual type is image.
+        /// It will load ImageVisual even if file extensions are animtable.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        ImageVisualLoadStaticImagesOnly,
+    }
+}