/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
// 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>
+#include <dali/devel-api/actors/custom-actor-devel.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
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 );
// 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;
}
void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual )
{
- Control::RegisterVisual( index, visual );
+ DevelControl::RegisterVisual( *this, index, visual );
+}
+
+void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, int depthIndex )
+{
+ DevelControl::RegisterVisual( *this, index, visual, depthIndex );
}
void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
{
- Control::RegisterVisual( index, visual, enabled );
+ DevelControl::RegisterVisual( *this, index, visual, enabled );
+}
+
+void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex )
+{
+ DevelControl::RegisterVisual( *this, index, visual, enabled, depthIndex );
}
void ControlWrapper::UnregisterVisual( Property::Index index )
{
- Control::UnregisterVisual( index );
+ DevelControl::UnregisterVisual( *this, index );
}
Toolkit::Visual::Base ControlWrapper::GetVisual( Property::Index index ) const
{
- return Control::GetVisual( index );
+ return DevelControl::GetVisual( *this, index );
}
void ControlWrapper::EnableVisual( Property::Index index, bool enable )
{
- Control::EnableVisual( index, enable );
+ DevelControl::EnableVisual( *this, index, enable );
}
bool ControlWrapper::IsVisualEnabled( Property::Index index ) const
{
- return Control::IsVisualEnabled( index );
+ return DevelControl::IsVisualEnabled( *this, index );
}
Dali::Animation ControlWrapper::CreateTransition( const Toolkit::TransitionData& handle )
{
- return Control::CreateTransition( handle );
+ return DevelControl::CreateTransition( *this, handle );
+}
+
+void ControlWrapper::EmitKeyInputFocusSignal( bool focusGained )
+{
+ Control::EmitKeyInputFocusSignal( focusGained );
}
void ControlWrapper::ApplyThemeStyle()
}
}
+Dali::TypeInfo ControlWrapper::GetTypeInfo()
+{
+ return DevelCustomActor::GetTypeInfo(Self());
+}
+
} // namespace Internal
} // namespace Toolkit