[dali_2.2.20] Merge branch 'devel/master' 42/290742/1
authorAdam Bialogonski <adam.b@samsung.com>
Fri, 31 Mar 2023 09:21:07 +0000 (10:21 +0100)
committerAdam Bialogonski <adam.b@samsung.com>
Fri, 31 Mar 2023 09:21:07 +0000 (10:21 +0100)
Change-Id: Ifa1d46da35af26cd4f930e1ffae81e66807e3a24

dali-csharp-binder/file.list
dali-csharp-binder/src/dali-wrap.cpp
dali-csharp-binder/src/font-client-wrap.cpp
dali-csharp-binder/src/slim-custom-view-impl.cpp [new file with mode: 0644]
dali-csharp-binder/src/slim-custom-view-impl.h [new file with mode: 0644]
packaging/dali-csharp-binder.spec

index c594ded..2e28c8d 100755 (executable)
@@ -67,6 +67,7 @@ SET( dali_csharp_binder_common_src_files
   ${dali_csharp_binder_dir}/src/style-manager-wrap.cpp
   ${dali_csharp_binder_dir}/src/drag-and-drop-wrap.cpp
   ${dali_csharp_binder_dir}/src/font-client-wrap.cpp
+  ${dali_csharp_binder_dir}/src/slim-custom-view-impl.cpp
 )
 
 # added for key grab binding only for tizen
index 5969e1b..e56ac3c 100644 (file)
 #include <stdio.h>
 
 #include "common.h"
+#include "slim-custom-view-impl.h"
 
 SWIG_CSharpException_t SWIG_csharp_exceptions[] = {
   { SWIG_CSharpApplicationException, NULL },
@@ -35102,6 +35103,19 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_View_New() {
   return jresult;
 }
 
+SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_View_NewCustom() {
+  void * jresult;
+  Dali::Toolkit::Control result;
+
+  {
+    try {
+      result = SlimCustomViewImpl::New(Dali::Toolkit::Internal::Control::ControlBehaviour::DISABLE_STYLE_CHANGE_SIGNALS);
+    } CALL_CATCH_EXCEPTION(0);
+  }
+
+  jresult = new Dali::Toolkit::Control((const Dali::Toolkit::Control &)result);
+  return jresult;
+}
 
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_View__SWIG_0() {
   void * jresult ;
index 9140984..251a844 100755 (executable)
@@ -35,6 +35,7 @@ extern SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback;
 typedef std::string FontPath;
 typedef std::string FontFamily;
 typedef std::string FontStyle;
+typedef std::vector<FontFamily> FontFamilyList;
 typedef std::vector<Dali::TextAbstraction::FontDescription> FontList;
 
 typedef uint32_t FontId;
@@ -59,6 +60,26 @@ SWIGEXPORT Dali::BaseHandle * SWIGSTDCALL CSharp_Dali_FontClient_SWIGUpcast(Dali
     return (Dali::BaseHandle *)jarg1;
 }
 
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Dali_FontClient_PreCache(char ** fallbackFamilyArray, int fallbackFamilySize, char ** extraFamilyArray, int extraFamilySize, char * localeFamilyString, bool useThread) {
+  FontFamilyList fallbackFamilyList;
+  FontFamilyList extraFamilyList;
+  FontFamily localeFamily = localeFamilyString ? localeFamilyString : "";
+
+  if(fallbackFamilyArray)
+  {
+    fallbackFamilyList.assign(fallbackFamilyArray, fallbackFamilyArray + fallbackFamilySize);
+  }
+
+  if(extraFamilyArray)
+  {
+    extraFamilyList.assign(extraFamilyArray, extraFamilyArray + extraFamilySize);
+  }
+
+  Dali::TextAbstraction::FontClientPreCache(fallbackFamilyList, extraFamilyList, localeFamily, useThread);
+}
+
+
 SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_FontWidthName_get() {
   void * jresult ;
   char **result = 0 ;
diff --git a/dali-csharp-binder/src/slim-custom-view-impl.cpp b/dali-csharp-binder/src/slim-custom-view-impl.cpp
new file mode 100644 (file)
index 0000000..a2ecdce
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ *
+ */
+
+// CLASS HEADER
+#include "slim-custom-view-impl.h"
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/object/handle-devel.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+// INTERNAL INCLUDES
+#include "nui-view-accessible.h"
+
+SlimCustomViewImpl::SlimCustomViewImpl(ControlBehaviour behaviourFlags) : Control(behaviourFlags)
+{
+}
+
+Dali::Toolkit::Control SlimCustomViewImpl::New(ControlBehaviour additionalBehaviour)
+{
+  // Create the implementation, temporarily owned on stack
+  Dali::IntrusivePtr<SlimCustomViewImpl> controlImpl = new SlimCustomViewImpl(Control::ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour));
+
+  // Pass ownership to handle
+  Dali::Toolkit::Control handle(*controlImpl);
+
+  // Second-phase init of the implementation
+  // This can only be done after the CustomActor connection has been made...
+  controlImpl->Initialize();
+
+  // Impersonate Control by adopting its TypeInfo. Without this, many things don't work.
+  Dali::TypeInfo typeInfo = Dali::TypeRegistry::Get().GetTypeInfo(typeid(Control));
+  if(typeInfo)
+  {
+    Dali::DevelHandle::SetTypeInfo(handle, typeInfo);
+  }
+
+  return handle;
+}
+
+Dali::Toolkit::DevelControl::ControlAccessible* SlimCustomViewImpl::CreateAccessibleObject()
+{
+  return new NUIViewAccessible(Self());
+}
diff --git a/dali-csharp-binder/src/slim-custom-view-impl.h b/dali-csharp-binder/src/slim-custom-view-impl.h
new file mode 100644 (file)
index 0000000..a2cb8e6
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef CSHARP_SLIM_CUSTOM_VIEW_IMPL_H
+#define CSHARP_SLIM_CUSTOM_VIEW_IMPL_H
+
+/*
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
+
+// INTERNAL INCLUDES
+#include "common.h"
+
+// SlimCustomViewImpl behaves almost identically to Toolkit::Internal::Control,
+// but is associated with a NUIViewAccessible, therefore opening the possibility
+// of providing Accessibility support in C#.
+class SlimCustomViewImpl : public Dali::Toolkit::Internal::Control
+{
+  using Dali::Toolkit::Internal::Control::ControlBehaviour;
+
+  SlimCustomViewImpl(ControlBehaviour behaviourFlags);
+
+public:
+  static Dali::Toolkit::Control New(ControlBehaviour additionalBehaviour);
+
+protected:
+  Dali::Toolkit::DevelControl::ControlAccessible* CreateAccessibleObject() override;
+};
+
+#endif // CSHARP_SLIM_CUSTOM_VIEW_IMPL_H
index d69f57e..33456d4 100644 (file)
@@ -21,7 +21,7 @@
 
 Name: dali2-csharp-binder
 Summary: The DALI Csharp Binder
-Version: 2.2.19
+Version: 2.2.20
 Release: 1
 Group: uifw/graphic
 License: Apache-2.0 and BSD-3-Clause and MIT