--- /dev/null
+{
+ "styles":
+ {
+ "testbutton":
+ {
+ "backgroundColor":[1.0,1.0,0.0,1.0]
+ }
+ }
+}
--- /dev/null
+{
+ "styles":
+ {
+ "testbutton":
+ {
+ "backgroundColor":[1.0,1.0,0.0,1.0]
+// Deliberate Error: trailing comma
+ },
+ },
+}
-/*
+ /*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
#include <test-button.h>
#include <test-animation-data.h>
#include <toolkit-style-monitor.h>
+#include <dummy-control.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
using namespace Dali;
using namespace Dali::Toolkit;
{
const char* defaultTheme =
"{\n"
+" \"constants\":\n"
+" {\n"
+" \"CONFIG_SCRIPT_LOG_LEVEL\":\"NoLogging\"\n"
+" },\n"
" \"styles\":\n"
" {\n"
" \"textlabel\":\n"
" \"grabHandleImage\" : \"{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png\",\n"
" \"selectionHandleImageLeft\" : {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png\" },\n"
" \"selectionHandleImageRight\": {\"filename\":\"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png\" }\n"
+" },\n"
+" \"ComplexControl\":\n"
+" {\n"
+" \"states\":\n"
+" {\n"
+" \"NORMAL\":\n"
+" {\n"
+" \"states\":\n"
+" {\n"
+" \"SELECTED\":\n"
+" {\n"
+" \"visuals\":\n"
+" {\n"
+" \"foregroundVisual\":\n"
+" {\n"
+" \"visualType\":\"GRADIENT\",\n"
+" \"startPosition\": [-1, -1],\n"
+" \"endPosition\": [1, 1],\n"
+" \"spreadMethod\": \"REPEAT\",\n"
+" \"stopOffset\": [0.2, 0.8],\n"
+" \"stopColor\": [ [ 1,0,0,1], [0,1,0,1] ]\n"
+" }\n"
+" }\n"
+" },\n"
+" \"UNSELECTED\":\n"
+" {\n"
+" \"visuals\":\n"
+" {\n"
+" \"foregroundVisual\":\n"
+" {\n"
+" \"visualType\":\"COLOR\",\n"
+" \"mixColor\": [ 1,0,0,1]\n"
+" }\n"
+" }\n"
+" }\n"
+" },\n"
+" \"transitions\":\n"
+" {\n"
+" \"visualName\":\"*\",\n"
+" \"effect\":\"CROSSFADE\",\n"
+" \"animator\":\n"
+" {\n"
+" \"alphaFunction\":\"EASE_IN_OUT\",\n"
+" \"duration\":0.3\n"
+" }\n"
+" }\n"
+" },\n"
+" \"FOCUSED\":\n"
+" {\n"
+" \"visuals\":\n"
+" {\n"
+" \"foregroundVisual\":\n"
+" {\n"
+" \"visualType\":\"GRADIENT\",\n"
+" \"startPosition\": [-1, -1],\n"
+" \"endPosition\": [1, 1],\n"
+" \"spreadMethod\": \"REPEAT\",\n"
+" \"stopOffset\": [0.3, 0.9],\n"
+" \"stopColor\": [ [ 0,0,1,1], [0,1,1,1] ]\n"
+" },\n"
+" \"focusVisual\":\n"
+" {\n"
+" \"visualType\":\"IMAGE\",\n"
+" \"url\": \"focus.png\"\n"
+" }\n"
+" },\n"
+" \"entryTransition\":\n"
+" {\n"
+" \"target\":\"focusVisual\",\n"
+" \"property\":\"mixColor\",\n"
+" \"initialValue\":[0,0,0,0],\n"
+" \"targetValue\":[1,1,1,1],\n"
+" \"animator\":\n"
+" {\n"
+" \"alphaFunction\":\"EASE_IN_OUT_SINE\",\n"
+" \"timePeriod\": \n"
+" {\n"
+" \"duration\":0.5,\n"
+" \"delay\":0\n"
+" }\n"
+" }\n"
+" },\n"
+" \"exitTransition\":\n"
+" {\n"
+" \"target\":\"focusVisual\",\n"
+" \"property\":\"mixColor\",\n"
+" \"initialValue\":[1,1,1,1],\n"
+" \"targetValue\":[0,0,0,0],\n"
+" \"animator\":\n"
+" {\n"
+" \"alphaFunction\":\"EASE_IN_OUT_SINE\",\n"
+" \"timePeriod\": \n"
+" {\n"
+" \"duration\":0.5,\n"
+" \"delay\":0\n"
+" }\n"
+" }\n"
+" }\n"
+" },\n"
+" \"DISABLED\":\n"
+" {\n"
+" \"visuals\":\n"
+" {\n"
+" \"foregroundVisual\":\n"
+" {\n"
+" \"visualType\":\"COLOR\",\n"
+" \"mixColor\": [1,0,0,1]\n"
+" }\n"
+" }\n"
+" }\n"
+" },\n"
+" \"transitions\":\n"
+" [\n"
+" {\n"
+" \"effect\":\"CROSSFADE\",\n"
+" \"animator\":\n"
+" {\n"
+" \"alphaFunction\":\"EASE_IN_OUT\",\n"
+" \"duration\":0.3\n"
+" }\n"
+" }\n"
+" ]\n"
+" },\n"
+" \"BasicControl\":\n"
+" {\n"
+" \"states\":\n"
+" {\n"
+" \"NORMAL\":\n"
+" {\n"
+" \"visuals\":\n"
+" {\n"
+" \"foregroundVisual\":\n"
+" {\n"
+" \"visualType\":\"GRADIENT\",\n"
+" \"startPosition\": [-1, -1],\n"
+" \"endPosition\": [1, 1],\n"
+" \"spreadMethod\": \"REPEAT\",\n"
+" \"stopOffset\": [0.2, 0.8],\n"
+" \"stopColor\": [ [ 1,0,0,1], [0,1,0,1] ]\n"
+" }\n"
+" }\n"
+" },\n"
+" \"FOCUSED\":\n"
+" {\n"
+" \"visuals\":\n"
+" {\n"
+" \"foregroundVisual\":\n"
+" {\n"
+" \"visualType\":\"GRADIENT\",\n"
+" \"startPosition\": [-1, -1],\n"
+" \"endPosition\": [1, 1],\n"
+" \"spreadMethod\": \"REPEAT\",\n"
+" \"stopOffset\": [0.3, 0.9],\n"
+" \"stopColor\": [ [ 0,0,1,1], [0,1,1,1] ]\n"
+" },\n"
+" \"focusVisual\":\n"
+" {\n"
+" \"visualType\":\"IMAGE\",\n"
+" \"url\": \"focus.png\"\n"
+" }\n"
+" },\n"
+" \"entryTransition\":\n"
+" {\n"
+" \"target\":\"focusVisual\",\n"
+" \"property\":\"mixColor\",\n"
+" \"initialValue\":[0,0,0,0],\n"
+" \"targetValue\":[1,1,1,1],\n"
+" \"animator\":\n"
+" {\n"
+" \"alphaFunction\":\"EASE_IN_OUT_SINE\",\n"
+" \"timePeriod\": \n"
+" {\n"
+" \"duration\":0.5,\n"
+" \"delay\":0\n"
+" }\n"
+" }\n"
+" },\n"
+" \"exitTransition\":\n"
+" {\n"
+" \"target\":\"focusVisual\",\n"
+" \"property\":\"mixColor\",\n"
+" \"initialValue\":[1,1,1,1],\n"
+" \"targetValue\":[0,0,0,0],\n"
+" \"animator\":\n"
+" {\n"
+" \"alphaFunction\":\"EASE_IN_OUT_SINE\",\n"
+" \"timePeriod\": \n"
+" {\n"
+" \"duration\":0.5,\n"
+" \"delay\":0\n"
+" }\n"
+" }\n"
+" }\n"
+" },\n"
+" \"DISABLED\":\n"
+" {\n"
+" \"visuals\":\n"
+" {\n"
+" \"foregroundVisual\":\n"
+" {\n"
+" \"visualType\":\"COLOR\",\n"
+" \"mixColor\": [1,0,0,1]\n"
+" }\n"
+" }\n"
+" }\n"
+" },\n"
+" \"transitions\":\n"
+" [\n"
+" {\n"
+" \"effect\":\"CROSSFADE\",\n"
+" \"animator\":\n"
+" {\n"
+" \"alphaFunction\":\"EASE_IN_OUT\",\n"
+" \"duration\":0.3\n"
+" }\n"
+" }\n"
+" ]\n"
" }\n"
" }\n"
"}\n";
+
void dali_style_manager_startup(void)
{
test_return_value = TET_UNDEF;
const char* json1 =
"{\n"
+ " \"constants\":\n"
+ " {\n"
+ " \"CONFIG_SCRIPT_LOG_LEVEL\":\"Verbose\"\n"
+ " },\n"
" \"styles\":\n"
" {\n"
" \"testbutton\":\n"
const char* defaultTheme =
"{\n"
+ " \"constants\":\n"
+ " {\n"
+ " \"CONFIG_SCRIPT_LOG_LEVEL\":\"Concise\"\n"
+ " },\n"
" \"styles\":\n"
" {\n"
" \"testbutton\":\n"
const char* json1 =
"{\n"
+ " \"constants\":\n"
+ " {\n"
+ " \"CONFIG_SCRIPT_LOG_LEVEL\":\"General\"\n"
+ " },\n"
" \"styles\":\n"
" {\n"
" \"testbutton\":\n"
}
+int UtcDaliStyleManagerIncludeStyleP(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliStyleManagerIncludeStyle - test that style sheet inclusion works" );
+
+ const char* json1 =
+ "{\n"
+ " \"includes\":\n"
+ " [\n"
+ " \"src/dali-toolkit-styling/theme2.json\"\n"
+ " ],\n"
+ " \"styles\":\n"
+ " {\n"
+ " \"testbutton\":\n"
+ " {\n"
+ " \"foregroundColor\":[0.0,0.0,1.0,1.0]\n"
+ " }\n"
+ " }\n"
+ "}\n";
+
+ // Add 2 buttons
+ Test::TestButton testButton = Test::TestButton::New();
+ Test::TestButton testButton2 = Test::TestButton::New();
+ Stage::GetCurrent().Add( testButton );
+ Stage::GetCurrent().Add( testButton2 );
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ StyleManager styleManager = StyleManager::Get();
+
+ styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
+
+ tet_infoline("Apply the style");
+
+ std::string themeFile("ThemeOne");
+ Test::StyleMonitor::SetThemeFileOutput(themeFile, json1);
+
+ styleManager.ApplyTheme(themeFile);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ Property::Value themedBgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
+ Property::Value themedFgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
+
+ DALI_TEST_EQUALS( themedBgColor, Property::Value(Color::YELLOW), 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS( themedFgColor, Property::Value(Color::BLUE), 0.001, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
+int UtcDaliStyleManagerIncludeStyleN(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliStyleManagerIncludeStyle - test that style sheet inclusion works, but included stylesheet is bad json" );
+
+ const char* json1 =
+ "{\n"
+ " \"includes\":\n"
+ " [\n"
+ " \"src/dali-toolkit-styling/theme3.json\"\n"
+ " ],\n"
+ " \"styles\":\n"
+ " {\n"
+ " \"testbutton\":\n"
+ " {\n"
+ " \"foregroundColor\":[0.0,0.0,1.0,1.0]\n"
+ " }\n"
+ " }\n"
+ "}\n";
+
+ // Add 2 buttons
+ Test::TestButton testButton = Test::TestButton::New();
+ Test::TestButton testButton2 = Test::TestButton::New();
+ Stage::GetCurrent().Add( testButton );
+ Stage::GetCurrent().Add( testButton2 );
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ StyleManager styleManager = StyleManager::Get();
+
+ styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
+
+ tet_infoline("Apply the style");
+
+ std::string themeFile("ThemeOne");
+ Test::StyleMonitor::SetThemeFileOutput(themeFile, json1);
+
+ try
+ {
+ styleManager.ApplyTheme(themeFile);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_ASSERT( e, "!\"Cannot parse JSON\"", TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
+
int UtcDaliStyleManagerStyleChangedSignalFontFamily(void)
{
tet_infoline("Test that the StyleChange signal is fired when the font family is altered" );
END_TEST;
}
+
+
+int UtcDaliStyleManagerVisualTransitionParsing(void)
+{
+ tet_infoline("Instantiate dummy control and test state/visual/transition capture" );
+ Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
+ defaultTheme );
+
+ ToolkitTestApplication application;
+
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ Dali::StyleMonitor styleMonitor = Dali::StyleMonitor::Get();
+ StyleManager styleManager = StyleManager::Get();
+
+ DummyControl actor = DummyControl::New(true);
+ actor.SetStyleName("BasicControl");
+ Stage::GetCurrent().Add(actor);
+
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+
+ DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+ Visual::Base visual1 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+
+ actor.SetProperty( DevelControl::Property::STATE, DevelControl::FOCUSED );
+
+ DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOCUS_VISUAL), true, TEST_LOCATION);
+
+ Visual::Base visual2 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+ DALI_TEST_CHECK( visual1 != visual2 );
+
+ actor.SetProperty( DevelControl::Property::STATE, DevelControl::DISABLED );
+
+ DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+
+ Visual::Base visual3 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+ Visual::Base focusVisual = dummyImpl.GetVisual(DummyControl::Property::FOCUS_VISUAL);
+ DALI_TEST_CHECK( !focusVisual );
+ DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOCUS_VISUAL), false, TEST_LOCATION);
+
+ DALI_TEST_CHECK( visual1 != visual3 );
+ DALI_TEST_CHECK( visual2 != visual3 );
+
+ END_TEST;
+}
+
+
+int UtcDaliStyleManagerVisualTransitionParsing02(void)
+{
+ tet_infoline("Instantiate dummy control and test state/visual/transition capture" );
+ Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
+ defaultTheme );
+
+ ToolkitTestApplication application;
+
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ Dali::StyleMonitor styleMonitor = Dali::StyleMonitor::Get();
+ StyleManager styleManager = StyleManager::Get();
+
+ DummyControl actor = DummyControl::New(true);
+ actor.SetProperty(DevelControl::Property::STATE, "FOCUSED");
+
+ actor.SetStyleName("ComplexControl");
+ Stage::GetCurrent().Add(actor);
+
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+
+ DALI_TEST_EQUALS(dummyImpl.IsVisualEnabled(DummyControl::Property::FOREGROUND_VISUAL), true, TEST_LOCATION);
+ Visual::Base visual1 = dummyImpl.GetVisual(DummyControl::Property::FOREGROUND_VISUAL);
+ DALI_TEST_CHECK( visual1 );
+ Property::Map map;
+ visual1.CreatePropertyMap( map );
+ Property::Value* value = map.Find( Visual::Property::TYPE );
+ DALI_TEST_CHECK( value );
+
+ int visualType;
+ value->Get( visualType );
+
+ DALI_TEST_EQUALS( visualType, (int)Toolkit::Visual::GRADIENT, TEST_LOCATION );
+
+ END_TEST;
+}
/*
- * 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
{
Dali::PropertyRegistration dummyControlVisualProperty02(
typeRegistration, "testVisual", Dali::Toolkit::DummyControl::Property::TEST_VISUAL2, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
+Dali::PropertyRegistration dummyControlVisualProperty03(
+ typeRegistration, "foregroundVisual", Dali::Toolkit::DummyControl::Property::FOREGROUND_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
+
+Dali::PropertyRegistration dummyControlVisualProperty04(
+ typeRegistration, "focusVisual", Dali::Toolkit::DummyControl::Property::FOCUS_VISUAL, Dali::Property::MAP, &Dali::Toolkit::DummyControlImpl::SetProperty, &Dali::Toolkit::DummyControlImpl::GetProperty );
+
}
DummyControl DummyControlImpl::New()
void DummyControlImpl::SetProperty( BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value )
{
+ Toolkit::DummyControl control = Toolkit::DummyControl::DownCast( Dali::BaseHandle( object ) );
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(control.GetImplementation());
+
+ switch(index)
+ {
+ case Toolkit::DummyControl::Property::TEST_VISUAL:
+ case Toolkit::DummyControl::Property::TEST_VISUAL2:
+ case Toolkit::DummyControl::Property::FOREGROUND_VISUAL:
+ case Toolkit::DummyControl::Property::FOCUS_VISUAL:
+ {
+ Property::Map* map = value.GetMap();
+ if( map != NULL )
+ {
+ VisualFactory visualFactory = VisualFactory::Get();
+ Visual::Base visual = visualFactory.CreateVisual(*map);
+ dummyImpl.RegisterVisual(index, visual);
+ }
+ break;
+ }
+ }
}
Property::Value DummyControlImpl::GetProperty( BaseObject* object, Dali::Property::Index propertyIndex )
enum Type
{
TEST_VISUAL = PROPERTY_START_INDEX,
- TEST_VISUAL2
+ TEST_VISUAL2,
+ FOREGROUND_VISUAL,
+ FOCUS_VISUAL
};
};
void RegisterVisual( Property::Index index, Toolkit::Visual::Base visual, bool enabled );
void UnregisterVisual( Property::Index index );
void EnableVisual( Property::Index index, bool enabled );
- bool IsVisualEnabled( Property::Index indepx );
+ bool IsVisualEnabled( Property::Index index );
Toolkit::Visual::Base GetVisual( Property::Index index );
Animation CreateTransition( const Toolkit::TransitionData& transition );
/*
- * 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.
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,
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.
" \"name\": \"greeting\","
" \"type\": \"TextLabel\","
" \"text\": \"Touch me\","
- " \"styles\": [\"basicText\"],"
+ " \"inherit\": [\"basicText\"],"
" \"position\": [0, -120, 0],"
" \"size\": [200, 200, 1],"
" \"orientation\": [0, 0, 30],"
" \"name\": \"greeting\","
" \"type\": \"TextLabel\","
" \"text\": \"Touch me\","
- " \"styles\": [\"basicText\"],"
+ " \"inherit\": [\"basicText\"],"
" \"position\": [0, -120, 0],"
" \"size\": [200, 200, 1],"
" \"orientation\": [0, 0, 30],"
#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()) );
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/key-event-integ.h>
-
+#include <dali-toolkit/devel-api/controls/control-devel.h>
using namespace Dali;
using namespace Dali::Toolkit;
}
+
+
+
+int UtcDaliKeyboardFocusManagerMoveFocusTestStateChange(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerMoveFocusTestStateChange");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool preFocusChangeSignalVerified = false;
+ PreFocusChangeCallback preFocusChangeCallback(preFocusChangeSignalVerified);
+ manager.PreFocusChangeSignal().Connect( &preFocusChangeCallback, &PreFocusChangeCallback::Callback );
+
+ bool focusChangedSignalVerified = false;
+ FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
+ manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
+
+ // Create the first actor and add it to the stage
+ Control first = Control::New();
+ first.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(first);
+
+ // Create the second actor and add it to the stage
+ Control second = Control::New();
+ second.SetKeyboardFocusable(true);
+ Stage::GetCurrent().Add(second);
+
+ // Move the focus to the right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
+
+ // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
+ preFocusChangeCallback.Reset();
+
+ // Check that the focus is set on the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+ focusChangedCallback.Reset();
+
+ // Move the focus towards right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
+
+ // Because no layout control in the stage and the first actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::RIGHT);
+ preFocusChangeCallback.Reset();
+
+ // Check that the focus is set on the second actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+ focusChangedCallback.Reset();
+
+ // Move the focus towards up
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::UP) == false);
+
+ // Because no layout control in the stage and no actor is focused, it should emit the PreFocusChange signal
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == second);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::UP);
+ preFocusChangeCallback.Reset();
+ DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
+
+ // Create a 2x2 table view and try to move focus inside it
+ TableView tableView = TableView::New( 2, 2 );
+ Stage::GetCurrent().Add(tableView);
+
+ // Create the third actor
+ Control third = Control::New();
+ third.SetKeyboardFocusable(true);
+
+ // Create the fourth actor
+ Control fourth = Control::New();
+ fourth.SetKeyboardFocusable(true);
+
+ // Add the four children to table view
+ tableView.AddChild(first, TableView::CellPosition(0, 0));
+ tableView.AddChild(second, TableView::CellPosition(0, 1));
+ tableView.AddChild(third, TableView::CellPosition(1, 0));
+ tableView.AddChild(fourth, TableView::CellPosition(1, 1));
+
+ // Set the focus to the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+ DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+
+ focusChangedCallback.Reset();
+
+ // Move the focus towards right
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+
+ focusChangedCallback.Reset();
+
+ // Move the focus towards down
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::DOWN) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
+
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+
+ focusChangedCallback.Reset();
+
+ // Move the focus towards left
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == third);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == fourth);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == third);
+
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+ DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+
+ focusChangedCallback.Reset();
+
+ // Move the focus towards up
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::UP) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == third);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+ DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ focusChangedCallback.Reset();
+
+ // Move the focus towards left. The focus move will fail as no way to move it upwards
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mSignalVerified);
+ DALI_TEST_CHECK(preFocusChangeCallback.mCurrentFocusedActor == first);
+ DALI_TEST_CHECK(preFocusChangeCallback.mProposedActorToFocus == Actor());
+ DALI_TEST_CHECK(preFocusChangeCallback.mDirection == Control::KeyboardFocus::LEFT);
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+ DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+
+ preFocusChangeCallback.Reset();
+ DALI_TEST_CHECK(!focusChangedCallback.mSignalVerified);
+
+ // Enable the loop
+ manager.SetFocusGroupLoop(true);
+ DALI_TEST_CHECK(manager.GetFocusGroupLoop() == true);
+
+ // Move the focus towards left again. The focus should move to the fourth actor.
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == fourth);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == fourth);
+
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "FOCUSED", TEST_LOCATION );
+
+ focusChangedCallback.Reset();
+
+ // Clear the focus
+ manager.ClearFocus();
+ DALI_TEST_EQUALS(first.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(second.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(third.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+ DALI_TEST_EQUALS(fourth.GetProperty<std::string>(DevelControl::Property::STATE), "NORMAL", TEST_LOCATION );
+
+
+ END_TEST;
+}
// Test all contextual modes.
const char* mode[5] = { "NON_CONTEXTUAL", "ABOVE", "RIGHT", "BELOW", "LEFT" };
Vector2 offsetValues[5];
- offsetValues[0] = Vector2( 0.0f, 0.0f );
- offsetValues[1] = Vector2( 0.0f, -10.0f );
- offsetValues[2] = Vector2( 10.0f, 0.0f );
- offsetValues[3] = Vector2( 0.0f, 10.0f );
- offsetValues[4] = Vector2( -10.0f, 0.0f );
+ offsetValues[0] = Vector2( 0.375f, 0.0f );
+ offsetValues[1] = Vector2( -0.125f, -10.5f );
+ offsetValues[2] = Vector2( 10.875f, -0.5f );
+ offsetValues[3] = Vector2( -0.125f, 10.5f );
+ offsetValues[4] = Vector2( -10.875f, -0.5f );
for( int i = 0; i < 5; ++i )
{
int UtcDaliToolkitTextSelectionToolBarP(void)
{
-
// Creates Toolbar, adds 2 options and a divider then resizes divider
ToolkitTestApplication application;
DALI_TEST_CHECK( toolbar );
END_TEST;
}
+
+int UtcDaliToolkitTextSelectionToolBarScrollBarP(void)
+{
+ // Creates Toolbar, adds 2 options and a divider then resizes divider
+ ToolkitTestApplication application;
+
+ TextSelectionToolbar toolbar = TextSelectionToolbar::New();
+
+ toolbar.SetProperty( Toolkit::TextSelectionToolbar::Property::MAX_SIZE, Size( 100.0f, 60.0f) );
+
+ Toolkit::PushButton option = Toolkit::PushButton::New();
+ option.SetName( "test-option" );
+ option.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ toolbar.AddOption( option );
+
+ // Add a scroll-bar
+ toolbar.SetProperty( Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR, true );
+
+ bool enabled = toolbar.GetProperty<bool>( Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR );
+ DALI_TEST_CHECK( enabled );
+
+ DALI_TEST_CHECK( toolbar );
+ END_TEST;
+}
svgVisual2.GetNaturalSize(naturalSize);
DALI_TEST_EQUALS( naturalSize, Vector2(100.f, 100.f), TEST_LOCATION ); // Natural size should still be 100, 100
- // Batch Image visual
- TestPlatformAbstraction& platform = application.GetPlatform();
- Vector2 testSize(80.f, 160.f);
- platform.SetClosestImageSize(testSize);
- propertyMap.Clear();
- propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
- propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- propertyMap.Insert( "batchingEnabled", true );
- Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
- batchImageVisual.SetTransformAndSize(DefaultTransform(), controlSize );
- batchImageVisual.GetNaturalSize( naturalSize );
- DALI_TEST_EQUALS( naturalSize, Vector2( 80.0f, 160.0f ), TEST_LOCATION );
-
// Text visual.
// Load some fonts to get the same metrics on different platforms.
END_TEST;
}
-int UtcDaliVisualGetPropertyMapBatchImageVisual(void)
-{
- ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualGetPropertyMapBatchImageVisual:" );
-
- VisualFactory factory = VisualFactory::Get();
- Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
- propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
- propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 20 );
- propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 30 );
-
- Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
- DALI_TEST_CHECK( batchImageVisual );
-
- Property::Map resultMap;
- batchImageVisual.CreatePropertyMap( resultMap );
-
- // Check the property values from the returned map from visual
- Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
-
- value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
-
- value = resultMap.Find( ImageVisual::Property::DESIRED_WIDTH, Property::INTEGER );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == 20 );
-
- value = resultMap.Find( ImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == 30 );
-
- END_TEST;
-}
-
//Text shape visual
int UtcDaliVisualGetPropertyMap10(void)
{
END_TEST;
}
-int UtcDaliVisualGetPropertyMapBatchImageVisualNoAtlas(void)
-{
- ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualGetPropertyMapBatchImageVisualNoAtlas:" );
-
- VisualFactory factory = VisualFactory::Get();
- Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
- propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
- propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-
- // Set the desired size to be larger than the atlas limit of 1024x1024.
- propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 2048 );
- propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 2048 );
-
- // Create the visual.
- Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
-
- DALI_TEST_CHECK( batchImageVisual );
-
- DummyControl dummyControl = DummyControl::New(true);
- Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(dummyControl.GetImplementation());
- dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, batchImageVisual );
- Stage::GetCurrent().Add( dummyControl );
-
- DALI_TEST_CHECK( dummyControl.GetRendererCount() == 1u );
-
- END_TEST;
-}
-
int UtcDaliVisualAnimateBorderVisual01(void)
{
ToolkitTestApplication application;
END_TEST;
}
-int UtcDaliVisualFactoryGetBatchImageVisual1(void)
-{
- ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetBatchImageVisual1: Request a Batch Image visual with a Property::Map" );
-
- VisualFactory factory = VisualFactory::Get();
- DALI_TEST_CHECK( factory );
-
- Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
- propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
- propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-
- Visual::Base visual = factory.CreateVisual( propertyMap );
- DALI_TEST_CHECK( visual );
-
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
-
- actor.SetSize( 200.0f, 200.0f );
- Stage::GetCurrent().Add( actor );
- visual.SetTransformAndSize(DefaultTransform(), Vector2( 200.0f, 200.0f ) );
-
- // Test SetOnStage().
- DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-
- application.SendNotification();
- application.Render();
-
- // Test SetOffStage().
- actor.Unparent();
- DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
- END_TEST;
-}
-
-int UtcDaliVisualFactoryGetBatchImageVisual2(void)
-{
- ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetBatchImageVisual2: Request Batch Image visual from an Image Visual with batchingEnabled set" );
-
- VisualFactory factory = VisualFactory::Get();
- DALI_TEST_CHECK( factory );
-
- Property::Map propertyMap;
- // Create a normal Image Visual.
- propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
- // Instruct the factory to change Image Visuals to Batch-Image Visuals.
- propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
-
- // Properties for the Batch-Image Visual.
- propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
-
- Visual::Base visual = factory.CreateVisual( propertyMap );
- DALI_TEST_CHECK( visual );
-
- // Check that a Batch-Image visual was created instead of an Image visual.
- Property::Map resultMap;
- visual.CreatePropertyMap( resultMap );
-
- Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<int>(), (int)Visual::IMAGE, TEST_LOCATION );
-
- DummyControl actor = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
- dummyImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual );
-
- actor.SetSize( 200.0f, 200.0f );
- Stage::GetCurrent().Add( actor );
- visual.SetTransformAndSize(DefaultTransform(), Vector2( 200.0f, 200.0f ) );
-
- // Test SetOnStage().
- DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-
- application.SendNotification();
- application.Render();
-
- // Test SetOffStage().
- actor.Unparent();
- DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
-
- END_TEST;
-}
-
-int UtcDaliVisualFactoryGetBatchImageVisual3(void)
-{
- ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetBatchImageVisual3: Create an ImageView that uses a batched visual internally" );
-
- VisualFactory factory = VisualFactory::Get();
- DALI_TEST_CHECK( factory );
-
- // Create a property-map that enables batching.
- Property::Map propertyMap;
- propertyMap[ Dali::Toolkit::ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME ;
- propertyMap[ "desiredHeight" ] = 200;
- propertyMap[ "desiredWidth" ] = 200;
- propertyMap[ "batchingEnabled" ] = true;
-
- // Create an ImageView, passing the property-map in to instruct it to use batching.
- Toolkit::ImageView imageView = Toolkit::ImageView::New();
- imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap );
-
- imageView.SetSize( 200.0f, 200.0f );
- Stage::GetCurrent().Add( imageView );
-
- END_TEST;
-}
-
-int UtcDaliVisualFactoryGetBatchImageVisual4N(void)
-{
- ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetBatchImageVisual4: Create an ImageView that uses a batched visual, with desired properties of the wrong type" );
-
- VisualFactory factory = VisualFactory::Get();
- DALI_TEST_CHECK( factory );
-
- // Create a property-map that enables batching.
- Property::Map propertyMap;
- propertyMap[ Dali::Toolkit::ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME ;
- propertyMap[ "desiredHeight" ] = Vector2(100, 100);
- propertyMap[ "desiredWidth" ] = Vector3(1, 1, 1);
- propertyMap[ "batchingEnabled" ] = true;
-
- // Create an ImageView, passing the property-map in to instruct it to use batching.
- Toolkit::ImageView imageView = Toolkit::ImageView::New();
- imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, propertyMap );
-
- imageView.SetSize( 200.0f, 200.0f );
- Stage::GetCurrent().Add( imageView );
-
- END_TEST;
-}
-
int UtcDaliVisualFactoryGetAnimatedImageVisual1(void)
{
ToolkitTestApplication application;
#include "dali-toolkit/devel-api/builder/tree-node.h"
#include "dali-toolkit/internal/builder/tree-node-manipulator.h"
-namespace
+
+namespace Dali
{
bool CaseInsensitiveCharacterCompare( unsigned char a, unsigned char b )
return result;
}
-} // anonymous namespace
-
-
-namespace Dali
-{
-
namespace Toolkit
{
namespace DevelControl
{
+enum State
+{
+ NORMAL,
+ FOCUSED,
+ DISABLED
+};
+
namespace Property
{
* @see Toolkit::Tooltip
*/
TOOLTIP = BACKGROUND + 1,
+
+ /**
+ * @brief The current state of the control.
+ * @details Name "state", type DevelControl::State ( Property::INTEGER ) or Property::STRING
+ *
+ * @see DevelControl::State
+ */
+ STATE = BACKGROUND + 2,
+
+ /**
+ * @brief The current sub state of the control.
+ * @details Name "subState", type Property::INTEGER or Property::STRING. The enumeration used is dependent on the derived control.
+ *
+ * @see DevelControl::State
+ */
+ SUB_STATE = BACKGROUND + 3
};
} // namespace Property
// 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
};
};
#include <sys/stat.h>
#include <sstream>
-#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/actors/camera-actor.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/object/property-array.h>
#include <dali/public-api/object/type-info.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/object/property-array.h>
-#include <dali/public-api/actors/layer.h>
-#include <dali/public-api/actors/camera-actor.h>
-#include <dali/devel-api/scripting/scripting.h>
+#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/signals/functor-delegate.h>
+#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/devel-api/builder/json-parser.h>
-#include <dali-toolkit/internal/builder/builder-get-is.inl.h>
-#include <dali-toolkit/internal/builder/builder-filesystem.h>
#include <dali-toolkit/internal/builder/builder-declarations.h>
+#include <dali-toolkit/internal/builder/builder-filesystem.h>
+#include <dali-toolkit/internal/builder/builder-get-is.inl.h>
+#include <dali-toolkit/internal/builder/builder-impl-debug.h>
#include <dali-toolkit/internal/builder/builder-set-property.h>
#include <dali-toolkit/internal/builder/replacement.h>
#include <dali-toolkit/internal/builder/tree-node-manipulator.h>
-#include <dali-toolkit/internal/builder/builder-impl-debug.h>
-
namespace Dali
{
class Replacement;
extern Animation CreateAnimation(const TreeNode& child, const Replacement& replacements, const Dali::Actor searchRoot, Builder* const builder );
+
extern Actor SetupSignalAction(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, Dali::Toolkit::Internal::Builder* const builder);
+
extern Actor SetupPropertyNotification(ConnectionTracker* tracker, const TreeNode &root, const TreeNode &child, Actor actor, Dali::Toolkit::Internal::Builder* const builder);
+
#if defined(DEBUG_ENABLED)
Integration::Log::Filter* gFilterScript = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_SCRIPT");
#endif
#define TOKEN_STRING(x) #x
-const std::string KEYNAME_STYLES = "styles";
-const std::string KEYNAME_TYPE = "type";
-const std::string KEYNAME_ACTORS = "actors";
-const std::string KEYNAME_SIGNALS = "signals";
-const std::string KEYNAME_NAME = "name";
-const std::string KEYNAME_TEMPLATES = "templates";
-const std::string KEYNAME_INCLUDES = "includes";
-const std::string KEYNAME_MAPPINGS = "mappings";
+const std::string KEYNAME_ACTORS = "actors";
+const std::string KEYNAME_ENTRY_TRANSITION = "entryTransition";
+const std::string KEYNAME_EXIT_TRANSITION = "exitTransition";
+const std::string KEYNAME_INCLUDES = "includes";
+const std::string KEYNAME_INHERIT = "inherit";
+const std::string KEYNAME_MAPPINGS = "mappings";
+const std::string KEYNAME_NAME = "name";
+const std::string KEYNAME_SIGNALS = "signals";
+const std::string KEYNAME_STATES = "states";
+const std::string KEYNAME_STYLES = "styles";
+const std::string KEYNAME_TEMPLATES = "templates";
+const std::string KEYNAME_TRANSITIONS = "transitions";
+const std::string KEYNAME_TYPE = "type";
+const std::string KEYNAME_VISUALS = "visuals";
const std::string PROPERTIES = "properties";
const std::string ANIMATABLE_PROPERTIES = "animatableProperties";
{
styleList.push_back( &(*node) );
- if( OptionalChild subStyle = IsChild( *node, KEYNAME_STYLES ) )
+ OptionalChild subStyle = IsChild( *node, KEYNAME_INHERIT );
+ if( ! subStyle )
+ {
+ subStyle = IsChild( *node, KEYNAME_STYLES );
+ }
+ if( subStyle )
{
CollectAllStyles( stylesCollection, *subStyle, styleList );
}
} // namespace anon
-/*
- * Sets the handle properties found in the tree node
- */
-void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replacement& constant )
+
+Builder::Builder()
+: mSlotDelegate( this )
{
- if( handle )
- {
+ mParser = Dali::Toolkit::JsonParser::New();
- for( TreeNode::ConstIterator iter = node.CBegin(); iter != node.CEnd(); ++iter )
- {
- const TreeNode::KeyNodePair& keyChild = *iter;
+ Property::Map defaultDirs;
+ defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_SOUND_DIR) ] = DALI_SOUND_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_STYLE_DIR) ] = DALI_STYLE_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_STYLE_IMAGE_DIR) ] = DALI_STYLE_IMAGE_DIR;
- std::string key( keyChild.first );
+ AddConstants( defaultDirs );
+}
- // ignore special fields; type,actors,signals,styles
- if(key == KEYNAME_TYPE || key == KEYNAME_ACTORS || key == KEYNAME_SIGNALS || key == KEYNAME_STYLES || key == KEYNAME_MAPPINGS )
- {
- continue;
- }
+void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::UIFormat format )
+{
+ // parser to get constants and includes only
+ Dali::Toolkit::JsonParser parser = Dali::Toolkit::JsonParser::New();
+
+ if( !parser.Parse( data ) )
+ {
+ DALI_LOG_WARNING( "JSON Parse Error:%d:%d:'%s'\n",
+ parser.GetErrorLineNumber(),
+ parser.GetErrorColumn(),
+ parser.GetErrorDescription().c_str() );
- Handle propertyObject( handle );
+ DALI_ASSERT_ALWAYS(!"Cannot parse JSON");
+ }
+ else
+ {
+ // load constant map (allows the user to override the constants in the json after loading)
+ LoadConstants( *parser.GetRoot(), mReplacementMap );
- Dali::Property::Index index = propertyObject.GetPropertyIndex( key );
+ // merge includes
+ if( OptionalChild includes = IsChild(*parser.GetRoot(), KEYNAME_INCLUDES) )
+ {
+ Replacement replacer( mReplacementMap );
- if( Property::INVALID_INDEX != index )
+ for(TreeNode::ConstIterator iter = (*includes).CBegin(); iter != (*includes).CEnd(); ++iter)
{
- Property::Type type = propertyObject.GetPropertyType(index);
- Property::Value value;
- bool mapped = false;
+ OptionalString filename = replacer.IsString( (*iter).second );
- // if node.value is a mapping, get the property value from the "mappings" table
- if( keyChild.second.GetType() == TreeNode::STRING )
- {
- std::string mappingKey;
- if( GetMappingKey(keyChild.second.GetString(), mappingKey) )
- {
- OptionalChild mappingRoot = IsChild( mParser.GetRoot(), KEYNAME_MAPPINGS );
- mapped = GetPropertyMap( *mappingRoot, mappingKey.c_str(), type, value );
- }
- }
- if( ! mapped )
- {
- mapped = DeterminePropertyFromNode( keyChild.second, type, value, constant );
- if( ! mapped )
- {
- // Just determine the property from the node and if it's valid, let the property object handle it
- DeterminePropertyFromNode( keyChild.second, value, constant );
- mapped = ( value.GetType() != Property::NONE );
- }
- }
- if( mapped )
+ if( filename )
{
- DALI_SCRIPT_VERBOSE("SetProperty '%s' Index=:%d Value Type=%d Value '%s'\n", key.c_str(), index, value.GetType(), PropertyValueToString(value).c_str() );
-
- propertyObject.SetProperty( index, value );
+#if defined(DEBUG_ENABLED)
+ DALI_SCRIPT_VERBOSE("Loading Include '%s'\n", (*filename).c_str());
+#endif
+ LoadFromString( GetFileContents(*filename) );
}
}
- else
- {
- DALI_LOG_ERROR("Key '%s' not found.\n", key.c_str());
- }
+ }
- // Add custom properties
- SetCustomProperties(node, handle, constant, PROPERTIES, Property::READ_WRITE);
- SetCustomProperties(node, handle, constant, ANIMATABLE_PROPERTIES, Property::ANIMATABLE);
+ if( !mParser.Parse( data ) )
+ {
+ DALI_LOG_WARNING( "JSON Parse Error:%d:%d:'%s'\n",
+ mParser.GetErrorLineNumber(),
+ mParser.GetErrorColumn(),
+ mParser.GetErrorDescription().c_str() );
- } // for property nodes
- }
- else
- {
- DALI_SCRIPT_WARNING("Style applied to empty handle\n");
+ DALI_ASSERT_ALWAYS(!"Cannot parse JSON");
+ }
}
+
+ DUMP_PARSE_TREE(parser); // This macro only writes out if DEBUG is enabled and the "DUMP_TREE" constant is defined in the stylesheet.
+ DUMP_TEST_MAPPINGS(parser);
+
+ DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Cannot parse JSON");
}
-void Builder::SetCustomProperties( const TreeNode& node, Handle& handle, const Replacement& constant,
- const std::string& childName, Property::AccessMode accessMode )
+void Builder::AddConstants( const Property::Map& map )
{
- // Add custom properties
- if( OptionalChild customPropertiesChild = IsChild(node, childName) )
- {
- const TreeNode& customPropertiesNode = *customPropertiesChild;
- const TreeConstIter endIter = customPropertiesNode.CEnd();
- for( TreeConstIter iter = customPropertiesNode.CBegin(); endIter != iter; ++iter )
- {
- const TreeNode::KeyNodePair& keyChild = *iter;
- std::string key( keyChild.first );
+ mReplacementMap.Merge( map );
+}
- Property::Value value;
- DeterminePropertyFromNode( keyChild.second, value, constant );
- // Register/Set property.
- handle.RegisterProperty( key, value, accessMode );
- }
- }
+void Builder::AddConstant( const std::string& key, const Property::Value& value )
+{
+ mReplacementMap[key] = value;
}
-// Set properties from node on handle.
-void Builder::ApplyProperties( const TreeNode& root, const TreeNode& node,
- Dali::Handle& handle, const Replacement& constant )
+const Property::Map& Builder::GetConstants() const
{
- if( Actor actor = Actor::DownCast(handle) )
- {
- SetProperties( node, actor, constant );
+ return mReplacementMap;
+}
- if( actor )
- {
- // add signals
- SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor, this );
- SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor, this );
- }
+const Property::Value& Builder::GetConstant( const std::string& key ) const
+{
+ Property::Value* match = mReplacementMap.Find( key );
+ if( match )
+ {
+ return (*match);
}
else
{
- SetProperties( node, handle, constant );
+ static Property::Value invalid;
+ return invalid;
}
}
-// Appling by style helper
-// use FindChildByName() to apply properties referenced in KEYNAME_ACTORS in the node
-void Builder::ApplyStylesByActor( const TreeNode& root, const TreeNode& node,
- Dali::Handle& handle, const Replacement& constant )
+Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor )
{
- if( Dali::Actor actor = Dali::Actor::DownCast( handle ) )
- {
- if( const TreeNode* actors = node.GetChild( KEYNAME_ACTORS ) )
- {
- // in a style the actor subtree properties referenced by actor name
- for( TreeConstIter iter = actors->CBegin(); iter != actors->CEnd(); ++iter )
- {
- Dali::Actor foundActor;
-
- if( (*iter).first )
- {
- foundActor = actor.FindChildByName( (*iter).first );
- }
-
- if( !foundActor )
- {
- // debug log cannot find searched for actor
-#if defined(DEBUG_ENABLED)
- DALI_SCRIPT_VERBOSE("Cannot find actor in style application '%s'\n", (*iter).first);
-#endif
- }
- else
- {
-#if defined(DEBUG_ENABLED)
- DALI_SCRIPT_VERBOSE("Styles applied to actor '%s'\n", (*iter).first);
-#endif
- ApplyProperties( root, (*iter).second, foundActor, constant );
- }
- }
- }
- }
+ Replacement replacement(map, mReplacementMap);
+ return CreateAnimation( animationName, replacement, sourceActor);
}
+Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map )
+{
+ Replacement replacement(map, mReplacementMap);
+ return CreateAnimation( animationName, replacement, Stage::GetCurrent().GetRootLayer() );
+}
-void Builder::ApplyAllStyleProperties( const TreeNode& root, const TreeNode& node,
- Dali::Handle& handle, const Replacement& constant )
+Animation Builder::CreateAnimation( const std::string& animationName, Dali::Actor sourceActor )
{
- OptionalChild styles = IsChild(root, KEYNAME_STYLES);
- OptionalChild style = IsChild(node, KEYNAME_STYLES);
+ Replacement replacement( mReplacementMap );
- if( styles && style )
- {
- TreeNodeList additionalStyles;
+ return CreateAnimation( animationName, replacement, sourceActor );
+}
- CollectAllStyles( *styles, *style, additionalStyles );
+Animation Builder::CreateAnimation( const std::string& animationName )
+{
+ Replacement replacement( mReplacementMap );
-#if defined(DEBUG_ENABLED)
- for(TreeNode::ConstIterator iter = (*style).CBegin(); iter != (*style).CEnd(); ++iter)
- {
- if( OptionalString styleName = IsString( (*iter).second ) )
- {
- DALI_SCRIPT_VERBOSE("Style Applied '%s'\n", (*styleName).c_str());
- }
- }
-#endif
+ return CreateAnimation( animationName, replacement, Dali::Stage::GetCurrent().GetRootLayer() );
+}
- // a style may have other styles, which has other styles etc so we apply in reverse by convention.
- for(TreeNodeList::reverse_iterator iter = additionalStyles.rbegin(); iter != additionalStyles.rend(); ++iter)
- {
- ApplyProperties( root, *(*iter), handle, constant );
+BaseHandle Builder::Create( const std::string& templateName )
+{
+ Replacement replacement( mReplacementMap );
+ return Create( templateName, replacement );
+}
- ApplyStylesByActor( root, *(*iter), handle, constant );
- }
- }
+BaseHandle Builder::Create( const std::string& templateName, const Property::Map& map )
+{
+ Replacement replacement( map, mReplacementMap );
+ return Create( templateName, replacement );
+}
+
+BaseHandle Builder::CreateFromJson( const std::string& json )
+{
+ BaseHandle ret;
- // applying given node last
- ApplyProperties( root, node, handle, constant );
+ // merge in new template, hoping no one else has one named '@temp@'
+ std::string newTemplate =
+ std::string("{\"templates\":{\"@temp@\":") + \
+ json + \
+ std::string("}}");
- ApplyStylesByActor( root, node, handle, constant );
+ if( mParser.Parse(newTemplate) )
+ {
+ Replacement replacement( mReplacementMap );
+ ret = Create( "@temp@", replacement );
+ }
+ return ret;
}
-
-/*
- * Create a dali type from a node.
- * If parent given and an actor type was created then add it to the parent and
- * recursively add nodes children.
- */
-BaseHandle Builder::DoCreate( const TreeNode& root, const TreeNode& node,
- Actor parent, const Replacement& replacements )
+bool Builder::ApplyFromJson( Handle& handle, const std::string& json )
{
- BaseHandle baseHandle;
- TypeInfo typeInfo;
- const TreeNode* templateNode = NULL;
-
- if( OptionalString typeName = IsString(node, KEYNAME_TYPE) )
- {
- typeInfo = TypeRegistry::Get().GetTypeInfo( *typeName );
+ bool ret = false;
- if( !typeInfo )
- {
- // a template name is also allowed inplace of the type name
- OptionalChild templates = IsChild( root, KEYNAME_TEMPLATES);
-
- if( templates )
- {
- if( OptionalChild isTemplate = IsChild( *templates, *typeName ) )
- {
- templateNode = &(*isTemplate);
-
- if( OptionalString templateTypeName = IsString(*templateNode, KEYNAME_TYPE) )
- {
- typeInfo = TypeRegistry::Get().GetTypeInfo( *templateTypeName );
- }
- }
- }
- }
- }
+ // merge new style, hoping no one else has one named '@temp@'
+ std::string newStyle =
+ std::string("{\"styles\":{\"@temp@\":") + \
+ json + \
+ std::string("}}");
- if(!typeInfo)
+ if( mParser.Parse(newStyle) )
{
- DALI_SCRIPT_WARNING("Cannot create Dali type from node '%s'\n", node.GetName());
+ Replacement replacement( mReplacementMap );
+ ret = ApplyStyle( "@temp@", handle, replacement );
}
- else
- {
- baseHandle = typeInfo.CreateInstance();
- Handle handle = Handle::DownCast(baseHandle);
- Actor actor = Actor::DownCast(handle);
-
- if(handle)
- {
-
- DALI_SCRIPT_VERBOSE("Create:%s\n", typeInfo.GetName().c_str());
-
-#if defined(DEBUG_ENABLED)
- if(handle)
- {
- DALI_SCRIPT_VERBOSE(" Is Handle Object=%d\n", (long*)handle.GetObjectPtr());
- DALI_SCRIPT_VERBOSE(" Is Handle Property Count=%d\n", handle.GetPropertyCount());
- }
-
- if(actor)
- {
- DALI_SCRIPT_VERBOSE(" Is Actor id=%d\n", actor.GetId());
- }
-
- Toolkit::Control control = Toolkit::Control::DownCast(handle);
- if(control)
- {
- DALI_SCRIPT_VERBOSE(" Is Control id=%d\n", actor.GetId());
- }
-#endif // DEBUG_ENABLED
- if( templateNode )
- {
- ApplyProperties( root, *templateNode, handle, replacements );
+ return ret;
+}
- if( OptionalChild actors = IsChild( *templateNode, KEYNAME_ACTORS ) )
- {
- for( TreeConstIter iter = (*actors).CBegin(); iter != (*actors).CEnd(); ++iter )
- {
- DoCreate( root, (*iter).second, actor, replacements );
- }
- }
- }
+bool Builder::ApplyStyle( const std::string& styleName, Handle& handle )
+{
+ Replacement replacer( mReplacementMap );
+ return ApplyStyle( styleName, handle, replacer );
+}
- if( actor )
- {
- // add children of all the styles
- if( OptionalChild actors = IsChild( node, KEYNAME_ACTORS ) )
- {
- for( TreeConstIter iter = (*actors).CBegin(); iter != (*actors).CEnd(); ++iter )
- {
- DoCreate( root, (*iter).second, actor, replacements );
- }
- }
+bool Builder::LookupStyleName( const std::string& styleName )
+{
+ DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
- // apply style on top as they need the children to exist
- ApplyAllStyleProperties( root, node, actor, replacements );
+ OptionalChild styles = IsChild( *mParser.GetRoot(), KEYNAME_STYLES );
+ OptionalChild style = IsChildIgnoreCase( *styles, styleName );
- // then add to parent
- if( parent )
- {
- parent.Add( actor );
- }
- }
- else
- {
- ApplyProperties( root, node, handle, replacements );
- }
- }
- else
- {
- DALI_SCRIPT_WARNING("Cannot create handle from type '%s'\n", typeInfo.GetName().c_str());
- }
+ if( styles && style )
+ {
+ return true;
}
-
- return baseHandle;
+ return false;
}
-void Builder::SetupTask( RenderTask& task, const TreeNode& node, const Replacement& constant )
+const StylePtr Builder::GetStyle( const std::string& styleName )
{
- const Stage& stage = Stage::GetCurrent();
- Layer root = stage.GetRootLayer();
+ const StylePtr* style = mStyles.FindCaseInsensitiveC( styleName );
- if( OptionalString s = constant.IsString( IsChild(node, "sourceActor") ) )
+ if( style==NULL )
{
- Actor actor = root.FindChildByName(*s);
- if(actor)
- {
- task.SetSourceActor( actor );
- }
- else
- {
- DALI_SCRIPT_WARNING("Cannot find source actor on stage for render task called '%s'\n", (*s).c_str() );
- }
+ return StylePtr(NULL);
}
-
- if( OptionalString s = constant.IsString( IsChild(node, "cameraActor") ) )
+ else
{
- CameraActor actor = CameraActor::DownCast( root.FindChildByName(*s) );
- if(actor)
- {
- task.SetCameraActor( actor );
- }
- else
- {
- DALI_SCRIPT_WARNING("Cannot find camera actor on stage for render task called '%s'\n", (*s).c_str() );
- }
+ return *style;
}
+}
- if( OptionalString s = constant.IsString( IsChild(node, "targetFrameBuffer") ) )
- {
- FrameBufferImage fb = GetFrameBufferImage( *s, constant );
- if(fb)
- {
- task.SetTargetFrameBuffer( fb );
- }
- else
- {
- DALI_SCRIPT_WARNING("Cannot find target frame buffer '%s'\n", (*s).c_str() );
- }
- }
+void Builder::AddActors( Actor toActor )
+{
+ // 'stage' is the default/by convention section to add from
+ AddActors( "stage", toActor );
+}
- if( OptionalString s = constant.IsString( IsChild(node, "screenToFrameBufferFunction") ) )
+void Builder::AddActors( const std::string §ionName, Actor toActor )
+{
+ DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
+
+ Property::Map overrideMap;
+ Replacement replacements(overrideMap, mReplacementMap);
+
+ OptionalChild add = IsChild(*mParser.GetRoot(), sectionName);
+
+ if( add )
{
- if("DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION" == *s)
- {
- task.SetScreenToFrameBufferFunction( RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION );
- }
- else if("FULLSCREEN_FRAMEBUFFER_FUNCTION" == *s)
+ for( TreeNode::ConstIterator iter = (*add).CBegin(); iter != (*add).CEnd(); ++iter )
{
- task.SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION );
+ // empty actor adds directly to the stage
+ BaseHandle baseHandle = DoCreate( *mParser.GetRoot(), (*iter).second, Actor(), replacements );
+ Actor actor = Actor::DownCast(baseHandle);
+ if(actor)
+ {
+ toActor.Add( actor );
+ }
}
- else
+
+ // if were adding the 'stage' section then also check for a render task called stage
+ // to add automatically
+ if( "stage" == sectionName )
{
- DALI_SCRIPT_WARNING("todo");
+ if( OptionalChild renderTasks = IsChild(*mParser.GetRoot(), "renderTasks") )
+ {
+ if( OptionalChild tasks = IsChild(*renderTasks, "stage") )
+ {
+ CreateRenderTask( "stage" );
+ }
+ }
}
}
-
- // other setup is via the property system
- SetProperties( node, task, constant );
}
void Builder::CreateRenderTask( const std::string &name )
return ret;
}
+
bool Builder::IsPathConstrainer( const std::string& name )
{
size_t count( mPathConstrainerLut.size() );
mQuitSignal.Emit();
}
-void Builder::AddActors( Actor toActor )
+Builder::~Builder()
{
- // 'stage' is the default/by convention section to add from
- AddActors( "stage", toActor );
}
-void Builder::AddActors( const std::string §ionName, Actor toActor )
+void Builder::LoadConstants( const TreeNode& root, Property::Map& intoMap )
{
- DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
-
- Property::Map overrideMap;
- Replacement replacements(overrideMap, mReplacementMap);
-
- OptionalChild add = IsChild(*mParser.GetRoot(), sectionName);
+ Replacement replacer(intoMap);
- if( add )
+ if( OptionalChild constants = IsChild(root, "constants") )
{
- for( TreeNode::ConstIterator iter = (*add).CBegin(); iter != (*add).CEnd(); ++iter )
- {
- // empty actor adds directly to the stage
- BaseHandle baseHandle = DoCreate( *mParser.GetRoot(), (*iter).second, Actor(), replacements );
- Actor actor = Actor::DownCast(baseHandle);
- if(actor)
- {
- toActor.Add( actor );
- }
- }
-
- // if were adding the 'stage' section then also check for a render task called stage
- // to add automatically
- if( "stage" == sectionName )
+ for(TreeNode::ConstIterator iter = (*constants).CBegin();
+ iter != (*constants).CEnd(); ++iter)
{
- if( OptionalChild renderTasks = IsChild(*mParser.GetRoot(), "renderTasks") )
+ Dali::Property::Value property;
+ if( (*iter).second.GetName() )
{
- if( OptionalChild tasks = IsChild(*renderTasks, "stage") )
- {
- CreateRenderTask( "stage" );
- }
+#if defined(DEBUG_ENABLED)
+ DALI_SCRIPT_VERBOSE("Constant set from json '%s'\n", (*iter).second.GetName());
+#endif
+ DeterminePropertyFromNode( (*iter).second, property, replacer );
+ intoMap[ (*iter).second.GetName() ] = property;
}
}
}
-}
-
-Animation Builder::CreateAnimation( const std::string& animationName, const Replacement& replacement, Dali::Actor sourceActor )
-{
- DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
-
- Animation anim;
- if( OptionalChild animations = IsChild(*mParser.GetRoot(), "animations") )
+#if defined(DEBUG_ENABLED)
+ Property::Value* iter = intoMap.Find( "CONFIG_SCRIPT_LOG_LEVEL" );
+ if( iter && iter->GetType() == Property::STRING )
{
- if( OptionalChild animation = IsChild(*animations, animationName) )
+ std::string logLevel( iter->Get< std::string >() );
+ if( logLevel == "NoLogging" )
{
- anim = Dali::Toolkit::Internal::CreateAnimation( *animation, replacement, sourceActor, this );
+ gFilterScript->SetLogLevel( Integration::Log::NoLogging );
+ }
+ else if( logLevel == "Concise" )
+ {
+ gFilterScript->SetLogLevel( Integration::Log::Concise );
+ }
+ else if( logLevel == "General" )
+ {
+ gFilterScript->SetLogLevel( Integration::Log::General );
+ }
+ else if( logLevel == "Verbose" )
+ {
+ gFilterScript->SetLogLevel( Integration::Log::Verbose );
+ }
+ }
+#endif
+}
+
+Animation Builder::CreateAnimation( const std::string& animationName, const Replacement& replacement, Dali::Actor sourceActor )
+{
+ DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
+
+ Animation anim;
+
+ if( OptionalChild animations = IsChild(*mParser.GetRoot(), "animations") )
+ {
+ if( OptionalChild animation = IsChild(*animations, animationName) )
+ {
+ anim = Dali::Toolkit::Internal::CreateAnimation( *animation, replacement, sourceActor, this );
}
else
{
return anim;
}
-Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor )
+BaseHandle Builder::Create( const std::string& templateName, const Replacement& constant )
{
- Replacement replacement(map, mReplacementMap);
- return CreateAnimation( animationName, replacement, sourceActor);
-}
+ DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
-Animation Builder::CreateAnimation( const std::string& animationName, const Property::Map& map )
-{
- Replacement replacement(map, mReplacementMap);
- return CreateAnimation( animationName, replacement, Stage::GetCurrent().GetRootLayer() );
-}
+ BaseHandle baseHandle;
-Animation Builder::CreateAnimation( const std::string& animationName, Dali::Actor sourceActor )
-{
- Replacement replacement( mReplacementMap );
+ OptionalChild templates = IsChild(*mParser.GetRoot(), KEYNAME_TEMPLATES);
- return CreateAnimation( animationName, replacement, sourceActor );
-}
+ if( !templates )
+ {
+ DALI_SCRIPT_WARNING("No template section found to CreateFromTemplate\n");
+ }
+ else
+ {
+ OptionalChild childTemplate = IsChild(*templates, templateName);
+ if(!childTemplate)
+ {
+ DALI_SCRIPT_WARNING("Template '%s' does not exist in template section\n", templateName.c_str());
+ }
+ else
+ {
+ OptionalString type = constant.IsString( IsChild(*childTemplate, KEYNAME_TYPE) );
-Animation Builder::CreateAnimation( const std::string& animationName )
-{
- Replacement replacement( mReplacementMap );
+ if(!type)
+ {
+ DALI_SCRIPT_WARNING("Cannot create template '%s' as template section is missing 'type'\n", templateName.c_str());
+ }
+ else
+ {
+ baseHandle = DoCreate( *mParser.GetRoot(), *childTemplate, Actor(), constant );
+ }
+ }
+ }
- return CreateAnimation( animationName, replacement, Dali::Stage::GetCurrent().GetRootLayer() );
+ return baseHandle;
}
-bool Builder::ConvertChildValue( const TreeNode& mappingRoot, KeyStack& keyStack, Property::Value& child )
+/*
+ * Create a dali type from a node.
+ * If parent given and an actor type was created then add it to the parent and
+ * recursively add nodes children.
+ */
+BaseHandle Builder::DoCreate( const TreeNode& root, const TreeNode& node,
+ Actor parent, const Replacement& replacements )
{
- bool result = false;
+ BaseHandle baseHandle;
+ TypeInfo typeInfo;
+ const TreeNode* templateNode = NULL;
- switch( child.GetType() )
+ if( OptionalString typeName = IsString(node, KEYNAME_TYPE) )
{
- case Property::STRING:
+ typeInfo = TypeRegistry::Get().GetTypeInfo( *typeName );
+
+ if( !typeInfo )
{
- std::string value;
- if( child.Get( value ) )
+ // a template name is also allowed inplace of the type name
+ OptionalChild templates = IsChild( root, KEYNAME_TEMPLATES);
+
+ if( templates )
{
- std::string key;
- if( GetMappingKey( value, key ) )
+ if( OptionalChild isTemplate = IsChild( *templates, *typeName ) )
{
- // Check key for cycles:
- result=true;
- for( KeyStack::iterator iter = keyStack.begin() ; iter != keyStack.end(); ++iter )
- {
- if( key.compare(*iter) == 0 )
- {
- // key is already in stack; stop.
- DALI_LOG_WARNING("Detected cycle in stylesheet mapping table:%s\n", key.c_str());
- child = Property::Value("");
- result=false;
- break;
- }
- }
+ templateNode = &(*isTemplate);
- if( result )
+ if( OptionalString templateTypeName = IsString(*templateNode, KEYNAME_TYPE) )
{
- // The following call will overwrite the child with the value
- // from the mapping.
- RecursePropertyMap( mappingRoot, keyStack, key.c_str(), Property::NONE, child );
- result = true;
+ typeInfo = TypeRegistry::Get().GetTypeInfo( *templateTypeName );
}
}
}
- break;
}
+ }
- case Property::MAP:
+ if(!typeInfo)
+ {
+ DALI_SCRIPT_WARNING("Cannot create Dali type from node '%s'\n", node.GetName());
+ }
+ else
+ {
+ baseHandle = typeInfo.CreateInstance();
+ Handle handle = Handle::DownCast(baseHandle);
+ Actor actor = Actor::DownCast(handle);
+
+ if(handle)
{
- Property::Map* map = child.GetMap();
- if( map )
+
+ DALI_SCRIPT_VERBOSE("Create:%s\n", typeInfo.GetName().c_str());
+
+#if defined(DEBUG_ENABLED)
+ if(handle)
{
- for( Property::Map::SizeType i=0; i < map->Count(); ++i )
- {
- Property::Value& child = map->GetValue(i);
- ConvertChildValue(mappingRoot, keyStack, child);
- }
+ DALI_SCRIPT_VERBOSE(" Is Handle Object=%d\n", (long*)handle.GetObjectPtr());
+ DALI_SCRIPT_VERBOSE(" Is Handle Property Count=%d\n", handle.GetPropertyCount());
}
- break;
- }
- case Property::ARRAY:
- {
- Property::Array* array = child.GetArray();
- if( array )
+ if(actor)
{
- for( Property::Array::SizeType i=0; i < array->Count(); ++i )
- {
- Property::Value& child = array->GetElementAt(i);
- ConvertChildValue(mappingRoot, keyStack, child);
- }
+ DALI_SCRIPT_VERBOSE(" Is Actor id=%d\n", actor.GetId());
}
- break;
- }
-
- default:
- // Ignore other types.
- break;
- }
- return result;
-}
+ Toolkit::Control control = Toolkit::Control::DownCast(handle);
+ if(control)
+ {
+ DALI_SCRIPT_VERBOSE(" Is Control id=%d\n", actor.GetId());
+ }
+#endif // DEBUG_ENABLED
-bool Builder::RecursePropertyMap( const TreeNode& mappingRoot, KeyStack& keyStack, const char* theKey, Property::Type propertyType, Property::Value& value )
-{
- Replacement replacer( mReplacementMap );
- bool result = false;
+ if( templateNode )
+ {
+ ApplyProperties( root, *templateNode, handle, replacements );
- keyStack.push_back( theKey );
+ if( OptionalChild actors = IsChild( *templateNode, KEYNAME_ACTORS ) )
+ {
+ for( TreeConstIter iter = (*actors).CBegin(); iter != (*actors).CEnd(); ++iter )
+ {
+ DoCreate( root, (*iter).second, actor, replacements );
+ }
+ }
+ }
- for( TreeNode::ConstIterator iter = mappingRoot.CBegin(); iter != mappingRoot.CEnd(); ++iter )
- {
- std::string aKey( (*iter).first );
- if( aKey.compare( theKey ) == 0 )
- {
- if( propertyType == Property::NONE )
+ if( actor )
{
- DeterminePropertyFromNode( (*iter).second, value, replacer );
- result = true;
+ // add children of all the styles
+ if( OptionalChild actors = IsChild( node, KEYNAME_ACTORS ) )
+ {
+ for( TreeConstIter iter = (*actors).CBegin(); iter != (*actors).CEnd(); ++iter )
+ {
+ DoCreate( root, (*iter).second, actor, replacements );
+ }
+ }
+
+ // apply style on top as they need the children to exist
+ ApplyAllStyleProperties( root, node, actor, replacements );
+
+ // then add to parent
+ if( parent )
+ {
+ parent.Add( actor );
+ }
}
else
{
- result = DeterminePropertyFromNode( (*iter).second, propertyType, value, replacer );
- }
-
- if( result )
- {
- ConvertChildValue(mappingRoot, keyStack, value);
+ ApplyProperties( root, node, handle, replacements );
}
- break;
+ }
+ else
+ {
+ DALI_SCRIPT_WARNING("Cannot create handle from type '%s'\n", typeInfo.GetName().c_str());
}
}
- keyStack.pop_back();
-
- return result;
-}
-
-bool Builder::GetPropertyMap( const TreeNode& mappingRoot, const char* theKey, Property::Type propertyType, Property::Value& value )
-{
- KeyStack keyStack;
- return RecursePropertyMap( mappingRoot, keyStack, theKey, propertyType, value );
+ return baseHandle;
}
-
-void Builder::LoadFromString( std::string const& data, Dali::Toolkit::Builder::UIFormat format )
+void Builder::SetupTask( RenderTask& task, const TreeNode& node, const Replacement& constant )
{
- // parser to get constants and includes only
- Dali::Toolkit::JsonParser parser = Dali::Toolkit::JsonParser::New();
+ const Stage& stage = Stage::GetCurrent();
+ Layer root = stage.GetRootLayer();
- if( !parser.Parse( data ) )
+ if( OptionalString s = constant.IsString( IsChild(node, "sourceActor") ) )
{
- DALI_LOG_WARNING( "JSON Parse Error:%d:%d:'%s'\n",
- parser.GetErrorLineNumber(),
- parser.GetErrorColumn(),
- parser.GetErrorDescription().c_str() );
-
- DALI_ASSERT_ALWAYS(!"Cannot parse JSON");
+ Actor actor = root.FindChildByName(*s);
+ if(actor)
+ {
+ task.SetSourceActor( actor );
+ }
+ else
+ {
+ DALI_SCRIPT_WARNING("Cannot find source actor on stage for render task called '%s'\n", (*s).c_str() );
+ }
}
- else
- {
- // load constant map (allows the user to override the constants in the json after loading)
- LoadConstants( *parser.GetRoot(), mReplacementMap );
- // merge includes
- if( OptionalChild includes = IsChild(*parser.GetRoot(), KEYNAME_INCLUDES) )
+ if( OptionalString s = constant.IsString( IsChild(node, "cameraActor") ) )
+ {
+ CameraActor actor = CameraActor::DownCast( root.FindChildByName(*s) );
+ if(actor)
{
- Replacement replacer( mReplacementMap );
-
- for(TreeNode::ConstIterator iter = (*includes).CBegin(); iter != (*includes).CEnd(); ++iter)
- {
- OptionalString filename = replacer.IsString( (*iter).second );
-
- if( filename )
- {
-#if defined(DEBUG_ENABLED)
- DALI_SCRIPT_VERBOSE("Loading Include '%s'\n", (*filename).c_str());
-#endif
- LoadFromString( GetFileContents(*filename) );
- }
- }
+ task.SetCameraActor( actor );
}
-
- if( !mParser.Parse( data ) )
+ else
{
- DALI_LOG_WARNING( "JSON Parse Error:%d:%d:'%s'\n",
- mParser.GetErrorLineNumber(),
- mParser.GetErrorColumn(),
- mParser.GetErrorDescription().c_str() );
+ DALI_SCRIPT_WARNING("Cannot find camera actor on stage for render task called '%s'\n", (*s).c_str() );
+ }
+ }
- DALI_ASSERT_ALWAYS(!"Cannot parse JSON");
+ if( OptionalString s = constant.IsString( IsChild(node, "targetFrameBuffer") ) )
+ {
+ FrameBufferImage fb = GetFrameBufferImage( *s, constant );
+ if(fb)
+ {
+ task.SetTargetFrameBuffer( fb );
+ }
+ else
+ {
+ DALI_SCRIPT_WARNING("Cannot find target frame buffer '%s'\n", (*s).c_str() );
}
}
- DUMP_PARSE_TREE(parser); // This macro only writes out if DEBUG is enabled and the "DUMP_TREE" constant is defined in the stylesheet.
- DUMP_TEST_MAPPINGS(parser);
+ if( OptionalString s = constant.IsString( IsChild(node, "screenToFrameBufferFunction") ) )
+ {
+ if("DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION" == *s)
+ {
+ task.SetScreenToFrameBufferFunction( RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION );
+ }
+ else if("FULLSCREEN_FRAMEBUFFER_FUNCTION" == *s)
+ {
+ task.SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION );
+ }
+ else
+ {
+ DALI_SCRIPT_WARNING("todo");
+ }
+ }
- DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Cannot parse JSON");
+ // other setup is via the property system
+ SetProperties( node, task, constant );
}
-void Builder::AddConstants( const Property::Map& map )
+bool Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement )
{
- mReplacementMap.Merge( map );
-}
+ DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
-void Builder::AddConstant( const std::string& key, const Property::Value& value )
-{
- mReplacementMap[key] = value;
-}
+ OptionalChild styles = IsChild( *mParser.GetRoot(), KEYNAME_STYLES );
-const Property::Map& Builder::GetConstants() const
-{
- return mReplacementMap;
-}
+ std::string styleNameLower(styleName);
+ OptionalChild style = IsChildIgnoreCase( *styles, styleNameLower );
-const Property::Value& Builder::GetConstant( const std::string& key ) const
-{
- Property::Value* match = mReplacementMap.Find( key );
- if( match )
+ if( styles && style )
{
- return (*match);
+ ApplyAllStyleProperties( *mParser.GetRoot(), *style, handle, replacement );
+ return true;
}
else
{
- static Property::Value invalid;
- return invalid;
+ return false;
}
}
-void Builder::LoadConstants( const TreeNode& root, Property::Map& intoMap )
+void Builder::ApplyAllStyleProperties( const TreeNode& root, const TreeNode& node,
+ Dali::Handle& handle, const Replacement& constant )
{
- Replacement replacer(intoMap);
+ const char* styleName = node.GetName();
- if( OptionalChild constants = IsChild(root, "constants") )
+ StylePtr style = Style::New();
+
+ StylePtr* matchedStyle = NULL;
+ if( styleName )
{
- for(TreeNode::ConstIterator iter = (*constants).CBegin();
- iter != (*constants).CEnd(); ++iter)
+ matchedStyle = mStyles.FindCaseInsensitive( styleName );
+ if( ! matchedStyle )
{
- Dali::Property::Value property;
- if( (*iter).second.GetName() )
+ OptionalChild styleNodes = IsChild(root, KEYNAME_STYLES);
+ OptionalChild inheritFromNode = IsChild(node, KEYNAME_INHERIT);
+ if( !inheritFromNode )
+ {
+ inheritFromNode = IsChild( node, KEYNAME_STYLES );
+ }
+
+ if( styleNodes )
{
+ if( inheritFromNode )
+ {
+ TreeNodeList additionalStyleNodes;
+
+ CollectAllStyles( *styleNodes, *inheritFromNode, additionalStyleNodes );
+
#if defined(DEBUG_ENABLED)
- DALI_SCRIPT_VERBOSE("Constant set from json '%s'\n", (*iter).second.GetName());
+ for(TreeNode::ConstIterator iter = (*inheritFromNode).CBegin(); iter != (*inheritFromNode).CEnd(); ++iter)
+ {
+ if( OptionalString styleName = IsString( (*iter).second ) )
+ {
+ DALI_SCRIPT_VERBOSE("Style Applied '%s'\n", (*styleName).c_str());
+ }
+ }
#endif
- DeterminePropertyFromNode( (*iter).second, property, replacer );
- intoMap[ (*iter).second.GetName() ] = property;
+
+ // a style may have other styles, which has other styles etc so we apply in reverse by convention.
+ for(TreeNodeList::reverse_iterator iter = additionalStyleNodes.rbegin(); iter != additionalStyleNodes.rend(); ++iter)
+ {
+ RecordStyle( style, *(*iter), handle, constant );
+ ApplySignals( root, *(*iter), handle );
+ ApplyStylesByActor( root, *(*iter), handle, constant );
+ }
+ }
+
+ RecordStyle( style, node, handle, constant );
+ mStyles.Add( styleName, style ); // shallow copy
+ matchedStyle = &style;
}
}
}
-#if defined(DEBUG_ENABLED)
- Property::Value* iter = intoMap.Find( "CONFIG_SCRIPT_LOG_LEVEL" );
- if( iter && iter->GetType() == Property::STRING )
+ if( matchedStyle )
{
- std::string logLevel( iter->Get< std::string >() );
- if( logLevel == "NoLogging" )
+ StylePtr style( *matchedStyle );
+ style->ApplyVisualsAndPropertiesRecursively( handle ); // (recurses through states)
+ }
+ else // If there were no styles, instead set properties
+ {
+ SetProperties( node, handle, constant );
+ }
+ ApplySignals( root, node, handle );
+ ApplyStylesByActor( root, node, handle, constant );
+}
+
+void Builder::RecordStyle( StylePtr style,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& replacements )
+{
+ // With repeated calls, accumulate inherited states, visuals and properties
+ // but override any with same name
+
+ for( TreeNode::ConstIterator iter = node.CBegin(); iter != node.CEnd(); ++iter )
+ {
+ const TreeNode::KeyNodePair& keyValue = *iter;
+ std::string key( keyValue.first );
+ if( key == KEYNAME_STATES )
{
- gFilterScript->SetLogLevel( Integration::Log::NoLogging );
+ const TreeNode& states = keyValue.second;
+ if( states.GetType() != TreeNode::OBJECT )
+ {
+ DALI_LOG_WARNING( "RecordStyle() Node \"%s\" is not a JSON object\n", key.c_str() );
+ continue;
+ }
+
+ for( TreeNode::ConstIterator iter = states.CBegin(); iter != states.CEnd(); ++iter )
+ {
+ const TreeNode& stateNode = (*iter).second;
+ const char* stateName = stateNode.GetName();
+ if( stateNode.GetType() != TreeNode::OBJECT )
+ {
+ DALI_LOG_WARNING( "RecordStyle() Node \"%s\" is not a JSON object\n", stateName );
+ continue;
+ }
+
+ StylePtr* stylePtr = style->subStates.FindCaseInsensitive( stateName );
+ if( stylePtr )
+ {
+ StylePtr style(*stylePtr);
+ RecordStyle( style, stateNode, handle, replacements );
+ }
+ else
+ {
+ StylePtr subState = Style::New();
+ RecordStyle( subState, stateNode, handle, replacements );
+ style->subStates.Add( stateName, subState );
+ }
+ }
}
- else if( logLevel == "Concise" )
+ else if( key == KEYNAME_VISUALS )
{
- gFilterScript->SetLogLevel( Integration::Log::Concise );
+ for( TreeNode::ConstIterator iter = keyValue.second.CBegin(); iter != keyValue.second.CEnd(); ++iter )
+ {
+ // Each key in this table should be a property name matching a visual.
+ const TreeNode::KeyNodePair& visual = *iter;
+ Dali::Property::Value property(Property::MAP);
+ if( DeterminePropertyFromNode( visual.second, Property::MAP, property, replacements ) )
+ {
+ Property::Map* mapPtr = style->visuals.FindCaseInsensitive( visual.first );
+ if( mapPtr )
+ {
+ // Override existing visuals
+ mapPtr->Clear();
+ mapPtr->Merge(*property.GetMap());
+ }
+ else
+ {
+ style->visuals.Add(visual.first, *property.GetMap());
+ }
+ }
+ }
}
- else if( logLevel == "General" )
+ else if( key == KEYNAME_ENTRY_TRANSITION )
{
- gFilterScript->SetLogLevel( Integration::Log::General );
+ Dali::Property::Value property(Property::MAP);
+ if( DeterminePropertyFromNode( keyValue.second, Property::MAP, property, replacements ) )
+ {
+ style->entryTransition = Toolkit::TransitionData::New( *property.GetMap() );
+ }
}
- else if( logLevel == "Verbose" )
+ else if( key == KEYNAME_EXIT_TRANSITION )
{
- gFilterScript->SetLogLevel( Integration::Log::Verbose );
+ Dali::Property::Value property(Property::MAP);
+ if( DeterminePropertyFromNode( keyValue.second, Property::MAP, property, replacements ) )
+ {
+ style->exitTransition = Toolkit::TransitionData::New( *property.GetMap() );
+ }
+ }
+ else if( key == KEYNAME_TRANSITIONS )
+ {
+ //@todo add new transitions to style.transitions
+ // override existing transitions. A transition matches on target & property name
+ const TreeNode& node = keyValue.second;
+ if( node.GetType() == TreeNode::ARRAY )
+ {
+ Dali::Property::Value property(Property::ARRAY);
+ if( DeterminePropertyFromNode( node, Property::ARRAY, property, replacements ) )
+ {
+ style->transitions = *property.GetArray();
+ }
+ }
+ else if( node.GetType() == TreeNode::OBJECT )
+ {
+ Dali::Property::Value property(Property::MAP);
+ if( DeterminePropertyFromNode( node, Property::MAP, property, replacements ) )
+ {
+ Property::Array propertyArray;
+ propertyArray.Add( property );
+ style->transitions = propertyArray;
+ }
+ }
+ else
+ {
+ DALI_LOG_WARNING( "RecordStyle() Node \"%s\" is not a JSON array or object\n", key.c_str() );
+ }
+ }
+ else if( key == KEYNAME_TYPE ||
+ key == KEYNAME_ACTORS ||
+ key == KEYNAME_SIGNALS ||
+ key == KEYNAME_STYLES ||
+ key == KEYNAME_MAPPINGS ||
+ key == KEYNAME_INHERIT )
+ {
+ continue;
+ }
+ else // It's a property
+ {
+ Property::Index index;
+ Property::Value value;
+ if( MapToTargetProperty( handle, key, keyValue.second, replacements, index, value ) )
+ {
+ Property::Value* existingValuePtr = style->properties.Find( index );
+ if( existingValuePtr != NULL )
+ {
+ *existingValuePtr = value; // Overwrite existing property.
+ }
+ else
+ {
+ style->properties.Add( index, value );
+ }
+ }
}
}
-#endif
+}
+// Set properties from node on handle.
+void Builder::ApplyProperties( const TreeNode& root, const TreeNode& node,
+ Dali::Handle& handle, const Replacement& constant )
+{
+ SetProperties( node, handle, constant );
+ ApplySignals( root, node, handle );
}
-bool Builder::ApplyStyle( const std::string& styleName, Handle& handle )
+void Builder::ApplySignals(const TreeNode& root, const TreeNode& node, Dali::Handle& handle )
{
- Replacement replacer( mReplacementMap );
- return ApplyStyle( styleName, handle, replacer );
+ Actor actor = Actor::DownCast(handle);
+ if( actor )
+ {
+ // add signals
+ SetupSignalAction( mSlotDelegate.GetConnectionTracker(), root, node, actor, this );
+ SetupPropertyNotification( mSlotDelegate.GetConnectionTracker(), root, node, actor, this );
+ }
}
-bool Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement )
+
+// Appling by style helper
+// use FindChildByName() to apply properties referenced in KEYNAME_ACTORS in the node
+void Builder::ApplyStylesByActor( const TreeNode& root, const TreeNode& node,
+ Dali::Handle& handle, const Replacement& constant )
{
- DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
+ if( Dali::Actor actor = Dali::Actor::DownCast( handle ) )
+ {
+ if( const TreeNode* actors = node.GetChild( KEYNAME_ACTORS ) )
+ {
+ // in a style the actor subtree properties referenced by actor name
+ for( TreeConstIter iter = actors->CBegin(); iter != actors->CEnd(); ++iter )
+ {
+ Dali::Actor foundActor;
- OptionalChild styles = IsChild( *mParser.GetRoot(), KEYNAME_STYLES );
+ if( (*iter).first )
+ {
+ foundActor = actor.FindChildByName( (*iter).first );
+ }
- std::string styleNameLower(styleName);
- OptionalChild style = IsChildIgnoreCase( *styles, styleNameLower );
+ if( !foundActor )
+ {
+ DALI_SCRIPT_VERBOSE("Cannot find actor in style application '%s'\n", (*iter).first);
+ }
+ else
+ {
+ DALI_SCRIPT_VERBOSE("Styles applied to actor '%s'\n", (*iter).first);
+ ApplyProperties( root, (*iter).second, foundActor, constant );
+ }
+ }
+ }
+ }
+}
- if( styles && style )
+/*
+ * Sets the handle properties found in the tree node
+ */
+void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replacement& constant )
+{
+ if( handle )
{
- ApplyAllStyleProperties( *mParser.GetRoot(), *style, handle, replacement );
- return true;
+ for( TreeNode::ConstIterator iter = node.CBegin(); iter != node.CEnd(); ++iter )
+ {
+ const TreeNode::KeyNodePair& keyChild = *iter;
+
+ std::string key( keyChild.first );
+
+ // ignore special fields;
+ if( key == KEYNAME_TYPE ||
+ key == KEYNAME_ACTORS ||
+ key == KEYNAME_SIGNALS ||
+ key == KEYNAME_STYLES ||
+ key == KEYNAME_MAPPINGS ||
+ key == KEYNAME_INHERIT ||
+ key == KEYNAME_STATES ||
+ key == KEYNAME_VISUALS ||
+ key == KEYNAME_ENTRY_TRANSITION ||
+ key == KEYNAME_EXIT_TRANSITION ||
+ key == KEYNAME_TRANSITIONS )
+ {
+ continue;
+ }
+
+ Property::Index index;
+ Property::Value value;
+
+ bool mapped = MapToTargetProperty( handle, key, keyChild.second, constant, index, value );
+ if( mapped )
+ {
+ DALI_SCRIPT_VERBOSE("SetProperty '%s' Index=:%d Value Type=%d Value '%s'\n", key.c_str(), index, value.GetType(), PropertyValueToString(value).c_str() );
+
+ handle.SetProperty( index, value );
+ }
+
+ // Add custom properties
+ SetCustomProperties(node, handle, constant, PROPERTIES, Property::READ_WRITE);
+ SetCustomProperties(node, handle, constant, ANIMATABLE_PROPERTIES, Property::ANIMATABLE);
+
+ } // for property nodes
}
else
{
- return false;
+ DALI_SCRIPT_WARNING("Style applied to empty handle\n");
}
}
-BaseHandle Builder::Create( const std::string& templateName, const Property::Map& map )
+bool Builder::MapToTargetProperty(
+ Handle& propertyObject,
+ const std::string& key,
+ const TreeNode& node,
+ const Replacement& constant,
+ Property::Index& index,
+ Property::Value& value )
{
- Replacement replacement( map, mReplacementMap );
- return Create( templateName, replacement );
+ bool mapped = false;
+
+ index = propertyObject.GetPropertyIndex( key );
+ if( Property::INVALID_INDEX != index )
+ {
+ Property::Type type = propertyObject.GetPropertyType(index);
+
+ // if node.value is a mapping, get the property value from the "mappings" table
+ if( node.GetType() == TreeNode::STRING )
+ {
+ std::string mappingKey;
+ if( GetMappingKey( node.GetString(), mappingKey) )
+ {
+ OptionalChild mappingRoot = IsChild( mParser.GetRoot(), KEYNAME_MAPPINGS );
+ mapped = GetPropertyMap( *mappingRoot, mappingKey.c_str(), type, value );
+ }
+ }
+ if( ! mapped )
+ {
+ mapped = DeterminePropertyFromNode( node, type, value, constant );
+ if( ! mapped )
+ {
+ // Just determine the property from the node and if it's valid, let the property object handle it
+ DeterminePropertyFromNode( node, value, constant );
+ mapped = ( value.GetType() != Property::NONE );
+ }
+ }
+ }
+ else
+ {
+ DALI_LOG_ERROR("Key '%s' not found.\n", key.c_str());
+ }
+ return mapped;
}
-BaseHandle Builder::Create( const std::string& templateName, const Replacement& constant )
+bool Builder::GetPropertyMap( const TreeNode& mappingRoot, const char* theKey, Property::Type propertyType, Property::Value& value )
{
- DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
+ KeyStack keyStack;
+ return RecursePropertyMap( mappingRoot, keyStack, theKey, propertyType, value );
+}
- BaseHandle baseHandle;
+bool Builder::RecursePropertyMap( const TreeNode& mappingRoot, KeyStack& keyStack, const char* theKey, Property::Type propertyType, Property::Value& value )
+{
+ Replacement replacer( mReplacementMap );
+ bool result = false;
- OptionalChild templates = IsChild(*mParser.GetRoot(), KEYNAME_TEMPLATES);
+ keyStack.push_back( theKey );
- if( !templates )
- {
- DALI_SCRIPT_WARNING("No template section found to CreateFromTemplate\n");
- }
- else
+ for( TreeNode::ConstIterator iter = mappingRoot.CBegin(); iter != mappingRoot.CEnd(); ++iter )
{
- OptionalChild childTemplate = IsChild(*templates, templateName);
- if(!childTemplate)
- {
- DALI_SCRIPT_WARNING("Template '%s' does not exist in template section\n", templateName.c_str());
- }
- else
+ std::string aKey( (*iter).first );
+ if( aKey.compare( theKey ) == 0 )
{
- OptionalString type = constant.IsString( IsChild(*childTemplate, KEYNAME_TYPE) );
-
- if(!type)
+ if( propertyType == Property::NONE )
{
- DALI_SCRIPT_WARNING("Cannot create template '%s' as template section is missing 'type'\n", templateName.c_str());
+ DeterminePropertyFromNode( (*iter).second, value, replacer );
+ result = true;
}
else
{
- baseHandle = DoCreate( *mParser.GetRoot(), *childTemplate, Actor(), constant );
+ result = DeterminePropertyFromNode( (*iter).second, propertyType, value, replacer );
+ }
+
+ if( result )
+ {
+ ConvertChildValue(mappingRoot, keyStack, value);
}
+ break;
}
}
+ keyStack.pop_back();
- return baseHandle;
+ return result;
}
-BaseHandle Builder::CreateFromJson( const std::string& json )
+bool Builder::ConvertChildValue( const TreeNode& mappingRoot, KeyStack& keyStack, Property::Value& child )
{
- BaseHandle ret;
-
- // merge in new template, hoping no one else has one named '@temp@'
- std::string newTemplate =
- std::string("{\"templates\":{\"@temp@\":") + \
- json + \
- std::string("}}");
+ bool result = false;
- if( mParser.Parse(newTemplate) )
+ switch( child.GetType() )
{
- Replacement replacement( mReplacementMap );
- ret = Create( "@temp@", replacement );
- }
+ case Property::STRING:
+ {
+ std::string value;
+ if( child.Get( value ) )
+ {
+ std::string key;
+ if( GetMappingKey( value, key ) )
+ {
+ // Check key for cycles:
+ result=true;
+ for( KeyStack::iterator iter = keyStack.begin() ; iter != keyStack.end(); ++iter )
+ {
+ if( key.compare(*iter) == 0 )
+ {
+ // key is already in stack; stop.
+ DALI_LOG_WARNING("Detected cycle in stylesheet mapping table:%s\n", key.c_str());
+ child = Property::Value("");
+ result=false;
+ break;
+ }
+ }
- return ret;
-}
+ if( result )
+ {
+ // The following call will overwrite the child with the value
+ // from the mapping.
+ RecursePropertyMap( mappingRoot, keyStack, key.c_str(), Property::NONE, child );
+ result = true;
+ }
+ }
+ }
+ break;
+ }
-bool Builder::ApplyFromJson( Handle& handle, const std::string& json )
-{
- bool ret = false;
+ case Property::MAP:
+ {
+ Property::Map* map = child.GetMap();
+ if( map )
+ {
+ for( Property::Map::SizeType i=0; i < map->Count(); ++i )
+ {
+ Property::Value& child = map->GetValue(i);
+ ConvertChildValue(mappingRoot, keyStack, child);
+ }
+ }
+ break;
+ }
- // merge new style, hoping no one else has one named '@temp@'
- std::string newStyle =
- std::string("{\"styles\":{\"@temp@\":") + \
- json + \
- std::string("}}");
+ case Property::ARRAY:
+ {
+ Property::Array* array = child.GetArray();
+ if( array )
+ {
+ for( Property::Array::SizeType i=0; i < array->Count(); ++i )
+ {
+ Property::Value& child = array->GetElementAt(i);
+ ConvertChildValue(mappingRoot, keyStack, child);
+ }
+ }
+ break;
+ }
- if( mParser.Parse(newStyle) )
- {
- Replacement replacement( mReplacementMap );
- ret = ApplyStyle( "@temp@", handle, replacement );
+ default:
+ // Ignore other types.
+ break;
}
- return ret;
-}
-
-
-BaseHandle Builder::Create( const std::string& templateName )
-{
- Replacement replacement( mReplacementMap );
- return Create( templateName, replacement );
+ return result;
}
-Builder::Builder()
-: mSlotDelegate( this )
+void Builder::SetCustomProperties( const TreeNode& node, Handle& handle, const Replacement& constant,
+ const std::string& childName, Property::AccessMode accessMode )
{
- mParser = Dali::Toolkit::JsonParser::New();
-
- Property::Map defaultDirs;
- defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR;
- defaultDirs[ TOKEN_STRING(DALI_SOUND_DIR) ] = DALI_SOUND_DIR;
- defaultDirs[ TOKEN_STRING(DALI_STYLE_DIR) ] = DALI_STYLE_DIR;
- defaultDirs[ TOKEN_STRING(DALI_STYLE_IMAGE_DIR) ] = DALI_STYLE_IMAGE_DIR;
+ // Add custom properties
+ if( OptionalChild customPropertiesChild = IsChild(node, childName) )
+ {
+ const TreeNode& customPropertiesNode = *customPropertiesChild;
+ const TreeConstIter endIter = customPropertiesNode.CEnd();
+ for( TreeConstIter iter = customPropertiesNode.CBegin(); endIter != iter; ++iter )
+ {
+ const TreeNode::KeyNodePair& keyChild = *iter;
+ std::string key( keyChild.first );
+ Property::Value value;
+ DeterminePropertyFromNode( keyChild.second, value, constant );
- AddConstants( defaultDirs );
+ // Register/Set property.
+ handle.RegisterProperty( key, value, accessMode );
+ }
+ }
}
-Builder::~Builder()
-{
-}
} // namespace Internal
#include <dali-toolkit/devel-api/builder/json-parser.h>
#include <dali-toolkit/devel-api/builder/builder.h>
#include <dali-toolkit/internal/builder/builder-declarations.h>
+#include <dali-toolkit/internal/builder/style.h>
// Warning messages usually displayed
#define DALI_SCRIPT_WARNING(format, args...) \
bool ApplyStyle( const std::string& styleName, Handle& handle );
/**
+ * Lookup the stylename in builder. If it's found in the parse tree,
+ * then return true.
+ * @param[in] styleName The style name to search for
+ * @return true if the stylename exists
+ */
+ bool LookupStyleName( const std::string& styleName );
+
+ /**
+ * Lookup the stylename in the recorded Styles - if it exists,
+ * performs a shallow copy to the passed in style and returns true.
+ * Otherwise it returns false.
+
+ * @param[in] styleName The stylename to search for
+ * @return A const pointer to the style object
+ */
+ const StylePtr GetStyle( const std::string& styleName );
+
+ /**
* @copydoc Toolkit::Builder::AddActors
*/
void AddActors( Actor toActor );
*/
void EmitQuitSignal();
+
protected:
virtual ~Builder();
private:
- // Undefined
- Builder(const Builder&);
- Builder& operator=(const Builder& rhs);
-
- void SetupTask( RenderTask& task, const Toolkit::TreeNode& node, const Replacement& replacement );
-
- void SetCustomProperties( const TreeNode& node, Handle& handle, const Replacement& constant, const std::string& childName, Property::AccessMode accessMode );
-
-private:
- Toolkit::JsonParser mParser;
-
- typedef std::map<const std::string, FrameBufferImage> ImageLut;
- ImageLut mFrameBufferImageLut;
-
- typedef std::map<const std::string, Path> PathLut;
- PathLut mPathLut;
-
- typedef struct{ std::string name; Dali::PathConstrainer pathConstrainer; } PathConstrainerEntry;
- typedef std::vector<PathConstrainerEntry> PathConstrainerLut;
- PathConstrainerLut mPathConstrainerLut;
-
+ typedef std::vector<const char*> KeyStack;
+ typedef std::vector< TreeNode::KeyNodePair > MappingsLut;
typedef struct{ std::string name; Dali::LinearConstrainer linearConstrainer; } LinearConstrainerEntry;
typedef std::vector<LinearConstrainerEntry> LinearConstrainerLut;
- LinearConstrainerLut mLinearConstrainerLut;
-
- SlotDelegate<Builder> mSlotDelegate;
-
- Property::Map mReplacementMap;
-
- typedef std::vector< TreeNode::KeyNodePair > MappingsLut;
- MappingsLut mCompleteMappings;
+ typedef struct{ std::string name; Dali::PathConstrainer pathConstrainer; } PathConstrainerEntry;
+ typedef std::vector<PathConstrainerEntry> PathConstrainerLut;
+ typedef std::map<const std::string, Path> PathLut;
+ typedef std::map<const std::string, FrameBufferImage> ImageLut;
- BaseHandle Create( const std::string& templateName, const Replacement& constant );
+private:
+ // Undefined
+ Builder(const Builder&);
- BaseHandle DoCreate( const TreeNode& root, const TreeNode& node, Actor parent, const Replacement& replacements );
+ // Undefined
+ Builder& operator=(const Builder& rhs);
void LoadConstants( const TreeNode& root, Property::Map& intoMap );
- void LoadIncludes( const std::string& data );
-
- bool ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement);
-
- Animation CreateAnimation( const std::string& animationName, const Replacement& replacement, Dali::Actor sourceActor );
-
- typedef std::vector<const char*> KeyStack;
+ Animation CreateAnimation( const std::string& animationName,
+ const Replacement& replacement,
+ Dali::Actor sourceActor );
+
+ BaseHandle Create( const std::string& templateName,
+ const Replacement& constant );
+
+ BaseHandle DoCreate( const TreeNode& root,
+ const TreeNode& node,
+ Actor parent,
+ const Replacement& replacements );
+
+ void SetupTask( RenderTask& task,
+ const Toolkit::TreeNode& node,
+ const Replacement& replacement );
+
+ bool ApplyStyle( const std::string& styleName,
+ Handle& handle,
+ const Replacement& replacement);
+
+ void ApplyAllStyleProperties( const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& constant );
+
+ void RecordStyles( const char* styleName,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& replacements );
+
+ void RecordStyle( StylePtr style,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& replacements );
+
+ void ApplyProperties( const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& constant );
+
+ void ApplySignals( const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle );
+
+ void ApplyStylesByActor( const TreeNode& root,
+ const TreeNode& node,
+ Dali::Handle& handle,
+ const Replacement& constant );
+
+ void SetProperties( const TreeNode& node,
+ Handle& handle,
+ const Replacement& constant );
+
+ bool MapToTargetProperty( Handle& propertyObject,
+ const std::string& key,
+ const TreeNode& node,
+ const Replacement& constant,
+ Property::Index& index,
+ Property::Value& value );
/**
- * Tests if the value is a string delimited by <>. If it is, then it attempts to
- * change the value to the mapping from a matching key in the mappings table.
+ * Find the key in the mapping table, if it's present, then generate
+ * a property value for it (of the given type if available),
+ * recursing as necessary, and stopping if any cycles are detected.
+ *
* @param[in] mappingRoot The JSON node containing the mappings
- * @param[in,out] keyStack the stack of visited keys
+ * @param[in] theKey The key to search for
+ * @param[in] propertyType The property type if known, or NONE
* @param[in,out] value The string value to test and write back to.
- * @return true if the value was converted, false otherwise.
*/
- bool ConvertChildValue( const TreeNode& mappingRoot, KeyStack& keyStack, Property::Value& value );
+ bool GetPropertyMap( const TreeNode& mappingRoot,
+ const char* theKey,
+ Property::Type propertyType,
+ Property::Value& value );
+
+ void SetCustomProperties( const TreeNode& node,
+ Handle& handle,
+ const Replacement& constant,
+ const std::string& childName,
+ Property::AccessMode accessMode );
/**
- * Find the key in the mapping table, if it's present, then generate a property value for it (of the given type if available), recursing as necessary, and stopping if any cycles
- * are detected.
+ * Find the key in the mapping table, if it's present, then generate
+ * a property value for it (of the given type if available),
+ * recursing as necessary, and stopping if any cycles are detected.
+ *
* @param[in] mappingRoot The JSON node containing the mappings
* @param[in] theKey The key to search for
* @param[in,out] keyStack the stack of visited keys
* @param[in] propertyType The property type if known, or NONE
* @param[in,out] value The string value to test and write back to.
*/
- bool RecursePropertyMap( const TreeNode& mappingRoot, KeyStack& keyStack, const char* theKey, Property::Type propertyType, Property::Value& value );
+ bool RecursePropertyMap( const TreeNode& mappingRoot,
+ KeyStack& keyStack,
+ const char* theKey,
+ Property::Type propertyType,
+ Property::Value& value );
+
/**
- * Find the key in the mapping table, if it's present, then generate a property value for it (of the given type if available), recursing as necessary, and stopping if any cycles
- * are detected.
+ * Tests if the value is a string delimited by <>. If it is, then it attempts to
+ * change the value to the mapping from a matching key in the mappings table.
* @param[in] mappingRoot The JSON node containing the mappings
- * @param[in] theKey The key to search for
- * @param[in] propertyType The property type if known, or NONE
+ * @param[in,out] keyStack the stack of visited keys
* @param[in,out] value The string value to test and write back to.
+ * @return true if the value was converted, false otherwise.
*/
- bool GetPropertyMap( const TreeNode& mappingRoot, const char* theKey, Property::Type propertyType, Property::Value& value );
-
- void ApplyProperties( const TreeNode& root, const TreeNode& node,
- Dali::Handle& handle, const Replacement& constant );
-
- void ApplyStylesByActor( const TreeNode& root, const TreeNode& node,
- Dali::Handle& handle, const Replacement& constant );
-
- void ApplyAllStyleProperties( const TreeNode& root, const TreeNode& node,
- Dali::Handle& handle, const Replacement& constant );
-
- void SetProperties( const TreeNode& node, Handle& handle, const Replacement& constant );
+ bool ConvertChildValue( const TreeNode& mappingRoot,
+ KeyStack& keyStack,
+ Property::Value& value );
+private:
+ Toolkit::JsonParser mParser;
+ ImageLut mFrameBufferImageLut;
+ PathLut mPathLut;
+ PathConstrainerLut mPathConstrainerLut;
+ LinearConstrainerLut mLinearConstrainerLut;
+ SlotDelegate<Builder> mSlotDelegate;
+ Property::Map mReplacementMap;
+ MappingsLut mCompleteMappings;
+ Dictionary<StylePtr> mStyles; // State based styles
Toolkit::Builder::BuilderSignalType mQuitSignal;
};
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H
+#define DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H
+
+/*
+ * 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.
+ * 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.
+ */
+
+#include <dali/public-api/common/vector-wrapper.h>
+#include <algorithm>
+
+namespace Dali
+{
+extern bool CaseInsensitiveStringCompare( const std::string& a, const std::string& b );
+
+namespace Toolkit
+{
+namespace Internal
+{
+
+/**
+ * The Dictionary template class enables a means of storing key-value
+ * pairs where the keys are strings and the value can be a complex
+ * type.
+ *
+ * It enables lookup of keys via case-insensitive match.
+ */
+template<typename EntryType>
+class Dictionary
+{
+private:
+ /**
+ * Element is a key-value pair
+ */
+ struct Element
+ {
+ std::string key;
+ EntryType entry;
+ Element( const std::string&name, EntryType entry )
+ : key( name ),
+ entry( entry )
+ {
+ }
+ };
+ typedef std::vector<Element> Elements;
+ Elements container;
+
+public:
+ /**
+ * Only allow const iteration over the dictionary
+ */
+ typedef typename Elements::const_iterator iterator;
+
+
+ /**
+ * Constructor
+ */
+ Dictionary<EntryType>()
+ {
+ }
+
+ /**
+ * Add a key value pair to the dictionary.
+ * If the entry does not already exist, add it to the dictionary
+ * using a shallow copy
+ */
+ bool Add( const std::string& name, const EntryType& entry )
+ {
+ for( typename Elements::iterator iter = container.begin(); iter != container.end(); ++iter )
+ {
+ if( iter->key == name )
+ {
+ return false;
+ }
+ }
+ container.push_back( Element(name, entry) );
+ return true;
+ }
+
+ /**
+ * Add a key-value pair to the dictionary
+ * If the entry does not already exist, add it to the dictionary
+ * (shallow copy)
+ */
+ bool Add( const char* name, const EntryType& entry )
+ {
+ bool result=false;
+ if( name != NULL )
+ {
+ std::string theName(name);
+ result=Add(theName, entry);
+ }
+ return result;
+ }
+
+ /**
+ * Find the element in the dictionary pointed at by key, and
+ * return a pointer to it, or NULL.
+ */
+ EntryType* Find( const std::string& key ) const
+ {
+ EntryType* result=NULL;
+
+ if( ! key.empty() )
+ {
+ for( typename Elements::iterator iter = container.begin(); iter != container.end(); ++iter )
+ {
+ if( iter->key == key )
+ {
+ result = &(iter->entry);
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Find the element in the dictionary pointed at by key, and
+ * return a pointer to it, or NULL
+ */
+ EntryType* Find( const char* key ) const
+ {
+ if( key != NULL )
+ {
+ std::string theKey(key);
+ return Find(theKey);
+ }
+ return NULL;
+ }
+
+ /**
+ * Find the element in the dictionary pointed at by key using a case
+ * insensitive search, and return a const pointer to it, or NULL
+ */
+ const EntryType* FindCaseInsensitiveC( const std::string& key ) const
+ {
+ if( ! key.empty() )
+ {
+ for( typename Elements::const_iterator iter = container.begin(); iter != container.end(); ++iter )
+ {
+ if( Dali::CaseInsensitiveStringCompare(iter->key, key ))
+ {
+ const EntryType* result = &(iter->entry);
+ return result;
+ }
+ }
+ }
+ return NULL;
+ }
+
+ /**
+ * Find the element in the dictionary pointed at by key using a case
+ * insensitive search, and return a non-const pointer to it, or NULL
+ */
+ EntryType* FindCaseInsensitive( const std::string& key ) const
+ {
+ EntryType* result = NULL;
+ if( ! key.empty() )
+ {
+ for( typename Elements::const_iterator iter = container.begin(); iter != container.end(); ++iter )
+ {
+ if( Dali::CaseInsensitiveStringCompare(iter->key, key ))
+ {
+ // Const cast because of const_iterator. const_iterator because, STL.
+ result = const_cast<EntryType*>(&(iter->entry));
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Find the element in the dictionary pointed at by key using a case
+ * insensitive search, and return a const pointer to it, or NULL
+ */
+ const EntryType* FindCaseInsensitiveC( const char* key ) const
+ {
+ if( key != NULL )
+ {
+ std::string theKey(key);
+ return FindCaseInsensitiveC( theKey );
+ }
+ return NULL;
+ }
+
+ /**
+ * Find the element in the dictionary pointed at by key using a case
+ * insensitive search, and return a non-const pointer to it, or NULL
+ */
+ EntryType* FindCaseInsensitive( const char* key ) const
+ {
+ if( key != NULL )
+ {
+ std::string theKey(key);
+ return FindCaseInsensitive( theKey );
+ }
+ return NULL;
+ }
+
+ /**
+ * Return an iterator pointing at the first entry in the dictionary
+ */
+ typename Elements::const_iterator Begin() const
+ {
+ return container.begin();
+ }
+
+ /**
+ * Return an iterator pointing past the last entry in the dictionary
+ */
+ typename Elements::const_iterator End() const
+ {
+ return container.end();
+ }
+};
+
+
+
+}//Internal
+}//Toolkit
+}//Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_BUILDER_DICTIONARY_H
--- /dev/null
+/*
+ * 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.
+ * 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.
+ */
+
+#include <dali/public-api/object/handle.h>
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/internal/builder/style.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+
+StylePtr Style::New()
+{
+ StylePtr stylePtr( new Style() );
+ return stylePtr;
+}
+
+void Style::ApplyVisualsAndPropertiesRecursively( Handle handle ) const
+{
+ ApplyVisuals( handle );
+ ApplyProperties( handle );
+
+ Toolkit::Control control = Toolkit::Control::DownCast(handle);
+ if( control )
+ {
+ Property::Value value = control.GetProperty(DevelControl::Property::STATE);
+ std::string stateName;
+ if( value.Get( stateName ) )
+ {
+ // Look up state in states table:
+ const StylePtr* stylePtr = subStates.FindCaseInsensitiveC( stateName );
+ if( stylePtr )
+ {
+ const StylePtr statePtr(*stylePtr);
+
+ // We have a state match.
+ statePtr->ApplyVisuals( handle );
+ statePtr->ApplyProperties( handle );
+
+ // Apply substate visuals
+ Property::Value value = control.GetProperty(DevelControl::Property::SUB_STATE);
+ std::string subStateName;
+ if( value.Get( subStateName ) && ! subStateName.empty() )
+ {
+ const StylePtr* stylePtr = statePtr->subStates.FindCaseInsensitiveC( subStateName );
+ if( stylePtr )
+ {
+ const StylePtr subStatePtr(*stylePtr);
+ // We have a sub-state match.
+ subStatePtr->ApplyVisuals( handle );
+ subStatePtr->ApplyProperties( handle );
+ }
+ }
+ }
+ }
+ }
+}
+
+void Style::ApplyVisuals( Handle handle ) const
+{
+ for( Dictionary<Property::Map>::iterator iter = visuals.Begin(); iter != visuals.End() ; ++iter )
+ {
+ const std::string& visualName = (*iter).key;
+ const Property::Map& map = (*iter).entry;
+ Dali::Property::Index index = handle.GetPropertyIndex( visualName );
+ if( index != Property::INVALID_INDEX )
+ {
+ const Property::Value value(const_cast<Property::Map&>(map));
+ handle.SetProperty( index, value );
+ }
+ }
+}
+
+void Style::ApplyProperties( Handle handle ) const
+{
+ for( Property::Map::SizeType i=0; i<properties.Count(); ++i )
+ {
+ KeyValuePair keyValue = properties.GetKeyValue( i );
+ if( keyValue.first.type == Property::Key::INDEX )
+ {
+ handle.SetProperty( keyValue.first.indexKey, keyValue.second );
+ }
+ }
+}
+
+Style::Style()
+{
+}
+
+Style::~Style()
+{
+}
+
+
+} // Internal
+} // Toolkit
+} // Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
+#define DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
+
+/*
+ * 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.
+ * 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.
+ */
+
+#include <dali/public-api/object/ref-object.h>
+#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+#include <dali-toolkit/internal/builder/dictionary.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+
+class Style;
+typedef IntrusivePtr<Style> StylePtr;
+
+/**
+ * This class encapsulates the style information for a given styled
+ * control. It is generated only when a control instance looks up
+ * it's style information for the first time, and then stored by
+ * Builder.
+ *
+ * It contains the visual, property and transition definitions for the
+ * main control and for each state and sub-state within the control.
+ *
+ * It has methods to enable the base control to apply visuals and
+ * properties per state.
+ */
+class Style : public RefObject
+{
+public:
+ static StylePtr New();
+
+public:
+ /**
+ * Apply the visuals and properties for the current state/substate
+ * of the handle to the control pointed at by handle. Recurses
+ * through sub-states.
+ *
+ * @param[in] handle The handle to apply the visuals to
+ */
+ void ApplyVisualsAndPropertiesRecursively( Handle handle ) const;
+
+
+private:
+ /**
+ * Apply the visuals of the style to the control pointed at by
+ * handle.
+ *
+ * @param[in] handle The handle to apply the visuals to
+ */
+ void ApplyVisuals( Handle handle ) const;
+
+ /**
+ * Apply the properties of the style to the control pointed at by
+ * handle.
+ *
+ * @param[in] handle The handle to apply the properties to
+ */
+ void ApplyProperties( Handle handle ) const;
+
+protected:
+ /**
+ * @brief Default constructor.
+ */
+ Style();
+
+ /**
+ * @brief virtual destructor.
+ */
+ virtual ~Style();
+
+private:
+ // Not implemented
+ DALI_INTERNAL Style( const Style& rhs );
+
+ // Not implemented
+ DALI_INTERNAL Style& operator=(const Style& rhs);
+
+public:
+ // Everything must be shallow-copiable.
+ Dictionary<StylePtr> subStates; // Each named style maps to a state.
+ Dictionary<Property::Map> visuals;
+ Property::Map properties;
+ Property::Array transitions;
+ Toolkit::TransitionData entryTransition;
+ Toolkit::TransitionData exitTransition;
+};
+
+} // Internal
+} // Toolkit
+} // Dali
+
+
+#endif //DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
indicator.SetParentOrigin( ParentOrigin::TOP_LEFT );
indicator.SetAnchorPoint( AnchorPoint::TOP_LEFT );
indicator.SetStyleName( "ScrollBarIndicator" );
+ indicator.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
SetScrollIndicator(indicator);
}
}
mIndicator = indicator;
- Toolkit::Control control = Toolkit::Control::DownCast( mIndicator );
- if( control )
- {
- control.SetStyleName( "ScrollBarIndicator" );
- }
-
mIndicatorFirstShow = true;
Self().Add( mIndicator );
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
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 )
+ {
+ Toolkit::ImageView indicator = Toolkit::ImageView::New();
+ indicator.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ indicator.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ indicator.SetStyleName( "TextSelectionScrollIndicator" );
+
+ mScrollBar = Toolkit::ScrollBar::New( Toolkit::ScrollBar::Horizontal );
+ mScrollBar.SetName( "Text popup scroll bar" );
+ mScrollBar.SetStyleName( "TextSelectionScrollBar" );
+ 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.SetScrollIndicator( indicator );
+ 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
$(toolkit_src_dir)/builder/builder-signals.cpp \
$(toolkit_src_dir)/builder/json-parser-state.cpp \
$(toolkit_src_dir)/builder/json-parser-impl.cpp \
+ $(toolkit_src_dir)/builder/style.cpp \
$(toolkit_src_dir)/builder/tree-node-manipulator.cpp \
$(toolkit_src_dir)/builder/replacement.cpp \
$(toolkit_src_dir)/visuals/visual-base-impl.cpp \
$(toolkit_src_dir)/visuals/gradient/linear-gradient.cpp \
$(toolkit_src_dir)/visuals/gradient/radial-gradient.cpp \
$(toolkit_src_dir)/visuals/gradient/gradient-visual.cpp \
- $(toolkit_src_dir)/visuals/image/batch-image-visual.cpp \
$(toolkit_src_dir)/visuals/image/image-visual.cpp \
$(toolkit_src_dir)/visuals/mesh/mesh-visual.cpp \
$(toolkit_src_dir)/visuals/npatch/npatch-visual.cpp \
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
namespace Dali
{
actor.Add( GetFocusIndicatorActor() );
}
// Send notification for the change of focus actor
+ Actor currentFocusedActor = GetCurrentFocusActor();
+
if( !mFocusChangedSignal.Empty() )
{
- mFocusChangedSignal.Emit(GetCurrentFocusActor(), actor);
+ mFocusChangedSignal.Emit(currentFocusedActor, actor);
+ }
+
+ Toolkit::Control currentlyFocusedControl = Toolkit::Control::DownCast(currentFocusedActor);
+ if( currentlyFocusedControl )
+ {
+ // Do we need it to remember if it was previously DISABLED?
+ currentlyFocusedControl.SetProperty(DevelControl::Property::STATE, DevelControl::NORMAL );
}
DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Focus Changed\n", __FUNCTION__, __LINE__);
// Save the current focused actor
mCurrentFocusActor = actorID;
+ Toolkit::Control newlyFocusedControl = Toolkit::Control::DownCast(actor);
+ if( newlyFocusedControl )
+ {
+ newlyFocusedControl.SetProperty(DevelControl::Property::STATE, DevelControl::FOCUSED );
+ }
+
// Push Current Focused Actor to FocusHistory
mFocusHistory.PushBack( &actor.GetBaseObject() );
void KeyboardFocusManager::ClearFocus()
{
Actor actor = GetCurrentFocusActor();
- if(actor)
+ if( actor )
{
- if(mFocusIndicatorActor)
+ if( mFocusIndicatorActor )
{
- actor.Remove(mFocusIndicatorActor);
+ actor.Remove( mFocusIndicatorActor );
}
// Send notification for the change of focus actor
if( !mFocusChangedSignal.Empty() )
{
- mFocusChangedSignal.Emit(actor, Actor());
+ mFocusChangedSignal.Emit( actor, Actor() );
+ }
+
+ Toolkit::Control currentlyFocusedControl = Toolkit::Control::DownCast( actor );
+ if( currentlyFocusedControl )
+ {
+ currentlyFocusedControl.SetProperty( DevelControl::Property::STATE, DevelControl::NORMAL );
}
}
#include <dali/public-api/adaptor-framework/application.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/builder/builder-impl.h>
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
}
}
-void StyleManager::CollectQualifiers( StringList& qualifiersOut )
+static void CollectQualifiers( std::vector<std::string>& qualifiersOut )
{
// Append the relevant qualifier for orientation
int orientation = 0; // Get the orientation from the system
}
}
-void StyleManager::BuildQualifiedStyleName( const std::string& styleName, const StringList& qualifiers, std::string& qualifiedStyleOut )
+/**
+ * @brief Construct a qualified style name out of qualifiers
+ *
+ * A qualifed style name will be in the format: style-qualifier0-qualifier1-qualifierN
+ *
+ * @param[in] styleName The root name of the style
+ * @param[in] qualifiers List of qualifier names
+ * @param[out] qualifiedStyleOut The qualified style name
+ */
+static void BuildQualifiedStyleName(
+ const std::string& styleName,
+ const std::vector<std::string>& qualifiers,
+ std::string& qualifiedStyleOut )
{
qualifiedStyleOut.append( styleName );
- for( StringList::const_iterator it = qualifiers.begin(), itEnd = qualifiers.end(); it != itEnd; ++it )
+ for( std::vector<std::string>::const_iterator it = qualifiers.begin(),
+ itEnd = qualifiers.end(); it != itEnd; ++it )
{
const std::string& str = *it;
}
}
-void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control control )
+static bool GetStyleNameForControl( Toolkit::Builder builder, Toolkit::Control control, std::string& styleName)
{
- std::string styleName = control.GetStyleName();
+ styleName = control.GetStyleName();
if( styleName.empty() )
{
}
// Apply the style after choosing the correct actual style (e.g. landscape or portrait)
- StringList qualifiers;
+ std::vector<std::string> qualifiers;
CollectQualifiers( qualifiers );
- while( true )
+ bool found = 0;
+ std::string qualifiedStyleName;
+ do
{
- std::string qualifiedStyleName;
+ qualifiedStyleName.clear();
BuildQualifiedStyleName( styleName, qualifiers, qualifiedStyleName );
// Break if style found or we have tried the root style name (qualifiers is empty)
- if( builder.ApplyStyle( qualifiedStyleName, control ) || qualifiers.size() == 0 )
+ if( GetImpl(builder).LookupStyleName( qualifiedStyleName ) )
+ {
+ found = true;
+ break;
+ }
+ if( qualifiers.size() == 0 )
{
break;
}
-
// Remove the last qualifier in an attempt to find a style that is valid
qualifiers.pop_back();
+ } while (!found);
+
+ if(found)
+ {
+ styleName = qualifiedStyleName;
+ }
+ return found;
+}
+
+void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control control )
+{
+ std::string styleName = control.GetStyleName();
+ if( GetStyleNameForControl( builder, control, styleName ) )
+ {
+ builder.ApplyStyle( styleName, control );
}
if( mDefaultFontSize >= 0 )
}
}
+const StylePtr StyleManager::GetRecordedStyle( Toolkit::Control control )
+{
+ if( mThemeBuilder )
+ {
+ std::string styleName = control.GetStyleName();
+
+ if( GetStyleNameForControl( mThemeBuilder, control, styleName ) )
+ {
+ const StylePtr style = GetImpl(mThemeBuilder).GetStyle( styleName );
+ return style;
+ }
+ }
+ return StylePtr(NULL);
+}
+
Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key )
{
BuilderMap::iterator builderIt = mBuilderCache.find( key );
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/styling/style-manager.h>
#include <dali-toolkit/devel-api/builder/builder.h>
+#include <dali-toolkit/internal/builder/style.h>
namespace Dali
{
public: // Public API
-/**
+ /**
* @copydoc Toolkit::StyleManager::ApplyTheme
*/
void ApplyTheme( const std::string& themeFile );
*/
void ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName );
+ /**
+ * Get the state/style information for the given control
+ * @param[in] control The control to get state information for
+ * @return The style information (or empty ptr if not found)
+ */
+ const StylePtr GetRecordedStyle( Toolkit::Control control );
+
public:
// SIGNALS
bool LoadJSON( Toolkit::Builder builder, const std::string& jsonFileName );
/**
- * @brief Collect qualifiers (e.g. Landscape, portrait etc) for a given style
- *
- * @param[in,out] qualifiersOut The list to populate with qualifiers
- */
- void CollectQualifiers( StringList& qualifiersOut );
-
- /**
- * @brief Construct a qualified style name out of qualifiers
- *
- * A qualifed style name will be in the format: style-qualifier0-qualifier1-qualifierN
- *
- * @param[in] styleName The root name of the style
- * @param[in] qualifiers List of qualifier names
- * @param[out] qualifiedStyleOut The qualified style name
- */
- void BuildQualifiedStyleName( const std::string& styleName, const StringList& qualifiers, std::string& qualifiedStyleOut );
-
- /**
* @brief Apply a style to the control using the given builder
*
* @param[in] builder The builder to apply the style from
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "batch-image-visual.h"
-
-// EXTERNAL HEADER
-#include <cstring> // for strncasecmp
-#include <dali/public-api/images/resource-image.h>
-#include <dali/public-api/images/native-image.h>
-#include <dali/integration-api/debug.h>
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
-#include <dali/devel-api/rendering/renderer-devel.h>
-#include <dali/public-api/images/pixel-data.h>
-#include <dali/public-api/rendering/texture.h>
-#include <dali/public-api/rendering/texture-set.h>
-#include <dali/public-api/rendering/texture-set.h>
-
-// INTERNAL HEADER
-#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
-#include <dali-toolkit/internal/visuals/visual-string-constants.h>
-#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace
-{
-const char HTTP_URL[] = "http://";
-const char HTTPS_URL[] = "https://";
-
-// Properties:
-const char * const DESIRED_WIDTH( "desiredWidth" );
-const char * const DESIRED_HEIGHT( "desiredHeight" );
-
-const Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f );
-
-// The shader used for batched rendering. It uses interleaved data for
-// attributes. Limitation is that all batched renderers will share same set of uniforms.
-const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- attribute mediump vec2 aTexCoord;\n
- uniform mediump mat4 uMvpMatrix;\n
- varying mediump vec2 vTexCoord;\n
- \n
- void main()\n
- {\n
- vTexCoord = aTexCoord;\n
- gl_Position = uMvpMatrix * vec4( aPosition, 0.0, 1.0 );\n
- }\n
-);
-
-const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
- varying mediump vec2 vTexCoord;\n
- uniform sampler2D sTexture;\n
- uniform lowp vec4 uColor;\n
- uniform lowp vec4 mixColor;\n
- uniform lowp float preMultipliedAlpha;\n
- lowp vec4 visualMixColor()\n
- {\n
- return vec4( mixColor.rgb * mix( 1.0, mixColor.a, preMultipliedAlpha ), mixColor.a );\n
- }\n
- \n
- void main()\n
- {\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * visualMixColor();
- }\n
-);
-
-} // unnamed namespace
-
-BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties )
-{
- BatchImageVisualPtr visual = new BatchImageVisual( factoryCache );
- visual->mImageUrl = url;
- visual->SetProperties( properties );
-
- return visual;
-}
-
-BatchImageVisual::BatchImageVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache ),
- mImageUrl(""),
- mDesiredSize()
-{
-}
-
-BatchImageVisual::~BatchImageVisual()
-{
-}
-
-void BatchImageVisual::DoSetProperties( const Property::Map& propertyMap )
-{
- // url already passed in constructor
-
- for( Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter )
- {
- KeyValuePair keyValue = propertyMap.GetKeyValue( iter );
- if( keyValue.first.type == Property::Key::INDEX )
- {
- DoSetProperty( keyValue.first.indexKey, keyValue.second );
- }
- else
- {
- if( keyValue.first == DESIRED_WIDTH )
- {
- DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_WIDTH, keyValue.second );
- }
- else if( keyValue.first == DESIRED_HEIGHT )
- {
- DoSetProperty( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, keyValue.second );
- }
- }
- }
-}
-
-void BatchImageVisual::DoSetProperty( Property::Index index, const Property::Value& value )
-{
- switch( index )
- {
- case Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH:
- {
- int width;
- if( value.Get( width ) )
- {
- mDesiredSize.SetWidth( width );
- }
- else
- {
- DALI_LOG_ERROR("BatchImageVisual: width property has incorrect type\n");
- }
- break;
- }
- case Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT:
- {
- int height;
- if( value.Get( height ) )
- {
- mDesiredSize.SetHeight( height );
- }
- else
- {
- DALI_LOG_ERROR("BatchImageVisual: height property has incorrect type\n");
- }
- break;
- }
- }
-}
-
-void BatchImageVisual::GetNaturalSize( Vector2& naturalSize )
-{
- if( mDesiredSize.GetWidth() > 0 && mDesiredSize.GetHeight() > 0 )
- {
- naturalSize.x = mDesiredSize.GetWidth();
- naturalSize.y = mDesiredSize.GetHeight();
- return;
- }
- else if( !mImageUrl.empty() )
- {
- ImageDimensions dimentions = ResourceImage::GetImageSize( mImageUrl );
- naturalSize.x = dimentions.GetWidth();
- naturalSize.y = dimentions.GetHeight();
- return;
- }
-
- naturalSize = Vector2::ZERO;
-}
-
-void BatchImageVisual::InitializeRenderer( const std::string& imageUrl )
-{
- if( imageUrl.empty() )
- {
- return;
- }
-
- mImageUrl = imageUrl;
- mImpl->mRenderer.Reset();
- mAtlasRect = FULL_TEXTURE_RECT;
-
- if( !mImpl->mCustomShader &&
- ( strncasecmp( imageUrl.c_str(),HTTP_URL, sizeof( HTTP_URL ) -1 ) != 0 ) && // Ignore remote images
- ( strncasecmp( imageUrl.c_str(), HTTPS_URL, sizeof( HTTPS_URL ) -1 ) != 0 ) )
- {
- if( !mImpl->mRenderer )
- {
- TextureSet textureSet = mFactoryCache.GetAtlasManager()->Add(
- mAtlasRect,
- imageUrl,
- mDesiredSize );
-
- // If image doesn't fit the atlas, create new texture set with texture that
- // is used as whole.
- if( !textureSet )
- {
- BitmapLoader loader = BitmapLoader::New( imageUrl, mDesiredSize );
- loader.Load();
- Dali::PixelData pixelData = loader.GetPixelData();
- Texture texture = Texture::New( TextureType::TEXTURE_2D,
- pixelData.GetPixelFormat(),
- pixelData.GetWidth(),
- pixelData.GetHeight() );
- texture.Upload( pixelData );
- textureSet = TextureSet::New();
- textureSet.SetTexture( 0, texture );
- mAtlasRect = FULL_TEXTURE_RECT;
- }
-
- Geometry geometry = mFactoryCache.CreateBatchQuadGeometry( mAtlasRect );
- Shader shader( GetBatchShader( mFactoryCache ) );
- mImpl->mRenderer = Renderer::New( geometry, shader );
- mImpl->mRenderer.SetTextures( textureSet );
-
- // Turn batching on, to send message it must be on stage.
- mImpl->mRenderer.SetProperty( Dali::DevelRenderer::Property::BATCHING_ENABLED, true );
- }
- mImpl->mFlags |= Impl::IS_FROM_CACHE;
- }
-}
-
-void BatchImageVisual::DoSetOnStage( Actor& actor )
-{
- if( !mImageUrl.empty() )
- {
- InitializeRenderer( mImageUrl );
- }
- // Turn batching on, to send message it must be on stage
- mImpl->mRenderer.SetProperty( Dali::DevelRenderer::Property::BATCHING_ENABLED, true );
-
- actor.AddRenderer( mImpl->mRenderer );
-}
-
-void BatchImageVisual::DoSetOffStage( Actor& actor )
-{
- actor.RemoveRenderer( mImpl->mRenderer );
-
- // If we own the image then make sure we release it when we go off stage
- if( !mImageUrl.empty() )
- {
- CleanCache( mImageUrl );
- }
- else
- {
- mImpl->mRenderer.Reset();
- }
-}
-
-void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const
-{
- map.Clear();
- map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
-
- if( !mImageUrl.empty() )
- {
- map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
- map.Insert( Toolkit::ImageVisual::Property::BATCHING_ENABLED, true );
- map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
- map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
- }
-}
-
-Shader BatchImageVisual::GetBatchShader( VisualFactoryCache& factoryCache )
-{
- Shader shader = factoryCache.GetShader( VisualFactoryCache::BATCH_IMAGE_SHADER );
- if( !shader )
- {
- shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
- factoryCache.SaveShader( VisualFactoryCache::BATCH_IMAGE_SHADER, shader );
- }
- return shader;
-}
-
-void BatchImageVisual::CleanCache(const std::string& url)
-{
- TextureSet textureSet = mImpl->mRenderer.GetTextures();
- mImpl->mRenderer.Reset();
- if( mFactoryCache.CleanRendererCache( url ) )
- {
- mFactoryCache.GetAtlasManager()->Remove( textureSet, mAtlasRect );
- }
-}
-
-void BatchImageVisual::OnSetTransform()
-{
- if( mImpl->mRenderer )
- {
- //Register transform properties
- mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
- }
-}
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H
-#define DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H
-
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/common/intrusive-ptr.h>
-
-// INTERNAL HEADER
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-namespace Internal
-{
-
-class BatchImageVisual;
-typedef IntrusivePtr< BatchImageVisual > BatchImageVisualPtr;
-
-class BatchImageVisual: public Visual::Base, public ConnectionTracker
-{
-public:
-
- /**
- * @brief Create a new batch-image visual.
- *
- * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
- * @param[in] url The URL of the image to use
- * @param[in] properties A Property::Map containing settings for this visual
- * @return A smart-pointer to the newly allocated visual.
- */
- static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties = Property::Map() );
-
-public: // from Visual
-
- /**
- * @copydoc Visual::Base::GetNaturalSize
- */
- virtual void GetNaturalSize( Vector2& naturalSize );
-
- /**
- * @copydoc Visual::Base::CreatePropertyMap
- */
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
-
-protected:
-
- /**
- * @brief Constructor.
- *
- * @param[in] factoryCache The VisualFactoryCache object
- */
- BatchImageVisual( VisualFactoryCache& factoryCache );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- ~BatchImageVisual();
-
- /**
- * @copydoc Visua::Base::DoSetProperties
- */
- virtual void DoSetProperties( const Property::Map& propertyMap );
-
- /**
- * @copydoc Visual::Base::DoSetOnStage
- */
- virtual void DoSetOnStage( Actor& actor );
-
- /**
- * @copydoc Visual::Base::DoSetOffStage
- */
- virtual void DoSetOffStage( Actor& actor );
-
- /**
- * @copydoc Visual::Base::OnSetTransform
- */
- virtual void OnSetTransform();
-
-private:
-
- /**
- * Get the batch image rendering shader.
- * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
- */
- static Shader GetBatchShader( VisualFactoryCache& factoryCache );
-
- /**
- * @brief Initializes the Dali::Renderer from an image url string
- *
- * @param[in] imageUrl The image url string to intialize this ImageVisual from
- */
- void InitializeRenderer( const std::string& imageUrl );
-
- /**
- * Clean the Visual from cache, and remove the image from atlas if it is not used anymore
- */
- void CleanCache( const std::string& url );
-
- /**
- * Helper method to set individual values by index key.
- * @param[in] index The index key of the value
- * @param[in] value The value
- */
- void DoSetProperty( Property::Index index, const Property::Value& value );
-
-private:
-
- Vector4 mAtlasRect;
- std::string mImageUrl;
- Dali::ImageDimensions mDesiredSize;
-};
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_INTERNAL_BATCH_IMAGE_VISUAL_H
const char * const IMAGE_DESIRED_WIDTH( "desiredWidth" );
const char * const IMAGE_DESIRED_HEIGHT( "desiredHeight" );
const char * const SYNCHRONOUS_LOADING( "synchronousLoading" );
-const char * const BATCHING_ENABLED( "batchingEnabled" );
// fitting modes
DALI_ENUM_TO_STRING_TABLE_BEGIN( FITTING_MODE )
* | underline | STRING |
* | shadow | STRING |
* | outline | STRING |
- * | batchingEnabled | BOOLEAN |
*
*/
class TextVisual : public Visual::Base
return geometry;
}
-Geometry VisualFactoryCache::CreateBatchQuadGeometry( Vector4 texCoords )
-{
- const float halfWidth = 0.5f;
- const float halfHeight = 0.5f;
- struct QuadVertex {
- QuadVertex( const Vector2& vertexPosition, const Vector2& vertexTexCoords )
- : position( vertexPosition ),
- texCoords( vertexTexCoords )
- {}
- Vector2 position;
- Vector2 texCoords;
- };
-
- // special case, when texture takes whole space
- if( texCoords == Vector4::ZERO )
- {
- texCoords = Vector4(0.0f, 0.0f, 1.0f, 1.0f);
- }
-
- QuadVertex quadVertexData[6] =
- {
- QuadVertex( Vector2(-halfWidth, -halfHeight ), Vector2(texCoords.x, texCoords.y) ),
- QuadVertex( Vector2( halfWidth, -halfHeight ), Vector2(texCoords.z, texCoords.y) ),
- QuadVertex( Vector2(-halfWidth, halfHeight ), Vector2(texCoords.x, texCoords.w) ),
- QuadVertex( Vector2( halfWidth, -halfHeight ), Vector2(texCoords.z, texCoords.y) ),
- QuadVertex( Vector2(-halfWidth, halfHeight ), Vector2(texCoords.x, texCoords.w) ),
- QuadVertex( Vector2( halfWidth, halfHeight ), Vector2(texCoords.z, texCoords.w) ),
- };
-
- Property::Map vertexFormat;
- vertexFormat[ "aPosition" ] = Property::VECTOR2;
- vertexFormat[ "aTexCoord" ] = Property::VECTOR2;
- PropertyBuffer vertexBuffer = PropertyBuffer::New( vertexFormat );
- vertexBuffer.SetData( quadVertexData, 6 );
-
- // create geometry as normal, single quad
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexBuffer );
- geometry.SetType( Geometry::TRIANGLES );
-
- return geometry;
-}
-
Image VisualFactoryCache::GetBrokenVisualImage()
{
return ResourceImage::New( BROKEN_VISUAL_IMAGE_URL );
GRADIENT_SHADER_RADIAL_USER_SPACE,
GRADIENT_SHADER_RADIAL_BOUNDING_BOX,
IMAGE_SHADER,
- BATCH_IMAGE_SHADER,
IMAGE_SHADER_ATLAS_DEFAULT_WRAP,
IMAGE_SHADER_ATLAS_CUSTOM_WRAP,
NINE_PATCH_SHADER,
static Geometry CreateGridGeometry( Uint16Pair gridSize );
/**
- * Create the batchable geometry
- * @param[in] texCoords The texture atlas rect coordinates
- * @return The created batchable geometry
- */
- static Geometry CreateBatchQuadGeometry( Vector4 texCoords );
-
- /**
* @brief Returns an image to be used when a visual has failed to correctly render
* @return The broken image handle.
*/
#include <dali-toolkit/internal/visuals/border/border-visual.h>
#include <dali-toolkit/internal/visuals/color/color-visual.h>
#include <dali-toolkit/internal/visuals/gradient/gradient-visual.h>
-#include <dali-toolkit/internal/visuals/image/batch-image-visual.h>
#include <dali-toolkit/internal/visuals/image/image-visual.h>
#include <dali-toolkit/internal/visuals/mesh/mesh-visual.h>
#include <dali-toolkit/internal/visuals/npatch/npatch-visual.h>
namespace
{
-const char * const BATCHING_ENABLED( "batchingEnabled" );
BaseHandle Create()
{
BaseHandle handle = Toolkit::VisualFactory::Get();
}
else // Regular image
{
- bool batchingEnabled( false );
- Property::Value* batchingEnabledValue = propertyMap.Find( Toolkit::ImageVisual::Property::BATCHING_ENABLED, BATCHING_ENABLED );
- if( batchingEnabledValue )
- {
- batchingEnabledValue->Get( batchingEnabled );
- }
-
- if( batchingEnabled )
- {
- visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
- }
- else
- {
- visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
- }
+ visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
}
}
namespace Dali
{
+extern bool CaseInsensitiveStringCompare( const std::string& a, const std::string& b );
namespace Toolkit
{
return connected;
}
+const Scripting::StringEnum ControlStateTable[] = {
+ { "NORMAL", Toolkit::DevelControl::NORMAL },
+ { "FOCUSED", Toolkit::DevelControl::FOCUSED },
+ { "DISABLED", Toolkit::DevelControl::DISABLED },
+}; const unsigned int ControlStateTableCount = sizeof( ControlStateTable ) / sizeof( ControlStateTable[0] );
+
// Setup signals and actions using the type-registry.
DALI_TYPE_REGISTRATION_BEGIN( Control, CustomActor, Create );
// Construction & Destruction
Impl(Control& controlImpl)
: mControlImpl( controlImpl ),
+ mState( Toolkit::DevelControl::NORMAL ),
+ mSubState(""),
mStyleName(""),
mBackgroundColor(Color::TRANSPARENT),
mStartingPinchScale( NULL ),
break;
}
+ case Toolkit::DevelControl::Property::STATE:
+ {
+ Toolkit::DevelControl::State state( controlImpl.mImpl->mState );
+
+ if( Scripting::GetEnumerationProperty< Toolkit::DevelControl::State >( value, ControlStateTable, ControlStateTableCount, state ) )
+ {
+ controlImpl.mImpl->SetState( state );
+ }
+ }
+ break;
+
+ case Toolkit::DevelControl::Property::SUB_STATE:
+ {
+ std::string subState;
+ if( value.Get( subState ) )
+ {
+ controlImpl.mImpl->SetSubState( subState );
+ }
+ }
+ break;
+
case Toolkit::Control::Property::BACKGROUND_COLOR:
{
DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" );
break;
}
+ case Toolkit::DevelControl::Property::STATE:
+ {
+ value = Scripting::GetEnumerationName< Toolkit::DevelControl::State >( controlImpl.mImpl->mState, ControlStateTable, ControlStateTableCount );
+ break;
+ }
+
case Toolkit::Control::Property::BACKGROUND_COLOR:
{
DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" );
return value;
}
+ void SetState( DevelControl::State state )
+ {
+ if( mState != state )
+ {
+ // If mState was Disabled, and new state is Focused, should probably
+ // store that fact, e.g. in another property that FocusManager can access.
+ mState = state;
+
+ // Trigger state change and transitions
+ // Apply new style, if stylemanager is available
+ Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+ if( styleManager )
+ {
+ const StylePtr stylePtr = GetImpl( styleManager ).GetRecordedStyle( Toolkit::Control( mControlImpl.GetOwner() ) );
+ if( stylePtr )
+ {
+ for( int i=mVisuals.Count()-1; i >= 0; i-- )
+ {
+ mControlImpl.UnregisterVisual( mVisuals[i]->index );
+ }
+
+ Dali::CustomActor handle( mControlImpl.GetOwner() );
+ stylePtr->ApplyVisualsAndPropertiesRecursively( handle );
+ }
+ }
+ }
+ }
+
+ void SetSubState( const std::string& state )
+ {
+ if( mSubState != state )
+ {
+ mSubState = state;
+ // Trigger transitions
+
+ }
+ }
+
// Data
Control& mControlImpl;
+ DevelControl::State mState;
+ std::string mSubState;
+
RegisteredVisualContainer mVisuals; // Stores visuals needed by the control, non trivial type so std::vector used.
std::string mStyleName;
Vector4 mBackgroundColor; ///< The color of the background visual
static const PropertyRegistration PROPERTY_4;
static const PropertyRegistration PROPERTY_5;
static const PropertyRegistration PROPERTY_6;
+ static const PropertyRegistration PROPERTY_7;
+ static const PropertyRegistration PROPERTY_8;
};
// Properties registered without macro to use specific member variables.
const PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
const PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
const PropertyRegistration Control::Impl::PROPERTY_6( typeRegistration, "tooltip", Toolkit::DevelControl::Property::TOOLTIP, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_7( typeRegistration, "state", Toolkit::DevelControl::Property::STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_8( typeRegistration, "subState", Toolkit::DevelControl::Property::SUB_STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
Toolkit::Control Control::New()
{
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 26;
+const unsigned int TOOLKIT_MICRO_VERSION = 27;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
BORDER_ONLY,
/**
- * @brief This enables Image visuals to automatically be converted to Batch-Image visuals.
- * @details Name "batchingEnabled", type Property::BOOLEAN.
- * @SINCE_1_2.0
- * @note Optional. If not specified, the default is false.
- * @note For Image visuals only. Not to be used with NPatch or SVG images.
- */
- BATCHING_ENABLED,
-
- /**
* @brief The image area to be displayed.
* @details Name "pixelArea", type Property::VECTOR4.
* It is a rectangular area.
"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,
"overshootSize":[480.0,42.0]
}
},
+ "TextSelectionScrollBar":
+ {
+ "indicatorShowDuration":0.25,
+ "indicatorHideDuration":0.25
+ },
+ "TextSelectionScrollIndicator":
+ {
+ "image":
+ {
+ "visualType":"IMAGE",
+ "url":"{DALI_IMAGE_DIR}text_selection_scroll_indicator.9.png"
+ },
+ "color":[0.0,0.72,0.9,0.7]
+ },
"ScrollView":
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":120.0,
"overshootSize":[480.0,42.0]
},
+ "ScrollBar":
+ {
+ "indicatorShowDuration":0.25,
+ "indicatorHideDuration":0.25
+ },
+ "ScrollBarIndicator":
+ {
+ "image":
+ {
+ "visualType":"IMAGE",
+ "url":"{DALI_IMAGE_DIR}popup_scroll.9.png"
+ }
+ },
"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,
// C++
label.SetProperty( TextLabel::Property::FONT_FAMILY, "FreeSerif" );
-label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"bold\",\"slant\":\"italic\"}" );
+label.SetProperty( TextLabel::Property::FONT_STYLE,
+ Property::Map().Add( "weight", "bold" )
+ .Add( "slant", "italic" ) );
label.SetProperty( TextLabel::Property::POINT_SIZE, 12.0f );
~~~
// JavaScript
label.fontFamily = "FreeSerif";
-label.fontStyle = "{\"weight\":\"bold\",\"slant\":\"italic\"}";
+label.fontStyle = {
+ "weight" : "bold",
+ "slant" : "italic"
+ };
label.pointSize = 12;
~~~
"textlabel":
{
"fontFamily":"FreeSerif",
- "fontStyle":"{\"weight\":\"bold\",\"slant\":\"italic\"}",
+ "fontStyle":
+ {
+ "weight":"bold",
+ "slant":"italic"
+ },
"pointSize":8
}
}
"textlabel":
{
"fontFamily":"FreeSerif",
- "fontStyle":"{\"weight\":\"bold\",\"slant\":\"italic\"}",
+ "fontStyle":
+ {
+ "weight":"bold",
+ "slant":"italic"
+ },
},
"textlabelFontSize0":
"customLabel":
{
"fontFamily":"TimesNewRoman",
- "fontStyle":"{\"weight\":\"regular\",\"slant\":\"regular\"}",
+ "fontStyle":
+ {
+ "weight":"regular",
+ "slant":"regular"
+ },
},
"customLabelFontSize0":
{
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.26
+Version: 1.2.27
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.26
+Version: 1.2.27
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
/*
- * 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.
%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/math/random.h>
%include <dali/public-api/math/angle-axis.h>
%include <dali/public-api/math/viewport.h>
+%include <dali/public-api/math/math-utils.h>
%include <dali/public-api/object/property-index-ranges.h>
%include <dali/public-api/object/property.h>
%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(StringValuePair) std::pair<std::string, Dali::Property::Value>;
%template(TouchPointContainer) std::vector<Dali::TouchPoint>;
-%template(RectDouble) Dali::Rect<double>;
-%template(RectInteger) Dali::Rect<int>;
-%template(RectUnsignedInteger) Dali::Rect<unsigned int>;
-%template(RectFloat) Dali::Rect<float>;
+%template(Rectangle) Dali::Rect<int>;
+%template(PaddingType) Dali::Rect<float>;
%template(VectorInteger) Dali::Vector<int>;
%template(VectorFloat) Dali::Vector<float>;
%template(VectorUnsignedChar) Dali::Vector<unsigned char>;
//%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&)>;
/*
- * 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.
%}
%enddef
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VIDEOVIEWSIGNAL( NameSpace, ClassName )
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( NameSpace, ClassName, NewClassName )
%typemap(csfinalize) NameSpace::ClassName %{
- ~VideoViewSignal() {
+ ~NewClassName() {
DisposeQueue.Instance.Add(this);
}
%}
%enddef
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VIDEOVIEWSIGNAL( NameSpace, ClassName )
+%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);
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
- NDalicPINVOKE.delete_VideoViewSignal(swigCPtr);
+ NDalicPINVOKE.delete_##NewClassName(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
%}
%enddef
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_APPLICATIONSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~ApplicationSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_APPLICATIONSIGNAL( NameSpace, ClassName )
-%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_ApplicationSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_APPLICATIONCONTROLSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~ApplicationControlSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_APPLICATIONCONTROLSIGNAL( NameSpace, ClassName )
-%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_ApplicationControlSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_IMAGESIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~ImageSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_IMAGESIGNAL( NameSpace, ClassName )
-%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_ImageSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RESOURCESIMAGESIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~ResourceImageSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RESOURCESIMAGESIGNAL( NameSpace, ClassName )
-%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_ResourceImageSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTINT( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~RectInteger() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTINT( NameSpace, ClassName )
-%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_RectInteger(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTDOUBLE( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~RectDouble() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTDOUBLE( NameSpace, ClassName )
-%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_RectDouble(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTFLOAT( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~RectFloat() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTFLOAT( NameSpace, ClassName )
-%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_RectFloat(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTUNSIGNEDINT( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~RectUnsignedInteger() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTUNSIGNEDINT( NameSpace, ClassName )
-%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_RectUnsignedInteger(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STRINGVALUEPAIR( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~StringValuePair() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STRINGVALUEPAIR( NameSpace, ClassName )
-%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_StringValuePair(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TOUCHCONTAINER( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~TouchPointContainer() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TOUCHCONTAINER( NameSpace, ClassName )
-%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_TouchPointContainer(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BOOLSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~BoolSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_BOOLSIGNAL( NameSpace, ClassName )
-%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_BoolSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYACTIONSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~AccessibilityActionSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYACTIONSIGNAL( NameSpace, ClassName )
-%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_AccessibilityActionSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYACTIONSCROLLSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~AccessibilityActionScrollSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYACTIONSCROLLSIGNAL( NameSpace, ClassName )
-%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_AccessibilityActionScrollSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYFOCUSSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~AccessibilityFocusOvershotSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYFOCUSSIGNAL( NameSpace, ClassName )
-%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_AccessibilityFocusOvershotSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORINT( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~VectorInteger() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORINT( NameSpace, ClassName )
-%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_VectorInteger(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORFLOAT( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~VectorFloat() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORFLOAT( NameSpace, ClassName )
-%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_VectorFloat(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORUNSIGNEDCHAR( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~VectorUnsignedChar() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORUNSIGNEDCHAR( NameSpace, ClassName )
-%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_VectorUnsignedChar(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORUINT16PAIR( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~VectorUint16Pair() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORUINT16PAIR( NameSpace, ClassName )
-%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_VectorUint16Pair(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TIMERSIGNALTYPE( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~TimerSignalType() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TIMERSIGNALTYPE( NameSpace, ClassName )
-%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_TimerSignalType(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACTOR( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~ActorSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACTOR( NameSpace, ClassName )
-%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_ActorSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ANIMATIONSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~AnimationSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ANIMATIONSIGNAL( NameSpace, ClassName )
-%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_AnimationSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BUTTON( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~ButtonSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_BUTTON( NameSpace, ClassName )
-%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_ButtonSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PAGETURNSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~PageTurnSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PAGETURNSIGNAL( NameSpace, ClassName )
-%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_PageTurnSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PAGEVIEWSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~PagePanSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PAGEVIEWSIGNAL( NameSpace, ClassName )
-%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_PagePanSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PANGESTURESIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~PanGestureDetectedSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PANGESTURESIGNAL( NameSpace, ClassName )
-%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_PanGestureDetectedSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PINCHGESTURESIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~PinchGestureDetectedSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PINCHGESTURESIGNAL( NameSpace, ClassName )
-%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_PinchGestureDetectedSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENDERTASKSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~RenderTaskSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENDERTASKSIGNAL( NameSpace, ClassName )
-%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_RenderTaskSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SCROLLABLESIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~ScrollableSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SCROLLABLESIGNAL( NameSpace, ClassName )
-%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_ScrollableSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SCROLLVIEWSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~ScrollViewSnapStartedSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SCROLLVIEWSIGNAL( NameSpace, ClassName )
-%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_ScrollViewSnapStartedSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SLIDERVALUECHANGEDSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~SliderValueChangedSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SLIDERVALUECHANGEDSIGNAL( NameSpace, ClassName )
-%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_SliderValueChangedSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SLIDERMARKCHANGEDSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~SliderMarkReachedSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SLIDERMARKCHANGEDSIGNAL( NameSpace, ClassName )
-%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_SliderMarkReachedSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STAGESIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~StageWheelEventSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STAGESIGNAL( NameSpace, ClassName )
-%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_StageWheelEventSignal(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
- global::System.GC.SuppressFinalize(this);
- }
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STYLECHANGEDSIGNAL( NameSpace, ClassName )
-%typemap(csfinalize) NameSpace::ClassName %{
- ~StyleChangedSignal() {
- DisposeQueue.Instance.Add(this);
- }
-%}
-%enddef
-
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STYLECHANGEDSIGNAL( NameSpace, ClassName )
-%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+%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;
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
- NDalicPINVOKE.delete_StyleChangedSignal(swigCPtr);
+ 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_TAPGESTURESIGNAL( NameSpace, ClassName )
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STRINGVALUEPAIR( NameSpace, ClassName )
%typemap(csfinalize) NameSpace::ClassName %{
- ~TapGestureDetectedSignal() {
+ ~StringValuePair() {
DisposeQueue.Instance.Add(this);
}
%}
%enddef
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TAPGESTURESIGNAL( NameSpace, ClassName )
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STRINGVALUEPAIR( NameSpace, ClassName )
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
if (!Stage.IsInstalled()) {
DisposeQueue.Instance.Add(this);
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
- NDalicPINVOKE.delete_TapGestureDetectedSignal(swigCPtr);
+ NDalicPINVOKE.delete_StringValuePair(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
%}
%enddef
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TEXTFIELDSIGNAL( NameSpace, ClassName )
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BOOLSIGNAL( NameSpace, ClassName )
%typemap(csfinalize) NameSpace::ClassName %{
- ~TextFieldSignal() {
+ ~BoolSignal() {
DisposeQueue.Instance.Add(this);
}
%}
%enddef
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TEXTFIELDSIGNAL( NameSpace, ClassName )
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_BOOLSIGNAL( NameSpace, ClassName )
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
if (!Stage.IsInstalled()) {
DisposeQueue.Instance.Add(this);
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
- NDalicPINVOKE.delete_TextFieldSignal(swigCPtr);
+ NDalicPINVOKE.delete_BoolSignal(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
%}
%enddef
-%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TEXTEDITORSIGNAL( NameSpace, ClassName )
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TIMERSIGNALTYPE( NameSpace, ClassName )
%typemap(csfinalize) NameSpace::ClassName %{
- ~TextEditorSignal() {
+ ~TimerSignalType() {
DisposeQueue.Instance.Add(this);
}
%}
%enddef
-%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TEXTEDITORSIGNAL( NameSpace, ClassName )
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TIMERSIGNALTYPE( NameSpace, ClassName )
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
if (!Stage.IsInstalled()) {
DisposeQueue.Instance.Add(this);
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
- NDalicPINVOKE.delete_TextEditorSignal(swigCPtr);
+ NDalicPINVOKE.delete_TimerSignalType(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 );
DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, VisualFactory );
DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, VisualFactory );
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_APPLICATIONSIGNAL( Dali, Signal<void(Dali::Application&)>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_APPLICATIONSIGNAL( Dali, Signal<void(Dali::Application&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_APPLICATIONCONTROLSIGNAL( Dali, Signal<void(Dali::Application&, void*)>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_APPLICATIONCONTROLSIGNAL( Dali, Signal<void(Dali::Application&, void*)>);
-
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VIDEOVIEWSIGNAL( Dali, Signal<void(Dali::Toolkit::VideoView&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VIDEOVIEWSIGNAL( Dali, Signal<void(Dali::Toolkit::VideoView&)>);
-
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_IMAGESIGNAL( Dali, Signal<void(Dali::Image)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_IMAGESIGNAL( Dali, Signal<void(Dali::Image)>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RESOURCESIMAGESIGNAL( Dali, Signal<void(Dali::ResourceImage)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RESOURCESIMAGESIGNAL( Dali, Signal<void(Dali::ResourceImage)>);
-
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTINT( Dali, Rect<int>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTINT( Dali, Rect<int>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTDOUBLE( Dali, Rect<double>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTDOUBLE( Dali, Rect<double>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTFLOAT( Dali, Rect<float>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTFLOAT( Dali, Rect<float>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTUNSIGNEDINT( Dali, Rect<unsigned int>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTUNSIGNEDINT( Dali, Rect<unsigned int>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TOUCHCONTAINER( std, vector<Dali::TouchPoint>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TOUCHCONTAINER( std, vector<Dali::TouchPoint>);
-
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORINT( Dali, Vector<int>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORINT( Dali, Vector<int>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORFLOAT( Dali, Vector<float>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORFLOAT( Dali, Vector<float>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORUNSIGNEDCHAR( Dali, Vector<unsigned char>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORUNSIGNEDCHAR( Dali, Vector<unsigned char>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORUINT16PAIR( Dali, Vector<Dali::Uint16Pair>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORUINT16PAIR( Dali, Vector<Dali::Uint16Pair>);
-
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYACTIONSIGNAL( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYACTIONSIGNAL( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&)>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYACTIONSCROLLSIGNAL( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYACTIONSCROLLSIGNAL( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&)>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYFOCUSSIGNAL( Dali, Signal<void(Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYFOCUSSIGNAL( Dali, Signal<void(Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Application&)>, ApplicationSignal);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Application&)>, ApplicationSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Application&, void*)>, ApplicationControlSignal);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Application&, void*)>, ApplicationControlSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::VideoView&)>, VideoViewSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::VideoView&)>, VideoViewSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Image)>, ImageSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Image)>, ImageSignal);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::ResourceImage)>, ResourceImageSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::ResourceImage)>, ResourceImageSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Rect<int>, Rectangle);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Rect<int>, Rectangle);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Rect<float>, PaddingType);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Rect<float>, PaddingType);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( std, vector<Dali::TouchPoint>, TouchPointContainer);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( std, vector<Dali::TouchPoint>, TouchPointContainer);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Vector<int>, VectorInteger);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Vector<int>, VectorInteger);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Vector<float>, VectorFloat);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Vector<float>, VectorFloat);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Vector<unsigned char>, VectorUnsignedChar);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Vector<unsigned char>, VectorUnsignedChar);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Vector<Dali::Uint16Pair>, VectorUint16Pair);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Vector<Dali::Uint16Pair>, VectorUint16Pair);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&)>, AccessibilityActionSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&)>, AccessibilityActionSignal);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&)>, AccessibilityActionScrollSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&)>, AccessibilityActionScrollSignal);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection)>, AccessibilityFocusOvershotSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection)>, AccessibilityFocusOvershotSignal);
//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STRINGVALUEPAIR( Dali, pair<std::string, Dali::Property::Value>);
//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STRINGVALUEPAIR( Dali, pair<std::string, Dali::Property::Value>);
//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BOOLSIGNAL( Dali, Signal<bool()>);
//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TIMERSIGNALTYPE( Dali, Signal<bool()>);
//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TIMERSIGNALTYPE( Dali, Signal<bool()>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACTOR( Dali, Signal<void (Dali::Actor)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACTOR( Dali, Signal<void (Dali::Actor)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor)>, ActorSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor)>, ActorSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Animation&)>, AnimationSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Animation&)>, AnimationSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::Button)>, ButtonSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::Button)>, ButtonSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::PageTurnView, unsigned int, bool)>, PageTurnSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::PageTurnView, unsigned int, bool)>, PageTurnSignal);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::PageTurnView)>, PagePanSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::PageTurnView)>, PagePanSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor, const Dali::PanGesture&)>, PanGestureDetectedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor, const Dali::PanGesture&)>, PanGestureDetectedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor, const Dali::PinchGesture&)>, PinchGestureDetectedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor, const Dali::PinchGesture&)>, PinchGestureDetectedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::RenderTask&)>, RenderTaskSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::RenderTask&)>, RenderTaskSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal< void(const Dali::Vector2&)>, ScrollableSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal< void(const Dali::Vector2&)>, ScrollableSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal< void(const Dali::Toolkit::ScrollView::SnapEvent&)>, ScrollViewSnapStartedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal< void(const Dali::Toolkit::ScrollView::SnapEvent&)>, ScrollViewSnapStartedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::Slider, float)>, SliderValueChangedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::Slider, float)>, SliderValueChangedSignal);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::Slider, int)>, SliderMarkReachedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::Slider, int)>, SliderMarkReachedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (const Dali::WheelEvent&)>, StageWheelSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (const Dali::WheelEvent&)>, StageWheelSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::StyleManager, Dali::StyleChange::Type)>, StyleChangedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::StyleManager, Dali::StyleChange::Type)>,StyleChangedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor, const Dali::TapGesture&)>, TapGestureDetectedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor, const Dali::TapGesture&)>, TapGestureDetectedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::TextEditor)>, TextEditorSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::TextEditor)>, TextEditorSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::TextField)>, TextFieldSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::TextField)>, TextFieldSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( std, vector<Dali::Actor>, ActorContainer);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( std, vector<Dali::Actor>, ActorContainer);
+
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ITEM( std, pair<unsigned int, Dali::Actor));
+//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ITEM( std, pair<unsigned int, Dali::Actor>);
+
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ITEMCONTAINER( std, vector<std::pair<unsigned int, Dali::Actor>>);
+//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ITEMCONTAINER( std, vector<std::pair<unsigned int, Dali::Actor>>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( std, vector<unsigned int>, ItemIdContainer);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( std, vector<unsigned int>, ItemIdContainer);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Actor, Dali::Actor)>, FocusChangedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Actor, Dali::Actor)>, FocusChangedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Actor, bool)>, FocusGroupChangedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Actor, bool)>, FocusGroupChangedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (Dali::Toolkit::GaussianBlurView)>, GaussianBlurViewSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (Dali::Toolkit::GaussianBlurView)>, GaussianBlurViewSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::Control, const Dali::KeyEvent&)>, ControlKeySignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool(Dali::Toolkit::Control, const Dali::KeyEvent&)>, ControlKeySignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (const Dali::KeyEvent&)>, KeyEventSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (const Dali::KeyEvent&)>, KeyEventSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::Control)>, KeyInputFocusSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::Toolkit::Control)>, KeyInputFocusSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, IntrusivePtr<Dali::Toolkit::Ruler>, RulerPtr);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, IntrusivePtr<Dali::Toolkit::Ruler>, RulerPtr);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void()>, VoidSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void()>, VoidSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(float)>, FloatSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(float)>, FloatSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(const Dali::RefObject*)>, ObjectDestroyedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(const Dali::RefObject*)>, ObjectDestroyedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::BaseHandle)>, ObjectCreatedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::BaseHandle)>, ObjectCreatedSignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void(Dali::PropertyNotification&)>, PropertyNotifySignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void(Dali::PropertyNotification&)>, PropertyNotifySignal);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor, const Dali::LongPressGesture&)>, LongPressGestureDetectedSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (Dali::Actor, const Dali::LongPressGesture&)>, LongPressGestureDetectedSignal);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ANIMATIONSIGNAL( Dali, Signal<void(Dali::Animation&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ANIMATIONSIGNAL( Dali, Signal<void(Dali::Animation&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool (Dali::Actor, const Dali::HoverEvent&)>, ActorHoverSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool (Dali::Actor, const Dali::HoverEvent&)>, ActorHoverSignal);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BUTTON( Dali, Signal<bool(Dali::Toolkit::Button)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_BUTTON( Dali, Signal<bool(Dali::Toolkit::Button)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool (Dali::Actor, const Dali::TouchData&)>, ActorTouchDataSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool (Dali::Actor, const Dali::TouchData&)>, ActorTouchDataSignal);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PAGETURNSIGNAL( Dali, Signal<void(Dali::Toolkit::PageTurnView, unsigned int, bool)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PAGETURNSIGNAL( Dali, Signal<void(Dali::Toolkit::PageTurnView, unsigned int, bool)>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PAGEVIEWSIGNAL( Dali, Signal<void(Dali::Toolkit::PageTurnView)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PAGEVIEWSIGNAL( Dali, Signal<void(Dali::Toolkit::PageTurnView)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<bool (Dali::Actor, const Dali::WheelEvent&)>, ActorWheelSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<bool (Dali::Actor, const Dali::WheelEvent&)>, ActorWheelSignal);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PANGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::PanGesture&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PANGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::PanGesture&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, Signal<void (const Dali::TouchData&)>, TouchSignal);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, Signal<void (const Dali::TouchData&)>, TouchSignal);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PINCHGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::PinchGesture&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PINCHGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::PinchGesture&)>);
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENAME( Dali, (std::pair< Dali::Radian, Dali::Radian >), AngleThresholdPair);
+//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENAME( Dali, (std::pair< Dali::Radian, Dali::Radian >), AngleThresholdPair);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENDERTASKSIGNAL( Dali, Signal<void(Dali::RenderTask&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENDERTASKSIGNAL( Dali, Signal<void(Dali::RenderTask&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, ApplicationExtensions );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, ApplicationExtensions );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SCROLLABLESIGNAL( Dali, Signal< void(const Dali::Vector2&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SCROLLABLESIGNAL( Dali, Signal< void(const Dali::Vector2&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, SlotObserver );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, SlotObserver );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SCROLLVIEWSIGNAL( Dali, Signal< void(const Dali::Toolkit::ScrollView::SnapEvent&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SCROLLVIEWSIGNAL( Dali, Signal< void(const Dali::Toolkit::ScrollView::SnapEvent&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, SignalObserver );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, SignalObserver );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SLIDERVALUECHANGEDSIGNAL( Dali, Signal<bool(Dali::Toolkit::Slider, float)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SLIDERVALUECHANGEDSIGNAL( Dali, Signal<bool(Dali::Toolkit::Slider, float)>);
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SLIDERMARKCHANGEDSIGNAL( Dali, Signal<bool(Dali::Toolkit::Slider, int)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SLIDERMARKCHANGEDSIGNAL( Dali, Signal<bool(Dali::Toolkit::Slider, int)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, AnimatablePropertyComponentRegistration );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, AnimatablePropertyComponentRegistration );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STAGESIGNAL( Dali, Signal<void (const Dali::WheelEvent&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STAGESIGNAL( Dali, Signal<void (const Dali::WheelEvent&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, AnimatablePropertyRegistration );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, AnimatablePropertyRegistration );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STYLECHANGEDSIGNAL( Dali, Signal<void(Dali::Toolkit::StyleManager, Dali::StyleChange::Type)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STYLECHANGEDSIGNAL( Dali, Signal<void(Dali::Toolkit::StyleManager, Dali::StyleChange::Type)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, AsyncImageLoader );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, AsyncImageLoader );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TAPGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::TapGesture&)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TAPGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::TapGesture&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, ChildPropertyRegistration );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, ChildPropertyRegistration );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TEXTEDITORSIGNAL( Dali, Signal<void(Dali::Toolkit::TextEditor)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TEXTEDITORSIGNAL( Dali, Signal<void(Dali::Toolkit::TextEditor)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ClampState2D );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali::Toolkit, ClampState2D );
-DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TEXTFIELDSIGNAL( Dali, Signal<void(Dali::Toolkit::TextField)>);
-DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TEXTFIELDSIGNAL( Dali, Signal<void(Dali::Toolkit::TextField)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, DaliException );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, DaliException );
%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)>;
/*
- * 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 events/pangesture-event.i
%include events/propertynotification-event.i
%include events/longpressgesture-event.i
-%include events/rectinteger.i
+%include events/rectangle.i
+%include events/padding.i
%include events/resourceimage-event.i
%include events/scrollable-event.i
%include events/scrollbar-event.i
%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
%}
%typemap(cscode) Dali::Actor::Property %{
- public static readonly int BATCH_PARENT = NDalicManualPINVOKE.Actor_Property_BATCH_PARENT_get();
public static readonly int SIBLING_ORDER = NDalicManualPINVOKE.Actor_Property_SIBLING_ORDER_get();
%}
-%typemap(cscode) Dali::Renderer::Property %{
- public static readonly int BATCHING_ENABLED = NDalicManualPINVOKE.Renderer_Property_BATCHING_ENABLED_get();
-%}
-
-%typemap(cscode) Dali::Renderer %{
- public bool BatchingEnabled
- {
- get
- {
- bool temp = false;
- GetProperty( Renderer.Property.BATCHING_ENABLED).Get( ref temp );
- return temp;
- }
- set
- {
- SetProperty( Renderer.Property.BATCHING_ENABLED, new Dali.Property.Value( value ) );
- }
- }
-%}
-
%typemap(cscode) Dali::Toolkit::Control::Property %{
public static readonly int TOOLTIP = NDalicManualPINVOKE.View_Property_TOOLTIP_get();
+ public static readonly int STATE = NDalicManualPINVOKE.View_Property_STATE_get();
+ public static readonly int SUB_STATE = NDalicManualPINVOKE.View_Property_SUB_STATE_get();
%}
%typemap(cscode) Dali::Toolkit::ItemView::Property %{
* @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
{
}
}
- public bool BatchParent
- {
- get
- {
- bool temp = false;
- GetProperty( Actor.Property.BATCH_PARENT).Get( ref temp );
- return temp;
- }
- set
- {
- SetProperty( Actor.Property.BATCH_PARENT, new Dali.Property.Value( value ) );
- }
- }
-
public int SiblingOrder
{
get
}
/**
- * @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;
--- /dev/null
+/*
+ * 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.
+ * 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.
+ *
+ */
+%csmethodmodifiers Dali::Rect<float>::x "private";
+%csmethodmodifiers Dali::Rect<float>::y "private";
+%csmethodmodifiers Dali::Rect<float>::left "private";
+%csmethodmodifiers Dali::Rect<float>::right "private";
+%csmethodmodifiers Dali::Rect<float>::width "private";
+%csmethodmodifiers Dali::Rect<float>::bottom "private";
+%csmethodmodifiers Dali::Rect<float>::height "private";
+%csmethodmodifiers Dali::Rect<float>::top "private";
+%ignore Dali::Rect<float>::IsEmpty;
+%ignore Dali::Rect<float>::Left;
+%ignore Dali::Rect<float>::Right;
+%ignore Dali::Rect<float>::Top;
+%ignore Dali::Rect<float>::Bottom;
+%ignore Dali::Rect<float>::Area;
+%ignore Dali::Rect<float>::Intersects;
+%ignore Dali::Rect<float>::Contains;
+
+%define DALI_PADDINGTYPE_PROPERTY_PARAM(NameSpace,ClassName)
+ %typemap(cscode) NameSpace::ClassName %{
+ public static bool operator ==(PaddingType a, PaddingType b)
+ {
+ // If both are null, or both are same instance, return true.
+ if (System.Object.ReferenceEquals(a, b))
+ {
+ return true;
+ }
+
+ // If one is null, but not both, return false.
+ if (((object)a == null) || ((object)b == null))
+ {
+ return false;
+ }
+
+ // Return true if the fields match:
+ return ( System.Math.Abs( a.Left - b.Left ) < NDalic.GetRangedEpsilon(a.Left, b.Left) )&&
+ ( System.Math.Abs( a.Right - b.Right ) < NDalic.GetRangedEpsilon(a.Right, b.Right) )&&
+ ( System.Math.Abs( a.Bottom - b.Bottom ) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom) )&&
+ ( System.Math.Abs( a.Top - b.Top ) < NDalic.GetRangedEpsilon(a.Top, b.Top) );
+ }
+
+ public static bool operator !=(PaddingType a, PaddingType b)
+ {
+ return !(a == b);
+ }
+
+ ///< The Left value
+ public float Left
+ {
+ set
+ {
+ left = value;
+ }
+ get
+ {
+ return left;
+ }
+ }
+
+ ///< The Right value
+ public float Right
+ {
+ set
+ {
+ right = value;
+ }
+ get
+ {
+ return right;
+ }
+ }
+
+ ///< The Bottom value
+ public float Bottom
+ {
+ set
+ {
+ bottom = value;
+ }
+ get
+ {
+ return bottom;
+ }
+ }
+
+ ///< The Top value
+ public float Top
+ {
+ set
+ {
+ top = value;
+ }
+ get
+ {
+ return top;
+ }
+ }
+
+%}
+
+%enddef
+
+namespace Dali
+{
+ DALI_PADDINGTYPE_PROPERTY_PARAM( Dali, Rect<float>);
+}
--- /dev/null
+/*
+ * 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.
+ * 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.
+ *
+ */
+%csmethodmodifiers Dali::Rect<int>::x "private";
+%csmethodmodifiers Dali::Rect<int>::y "private";
+%csmethodmodifiers Dali::Rect<int>::left "private";
+%csmethodmodifiers Dali::Rect<int>::right "private";
+%csmethodmodifiers Dali::Rect<int>::width "private";
+%csmethodmodifiers Dali::Rect<int>::bottom "private";
+%csmethodmodifiers Dali::Rect<int>::height "private";
+%csmethodmodifiers Dali::Rect<int>::top "private";
+
+%define DALI_RECTANGLE_PROPERTY_PARAM(NameSpace,ClassName)
+ %typemap(cscode) NameSpace::ClassName %{
+ public static bool operator ==(Rectangle a, Rectangle b)
+ {
+ // If both are null, or both are same instance, return true.
+ if (System.Object.ReferenceEquals(a, b))
+ {
+ return true;
+ }
+
+ // If one is null, but not both, return false.
+ if (((object)a == null) || ((object)b == null))
+ {
+ return false;
+ }
+
+ // Return true if the fields match:
+ return a.X == b.X && a.Y == b.Y && a.Width == b.Width && a.Height == b.Height;
+ }
+
+ public static bool operator !=(Rectangle a, Rectangle b)
+ {
+ return !(a == b);
+ }
+
+ ///< X position of the rectangle
+ public int X
+ {
+ set
+ {
+ x = value;
+ }
+ get
+ {
+ return x;
+ }
+ }
+
+ ///< Y position of the rectangle
+ public int Y
+ {
+ set
+ {
+ y = value;
+ }
+ get
+ {
+ return y;
+ }
+ }
+
+ ///< Width of the rectangle
+ public int Width
+ {
+ set
+ {
+ width = value;
+ }
+ get
+ {
+ return width;
+ }
+ }
+
+ ///< Height of the rectangle
+ public int Height
+ {
+ set
+ {
+ height = value;
+ }
+ get
+ {
+ return height;
+ }
+ }
+%}
+
+%enddef
+
+namespace Dali
+{
+ DALI_RECTANGLE_PROPERTY_PARAM( Dali, Rect<int>);
+}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-%define DALI_RECTINTEGER_PROPERTY_PARAM(NameSpace,ClassName)
- %typemap(cscode) NameSpace::ClassName %{
-
- public int X {
- set {
- NDalicPINVOKE.RectInteger_x_set(swigCPtr, value);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- get {
- int ret = NDalicPINVOKE.RectInteger_x_get(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- }
-
- public int Y {
- set {
- NDalicPINVOKE.RectInteger_y_set(swigCPtr, value);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- get {
- int ret = NDalicPINVOKE.RectInteger_y_get(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- }
-
- public int W {
- set {
- NDalicPINVOKE.RectInteger_width_set(swigCPtr, value);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- get {
- int ret = NDalicPINVOKE.RectInteger_width_get(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- }
-
- public int H {
- set {
- NDalicPINVOKE.RectInteger_height_set(swigCPtr, value);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- }
- get {
- int ret = NDalicPINVOKE.RectInteger_height_get(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
- }
-
-%}
-
-%enddef
-
-namespace Dali
-{
- DALI_RECTINTEGER_PROPERTY_PARAM( Dali, Rect<int>);
-}
*/
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 );
/*
- * 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.
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 PaddingType(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 ();
}
/*
- * 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.
namespace MyCSharpExample
{
- class Example
- {
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- delegate void CallbackDelegate(IntPtr appPtr); // void, void delgate
-
- private Dali.Application _application;
-
- public Example(Dali.Application application)
- {
- _application = application;
- Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() );
-
- _application.Initialized += Initialize;
- Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() );
- }
-
- public void Initialize(object source, NUIApplicationInitEventArgs e)
- {
-
- OperatorTests();
-
- Handle handle = new Handle();
- int myPropertyIndex = handle.RegisterProperty("myProperty", new Property.Value(10.0f), Property.AccessMode.READ_WRITE);
- float myProperty = 0.0f;
- handle.GetProperty(myPropertyIndex).Get(ref myProperty);
- Console.WriteLine( "myProperty value: " + myProperty );
-
- int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Size(5.0f, 5.0f)), Property.AccessMode.READ_WRITE);
- Size myProperty2 = new Size(0.0f, 0.0f);
- handle.GetProperty(myPropertyIndex2).Get(myProperty2);
- Console.WriteLine( "myProperty2 value: " + myProperty2.W + ", " + myProperty2.H );
-
- Actor actor = new Actor();
- actor.Size = new Position(200.0f, 200.0f, 0.0f);
- actor.Name = "MyActor";
- actor.Color = new Color(1.0f, 0.0f, 1.0f, 0.8f);
- Console.WriteLine("Actor id: {0}", actor.GetId());
- Console.WriteLine("Actor size: " + actor.Size.X + ", " + actor.Size.Y);
- Console.WriteLine("Actor name: " + actor.Name);
-
- Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = Color.White;
-
- Size stageSize = stage.Size;
- Console.WriteLine("Stage size: " + stageSize.W + ", " + stageSize.H);
- stage.Add(actor);
-
- TextLabel text = new TextLabel("Hello Mono World");
- text.ParentOrigin = NDalic.ParentOriginCenter;
- text.AnchorPoint = NDalic.AnchorPointCenter;
- text.HorizontalAlignment = "CENTER";
- stage.Add(text);
-
- Console.WriteLine( "Text label text: " + text.Text );
-
- Console.WriteLine( "Text label point size: " + text.PointSize );
- text.PointSize = 32.0f;
- Console.WriteLine( "Text label new point size: " + text.PointSize );
-
- using (RectInteger ri = new RectInteger(02,05,20,30))
- {
- Console.WriteLine( " Created " + ri );
- Console.WriteLine( " IsEmpty() = " + ri.IsEmpty() );
- Console.WriteLine( " Left = " + ri.Left() );
- Console.WriteLine( " Right = " + ri.Right() );
- Console.WriteLine( " Top = " + ri.Top() );
- Console.WriteLine( " Bottom = " + ri.Bottom() );
- Console.WriteLine( " Area = " + ri.Area() );
- }
- Console.WriteLine( " *************************" );
- using (RectInteger ri2 = new RectInteger(02,05,20,30))
- {
- Console.WriteLine( " Created " + ri2 );
- ri2.Set(1,1,40,40);
- Console.WriteLine( " IsEmpty() = " + ri2.IsEmpty() );
- Console.WriteLine( " Left = " + ri2.Left() );
- Console.WriteLine( " Right = " + ri2.Right() );
- Console.WriteLine( " Top = " + ri2.Top() );
- Console.WriteLine( " Bottom = " + ri2.Bottom() );
- Console.WriteLine( " Area = " + ri2.Area() );
- }
- Console.WriteLine( " *************************" );
- using (RectDouble rd = new RectDouble(02,05,20.5,30.5))
- {
- Console.WriteLine( " Created " + rd );
- Console.WriteLine( " IsEmpty() = " + rd.IsEmpty() );
- Console.WriteLine( " Left = " + rd.Left() );
- Console.WriteLine( " Right = " + rd.Right() );
- Console.WriteLine( " Top = " + rd.Top() );
- Console.WriteLine( " Bottom = " + rd.Bottom() );
- Console.WriteLine( " Area = " + rd.Area() );
- }
- Console.WriteLine( " *************************" );
- RectDouble rd2 = new RectDouble();
- rd2.x = 10;
- rd2.y = 10;
- rd2.width = 20;
- rd2.height = 20;
- Console.WriteLine( " Created " + rd2 );
- Console.WriteLine( " IsEmpty() = " + rd2.IsEmpty() );
- Console.WriteLine( " Left = " + rd2.Left() );
- Console.WriteLine( " Right = " + rd2.Right() );
- Console.WriteLine( " Top = " + rd2.Top() );
- Console.WriteLine( " Bottom = " + rd2.Bottom() );
- Console.WriteLine( " Area = " + rd2.Area() );
-
- Console.WriteLine( " *************************" );
- Size Size = new Size(100, 50);
- Console.WriteLine( " Created " + Size );
- Console.WriteLine( " Size x = " + Size.W + ", y = " + Size.H );
- Size += new Size(20, 20);
- Console.WriteLine( " Size x = " + Size.W + ", y = " + Size.H );
- Size.W += 10;
- Size.H += 10;
- Console.WriteLine( " Size width = " + Size.W + ", height = " + Size.H );
-
- Console.WriteLine( " *************************" );
- Position Position = new Position(20, 100, 50);
- Console.WriteLine( " Created " + Position );
- Console.WriteLine( " Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z );
- Position += new Position(20, 20, 20);
- Console.WriteLine( " Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z );
- Position.X += 10;
- Position.Y += 10;
- Position.Z += 10;
- Console.WriteLine( " Position width = " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z );
- Position parentOrigin = new Dali.Position(NDalic.ParentOriginBottomRight);
- Console.WriteLine( " parentOrigin x = " + parentOrigin.X + ", y = " + parentOrigin.Y + ", z = " + parentOrigin.Z );
-
- Console.WriteLine( " *************************" );
- Color color = new Color(20, 100, 50, 200);
- Console.WriteLine( " Created " + color );
- Console.WriteLine( " Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A );
- color += new Color(20, 20, 20, 20);
- Console.WriteLine( " Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A );
- color.R += 10;
- color.G += 10;
- color.B += 10;
- color.A += 10;
- Console.WriteLine( " Color r = " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A );
- }
-
-
- public void OperatorTests()
- {
- Actor actor = new Actor();
- Actor differentActor = new Actor();
- Actor actorSame = actor;
- Actor nullActor = null;
-
- // test the true operator
- if ( actor )
- {
- Console.WriteLine ("BaseHandle Operator true (actor) : test passed ");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator true (actor): test failed ");
- }
-
- Actor parent = actor.GetParent ();
-
- if ( parent )
- {
- Console.WriteLine ("Handle with Empty body :failed ");
- }
- else
- {
- Console.WriteLine ("Valid with Empty body :passed ");
- }
-
- actor.Add( differentActor );
- // here we test two different C# objects, which on the native side have the same body/ ref-object
- if ( actor == differentActor.GetParent() )
- {
- Console.WriteLine ("actor == differentActor.GetParent() :passed ");
- }
- else
- {
- Console.WriteLine ("actor == differentActor.GetParent() :failed ");
- }
-
- if ( differentActor == differentActor.GetParent() )
- {
- Console.WriteLine ("differentActor == differentActor.GetParent() :failed ");
- }
- else
- {
- Console.WriteLine ("differentActor == differentActor.GetParent() :passed ");
- }
-
-
- if ( nullActor )
- {
- Console.WriteLine ("BaseHandle Operator true (nullActor) : test failed ");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator true (nullActor): test passed ");
- }
-
- // ! operator
- if ( !actor )
- {
- Console.WriteLine ("BaseHandle Operator !(actor) : test failed ");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator !(actor): test passed ");
- }
-
- if ( !nullActor )
- {
- Console.WriteLine ("BaseHandle Operator !(nullActor) : test passed ");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator !(nullActor): test failed ");
- }
-
- // Note: operator false only used inside & operator
- // test equality operator ==
- if ( actor == actorSame )
- {
- Console.WriteLine ("BaseHandle Operator (actor == actorSame) : test passed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (actor == actorSame) : test failed");
+ class Example
+ {
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate void CallbackDelegate(IntPtr appPtr); // void, void delgate
+
+ private Dali.Application _application;
+
+ public Example(Dali.Application application)
+ {
+ _application = application;
+ Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() );
+
+ _application.Initialized += Initialize;
+ Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() );
+ }
+
+ 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;
+ handle.GetProperty(myPropertyIndex).Get(ref myProperty);
+ Console.WriteLine( "myProperty value: " + myProperty );
+
+ int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Size(5.0f, 5.0f)), Property.AccessMode.READ_WRITE);
+ Size myProperty2 = new Size(0.0f, 0.0f);
+ handle.GetProperty(myPropertyIndex2).Get(myProperty2);
+ Console.WriteLine( "myProperty2 value: " + myProperty2.W + ", " + myProperty2.H );
+
+ Actor actor = new Actor();
+ actor.Size = new Position(200.0f, 200.0f, 0.0f);
+ actor.Name = "MyActor";
+ actor.Color = new Color(1.0f, 0.0f, 1.0f, 0.8f);
+ Console.WriteLine("Actor id: {0}", actor.GetId());
+ Console.WriteLine("Actor size: " + actor.Size.X + ", " + actor.Size.Y);
+ Console.WriteLine("Actor name: " + actor.Name);
+
+ Stage stage = Stage.GetCurrent();
+ stage.BackgroundColor = Color.White;
+ Size stageSize = stage.Size;
+ Console.WriteLine("Stage size: " + stageSize.W + ", " + stageSize.H);
+ stage.Add(actor);
+
+ TextLabel text = new TextLabel("Hello Mono World");
+ text.ParentOrigin = NDalic.ParentOriginCenter;
+ text.AnchorPoint = NDalic.AnchorPointCenter;
+ text.HorizontalAlignment = "CENTER";
+ stage.Add(text);
+
+ Console.WriteLine( "Text label text: " + text.Text );
+
+ Console.WriteLine( "Text label point size: " + text.PointSize );
+ text.PointSize = 32.0f;
+ Console.WriteLine( "Text label new point size: " + text.PointSize );
+
+ RectanglePaddingClassTest();
+
+ Console.WriteLine( " *************************" );
+ Size Size = new Size(100, 50);
+ Console.WriteLine( " Created " + Size );
+ Console.WriteLine( " Size x = " + Size.W + ", y = " + Size.H );
+ Size += new Size(20, 20);
+ Console.WriteLine( " Size x = " + Size.W + ", y = " + Size.H );
+ Size.W += 10;
+ Size.H += 10;
+ Console.WriteLine( " Size width = " + Size.W + ", height = " + Size.H );
+
+ Console.WriteLine( " *************************" );
+ Position Position = new Position(20, 100, 50);
+ Console.WriteLine( " Created " + Position );
+ Console.WriteLine( " Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z );
+ Position += new Position(20, 20, 20);
+ Console.WriteLine( " Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z );
+ Position.X += 10;
+ Position.Y += 10;
+ Position.Z += 10;
+ Console.WriteLine( " Position width = " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z );
+ Position parentOrigin = new Dali.Position(NDalic.ParentOriginBottomRight);
+ Console.WriteLine( " parentOrigin x = " + parentOrigin.X + ", y = " + parentOrigin.Y + ", z = " + parentOrigin.Z );
+
+ Console.WriteLine( " *************************" );
+ Color color = new Color(20, 100, 50, 200);
+ Console.WriteLine( " Created " + color );
+ Console.WriteLine( " Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A );
+ color += new Color(20, 20, 20, 20);
+ Console.WriteLine( " Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A );
+ color.R += 10;
+ color.G += 10;
+ color.B += 10;
+ color.A += 10;
+ Console.WriteLine( " Color r = " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A );
+ }
+
+ public void RectanglePaddingClassTest()
+ {
+ using (Rectangle r1 = new Rectangle(2, 5, 20, 30))
+ {
+ Console.WriteLine( " Created " + r1 );
+ Console.WriteLine( " IsEmpty() = " + r1.IsEmpty() );
+ Console.WriteLine( " Left = " + r1.Left() );
+ Console.WriteLine( " Right = " + r1.Right() );
+ Console.WriteLine( " Top = " + r1.Top() );
+ Console.WriteLine( " Bottom = " + r1.Bottom() );
+ Console.WriteLine( " Area = " + r1.Area() );
+ }
+
+ Console.WriteLine( " *************************" );
+
+ using (Rectangle r2 = new Rectangle(2, 5, 20, 30))
+ {
+ Console.WriteLine( " Created " + r2 );
+ r2.Set(1,1,40,40);
+ Console.WriteLine( " IsEmpty() = " + r2.IsEmpty() );
+ Console.WriteLine( " Left = " + r2.Left() );
+ Console.WriteLine( " Right = " + r2.Right() );
+ Console.WriteLine( " Top = " + r2.Top() );
+ Console.WriteLine( " Bottom = " + r2.Bottom() );
+ Console.WriteLine( " Area = " + r2.Area() );
+ }
+
+ Console.WriteLine( " *************************" );
+
+ Rectangle r3 = new Rectangle(10, 10, 20, 20);
+ Rectangle r4 = new Rectangle(10, 10, 20, 20);
+
+ if (r3 == r4)
+ {
+ Console.WriteLine("r3 == r4");
+ }
+ else
+ {
+ Console.WriteLine("r3 != r4");
+ }
+
+ r4 = new Rectangle(12, 10, 20, 20);
+
+ if (r3 == r4)
+ {
+ Console.WriteLine("r3 == r4");
+ }
+ else
+ {
+ Console.WriteLine("r3 != r4");
+ }
+
+ PaddingType p1 = new PaddingType(10.5f, 10.7f, 20.8f, 20.8f);
+ PaddingType p2 = new PaddingType(10.5f, 10.7f, 20.8f, 20.8f);
+
+ if (p1 == p2)
+ {
+ Console.WriteLine("p1 == p2");
+ }
+ else
+ {
+ Console.WriteLine("p1 != p2");
+ }
+
+ p2 = new PaddingType(12.0f, 10.7f, 20.2f, 20.0f);
+
+ if (p1 == p2)
+ {
+ Console.WriteLine("p1 == p2");
+ }
+ else
+ {
+ Console.WriteLine("p1 != p2");
+ }
+ }
+
+ public void OperatorTests()
+ {
+ Actor actor = new Actor();
+ Actor differentActor = new Actor();
+ Actor actorSame = actor;
+ Actor nullActor = null;
+
+ // test the true operator
+ if ( actor )
+ {
+ Console.WriteLine ("BaseHandle Operator true (actor) : test passed ");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator true (actor): test failed ");
+ }
+
+ Actor parent = actor.GetParent ();
+
+ if ( parent )
+ {
+ Console.WriteLine ("Handle with Empty body :failed ");
+ }
+ else
+ {
+ Console.WriteLine ("Valid with Empty body :passed ");
+ }
+
+ actor.Add( differentActor );
+
+ // here we test two different C# objects, which on the native side have the same body/ ref-object
+ if ( actor == differentActor.GetParent() )
+ {
+ Console.WriteLine ("actor == differentActor.GetParent() :passed ");
+ }
+ else
+ {
+ Console.WriteLine ("actor == differentActor.GetParent() :failed ");
+ }
+
+ if ( differentActor == differentActor.GetParent() )
+ {
+ Console.WriteLine ("differentActor == differentActor.GetParent() :failed ");
+ }
+ else
+ {
+ Console.WriteLine ("differentActor == differentActor.GetParent() :passed ");
+ }
+
+ if ( nullActor )
+ {
+ Console.WriteLine ("BaseHandle Operator true (nullActor) : test failed ");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator true (nullActor): test passed ");
+ }
+
+ // ! operator
+ if ( !actor )
+ {
+ Console.WriteLine ("BaseHandle Operator !(actor) : test failed ");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator !(actor): test passed ");
+ }
+
+ if ( !nullActor )
+ {
+ Console.WriteLine ("BaseHandle Operator !(nullActor) : test passed ");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator !(nullActor): test failed ");
+ }
+
+ // Note: operator false only used inside & operator
+ // test equality operator ==
+ if ( actor == actorSame )
+ {
+ Console.WriteLine ("BaseHandle Operator (actor == actorSame) : test passed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (actor == actorSame) : test failed");
+ }
+
+ if ( actor == differentActor )
+ {
+ Console.WriteLine ("BaseHandle Operator (actor == differentActor) : test failed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (actor == differentActor) : test passed");
+ }
+
+ if ( actor == nullActor )
+ {
+ Console.WriteLine ("BaseHandle Operator (actor == nullActor) : test failed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (actor == nullActor) : test passed");
+ }
+
+ if ( nullActor == nullActor )
+ {
+ Console.WriteLine ("BaseHandle Operator (nullActor == nullActor) : test passed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (nullActor == nullActor) : test failed");
+ }
+
+ // test || operator
+ if ( actor || actorSame )
+ {
+ Console.WriteLine ("BaseHandle Operator (actor || actorSame) : test passed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (actor || actorSame) : test failed");
+ }
+
+ if ( actor || nullActor )
+ {
+ Console.WriteLine ("BaseHandle Operator (actor || nullActor) : test passed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (actor || nullActor) : test failed");
+ }
+
+ if ( nullActor || nullActor )
+ {
+ Console.WriteLine ("BaseHandle Operator (nullActor || nullActor) : test failed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (nullActor || nullActor) : test passed");
+ }
+
+ // test && operator
+ if ( actor && actorSame )
+ {
+ Console.WriteLine ("BaseHandle Operator (actor && actorSame) : test passed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (actor && actorSame) : test failed");
+ }
+
+ if ( actor && nullActor )
+ {
+ Console.WriteLine ("BaseHandle Operator (actor && nullActor) : test failed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (actor && nullActor) : test passed");
+ }
+
+ if ( nullActor && nullActor )
+ {
+ Console.WriteLine ("BaseHandle Operator (nullActor && nullActor) : test failed");
+ }
+ else
+ {
+ Console.WriteLine ("BaseHandle Operator (nullActor && nullActor) : test passed");
+ }
+ }
+
+ 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 ();
+ }
+
+ /// <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());
+ example.MainLoop ();
+ }
}
-
- if ( actor == differentActor )
- {
- Console.WriteLine ("BaseHandle Operator (actor == differentActor) : test failed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (actor == differentActor) : test passed");
- }
-
- if ( actor == nullActor )
- {
- Console.WriteLine ("BaseHandle Operator (actor == nullActor) : test failed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (actor == nullActor) : test passed");
- }
-
- if ( nullActor == nullActor )
- {
- Console.WriteLine ("BaseHandle Operator (nullActor == nullActor) : test passed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (nullActor == nullActor) : test failed");
- }
-
- // test || operator
- if ( actor || actorSame )
- {
- Console.WriteLine ("BaseHandle Operator (actor || actorSame) : test passed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (actor || actorSame) : test failed");
- }
-
- if ( actor || nullActor )
- {
- Console.WriteLine ("BaseHandle Operator (actor || nullActor) : test passed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (actor || nullActor) : test failed");
- }
-
- if ( nullActor || nullActor )
- {
- Console.WriteLine ("BaseHandle Operator (nullActor || nullActor) : test failed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (nullActor || nullActor) : test passed");
- }
-
-
- // test && operator
- if ( actor && actorSame )
- {
- Console.WriteLine ("BaseHandle Operator (actor && actorSame) : test passed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (actor && actorSame) : test failed");
- }
-
- if ( actor && nullActor )
- {
- Console.WriteLine ("BaseHandle Operator (actor && nullActor) : test failed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (actor && nullActor) : test passed");
- }
-
- if ( nullActor && nullActor )
- {
- Console.WriteLine ("BaseHandle Operator (nullActor && nullActor) : test failed");
- }
- else
- {
- Console.WriteLine ("BaseHandle Operator (nullActor && nullActor) : test passed");
- }
-
- }
-
- 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());
- example.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)
extern "C" {
#endif
-SWIGEXPORT int SWIGSTDCALL CSharp_Actor_Property_BATCH_PARENT_get() {
+SWIGEXPORT int SWIGSTDCALL CSharp_Actor_Property_SIBLING_ORDER_get() {
int jresult ;
int result;
- result = (int)Dali::DevelActor::Property::BATCH_PARENT;
+ result = (int)Dali::DevelActor::Property::SIBLING_ORDER;
jresult = (int)result;
return jresult;
}
-SWIGEXPORT int SWIGSTDCALL CSharp_Actor_Property_SIBLING_ORDER_get() {
+SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_TOOLTIP_get() {
int jresult ;
int result;
- result = (int)Dali::DevelActor::Property::SIBLING_ORDER;
+ result = (int)Dali::Toolkit::DevelControl::Property::TOOLTIP;
jresult = (int)result;
return jresult;
}
-SWIGEXPORT int SWIGSTDCALL CSharp_Renderer_Property_BATCHING_ENABLED_get() {
+SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_STATE_get() {
int jresult ;
int result;
- result = (int)Dali::DevelRenderer::Property::BATCHING_ENABLED;
+ result = (int)Dali::Toolkit::DevelControl::Property::STATE;
jresult = (int)result;
return jresult;
}
-SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_TOOLTIP_get() {
+SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_SUB_STATE_get() {
int jresult ;
int result;
- result = (int)Dali::Toolkit::DevelControl::Property::TOOLTIP;
+ result = (int)Dali::Toolkit::DevelControl::Property::SUB_STATE;
jresult = (int)result;
return jresult;
}
}
-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;
}
*/
using System;
-namespace Dali
+namespace Dali
{
namespace Constants
{
- public enum TextureType
+ public enum TextureType
{
Texture2D = Dali.TextureType.TEXTURE_2D, ///< One 2D image @SINCE_1_1.43
TextureCube = Dali.TextureType.TEXTURE_CUBE ///< Six 2D images arranged in a cube-shape @SINCE_1_1.43
}
- public enum ViewMode
+ public enum ViewMode
{
Mono = Dali.ViewMode.MONO, ///< Monoscopic (single camera). This is the default @SINCE_1_0.0
StereoHorizontal = Dali.ViewMode.STEREO_HORIZONTAL, ///< Stereoscopic. Frame buffer is split horizontally with the left and right camera views in their respective sides. @SINCE_1_0.0
public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT;
public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING;
public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY;
- public static readonly int BatchingEnabled = NDalic.IMAGE_VISUAL_BATCHING_ENABLED;
public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA;
public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U;
public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V;
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();
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_MakeCallback")]
public static extern global::System.IntPtr MakeCallback(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Actor_Property_BATCH_PARENT_get")]
- public static extern int Actor_Property_BATCH_PARENT_get();
-
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Actor_Property_SIBLING_ORDER_get")]
public static extern int Actor_Property_SIBLING_ORDER_get();
- [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Renderer_Property_BATCHING_ENABLED_get")]
- public static extern int Renderer_Property_BATCHING_ENABLED_get();
-
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_TOOLTIP_get")]
public static extern int View_Property_TOOLTIP_get();
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_STATE_get")]
+ public static extern int View_Property_STATE_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_SUB_STATE_get")]
+ public static extern int View_Property_SUB_STATE_get();
+
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_ItemView_Property_LAYOUT_get")]
public static extern int ItemView_Property_LAYOUT_get();
///
/// 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();
["VECTOR4", "Vector4", "", "Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);"],
["MATRIX3", "Matrix3", "", "Matrix3 temp = new Matrix3();"],
["MATRIX", "Matrix", "", "Matrix temp = new Matrix();" ],
- ["RECTANGLE", "RectInteger", "", "RectInteger temp = new RectInteger(0,0,0,0);"],
+ ["RECTANGLE", "Rectangle", "", "Rectangle temp = new Rectangle(0,0,0,0);"],
["ROTATION", "Quaternion", "", "Quaternion temp = new Quaternion();"],
["STRING", "string", "out", "string temp;"],
["ARRAY", "Dali.Property.Array", "", "Dali.Property.Array temp = new Dali.Property.Array();"],
{
// 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)
{
}