Merge "Change adding focus indicator logic" into devel/master
authorminho.sun <minho.sun@samsung.com>
Wed, 15 Feb 2017 12:27:31 +0000 (04:27 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 15 Feb 2017 12:27:32 +0000 (04:27 -0800)
25 files changed:
automated-tests/src/dali-toolkit/utc-Dali-ControlWrapper.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
automated-tests/src/dali-toolkit/utc-Dali-VisualFactory.cpp
dali-toolkit/devel-api/controls/control-wrapper-impl.cpp
dali-toolkit/devel-api/controls/control-wrapper-impl.h
dali-toolkit/devel-api/controls/control-wrapper.cpp
dali-toolkit/devel-api/controls/control-wrapper.h
dali-toolkit/internal/file.list
dali-toolkit/internal/visuals/image/batch-image-visual.cpp [deleted file]
dali-toolkit/internal/visuals/image/batch-image-visual.h [deleted file]
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/text/text-visual.h
dali-toolkit/internal/visuals/visual-factory-cache.cpp
dali-toolkit/internal/visuals/visual-factory-cache.h
dali-toolkit/internal/visuals/visual-factory-impl.cpp
dali-toolkit/public-api/visuals/image-visual-properties.h
plugins/dali-swig/examples/custom-control.cs
plugins/dali-swig/examples/dali-test.cs
plugins/dali-swig/manual/cpp/view-wrapper-impl-wrap.cpp
plugins/dali-swig/manual/csharp/CustomView.cs
plugins/dali-swig/manual/csharp/ManualPINVOKE.cs
plugins/dali-swig/manual/csharp/ViewRegistry.cs
plugins/dali-swig/manual/csharp/ViewWrapper.cs
plugins/dali-swig/manual/csharp/ViewWrapperImpl.cs
plugins/dali-swig/views/spin.cs

index 32076f1..8caf518 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali-toolkit-test-suite-utils.h>
 
 #include <dali.h>
+#include <dali/public-api/dali-core.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/control-wrapper.h>
 #include <dali-toolkit/devel-api/controls/control-wrapper-impl.h>
@@ -216,8 +217,12 @@ struct TestCustomControl : public Toolkit::Internal::ControlWrapper
   bool mNego;
   unsigned int mDepth;
 };
+
 }
 
+static std::string customControlTypeName = "TestCustomControl";
+static TypeRegistration customControl( customControlTypeName, typeid(Dali::Toolkit::Control), NULL );
+
 int UtcDaliControlWrapperConstructor(void)
 {
   ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
@@ -227,9 +232,10 @@ int UtcDaliControlWrapperConstructor(void)
 
   DALI_TEST_CHECK( !ControlWrapper::DownCast( controlWrapper ) );
 
-  controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   DALI_TEST_CHECK( ControlWrapper::DownCast( controlWrapper ) );
+
   END_TEST;
 }
 
