/*
- * Copyright (c) 2015 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.
return CreateBufferImage(4, 4, Color::WHITE);
}
+void PrepareResourceImage( TestApplication& application, unsigned int imageWidth, unsigned int imageHeight, Pixel::Format pixelFormat )
+{
+ TestPlatformAbstraction& platform = application.GetPlatform();
+ platform.SetClosestImageSize(Vector2( imageWidth, imageHeight));
+
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
+ Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, imageWidth, imageHeight, imageWidth, imageHeight );
+ unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
+ unsigned int initialColor = 0xFF;
+ memset( pixbuffer, initialColor, imageHeight*imageWidth*bytesPerPixel);
+
+ Integration::ResourcePointer resourcePtr(bitmap);
+ platform.SetSynchronouslyLoadedResource( resourcePtr );
+}
+
namespace Test
{
#define __DALI_TEST_SUITE_UTILS_H__
/*
- * 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.
return false;
}
+ bool result = false;
switch(type)
{
case Property::BOOLEAN:
bool a, b;
q1.Get(a);
q2.Get(b);
- return a == b;
+ result = a == b;
break;
}
case Property::INTEGER:
int a, b;
q1.Get(a);
q2.Get(b);
- return a == b;
+ result = a == b;
break;
}
case Property::FLOAT:
float a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<float>(a, b, epsilon);
+ result = CompareType<float>(a, b, epsilon);
break;
}
case Property::VECTOR2:
Vector2 a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<Vector2>(a, b, epsilon);
+ result = CompareType<Vector2>(a, b, epsilon);
break;
}
case Property::VECTOR3:
Vector3 a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<Vector3>(a, b, epsilon);
+ result = CompareType<Vector3>(a, b, epsilon);
break;
}
case Property::RECTANGLE:
Vector4 a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<Vector4>(a, b, epsilon);
+ result = CompareType<Vector4>(a, b, epsilon);
break;
}
case Property::ROTATION:
Quaternion a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<Quaternion>(a, b, epsilon);
+ result = CompareType<Quaternion>(a, b, epsilon);
+ break;
+ }
+ case Property::MATRIX:
+ case Property::MATRIX3:
+ case Property::STRING:
+ case Property::ARRAY:
+ case Property::MAP:
+ {
+ //TODO: Implement this?
+ DALI_ASSERT_ALWAYS( 0 && "Not implemented");
+ result = false;
+ break;
+ }
+ case Property::NONE:
+ {
+ result = false;
break;
}
- default:
- return false;
}
- return false;
+ return result;
}
BufferImage CreateBufferImage();
BufferImage CreateBufferImage(int width, int height, const Vector4& color);
+// Prepare a resource image to be loaded. Should be called before creating the ResourceImage
+void PrepareResourceImage( TestApplication& application, unsigned int imageWidth, unsigned int imageHeight, Pixel::Format pixelFormat );
+
// Test namespace to prevent pollution of Dali namespace, add Test helper functions here
namespace Test
{
/*
- * Copyright (c) 2014 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.
#define __DALI_TEST_APPLICATION_H__
/*
- * Copyright (c) 2014 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.
/*
- * Copyright (c) 2014 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.
/*
- * Copyright (c) 2014 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.
{
}
+
+TestNativeImageNoExtPointer TestNativeImageNoExt::New(int width, int height)
+{
+ return new TestNativeImageNoExt(width, height);
+}
+
+TestNativeImageNoExt::TestNativeImageNoExt(int width, int height)
+: mWidth(width), mHeight(height), mExtensionCreateCalls(0), mExtensionDestroyCalls(0), mTargetTextureCalls(0),createResult(true)
+{
+}
+
+TestNativeImageNoExt::~TestNativeImageNoExt()
+{
+}
+
} // namespace dali
#define __TEST_NATIVE_IMAGE_H__
/*
- * Copyright (c) 2014 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.
*/
// INTERNAL INCLUDES
-
-// EXTERNAL INCLUDES
#include <dali/public-api/images/native-image-interface.h>
#include <dali/devel-api/images/native-image-interface-extension.h>
#include <dali/integration-api/gl-defines.h>
namespace Dali
{
class TestNativeImage;
+class TestNativeImageNoExt;
typedef IntrusivePtr<TestNativeImage> TestNativeImagePointer;
+typedef IntrusivePtr<TestNativeImageNoExt> TestNativeImageNoExtPointer;
class DALI_IMPORT_API TestNativeImageExtension: public Dali::NativeImageInterface::Extension
{
inline const char* GetCustomFragmentPreFix(){return "#extension GL_OES_EGL_image_external:require\n";}
inline const char* GetCustomSamplerTypename(){return "samplerExternalOES";}
- inline int GetEglImageTextureTarget(){return GL_TEXTURE_2D;}
+ inline int GetEglImageTextureTarget(){return GL_TEXTURE_EXTERNAL_OES;}
};
inline void SetGlExtensionCreateResult(bool result){ createResult = result;}
inline virtual bool GlExtensionCreate() { ++mExtensionCreateCalls; return createResult;};
inline virtual void GlExtensionDestroy() { ++mExtensionDestroyCalls; };
- inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 1;};
+ inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 0;};
inline virtual void PrepareTexture() {};
inline virtual unsigned int GetWidth() const {return mWidth;};
inline virtual unsigned int GetHeight() const {return mHeight;};
TestNativeImageExtension* mExtension;
};
+
+class DALI_IMPORT_API TestNativeImageNoExt : public Dali::NativeImageInterface
+{
+public:
+ static TestNativeImageNoExtPointer New(int width, int height);
+
+ inline void SetGlExtensionCreateResult(bool result){ createResult = result;}
+ inline virtual bool GlExtensionCreate() { ++mExtensionCreateCalls; return createResult;};
+ inline virtual void GlExtensionDestroy() { ++mExtensionDestroyCalls; };
+ inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 1;};
+ inline virtual void PrepareTexture() {};
+ inline virtual unsigned int GetWidth() const {return mWidth;};
+ inline virtual unsigned int GetHeight() const {return mHeight;};
+ inline virtual bool RequiresBlending() const {return true;};
+
+private:
+ TestNativeImageNoExt(int width, int height);
+ virtual ~TestNativeImageNoExt();
+
+ int mWidth;
+ int mHeight;
+public:
+ int mExtensionCreateCalls;
+ int mExtensionDestroyCalls;
+ int mTargetTextureCalls;
+ bool createResult;
+};
+
} // Dali
#endif
/*
- * Copyright (c) 2014 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.
TestPlatformAbstraction::~TestPlatformAbstraction()
{
+ DiscardRequest();
}
void TestPlatformAbstraction::Suspend()
Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer( const Integration::ResourceType& resourceType, uint8_t * buffer, size_t size )
{
mTrace.PushCall("DecodeBuffer", "");
- return Integration::BitmapPtr();
+ return mDecodedBitmap;
}
void TestPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
mResourceRequests.Clear();
mIsLoadingResult=false;
mSynchronouslyLoadedResource.Reset();
+ mDecodedBitmap.Reset();
}
bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
mLoadedResourcesQueue.clear();
mFailedLoadQueue.clear();
mSynchronouslyLoadedResource.Reset();
+ mDecodedBitmap.Reset();
}
void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId loadedId,
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
SetResourceLoaded( request->GetId(), request->GetType()->id, resource );
+ delete request;
}
mResourceRequests.Clear();
}
for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
iter != endIter; ++iter )
{
+ Integration::ResourceRequest* request = *iter;
SetResourceLoadFailed( (*iter)->GetId(), failure);
+ delete request;
}
mResourceRequests.Clear();
}
void TestPlatformAbstraction::DiscardRequest()
{
+ for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
+ iter != endIter; ++iter )
+ {
+ Integration::ResourceRequest* request = *iter;
+ delete request;
+ }
mResourceRequests.Clear();
}
mSynchronouslyLoadedResource = resource;
}
+void TestPlatformAbstraction::SetDecodedBitmap( Integration::BitmapPtr bitmap )
+{
+ mDecodedBitmap = bitmap;
+}
+
} // namespace Dali
#define __DALI_TEST_PLATFORM_ABSTRACTION_H__
/*
- * Copyright (c) 2014 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.
*/
void SetSynchronouslyLoadedResource( Integration::ResourcePointer resource );
+ /**
+ * @brief Sets the bitmap returned by DecodeBuffer()
+ * @param[in] bitmap The decoded bitmap
+ */
+ void SetDecodedBitmap( Integration::BitmapPtr bitmap );
+
+private:
+
+ TestPlatformAbstraction( const TestPlatformAbstraction& ); ///< Undefined
+ TestPlatformAbstraction& operator=( const TestPlatformAbstraction& ); ///< Undefined
+
private:
struct LoadedResource
bool mSaveFileResult;
Integration::ResourcePointer mSynchronouslyLoadedResource;
+ Integration::BitmapPtr mDecodedBitmap;
};
} // Dali
/*
- * 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.
#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>
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
DALI_TEST_CHECK( !ControlWrapper::DownCast( controlWrapper ) );
- controlWrapper = ControlWrapper::New( *controlWrapperImpl );
+ controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
DALI_TEST_CHECK( ControlWrapper::DownCast( controlWrapper ) );
+
END_TEST;
}
{
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 );
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 );
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;
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;
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 );
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;
{
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 );
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;
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;
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);
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;
+}
/*
- * 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.
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream params;
- params << GL_TEXTURE_2D << ", " << 23;
+ params << GL_TEXTURE_EXTERNAL_OES << ", " << 23;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", params.str()) );
END_TEST;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream nextTextureParams;
- nextTextureParams << GL_TEXTURE_2D << ", " << 24;
+ nextTextureParams << GL_TEXTURE_EXTERNAL_OES << ", " << 24;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", nextTextureParams.str()) );
END_TEST;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream params;
- params << GL_TEXTURE_2D << ", " << 23;
+ params << GL_TEXTURE_EXTERNAL_OES << ", " << 23;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", params.str()) );
width = 200;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream params;
- params << GL_TEXTURE_2D << ", " << 23;
+ params << GL_TEXTURE_EXTERNAL_OES << ", " << 23;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", params.str()) );
END_TEST;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream nativeImageParams;
- nativeImageParams << GL_TEXTURE_2D << ", " << 24;
+ nativeImageParams << GL_TEXTURE_EXTERNAL_OES << ", " << 24;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", nativeImageParams.str()) );
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/common/compile-time-assert.h>
+#include <dali/devel-api/actors/layer-devel.h>
namespace Dali
{
namespace DepthIndex
{
+// The negative value for background effect and background has been
+// chosen so that newer controls can have content without setting
+// depth index, and go in front of native controls with a background.
+// This backround negative value means that the highest possible value
+// is SIBLING_ORDER_MULTIPLIER-BACKGROUND_EFFECT-1. The divisor of
+// 100 ensures the range fits within the sibling order range, and has
+// enough gaps to allow Control Authors to use other intermediate depths.
+
enum Ranges
{
- BACKGROUND = -Dali::Layer::TREE_DEPTH_MULTIPLIER / 10,
- CONTENT = 0,
- TEXT = Dali::Layer::TREE_DEPTH_MULTIPLIER / 100,
- DECORATION = Dali::Layer::TREE_DEPTH_MULTIPLIER / 10
+ BACKGROUND_EFFECT = -2 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100,
+ BACKGROUND = -1 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100,
+ CONTENT = 0,
+ DECORATION = 1 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100,
+ FOREGROUND_EFFECT = 2 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100
};
+DALI_COMPILE_TIME_ASSERT( (unsigned int)DevelLayer::ACTOR_DEPTH_MULTIPLIER > (unsigned int)DevelLayer::SIBLING_ORDER_MULTIPLIER );
+DALI_COMPILE_TIME_ASSERT( BACKGROUND_EFFECT < BACKGROUND );
+DALI_COMPILE_TIME_ASSERT( BACKGROUND < CONTENT );
+DALI_COMPILE_TIME_ASSERT( CONTENT < DECORATION );
+DALI_COMPILE_TIME_ASSERT( DECORATION < FOREGROUND_EFFECT );
+
} // namespace DepthIndex
} // namespace Toolkit
// 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>
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;
}
/**
* 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
// 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()
/**
* @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.
{
MAX_SIZE = PROPERTY_START_INDEX, ///< name "maxSize", The maximum size the Popup can be, type VECTOR2
ENABLE_OVERSHOOT, ///< name "enableOvershoot", Whether the overshoot image is enabled, type BOOLEAN
+ ENABLE_SCROLL_BAR, ///< name "enableScrollBar", Whether the scroll-bar is enabled, type BOOLEAN
+ SCROLL_BAR_PADDING, ///< name "scrollBarPadding", The padding used to position the scroll bar, type VECTOR2
SCROLL_VIEW, ///< name "scrollView", Properties to set on scroll view type Property::Map
};
};
indicator.SetParentOrigin( ParentOrigin::TOP_LEFT );
indicator.SetAnchorPoint( AnchorPoint::TOP_LEFT );
indicator.SetStyleName( "ScrollBarIndicator" );
+ indicator.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
SetScrollIndicator(indicator);
}
mAlterChild(false),
mDefaultMaxOvershoot(true),
mCanScrollHorizontal(true),
- mCanScrollVertical(true)
+ mCanScrollVertical(true),
+ mTransientScrollBar(true)
{
}
ScrollBase::OnChildAdd( child );
Dali::Toolkit::ScrollBar scrollBar = Dali::Toolkit::ScrollBar::DownCast(child);
- if(scrollBar)
+ if( scrollBar )
{
- mInternalActor.Add(scrollBar);
- if(scrollBar.GetScrollDirection() == Toolkit::ScrollBar::Horizontal)
+ mScrollBar = scrollBar;
+ scrollBar.SetName("ScrollBar");
+
+ mInternalActor.Add( scrollBar );
+ if( scrollBar.GetScrollDirection() == Toolkit::ScrollBar::Horizontal )
{
- scrollBar.SetScrollPropertySource(Self(),
- Toolkit::ScrollView::Property::SCROLL_PRE_POSITION_X,
- Toolkit::Scrollable::Property::SCROLL_POSITION_MIN_X,
- Toolkit::ScrollView::Property::SCROLL_PRE_POSITION_MAX_X,
- Toolkit::ScrollView::Property::SCROLL_DOMAIN_SIZE_X);
+ scrollBar.SetScrollPropertySource( Self(),
+ Toolkit::ScrollView::Property::SCROLL_PRE_POSITION_X,
+ Toolkit::Scrollable::Property::SCROLL_POSITION_MIN_X,
+ Toolkit::ScrollView::Property::SCROLL_PRE_POSITION_MAX_X,
+ Toolkit::ScrollView::Property::SCROLL_DOMAIN_SIZE_X );
}
else
{
- scrollBar.SetScrollPropertySource(Self(),
- Toolkit::ScrollView::Property::SCROLL_PRE_POSITION_Y,
- Toolkit::Scrollable::Property::SCROLL_POSITION_MIN_Y,
- Toolkit::ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y,
- Toolkit::ScrollView::Property::SCROLL_DOMAIN_SIZE_Y);
+ scrollBar.SetScrollPropertySource( Self(),
+ Toolkit::ScrollView::Property::SCROLL_PRE_POSITION_Y,
+ Toolkit::Scrollable::Property::SCROLL_POSITION_MIN_Y,
+ Toolkit::ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y,
+ Toolkit::ScrollView::Property::SCROLL_DOMAIN_SIZE_Y );
+ }
+
+ if( mTransientScrollBar )
+ {
+ scrollBar.SetVisible( false );
+ scrollBar.HideIndicator();
}
}
else if(mAlterChild)
self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, Vector3(gesture.position.x, gesture.position.y, 0.0f) );
UpdateMainInternalConstraint();
+ Toolkit::ScrollBar scrollBar = mScrollBar.GetHandle();
+ if( scrollBar && mTransientScrollBar )
+ {
+ Vector3 size = Self().GetCurrentSize();
+ const Toolkit::RulerDomain& rulerDomainX = mRulerX->GetDomain();
+ const Toolkit::RulerDomain& rulerDomainY = mRulerY->GetDomain();
+
+ if( ( rulerDomainX.max > size.width ) || ( rulerDomainY.max > size.height ) )
+ {
+ scrollBar.SetVisible( true );
+ scrollBar.ShowIndicator();
+ }
+ }
break;
}
{
mScrollMainInternalPrePositionConstraint.Remove();
}
+
+ Toolkit::ScrollBar scrollBar = mScrollBar.GetHandle();
+ if( scrollBar && mTransientScrollBar )
+ {
+ scrollBar.HideIndicator();
+ }
}
else
{
#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/object/property-notification.h>
+#include <dali/devel-api/object/weak-handle.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
Constraint mScrollMainInternalPrePositionMaxConstraint;
ScrollOvershootIndicatorPtr mOvershootIndicator;
+ WeakHandle<Toolkit::ScrollBar> mScrollBar;
Toolkit::ScrollView::SnapStartedSignalType mSnapStartedSignal;
bool mDefaultMaxOvershoot:1; ///< Whether to use default max overshoot or application defined one
bool mCanScrollHorizontal:1; ///< Local value of our property to check against
bool mCanScrollVertical:1; ///< Local value of our property to check against
+ bool mTransientScrollBar:1; ///< True if scroll-bar should be automatically show/hidden during/after panning
};
} // namespace Internal
{
renderableActor = mRenderer->Render( mController->GetView(),
mAlignmentOffset,
- DepthIndex::TEXT );
+ DepthIndex::CONTENT );
}
if( renderableActor != mRenderableActor )
{
renderableActor = mRenderer->Render( mController->GetView(),
mAlignmentOffset,
- DepthIndex::TEXT );
+ DepthIndex::CONTENT );
}
if( renderableActor != mRenderableActor )
{
renderableActor = mRenderer->Render( mController->GetView(),
alignmentOffset,
- DepthIndex::TEXT );
+ DepthIndex::CONTENT );
}
if( renderableActor != mRenderableActor )
namespace
{
+const Dali::Vector2 DEFAULT_SCROLL_BAR_PADDING( 8.0f, 6.0f );
+
BaseHandle Create()
{
return Toolkit::TextSelectionToolbar::New();
DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionToolbar, "maxSize", VECTOR2, MAX_SIZE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionToolbar, "enableOvershoot", BOOLEAN, ENABLE_OVERSHOOT )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionToolbar, "enableScrollBar", BOOLEAN, ENABLE_SCROLL_BAR )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionToolbar, "scrollBarPadding", VECTOR2, SCROLL_BAR_PADDING )
DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionToolbar, "scrollView", MAP, SCROLL_VIEW )
DALI_TYPE_REGISTRATION_END()
impl.mScrollView.SetOvershootEnabled( value.Get< bool >() );
break;
}
+ case Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR:
+ {
+ impl.SetUpScrollBar( value.Get< bool >() );
+ break;
+ }
+ case Toolkit::TextSelectionToolbar::Property::SCROLL_BAR_PADDING:
+ {
+ impl.SetScrollBarPadding( value.Get< Vector2 >() );
+ break;
+ }
case Toolkit::TextSelectionToolbar::Property::SCROLL_VIEW:
{
// Get a Property::Map from the property if possible.
value = impl.mScrollView.IsOvershootEnabled();
break;
}
+ case Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR:
+ {
+ value = impl.mScrollBar ? true : false;
+ break;
+ }
+ case Toolkit::TextSelectionToolbar::Property::SCROLL_BAR_PADDING:
+ {
+ value = impl.GetScrollBarPadding();
+ break;
+ }
} // switch
}
return value;
float width = std::max ( mTableOfButtons.GetNaturalSize().width, size.width );
mRulerX->SetDomain( RulerDomain( 0.0, width, true ) );
mScrollView.SetRulerX( mRulerX );
+
+ if( mScrollBar )
+ {
+ float barWidth = std::min( mTableOfButtons.GetNaturalSize().width, size.width ) - 2.f * mScrollBarPadding.x;
+ mScrollBar.SetSize( Vector2( 0.0f, barWidth ) );
+ }
}
void TextSelectionToolbar::SetPopupMaxSize( const Size& maxSize )
self.Add( mToolbarLayer );
}
+void TextSelectionToolbar::SetUpScrollBar( bool enable )
+{
+ if( enable )
+ {
+ if( ! mScrollBar )
+ {
+ mScrollBar = Toolkit::ScrollBar::New( Toolkit::ScrollBar::Horizontal );
+ mScrollBar.SetName( "Text popup scroll bar" );
+ mScrollBar.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
+ mScrollBar.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mScrollBar.SetPosition( mScrollBarPadding.x, -mScrollBarPadding.y );
+ mScrollBar.SetResizePolicy( Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::WIDTH );
+ mScrollBar.SetOrientation( Quaternion( Radian( 1.5f * Math::PI ), Vector3::ZAXIS ) );
+ mScrollBar.GetPanGestureDetector().DetachAll();
+ mScrollView.Add( mScrollBar );
+ }
+ }
+ else
+ {
+ UnparentAndReset( mScrollBar );
+ }
+}
+
void TextSelectionToolbar::OnScrollStarted( const Vector2& position )
{
mTableOfButtons.SetSensitive( false );
mToolbarLayer.RaiseAbove( target );
}
+void TextSelectionToolbar::SetScrollBarPadding( const Vector2& padding )
+{
+ mScrollBarPadding = padding;
+ if( mScrollBar )
+ {
+ mScrollBar.SetPosition( mScrollBarPadding.x, -mScrollBarPadding.y );
+ }
+
+ RelayoutRequest();
+}
+
void TextSelectionToolbar::ConfigureScrollview( const Property::Map& properties )
{
// Set any properties specified for the label by iterating through all property key-value pairs.
RelayoutRequest();
}
+const Vector2& TextSelectionToolbar::GetScrollBarPadding() const
+{
+ return mScrollBarPadding;
+}
TextSelectionToolbar::TextSelectionToolbar()
: Control( ControlBehaviour( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ) ),
mMaxSize (),
+ mScrollBarPadding( DEFAULT_SCROLL_BAR_PADDING ),
mIndexInTable( 0 ),
mDividerIndexes()
{
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
+#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
*/
void RaiseAbove( Layer target );
+ /**
+ * Sets the scroll bar padding.
+ *
+ * @param[in] padding The padding value.
+ */
+ void SetScrollBarPadding( const Vector2& padding );
+
+ /**
+ * @return The padding value.
+ */
+ const Vector2& GetScrollBarPadding() const;
+
private: // From Control
/**
void SetUp();
/**
+ * @brief Enable or disable the scroll-bar
+ *
+ * @param[in] enable True if the scroll-bar is required
+ */
+ void SetUpScrollBar( bool enable );
+
+ /**
* Toolbar has started to scroll
* @param[in] position current scroll view position
*/
Layer mToolbarLayer; ///< The layer used to house the toolbar.
Toolkit::TableView mTableOfButtons; ///< Actor which holds all the buttons, sensitivity can be set on buttons via this actor
Toolkit::ScrollView mScrollView; ///< Provides scrolling of Toolbar when content does not fit.
+ Toolkit::ScrollBar mScrollBar; ///< An horizontal scroll bar for the text's popup options.
RulerPtr mRulerX; ///< Ruler to clamp horizontal scrolling. Updates on Relayout
Size mMaxSize; ///< Max size of the Toolbar
+ Vector2 mScrollBarPadding; ///< The padding used to position the scroll indicator.
unsigned int mIndexInTable; ///< Index in table to add option
Dali::Vector< unsigned int > mDividerIndexes; ///< Vector of indexes in the Toolbar that contain dividers.
-
};
} // namespace Internal
// EXTERNAL INCLUDES
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/images/frame-buffer-image.h>
#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/integration-api/debug.h>
BIDI_INFO |
SHAPE_TEXT |
GET_GLYPH_METRICS );
+
+ // Set the update info to relayout the whole text.
+ mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
+ mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
+
// Make sure the model is up-to-date before layouting
mImpl->UpdateModel( onlyOnceOperations );
// Layout the text for the new width.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | LAYOUT );
- // Set the update info to relayout the whole text.
- mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
- mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
-
// Store the actual control's size to restore later.
const Size actualControlSize = mImpl->mModel->mVisualModel->mControlSize;
BIDI_INFO |
SHAPE_TEXT |
GET_GLYPH_METRICS );
+
+ // Set the update info to relayout the whole text.
+ mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
+ mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
+
// Make sure the model is up-to-date before layouting
mImpl->UpdateModel( onlyOnceOperations );
// Layout the text for the new width.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | LAYOUT );
- // Set the update info to relayout the whole text.
- mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
- mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
-
// Store the actual control's width.
const float actualControlWidth = mImpl->mModel->mVisualModel->mControlSize.width;
{
textChanged = BackspaceKeyEvent();
}
- else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) )
- {
- mImpl->ChangeState( EventData::INTERRUPTED ); // State is not INACTIVE as expect to return to edit mode.
- // Avoids calling the InsertText() method which can delete selected text
- }
- else if( IsKey( keyEvent, Dali::DALI_KEY_MENU ) ||
+ else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) ||
+ IsKey( keyEvent, Dali::DALI_KEY_MENU ) ||
IsKey( keyEvent, Dali::DALI_KEY_HOME ) )
{
+ // Power key/Menu/Home key behaviour does not allow edit mode to resume.
mImpl->ChangeState( EventData::INACTIVE );
- // Menu/Home key behaviour does not allow edit mode to resume like Power key
- // Avoids calling the InsertText() method which can delete selected text
+
+ // This branch avoids calling the InsertText() method of the 'else' branch which can delete selected text.
}
else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode )
{
numberOfCharacters = currentText.Count() - cursorIndex;
}
- if( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters )
+ if( mImpl->mEventData->mPreEditFlag || // If the preedit flag is enabled, it means two (or more) of them came together i.e. when two keys have been pressed at the same time.
+ ( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) )
{
// Mark the paragraphs to be updated.
mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex );
vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
mediump vec2 scale = vec2( length( uModelMatrix[ 0 ].xyz ), length( uModelMatrix[ 1 ].xyz ) );\n
- mediump vec2 size = visualSize.xy * scale;\n
+ mediump vec2 size = visualSize.xy;\n
\n
mediump vec2 fixedFactor = vec2( uFixed[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uFixed[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].y );\n
mediump vec2 stretch = floor( aPosition * 0.5 );\n
\n
mediump vec4 vertexPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );
vertexPosition.xy -= size * vec2( 0.5, 0.5 );\n
- vertexPosition.xy = vertexPosition.xy / scale + anchorPoint*size + (visualOffset + origin)*uSize.xy;\
+ vertexPosition.xy = vertexPosition.xy + anchorPoint*size + (visualOffset + origin)*uSize.xy;\
\n
vertexPosition = uMvpMatrix * vertexPosition;\n
\n
}
mImpl->mRenderer = Renderer::New( geometry, shader );
- mImpl->mRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::TEXT );
+ mImpl->mRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::CONTENT );
UpdateRenderer( true ); // Renderer needs textures and to be added to control
}
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 25;
+const unsigned int TOOLKIT_MICRO_VERSION = 26;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
"TextSelectionToolbar":
{
"enableOvershoot":true,
+ "enableScrollBar":true,
"scrollView":
{
"overshootAnimationSpeed":360.0,
"overshootAnimationSpeed":960.0,
"overshootSize":[1920.0,130.0]
},
+ "ScrollBar":
+ {
+ "indicatorShowDuration":0.25,
+ "indicatorHideDuration":0.25,
+ "color":[0.0,0.72,0.9,0.7]
+ },
"TextEditor":
{
"pointSize":120,
"TextSelectionToolbar":
{
"enableOvershoot":true,
+ "enableScrollBar":true,
"scrollView":
{
"overshootAnimationSpeed":120.0,
"overshootAnimationSpeed":120.0,
"overshootSize":[480.0,42.0]
},
+ "ScrollBar":
+ {
+ "indicatorShowDuration":0.25,
+ "indicatorHideDuration":0.25,
+ "color":[0.0,0.72,0.9,0.7]
+ },
"TextEditor":
{
"pointSize":18,
"TextSelectionToolbar":
{
"enableOvershoot":true,
+ "enableScrollBar":true,
"scrollView":
{
"overshootAnimationSpeed":360.0,
"overshootAnimationSpeed":360.0,
"overshootSize":[720.0,130.0]
},
+ "ScrollBar":
+ {
+ "indicatorShowDuration":0.25,
+ "indicatorHideDuration":0.25,
+ "color":[0.0,0.72,0.9,0.7]
+ },
"TextEditor":
{
"pointSize":18,
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.25
+Version: 1.2.26
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.25
+Version: 1.2.26
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
%ignore *::SetPositionInheritanceMode(PositionInheritanceMode);
%ignore *::GetKeyValue(SizeType) const;
%ignore *::TypeInfo::GetCreator() const;
+%ignore Dali::Stage::TouchedSignal;
%rename(ParentOriginTop) Dali::ParentOrigin::TOP;
%rename(ParentOriginBottom) Dali::ParentOrigin::BOTTOM;
%include <dali/public-api/events/pinch-gesture.h>
%include <dali/public-api/events/tap-gesture-detector.h>
%include <dali/public-api/events/tap-gesture.h>
-%include <dali/public-api/events/touch-event.h>
%include <dali/public-api/animation/alpha-function.h>
%include <dali/public-api/animation/key-frames.h>
//%template(ActorTouchEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchEvent&)>;
%template(ActorTouchDataSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchData&)>;
%template(ActorHoverSignal) Dali::Signal<bool (Dali::Actor, const Dali::HoverEvent&)>;
-%template(ActorWheelEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::WheelEvent&)>;
+%template(ActorWheelSignal) Dali::Signal<bool (Dali::Actor, const Dali::WheelEvent&)>;
%template(ActorSignal) Dali::Signal<void (Dali::Actor)>;
%template(KeyEventSignal) Dali::Signal<void (const Dali::KeyEvent&)>;
//%template(TouchEventSignal) Dali::Signal<void (const Dali::TouchEvent&)>;
%template(TouchSignal) Dali::Signal<void (const Dali::TouchData&)>;
-%template(StageWheelEventSignal) Dali::Signal<void (const Dali::WheelEvent&)>;
+%template(StageWheelSignal) Dali::Signal<void (const Dali::WheelEvent&)>;
%template(AngleThresholdPair) std::pair<Dali::Radian, Dali::Radian>;
%template(PanGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::PanGesture&)>;
%template(PinchGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::PinchGesture&)>;
%}
%enddef
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( NameSpace, ClassName, NewClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~NewClassName() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( NameSpace, ClassName, NewClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_##NewClassName(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION_RENAME( NameSpace, ClassName, NewClassName )
+%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_##NewClassName(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ base.Dispose();
+ }
+ }
+%}
+%enddef
+
%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VIDEOVIEWSIGNAL( NameSpace, ClassName )
%typemap(csfinalize) NameSpace::ClassName %{
~VideoViewSignal() {
%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STAGESIGNAL( NameSpace, ClassName )
%typemap(csfinalize) NameSpace::ClassName %{
- ~StageWheelEventSignal() {
+ ~StageWheelSignal() {
DisposeQueue.Instance.Add(this);
}
%}
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
- NDalicPINVOKE.delete_StageWheelEventSignal(swigCPtr);
+ NDalicPINVOKE.delete_StageWheelSignal(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, LongPressGestureDetector );
DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, LongPressGestureDetector );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, KeyEvent );
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, KeyEvent );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, KeyEvent, Key );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, KeyEvent, Key );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, HoverEvent, Hover );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, HoverEvent, Hover );
DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TouchEvent );
DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, TouchEvent );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, WheelEvent );
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, WheelEvent );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, WheelEvent, Wheel );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, WheelEvent, Wheel );
DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Renderer );
DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Renderer );
DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TouchPoint );
DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, TouchPoint );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TouchData );
-DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, TouchData );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, TouchData, Touch );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION_RENAME( Dali, TouchData, Touch );
DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Application );
DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Application );
%ignore *::Button::SetUnselectedImage(const std::string &);
%ignore Dali::Toolkit::DevelVisual::Type;
%ignore Dali::Toolkit::DevelVisual::Property::Type;
+%ignore Dali::Toolkit::AccessibilityManager::AccessibilityActionScrollSignalType;
%rename(View) Dali::Toolkit::Control;
%rename(ViewImpl) Dali::Toolkit::Internal::Control;
%template(ItemContainer) std::vector<std::pair<unsigned int, Dali::Actor>>;
%template(ActorContainer) std::vector<Dali::Actor>;
%template(AccessibilityActionSignal) Dali::Signal<bool(Dali::Toolkit::AccessibilityManager&)>;
-%template(AccessibilityActionScrollSignal) Dali::Signal<bool(Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&)>;
%template(AccessibilityFocusOvershotSignal) Dali::Signal<void(Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection)>;
%template(FocusChangedSignal) Dali::Signal<void(Dali::Actor, Dali::Actor)>;
%template(FocusGroupChangedSignal) Dali::Signal<void(Dali::Actor, bool)>;
%template(ScrollableSignal) Dali::Signal< void(const Dali::Vector2&)>;
%template(TextEditorSignal) Dali::Signal<void(Dali::Toolkit::TextEditor)>;
%template(TextFieldSignal) Dali::Signal<void(Dali::Toolkit::TextField)>;
-%template(ControlKeyEventSignal) Dali::Signal<bool(Dali::Toolkit::Control, const Dali::KeyEvent&)>;
+%template(ControlKeySignal) Dali::Signal<bool(Dali::Toolkit::Control, const Dali::KeyEvent&)>;
%template(KeyInputFocusSignal) Dali::Signal<void(Dali::Toolkit::Control)>;
%template(VideoViewSignal) Dali::Signal<void(Dali::Toolkit::VideoView&)>;
%template(SliderValueChangedSignal) Dali::Signal<bool(Dali::Toolkit::Slider, float)>;
%include devel-properties.i
%include gestures/hover.i
-
+%include gestures/gesture.i
+%include gestures/long-press-gesture.i
+%include gestures/pan-gesture.i
+%include gestures/tap-gesture.i
+%include gestures/pinch-gesture.i
+%include gestures/wheel.i
+%include gestures/touch.i
+%include gestures/key.i
%include dali-core.i
%include dali-adaptor.i
* @brief Event arguments that passed via ActionScroll signal
*
*/
+/*
+ // To be replaced by a new event that takes Touch
public class ActionScrollEventArgs : EventArgs
{
private AccessibilityManager _accessibilityManager;
}
}
}
+*/
/**
* @brief Event arguments that passed via ActionPageUp signal
private DaliEventHandlerWithReturnType<object,ActionStartStopEventArgs,bool> _accessibilityManagerActionStartStopEventHandler;
private ActionStartStopEventCallbackDelegate _accessibilityManagerActionStartStopEventCallbackDelegate;
+/*
+ // To be replaced by a new event that takes Touch
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool ActionScrollEventCallbackDelegate(IntPtr accessibilityManager, IntPtr touchEvent);
private DaliEventHandlerWithReturnType<object,ActionScrollEventArgs,bool> _accessibilityManagerActionScrollEventHandler;
private ActionScrollEventCallbackDelegate _accessibilityManagerActionScrollEventCallbackDelegate;
+*/
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void FocusChangedEventCallbackDelegate(IntPtr actor1, IntPtr actor2);
return false;
}
+/*
+ // To be replaced by a new event that takes Touch
public event DaliEventHandlerWithReturnType<object,ActionScrollEventArgs,bool> ActionScroll
{
add
}
return false;
}
+*/
public event DaliEventHandler<object,FocusChangedEventArgs> FocusChanged
{
}
/**
- * @brief Event arguments that passed via KeyEvent signal
+ * @brief Event arguments that passed via Key signal
*
*/
public class KeyEventArgs : EventArgs
{
private View _view;
- private KeyEvent _keyEvent;
+ private Key _key;
/**
- * @brief View - is the view that recieves the keyevent.
+ * @brief View - is the view that recieves the key.
*
*/
public View View
}
/**
- * @brief KeyEvent - is the keyevent sent to the View.
+ * @brief Key - is the key sent to the View.
*
*/
- public KeyEvent KeyEvent
+ public Key Key
{
get
{
- return _keyEvent;
+ return _key;
}
set
{
- _keyEvent = value;
+ _key = value;
}
}
}
public class TouchEventArgs : EventArgs
{
private View _view;
- private TouchData _touchData;
+ private Touch _touch;
/**
* @brief View - is the view that is being touched
}
/**
- * @brief TouchData - contains the information of touch points
+ * @brief Touch - contains the information of touch points
*
*/
- public TouchData TouchData
+ public Touch Touch
{
get
{
- return _touchData;
+ return _touch;
}
set
{
- _touchData = value;
+ _touch = value;
}
}
}
* @brief Event arguments that passed via Hover signal
*
*/
- public class HoverArgs : EventArgs
+ public class HoverEventArgs : EventArgs
{
- private View _view;
- private Hover _hover;
+ private View _view;
+ private Hover _hover;
/**
* @brief View - is the view that is being hovered
*/
public class WheelEventArgs : EventArgs
{
- private View _view;
- private WheelEvent _wheelEvent;
+ private View _view;
+ private Wheel _wheel;
/**
* @brief View - is the view that is being wheeled
}
/**
- * @brief WheelEvent - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL
+ * @brief Wheel - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL
*
*/
- public WheelEvent WheelEvent
+ public Wheel Wheel
{
get
{
- return _wheelEvent;
+ return _wheel;
}
set
{
- _wheelEvent = value;
+ _wheel = value;
}
}
}
private KeyInputFocusLostCallbackDelegate _KeyInputFocusLostCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr keyEvent);
- private DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> _KeyEventHandler;
+ private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr key);
+ private DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> _KeyHandler;
private KeyCallbackDelegate _KeyCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private OnRelayoutEventCallbackDelegate _viewOnRelayoutEventCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate bool TouchCallbackDelegate(IntPtr view, IntPtr touchData);
- private DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> _viewTouchDataEventHandler;
- private TouchCallbackDelegate _viewTouchDataCallbackDelegate;
+ private delegate bool TouchCallbackDelegate(IntPtr view, IntPtr touch);
+ private DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> _viewTouchHandler;
+ private TouchCallbackDelegate _viewTouchCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate bool HoverCallbackDelegate(IntPtr view, IntPtr hover);
- private DaliEventHandlerWithReturnType<object,HoverArgs,bool> _viewHoverHandler;
+ private DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> _viewHoverHandler;
private HoverCallbackDelegate _viewHoverCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate bool WheelEventCallbackDelegate(IntPtr view, IntPtr wheelEvent);
- private DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> _viewWheelEventHandler;
- private WheelEventCallbackDelegate _viewWheelEventCallbackDelegate;
+ private delegate bool WheelCallbackDelegate(IntPtr view, IntPtr wheel);
+ private DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> _viewWheelHandler;
+ private WheelCallbackDelegate _viewWheelCallbackDelegate;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void OnStageEventCallbackDelegate(IntPtr control);
if (_KeyInputFocusGainedEventHandler == null)
{
_KeyInputFocusGainedEventHandler += value;
- Console.WriteLine("View Keyevent EVENT Locked....");
+ Console.WriteLine("View Key EVENT Locked....");
_KeyInputFocusGainedCallbackDelegate = new KeyInputFocusGainedCallbackDelegate(OnKeyInputFocusGained);
this.KeyInputFocusGainedSignal().Connect(_KeyInputFocusGainedCallbackDelegate);
}
private void OnKeyInputFocusGained(IntPtr view)
{
KeyInputFocusGainedEventArgs e = new KeyInputFocusGainedEventArgs();
- Console.WriteLine("View Keyevent ....");
+ Console.WriteLine("View Key ....");
// Populate all members of "e" (KeyInputFocusGainedEventArgs) with real data
e.View = Dali.View.GetViewFromPtr(view);
/**
* @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of KeyEventEventHandler-DaliEventHandlerWithReturnType<object,KeyEventArgs,bool>)
+ * (in the type of KeyHandler-DaliEventHandlerWithReturnType<object,KeyEventArgs,bool>)
* provided by the user. KeyPressed signal is emitted when key event is received.
*/
public event DaliEventHandlerWithReturnType<object,KeyEventArgs,bool> KeyPressed
lock(this)
{
// Restricted to only one listener
- if (_KeyEventHandler == null)
+ if (_KeyHandler == null)
{
- _KeyEventHandler += value;
+ _KeyHandler += value;
- _KeyCallbackDelegate = new KeyCallbackDelegate(OnKeyEvent);
+ _KeyCallbackDelegate = new KeyCallbackDelegate(OnKey);
this.KeyEventSignal().Connect(_KeyCallbackDelegate);
}
}
{
lock(this)
{
- if (_KeyEventHandler != null)
+ if (_KeyHandler != null)
{
this.KeyEventSignal().Disconnect(_KeyCallbackDelegate);
}
- _KeyEventHandler -= value;
+ _KeyHandler -= value;
}
}
}
- private bool OnKeyEvent(IntPtr view, IntPtr keyEvent)
+ private bool OnKey(IntPtr view, IntPtr key)
{
KeyEventArgs e = new KeyEventArgs();
// Populate all members of "e" (KeyEventArgs) with real data
e.View = Dali.View.GetViewFromPtr(view);
- e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr(keyEvent);
+ e.Key = Dali.Key.GetKeyFromPtr(key);
- if (_KeyEventHandler != null)
+ if (_KeyHandler != null)
{
//here we send all data to user event handlers
- return _KeyEventHandler(this, e);
+ return _KeyHandler(this, e);
}
return false;
/**
* @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of TouchEventHandler-DaliEventHandlerWithReturnType<object,TouchEventArgs,bool>)
+ * (in the type of TouchHandler-DaliEventHandlerWithReturnType<object,TouchEventArgs,bool>)
* provided by the user. Touched signal is emitted when touch input is received.
*/
public event DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> Touched
lock(this)
{
// Restricted to only one listener
- if (_viewTouchDataEventHandler == null)
+ if (_viewTouchHandler == null)
{
- _viewTouchDataEventHandler += value;
+ _viewTouchHandler += value;
Console.WriteLine("View Touch EVENT LOCKED....");
- _viewTouchDataCallbackDelegate = new TouchCallbackDelegate(OnTouch);
- this.TouchSignal().Connect(_viewTouchDataCallbackDelegate);
+ _viewTouchCallbackDelegate = new TouchCallbackDelegate(OnTouch);
+ this.TouchSignal().Connect(_viewTouchCallbackDelegate);
}
}
}
{
lock(this)
{
- if (_viewTouchDataEventHandler != null)
+ if (_viewTouchHandler != null)
{
- this.TouchSignal().Disconnect(_viewTouchDataCallbackDelegate);
+ this.TouchSignal().Disconnect(_viewTouchCallbackDelegate);
}
- _viewTouchDataEventHandler -= value;
+ _viewTouchHandler -= value;
}
}
}
// Callback for View TouchSignal
- private bool OnTouch(IntPtr view, IntPtr touchData)
+ private bool OnTouch(IntPtr view, IntPtr touch)
{
TouchEventArgs e = new TouchEventArgs();
Console.WriteLine("View Touch EVENT....");
// Populate all members of "e" (TouchEventArgs) with real data
e.View = View.GetViewFromPtr(view);
- e.TouchData = Dali.TouchData.GetTouchDataFromPtr(touchData);
+ e.Touch = Dali.Touch.GetTouchFromPtr(touch);
- if (_viewTouchDataEventHandler != null)
+ if (_viewTouchHandler != null)
{
//here we send all data to user event handlers
- return _viewTouchDataEventHandler(this, e);
+ return _viewTouchHandler(this, e);
}
return false;
/**
* @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of HoverHandler-DaliEventHandlerWithReturnType<object,HoverArgs,bool>)
+ * (in the type of HoverHandler-DaliEventHandlerWithReturnType<object,HoverEventArgs,bool>)
* provided by the user. Hovered signal is emitted when hover input is received.
*/
- public event DaliEventHandlerWithReturnType<object,HoverArgs,bool> Hovered
+ public event DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> Hovered
{
add
{
// Callback for View Hover signal
private bool OnHover(IntPtr view, IntPtr hover)
{
- HoverArgs e = new HoverArgs();
+ HoverEventArgs e = new HoverEventArgs();
- // Populate all members of "e" (HoverArgs) with real data
+ // Populate all members of "e" (HoverEventArgs) with real data
e.View = View.GetViewFromPtr(view);
e.Hover = Dali.Hover.GetHoverFromPtr(hover);
/**
* @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler
- * (in the type of WheelEventHandler-DaliEventHandlerWithReturnType<object,WheelEventArgs,bool>)
+ * (in the type of WheelHandler-DaliEventHandlerWithReturnType<object,WheelEventArgs,bool>)
* provided by the user. WheelMoved signal is emitted when wheel event is received.
*/
public event DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> WheelMoved
lock(this)
{
// Restricted to only one listener
- if (_viewWheelEventHandler == null)
+ if (_viewWheelHandler == null)
{
- _viewWheelEventHandler += value;
+ _viewWheelHandler += value;
Console.WriteLine("View Wheel EVENT LOCKED....");
- _viewWheelEventCallbackDelegate = new WheelEventCallbackDelegate(OnWheelEvent);
- this.WheelEventSignal().Connect(_viewWheelEventCallbackDelegate);
+ _viewWheelCallbackDelegate = new WheelCallbackDelegate(OnWheel);
+ this.WheelEventSignal().Connect(_viewWheelCallbackDelegate);
}
}
}
{
lock(this)
{
- if (_viewWheelEventHandler != null)
+ if (_viewWheelHandler != null)
{
- this.WheelEventSignal().Disconnect(_viewWheelEventCallbackDelegate);
+ this.WheelEventSignal().Disconnect(_viewWheelCallbackDelegate);
}
- _viewWheelEventHandler -= value;
+ _viewWheelHandler -= value;
}
}
}
// Callback for View Wheel signal
- private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent)
+ private bool OnWheel(IntPtr view, IntPtr wheel)
{
WheelEventArgs e = new WheelEventArgs();
Console.WriteLine("View Wheel EVENT ....");
// Populate all members of "e" (WheelEventArgs) with real data
e.View = View.GetViewFromPtr(view);
- e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr(wheelEvent);
+ e.Wheel = Dali.Wheel.GetWheelFromPtr(wheel);
- if (_viewWheelEventHandler != null)
+ if (_viewWheelHandler != null)
{
//here we send all data to user event handlers
- return _viewWheelEventHandler(this, e);
+ return _viewWheelHandler(this, e);
}
return false;
*/
public class TouchEventArgs : EventArgs
{
- private TouchData _touchData;
+ private Touch _touch;
/**
- * @brief TouchData - contains the information of touch points
+ * @brief Touch - contains the information of touch points
*
*/
- public TouchData TouchData
+ public Touch Touch
{
get
{
- return _touchData;
+ return _touch;
}
set
{
- _touchData = value;
+ _touch = value;
}
}
}
- private event EventHandler<TouchEventArgs> _stageTouchEventHandler;
+ private event EventHandler<TouchEventArgs> _stageTouchHandler;
private EventCallbackDelegateType1<IntPtr> _stageTouchCallbackDelegate;
/**
* (i.e. the down & up touch events only).
*
*/
- public event EventHandler<TouchEventArgs> TouchEvent
+ public event EventHandler<TouchEventArgs> Touch
{
add
{
lock(this)
{
- _stageTouchEventHandler += value;
+ _stageTouchHandler += value;
_stageTouchCallbackDelegate = OnStageTouch;
this.TouchSignal().Connect(_stageTouchCallbackDelegate);
}
{
lock(this)
{
- if (_stageTouchEventHandler != null)
+ if (_stageTouchHandler != null)
{
this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
}
- _stageTouchEventHandler -= value;
+ _stageTouchHandler -= value;
}
}
}
if( data != null )
{
- e.TouchData = TouchData.GetTouchDataFromPtr( data );
+ e.Touch = Dali.Touch.GetTouchFromPtr( data );
}
- if (_stageTouchEventHandler != null)
+ if (_stageTouchHandler != null)
{
- _stageTouchEventHandler(this, e);
+ _stageTouchHandler(this, e);
}
}
-
/**
- * @brief WheelEvent arguments that passed via Wheel signal
+ * @brief Wheel arguments that passed via Wheel signal
*
*/
public class WheelEventArgs : EventArgs
{
- private WheelEvent _wheelEvent;
+ private Wheel _wheel;
/**
- * @brief WheelEvent - store a wheel rolling type MOUSE_WHEEL or CUSTOM_WHEEL
+ * @brief Wheel - store a wheel rolling type MOUSE_WHEEL or CUSTOM_WHEEL
*
*/
- public WheelEvent WheelEvent
+ public Wheel Wheel
{
get
{
- return _wheelEvent;
+ return _wheel;
}
set
{
- _wheelEvent = value;
+ _wheel = value;
}
}
}
- private event EventHandler<WheelEventArgs> _stageWheelEventHandler;
+ private event EventHandler<WheelEventArgs> _stageWheelHandler;
private EventCallbackDelegateType1<IntPtr> _stageWheelCallbackDelegate;
/**
- * @brief Event for WheelEvent signal which can be used to subscribe/unsubscribe the event handler
- * WheelEvent signal is emitted is emitted when wheel event is received.
+ * @brief Event for Wheel signal which can be used to subscribe/unsubscribe the event handler
+ * Wheel signal is emitted is emitted when wheel event is received.
*
*/
- public event EventHandler<WheelEventArgs> WheelEvent
+ public event EventHandler<WheelEventArgs> Wheel
{
add
{
lock(this)
{
- _stageWheelEventHandler += value;
+ _stageWheelHandler += value;
_stageWheelCallbackDelegate = OnStageWheel;
this.WheelEventSignal().Connect(_stageWheelCallbackDelegate);
}
{
lock(this)
{
- if (_stageWheelEventHandler != null)
+ if (_stageWheelHandler != null)
{
this.WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
}
- _stageWheelEventHandler -= value;
+ _stageWheelHandler -= value;
}
}
}
if( data != null )
{
- e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr( data );
+ e.Wheel = Dali.Wheel.GetWheelFromPtr( data );
}
- if (_stageWheelEventHandler != null)
+ if (_stageWheelHandler != null)
{
- _stageWheelEventHandler(this, e);
+ _stageWheelHandler(this, e);
}
}
/**
- * @brief Event arguments that passed via KeyEvent signal
+ * @brief Event arguments that passed via Key signal
*
*/
public class KeyEventArgs : EventArgs
{
- private KeyEvent _keyEvent;
+ private Key _key;
/**
- * @brief KeyEvent - is the keyevent sent to Stage.
+ * @brief Key - is the keyevent sent to Stage.
*
*/
- public KeyEvent KeyEvent
+ public Key Key
{
get
{
- return _keyEvent;
+ return _key;
}
set
{
- _keyEvent = value;
+ _key = value;
}
}
}
- private event EventHandler<KeyEventArgs> _stageKeyEventHandler;
+ private event EventHandler<KeyEventArgs> _stageKeyHandler;
private EventCallbackDelegateType1<IntPtr> _stageKeyCallbackDelegate;
/**
- * @brief Event for KeyEvent signal which can be used to subscribe/unsubscribe the event handler
- * KeyEvent signal is emitted is emitted when key event is received.
+ * @brief Event for Key signal which can be used to subscribe/unsubscribe the event handler
+ * Key signal is emitted is emitted when key event is received.
*
*/
- public event EventHandler<KeyEventArgs> KeyEvent
+ public event EventHandler<KeyEventArgs> Key
{
add
{
lock(this)
{
- _stageKeyEventHandler += value;
+ _stageKeyHandler += value;
_stageKeyCallbackDelegate = OnStageKey;
this.KeyEventSignal().Connect(_stageKeyCallbackDelegate);
}
{
lock(this)
{
- if (_stageKeyEventHandler != null)
+ if (_stageKeyHandler != null)
{
this.KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
}
- _stageKeyEventHandler -= value;
+ _stageKeyHandler -= value;
}
}
}
if( data != null )
{
- e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr( data );
+ e.Key = Dali.Key.GetKeyFromPtr( data );
}
- if (_stageKeyEventHandler != null)
+ if (_stageKeyHandler != null)
{
//here we send all data to user event handlers
- _stageKeyEventHandler(this, e);
+ _stageKeyHandler(this, e);
}
}
--- /dev/null
+%rename(GestureType) Dali::Gesture::Type;
+%rename(StateType) Dali::Gesture::State;
+
+%csmethodmodifiers Dali::Gesture::type "private";
+%csmethodmodifiers Dali::Gesture::state "private";
+%csmethodmodifiers Dali::Gesture::time "private";
+
+%typemap(cscode) Dali::Gesture %{
+ public Gesture.GestureType Type
+ {
+ get
+ {
+ return type;
+ }
+ }
+
+ public Gesture.StateType State
+ {
+ get
+ {
+ return state;
+ }
+ }
+
+ public uint Time
+ {
+ get
+ {
+ return time;
+ }
+ }
+%}
\ No newline at end of file
return ret;
}
- public uint GetTime() {
- return time;
+ public uint Time
+ {
+ get
+ {
+ return time;
+ }
}
public int GetDeviceId(uint point) {
--- /dev/null
+%rename(Key) Dali::KeyEvent;
+%rename(StateType) Dali::KeyEvent::State;
+
+%csmethodmodifiers Dali::KeyEvent::keyPressedName "private";
+%csmethodmodifiers Dali::KeyEvent::keyPressed "private";
+%csmethodmodifiers Dali::KeyEvent::keyCode "private";
+%csmethodmodifiers Dali::KeyEvent::keyModifier "private";
+%csmethodmodifiers Dali::KeyEvent::time "private";
+%csmethodmodifiers Dali::KeyEvent::state "private";
+
+%typemap(cscode) Dali::KeyEvent %{
+ public static Key GetKeyFromPtr(global::System.IntPtr cPtr) {
+ Key ret = new Key(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public string KeyPressedName
+ {
+ get
+ {
+ return keyPressedName;
+ }
+ }
+
+ public string KeyPressed
+ {
+ get
+ {
+ return keyPressed;
+ }
+ }
+
+ public int KeyCode
+ {
+ get
+ {
+ return keyCode;
+ }
+ }
+
+ public int KeyModifier
+ {
+ get
+ {
+ return keyModifier;
+ }
+ }
+
+ public uint Time
+ {
+ get
+ {
+ return time;
+ }
+ }
+
+ public Key.StateType State
+ {
+ get
+ {
+ return state;
+ }
+ }
+%}
\ No newline at end of file
--- /dev/null
+%csmethodmodifiers Dali::LongPressGesture::numberOfTouches "private";
+%csmethodmodifiers Dali::LongPressGesture::screenPoint "private";
+%csmethodmodifiers Dali::LongPressGesture::localPoint "private";
+
+%typemap(cscode) Dali::LongPressGesture %{
+ public static LongPressGesture GetLongPressGestureFromPtr(global::System.IntPtr cPtr) {
+ LongPressGesture ret = new LongPressGesture(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public uint NumberOfTouches
+ {
+ get
+ {
+ return numberOfTouches;
+ }
+ }
+
+ public Vector2 ScreenPoint
+ {
+ get
+ {
+ return screenPoint;
+ }
+ }
+
+ public Vector2 LocalPoint
+ {
+ get
+ {
+ return localPoint;
+ }
+ }
+%}
\ No newline at end of file
--- /dev/null
+%csmethodmodifiers Dali::PanGesture::velocity "private";
+%csmethodmodifiers Dali::PanGesture::displacement "private";
+%csmethodmodifiers Dali::PanGesture::position "private";
+%csmethodmodifiers Dali::PanGesture::screenVelocity "private";
+%csmethodmodifiers Dali::PanGesture::screenDisplacement "private";
+%csmethodmodifiers Dali::PanGesture::screenPosition "private";
+%csmethodmodifiers Dali::PanGesture::numberOfTouches "private";
+
+%typemap(cscode) Dali::PanGesture %{
+ public static PanGesture GetPanGestureFromPtr(global::System.IntPtr cPtr) {
+ PanGesture ret = new PanGesture(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public Vector2 Velocity
+ {
+ get
+ {
+ return velocity;
+ }
+ }
+
+ public Vector2 Displacement
+ {
+ get
+ {
+ return displacement;
+ }
+ }
+
+ public Vector2 Position
+ {
+ get
+ {
+ return position;
+ }
+ }
+
+ public Vector2 ScreenVelocity
+ {
+ get
+ {
+ return screenVelocity;
+ }
+ }
+
+ public Vector2 ScreenDisplacement
+ {
+ get
+ {
+ return screenDisplacement;
+ }
+ }
+
+ public Vector2 ScreenPosition
+ {
+ get
+ {
+ return screenPosition;
+ }
+ }
+
+ public uint NumberOfTouches
+ {
+ get
+ {
+ return numberOfTouches;
+ }
+ }
+%}
\ No newline at end of file
--- /dev/null
+%csmethodmodifiers Dali::PinchGesture::scale "private";
+%csmethodmodifiers Dali::PinchGesture::speed "private";
+%csmethodmodifiers Dali::PinchGesture::screenCenterPoint "private";
+%csmethodmodifiers Dali::PinchGesture::localCenterPoint "private";
+
+%typemap(cscode) Dali::PinchGesture %{
+ public static PinchGesture GetPinchGestureFromPtr(global::System.IntPtr cPtr) {
+ PinchGesture ret = new PinchGesture(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public float Scale
+ {
+ get
+ {
+ return scale;
+ }
+ }
+
+ public float Speed
+ {
+ get
+ {
+ return speed;
+ }
+ }
+
+ public Vector2 ScreenCenterPoint
+ {
+ get
+ {
+ return screenCenterPoint;
+ }
+ }
+
+ public Vector2 LocalCenterPoint
+ {
+ get
+ {
+ return localCenterPoint;
+ }
+ }
+%}
\ No newline at end of file
--- /dev/null
+%csmethodmodifiers Dali::TapGesture::numberOfTaps "private";
+%csmethodmodifiers Dali::TapGesture::numberOfTouches "private";
+%csmethodmodifiers Dali::TapGesture::screenPoint "private";
+%csmethodmodifiers Dali::TapGesture::localPoint "private";
+
+%typemap(cscode) Dali::TapGesture %{
+ public static TapGesture GetTapGestureFromPtr(global::System.IntPtr cPtr) {
+ TapGesture ret = new TapGesture(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public uint NumberOfTaps
+ {
+ get
+ {
+ return numberOfTaps;
+ }
+ }
+
+ public uint NumberOfTouches
+ {
+ get
+ {
+ return numberOfTouches;
+ }
+ }
+
+ public Vector2 ScreenPoint
+ {
+ get
+ {
+ return screenPoint;
+ }
+ }
+
+ public Vector2 LocalPoint
+ {
+ get
+ {
+ return localPoint;
+ }
+ }
+%}
\ No newline at end of file
--- /dev/null
+%rename(Touch) Dali::TouchData;
+
+%typemap(cscode) Dali::TouchData %{
+ public static Touch GetTouchFromPtr(global::System.IntPtr cPtr) {
+ Touch ret = new Touch(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+%}
\ No newline at end of file
--- /dev/null
+%rename(Wheel) Dali::WheelEvent;
+%rename(WheelType) Dali::WheelEvent::Type;
+
+%csmethodmodifiers Dali::WheelEvent::type "private";
+%csmethodmodifiers Dali::WheelEvent::direction "private";
+%csmethodmodifiers Dali::WheelEvent::modifiers "private";
+%csmethodmodifiers Dali::WheelEvent::point "private";
+%csmethodmodifiers Dali::WheelEvent::z "private";
+%csmethodmodifiers Dali::WheelEvent::timeStamp "private";
+
+%typemap(cscode) Dali::WheelEvent %{
+ public static Wheel GetWheelFromPtr(global::System.IntPtr cPtr) {
+ Wheel ret = new Wheel(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public Wheel.WheelType Type
+ {
+ get
+ {
+ return type;
+ }
+ }
+
+ public int Direction
+ {
+ get
+ {
+ return direction;
+ }
+ }
+
+ public uint Modifiers
+ {
+ get
+ {
+ return modifiers;
+ }
+ }
+
+ public Vector2 Point
+ {
+ get
+ {
+ return point;
+ }
+ }
+
+ public int Z
+ {
+ get
+ {
+ return z;
+ }
+ }
+
+ public uint TimeStamp
+ {
+ get
+ {
+ return timeStamp;
+ }
+ }
+%}
\ No newline at end of file
* Required to get access to any data passed as a parameter in a Signal ( in C# they are delegate parameters).
* E.g.
*
- * CREATE_CSHARP_WRAPPER_FROM_C_PTR_FUNCTION( TouchData );
- * Creates a function called GetTouchDataFromPtr which allows you to:
+ * CREATE_CSHARP_WRAPPER_FROM_C_PTR_FUNCTION( Touch );
+ * Creates a function called GetTouchFromPtr which allows you to:
*
* static void OnStageTouched(IntPtr data)
* {
- * TouchData touchData = TouchData.GetTouchDataFromPtr( data );
+ * Touch touch = Touch.GetTouchFromPtr( data );
* }
*
* ## means concat in a SWIG macro
DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Image );
DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, ResourceImage );
DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Animation );
-DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchEvent );
-DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchData );
-DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, WheelEvent );
-DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, KeyEvent );
-DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, LongPressGesture );
-DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, PanGesture );
-DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, PinchGesture );
-DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TapGesture );
DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, PropertyNotification );
DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, BaseHandle );
DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, RefObject );
namespace MyCSharpExample
{
- class Example
+ class Example
+ {
+ // This is simple structure to contain Control name and implement state at once
+ // name : control name
+ // isImplemented : the state which the control is implemented in public or not
+ private struct Item
{
- // This is simple structure to contain Control name and implement state at once
- // name : control name
- // isImplemented : the state which the control is implemented in public or not
- private struct Item
- {
- public String name;
- public bool isImplemented;
+ public String name;
+ public bool isImplemented;
+
+ public Item(String name, bool isImplemented)
+ {
+ this.name = name;
+ this.isImplemented = isImplemented;
+ }
+ }
- public Item(String name, bool isImplemented)
- {
- this.name = name;
- this.isImplemented = isImplemented;
- }
- }
+ private Dali.Application _application;
+ private TableView _contentContainer;
+ private Stage _stage;
+ private Popup _popup;
+
+ // List of items
+ private Item[] mViewList = {
+ new Item("PushButton", true), new Item("DropDown", false), new Item("Toggle", true),
+ new Item("InputField", false), new Item("AnimateGif", false), new Item("Loading", false),
+ new Item("ProgressBar", false), new Item("CheckBox", false), new Item("RadioButton", true),
+ new Item("Tooltip", true), new Item("Popup", true), new Item("Toast", true),
+ new Item("ItemView", false), new Item("CheckBox", true)
+ };
+
+ public Example(Dali.Application application)
+ {
+ _application = application;
+ _application.Initialized += OnInitialize;
+ }
+
+ public void OnInitialize(object source, NUIApplicationInitEventArgs e)
+ {
+ Console.WriteLine("Customized Application Initialize event handler");
+ _stage = Stage.GetCurrent();
+ _stage.BackgroundColor = Color.White;
+
+ // Top label
+ TextLabel topLabel = new TextLabel();
+ topLabel.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ topLabel.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT);
+ topLabel.AnchorPoint = NDalic.AnchorPointTopCenter;
+ topLabel.ParentOrigin = NDalic.ParentOriginTopCenter;
+ topLabel.SetSizeModeFactor(new Vector3( 0.0f, 0.1f, 0.0f ) );
+ topLabel.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f);
+ topLabel.TextColor = NDalic.WHITE;
+ topLabel.Text = " DALi Views";
+ topLabel.HorizontalAlignment = "BEGIN";
+ topLabel.VerticalAlignment = "CENTER";
+ topLabel.PointSize = 42.0f;
+ _stage.Add(topLabel);
+
+ // Grid container to contain items. Use tableView because FlexContainer support focus navigation just two direction ( up/down or left/right )
+ _contentContainer = new TableView(6, 5);
+ _contentContainer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ _contentContainer.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT);
+ _contentContainer.SetSizeModeFactor(new Vector3( 0.0f, 0.9f, 0.0f ) );
+ _contentContainer.AnchorPoint = NDalic.AnchorPointBottomCenter;
+ _contentContainer.ParentOrigin = NDalic.ParentOriginBottomCenter;
+ _contentContainer.SetRelativeHeight(0, 0.07f);
+ _contentContainer.SetRelativeHeight(1, 0.26f);
+ _contentContainer.SetRelativeHeight(2, 0.07f);
+ _contentContainer.SetRelativeHeight(3, 0.26f);
+ _contentContainer.SetRelativeHeight(4, 0.07f);
+ _contentContainer.SetRelativeHeight(5, 0.26f);
+ _contentContainer.SetKeyboardFocusable(true);
+ _stage.Add(_contentContainer);
+
+ CreateContent();
+
+ FocusManager.Instance.PreFocusChange += OnPreFocusChange;
+ }
+
+ // Callback for KeyboardFocusManager
+ private Actor OnPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e)
+ {
+ if (!e.Proposed && !e.Current)
+ {
+ e.Proposed = _contentContainer.GetChildAt(1);
+ }
+ return e.Proposed;
+ }
+
+ private void CreateContent()
+ {
+ for (int i = 0; i < mViewList.Length; i++)
+ {
+ CreateItem(mViewList[i], i);
+ }
+ }
- private Dali.Application _application;
- private TableView _contentContainer;
- private Stage _stage;
- private Popup _popup;
-
- // List of items
- private Item[] mViewList = {
- new Item("PushButton", true), new Item("DropDown", false), new Item("Toggle", true),
- new Item("InputField", false), new Item("AnimateGif", false), new Item("Loading", false),
- new Item("ProgressBar", false), new Item("CheckBox", false), new Item("RadioButton", true),
- new Item("Tooltip", true), new Item("Popup", true), new Item("Toast", true),
- new Item("ItemView", false), new Item("CheckBox", true)
- };
-
- public Example(Dali.Application application)
+ private void CreateItem(Item item, int idx)
+ {
+ // Make label for item
+ TextLabel itemLabel = new TextLabel(" " + item.name);
+ itemLabel.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.05f, 0.0f);
+ itemLabel.HorizontalAlignment = "BEGIN";
+ itemLabel.VerticalAlignment = "BOTTOM";
+ itemLabel.PointSize = 18.0f;
+ _contentContainer.AddChild(itemLabel, new TableView.CellPosition(((uint)idx / 5) * 2, (uint)idx % 5));
+
+ // If item is implemented in public, attach it on stage
+ if (item.isImplemented)
+ {
+ if (item.name.CompareTo("PushButton") == 0)
{
- _application = application;
- _application.Initialized += OnInitialize;
+ PushButton pushButton = new PushButton();
+ pushButton.LabelText = "Push Button";
+ pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
+ pushButton.UnselectedColor = new Vector4(1.0f,0.0f,0.0f,1.0f);
+ pushButton.SelectedColor = new Vector4(0.0f,1.0f,0.0f,1.0f);
+ pushButton.Clicked += (obj, e) =>
+ {
+ e.Button.LabelText = "Click Me";
+ e.Button.UnselectedColor = new Vector4(0.0f,0.0f,1.0f,1.0f);
+ return true;
+ };
+
+ _contentContainer.AddChild(pushButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
}
+ if (item.name.CompareTo("DropDown") == 0)
+ {
- public void OnInitialize(object source, NUIApplicationInitEventArgs e)
+ }
+ if (item.name.CompareTo("Toggle") == 0)
{
- Console.WriteLine("Customized Application Initialize event handler");
- _stage = Stage.GetCurrent();
- _stage.BackgroundColor = Color.White;
-
- // Top label
- TextLabel topLabel = new TextLabel();
- topLabel.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
- topLabel.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT);
- topLabel.AnchorPoint = NDalic.AnchorPointTopCenter;
- topLabel.ParentOrigin = NDalic.ParentOriginTopCenter;
- topLabel.SetSizeModeFactor(new Vector3( 0.0f, 0.1f, 0.0f ) );
- topLabel.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f);
- topLabel.TextColor = NDalic.WHITE;
- topLabel.Text = " DALi Views";
- topLabel.HorizontalAlignment = "BEGIN";
- topLabel.VerticalAlignment = "CENTER";
- topLabel.PointSize = 42.0f;
- _stage.Add(topLabel);
-
- // Grid container to contain items. Use tableView because FlexContainer support focus navigation just two direction ( up/down or left/right )
- _contentContainer = new TableView(6, 5);
- _contentContainer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
- _contentContainer.SetResizePolicy(ResizePolicyType.SIZE_RELATIVE_TO_PARENT, DimensionType.HEIGHT);
- _contentContainer.SetSizeModeFactor(new Vector3( 0.0f, 0.9f, 0.0f ) );
- _contentContainer.AnchorPoint = NDalic.AnchorPointBottomCenter;
- _contentContainer.ParentOrigin = NDalic.ParentOriginBottomCenter;
- _contentContainer.SetRelativeHeight(0, 0.07f);
- _contentContainer.SetRelativeHeight(1, 0.26f);
- _contentContainer.SetRelativeHeight(2, 0.07f);
- _contentContainer.SetRelativeHeight(3, 0.26f);
- _contentContainer.SetRelativeHeight(4, 0.07f);
- _contentContainer.SetRelativeHeight(5, 0.26f);
- _contentContainer.SetKeyboardFocusable(true);
- _stage.Add(_contentContainer);
-
- CreateContent();
-
- FocusManager.Instance.PreFocusChange += OnPreFocusChange;
+ ToggleButton toggleButton = new ToggleButton();
+ Dali.Property.Array array = new Dali.Property.Array();
+ array.Add( new Dali.Property.Value("./images/star-highlight.png") );
+ array.Add( new Dali.Property.Value("./images/star-mod.png") );
+ array.Add( new Dali.Property.Value("./images/star-dim.png") );
+ toggleButton.StateVisuals = array;
+
+ Dali.Property.Array tooltips = new Dali.Property.Array();
+ tooltips.Add( new Dali.Property.Value("State A") );
+ tooltips.Add( new Dali.Property.Value("State B") );
+ tooltips.Add( new Dali.Property.Value("State C") );
+ toggleButton.Tooltips = tooltips;
+
+ toggleButton.WidthResizePolicy = "FILL_TO_PARENT";
+ toggleButton.HeightResizePolicy = "FILL_TO_PARENT";
+ toggleButton.Clicked += (obj, e) =>
+ {
+ Console.WriteLine("Toggle button state changed.");
+ return true;
+ };
+
+ _contentContainer.AddChild(toggleButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
}
+ if (item.name.CompareTo("InputField") == 0)
+ {
- // Callback for KeyboardFocusManager
- private Actor OnPreFocusChange(object source, FocusManager.PreFocusChangeEventArgs e)
+ }
+ if (item.name.CompareTo("AnimateGif") == 0)
{
- if (!e.Proposed && !e.Current)
- {
- e.Proposed = _contentContainer.GetChildAt(1);
- }
- return e.Proposed;
+
}
+ if (item.name.CompareTo("Loading") == 0)
+ {
- private void CreateContent()
+ }
+ if (item.name.CompareTo("ProgressBar") == 0)
{
- for (int i = 0; i < mViewList.Length; i++)
- {
- CreateItem(mViewList[i], i);
- }
+
}
+ if (item.name.CompareTo("ScrollBar") == 0)
+ {
- private void CreateItem(Item item, int idx)
+ }
+ if (item.name.CompareTo("CheckBox") == 0)
{
- // Make label for item
- TextLabel itemLabel = new TextLabel(" " + item.name);
- itemLabel.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.05f, 0.0f);
- itemLabel.HorizontalAlignment = "BEGIN";
- itemLabel.VerticalAlignment = "BOTTOM";
- itemLabel.PointSize = 18.0f;
- _contentContainer.AddChild(itemLabel, new TableView.CellPosition(((uint)idx / 5) * 2, (uint)idx % 5));
-
- // If item is implemented in public, attach it on stage
- if (item.isImplemented)
- {
- if (item.name.CompareTo("PushButton") == 0)
- {
- PushButton pushButton = new PushButton();
- pushButton.LabelText = "Push Button";
- pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
- pushButton.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
- pushButton.UnselectedColor = new Vector4(1.0f,0.0f,0.0f,1.0f);
- pushButton.SelectedColor = new Vector4(0.0f,1.0f,0.0f,1.0f);
- pushButton.Clicked += (obj, e) =>
- {
- e.Button.LabelText = "Click Me";
- e.Button.UnselectedColor = new Vector4(0.0f,0.0f,1.0f,1.0f);
- return true;
- };
-
- _contentContainer.AddChild(pushButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
- }
- if (item.name.CompareTo("DropDown") == 0)
- {
-
- }
- if (item.name.CompareTo("Toggle") == 0)
- {
- ToggleButton toggleButton = new ToggleButton();
- Dali.Property.Array array = new Dali.Property.Array();
- array.Add( new Dali.Property.Value("./images/star-highlight.png") );
- array.Add( new Dali.Property.Value("./images/star-mod.png") );
- array.Add( new Dali.Property.Value("./images/star-dim.png") );
- toggleButton.StateVisuals = array;
-
- Dali.Property.Array tooltips = new Dali.Property.Array();
- tooltips.Add( new Dali.Property.Value("State A") );
- tooltips.Add( new Dali.Property.Value("State B") );
- tooltips.Add( new Dali.Property.Value("State C") );
- toggleButton.Tooltips = tooltips;
-
- toggleButton.WidthResizePolicy = "FILL_TO_PARENT";
- toggleButton.HeightResizePolicy = "FILL_TO_PARENT";
- toggleButton.Clicked += (obj, e) =>
- {
- Console.WriteLine("Toggle button state changed.");
- return true;
- };
-
- _contentContainer.AddChild(toggleButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
- }
- if (item.name.CompareTo("InputField") == 0)
- {
-
- }
- if (item.name.CompareTo("AnimateGif") == 0)
- {
-
- }
- if (item.name.CompareTo("Loading") == 0)
- {
-
- }
- if (item.name.CompareTo("ProgressBar") == 0)
- {
-
- }
- if (item.name.CompareTo("ScrollBar") == 0)
- {
-
- }
- if (item.name.CompareTo("CheckBox") == 0)
- {
- CheckBoxButton checkBoxButton = new CheckBoxButton();
- checkBoxButton.LabelText = "Yes";
-
- _contentContainer.AddChild(checkBoxButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
- }
- if (item.name.CompareTo("RadioButton") == 0)
- {
- TableView tableView = new TableView(2, 1);
- tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
- tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
-
- RadioButton rButton = new RadioButton();
- rButton.LabelText = "Yes";
- rButton.Selected = true;
- tableView.AddChild(rButton, new TableView.CellPosition(0, 0));
-
- rButton = new RadioButton();
- rButton.LabelText = "No";
-
- tableView.AddChild(rButton, new TableView.CellPosition(1, 0));
-
- _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
- }
- if (item.name.CompareTo("Tooltip") == 0)
- {
- TableView tableView = new TableView(2, 1);
- tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
- tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
-
- // Create two push buttons and add them to a table view
- PushButton buttonWithSimpleTooltip = new PushButton();
- buttonWithSimpleTooltip.LabelText = "Tooltip with text only";
- buttonWithSimpleTooltip.UnselectedColor = new Vector4(0.5f,0.5f,0.7f,1.0f);
- buttonWithSimpleTooltip.SelectedColor = new Vector4(0.7f,0.5f,0.7f,1.0f);
- buttonWithSimpleTooltip.WidthResizePolicy = "FILL_TO_PARENT";
- tableView.AddChild(buttonWithSimpleTooltip, new TableView.CellPosition(0, 0));
-
- PushButton buttonWithIconTooltip = new PushButton();
- buttonWithIconTooltip.LabelText = "Tooltip with Text and Icon";
- buttonWithIconTooltip.WidthResizePolicy = "FILL_TO_PARENT";
- buttonWithIconTooltip.UnselectedColor = new Vector4(0.5f,0.5f,0.7f,1.0f);
- buttonWithIconTooltip.SelectedColor = new Vector4(0.7f,0.5f,0.7f,1.0f);
- tableView.AddChild(buttonWithIconTooltip, new TableView.CellPosition(1, 0));
-
- // Add a simple text only tooltip to the first push button
- buttonWithSimpleTooltip.TooltipText = "Simple Tooltip";
-
- // Create a property map for a tooltip with one icon and one text
- Property.Array iconTooltipContent = new Property.Array();
-
- Property.Map iconVisual = new Property.Map();
- iconVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Image) )
- .Add( Dali.Constants.ImageVisualProperty.URL, new Property.Value("./images/star-highlight.png") );
- iconTooltipContent.Add(new Property.Value(iconVisual));
-
- Property.Map textVisual = new Property.Map();
- textVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Text) )
- .Add( Dali.Constants.TextVisualProperty.Text, new Property.Value("Tooltip with Icon") );
- iconTooltipContent.Add(new Property.Value(textVisual));
-
- Property.Map iconTooltip = new Property.Map();
- iconTooltip.Add( Dali.Constants.Tooltip.Property.Content, new Property.Value(iconTooltipContent) )
- .Add( Dali.Constants.Tooltip.Property.Tail, new Property.Value(true) );
-
- // Add the tooltip with icon and text to the second push button
- buttonWithIconTooltip.Tooltip = iconTooltip;
-
- _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
- }
- if (item.name.CompareTo("Popup") == 0)
- {
- PushButton button = new PushButton();
- button.LabelText = "Popup";
- button.ParentOrigin = NDalic.ParentOriginCenter;
- button.AnchorPoint = NDalic.AnchorPointCenter;
- button.MaximumSize = new Vector2(90.0f,50.0f);
- _popup = CreatePopup();
- _popup.SetTitle(CreateTitle("Popup"));
-
- TextLabel text = new TextLabel("This will erase the file permanently. Are you sure?");
- text.BackgroundColor = Color.White;
- text.MultiLine = true;
- text.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
- text.SetResizePolicy(ResizePolicyType.DIMENSION_DEPENDENCY, DimensionType.HEIGHT);
- text.SetPadding(new RectFloat(10.0f, 10.0f, 20.0f, 0.0f));
- _popup.SetContent(text);
- _popup.SetKeyboardFocusable(true);
- _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN);
-
- button.Clicked += (obj, ee) =>
- {
- _stage.Add(_popup);
- _popup.SetDisplayState(Popup.DisplayStateType.SHOWN);
- FocusManager.Instance.SetCurrentFocusActor((_popup.FindChildByName( "Footer" )).FindChildByName("OKButton"));
- return true;
- };
- _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
- }
- if (item.name.CompareTo("Toast") == 0)
- {
- PushButton button = new PushButton();
- button.LabelText = "Toast";
- button.ParentOrigin = NDalic.ParentOriginCenter;
- button.AnchorPoint = NDalic.AnchorPointCenter;
- button.Clicked += (obj, ee) =>
- {
- TypeInfo typeInfo = new TypeInfo(TypeRegistry.Get().GetTypeInfo( "PopupToast" ));
- if( typeInfo )
- {
- BaseHandle baseHandle = typeInfo.CreateInstance();
- if( baseHandle )
- {
- Popup toast = Popup.DownCast( baseHandle );
- TextLabel text = new TextLabel("This is a Toast.\nIt will auto-hide itself");
- text.TextColor = Color.White;
- text.MultiLine = true;
- text.HorizontalAlignment = "center";
- toast.SetTitle( text);
- _stage.Add(toast);
- toast.SetDisplayState( Popup.DisplayStateType.SHOWN);
- }
- }
- return true;
- };
- _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
- }
- if (item.name.CompareTo("ItemView") == 0)
- {
-
- }
- }
- else
- {
- ImageView notSupportView = new ImageView("images/not_yet_sign.png");
- notSupportView.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.25f, 0.0f);
- notSupportView.SetKeyboardFocusable(true);
- _contentContainer.AddChild(notSupportView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
- }
+ CheckBoxButton checkBoxButton = new CheckBoxButton();
+ checkBoxButton.LabelText = "Yes";
+
+ _contentContainer.AddChild(checkBoxButton, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
}
- Popup CreatePopup()
+ if (item.name.CompareTo("RadioButton") == 0)
{
- Popup confirmationPopup = new Popup();
-
- Actor footer = new Actor();
- footer.SetName("Footer");
- footer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
- footer.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.HEIGHT);
- footer.SetSize(0.0f, 80.0f);
- footer.ParentOrigin = NDalic.ParentOriginCenter;
- footer.AnchorPoint = NDalic.AnchorPointCenter;
-
- PushButton okButton = CreateOKButton();
- okButton.ParentOrigin = NDalic.ParentOriginCenter;
- okButton.AnchorPoint = NDalic.AnchorPointCenter;
- okButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS);
- okButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f));
-
- PushButton cancelButton = CreateCancelButton();
- cancelButton.ParentOrigin = NDalic.ParentOriginCenter;
- cancelButton.AnchorPoint = NDalic.AnchorPointCenter;
- cancelButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS);
- cancelButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f));
-
- TableView controlLayout = new TableView(1, 2);
- controlLayout.ParentOrigin = NDalic.ParentOriginCenter;
- controlLayout.AnchorPoint = NDalic.AnchorPointCenter;
- controlLayout.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
- controlLayout.SetCellPadding(new Size(10.0f, 10.0f));
- controlLayout.SetRelativeWidth(0, 0.5f);
- controlLayout.SetRelativeWidth(1, 0.5f);
- controlLayout.SetCellAlignment(new TableView.CellPosition(0, 0), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER);
- controlLayout.SetCellAlignment(new TableView.CellPosition(0, 1), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER);
- controlLayout.AddChild(okButton, new TableView.CellPosition(0, 0));
- controlLayout.AddChild(cancelButton, new TableView.CellPosition(0, 1));
-
- footer.Add(controlLayout);
-
- confirmationPopup.SetFooter(footer);
- return confirmationPopup;
+ TableView tableView = new TableView(2, 1);
+ tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
+
+ RadioButton rButton = new RadioButton();
+ rButton.LabelText = "Yes";
+ rButton.Selected = true;
+ tableView.AddChild(rButton, new TableView.CellPosition(0, 0));
+
+ rButton = new RadioButton();
+ rButton.LabelText = "No";
+
+ tableView.AddChild(rButton, new TableView.CellPosition(1, 0));
+
+ _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
}
- Actor CreateTitle(string title)
+ if (item.name.CompareTo("Tooltip") == 0)
{
- TextLabel titleActor = new TextLabel(title);
- titleActor.TextColor = Color.White;
- titleActor.MultiLine = true;
- titleActor.HorizontalAlignment = "center";
- return titleActor;
+ TableView tableView = new TableView(2, 1);
+ tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ tableView.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
+
+ // Create two push buttons and add them to a table view
+ PushButton buttonWithSimpleTooltip = new PushButton();
+ buttonWithSimpleTooltip.LabelText = "Tooltip with text only";
+ buttonWithSimpleTooltip.UnselectedColor = new Vector4(0.5f,0.5f,0.7f,1.0f);
+ buttonWithSimpleTooltip.SelectedColor = new Vector4(0.7f,0.5f,0.7f,1.0f);
+ buttonWithSimpleTooltip.WidthResizePolicy = "FILL_TO_PARENT";
+ tableView.AddChild(buttonWithSimpleTooltip, new TableView.CellPosition(0, 0));
+
+ PushButton buttonWithIconTooltip = new PushButton();
+ buttonWithIconTooltip.LabelText = "Tooltip with Text and Icon";
+ buttonWithIconTooltip.WidthResizePolicy = "FILL_TO_PARENT";
+ buttonWithIconTooltip.UnselectedColor = new Vector4(0.5f,0.5f,0.7f,1.0f);
+ buttonWithIconTooltip.SelectedColor = new Vector4(0.7f,0.5f,0.7f,1.0f);
+ tableView.AddChild(buttonWithIconTooltip, new TableView.CellPosition(1, 0));
+
+ // Add a simple text only tooltip to the first push button
+ buttonWithSimpleTooltip.TooltipText = "Simple Tooltip";
+
+ // Create a property map for a tooltip with one icon and one text
+ Property.Array iconTooltipContent = new Property.Array();
+
+ Property.Map iconVisual = new Property.Map();
+ iconVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Image) )
+ .Add( Dali.Constants.ImageVisualProperty.URL, new Property.Value("./images/star-highlight.png") );
+ iconTooltipContent.Add(new Property.Value(iconVisual));
+
+ Property.Map textVisual = new Property.Map();
+ textVisual.Add( Dali.Constants.Visual.Property.Type, new Property.Value((int)Dali.Constants.Visual.Type.Text) )
+ .Add( Dali.Constants.TextVisualProperty.Text, new Property.Value("Tooltip with Icon") );
+ iconTooltipContent.Add(new Property.Value(textVisual));
+
+ Property.Map iconTooltip = new Property.Map();
+ iconTooltip.Add( Dali.Constants.Tooltip.Property.Content, new Property.Value(iconTooltipContent) )
+ .Add( Dali.Constants.Tooltip.Property.Tail, new Property.Value(true) );
+
+ // Add the tooltip with icon and text to the second push button
+ buttonWithIconTooltip.Tooltip = iconTooltip;
+
+ _contentContainer.AddChild(tableView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
}
-
- PushButton CreateOKButton()
+ if (item.name.CompareTo("Popup") == 0)
{
- PushButton okayButton = new PushButton();
- okayButton.SetName("OKButton");
- okayButton.LabelText = "OK";
- okayButton.SetKeyboardFocusable(true);
- okayButton.Clicked += (obj, ee) =>
- {
- _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN);
- return true;
- };
- return okayButton;
+ PushButton button = new PushButton();
+ button.LabelText = "Popup";
+ button.ParentOrigin = NDalic.ParentOriginCenter;
+ button.AnchorPoint = NDalic.AnchorPointCenter;
+ button.MaximumSize = new Vector2(90.0f,50.0f);
+ _popup = CreatePopup();
+ _popup.SetTitle(CreateTitle("Popup"));
+
+ TextLabel text = new TextLabel("This will erase the file permanently. Are you sure?");
+ text.BackgroundColor = Color.White;
+ text.MultiLine = true;
+ text.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ text.SetResizePolicy(ResizePolicyType.DIMENSION_DEPENDENCY, DimensionType.HEIGHT);
+ text.SetPadding(new RectFloat(10.0f, 10.0f, 20.0f, 0.0f));
+ _popup.SetContent(text);
+ _popup.SetKeyboardFocusable(true);
+ _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN);
+
+ button.Clicked += (obj, ee) =>
+ {
+ _stage.Add(_popup);
+ _popup.SetDisplayState(Popup.DisplayStateType.SHOWN);
+ FocusManager.Instance.SetCurrentFocusActor((_popup.FindChildByName( "Footer" )).FindChildByName("OKButton"));
+ return true;
+ };
+ _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
}
- PushButton CreateCancelButton()
+ if (item.name.CompareTo("Toast") == 0)
{
- PushButton cancelButton = new PushButton();
- cancelButton.LabelText = "Cancel";
- cancelButton.SetKeyboardFocusable(true);
- cancelButton.Clicked += (obj, ee) =>
+ PushButton button = new PushButton();
+ button.LabelText = "Toast";
+ button.ParentOrigin = NDalic.ParentOriginCenter;
+ button.AnchorPoint = NDalic.AnchorPointCenter;
+ button.Clicked += (obj, ee) =>
+ {
+ TypeInfo typeInfo = new TypeInfo(TypeRegistry.Get().GetTypeInfo( "PopupToast" ));
+ if( typeInfo )
{
- _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN);
- return true;
- };
- return cancelButton;
+ BaseHandle baseHandle = typeInfo.CreateInstance();
+ if( baseHandle )
+ {
+ Popup toast = Popup.DownCast( baseHandle );
+ TextLabel text = new TextLabel("This is a Toast.\nIt will auto-hide itself");
+ text.TextColor = Color.White;
+ text.MultiLine = true;
+ text.HorizontalAlignment = "center";
+ toast.SetTitle( text);
+ _stage.Add(toast);
+ toast.SetDisplayState( Popup.DisplayStateType.SHOWN);
+ }
+ }
+ return true;
+ };
+ _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
}
-
- public void MainLoop()
+ if (item.name.CompareTo("ItemView") == 0)
{
- _application.MainLoop();
- }
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
+ }
+ }
+ else
+ {
+ ImageView notSupportView = new ImageView("images/not_yet_sign.png");
+ notSupportView.Size = new Vector3(_stage.GetSize().Width * 0.2f, _stage.GetSize().Height * 0.25f, 0.0f);
+ notSupportView.SetKeyboardFocusable(true);
+ _contentContainer.AddChild(notSupportView, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5));
+ }
+ }
+ Popup CreatePopup()
+ {
+ Popup confirmationPopup = new Popup();
+
+ Actor footer = new Actor();
+ footer.SetName("Footer");
+ footer.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.WIDTH);
+ footer.SetResizePolicy(ResizePolicyType.FIXED, DimensionType.HEIGHT);
+ footer.SetSize(0.0f, 80.0f);
+ footer.ParentOrigin = NDalic.ParentOriginCenter;
+ footer.AnchorPoint = NDalic.AnchorPointCenter;
+
+ PushButton okButton = CreateOKButton();
+ okButton.ParentOrigin = NDalic.ParentOriginCenter;
+ okButton.AnchorPoint = NDalic.AnchorPointCenter;
+ okButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS);
+ okButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f));
+
+ PushButton cancelButton = CreateCancelButton();
+ cancelButton.ParentOrigin = NDalic.ParentOriginCenter;
+ cancelButton.AnchorPoint = NDalic.AnchorPointCenter;
+ cancelButton.SetResizePolicy(ResizePolicyType.SIZE_FIXED_OFFSET_FROM_PARENT, DimensionType.ALL_DIMENSIONS);
+ cancelButton.SetSizeModeFactor(new Vector3(-20.0f, -20.0f, 0.0f));
+
+ TableView controlLayout = new TableView(1, 2);
+ controlLayout.ParentOrigin = NDalic.ParentOriginCenter;
+ controlLayout.AnchorPoint = NDalic.AnchorPointCenter;
+ controlLayout.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
+ controlLayout.SetCellPadding(new Size(10.0f, 10.0f));
+ controlLayout.SetRelativeWidth(0, 0.5f);
+ controlLayout.SetRelativeWidth(1, 0.5f);
+ controlLayout.SetCellAlignment(new TableView.CellPosition(0, 0), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER);
+ controlLayout.SetCellAlignment(new TableView.CellPosition(0, 1), HorizontalAlignmentType.CENTER, VerticalAlignmentType.CENTER);
+ controlLayout.AddChild(okButton, new TableView.CellPosition(0, 0));
+ controlLayout.AddChild(cancelButton, new TableView.CellPosition(0, 1));
+
+ footer.Add(controlLayout);
+
+ confirmationPopup.SetFooter(footer);
+ return confirmationPopup;
+ }
+ Actor CreateTitle(string title)
+ {
+ TextLabel titleActor = new TextLabel(title);
+ titleActor.TextColor = Color.White;
+ titleActor.MultiLine = true;
+ titleActor.HorizontalAlignment = "center";
+ return titleActor;
+ }
- [STAThread]
- static void Main(string[] args)
- {
- Console.WriteLine("Hello Mono World");
+ PushButton CreateOKButton()
+ {
+ PushButton okayButton = new PushButton();
+ okayButton.SetName("OKButton");
+ okayButton.LabelText = "OK";
+ okayButton.SetKeyboardFocusable(true);
+ okayButton.Clicked += (obj, ee) =>
+ {
+ _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN);
+ return true;
+ };
+ return okayButton;
+ }
+ PushButton CreateCancelButton()
+ {
+ PushButton cancelButton = new PushButton();
+ cancelButton.LabelText = "Cancel";
+ cancelButton.SetKeyboardFocusable(true);
+ cancelButton.Clicked += (obj, ee) =>
+ {
+ _popup.SetDisplayState(Popup.DisplayStateType.HIDDEN);
+ return true;
+ };
+ return cancelButton;
+ }
- Example example = new Example(Application.NewApplication());
- example.MainLoop();
- }
+ public void MainLoop()
+ {
+ _application.MainLoop();
}
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Hello Mono World");
+
+ Example example = new Example(Application.NewApplication("json/control-dashboard.json"));
+ example.MainLoop();
+ }
+ }
}
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)
{
}
UpdateStartImages(_myRating);
// Enable pan gesture detection
- EnableGestureDetection(Gesture.Type.Pan);
+ EnableGestureDetection(Gesture.GestureType.Pan);
_myDragEnabled = true; // Allow dragging by default (can be disabled)
}
// Only handle pan gesture if dragging is allowed
if(_myDragEnabled)
{
- switch (gesture.state)
+ switch (gesture.State)
{
- case Gesture.State.Started:
+ case Gesture.StateType.Started:
{
_gestureDisplacement = new Vector3(0.0f, 0.0f, 0.0f);
_currentValue = 0;
break;
}
- case Gesture.State.Continuing:
+ case Gesture.StateType.Continuing:
{
// Calculate the rating according to pan desture displacement
- _gestureDisplacement.X += gesture.displacement.X;
+ _gestureDisplacement.X += gesture.Displacement.X;
int delta = (int)Math.Ceiling(_gestureDisplacement.X / 40.0f);
_currentValue = _myRating + delta;
[STAThread]
static void Main(string[] args)
{
+ System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (typeof(MyCSharpExample.StarRating).TypeHandle);
+
Example example = new Example(Application.NewApplication());
example.MainLoop ();
}
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;
}
+ 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 ();
Console.WriteLine("Customized Application Initialize event handler");
Stage stage = Stage.Instance;
stage.BackgroundColor = Color.White;
- stage.TouchEvent += OnStageTouched;
+ stage.Touch += OnStageTouched;
// Add a _text label to the stage
_text = new TextLabel("Hello Mono World");
public void OnStageTouched(object sender, Stage.TouchEventArgs e)
{
// Only animate the _text label when touch down happens
- if( e.TouchData.GetState(0) == PointStateType.DOWN )
+ if( e.Touch.GetState(0) == PointStateType.DOWN )
{
Console.WriteLine("Customized Stage Touch event handler");
// Create a new _animation
Log("Customized Application Initialize event handler");
stage = Stage.Instance;
stage.BackgroundColor = Color.Cyan;
- stage.TouchEvent += OnStageTouched;
- stage.WheelEvent += OnStageWheelMoved;
- stage.KeyEvent += OnStageKeyPressed;
+ stage.Touch += OnStageTouched;
+ stage.Wheel += OnStageWheelMoved;
+ stage.Key += OnStageKeyPressed;
//stage.EventProcessingFinished += OnStageEventProcessingFinished;
layer = stage.GetDefaultLayer();
public void OnStageKeyPressed(object sender, Stage.KeyEventArgs e)
{
Log("OnStageKeyEventOccured()!");
- Log("keyPressedName=" + e.KeyEvent.keyPressedName);
- Log("state=" + e.KeyEvent.state);
+ Log("keyPressedName=" + e.Key.KeyPressedName);
+ Log("state=" + e.Key.State);
}
public void OnStageWheelMoved(object sender, Stage.WheelEventArgs e)
{
Log("OnStageWheelEventOccured()!");
- Log("direction=" + e.WheelEvent.direction);
- Log("type=" + e.WheelEvent.type);
+ Log("direction=" + e.Wheel.Direction);
+ Log("type=" + e.Wheel.Type);
}
// Callback for stage touched signal handling
public void OnStageTouched(object sender, Stage.TouchEventArgs e)
{
- Log("OnStageTouched()! e.TouchData.GetState(0)=" + e.TouchData.GetState(0) );
+ Log("OnStageTouched()! e.TouchData.GetState(0)=" + e.Touch.GetState(0));
}
public void MainLoop()
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * This file is part of Dali Toolkit
+ *
+ * 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.
+ */
+
+{
+ "styles":
+ {
+ "ProgressBar":
+ {
+ }
+ }
+}
Console.WriteLine("View TOUCH EVENT callback....");
// Only animate the _text label when touch down happens
- if( e.TouchData.GetState(0) == PointStateType.DOWN )
+ if( e.Touch.GetState(0) == PointStateType.DOWN )
{
Console.WriteLine("Customized Stage Touch event handler");
// Create a new _animation
Log("Initialize() is called!");
Stage stage = Stage.GetCurrent();
stage.BackgroundColor = Color.White;
- stage.TouchEvent += OnStageTouched;
- stage.TouchEvent += OnStageTouched2;
+ stage.Touch += OnStageTouched;
+ stage.Touch += OnStageTouched2;
//stage.EventProcessingFinished += OnEventProcessingFinished;
- stage.WheelEvent += OnStageWheelEvent;
+ stage.Wheel += OnStageWheelEvent;
// Add a _text label to the stage
_text = new TextLabel("Hello Mono World");
public void OnStageTouched(object source, Stage.TouchEventArgs e)
{
// Only animate the _text label when touch down happens
- if( e.TouchData.GetState(0) == PointStateType.DOWN )
+ if( e.Touch.GetState(0) == PointStateType.DOWN )
{
Log("OnStageTouched() is called! PointStateType.DOWN came!");
myCount++;
// Callback for stage touched signal handling
public void OnStageTouched2(object source, Stage.TouchEventArgs e)
{
- Log("OnStageTouched2() is called!state="+ e.TouchData.GetState(0) );
+ Log("OnStageTouched2() is called!state="+ e.Touch.GetState(0) );
}
public void OnEventProcessingFinished(object source)
}
-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;
}
-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;
{
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);
viewWrapperImpl.OnPropertySet = new ViewWrapperImpl.OnPropertySetDelegate(OnPropertySet);
viewWrapperImpl.OnSizeSet = new ViewWrapperImpl.OnSizeSetDelegate(OnSizeSet);
viewWrapperImpl.OnSizeAnimation = new ViewWrapperImpl.OnSizeAnimationDelegate(OnSizeAnimation);
- viewWrapperImpl.OnTouchEvent = new ViewWrapperImpl.OnTouchEventDelegate(OnTouchEvent);
+ viewWrapperImpl.OnTouch = new ViewWrapperImpl.OnTouchDelegate(OnTouch);
viewWrapperImpl.OnHover = new ViewWrapperImpl.OnHoverDelegate(OnHover);
- viewWrapperImpl.OnKeyEvent = new ViewWrapperImpl.OnKeyEventDelegate(OnKeyEvent);
- viewWrapperImpl.OnWheelEvent = new ViewWrapperImpl.OnWheelEventDelegate(OnWheelEvent);
+ viewWrapperImpl.OnKey = new ViewWrapperImpl.OnKeyDelegate(OnKey);
+ viewWrapperImpl.OnWheel = new ViewWrapperImpl.OnWheelDelegate(OnWheel);
viewWrapperImpl.OnRelayout = new ViewWrapperImpl.OnRelayoutDelegate(OnRelayout);
viewWrapperImpl.OnSetResizePolicy = new ViewWrapperImpl.OnSetResizePolicyDelegate(OnSetResizePolicy);
viewWrapperImpl.GetNaturalSize = new ViewWrapperImpl.GetNaturalSizeDelegate(GetNaturalSize);
* @endcode
* @param[in] type The gesture type(s) to enable.
*/
- public void EnableGestureDetection(Gesture.Type type)
+ public void EnableGestureDetection(Gesture.GestureType type)
{
viewWrapperImpl.EnableGestureDetection(type);
}
* @param[in] type The gesture type(s) to disable.
* @see EnableGetureDetection
*/
- public void DisableGestureDetection(Gesture.Type type)
+ public void DisableGestureDetection(Gesture.GestureType type)
{
viewWrapperImpl.DisableGestureDetection(type);
}
/**
* @brief Called by the KeyInputFocusManager to emit key event signals.
*
- * @param[in] keyEvent The key event.
+ * @param[in] key The key event.
* @return True if the event was consumed.
*/
- public bool EmitKeyEventSignal(KeyEvent keyEvent)
+ public bool EmitKeyEventSignal(Key key)
{
- return viewWrapperImpl.EmitKeyEventSignal(keyEvent);
+ return viewWrapperImpl.EmitKeyEventSignal(key);
}
/**
*
* @brief Called after a touch-event is received by the owning actor.
*
- * @param[in] event The touch event
+ * @param[in] touch The touch event
* @return True if the event should be consumed.
* @note CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
*/
- public virtual bool OnTouchEvent(TouchEvent touchEvent)
+ public virtual bool OnTouch(Touch touch)
{
return false; // Do not consume
}
/**
* @brief Called after a key-event is received by the actor that has had its focus set.
*
- * @param[in] event the Key Event
+ * @param[in] key the Key Event
* @return True if the event should be consumed.
*/
- public virtual bool OnKeyEvent(KeyEvent keyEvent)
+ public virtual bool OnKey(Key key)
{
return false; // Do not consume
}
/**
* @brief Called after a wheel-event is received by the owning actor.
*
- * @param[in] event The wheel event
+ * @param[in] wheel The wheel event
* @return True if the event should be consumed.
* @note CustomViewBehaviour.REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
*/
- public virtual bool OnWheelEvent(WheelEvent wheelEvent)
+ public virtual bool OnWheel(Wheel wheel)
{
return false; // Do not consume
}
* @brief This method should be overridden by deriving classes when they wish to respond the accessibility
* touch event.
*
- * @param[in] touchEvent The touch event.
+ * @param[in] touch The touch event.
* @return true if the touch event has been consumed by this control
*/
- public virtual bool OnAccessibilityTouch(TouchEvent touchEvent)
+ public virtual bool OnAccessibilityTouch(Touch touch)
{
return false;
}
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);
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();
///
/// 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
/// {
/// 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())
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);
}
}
- 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();
public delegate void OnPropertySetDelegate(int index, Property.Value propertyValue);
public delegate void OnSizeSetDelegate(Vector3 targetSize);
public delegate void OnSizeAnimationDelegate(Animation animation, Vector3 targetSize);
- public delegate bool OnTouchEventDelegate(TouchEvent touchEvent);
+ public delegate bool OnTouchDelegate(Touch touch);
public delegate bool OnHoverDelegate(Hover hover);
- public delegate bool OnKeyEventDelegate(KeyEvent keyEvent);
- public delegate bool OnWheelEventDelegate(WheelEvent wheelEvent);
+ public delegate bool OnKeyDelegate(Key key);
+ public delegate bool OnWheelDelegate(Wheel wheel);
public delegate void OnRelayoutDelegate(Vector2 size, RelayoutContainer container);
public delegate void OnSetResizePolicyDelegate(ResizePolicyType policy, DimensionType dimension);
public delegate Vector3 GetNaturalSizeDelegate();
public delegate void OnStyleChangeDelegate(StyleManager styleManager, StyleChangeType change);
public delegate bool OnAccessibilityActivatedDelegate();
public delegate bool OnAccessibilityPanDelegate(PanGesture gestures);
- public delegate bool OnAccessibilityTouchDelegate(TouchEvent touchEvent);
+ public delegate bool OnAccessibilityTouchDelegate(Touch touch);
public delegate bool OnAccessibilityValueChangeDelegate(bool isIncrease);
public delegate bool OnAccessibilityZoomDelegate();
public delegate void OnKeyInputFocusGainedDelegate();
public OnPropertySetDelegate OnPropertySet;
public OnSizeSetDelegate OnSizeSet;
public OnSizeAnimationDelegate OnSizeAnimation;
- public OnTouchEventDelegate OnTouchEvent;
+ public OnTouchDelegate OnTouch;
public OnHoverDelegate OnHover;
- public OnKeyEventDelegate OnKeyEvent;
- public OnWheelEventDelegate OnWheelEvent;
+ public OnKeyDelegate OnKey;
+ public OnWheelDelegate OnWheel;
public OnRelayoutDelegate OnRelayout;
public OnSetResizePolicyDelegate OnSetResizePolicy;
public GetNaturalSizeDelegate GetNaturalSize;
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;
}
Delegate4 = new DelegateViewWrapperImpl_4(DirectorOnPropertySet);
Delegate5 = new DelegateViewWrapperImpl_5(DirectorOnSizeSet);
Delegate6 = new DelegateViewWrapperImpl_6(DirectorOnSizeAnimation);
- Delegate7 = new DelegateViewWrapperImpl_7(DirectorOnTouchEvent);
+ Delegate7 = new DelegateViewWrapperImpl_7(DirectorOnTouch);
Delegate8 = new DelegateViewWrapperImpl_8(DirectorOnHover);
- Delegate9 = new DelegateViewWrapperImpl_9(DirectorOnKeyEvent);
- Delegate10 = new DelegateViewWrapperImpl_10(DirectorOnWheelEvent);
+ Delegate9 = new DelegateViewWrapperImpl_9(DirectorOnKey);
+ Delegate10 = new DelegateViewWrapperImpl_10(DirectorOnWheel);
Delegate11 = new DelegateViewWrapperImpl_11(DirectorOnRelayout);
Delegate12 = new DelegateViewWrapperImpl_12(DirectorOnSetResizePolicy);
Delegate13 = new DelegateViewWrapperImpl_13(DirectorGetNaturalSize);
OnSizeAnimation(new Animation(animation, false), new Vector3(targetSize, false));
}
- private bool DirectorOnTouchEvent(global::System.IntPtr arg0)
+ private bool DirectorOnTouch(global::System.IntPtr arg0)
{
- return OnTouchEvent(new TouchEvent(arg0, false));
+ return OnTouch(new Touch(arg0, false));
}
private bool DirectorOnHover(global::System.IntPtr arg0)
return OnHover(new Hover(arg0, false));
}
- private bool DirectorOnKeyEvent(global::System.IntPtr arg0)
+ private bool DirectorOnKey(global::System.IntPtr arg0)
{
- return OnKeyEvent(new KeyEvent(arg0, false));
+ return OnKey(new Key(arg0, false));
}
- private bool DirectorOnWheelEvent(global::System.IntPtr arg0)
+ private bool DirectorOnWheel(global::System.IntPtr arg0)
{
- return OnWheelEvent(new WheelEvent(arg0, false));
+ return OnWheel(new Wheel(arg0, false));
}
private void DirectorOnRelayout(global::System.IntPtr size, global::System.IntPtr container)
return OnAccessibilityPan(new PanGesture(gesture, false));
}
- private bool DirectorOnAccessibilityTouch(global::System.IntPtr touchEvent)
+ private bool DirectorOnAccessibilityTouch(global::System.IntPtr touch)
{
- return OnAccessibilityTouch(new TouchEvent(touchEvent, false));
+ return OnAccessibilityTouch(new Touch(touch, false));
}
private bool DirectorOnAccessibilityValueChange(bool isIncrease)
public delegate void DelegateViewWrapperImpl_24(global::System.IntPtr styleManager, int change);
public delegate bool DelegateViewWrapperImpl_25();
public delegate bool DelegateViewWrapperImpl_26(global::System.IntPtr gesture);
- public delegate bool DelegateViewWrapperImpl_27(global::System.IntPtr touchEvent);
+ public delegate bool DelegateViewWrapperImpl_27(global::System.IntPtr touch);
public delegate bool DelegateViewWrapperImpl_28(bool isIncrease);
public delegate bool DelegateViewWrapperImpl_29();
public delegate void DelegateViewWrapperImpl_30();
{
// 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)
{
}