@@ -237,7 +243,7 @@ int UtcDaliControlWrapperDestructor(void)
 {
   TestApplication application;
 
-  ControlWrapper control = ControlWrapper::New( *( new Toolkit::Internal::ControlWrapper( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT ) ) );
+  ControlWrapper control = ControlWrapper::New( customControlTypeName, *( new Toolkit::Internal::ControlWrapper( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT ) ) );
 
   ControlWrapper control2( control );
 
@@ -259,7 +265,7 @@ int UtcDaliControlWrapperRelayoutRequest(void)
   DALI_TEST_EQUALS( gOnRelayout, false, TEST_LOCATION );
 
   Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-  ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   Stage::GetCurrent().Add( controlWrapper );
 
@@ -283,7 +289,7 @@ int UtcDaliControlWrapperImplGetHeightForWidthBase(void)
   TestApplication application;
 
   Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-  ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   float width = 300.0f;
   float v = 0.0f;
@@ -303,7 +309,7 @@ int UtcDaliControlWrapperGetWidthForHeightBase(void)
   TestApplication application;
 
   Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-  ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   float height = 300.0f;
   float v = 0.0f;
@@ -323,7 +329,7 @@ int UtcDaliControlWrapperCalculateChildSizeBase(void)
   TestApplication application;
 
   Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-  ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   Actor child = Actor::New();
   child.SetResizePolicy( Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS );
@@ -344,7 +350,7 @@ int UtcDaliControlWrapperRelayoutDependentOnChildrenBase(void)
   TestApplication application;
 
   Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-  ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   bool v = false;
 
@@ -371,7 +377,7 @@ int UtcDaliControlWrapperRegisterVisualToSelf(void)
 
   {
     Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-    ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+    ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
     objectDestructionTracker.Start( controlWrapper );
 
@@ -404,7 +410,7 @@ int UtcDaliControlWrapperRegisterDisabledVisual(void)
   ToolkitTestApplication application;
 
   Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-  ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   Property::Index TEST_PROPERTY = 1;
 
@@ -446,7 +452,7 @@ int UtcDaliControlWrapperRegisterUnregisterVisual(void)
   ToolkitTestApplication application;
 
   Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-  ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   Property::Index index = 1;
 
@@ -491,7 +497,7 @@ int UtcDaliControlWrapperTransitionDataMap1N(void)
   Dali::Toolkit::TransitionData transition = TransitionData::New( map );
 
   Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-  ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   //DummyControl actor = DummyControl::New();
   controlWrapper.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
@@ -544,10 +550,56 @@ int UtcDaliControlWrapperApplyThemeStyle(void)
   ToolkitTestApplication application;
 
   Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
-  ControlWrapper controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
 
   controlWrapperImpl->ApplyThemeStyle();
 
   DALI_TEST_CHECK( true );
   END_TEST;
 }
+
+int UtcDaliControlWrapperTestControlProperties(void)
+{
+  ToolkitTestApplication application;
+
+  Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
+  ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
+
+  Stage::GetCurrent().Add( controlWrapper );
+
+  // "background" property
+  Property::Map rendererMap;
+  rendererMap[Visual::Property::TYPE] = Visual::COLOR;
+  rendererMap[ColorVisual::Property::MIX_COLOR] = Color::RED;
+  controlWrapper.SetProperty( Control::Property::BACKGROUND, rendererMap );
+  Property::Value propertyValue = controlWrapper.GetProperty( Control::Property::BACKGROUND );
+  Property::Map* resultMap = propertyValue.GetMap();
+  DALI_TEST_CHECK( resultMap->Find( Visual::Property::TYPE ) );
+  DALI_TEST_EQUALS( resultMap->Find( Visual::Property::TYPE )->Get<int>(), (int)Visual::COLOR, TEST_LOCATION );
+  DALI_TEST_CHECK( resultMap->Find( ColorVisual::Property::MIX_COLOR ) );
+  DALI_TEST_EQUALS( resultMap->Find( ColorVisual::Property::MIX_COLOR )->Get<Vector4>(), Color::RED, TEST_LOCATION );
+
+  // "keyInputFocus" property
+  controlWrapper.SetProperty( Control::Property::KEY_INPUT_FOCUS, true );
+  DALI_TEST_EQUALS( true, controlWrapper.GetProperty( Control::Property::KEY_INPUT_FOCUS ).Get< bool >(), TEST_LOCATION );
+
+  // "styleName" property
+  controlWrapper.SetProperty( Control::Property::STYLE_NAME, "MyCustomStyle" );
+  DALI_TEST_EQUALS( "MyCustomStyle", controlWrapper.GetProperty( Control::Property::STYLE_NAME ).Get< std::string >(), TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliControlWrapperTypeRegistryCreation(void)
+{
+  ToolkitTestApplication application;
+
+  TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ControlWrapper" );
+  DALI_TEST_CHECK( typeInfo )
+
+  // Check that we can't create a ControlWrapper instance
+  BaseHandle baseHandle = typeInfo.CreateInstance();
+  DALI_TEST_CHECK( !baseHandle )
+
+  END_TEST;
+}
index f0175c4..f399d4d 100644 (file)
@@ -286,19 +286,6 @@ int UtcDaliVisualSize(void)
   svgVisual2.GetNaturalSize(naturalSize);
   DALI_TEST_EQUALS( naturalSize, Vector2(100.f, 100.f), TEST_LOCATION ); // Natural size should still be 100, 100
 
-  // Batch Image visual
-  TestPlatformAbstraction& platform = application.GetPlatform();
-  Vector2 testSize(80.f, 160.f);
-  platform.SetClosestImageSize(testSize);
-  propertyMap.Clear();
-  propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
-  propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-  propertyMap.Insert( "batchingEnabled", true );
-  Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
-  batchImageVisual.SetTransformAndSize(DefaultTransform(), controlSize );
-  batchImageVisual.GetNaturalSize( naturalSize );
-  DALI_TEST_EQUALS( naturalSize, Vector2( 80.0f, 160.0f ), TEST_LOCATION );
-
   // Text visual.
 
   // Load some fonts to get the same metrics on different platforms.
@@ -957,45 +944,6 @@ int UtcDaliVisualGetPropertyMap9(void)
   END_TEST;
 }
 
-int UtcDaliVisualGetPropertyMapBatchImageVisual(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualGetPropertyMapBatchImageVisual:" );
-
-  VisualFactory factory = VisualFactory::Get();
-  Property::Map propertyMap;
-  propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
-  propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
-  propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-  propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 20 );
-  propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 30 );
-
-  Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
-  DALI_TEST_CHECK( batchImageVisual );
-
-  Property::Map resultMap;
-  batchImageVisual.CreatePropertyMap( resultMap );
-
-  // Check the property values from the returned map from visual
-  Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
-
-  value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
-
-  value = resultMap.Find( ImageVisual::Property::DESIRED_WIDTH, Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<int>() == 20 );
-
-  value = resultMap.Find( ImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_CHECK( value->Get<int>() == 30 );
-
-  END_TEST;
-}
-
 //Text shape visual
 int UtcDaliVisualGetPropertyMap10(void)
 {
@@ -1117,36 +1065,6 @@ int UtcDaliVisualGetPropertyMap11(void)
   END_TEST;
 }
 
-int UtcDaliVisualGetPropertyMapBatchImageVisualNoAtlas(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualGetPropertyMapBatchImageVisualNoAtlas:" );
-
-  VisualFactory factory = VisualFactory::Get();
-  Property::Map propertyMap;
-  propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
-  propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
-  propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-
-  // Set the desired size to be larger than the atlas limit of 1024x1024.
-  propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 2048 );
-  propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 2048 );
-
-  // Create the visual.
-  Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
-
-  DALI_TEST_CHECK( batchImageVisual );
-
-  DummyControl dummyControl = DummyControl::New(true);
-  Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
-  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, batchImageVisual );
-  Stage::GetCurrent().Add( dummyControl );
-
-  DALI_TEST_CHECK( dummyControl.GetRendererCount() == 1u );
-
-  END_TEST;
-}
-
 int UtcDaliVisualAnimateBorderVisual01(void)
 {
   ToolkitTestApplication application;
index 48de1ca..2eb6262 100644 (file)
@@ -1976,142 +1976,6 @@ int UtcDaliVisualFactoryGetPrimitiveVisualN1(void)
   END_TEST;
 }
 
-int UtcDaliVisualFactoryGetBatchImageVisual1(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualFactoryGetBatchImageVisual1: Request a Batch Image visual with a Property::Map" );
-
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  Property::Map propertyMap;
-  propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
-  propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
-  propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-
-  Visual::Base visual = factory.CreateVisual( propertyMap );
-  DALI_TEST_CHECK( visual );
-
-  DummyControl actor = DummyControl::New();
-  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
-
-  actor.SetSize( 200.0f, 200.0f );
-  Stage::GetCurrent().Add( actor );
-  visual.SetTransformAndSize(DefaultTransform(),  Vector2( 200.0f, 200.0f ) );
-
-  // Test SetOnStage().
-  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-
-  application.SendNotification();
-  application.Render();
-
-  // Test SetOffStage().
-  actor.Unparent();
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
-  END_TEST;
-}
-
-int UtcDaliVisualFactoryGetBatchImageVisual2(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualFactoryGetBatchImageVisual2: Request Batch Image visual from an Image Visual with batchingEnabled set" );
-
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  Property::Map propertyMap;
-  // Create a normal Image Visual.
-  propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
-  // Instruct the factory to change Image Visuals to Batch-Image Visuals.
-  propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
-
-  // Properties for the Batch-Image Visual.
-  propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-
-  Visual::Base visual = factory.CreateVisual( propertyMap );
-  DALI_TEST_CHECK( visual );
-
-  // Check that a Batch-Image visual was created instead of an Image visual.
-  Property::Map resultMap;
-  visual.CreatePropertyMap( resultMap );
-
-  Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
-  DALI_TEST_CHECK( value );
-  DALI_TEST_EQUALS( value->Get<int>(), (int)Visual::IMAGE, TEST_LOCATION );
-
-  DummyControl actor = DummyControl::New();
-  DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
-  dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
-
-  actor.SetSize( 200.0f, 200.0f );
-  Stage::GetCurrent().Add( actor );
-  visual.SetTransformAndSize(DefaultTransform(),  Vector2( 200.0f, 200.0f ) );
-
-  // Test SetOnStage().
-  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-
-  application.SendNotification();
-  application.Render();
-
-  // Test SetOffStage().
-  actor.Unparent();
-  DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
-  END_TEST;
-}
-
-int UtcDaliVisualFactoryGetBatchImageVisual3(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualFactoryGetBatchImageVisual3: Create an ImageView that uses a batched visual internally" );
-
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  // Create a property-map that enables batching.
-  Property::Map propertyMap;
-  propertyMap[ Dali::Toolkit::ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME ;
-  propertyMap[ "desiredHeight" ] = 200;
-  propertyMap[ "desiredWidth" ] = 200;
-  propertyMap[ "batchingEnabled" ] = true;
-
-  // Create an ImageView, passing the property-map in to instruct it to use batching.
-  Toolkit::ImageView imageView = Toolkit::ImageView::New();
-  imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap );
-
-  imageView.SetSize( 200.0f, 200.0f );
-  Stage::GetCurrent().Add( imageView );
-
-  END_TEST;
-}
-
-int UtcDaliVisualFactoryGetBatchImageVisual4N(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliVisualFactoryGetBatchImageVisual4: Create an ImageView that uses a batched visual, with desired properties of the wrong type" );
-
-  VisualFactory factory = VisualFactory::Get();
-  DALI_TEST_CHECK( factory );
-
-  // Create a property-map that enables batching.
-  Property::Map propertyMap;
-  propertyMap[ Dali::Toolkit::ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME ;
-  propertyMap[ "desiredHeight" ] = Vector2(100, 100);
-  propertyMap[ "desiredWidth" ] = Vector3(1, 1, 1);
-  propertyMap[ "batchingEnabled" ] = true;
-
-  // Create an ImageView, passing the property-map in to instruct it to use batching.
-  Toolkit::ImageView imageView = Toolkit::ImageView::New();
-  imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap );
-
-  imageView.SetSize( 200.0f, 200.0f );
-  Stage::GetCurrent().Add( imageView );
-
-  END_TEST;
-}
-
 int UtcDaliVisualFactoryGetAnimatedImageVisual1(void)
 {
   ToolkitTestApplication application;
index 48019fe..d3fcc56 100755 (executable)
 // CLASS HEADER
 #include <dali-toolkit/devel-api/controls/control-wrapper-impl.h>
 
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
 #include <dali/public-api/animation/animation.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/devel-api/object/handle-devel.h>
+
+// INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
 #include <dali-toolkit/public-api/styling/style-manager.h>
@@ -34,11 +39,26 @@ namespace Toolkit
 namespace Internal
 {
 
+namespace
+{
+
+BaseHandle Create()
+{
+  // empty handle as we cannot create control wrapper
+  return BaseHandle();
+}
+
+// Setup type-registry.
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ControlWrapper, Toolkit::Control, Create )
+DALI_TYPE_REGISTRATION_END()
+
+}
+
 /*
  * Implementation.
  */
 
-Dali::Toolkit::ControlWrapper ControlWrapper::New( ControlWrapper* controlWrapper )
+Dali::Toolkit::ControlWrapper ControlWrapper::New( const std::string& typeName, ControlWrapper* controlWrapper )
 {
   ControlWrapperPtr wrapper( controlWrapper );
 
@@ -49,6 +69,19 @@ Dali::Toolkit::ControlWrapper ControlWrapper::New( ControlWrapper* controlWrappe
   // This can only be done after the CustomActor connection has been made.
   wrapper->Initialize();
 
+  // Different types of C# custom view registered themselves using type registry,
+  // but their type names are registered per type not per instance, so they still
+  // have the same wrong type name in native side when type registry queries the
+  // unique type name of each instance using typeid() because of the binding.
+  // Therefore, we have to link each instance with its correct type info if already
+  // pre-registered.
+
+  TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeName );
+  if(typeInfo)
+  {
+    Dali::DevelHandle::SetTypeInfo( handle, typeInfo );
+  }
+
   return handle;
 }
 
index fa9173f..33905a5 100755 (executable)
@@ -64,9 +64,13 @@ public:
 
   /**
    * Create a new ControlWrapper.
+   *
+   * @param[in] typeName The name of the type that is registered with this control
+   * @param[in] controlWrapper The implementation of this control
+   *
    * @return A public handle to the newly allocated ControlWrapper.
    */
-  static Dali::Toolkit::ControlWrapper New( ControlWrapper* controlWrapper );
+  static Dali::Toolkit::ControlWrapper New( const std::string& typeName, ControlWrapper* controlWrapper );
 
 public: // From CustomActorImpl
 
index 7f8db27..0c6be01 100644 (file)
@@ -31,9 +31,9 @@ namespace Toolkit
 // ControlWrapper
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-ControlWrapper ControlWrapper::New( Internal::ControlWrapper& implementation )
+ControlWrapper ControlWrapper::New( const std::string& typeName, Internal::ControlWrapper& implementation )
 {
-  return Internal::ControlWrapper::New( &implementation );
+  return Internal::ControlWrapper::New( typeName, &implementation );
 }
 
 ControlWrapper::ControlWrapper()
index a45c4b5..b50852b 100644 (file)
@@ -45,9 +45,12 @@ public:
   /**
    * @brief Create a new instance of a ControlWrapper.
    *
+   * @param[in] typeName The name of the type that is registered with this control
+   * @param[in] implementation The implementation of this control
+   *
    * @return A handle to a new ControlWrapper.
    */
-  static ControlWrapper New( Internal::ControlWrapper& implementation );
+  static ControlWrapper New( const std::string& typeName, Internal::ControlWrapper& implementation );
 
   /**
    * @brief Creates an empty ControlWrapper handle.
index 84f3214..2fcc669 100755 (executable)
@@ -24,7 +24,6 @@ toolkit_src_files = \
    $(toolkit_src_dir)/visuals/gradient/linear-gradient.cpp \
    $(toolkit_src_dir)/visuals/gradient/radial-gradient.cpp \
    $(toolkit_src_dir)/visuals/gradient/gradient-visual.cpp \
-   $(toolkit_src_dir)/visuals/image/batch-image-visual.cpp \
    $(toolkit_src_dir)/visuals/image/image-visual.cpp \
    $(toolkit_src_dir)/visuals/mesh/mesh-visual.cpp \
    $(toolkit_src_dir)/visuals/npatch/npatch-visual.cpp \
diff --git a/dali-toolkit/internal/visuals/image/batch-image-visual.cpp b/dali-toolkit/internal/visuals/image/batch-image-visual.cpp
deleted file mode 100644 (file)
index 47f0316..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright (c) 2016 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 "batch-image-visual.h"
-
-// EXTERNAL HEADER
-#include <cstring> // for strncasecmp
-#include <dali/public-api/images/resource-image.h>
-#include <dali/public-api/images/native-image.h>
-#include <dali/integration-api/debug.h>
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
-#include <dali/devel-api/rendering/renderer-devel.h>
-#include <dali/public-api/images/pixel-data.h>
-#include <dali/public-api/rendering/texture.h>
-#include <dali/public-api/rendering/texture-set.h>
-#include <dali/public-api/rendering/texture-set.h>
-
-// INTERNAL HEADER
-#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
-#include <dali-toolkit/internal/visuals/visual-string-constants.h>
-#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace
-{
-const char HTTP_URL[] = "http://";
-const char HTTPS_URL[] = "https://";
-
-// Properties:
-const char * const DESIRED_WIDTH( "desiredWidth" );
-const char * const DESIRED_HEIGHT( "desiredHeight" );
-
-const Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f );
-
-// The shader used for batched rendering. It uses interleaved data for
-// attributes. Limitation is that all batched renderers will share same set of uniforms.
-const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
-  attribute mediump vec2 aPosition;\n
-  attribute mediump vec2 aTexCoord;\n
-  uniform mediump mat4 uMvpMatrix;\n
-  varying mediump vec2 vTexCoord;\n
-  \n
-  void main()\n
-  {\n
-    vTexCoord = aTexCoord;\n
-    gl_Position = uMvpMatrix * vec4( aPosition, 0.0, 1.0 );\n
-  }\n
-);
-
-const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
-  varying mediump vec2 vTexCoord;\n
-  uniform sampler2D sTexture;\n
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec4 mixColor;\n
-  uniform lowp float preMultipliedAlpha;\n
-  lowp vec4 visualMixColor()\n
-  {\n
-    return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
-  }\n
-  \n
-  void main()\n
-  {\n
-    gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();
-  }\n
-);
-
-} // unnamed namespace
-
-BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties )
-{
-  BatchImageVisualPtr visual = new BatchImageVisual( factoryCache );
-  visual->mImageUrl = url;
-  visual->SetProperties( properties );
-
-  return visual;
-}
-
-BatchImageVisual::BatchImageVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache ),
-  mImageUrl(""),
-  mDesiredSize()
-{
-}
-
-BatchImageVisual::~BatchImageVisual()
-{
-}
-
-void BatchImageVisual::DoSetProperties( const Property::Map& propertyMap )
-{
-  // url already passed in constructor
-
-  for( Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter )
-  {
-    KeyValuePair keyValue = propertyMap.GetKeyValue( iter );
-    if( keyValue.first.type == Property::Key::INDEX )
-    {
-      DoSetProperty( keyValue.first.indexKey, keyValue.second );
-    }
-    else
-    {
-      if( keyValue.first == DESIRED_WIDTH )
-      {
-        DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_WIDTH, keyValue.second );
-      }
-      else if( keyValue.first == DESIRED_HEIGHT )
-      {
-        DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, keyValue.second );
-      }
-    }
-  }
-}
-
-void BatchImageVisual::DoSetProperty( Property::Index index, const Property::Value& value )
-{
-  switch( index )
-  {
-    case Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH:
-    {
-      int width;
-      if( value.Get( width ) )
-      {
-        mDesiredSize.SetWidth( width );
-      }
-      else
-      {
-        DALI_LOG_ERROR("BatchImageVisual: width property has incorrect type\n");
-      }
-      break;
-    }
-    case Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT:
-    {
-      int height;
-      if( value.Get( height ) )
-      {
-        mDesiredSize.SetHeight( height );
-      }
-      else
-      {
-        DALI_LOG_ERROR("BatchImageVisual: height property has incorrect type\n");
-      }
-      break;
-    }
-  }
-}
-
-void BatchImageVisual::GetNaturalSize( Vector2& naturalSize )
-{
-  if( mDesiredSize.GetWidth() > 0 && mDesiredSize.GetHeight() > 0 )
-  {
-    naturalSize.x = mDesiredSize.GetWidth();
-    naturalSize.y = mDesiredSize.GetHeight();
-    return;
-  }
-  else if( !mImageUrl.empty() )
-  {
-    ImageDimensions dimentions = ResourceImage::GetImageSize( mImageUrl );
-    naturalSize.x = dimentions.GetWidth();
-    naturalSize.y = dimentions.GetHeight();
-    return;
-  }
-
-  naturalSize = Vector2::ZERO;
-}
-
-void BatchImageVisual::InitializeRenderer( const std::string& imageUrl )
-{
-  if( imageUrl.empty() )
-  {
-    return;
-  }
-
-  mImageUrl = imageUrl;
-  mImpl->mRenderer.Reset();
-  mAtlasRect = FULL_TEXTURE_RECT;
-
-  if( !mImpl->mCustomShader &&
-      ( strncasecmp( imageUrl.c_str(),HTTP_URL,  sizeof( HTTP_URL )  -1 ) != 0 ) && // Ignore remote images
-      ( strncasecmp( imageUrl.c_str(), HTTPS_URL, sizeof( HTTPS_URL ) -1 ) != 0 ) )
-  {
-    if( !mImpl->mRenderer )
-    {
-      TextureSet textureSet = mFactoryCache.GetAtlasManager()->Add(
-            mAtlasRect,
-            imageUrl,
-            mDesiredSize );
-
-      // If image doesn't fit the atlas, create new texture set with texture that
-      // is used as whole.
-      if( !textureSet )
-      {
-        BitmapLoader loader = BitmapLoader::New( imageUrl, mDesiredSize );
-        loader.Load();
-        Dali::PixelData pixelData = loader.GetPixelData();
-        Texture texture = Texture::New( TextureType::TEXTURE_2D,
-                                        pixelData.GetPixelFormat(),
-                                        pixelData.GetWidth(),
-                                        pixelData.GetHeight() );
-        texture.Upload( pixelData );
-        textureSet = TextureSet::New();
-        textureSet.SetTexture( 0, texture );
-        mAtlasRect = FULL_TEXTURE_RECT;
-      }
-
-      Geometry geometry = mFactoryCache.CreateBatchQuadGeometry( mAtlasRect );
-      Shader shader( GetBatchShader( mFactoryCache ) );
-      mImpl->mRenderer = Renderer::New( geometry, shader );
-      mImpl->mRenderer.SetTextures( textureSet );
-
-      // Turn batching on, to send message it must be on stage.
-      mImpl->mRenderer.SetProperty( Dali::DevelRenderer::Property::BATCHING_ENABLED, true );
-    }
-    mImpl->mFlags |= Impl::IS_FROM_CACHE;
-  }
-}
-
-void BatchImageVisual::DoSetOnStage( Actor& actor )
-{
-  if( !mImageUrl.empty() )
-  {
-    InitializeRenderer( mImageUrl );
-  }
-  // Turn batching on, to send message it must be on stage
-  mImpl->mRenderer.SetProperty( Dali::DevelRenderer::Property::BATCHING_ENABLED, true );
-
-  actor.AddRenderer( mImpl->mRenderer );
-}
-
-void BatchImageVisual::DoSetOffStage( Actor& actor )
-{
-  actor.RemoveRenderer( mImpl->mRenderer );
-
-  // If we own the image then make sure we release it when we go off stage
-  if( !mImageUrl.empty() )
-  {
-    CleanCache( mImageUrl );
-  }
-  else
-  {
-    mImpl->mRenderer.Reset();
-  }
-}
-
-void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const
-{
-  map.Clear();
-  map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
-
-  if( !mImageUrl.empty() )
-  {
-    map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
-    map.Insert( Toolkit::ImageVisual::Property::BATCHING_ENABLED, true );
-    map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
-    map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
-  }
-}
-
-Shader BatchImageVisual::GetBatchShader( VisualFactoryCache& factoryCache )
-{
-  Shader shader = factoryCache.GetShader( VisualFactoryCache::BATCH_IMAGE_SHADER );
-  if( !shader )
-  {
-    shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
-    factoryCache.SaveShader( VisualFactoryCache::BATCH_IMAGE_SHADER, shader );
-  }
-  return shader;
-}
-
-void BatchImageVisual::CleanCache(const std::string& url)
-{
-  TextureSet textureSet = mImpl->mRenderer.GetTextures();
-  mImpl->mRenderer.Reset();
-  if( mFactoryCache.CleanRendererCache( url ) )
-  {
-    mFactoryCache.GetAtlasManager()->Remove( textureSet, mAtlasRect );
-  }
-}
-
-void BatchImageVisual::OnSetTransform()
-{
-  if( mImpl->mRenderer )
-  {
-    //Register transform properties
-    mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
-  }
-}
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
diff --git a/dali-toolkit/internal/visuals/image/batch-image-visual.h b/dali-toolkit/internal/visuals/image/batch-image-visual.h
deleted file mode 100644 (file)
index 1f81195..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-#ifndef DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H
-#define DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H
-
-/*
- * Copyright (c) 2016 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/public-api/common/intrusive-ptr.h>
-
-// INTERNAL HEADER
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Internal
-{
-
-class BatchImageVisual;
-typedef IntrusivePtr< BatchImageVisual > BatchImageVisualPtr;
-
-class BatchImageVisual: public Visual::Base, public ConnectionTracker
-{
-public:
-
-  /**
-   * @brief Create a new batch-image visual.
-   *
-   * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
-   * @param[in] url The URL of the image to use
-   * @param[in] properties A Property::Map containing settings for this visual
-   * @return A smart-pointer to the newly allocated visual.
-   */
-  static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties = Property::Map() );
-
-public:  // from Visual
-
-  /**
-   * @copydoc Visual::Base::GetNaturalSize
-   */
-  virtual void GetNaturalSize( Vector2& naturalSize );
-
-  /**
-   * @copydoc Visual::Base::CreatePropertyMap
-   */
-  virtual void DoCreatePropertyMap( Property::Map& map ) const;
-
-protected:
-
-  /**
-   * @brief Constructor.
-   *
-   * @param[in] factoryCache The VisualFactoryCache object
-   */
-  BatchImageVisual( VisualFactoryCache& factoryCache );
-
-  /**
-   * @brief A reference counted object may only be deleted by calling Unreference().
-   */
-  ~BatchImageVisual();
-
-  /**
-   * @copydoc Visua::Base::DoSetProperties
-   */
-  virtual void DoSetProperties( const Property::Map& propertyMap );
-
-  /**
-   * @copydoc Visual::Base::DoSetOnStage
-   */
-  virtual void DoSetOnStage( Actor& actor );
-
-  /**
-   * @copydoc Visual::Base::DoSetOffStage
-   */
-  virtual void DoSetOffStage( Actor& actor );
-
-  /**
-   * @copydoc Visual::Base::OnSetTransform
-   */
-  virtual void OnSetTransform();
-
-private:
-
-  /**
-   * Get the batch image rendering shader.
-   * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
-   */
-  static Shader GetBatchShader( VisualFactoryCache& factoryCache );
-
-  /**
-   * @brief Initializes the Dali::Renderer from an image url string
-   *
-   * @param[in] imageUrl The image url string to intialize this ImageVisual from
-   */
-  void InitializeRenderer( const std::string& imageUrl );
-
-  /**
-   * Clean the Visual from cache, and remove the image from atlas if it is not used anymore
-   */
-  void CleanCache( const std::string& url );
-
-  /**
-   * Helper method to set individual values by index key.
-   * @param[in] index The index key of the value
-   * @param[in] value The value
-   */
-  void DoSetProperty( Property::Index index, const Property::Value& value );
-
-private:
-
-  Vector4                 mAtlasRect;
-  std::string             mImageUrl;
-  Dali::ImageDimensions   mDesiredSize;
-};
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H
index ec03c7f..a0197cd 100644 (file)
@@ -58,7 +58,6 @@ const char * const IMAGE_SAMPLING_MODE( "samplingMode" );
 const char * const IMAGE_DESIRED_WIDTH( "desiredWidth" );
 const char * const IMAGE_DESIRED_HEIGHT( "desiredHeight" );
 const char * const SYNCHRONOUS_LOADING( "synchronousLoading" );
-const char * const BATCHING_ENABLED( "batchingEnabled" );
 
 // fitting modes
 DALI_ENUM_TO_STRING_TABLE_BEGIN( FITTING_MODE )
index 9edf08c..b0bf8c3 100644 (file)
@@ -60,7 +60,6 @@ typedef IntrusivePtr< TextVisual > TextVisualPtr;
  * | underline           | STRING  |
  * | shadow              | STRING  |
  * | outline             | STRING  |
- * | batchingEnabled     | BOOLEAN |
  *
  */
 class TextVisual : public Visual::Base
index 05e32ff..03f31de 100644 (file)
@@ -284,49 +284,6 @@ Geometry VisualFactoryCache::CreateGridGeometry( Uint16Pair gridSize )
   return geometry;
 }
 
-Geometry VisualFactoryCache::CreateBatchQuadGeometry( Vector4 texCoords )
-{
-  const float halfWidth = 0.5f;
-  const float halfHeight = 0.5f;
-  struct QuadVertex {
-    QuadVertex( const Vector2& vertexPosition, const Vector2& vertexTexCoords )
-      : position( vertexPosition ),
-        texCoords( vertexTexCoords )
-    {}
-    Vector2 position;
-    Vector2 texCoords;
-  };
-
-  // special case, when texture takes whole space
-  if( texCoords == Vector4::ZERO )
-  {
-    texCoords = Vector4(0.0f, 0.0f, 1.0f, 1.0f);
-  }
-
-  QuadVertex quadVertexData[6] =
-  {
-    QuadVertex( Vector2(-halfWidth,   -halfHeight ),   Vector2(texCoords.x, texCoords.y) ),
-    QuadVertex( Vector2( halfWidth,   -halfHeight ),   Vector2(texCoords.z, texCoords.y) ),
-    QuadVertex( Vector2(-halfWidth,    halfHeight ),   Vector2(texCoords.x, texCoords.w) ),
-    QuadVertex( Vector2( halfWidth,   -halfHeight ),   Vector2(texCoords.z, texCoords.y) ),
-    QuadVertex( Vector2(-halfWidth,    halfHeight ),   Vector2(texCoords.x, texCoords.w) ),
-    QuadVertex( Vector2( halfWidth,    halfHeight ),   Vector2(texCoords.z, texCoords.w) ),
-  };
-
-  Property::Map vertexFormat;
-  vertexFormat[ "aPosition" ] = Property::VECTOR2;
-  vertexFormat[ "aTexCoord" ] = Property::VECTOR2;
-  PropertyBuffer vertexBuffer = PropertyBuffer::New( vertexFormat );
-  vertexBuffer.SetData( quadVertexData, 6 );
-
-  // create geometry as normal, single quad
-  Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer( vertexBuffer );
-  geometry.SetType( Geometry::TRIANGLES );
-
-  return geometry;
-}
-
 Image VisualFactoryCache::GetBrokenVisualImage()
 {
   return ResourceImage::New( BROKEN_VISUAL_IMAGE_URL );
index 641c013..c674aac 100644 (file)
@@ -64,7 +64,6 @@ public:
     GRADIENT_SHADER_RADIAL_USER_SPACE,
     GRADIENT_SHADER_RADIAL_BOUNDING_BOX,
     IMAGE_SHADER,
-    BATCH_IMAGE_SHADER,
     IMAGE_SHADER_ATLAS_DEFAULT_WRAP,
     IMAGE_SHADER_ATLAS_CUSTOM_WRAP,
     NINE_PATCH_SHADER,
@@ -134,13 +133,6 @@ public:
   static Geometry CreateGridGeometry( Uint16Pair gridSize );
 
   /**
-   * Create the batchable geometry
-   * @param[in] texCoords The texture atlas rect coordinates
-   * @return The created batchable geometry
-   */
-  static Geometry CreateBatchQuadGeometry( Vector4 texCoords );
-
-  /**
    * @brief Returns an image to be used when a visual has failed to correctly render
    * @return The broken image handle.
    */
index 2410f0a..909cfcc 100644 (file)
@@ -32,7 +32,6 @@
 #include <dali-toolkit/internal/visuals/border/border-visual.h>
 #include <dali-toolkit/internal/visuals/color/color-visual.h>
 #include <dali-toolkit/internal/visuals/gradient/gradient-visual.h>
-#include <dali-toolkit/internal/visuals/image/batch-image-visual.h>
 #include <dali-toolkit/internal/visuals/image/image-visual.h>
 #include <dali-toolkit/internal/visuals/mesh/mesh-visual.h>
 #include <dali-toolkit/internal/visuals/npatch/npatch-visual.h>
@@ -57,7 +56,6 @@ namespace Internal
 namespace
 {
 
-const char * const BATCHING_ENABLED( "batchingEnabled" );
 BaseHandle Create()
 {
   BaseHandle handle = Toolkit::VisualFactory::Get();
@@ -138,21 +136,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property
         }
         else // Regular image
         {
-          bool batchingEnabled( false );
-          Property::Value* batchingEnabledValue = propertyMap.Find( Toolkit::ImageVisual::Property::BATCHING_ENABLED, BATCHING_ENABLED );
-          if( batchingEnabledValue  )
-          {
-            batchingEnabledValue->Get( batchingEnabled );
-          }
-
-          if( batchingEnabled )
-          {
-            visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
-          }
-          else
-          {
-            visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
-          }
+          visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
         }
       }
 
index c1b0bfa..fd08176 100644 (file)
@@ -105,15 +105,6 @@ enum
   BORDER_ONLY,
 
   /**
-   * @brief This enables Image visuals to automatically be converted to Batch-Image visuals.
-   * @details Name "batchingEnabled", type Property::BOOLEAN.
-   * @SINCE_1_2.0
-   * @note Optional. If not specified, the default is false.
-   * @note For Image visuals only. Not to be used with NPatch or SVG images.
-   */
-  BATCHING_ENABLED,
-
-  /**
    * @brief The image area to be displayed.
    * @details Name "pixelArea", type Property::VECTOR4.
    *          It is a rectangular area.
index 20531a2..2da7ea4 100644 (file)
@@ -31,7 +31,21 @@ namespace MyCSharpExample
         private int _myRating;
         private bool _myDragEnabled;
 
-        public StarRating() : base(ViewWrapperImpl.CustomViewBehaviour.VIEW_BEHAVIOUR_DEFAULT)
+        // Called by DALi Builder if it finds a StarRating control in a JSON file
+        static CustomView CreateInstance()
+        {
+          return new StarRating();
+        }
+
+        // static constructor registers the control type (only runs once)
+        static StarRating()
+        {
+          // ViewRegistry registers control type with DALi type registery
+          // also uses introspection to find any properties that need to be registered with type registry
+          ViewRegistry.Instance.Register(CreateInstance, typeof(StarRating) );
+        }
+
+        public StarRating() : base(typeof(StarRating).Name, ViewWrapperImpl.CustomViewBehaviour.VIEW_BEHAVIOUR_DEFAULT)
         {
         }
 
@@ -229,6 +243,8 @@ namespace MyCSharpExample
         [STAThread]
         static void Main(string[] args)
         {
+            System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (typeof(MyCSharpExample.StarRating).TypeHandle);
+
             Example example = new Example(Application.NewApplication());
             example.MainLoop ();
         }
index 9c02eee..274b97a 100644 (file)
@@ -39,9 +39,10 @@ namespace MyCSharpExample
 
     public void Initialize(object source, NUIApplicationInitEventArgs e)
     {
-
       OperatorTests();
 
+      CustomViewPropertyTest();
+
       Handle handle = new Handle();
       int myPropertyIndex = handle.RegisterProperty("myProperty", new Property.Value(10.0f), Property.AccessMode.READ_WRITE);
       float myProperty = 0.0f;
@@ -338,6 +339,52 @@ namespace MyCSharpExample
 
   }
 
+    public void CustomViewPropertyTest()
+    {
+        // Create a Spin control
+        Spin spin = new Spin();
+
+        // Background property
+        Property.Map background = new Property.Map();
+        background.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Color) )
+                  .Add( Dali.Constants.ColorVisualProperty.MixColor, new Property.Value(Color.Red) );
+        spin.Background = background;
+
+        background = spin.Background;
+        Vector4 backgroundColor = new Vector4();
+        background.Find(Dali.Constants.ColorVisualProperty.MixColor).Get(backgroundColor);
+        if( backgroundColor == Color.Red )
+        {
+            Console.WriteLine ("Custom View Background property : test passed");
+        }
+        else
+        {
+            Console.WriteLine ("Custom View Background property : test failed");
+        }
+
+        // BackgroundColor property
+        spin.BackgroundColor = Color.Yellow;
+        if(spin.BackgroundColor == Color.Yellow)
+        {
+            Console.WriteLine ("Custom View BackgroundColor property : test passed");
+        }
+        else
+        {
+            Console.WriteLine ("Custom View BackgroundColor property : test failed");
+        }
+
+        // StyleName property
+        spin.StyleName = "MyCustomStyle";
+        if(spin.StyleName == "MyCustomStyle")
+        {
+            Console.WriteLine ("Custom View StyleName property : test passed");
+        }
+        else
+        {
+            Console.WriteLine ("Custom View StyleName property : test failed");
+        }
+    }
+
     public void MainLoop()
     {
       _application.MainLoop ();
index 3354408..9bf6950 100644 (file)
@@ -649,15 +649,21 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_ViewWrapperImpl(int jarg1) {
 }
 
 
-SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_ViewWrapperImpl_New(void * jarg1) {
+SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_ViewWrapperImpl_New(char * jarg1, void * jarg2) {
   void * jresult ;
-  Dali::Toolkit::Internal::ControlWrapper *arg1 = (Dali::Toolkit::Internal::ControlWrapper *) 0 ;
+  std::string arg1 ;
+  Dali::Toolkit::Internal::ControlWrapper *arg2 = (Dali::Toolkit::Internal::ControlWrapper *) 0 ;
   Dali::Toolkit::ControlWrapper result;
 
-  arg1 = (Dali::Toolkit::Internal::ControlWrapper *)jarg1;
+  if (!jarg1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+    return 0;
+  }
+  (&arg1)->assign(jarg1);
+  arg2 = (Dali::Toolkit::Internal::ControlWrapper *)jarg2;
   {
     try {
-      result = Dali::Toolkit::Internal::ControlWrapper::New(arg1);
+      result = Dali::Toolkit::Internal::ControlWrapper::New(arg1,arg2);
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
@@ -745,19 +751,25 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_GetControlWrapperImpl__SWIG_0(void * j
 }
 
 
-SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_ViewWrapper_New(void * jarg1) {
+SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_ViewWrapper_New(char * jarg1, void * jarg2) {
   void * jresult ;
-  Dali::Toolkit::Internal::ControlWrapper *arg1 = 0 ;
+  std::string arg1 ;
+  Dali::Toolkit::Internal::ControlWrapper *arg2 = 0 ;
   Dali::Toolkit::ControlWrapper result;
 
-  arg1 = (Dali::Toolkit::Internal::ControlWrapper *)jarg1;
-  if (!arg1) {
+  if (!jarg1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+    return 0;
+  }
+  (&arg1)->assign(jarg1);
+  arg2 = (Dali::Toolkit::Internal::ControlWrapper *)jarg2;
+  if (!arg2) {
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Toolkit::Internal::ControlWrapper & type is null", 0);
     return 0;
   }
   {
     try {
-      result = Dali::Toolkit::ControlWrapper::New(*arg1);
+      result = Dali::Toolkit::ControlWrapper::New(arg1,*arg2);
     } catch (std::out_of_range& e) {
       {
         SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
index 7e84f5b..9c54cdd 100644 (file)
@@ -19,7 +19,7 @@ namespace Dali
 {
     public class CustomView : ViewWrapper
     {
-        public CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour) : base(new ViewWrapperImpl(behaviour))
+        public CustomView(string typeName, ViewWrapperImpl.CustomViewBehaviour behaviour) : base(typeName, new ViewWrapperImpl(behaviour))
         {
             // Registering CustomView virtual functions to viewWrapperImpl delegates.
             viewWrapperImpl.OnStageConnection = new ViewWrapperImpl.OnStageConnectionDelegate(OnStageConnection);
index 3433213..6d7f471 100755 (executable)
@@ -104,7 +104,7 @@ namespace Dali
         public static extern global::System.IntPtr new_ViewWrapperImpl(int jarg1);
 
         [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_ViewWrapperImpl_New")]
-        public static extern global::System.IntPtr ViewWrapperImpl_New(global::System.Runtime.InteropServices.HandleRef jarg1);
+        public static extern global::System.IntPtr ViewWrapperImpl_New(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
         [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_delete_ViewWrapperImpl")]
         public static extern void delete_ViewWrapperImpl(global::System.Runtime.InteropServices.HandleRef jarg1);
@@ -116,7 +116,7 @@ namespace Dali
         public static extern global::System.IntPtr GetControlWrapperImpl__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1);
 
         [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_ViewWrapper_New")]
-        public static extern global::System.IntPtr ViewWrapper_New(global::System.Runtime.InteropServices.HandleRef jarg1);
+        public static extern global::System.IntPtr ViewWrapper_New(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
 
         [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_new_ViewWrapper__SWIG_0")]
         public static extern global::System.IntPtr new_ViewWrapper__SWIG_0();
index 29ece3a..c2be678 100644 (file)
@@ -98,7 +98,7 @@ namespace Dali
   ///
   ///  static Spin()
   ///  {
-  ///     ViewRegistry.Instance.RegisterControl("Spin", CreateInstance, typeof(Spin) );
+  ///     ViewRegistry.Instance.Register(CreateInstance, typeof(Spin) );
   ///  }
   ///
   ///  The control should also provide a CreateInstance function, which gets passed to the ViewRegistry
@@ -293,17 +293,17 @@ namespace Dali
     /// {
     ///   ViewRegistry registers control type with DALi type registery
     ///   also uses introspection to find any properties that need to be registered with type registry
-    ///   ViewRegistry.Instance.Register("Spin", CreateInstance, typeof(Spin) );
+    ///   ViewRegistry.Instance.Register(CreateInstance, typeof(Spin) );
     /// }
     ///
     /// </summary>
-    public void Register(string viewName, Func< CustomView > createFunction, System.Type viewType )
+    public void Register(Func< CustomView > createFunction, System.Type viewType )
     {
       // add the mapping between the view name and it's create function
-      _constructorMap.Add (viewName, createFunction);
+      _constructorMap.Add (viewType.Name, createFunction);
 
       // Call into DALi C++ to register the control with the type registry
-      TypeRegistration.RegisterControl( viewName, _createCallback );
+      TypeRegistration.RegisterControl( viewType.Name, _createCallback );
 
       // Cycle through each property in the class
       foreach (System.Reflection.PropertyInfo propertyInfo in viewType.GetProperties())
@@ -324,14 +324,14 @@ namespace Dali
               ScriptableProperty scriptableProp = attr as ScriptableProperty;
 
               // we get the start property index, based on the type and it's heirachy, e.g. DateView (70,000)-> Spin (60,000) -> View (50,000)
-              int propertyIndex =  _propertyRangeManager.GetPropertyIndex( viewName, viewType, scriptableProp.type );
+              int propertyIndex =  _propertyRangeManager.GetPropertyIndex( viewType.Name, viewType, scriptableProp.type );
 
               // get the enum for the property type... E.g. registering a string property returns Dali.PropertyType.String
               Dali.Property.Type propertyType = GetDaliPropertyType( propertyInfo.PropertyType.Name );
 
               // Example   RegisterProperty("spin","maxValue", 50001, FLOAT, set, get );
               // Native call to register the property
-              TypeRegistration.RegisterProperty (viewName, propertyInfo.Name , propertyIndex, propertyType, _setPropertyCallback, _getPropertyCallback);
+              TypeRegistration.RegisterProperty (viewType.Name, propertyInfo.Name , propertyIndex, propertyType, _setPropertyCallback, _getPropertyCallback);
             }
           }
           // Console.WriteLine ("property name = " + propertyInfo.Name);
index 76281fa..f0660b1 100644 (file)
@@ -55,7 +55,7 @@ namespace Dali
             }
         }
 
-        public ViewWrapper (ViewWrapperImpl implementation) : this (NDalicManualPINVOKE.ViewWrapper_New(ViewWrapperImpl.getCPtr(implementation)), true)
+        public ViewWrapper (string typeName, ViewWrapperImpl implementation) : this (NDalicManualPINVOKE.ViewWrapper_New(typeName, ViewWrapperImpl.getCPtr(implementation)), true)
         {
             viewWrapperImpl = implementation;
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
index 45c0175..0f42e4e 100644 (file)
@@ -141,9 +141,9 @@ namespace Dali
             DirectorConnect();
         }
 
-        public static ViewWrapper New(ViewWrapperImpl viewWrapper)
+        public static ViewWrapper New(string typeName, ViewWrapperImpl viewWrapper)
         {
-            ViewWrapper ret = new ViewWrapper(NDalicManualPINVOKE.ViewWrapperImpl_New(ViewWrapperImpl.getCPtr(viewWrapper)), true);
+            ViewWrapper ret = new ViewWrapper(NDalicManualPINVOKE.ViewWrapperImpl_New(typeName, ViewWrapperImpl.getCPtr(viewWrapper)), true);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             return ret;
         }
index 06a0210..f31a49d 100644 (file)
@@ -52,9 +52,10 @@ public class Spin : CustomView
     {
       // ViewRegistry registers control type with DALi type registery
       // also uses introspection to find any properties that need to be registered with type registry
-      ViewRegistry.Instance.Register("Spin", CreateInstance, typeof(Spin) );
+      ViewRegistry.Instance.Register(CreateInstance, typeof(Spin) );
     }
-    public Spin() : base(ViewWrapperImpl.CustomViewBehaviour.REQUIRES_KEYBOARD_NAVIGATION_SUPPORT | ViewWrapperImpl.CustomViewBehaviour.DISABLE_STYLE_CHANGE_SIGNALS)
+
+    public Spin() : base(typeof(Spin).Name, ViewWrapperImpl.CustomViewBehaviour.REQUIRES_KEYBOARD_NAVIGATION_SUPPORT | ViewWrapperImpl.CustomViewBehaviour.DISABLE_STYLE_CHANGE_SIGNALS)
     {
 
     }