ret=$?
if [ $ret -ne 6 ] ; then
if [ $opt_debug -ne 0 ] ; then
- if [ $ret -eq 0 ] ; then
- gdb --args build/src/$mod/tct-$mod-core $1
- fi
+ gdb --args build/src/$mod/tct-$mod-core $1
else
echo $output
if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
* limitations under the License.
*
*/
+
+// CLASS HEADER
#include "mesh-builder.h"
+// EXTERNAL INCLUDES
+#include <dali/devel-api/images/texture-set-image.h>
+
namespace Dali
{
{
return TextureSet::New();
}
+
TextureSet CreateTextureSet( Image image )
{
TextureSet textureSet = TextureSet::New();
- textureSet.SetImage( 0u, image );
+ TextureSetImage( textureSet, 0u, image );
return textureSet;
}
return vertexData;
}
+Geometry CreateQuadGeometry(void)
+{
+ PropertyBuffer vertexData = CreatePropertyBuffer();
+ const float halfQuadSize = .5f;
+ struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
+ TexturedQuadVertex texturedQuadVertexData[4] = {
+ { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
+ { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
+ { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
+ { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
+ vertexData.SetData(texturedQuadVertexData, 4);
+
+ unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
+
+ Geometry geometry = Geometry::New();
+ geometry.AddVertexBuffer( vertexData );
+ geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
+
+ return geometry;
+}
+
} // namespace Dali
#ifndef MESH_BUILDER_H
#define MESH_BUILDER_H
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
*
*/
+// EXTERNAL INCLUDES
#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/object/property-buffer.h>
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/texture-set.h>
-#include <dali/devel-api/rendering/sampler.h>
-#include <dali/devel-api/rendering/renderer.h>
namespace Dali
{
Shader CreateShader();
TextureSet CreateTextureSet();
TextureSet CreateTextureSet( Image image );
+Geometry CreateQuadGeometry();
PropertyBuffer CreatePropertyBuffer();
+
}
#endif // MESH_BUILDER_H
*
*/
-// HEADER
+// CLASS HEADER
#include "test-actor-utils.h"
-#include "mesh-builder.h"
// EXTERNAL INCLUDES
#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/devel-api/images/texture-set-image.h>
+
+// INTERNAL INCLUDES
+#include "mesh-builder.h"
namespace Dali
{
Actor CreateRenderableActor( Image texture, const std::string& vertexShader, const std::string& fragmentShader )
{
// Create the geometry
- Geometry geometry = Geometry::QUAD();
+ Geometry geometry = CreateQuadGeometry();
// Create Shader
Shader shader = Shader::New( vertexShader, fragmentShader );
if( texture )
{
TextureSet textureSet = TextureSet::New();
- textureSet.SetImage( 0u, texture );
+ TextureSetImage( textureSet, 0u, texture );
renderer.SetTextures( textureSet );
// Set actor to the size of the texture if set
TextureSet textureSet = renderer.GetTextures();
if( textureSet && textureSet.GetTextureCount() )
{
- image = textureSet.GetImage( 0u );
+ image = TextureGetImage( textureSet, 0u );
}
}
}
-#ifndef __DALI_TEST_ACTOR_UTILS_H__
-#define __DALI_TEST_ACTOR_UTILS_H__
+#ifndef DALI_TEST_ACTOR_UTILS_H
+#define DALI_TEST_ACTOR_UTILS_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
} // namespace Dali
-#endif // __DALI_TEST_ACTOR_UTILS_H__
+#endif // DALI_TEST_ACTOR_UTILS_H
-#ifndef __DALI_TOOLKIT_BITMAP_LOADER_H__
-#define __DALI_TOOLKIT_BITMAP_LOADER_H__
+#ifndef DALI_TOOLKIT_BITMAP_LOADER_H
+#define DALI_TOOLKIT_BITMAP_LOADER_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* limitations under the License.
*/
-#define __DALI_BITMAP_LOADER_H__
+#define DALI_BITMAP_LOADER_H
#include <string>
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/images/pixel.h>
#include <dali/public-api/images/image-operations.h>
+#include <dali/public-api/images/pixel.h>
+#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/object/base-handle.h>
-#include <dali/devel-api/images/pixel-data.h>
namespace Dali
{
} // Dali
-#endif /* __DALI_TOOLKIT_BITMAP_LOADER_H__ */
+#endif // DALI_TOOLKIT_BITMAP_LOADER_H
void GetFontMetrics( FontId fontId, FontMetrics& metrics ){}
GlyphIndex GetGlyphIndex( FontId fontId, Character charcode ){return 0;}
bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal ){return true;}
- BufferImage CreateBitmap( FontId fontId, GlyphIndex glyphIndex ){return BufferImage();}
+ PixelData CreateBitmap( FontId fontId, GlyphIndex glyphIndex ){return PixelData();}
void CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob,
unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight )
{
return GetImplementation(*this).GetGlyphMetrics( array, size, horizontal );
}
-BufferImage FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
+PixelData FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
{
return GetImplementation(*this).CreateBitmap( fontId, glyphIndex );
}
AccessibilityManager manager = AccessibilityManager::Get();
DALI_TEST_CHECK( manager );
+ Dali::AccessibilityAdaptor accAdaptor = Dali::AccessibilityAdaptor::Get();
+ Test::AccessibilityAdaptor::SetEnabled( accAdaptor, true );
+ accAdaptor.HandleActionEnableEvent();
+
+ Dali::Toolkit::PushButton button = Dali::Toolkit::PushButton::New();
+ button.SetSize(480, 800);
+ Stage::GetCurrent().Add(button);
+ manager.SetFocusOrder( button, 1 );
+ manager.SetCurrentFocusActor( button );
+
manager.ActionActivateSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
Dali::AccessibilityAdaptor accessibilityAdaptor = Dali::AccessibilityAdaptor::Get();
manager.ActionDownSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
- DummyControl dummyControl = DummyControl::New(true);
- dummyControl.SetSize(480, 800);
- manager.SetFocusOrder( dummyControl, 1 );
- Stage::GetCurrent().Add( dummyControl );
- manager.SetCurrentFocusActor( dummyControl );
+ Dali::Toolkit::PushButton button = Dali::Toolkit::PushButton::New();
+ button.SetSize(480, 800);
+ Stage::GetCurrent().Add(button);
+ manager.SetFocusOrder( button, 1 );
+ manager.SetCurrentFocusActor( button );
accessibilityAdaptor.HandleActionDownEvent();
AccessibilityManagerSignalHandler callback;
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK( manager );
+
+ Dali::Toolkit::PushButton button = Dali::Toolkit::PushButton::New();
+ button.SetSize(480, 800);
+ Stage::GetCurrent().Add(button);
+ manager.SetFocusOrder( button, 1 );
+ manager.SetCurrentFocusActor( button );
+
Dali::AccessibilityAdaptor accAdaptor = Dali::AccessibilityAdaptor::Get();
Test::AccessibilityAdaptor::SetEnabled( accAdaptor, true );
accAdaptor.HandleActionEnableEvent();
- AccessibilityManager manager = AccessibilityManager::Get();
- DALI_TEST_CHECK( manager );
-
manager.ActionZoomSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
Dali::AccessibilityAdaptor accessibilityAdaptor = Dali::AccessibilityAdaptor::Get();
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali-toolkit-test-suite-utils.h>
#include <dali.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h>
using namespace Dali;
using namespace Toolkit;
+namespace BuilderControlProperty
+{
+
+enum
+{
+ INTEGER_PROPERTY = Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1,
+ MATRIX3_PROPERTY,
+ MATRIX_PROPERTY,
+ NONE_PROPERTY
+};
+
+namespace
+{
+
+BaseHandle Create()
+{
+ return Toolkit::Control::New();
+}
+
+int gSetPropertyCalledCount = 0;
+
+void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
+{
+ ++gSetPropertyCalledCount;
+}
+
+Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+ return Property::Value();
+}
+
+} // unnamed namespace
+
+// Properties
+Dali::TypeRegistration typeRegistration( "BuilderControl", typeid( Toolkit::Control ), Create );
+
+Dali::PropertyRegistration propertyInteger( typeRegistration, "integerProperty", INTEGER_PROPERTY, Property::INTEGER, &SetProperty, &GetProperty );
+Dali::PropertyRegistration propertyMatrix3( typeRegistration, "matrix3Property", MATRIX3_PROPERTY, Property::MATRIX3, &SetProperty, &GetProperty );
+Dali::PropertyRegistration propertyMatrix( typeRegistration, "matrixProperty", MATRIX_PROPERTY, Property::MATRIX, &SetProperty, &GetProperty );
+Dali::PropertyRegistration propertyNone( typeRegistration, "noneProperty", NONE_PROPERTY, Property::NONE, &SetProperty, &GetProperty );
+
+}
+
namespace
{
"{"
"\"stage\":"
"[{"
- "\"type\": \"Actor\","
+ "\"type\": \"Layer\","
"\"size\": [100,100,1],"
"\"parentOrigin\": \"TOP_LEFT\","
"\"anchorPoint\": \"TOP_LEFT\","
+ "\"maximumSize\": [100,100],"
+ "\"orientation\": [10,10,10,10],"
+ "\"clippingBox\": [10,10,10,10],"
"\"signals\": [{"
- "\"name\": \"touched\","
+ "\"name\": \"touch\","
"\"action\": \"quit\""
"}]"
"}]"
" \"size\": [200, 200, 1],"
" \"orientation\": [0, 0, 30],"
" \"signals\": [{"
- " \"name\": \"touched\","
+ " \"name\": \"touch\","
" \"action\": \"play\","
" \"animation\": \"animate\""
" }]"
" \"size\": [200, 200, 1],"
" \"orientation\": [0, 0, 30],"
" \"signals\": [{"
- " \"name\": \"touched\","
+ " \"name\": \"touch\","
" \"action\": \"play\","
" \"animation\": \"animate\""
" }]"
" \"image\": { \"url\": \"dir/{IMAGE_PATH}\" },"
" \"sizeWidth\": \"{WIDTH}\","
" \"signals\": [{"
- " \"name\": \"touched\","
+ " \"name\": \"touch\","
" \"action\": \"quit\""
" }]"
"}]"
" \"color\": [1,0,0,1],\n"
" \"actors\": {\n"
" \"childImage\": {\n"
- " \"color\": [0,1,0,1]\n"
+ " \"color\": \"34\"\n"
" }\n"
" }\n"
" }\n"
"},\n"
"\"templates\":\n"
"{\n"
+ " \"imageViewTemplate\": { \n"
+ " \"type\": \"ImageView\",\n"
+ " \"styles\": [\"imageStyle\"]\n"
+ " },\n"
" \"imageTree\": { \n"
" \"type\": \"ImageView\",\n"
" \"styles\": [\"imageStyle\"],\n"
" \"name\": \"image\",\n"
" \"size\": \"{SIZE}\",\n"
" \"signals\": [{\n"
- " \"name\": \"touched\",\n"
+ " \"name\": \"touch\",\n"
" \"action\": \"quit\"\n"
" }],\n"
" \"actors\": [\n"
" {\n"
" \"type\":\"ImageView\",\n"
- " \"name\":\"childImage\" \n"
+ " \"name\":\"childImage\", \n"
+ " \"color\": \n"
+ " {\n"
+ " \"r\": 10,\n"
+ " \"g\": 10,\n"
+ " \"b\": 10,\n"
+ " \"a\": 100\n"
+ " }\n"
+ " },\n"
+ " {\n"
+ " \"type\":\"imageViewTemplate\",\n"
+ " \"name\":\"childImage2\"\n"
" }\n"
" ]\n"
" }\n"
" \"color\": [1,0,0,1],\n"
" \"actors\": {\n"
" \"childImage\": {\n"
- " \"color\": [0,1,0,1]\n"
+ " \"color\": \"#344353\"\n"
" }\n"
" }\n"
"}\n"
" \"name\": \"image\",\n"
" \"size\": \"{SIZE}\",\n"
" \"signals\": [{\n"
- " \"name\": \"touched\",\n"
+ " \"name\": \"touch\",\n"
" \"action\": \"quit\"\n"
" }],\n"
" \"actors\": [\n"
"[\n"
" { \n"
" \"type\": \"CameraActor\",\n"
- " \"name\": \"image\"\n"
+ " \"name\": \"camera\"\n"
" }, \n"
" { \n"
" \"type\": \"ImageView\",\n"
" \"name\": \"image\",\n"
" \"size\": [100,100,1],\n"
" \"signals\": [{\n"
- " \"name\": \"touched\",\n"
+ " \"name\": \"touch\",\n"
" \"action\": \"quit\"\n"
" }],\n"
" \"actors\": [\n"
" \"name\": \"subActor\"\n"
" }],\n"
" \"signals\": [{\n"
- " \"name\": \"touched\",\n"
+ " \"name\": \"touch\",\n"
" \"action\": \"hide\",\n"
" \"actor\": \"actor\",\n"
" \"childActor\": \"subActor\"\n"
" \"name\": \"subActor\"\n"
" }],\n"
" \"signals\": [{\n"
- " \"name\": \"touched\",\n"
+ " \"name\": \"touch\",\n"
" \"action\": \"set\",\n"
" \"actor\": \"subActor\",\n"
" \"property\": \"visible\",\n"
" \"name\": \"subActor\"\n"
" }],\n"
" \"signals\": [{\n"
- " \"name\": \"touched\",\n"
+ " \"name\": \"touch\",\n"
" \"action\": \"hide\"\n"
" }]\n"
" }]\n"
" \"name\": \"subActor\"\n"
" }],\n"
" \"signals\": [{\n"
- " \"name\": \"touched\",\n"
+ " \"name\": \"touch\",\n"
" \"action\": \"hide\"\n"
" }],\n"
" \"notifications\": [{\n"
" \"property\": \"visible\",\n"
" \"condition\": \"False\",\n"
" \"action\": \"show\"\n"
+ " },\n"
+ " {\n"
+ " \"property\": \"positionX\",\n"
+ " \"condition\": \"LessThan\",\n"
+ " \"arg0\": 0.0,\n"
+ " \"action\": \"show\"\n"
+ " },\n"
+ " {\n"
+ " \"property\": \"positionY\",\n"
+ " \"condition\": \"GreaterThan\",\n"
+ " \"arg0\": 200.0,\n"
+ " \"action\": \"show\"\n"
+ " },\n"
+ " {\n"
+ " \"property\": \"positionZ\",\n"
+ " \"condition\": \"Inside\",\n"
+ " \"arg0\": 0.0,\n"
+ " \"arg1\": 10.0,\n"
+ " \"action\": \"show\"\n"
+ " },\n"
+ " {\n"
+ " \"property\": \"positionZ\",\n"
+ " \"condition\": \"Outside\",\n"
+ " \"arg0\": 40.0,\n"
+ " \"arg1\": 50.0,\n"
+ " \"action\": \"show\"\n"
" }]\n"
" }]\n"
"}\n"
END_TEST;
}
+int UtcDaliBuilderPropertyNotificationN(void)
+{
+ ToolkitTestApplication application;
+
+ // JSON with a quit event when the actor is touched
+ std::string json(
+ "{\n"
+ " \"stage\":\n"
+ " [{\n"
+ " \"type\": \"Actor\",\n"
+ " \"notifications\": [{\n"
+ " \"property\": \"visible\",\n"
+ " \"condition\": \"ErrorCondition\",\n"
+ " \"action\": \"show\"\n"
+ " }]\n"
+ " }]\n"
+ "}\n"
+ );
+
+ try
+ {
+ Builder builder = Builder::New();
+ builder.LoadFromString( json );
+ builder.AddActors ( Stage::GetCurrent().GetRootLayer() );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+
+
int UtcDaliBuilderCustomPropertyP(void)
{
ToolkitTestApplication application;
" \"name\": \"image\",\n"
" \"size\": [100,100,1],\n"
" \"signals\": [{\n"
- " \"name\": \"touched\",\n"
+ " \"name\": \"touch\",\n"
" \"action\": \"quit\"\n"
" }],\n"
" \"properties\": {\n"
"\"parentOrigin\": \"TOP_LEFT\","
"\"anchorPoint\": \"TOP_LEFT\","
"\"signals\": [{"
- "\"name\": \"touched\","
+ "\"name\": \"touch\","
"\"action\": \"quit\""
"}]"
"}]"
" \"visible\": false\n"
" }],\n"
" \"signals\": [{\n"
- " \"name\": \"touched\",\n"
+ " \"name\": \"touch\",\n"
" \"action\": \"hide\",\n"
" \"actor\": \"actor\",\n"
" \"childActor\": \"subActor\"\n"
" \"range\": [-300,300]\n"
" }\n"
" ]\n"
+ " },\n"
+ " {\n"
+ " \"name\": \"offStage\",\n"
+ " \"action\": \"removeConstraints\",\n"
+ " \"constrainer\": \"constrainer0\",\n"
+ " \"properties\":\n"
+ " [\n"
+ " {\n"
+ " \"source\": \"Image1\",\n"
+ " \"sourceProperty\": \"positionX\",\n"
+ " \"target\": \"Image1\",\n"
+ " \"targetProperty\": \"colorRed\",\n"
+ " \"range\": [-300,300]\n"
+ " }\n"
+ " ]\n"
+ " },\n"
+ " {\n"
+ " \"name\": \"offStage\",\n"
+ " \"action\": \"removeConstraints\",\n"
+ " \"constrainer\": \"constrainer1\",\n"
+ " \"properties\":\n"
+ " [\n"
+ " {\n"
+ " \"source\": \"Image1\",\n"
+ " \"sourceProperty\": \"positionX\",\n"
+ " \"target\": \"Image1\",\n"
+ " \"targetProperty\": \"colorBlue\",\n"
+ " \"range\": [-300,300]\n"
+ " }\n"
+ " ]\n"
" }\n"
" ]\n"
" }\n"
Dali::LinearConstrainer constrainer1_2 = builder.GetLinearConstrainer( "constrainer1" );
DALI_TEST_CHECK( constrainer1 == constrainer1_2 );
+ // For coverage
+
+ Actor actor = Actor::New();
+ Stage::GetCurrent().Add( actor );
+ builder.AddActors( actor );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ actor.GetChildAt( 0 ).Unparent();
+
END_TEST;
}
END_TEST;
}
+
+int UtcDaliBuilderTypeCasts(void)
+{
+ ToolkitTestApplication application;
+
+ std::string json(
+ "{"
+ "\"stage\":"
+ "[{"
+ "\"type\": \"Layer\","
+ "\"maximumSize\": { \"typeCast\":\"vector2\", \"value\":[100,15] },"
+ "\"position\": { \"typeCast\":\"vector3\", \"value\":[100,10,1] },"
+ "\"color\": { \"typeCast\":\"vector4\", \"value\":[0.5,0.5,0.5,1] },"
+ "\"sensitive\": { \"typeCast\":\"boolean\", \"value\":false },"
+ "\"orientation\": { \"typeCast\":\"rotation\", \"value\":[10,10,10,10] },"
+ "\"colorMode\": { \"typeCast\":\"string\", \"value\":\"USE_OWN_MULTIPLY_PARENT_COLOR\" },"
+ "\"clippingBox\": { \"typeCast\":\"rect\", \"value\":[10,10,10,10] }"
+ "}]"
+ "}"
+ );
+
+ Actor rootActor = Actor::New();
+ Stage::GetCurrent().Add( rootActor );
+
+ Builder builder = Builder::New();
+ builder.LoadFromString( json );
+ builder.AddActors( rootActor );
+
+ application.SendNotification();
+ application.Render();
+
+ Actor createdActor = rootActor.GetChildAt( 0 );
+ DALI_TEST_EQUALS( createdActor.GetMaximumSize(), Vector2(100.0f,15.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( createdActor.GetCurrentPosition(), Vector3(100.0f,10.0f,1.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( createdActor.GetCurrentColor(), Vector4(0.5f,0.5f,0.5f,1.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS( createdActor.IsSensitive(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( createdActor.GetColorMode(), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliBuilderBuilderControl(void)
+{
+ ToolkitTestApplication application;
+
+ std::string json(
+ "{"
+ "\"stage\":"
+ "[{"
+ "\"type\": \"BuilderControl\","
+ "\"integerProperty\": 10,"
+ "\"matrix3Property\": [ 1,2,3,4,5,6,7,8,9 ],"
+ "\"matrixProperty\": [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ],"
+ "\"noneProperty\": 10"
+ "}]"
+ "}"
+ );
+
+ Actor rootActor = Actor::New();
+ Stage::GetCurrent().Add( rootActor );
+
+ Builder builder = Builder::New();
+ builder.LoadFromString( json );
+ builder.AddActors( rootActor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( BuilderControlProperty::gSetPropertyCalledCount, 4, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliBuilderActionsWithParams(void)
+{
+ ToolkitTestApplication application;
+
+ // JSON with a quit event when the actor is touched
+ std::string json(
+ "{\n"
+ "\"stage\":\n"
+ "[\n"
+ " { \n"
+ " \"type\": \"ImageView\",\n"
+ " \"name\": \"image\",\n"
+ " \"size\": [100,100,1],\n"
+ " \"signals\": [{\n"
+ " \"name\": \"touch\",\n"
+ " \"action\": \"show\",\n"
+ " \"parameters\": {\n"
+ " \"property1\" : 10,\n"
+ " \"property2\" : [1,2],\n"
+ " \"property3\" : [1,2,3],\n"
+ " \"property4\" : [1,2,3,4]\n"
+ " }\n"
+ " }]\n"
+ " }\n"
+ "]\n"
+ "}\n"
+ );
+
+ Builder builder = Builder::New();
+ builder.LoadFromString( json );
+ builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+
+ DALI_TEST_CHECK( true ); // For Coverage
+
+ END_TEST;
+}
bool* mCallbackFlag;
};
-
-Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
-{
- BufferImage imageData = BufferImage::New( width, height, Pixel::RGBA8888 );
-
- // Create the image
- PixelBuffer* pixbuf = imageData.GetBuffer();
- unsigned int size = width * height;
-
- for( size_t i = 0; i < size; i++ )
- {
- pixbuf[i*4+0] = 0xFF * color.r;
- pixbuf[i*4+1] = 0xFF * color.g;
- pixbuf[i*4+2] = 0xFF * color.b;
- pixbuf[i*4+3] = 0xFF * color.a;
- }
-
- imageData.Update();
-
- return imageData;
-}
-
Dali::Integration::Point GetPointDownInside()
{
Dali::Integration::Point point;
DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliButtonSetSelectedBackgroundImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetSelectedBackgroundImage( "TestImage.jpg");
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetSelectedBackgroundImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetSelectedBackgroundImage( "TestImage.jpg");
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetDisabledImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetDisabledImage( "TestImage.jpg");
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetDisabledImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetDisabledImage( "TestImage.jpg");
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetDisabledSelectedImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetDisabledSelectedImage( "TestImage.jpg");
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetDisabledSelectedImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetDisabledSelectedImage( "TestImage.jpg");
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetLabelP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetLabel( TextLabel::New("Hello") );
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetLabelN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetLabel( TextLabel::New("Hello") );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetButtonImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetButtonImage( CreateBufferImage( 10, 10, Color::WHITE ) );
+ DALI_TEST_CHECK( ImageView::DownCast( button.GetButtonImage() ) );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetButtonImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetButtonImage( CreateBufferImage( 10, 10, Color::WHITE ) );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetSelectedImageWithImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetSelectedImage( CreateBufferImage( 10, 10, Color::WHITE ) );
+ DALI_TEST_CHECK( ImageView::DownCast( button.GetSelectedImage() ) );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetSelectedImageWithImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetSelectedImage( CreateBufferImage( 10, 10, Color::WHITE ) );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetSelectedColorP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetSelectedColorP");
+
+ PushButton pushButton = PushButton::New();
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector4 SET_COLOR = Color::BLUE;
+
+ pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
+ pushButton.SetProperty( Button::Property::SELECTED_COLOR, SET_COLOR );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::SELECTED_COLOR );
+
+ DALI_TEST_EQUALS( color, SET_COLOR, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliButtonSetUnSelectedColorP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliButtonSetUnSelectedColorP");
+
+ PushButton pushButton = PushButton::New();
+ Stage::GetCurrent().Add( pushButton );
+
+ application.SendNotification();
+ application.Render();
+
+ const Vector4 SET_COLOR = Color::BLUE;
+
+ pushButton.SetSize( Vector2( 20.0f, 20.0f ) );
+ pushButton.SetProperty( Button::Property::UNSELECTED_COLOR, SET_COLOR );
+
+ application.SendNotification();
+ application.Render();
+
+ Vector4 color = pushButton.GetProperty<Vector4>( Button::Property::UNSELECTED_COLOR );
+
+ DALI_TEST_EQUALS( color, SET_COLOR, TEST_LOCATION );
+
+ END_TEST;
+}
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <iostream>
#include <stdlib.h>
#include <dali-toolkit-test-suite-utils.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/texture-set.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/shader.h>
#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
using namespace Dali;
#include <dali-toolkit/devel-api/transition-effects/cube-transition-cross-effect.h>
#include <dali-toolkit/devel-api/transition-effects/cube-transition-fold-effect.h>
#include <dali-toolkit/devel-api/transition-effects/cube-transition-wave-effect.h>
+#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
#include <dali/public-api/images/buffer-image.h>
class TransitionCompletedCallback : public Dali::ConnectionTracker
{
public:
- TransitionCompletedCallback( bool& signalReceived, CubeTransitionEffect& effect, Image& image )
+ TransitionCompletedCallback( bool& signalReceived, CubeTransitionEffect& effect, Texture& image )
: mSignalVerified( signalReceived ),
mCurrentEffect( effect ),
mActorTransitTo( image )
{
}
- void Callback( CubeTransitionEffect effect, Image image )
+ void Callback( CubeTransitionEffect effect, Texture image )
{
tet_infoline( "Verifying TransitionCompletedSignal" );
bool& mSignalVerified;
CubeTransitionEffect& mCurrentEffect;
- Image& mActorTransitTo;
+ Texture& mActorTransitTo;
};
} // namespace
unsigned int totalNum = NUM_ROWS*NUM_COLUMNS;
- Image image = BufferImage::New( 40, 40 ) ;
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
waveEffect.SetSize( VIEW_AREA_SIZE );
Stage::GetCurrent().Add( waveEffect );
- waveEffect.SetCurrentImage( image );
- waveEffect.SetTargetImage( image );
+ waveEffect.SetCurrentTexture( texture );
+ waveEffect.SetTargetTexture( texture );
application.SendNotification();
application.Render();
tet_infoline(" UtcDaliCubeTransitionEffectIsTransiting ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image image = BufferImage::New( 40, 40 ) ;
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
waveEffect.SetSize( VIEW_AREA_SIZE );
waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
DALI_TEST_CHECK( !waveEffect.IsTransitioning() );
- waveEffect.SetCurrentImage( image );
- waveEffect.SetTargetImage( image );
+ waveEffect.SetCurrentTexture( texture );
+ waveEffect.SetTargetTexture( texture );
//transition is started
waveEffect.StartTransition();
DALI_TEST_CHECK( waveEffect.IsTransitioning() );
crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
DALI_TEST_CHECK( !crossEffect.IsTransitioning() );
- crossEffect.SetCurrentImage( image );
- crossEffect.SetTargetImage( image );
+ crossEffect.SetCurrentTexture( texture );
+ crossEffect.SetTargetTexture( texture );
//transition is started
crossEffect.StartTransition(false);
DALI_TEST_CHECK( crossEffect.IsTransitioning() );
foldEffect.SetTransitionDuration( TRANSITION_DURATION );
DALI_TEST_CHECK( !foldEffect.IsTransitioning() );
- foldEffect.SetCurrentImage( image );
- foldEffect.SetTargetImage( image );
+ foldEffect.SetCurrentTexture( texture );
+ foldEffect.SetTargetTexture( texture );
//transition is started
foldEffect.StartTransition(true);
DALI_TEST_CHECK(foldEffect.IsTransitioning() );
}
//Test common codes in base class
-int UtcDaliCubeTransitionEffectSetCurrentImage(void)
+int UtcDaliCubeTransitionEffectSetCurrentTexture(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliCubeTransitionEffectSetCurrentImage ");
+ tet_infoline(" UtcDaliCubeTransitionEffectSetCurrentTexture ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image image = BufferImage::New( 40, 40 ) ;
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
waveEffect.SetSize( VIEW_AREA_SIZE );
- waveEffect.SetCurrentImage( image );
+ waveEffect.SetCurrentTexture( texture );
Stage::GetCurrent().Add( waveEffect );
}
//Test common codes in base class
-int UtcDaliCubeTransitionEffectSetTargetImage(void)
+int UtcDaliCubeTransitionEffectSetTargetTexture(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliCubeTransitionEffectSetTargetImage ");
+ tet_infoline(" UtcDaliCubeTransitionEffectSetTargetTexture ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image image = BufferImage::New( 30, 30 );
-
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
waveEffect.SetSize( VIEW_AREA_SIZE );
Stage::GetCurrent().Add( waveEffect );
- waveEffect.SetCurrentImage( image );
- waveEffect.SetTargetImage( image );
+ waveEffect.SetCurrentTexture( texture );
+ waveEffect.SetTargetTexture( texture );
Stage::GetCurrent().Add( waveEffect );
tet_infoline(" UtcDaliCubeTransitionWaveEffectStartTransition ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image image = ResourceImage::New( "Image.jpg" );
+
+ BitmapLoader loader = BitmapLoader::New( "Image.jpg" );
+ loader.Load();
+ PixelData pixelData = loader.GetPixelData();
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() );
+ texture.Upload( pixelData );
CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
waveEffect.SetSize( VIEW_AREA_SIZE );
waveEffect.SetTransitionDuration( TRANSITION_DURATION );
waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
- waveEffect.SetCurrentImage( image );
+ waveEffect.SetCurrentTexture( texture );
Stage::GetCurrent().Add( waveEffect );
Actor cube = waveEffect.GetChildAt(0).GetChildAt(0);
//check the cube rotation value and color values just before the end of different transitions
- waveEffect.SetTargetImage( image );
+ waveEffect.SetTargetTexture( texture );
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
- waveEffect.SetTargetImage( image );
+ waveEffect.SetTargetTexture( texture );
waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
- waveEffect.SetTargetImage( image );
+ waveEffect.SetTargetTexture( texture );
waveEffect.StartTransition(false);
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
- waveEffect.SetTargetImage( image );
+ waveEffect.SetTargetTexture( texture );
waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
tet_infoline(" UtcDaliCubeTransitionCrossEffectStartTransition ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image image = ResourceImage::New( "Image.jpg" );
+
+ BitmapLoader loader = BitmapLoader::New( "Image.jpg" );
+ loader.Load();
+ PixelData pixelData = loader.GetPixelData();
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() );
+ texture.Upload( pixelData );
CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
crossEffect.SetSize( VIEW_AREA_SIZE );
crossEffect.SetTransitionDuration( TRANSITION_DURATION );
crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
- crossEffect.SetCurrentImage( image );
- crossEffect.SetTargetImage( image );
+ crossEffect.SetCurrentTexture( texture );
+ crossEffect.SetTargetTexture( texture );
Stage::GetCurrent().Add( crossEffect );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
- crossEffect.SetTargetImage( image );
+ crossEffect.SetTargetTexture( texture );
crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
- crossEffect.SetTargetImage( image );
+ crossEffect.SetTargetTexture( texture );
crossEffect.StartTransition(false);
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
- crossEffect.SetTargetImage( image );
+ crossEffect.SetTargetTexture( texture );
crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
tet_infoline(" UtcDaliCubeTransitionFoldEffectStartTransition ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image image = BufferImage::New( 30, 30 );
-
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS );
foldEffect.SetSize( VIEW_AREA_SIZE );
foldEffect.SetTransitionDuration( TRANSITION_DURATION );
- foldEffect.SetCurrentImage( image );
- foldEffect.SetTargetImage( image );
+ foldEffect.SetCurrentTexture( texture );
+ foldEffect.SetTargetTexture( texture );
Stage::GetCurrent().Add( foldEffect );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
- foldEffect.SetTargetImage( image );
+ foldEffect.SetTargetTexture( texture );
foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
- foldEffect.SetTargetImage( image );
+ foldEffect.SetTargetTexture( texture );
foldEffect.StartTransition(false);
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), HALF_BRIGHTNESS, EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(),FULL_BRIGHTNESS, EPISILON, TEST_LOCATION );
- foldEffect.SetTargetImage( image );
+ foldEffect.SetTargetTexture( texture );
foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_BEFORE_END_DURATION );
DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( Dali::ANGLE_90, Vector3::YAXIS), EPISILON, TEST_LOCATION );
tet_infoline(" UtcDaliCubeTransitionEffectSignalTransitionCompleted ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image firstImage = BufferImage::New( 30, 30 );
- Image secondImage = BufferImage::New( 20, 20 );
- Image thirdImage = BufferImage::New( 40, 40 );
+ Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
+ Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
+ Texture thirdTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40 );
CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
waveEffect.SetSize( VIEW_AREA_SIZE );
bool signalVerified = false;
CubeTransitionEffect currentEffect;
- Image actorTransitTo;
+ Texture actorTransitTo;
TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
- //check that the wave effect is used to transit to secondImage
+ //check that the wave effect is used to transit to secondTexture
currentEffect = waveEffect;
- actorTransitTo = secondImage;
- waveEffect.SetCurrentImage( firstImage );
- waveEffect.SetTargetImage( secondImage );
+ actorTransitTo = secondTexture;
+ waveEffect.SetCurrentTexture( firstTexture );
+ waveEffect.SetTargetTexture( secondTexture );
waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_DURATION );
DALI_TEST_CHECK(callback.mSignalVerified);
callback.Reset();
- //check that the wave effect is used to transit to thirdImage
- actorTransitTo = thirdImage;
- waveEffect.SetTargetImage( thirdImage );
+ //check that the wave effect is used to transit to thirdTexture
+ actorTransitTo = thirdTexture;
+ waveEffect.SetTargetTexture( thirdTexture );
waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_DURATION );
DALI_TEST_CHECK(callback.mSignalVerified);
callback.Reset();
- //check that the cross effect is used to transit to secondImage
+ //check that the cross effect is used to transit to secondTexture
currentEffect = crossEffect;
- actorTransitTo = secondImage;
- crossEffect.SetCurrentImage( thirdImage );
- crossEffect.SetTargetImage( secondImage );
+ actorTransitTo = secondTexture;
+ crossEffect.SetCurrentTexture( thirdTexture );
+ crossEffect.SetTargetTexture( secondTexture );
crossEffect.StartTransition(true);
Wait( application, TRANSITION_DURATION );
DALI_TEST_CHECK(callback.mSignalVerified);
callback.Reset();
- //check that the cross effect is used to transit to firstImage
- actorTransitTo = firstImage;
- crossEffect.SetTargetImage( firstImage );
+ //check that the cross effect is used to transit to firstTexture
+ actorTransitTo = firstTexture;
+ crossEffect.SetTargetTexture( firstTexture );
crossEffect.StartTransition(false);
Wait( application, TRANSITION_DURATION );
DALI_TEST_CHECK(callback.mSignalVerified);
callback.Reset();
- //check that the fold effect is used to transit to secondImage
+ //check that the fold effect is used to transit to secondTexture
currentEffect = foldEffect;
- actorTransitTo = secondImage;
- foldEffect.SetCurrentImage( firstImage );
- foldEffect.SetTargetImage( secondImage );
+ actorTransitTo = secondTexture;
+ foldEffect.SetCurrentTexture( firstTexture );
+ foldEffect.SetTargetTexture( secondTexture );
foldEffect.StartTransition();
Wait( application, TRANSITION_DURATION );
DALI_TEST_CHECK( callback.mSignalVerified );
callback.Reset();
- //check that the fold effect is used to transit to thirdImage
- actorTransitTo = thirdImage;
- foldEffect.SetTargetImage( thirdImage );
+ //check that the fold effect is used to transit to thirdTexture
+ actorTransitTo = thirdTexture;
+ foldEffect.SetTargetTexture( thirdTexture );
foldEffect.StartTransition( false );
Wait( application, TRANSITION_DURATION );
DALI_TEST_CHECK( callback.mSignalVerified );
tet_infoline(" UtcDaliCubeTransitionEffectPauseResumeTransition ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image firstImage = BufferImage::New( 30, 30 );
- Image secondImage = BufferImage::New( 20, 20 );
+ Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
+ Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
waveEffect.SetSize( VIEW_AREA_SIZE );
bool signalVerified = false;
CubeTransitionEffect currentEffect;
- Image actorTransitTo;
+ Texture actorTransitTo;
TransitionCompletedCallback callback(signalVerified, currentEffect, actorTransitTo);
waveEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
crossEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
foldEffect.TransitionCompletedSignal().Connect( &callback, &TransitionCompletedCallback::Callback );
currentEffect = waveEffect;
- actorTransitTo = secondImage;
- waveEffect.SetCurrentImage( firstImage );
- waveEffect.SetTargetImage( secondImage );
+ actorTransitTo = secondTexture;
+ waveEffect.SetCurrentTexture( firstTexture );
+ waveEffect.SetTargetTexture( secondTexture );
// start transition; transit for 0.5*duration; pause for 0.5*duration;
// resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
// only until now the transition finished signal can be received
callback.Reset();
currentEffect = crossEffect;
- actorTransitTo = firstImage;
- crossEffect.SetCurrentImage( secondImage );
- crossEffect.SetTargetImage( firstImage );
+ actorTransitTo = firstTexture;
+ crossEffect.SetCurrentTexture( secondTexture );
+ crossEffect.SetTargetTexture( firstTexture );
// start transition; transit for 0.25*duration; pause for 0.2*duration;
// resume for 0.5*duration; pause for 0.2*duration; resume for another 0.25*duration;
// only until now the transition finished signal can be received
callback.Reset();
currentEffect = foldEffect;
- actorTransitTo = secondImage;
- foldEffect.SetCurrentImage( firstImage );
- foldEffect.SetTargetImage( secondImage );
+ actorTransitTo = secondTexture;
+ foldEffect.SetCurrentTexture( firstTexture );
+ foldEffect.SetTargetTexture( secondTexture );
// start transition; transit for 0.5*duration; pause for 0.5*duration;
// resume for 0.25*duration; pause for 0.25*duration; resume for another 0.25*duration;
// only until now the transition finished signal can be received
tet_infoline(" UtcDaliCubeTransitionWaveEffectStopTransition ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image firstImage = BufferImage::New( 30, 30 );
- Image secondImage = BufferImage::New( 20, 20 );
+ Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
+ Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
CubeTransitionEffect waveEffect = CubeTransitionWaveEffect::New( NUM_ROWS, NUM_COLUMNS );
waveEffect.SetSize( VIEW_AREA_SIZE );
waveEffect.SetTransitionDuration( TRANSITION_DURATION );
waveEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
- waveEffect.SetCurrentImage( firstImage );
- waveEffect.SetTargetImage( secondImage );
+ waveEffect.SetCurrentTexture( firstTexture );
+ waveEffect.SetTargetTexture( secondTexture );
Stage::GetCurrent().Add( waveEffect );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
- waveEffect.SetTargetImage( firstImage );
+ waveEffect.SetTargetTexture( firstTexture );
waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_DURATION*0.4f );
waveEffect.StopTransition();
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
- waveEffect.SetTargetImage( secondImage );
+ waveEffect.SetTargetTexture( secondTexture );
waveEffect.StartTransition(false);
Wait( application, TRANSITION_DURATION*0.6f );
waveEffect.StopTransition();
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
- waveEffect.SetTargetImage( firstImage );
+ waveEffect.SetTargetTexture( firstTexture );
waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_DURATION*0.8f );
waveEffect.StopTransition();
tet_infoline(" UtcDaliCubeTransitionCrossEffectStopTransition ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image firstImage = BufferImage::New( 30, 30 );
- Image secondImage = BufferImage::New( 20, 20 );
+ Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
+ Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
CubeTransitionEffect crossEffect = CubeTransitionCrossEffect::New( NUM_ROWS, NUM_COLUMNS );
crossEffect.SetSize( VIEW_AREA_SIZE );
crossEffect.SetTransitionDuration( TRANSITION_DURATION );
crossEffect.SetCubeDisplacement( CUBE_DISPLACEMENT );
- crossEffect.SetCurrentImage( firstImage );
- crossEffect.SetTargetImage( secondImage );
+ crossEffect.SetCurrentTexture( firstTexture );
+ crossEffect.SetTargetTexture( secondTexture );
Stage::GetCurrent().Add( crossEffect );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
- crossEffect.SetTargetImage( firstImage );
+ crossEffect.SetTargetTexture( firstTexture );
crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_DURATION*0.4f );
crossEffect.StopTransition();
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
- crossEffect.SetTargetImage( secondImage );
+ crossEffect.SetTargetTexture( secondTexture );
crossEffect.StartTransition(false);
Wait( application, TRANSITION_DURATION*0.6f );
crossEffect.StopTransition();
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
- crossEffect.SetTargetImage( firstImage );
+ crossEffect.SetTargetTexture( firstTexture );
crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_DURATION*0.8f );
crossEffect.StopTransition();
tet_infoline(" UtcDaliCubeTransitionFoldEffectStopTransition ");
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- Image firstImage = BufferImage::New( 30, 30 );
- Image secondImage = BufferImage::New( 20, 20 );
+ Texture firstTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 30, 30 );
+ Texture secondTexture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 20, 20 );
CubeTransitionEffect foldEffect = CubeTransitionFoldEffect::New( NUM_ROWS, NUM_COLUMNS );
foldEffect.SetSize( VIEW_AREA_SIZE );
foldEffect.SetTransitionDuration( TRANSITION_DURATION );
- foldEffect.SetCurrentImage( firstImage );
- foldEffect.SetTargetImage( secondImage );
+ foldEffect.SetCurrentTexture( firstTexture );
+ foldEffect.SetTargetTexture( secondTexture );
Stage::GetCurrent().Add( foldEffect );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
- foldEffect.SetTargetImage( firstImage );
+ foldEffect.SetTargetTexture( firstTexture );
foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_DURATION*0.4f );
foldEffect.StopTransition();
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
- foldEffect.SetTargetImage( secondImage );
+ foldEffect.SetTargetTexture( secondTexture );
foldEffect.StartTransition(false);
Wait( application, TRANSITION_DURATION*0.6f );
foldEffect.StopTransition();
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), FULL_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), HALF_BRIGHTNESS, FLT_EPISILON, TEST_LOCATION );
- foldEffect.SetTargetImage( firstImage );
+ foldEffect.SetTargetTexture( firstTexture );
foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_DURATION*0.8f );
foldEffect.StopTransition();
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
* limitations under the License.
*
*/
+
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/geometry.h>
#include <toolkit-environment-variable.h> // for setting environment variable: DALI_DEBUG_RENDERING
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali-toolkit/dali-toolkit.h>
#include <dali/devel-api/scripting/scripting.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
#include <test-native-image.h>
#include <sstream>
// Need to override adaptor classes for toolkit test harness, so include
// test harness headers before dali headers.
#include <dali-toolkit-test-suite-utils.h>
-
#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+
using namespace Dali;
using namespace Toolkit;
gOnLayoutActivatedCalled = true;
}
+// Generate a PanGestureEvent to send to Core
+Integration::PanGestureEvent GeneratePan(
+ Gesture::State state,
+ const Vector2& previousPosition,
+ const Vector2& currentPosition,
+ unsigned long timeDelta,
+ unsigned int numberOfTouches = 1)
+{
+ Integration::PanGestureEvent pan(state);
+
+ pan.previousPosition = previousPosition;
+ pan.currentPosition = currentPosition;
+ pan.timeDelta = timeDelta;
+ pan.numberOfTouches = numberOfTouches;
+
+ return pan;
+}
+
+/**
+ * Helper to generate PanGestureEvent
+ *
+ * @param[in] application Application instance
+ * @param[in] state The Gesture State
+ * @param[in] pos The current position of touch.
+ */
+static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
+{
+ static Vector2 last;
+
+ if( (state == Gesture::Started) ||
+ (state == Gesture::Possible) )
+ {
+ last.x = pos.x;
+ last.y = pos.y;
+ }
+
+ application.ProcessEvent(GeneratePan(state, last, pos, RENDER_FRAME_INTERVAL));
+
+ last.x = pos.x;
+ last.y = pos.y;
+}
+
/*
* Simulate time passed by.
*
// Create a grid layout and add it to ItemView
ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+ gridLayout->SetOrientation(ControlOrientation::Down);
view.AddLayout(*gridLayout);
// Check there is no active layout at the moment
// Create a grid layout and add it to ItemView
ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+ gridLayout->SetOrientation(ControlOrientation::Left);
view.AddLayout(*gridLayout);
// Activate the grid layout so that the items will be created and added to ItemView
// Create a grid layout and add it to ItemView
ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+ gridLayout->SetOrientation(ControlOrientation::Right);
view.AddLayout(*gridLayout);
// Activate the grid layout so that the items will be created and added to ItemView
TestItemFactory factory;
ItemView view = ItemView::New(factory);
- // Create a grid layout and add it to ItemView
- ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
- view.AddLayout(*gridLayout);
+ // Create a depth layout and add it to ItemView
+ ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
+ depthLayout->SetOrientation(ControlOrientation::Up);
+ view.AddLayout(*depthLayout);
// Activate the grid layout so that the items will be created and added to ItemView
Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
TestItemFactory factory;
ItemView view = ItemView::New(factory);
Vector3 vec(480.0f, 800.0f, 0.0f);
- ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+ ItemLayoutPtr layout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
view.SetName("view actor");
view.AddLayout(*layout);
view.SetSize(vec);
Stage::GetCurrent().Add(view);
- layout->SetOrientation(ControlOrientation::Up);
+ layout->SetOrientation(ControlOrientation::Down);
view.ActivateLayout(0, vec, 0.0f);
application.SendNotification();
TestItemFactory factory;
ItemView view = ItemView::New(factory);
- // Create a grid layout and add it to ItemView
- ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
- view.AddLayout(*gridLayout);
+ // Create a depth layout and add it to ItemView
+ ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH);
+ depthLayout->SetOrientation(ControlOrientation::Left);
+ view.AddLayout(*depthLayout);
// Activate the grid layout so that the items will be created and added to ItemView
Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
TestItemFactory factory;
ItemView view = ItemView::New(factory);
- // Create a grid layout and add it to ItemView
- ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
- view.AddLayout(*gridLayout);
+ // Create a depth layout and add it to ItemView
+ ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH);
+ depthLayout->SetOrientation(ControlOrientation::Right);
+ view.AddLayout(*depthLayout);
// Activate the grid layout so that the items will be created and added to ItemView
Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
TestItemFactory factory;
ItemView view = ItemView::New(factory);
- // Create a grid layout and add it to ItemView
- ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
- view.AddLayout(*gridLayout);
+ // Create a spiral layout and add it to ItemView
+ ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+ view.AddLayout(*spiralLayout);
// Activate the grid layout so that the items will be created and added to ItemView
Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
TestItemFactory factory;
ItemView view = ItemView::New(factory);
- // Create a grid layout and add it to ItemView
- ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
- view.AddLayout(*gridLayout);
+ // Create a spiral layout and add it to ItemView
+ ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+ spiralLayout->SetOrientation( ControlOrientation::Down );
+ view.AddLayout(*spiralLayout);
// Activate the grid layout so that the items will be created and added to ItemView
Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
TestItemFactory factory;
ItemView view = ItemView::New(factory);
- // Create a grid layout and add it to ItemView
- ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
- view.AddLayout(*gridLayout);
+ // Create a spiral layout and add it to ItemView
+ ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+ spiralLayout->SetOrientation( ControlOrientation::Left );
+ view.AddLayout(*spiralLayout);
// Activate the grid layout so that the items will be created and added to ItemView
Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
TestItemFactory factory;
ItemView view = ItemView::New(factory);
- // Create a grid layout and add it to ItemView
- ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
- view.AddLayout(*gridLayout);
+ // Create a spiral layout and add it to ItemView
+ ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+ spiralLayout->SetOrientation( ControlOrientation::Right );
+ view.AddLayout(*spiralLayout);
// Activate the grid layout so that the items will be created and added to ItemView
Vector3 stageSize(Dali::Stage::GetCurrent().GetSize());
END_TEST;
}
+
+int UtcDaliItemViewOvershootVertical(void)
+{
+ ToolkitTestApplication application;
+ Dali::Stage stage = Dali::Stage::GetCurrent();
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+ view.AddLayout(*gridLayout);
+ stage.Add(view);
+
+ // Activate the grid layout so that the items will be created and added to ItemView
+ Vector3 stageSize(stage.GetSize());
+ view.ActivateLayout(0, stageSize, 0.5f);
+
+ view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, true );
+ DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), true, TEST_LOCATION );
+
+ view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, Vector2(30, 30) );
+
+ Wait(application);
+
+ // Do a pan starting from 100,100 and moving down
+ Vector2 pos(100.0f, 100.0f);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ pos.y += 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<200;i++)
+ {
+ SendPan(application, Gesture::Continuing, pos);
+ pos.y += 5.0f;
+ Wait(application);
+ }
+
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application, 100);
+
+ // Do a pan starting from 100,100 and moving up
+ pos = Vector2(100.0f, 300.0f);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ pos.y -= 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<200;i++)
+ {
+ SendPan(application, Gesture::Continuing, pos);
+ pos.y -= 5.0f;
+ Wait(application);
+ }
+
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application, 100);
+ END_TEST;
+}
+
+int UtcDaliItemViewOvershootHorizontal(void)
+{
+ ToolkitTestApplication application;
+ Dali::Stage stage = Dali::Stage::GetCurrent();
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+ view.AddLayout(*gridLayout);
+ stage.Add(view);
+
+ // Activate the grid layout so that the items will be created and added to ItemView
+ Vector3 stageSize(stage.GetSize());
+ view.ActivateLayout(0, stageSize, 0.5f);
+
+ view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, true );
+ DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), true, TEST_LOCATION );
+
+ view.SetProperty( Scrollable::Property::OVERSHOOT_SIZE, Vector2(30, 30) );
+
+ Wait(application);
+
+ // Do a pan starting from 100,100 and moving left
+ Vector2 pos(100.0f, 100.0f);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ pos.x -= 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<200;i++)
+ {
+ SendPan(application, Gesture::Continuing, pos);
+ pos.x -= 5.0f;
+ Wait(application);
+ }
+
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application, 100);
+
+ // Do a pan starting from 100,100 and moving right
+ pos = Vector2(100.0f, 100.0f);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ pos.x += 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<200;i++)
+ {
+ SendPan(application, Gesture::Continuing, pos);
+ pos.x += 5.0f;
+ Wait(application);
+ }
+
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application, 100);
+
+ END_TEST;
+}
DALI_TEST_CHECK( std::string((*iterObject).first) == std::string("key" ));
DALI_TEST_CHECK( std::string(((*iterObject).second).GetString()) == std::string("value"));
+ ++iter;
+ DALI_TEST_CHECK(!( iter != root->CEnd() ));
+
+ ++iter; // Go past the end
+
+ iter++; // Use the other operator using the post increment operator
+
tet_result(TET_PASS);
END_TEST;
}
DALI_TEST_CHECK(1 == parser.GetErrorLineNumber());
DALI_TEST_CHECK(53 == parser.GetErrorPosition());
DALI_TEST_CHECK(11 == parser.GetErrorColumn());
+ DALI_TEST_CHECK("Missing Value" == parser.GetErrorDescription());
tet_result(TET_PASS);
END_TEST;
END_TEST;
}
+
+int UtcDaliJsonParserDownCast(void)
+{
+ BaseHandle handle = JsonParser::New();
+ JsonParser parser = JsonParser::DownCast( handle );
+ DALI_TEST_CHECK( parser );
+ END_TEST;
+}
+
+int UtcDaliJsonParserTreeNodeCount(void)
+{
+ std::string s1( ReplaceQuotes(" \
+{ \
+ 'styles': \
+ { \
+ 'button': \
+ { \
+ 'backgroundColor':[0.8, 0.0, 1.0, 1.0], \
+ 'foregroundColor':[1, 1, 1, 1] \
+ } \
+ } \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+ parser.Parse( s1 );
+
+ const TreeNode* treeNode = parser.GetRoot();
+ DALI_TEST_EQUALS(1, treeNode->Count("styles"), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, treeNode->Count("random"), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliJsonParserTreeNodeFind(void)
+{
+ std::string s1( ReplaceQuotes("\
+{ \
+ 'string':'value2', \
+ 'integer':2, \
+ 'float':2.3, \
+ 'boolean':true, \
+ 'nil':null, \
+ 'array':[1,2,3], \
+ 'object':{'key':'value'} \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+ parser.Parse( s1 );
+
+ const TreeNode* treeNode = parser.GetRoot();
+ const TreeNode* childNode = treeNode->Find("string");
+ DALI_TEST_CHECK( childNode );
+ const TreeNode* sameNode = childNode->Find("string");
+ DALI_TEST_EQUALS( sameNode, childNode, TEST_LOCATION );
+
+ END_TEST;
+}
return point;
}
-Image CreateSolidColorImage( const Vector4& color, unsigned int width, unsigned int height )
-{
- BufferImage imageData = BufferImage::New( width, height, Pixel::RGBA8888 );
-
- // Create the image
- PixelBuffer* pixbuf = imageData.GetBuffer();
- unsigned int size = width * height;
-
- for( size_t i = 0; i < size; i++ )
- {
- pixbuf[i*4+0] = 0xFF * color.r;
- pixbuf[i*4+1] = 0xFF * color.g;
- pixbuf[i*4+2] = 0xFF * color.b;
- pixbuf[i*4+3] = 0xFF * color.a;
- }
-
- imageData.Update();
-
- return imageData;
-}
-
} //namespace
int UtcDaliPushButtonConstructorP(void)
END_TEST;
}
+
+int UtcDaliPushButtonSetButtonImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetButtonImage( ImageView::New() );
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetButtonImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetSelectedImage( ImageView::New() );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetBackgroundImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetBackgroundImage( ImageView::New() );
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetBackgroundImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetBackgroundImage( ImageView::New() );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetSelectedImage( ImageView::New() );
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetSelectedImage( ImageView::New() );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedBackgroundImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetSelectedBackgroundImage( ImageView::New() );
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetSelectedBackgroundImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetSelectedBackgroundImage( ImageView::New() );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledBackgroundImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetDisabledBackgroundImage( ImageView::New() );
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledBackgroundImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetDisabledBackgroundImage( ImageView::New() );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetDisabledImage( ImageView::New() );
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetDisabledImage( ImageView::New() );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledSelectedImageP(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button = PushButton::New();
+ Stage::GetCurrent().Add( button );
+
+ try
+ {
+ button.SetDisabledSelectedImage( ImageView::New() );
+ DALI_TEST_CHECK( true );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( false );
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPushButtonSetDisabledSelectedImageN(void)
+{
+ ToolkitTestApplication application;
+
+ PushButton button;
+
+ try
+ {
+ button.SetDisabledSelectedImage( ImageView::New() );
+ DALI_TEST_CHECK( false );
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true );
+ }
+
+ END_TEST;
+}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <stdlib.h>
#include <dali-toolkit-test-suite-utils.h>
#include <toolkit-event-thread-callback.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/texture-set.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/shader.h>
#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
using namespace Dali;
#include <iostream>
#include <stdlib.h>
+#include <string>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/pan-gesture-event.h>
gOnPanFinishedCalled = true;
}
+struct CallbackFunctor
+{
+ CallbackFunctor(bool* callbackFlag)
+ : mCallbackFlag( callbackFlag )
+ {
+ }
+
+ void operator()()
+ {
+ *mCallbackFlag = true;
+ }
+ bool* mCallbackFlag;
+};
+
/**
* Invoked when the current scroll position of the scrollable content goes above or below the values
* specified by SCROLL_POSITION_INTERVALS property.
DALI_TEST_CHECK( vertical );
DALI_TEST_CHECK( vertical.GetScrollDirection() == ScrollBar::Vertical );
+ Property::Value value = vertical.GetProperty(ScrollBar::Property::SCROLL_DIRECTION);
+ std::string scrollDirection = value.Get<std::string>();
+ DALI_TEST_EQUALS( scrollDirection, "Vertical", TEST_LOCATION );
+
ScrollBar horizontal = ScrollBar::New(ScrollBar::Horizontal);
DALI_TEST_CHECK( horizontal );
DALI_TEST_CHECK( horizontal.GetScrollDirection() == ScrollBar::Horizontal );
+ value = vertical.GetProperty(ScrollBar::Property::SCROLL_DIRECTION);
+ scrollDirection = value.Get<std::string>();
+ DALI_TEST_EQUALS( scrollDirection, "Horizontal", TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollBarCreateP(void)
+{
+ ToolkitTestApplication application;
+
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+ DALI_TEST_CHECK( typeRegistry );
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo( "ScrollBar" );
+ DALI_TEST_CHECK( typeInfo );
+
+ BaseHandle handle = typeInfo.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ ScrollBar scrollBar = ScrollBar::DownCast( handle );
+ DALI_TEST_CHECK( scrollBar );
+
+ scrollBar.SetProperty(ScrollBar::Property::SCROLL_DIRECTION, "Vertical");
+ scrollBar.SetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY, "Fixed");
+
+ DALI_TEST_EQUALS( scrollBar.GetScrollDirection(), Toolkit::ScrollBar::Vertical, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Fixed, TEST_LOCATION );
+
+ scrollBar.SetProperty(ScrollBar::Property::SCROLL_DIRECTION, "Horizontal");
+ scrollBar.SetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY, "Variable");
+
+ DALI_TEST_EQUALS( scrollBar.GetScrollDirection(), Toolkit::ScrollBar::Horizontal, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollBar.GetIndicatorHeightPolicy(), Toolkit::ScrollBar::Variable, TEST_LOCATION );
END_TEST;
}
scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Fixed);
scrollBar.SetIndicatorFixedHeight(50.0f);
+ Property::Value value = scrollBar.GetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY);
+ DALI_TEST_EQUALS(value.Get<std::string>(), "Fixed", TEST_LOCATION );
+
// Render and notify
application.SendNotification();
application.Render();
// Set the indicator height to be variable
scrollBar.SetIndicatorHeightPolicy(Toolkit::ScrollBar::Variable);
+ value = scrollBar.GetProperty(ScrollBar::Property::INDICATOR_HEIGHT_POLICY);
+ DALI_TEST_EQUALS(value.Get<std::string>(), "Variable", TEST_LOCATION );
// Render and notify
application.SendNotification();
Stage::GetCurrent().Add( scrollBar );
// Connect the pan finished signal
+ ConnectionTracker connectionTracker;
+ bool panFinished = false;
scrollBar.PanFinishedSignal().Connect( &OnPanFinished );
+ scrollBar.ConnectSignal( &connectionTracker, "panFinished", CallbackFunctor(&panFinished));
// Render and notify
application.SendNotification();
// Perform a swipe gesture on the indicator
PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION );
END_TEST;
}
Stage::GetCurrent().Add( scrollBar );
// Connect the pan finished signal
+ ConnectionTracker connectionTracker;
+ bool panFinished = false;
scrollBar.PanFinishedSignal().Connect( &OnPanFinished );
+ scrollBar.ConnectSignal( &connectionTracker, "panFinished", CallbackFunctor(&panFinished));
// Render and notify
application.SendNotification();
// Perform a swipe gesture on the scroll bar but not on the indicator
PerformGestureSwipe(application, Vector2(1.0f, 780.0f), Vector2(Vector2::YAXIS * -1.0f), 20);
DALI_TEST_EQUALS( gOnPanFinishedCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS( panFinished, false, TEST_LOCATION );
// Perform a swipe gesture on the indicator
PerformGestureSwipe(application, Vector2(1.0f, 1.0f), Vector2(Vector2::YAXIS * 1.0f), 20);
DALI_TEST_EQUALS( gOnPanFinishedCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( panFinished, true, TEST_LOCATION );
END_TEST;
}
scrollBar.SetSize(20.0f, 800.0f, 0.0f);
Stage::GetCurrent().Add( scrollBar );
+ ConnectionTracker connectionTracker;
// Connect to the ScrollPositionIntervalReached signal
+ bool intervalReached = false;
scrollBar.ScrollPositionIntervalReachedSignal().Connect( &OnScrollPositionIntervalReached );
+ scrollBar.ConnectSignal( &connectionTracker, "scrollPositionIntervalReached", CallbackFunctor(&intervalReached));
// Render and notify
application.SendNotification();
// Check that the signal callback is called
DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION );
// Reset the flag
gOnScrollPositionIntervalReachedSignalCalled = false;
+ intervalReached = false;
// Rest and clear the animation
animation.Clear();
// Check that the signal callback is called
DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION );
// Reset the flag
gOnScrollPositionIntervalReachedSignalCalled = false;
+ intervalReached = false;
// Rest and clear the animation
animation.Clear();
// Check that the signal callback is called
DALI_TEST_EQUALS( gOnScrollPositionIntervalReachedSignalCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( intervalReached, true, TEST_LOCATION );
END_TEST;
}
END_TEST;
}
-
-
gObjectCreatedCallBackCalled = true;
}
+struct CallbackFunctor
+{
+ CallbackFunctor(bool* callbackFlag)
+ : mCallbackFlag( callbackFlag )
+ {
+ }
+
+ void operator()()
+ {
+ *mCallbackFlag = true;
+ }
+ bool* mCallbackFlag;
+};
const int MILLISECONDS_PER_SECOND = 1000;
const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation
+
const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete.
// For Clamp Signal testing...
END_TEST;
}
-int UtcDaliToolkitScrollViewNewP(void)
+int UtcDaliToolkitScrollViewNewP1(void)
{
ToolkitTestApplication application;
- tet_infoline(" UtcDaliToolkitScrollViewNewP");
+ tet_infoline(" UtcDaliToolkitScrollViewNewP1");
ScrollView scrollView;
END_TEST;
}
+int UtcDaliToolkitScrollViewNewP2(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewNewP2 - create thru type registry");
+
+ ScrollView scrollView;
+ DALI_TEST_CHECK( !scrollView );
+
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeInfo scrollViewType = typeRegistry.GetTypeInfo("ScrollView");
+ BaseHandle handle = scrollViewType.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ scrollView = ScrollView::DownCast(handle);
+ DALI_TEST_CHECK( scrollView );
+
+ END_TEST;
+}
+
int UtcDaliToolkitScrollViewDownCastP(void)
{
ToolkitTestApplication application;
scrollView.SetWrapMode(true);
+ Property::Value wrapMode = scrollView.GetProperty( Toolkit::ScrollView::Property::WRAP_ENABLED );
+ DALI_TEST_EQUALS( wrapMode.Get<bool>(), true, TEST_LOCATION );
+
const Vector2 target = Vector2(50.0f, 50.0f);
const Vector2 target2 = Vector2(150.0f, 150.0f);
END_TEST;
}
-int UtcDaliToolkitScrollViewSignalsUpdate(void)
+int UtcDaliToolkitScrollViewSignalsUpdate01(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
END_TEST;
}
+int UtcDaliToolkitScrollViewSignalsUpdate02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewSignalsUpdate");
+
+ gOnScrollStartCalled = false;
+ gOnScrollUpdateCalled = false;
+ gOnScrollCompleteCalled = false;
+
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
+ rulerY->SetDomain( RulerDomain(0.0f, 1000.0f, false) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+ Dali::ConnectionTracker tracker;
+ bool scrollStarted=false;
+ bool scrollUpdated=false;
+ bool scrollCompleted=false;
+ DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollStarted", CallbackFunctor(&scrollStarted) ));
+ DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollUpdated", CallbackFunctor(&scrollUpdated) ));
+ DALI_TEST_CHECK(scrollView.ConnectSignal( &tracker, "scrollCompleted", CallbackFunctor(&scrollCompleted) ));
+
+ Actor image = Actor::New();
+ image.SetSize(stageSize);
+ image.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ image.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ scrollView.Add(image);
+
+ Wait(application);
+
+ // Do a pan starting from 100,100 and moving down diagonally.
+ Vector2 pos(100.0f, 100.0f);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ pos.x += 5.0f;
+ pos.y += 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<20;i++)
+ {
+ SendPan(application, Gesture::Continuing, pos);
+ pos.x += 5.0f;
+ pos.y += 5.0f;
+ Wait(application);
+ }
+
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application, RENDER_DELAY_SCROLL);
+
+ DALI_TEST_CHECK(scrollStarted);
+ DALI_TEST_CHECK(scrollUpdated);
+ DALI_TEST_CHECK(scrollCompleted);
+
+ Stage::GetCurrent().Remove( scrollView );
+
+ END_TEST;
+}
+
static Vector2 PerformGestureDiagonalSwipe(ToolkitTestApplication& application, Vector2 start, Vector2 direction, int frames, bool finish = true)
{
gOnScrollStartCalled = false;
Wait(application, RENDER_DELAY_SCROLL);
DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
+ scrollView.Remove(a);
+ Wait(application);
+
END_TEST;
}
CleanupTest();
END_TEST;
}
-
END_TEST;
}
-static bool gSliderValueChangedCallBackCalled;
+static bool gSliderValueChangedCallBackCalled=false;
static bool OnSliderValueChanged( Slider slider, float value )
{
gSliderValueChangedCallBackCalled = true;
return true;
}
-static bool gSliderMarkCallBackCalled;
+static bool gSliderMarkCallBackCalled=false;
static bool OnSliderMark( Slider slider, int value )
{
gSliderMarkCallBackCalled = true;
return true;
}
+static bool gSliderSlidingFinishedCallBackCalled=false;
+static bool OnSlidingFinished( Slider slider, float value )
+{
+ gSliderSlidingFinishedCallBackCalled = true;
+ return true;
+}
+
int UtcDaliSliderSignals1(void)
{
ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
slider.ValueChangedSignal().Connect( &OnSliderValueChanged );
slider.MarkReachedSignal().Connect( &OnSliderMark );
+ slider.SlidingFinishedSignal().Connect( &OnSlidingFinished );
application.SendNotification();
application.Render();
gSliderValueChangedCallBackCalled = false;
gSliderMarkCallBackCalled = false;
+ gSliderSlidingFinishedCallBackCalled = false;
- Dali::Integration::TouchEvent event;
-
- event = Dali::Integration::TouchEvent();
-
- Integration::Point pointDown;
- pointDown.SetState( PointState::DOWN );
- pointDown.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
- event.AddPoint( pointDown );
+ {
+ Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent();
+ Integration::Point pointDown;
+ pointDown.SetState( PointState::DOWN );
+ pointDown.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+ event.AddPoint( pointDown );
+
+ application.ProcessEvent( event );
+ application.SendNotification();
+ application.Render();
+ }
for( int i = 0; i < 5; ++i )
{
+ Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent();
Integration::Point pointMotion;
pointMotion.SetState( PointState::MOTION );
pointMotion.SetScreenPosition( Vector2( 10.0f + i * 10.0f, 10.0f ) );
event.AddPoint( pointMotion );
- }
-
- Integration::Point pointUp;
- pointUp.SetState( PointState::UP );
- pointUp.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
- event.AddPoint( pointUp );
- application.ProcessEvent( event );
+ application.ProcessEvent( event );
+ application.SendNotification();
+ application.Render();
+ }
- application.SendNotification();
- application.Render();
+ {
+ Dali::Integration::TouchEvent event = Dali::Integration::TouchEvent();
+ Integration::Point pointUp;
+ pointUp.SetState( PointState::UP );
+ pointUp.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
+ event.AddPoint( pointUp );
+
+ application.ProcessEvent( event );
+ application.SendNotification();
+ application.Render();
+ }
DALI_TEST_CHECK(gSliderValueChangedCallBackCalled);
DALI_TEST_CHECK(gSliderMarkCallBackCalled);
+ DALI_TEST_CHECK(gSliderSlidingFinishedCallBackCalled);
END_TEST;
}
#include <iostream>
#include <stdlib.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
#include <iostream>
#include <stdlib.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/tap-gesture-event.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali/integration-api/events/long-press-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
const unsigned int CURSOR_BLINK_INTERVAL = 500u; // Cursor blink interval
+const float RENDER_FRAME_INTERVAL = 16.66f;
+
const float TO_MILLISECONDS = 1000.f;
const float TO_SECONDS = 1.f / TO_MILLISECONDS;
static bool gTextChangedCallBackCalled;
static bool gMaxCharactersCallBackCalled;
+static void LoadBitmapResource(TestPlatformAbstraction& platform, int width, int height)
+{
+ Integration::ResourceRequest* request = platform.GetRequest();
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
+ Integration::ResourcePointer resource(bitmap);
+ bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, width, height, width, height);
+
+ if(request)
+ {
+ platform.SetResourceLoaded(request->GetId(), request->GetType()->id, resource);
+ }
+}
+
+static void LoadMarkerImages(ToolkitTestApplication& app, TextField textField)
+{
+ int width(40);
+ int height(40);
+ LoadBitmapResource( app.GetPlatform(), width, height );
+
+ Property::Map propertyMap;
+ propertyMap["filename"] = "image.png";
+ propertyMap["width"] = width;
+ propertyMap["height"] = height;
+ textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT, propertyMap );
+ textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT, propertyMap );
+ textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT, propertyMap );
+ textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, propertyMap );
+ textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, propertyMap );
+ textField.SetProperty( Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, propertyMap );
+ textField.SetProperty( Toolkit::TextField::Property::GRAB_HANDLE_IMAGE, propertyMap );
+ textField.SetProperty( Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE, propertyMap );
+}
+
+// Generate a PanGestureEvent to send to Core
+static Integration::PanGestureEvent GeneratePan(
+ Gesture::State state,
+ const Vector2& previousPosition,
+ const Vector2& currentPosition,
+ unsigned long timeDelta,
+ unsigned int numberOfTouches = 1)
+{
+ Integration::PanGestureEvent pan(state);
+
+ pan.previousPosition = previousPosition;
+ pan.currentPosition = currentPosition;
+ pan.timeDelta = timeDelta;
+ pan.numberOfTouches = numberOfTouches;
+
+ return pan;
+}
+
+/**
+ * Helper to generate PanGestureEvent
+ *
+ * @param[in] application Application instance
+ * @param[in] state The Gesture State
+ * @param[in] pos The current position of touch.
+ */
+static void SendPan(ToolkitTestApplication& application, Gesture::State state, const Vector2& pos)
+{
+ static Vector2 last;
+
+ if( (state == Gesture::Started) ||
+ (state == Gesture::Possible) )
+ {
+ last.x = pos.x;
+ last.y = pos.y;
+ }
+
+ application.ProcessEvent(GeneratePan(state, last, pos, 16));
+
+ last.x = pos.x;
+ last.y = pos.y;
+}
+
+/*
+ * Simulate time passed by.
+ *
+ * @note this will always process at least 1 frame (1/60 sec)
+ *
+ * @param application Test application instance
+ * @param duration Time to pass in milliseconds.
+ * @return The actual time passed in milliseconds
+ */
+static int Wait(ToolkitTestApplication& application, int duration = 0)
+{
+ int time = 0;
+
+ for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ {
+ application.SendNotification();
+ application.Render(RENDER_FRAME_INTERVAL);
+ time += RENDER_FRAME_INTERVAL;
+ }
+
+ return time;
+}
+
+
static void TestTextChangedCallback( TextField control )
{
tet_infoline(" TestTextChangedCallback");
return tap;
}
+
+Integration::LongPressGestureEvent GenerateLongPress(
+ Gesture::State state,
+ unsigned int numberOfTouches,
+ Vector2 point)
+{
+ Integration::LongPressGestureEvent longPress( state );
+
+ longPress.numberOfTouches = numberOfTouches;
+ longPress.point = point;
+ return longPress;
+}
+
// Generate a KeyEvent to send to Core.
Integration::KeyEvent GenerateKey( const std::string& keyName,
const std::string& keyString,
TextField field = TextField::New();
field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
DALI_TEST_CHECK( field );
+ LoadMarkerImages(application, field);
Stage::GetCurrent().Add( field );
// Avoid a crash when core load gl resources.
application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ LoadMarkerImages(application, field);
// Render and notify
application.SendNotification();
END_TEST;
}
+
+int utcDaliTextFieldEvent04(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldEvent04");
+
+ // Checks if the highlight actor is created.
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+ Stage::GetCurrent().Add( field );
+ LoadMarkerImages(application, field);
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." );
+ field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
+ field.SetSize( 300.f, 50.f );
+ field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+
+ // Tap first to get the focus.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Double tap to select a word.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap grab handle
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 0.f, 40.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 0.f, 40.0f ) ) );
+ END_TEST;
+}
+
+int utcDaliTextFieldEvent05(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldEvent05");
+
+ // Checks dragging of cursor/grab handle
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+ Stage::GetCurrent().Add( field );
+ LoadMarkerImages(application, field);
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." );
+ field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
+ field.SetSize( 300.f, 50.f );
+ field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+
+ // Tap first to get the focus.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Double tap to select a word.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // drag grab handle right
+ Vector2 pos(0.0f, 40.0f);
+ SendPan(application, Gesture::Possible, pos);
+ SendPan(application, Gesture::Started, pos);
+ pos.x += 5.0f;
+ Wait(application, 100);
+
+ for(int i = 0;i<20;i++)
+ {
+ SendPan(application, Gesture::Continuing, pos);
+ pos.x += 5.0f;
+ Wait(application);
+ }
+
+ SendPan(application, Gesture::Finished, pos);
+ Wait(application, RENDER_FRAME_INTERVAL);
+
+ Actor offscreenRoot = field.GetChildAt( 1u );
+ END_TEST;
+}
+
+int utcDaliTextFieldEvent06(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldEvent06");
+
+ // Checks Longpress when in edit mode
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+ Stage::GetCurrent().Add( field );
+ LoadMarkerImages(application, field);
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ field.SetProperty( TextField::Property::TEXT, "Thisisalongtextforthesizeofthetextfield." );
+ field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
+ field.SetSize( 300.f, 50.f );
+ field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+
+ // Tap first to get the focus.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Long Press
+ application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
+int utcDaliTextFieldEvent07(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldEvent07");
+
+ // Checks Longpress to start edit mode
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+ Stage::GetCurrent().Add( field );
+ LoadMarkerImages(application, field);
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ field.SetProperty( TextField::Property::TEXT, "Thisisalongtextforthesizeofthetextfield." );
+ field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
+ field.SetSize( 300.f, 50.f );
+ field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Long Press
+ application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
+int utcDaliTextFieldEvent08(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldEvent08");
+
+ // Checks Longpress when only place holder text
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+ Stage::GetCurrent().Add( field );
+ LoadMarkerImages(application, field);
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Setting Placeholder Text" );
+ field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
+ field.SetSize( 300.f, 50.f );
+ field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Long Press
+ application.ProcessEvent( GenerateLongPress( Gesture::Possible, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateLongPress( Gesture::Started, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
+
+int utcDaliTextFieldStyleWhilstSelected09(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldEvent09");
+
+ // Change font and styles whilst text is selected whilst word selected
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+ Stage::GetCurrent().Add( field );
+ LoadMarkerImages(application, field);
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ field.SetProperty( TextField::Property::TEXT, "This is a long text for the size of the text-field." );
+ field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
+ field.SetSize( 300.f, 50.f );
+ field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 150.0f, 25.0f ) ) );
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+
+ // Tap first to get the focus.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Double tap to select a word.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 1.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"slant\":\"italic\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"slant\":\"italic\"}", TEST_LOCATION );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"width\":\"expanded\",\"slant\":\"italic\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"width\":\"expanded\",\"slant\":\"italic\"}", TEST_LOCATION );
+
+ field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
+ DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ field.SetProperty( TextField::Property::TEXT_COLOR, Color::RED );
+ DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::TEXT_COLOR ), Color::RED, TEST_LOCATION );
+
+ field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"bold\",\"slant\":\"italic\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), "{\"weight\":\"bold\",\"slant\":\"italic\"}", TEST_LOCATION );
+
+ field.SetProperty( TextField::Property::FONT_STYLE, "{\"width\":\"expanded\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), "{\"width\":\"expanded\"}", TEST_LOCATION );
+
+ END_TEST;
+}
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
using namespace Dali;
using namespace Toolkit;
END_TEST;
}
+
+// TextSelectionToolBar is used TextSelectionPopup, below tests it individually
+
+int UtcDaliToolkitTextSelectionToolBarP(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 );
+
+ Toolkit::Control divider = Toolkit::Control::New();
+ divider.SetSize( 2.0f, 0.0f );
+ divider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
+ toolbar.AddDivider( divider );
+
+ Toolkit::PushButton option2 = Toolkit::PushButton::New();
+ option2.SetName( "test-option-2" );
+ option2.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ toolbar.AddOption( option2 );
+
+ Size newSize = Size(3.0f, 0.0f);
+ toolbar.ResizeDividers( newSize );
+
+ DALI_TEST_CHECK( toolbar );
+ END_TEST;
+}
END_TEST;
}
+
+int UtcDaliVideoViewMethodsForCoverage(void)
+{
+ ToolkitTestApplication application;
+
+ VideoView videoView = VideoView::New();
+ DALI_TEST_CHECK( videoView );
+
+ videoView.Play();
+ videoView.Pause();
+ videoView.Stop();
+ videoView.Forward(10);
+ videoView.Backward(10);
+ VideoView::VideoViewSignalType& signal = videoView.FinishedSignal();
+ DALI_TEST_EQUALS( 0, signal.GetConnectionCount(), TEST_LOCATION );
+
+ END_TEST;
+}
{
}
-JsonParser DownCast( BaseHandle handle )
+JsonParser JsonParser::DownCast( BaseHandle handle )
{
return JsonParser( dynamic_cast<Internal::JsonParser*>(handle.GetObjectPtr()) );
}
return KeyNodePair(mNode->mName, *mNode);
}
-TreeNode::KeyNodePair TreeNode::ConstIterator::operator ->()
-{
- return KeyNodePair(mNode->mName, *mNode);
-}
-
bool TreeNode::ConstIterator::operator!=( const TreeNode::ConstIterator& rhs ) const
{
return mNode != rhs.mNode;
* pointer semantics
*/
KeyNodePair operator*();
-
- /*
- * pointer semantics
- */
- KeyNodePair operator->();
private:
TreeNode* mNode;
};
-#ifndef __DALI_TOOLKIT_IMAGE_ATLAS_H__
-#define __DALI_TOOLKIT_IMAGE_ATLAS_H__
+#ifndef DALI_TOOLKIT_IMAGE_ATLAS_H
+#define DALI_TOOLKIT_IMAGE_ATLAS_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/images/image.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/images/pixel.h>
-#include <dali/devel-api/images/pixel-data.h>
+#include <dali/public-api/images/pixel-data.h>
namespace Dali
{
} // namespace Dali
-#endif /* __DALI_TOOLKIT_IMAGE_ATLAS_H__ */
+#endif // DALI_TOOLKIT_IMAGE_ATLAS_H
-#ifndef __DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H__
-#define __DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H__
+#ifndef DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H_
+#define DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <string.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/shader.h>
namespace Dali
{
} // namespace Dali
-#endif // __DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H__
+#endif // DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H
return GetImpl(*this).IsTransitioning();
}
-void CubeTransitionEffect::SetCurrentImage( Image image )
+void CubeTransitionEffect::SetCurrentTexture( Texture texture )
{
- GetImpl(*this).SetCurrentImage( image );
+ GetImpl(*this).SetCurrentTexture( texture );
}
-void CubeTransitionEffect::SetTargetImage( Image image )
+void CubeTransitionEffect::SetTargetTexture( Texture texture )
{
- GetImpl(*this).SetTargetImage( image );
+ GetImpl(*this).SetTargetTexture( texture );
}
void CubeTransitionEffect::StartTransition( bool toNextImage )
-#ifndef __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__
-#define __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__
+#ifndef DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H
+#define DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
+// EXTERNAL INCLUDES
+#include <dali/public-api/rendering/texture.h>
+
namespace Dali
{
bool IsTransitioning();
/**
- * Set the current image to transition from
+ * Set the current texture to transition from
* if using this same effect continually, only need to set once
- * @param[in] image The current image
+ * @param[in] texture The current texture
*/
- void SetCurrentImage(Image image);
+ void SetCurrentTexture( Texture texture );
/**
- * Set the target image to transit to
- * @param[in] image The new Image showing on stage
+ * Set the target texture to transit to
+ * @param[in] texture The new Texture showing on stage
*/
- void SetTargetImage(Image image);
+ void SetTargetTexture( Texture texture );
/**
* Activate the transition animation with horizontally left/right panGesture
public: //Signal
//Transition animation completed signal
- typedef Signal< void ( CubeTransitionEffect, Image ) > TransitionCompletedSignalType;
+ typedef Signal< void ( CubeTransitionEffect, Texture ) > TransitionCompletedSignalType;
/**
* Signal emitted when the transition has completed animation
* A callback of the following type may be connected
* @code
- * void YourCallbackName( CubeTransitionEffect cubeEffect, Image currentImage );
+ * void YourCallbackName( CubeTransitionEffect cubeEffect, Texture currentTexture );
* @endcode
* @return The Signal to connect to.
*/
} // namespace Dali
-#endif /* __DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H__ */
+#endif // DALI_TOOLKIT_CUBE_TRANSITION_EFFECT_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
rendererMap[ "shader" ] = customShader;
mCompositeImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, rendererMap );
TextureSet textureSet = mCompositeImageView.GetRendererAt(0).GetTextures();
- textureSet.SetImage( 1u, mBlurExtractTarget );
+ TextureSetImage( textureSet, 1u, mBlurExtractTarget );
// set up target actor for rendering result, i.e. the blurred image
mTargetImageView.SetImage(mOutputRenderTarget);
-#ifndef __DALI_TOOLKIT_INTERNAL_BUBBLE_ACTOR_H_
-#define __DALI_TOOLKIT_INTERNAL_BUBBLE_ACTOR_H_
+#ifndef DALI_TOOLKIT_INTERNAL_BUBBLE_ACTOR_H
+#define DALI_TOOLKIT_INTERNAL_BUBBLE_ACTOR_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/property-map.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
namespace Dali
{
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_BUBBLE_ACTOR_H_ */
+#endif // DALI_TOOLKIT_INTERNAL_BUBBLE_ACTOR_H
-#ifndef __DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H_
-#define __DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H_
+#ifndef DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H
+#define DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <sstream>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/shader.h>
namespace Dali
{
} // namespace Toolkit
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H_ */
+#endif // DALI_TOOLKIT_INTERNAL_BUBBLE_EFFECT_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/images/resource-image.h>
+#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/bubble-effect/bubble-actor.h>
Shader bubbleShader = CreateBubbleShader (mNumBubblePerActor );
mTextureSet = TextureSet::New();
- mTextureSet.SetImage( 0u, mEffectImage );
- mTextureSet.SetImage( 1u, mShapeImage );
+ TextureSetImage( mTextureSet, 0u, mEffectImage );
+ TextureSetImage( mTextureSet, 1u, mShapeImage );
mBubbleActors.resize( mNumActor );
void BubbleEmitter::SetShapeImage( Image shapeImage )
{
- mTextureSet.SetImage( 1, shapeImage );
+ TextureSetImage( mTextureSet, 1, shapeImage );
}
void BubbleEmitter::SetBubbleScale( float scale )
-#ifndef __DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H__
-#define __DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H__
+#ifndef DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H
+#define DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/common/stage.h>
#include <dali/public-api/images/frame-buffer-image.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/devel-api/object/property-buffer.h>
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/sampler.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/property-buffer.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/sampler.h>
+#include <dali/public-api/rendering/shader.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H__ */
+#endif // DALI_TOOLKIT_INTERNAL_BUBBLE_EMITTER_IMPL_H
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
/**
* Button states and contents
}
}
-void Button::SetUnselectedColor( const Vector4& color )
+const Vector4 Button::GetUnselectedColor() const
+{
+ return mUnselectedColor;
+}
+
+void Button::SetColor( const Vector4& color, Button::PaintState selectedState )
{
- mUnselectedColor = color;
+ Actor& contentActor = mSelectedContent;
+ bool imageFileExists = false;
- if( mUnselectedContent && !GetUnselectedImageFilename().empty() )
+ if ( selectedState == SelectedState || selectedState == DisabledSelectedState )
{
- // If there is existing unselected content, change the color on it directly.
- mUnselectedContent.SetColor( mUnselectedColor );
+ mSelectedColor = color;
+ imageFileExists = !GetSelectedImageFilename().empty();
}
else
{
- // If there is no existing content, create a new actor to use for flat color.
- Toolkit::Control unselectedContentActor = Toolkit::Control::New();
- unselectedContentActor.SetBackgroundColor( mUnselectedColor );
- SetupContent( mUnselectedContent, unselectedContentActor );
- mUnselectedContent.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ mUnselectedColor = color;
+ contentActor = mUnselectedContent;
+ imageFileExists = !GetUnselectedImageFilename().empty();
}
-}
-
-const Vector4 Button::GetUnselectedColor() const
-{
- return mUnselectedColor;
-}
-
-void Button::SetSelectedColor( const Vector4& color )
-{
- mSelectedColor = color;
- if( mSelectedContent && !GetSelectedImageFilename().empty() )
+ if( contentActor && imageFileExists )
{
// If there is existing unselected content, change the color on it directly.
- mSelectedContent.SetColor( mSelectedColor );
+ contentActor.SetColor( color );
}
else
{
// If there is no existing content, create a new actor to use for flat color.
- Toolkit::Control selectedContentActor = Toolkit::Control::New();
- selectedContentActor.SetBackgroundColor( mSelectedColor );
- SetupContent( mSelectedContent, selectedContentActor );
- mSelectedContent.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ Actor placementActor = Actor::New();
+ Toolkit::RendererFactory rendererFactory = Toolkit::RendererFactory::Get();
+ Toolkit::ControlRenderer colorRenderer;
+
+ Property::Map map;
+ map["rendererType"] = "color";
+ map["mixColor"] = color;
+
+ colorRenderer = rendererFactory.CreateControlRenderer( map );
+ colorRenderer.SetOnStage( placementActor );
+ SetupContent( contentActor, placementActor );
+ contentActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
}
}
return std::string();
}
-std::string Button::GetBackgroundImageFilename() const
-{
- if( mBackgroundContent )
- {
- ResourceImage image = ResourceImage::DownCast( mBackgroundContent );
- if( image )
- {
- return image.GetUrl();
- }
- }
- return std::string();
-}
-
-std::string Button::GetSelectedBackgroundImageFilename() const
-{
- if( mSelectedBackgroundContent )
- {
- ResourceImage image = ResourceImage::DownCast( mSelectedBackgroundContent );
- if( image )
- {
- return image.GetUrl();
- }
- }
- return std::string();
-}
-
std::string Button::GetDisabledImageFilename() const
{
if( mDisabledContent )
return std::string();
}
-std::string Button::GetDisabledSelectedImageFilename() const
-{
- if( mDisabledSelectedContent )
- {
- ResourceImage image = ResourceImage::DownCast( mDisabledSelectedContent );
- if( image )
- {
- return image.GetUrl();
- }
- }
- return std::string();
-}
-
-std::string Button::GetDisabledBackgroundImageFilename() const
-{
- if( mDisabledBackgroundContent )
- {
- ResourceImage image = ResourceImage::DownCast( mDisabledBackgroundContent );
- if( image )
- {
- return image.GetUrl();
- }
- }
- return std::string();
-}
-
bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
{
bool ret = false;
case Toolkit::Button::Property::UNSELECTED_COLOR:
{
- GetImplementation( button ).SetUnselectedColor( value.Get< Vector4 >() );
+ GetImplementation( button ).SetColor( value.Get< Vector4 >(), UnselectedState );
break;
}
case Toolkit::Button::Property::SELECTED_COLOR:
{
- GetImplementation( button ).SetSelectedColor( value.Get< Vector4 >() );
+ GetImplementation( button ).SetColor( value.Get< Vector4 >(), SelectedState );
break;
}
class Button : public Control
{
-protected:
-
- /**
- * Construct a new Button.
- */
- Button();
-
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~Button();
-
public:
/**
protected:
+ enum ButtonState
+ {
+ ButtonUp, ///< The button is up.
+ ButtonDown, ///< The button is down.
+ };
+
+ /**
+ * Button paint states.
+ */
+ enum PaintState
+ {
+ UnselectedState, ///< The button is unselected.
+ SelectedState, ///< The button is selected.
+ DisabledUnselectedState, ///< The button is disabled and unselected.
+ DisabledSelectedState, ///< The button is disabled and selected.
+ };
+
+ /**
+ * Enum to specify which decoration when getting and setting decorations.
+ */
+ enum DecorationState
+ {
+ UNSELECTED_DECORATION = 0,
+ SELECTED_DECORATION,
+ DECORATION_STATES
+ };
+
+ /**
+ * Construct a new Button.
+ */
+ Button();
+
+ /**
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~Button();
/**
* @return A reference to the label actor.
*/
*/
void OnStageDisconnection();
+
private:
/**
void SetupContent( Actor& actorToModify, Actor newActor );
/**
- * Sets the color of the unselected image.
- * If no image exists, it is created.
- * @param[in] color The color to use.
- */
- void SetUnselectedColor( const Vector4& color );
-
- /**
* Gets the unselected content color.
* @return The currently used unselected color.
*/
const Vector4 GetUnselectedColor() const;
/**
- * Sets the color of the selected image.
- * If no image exists, it is created.
+ * Sets the color of button in selected or unselected state, if image also supplied this color will be appplied to it.
+ * If no visual exists, it is created.
* @param[in] color The color to use.
+ * @param[in] selectedState The state to apply the color to, SelectedState or DisabledUnselectedState.
*/
- void SetSelectedColor( const Vector4& color );
+ void SetColor( const Vector4& color, PaintState selectedState );
/**
* Gets the selected content color.
protected:
- enum ButtonState
- {
- ButtonUp, ///< The button is up.
- ButtonDown, ///< The button is down.
- };
-
- /**
- * Button paint states.
- */
- enum PaintState
- {
- UnselectedState, ///< The button is unselected.
- SelectedState, ///< The button is selected.
- DisabledUnselectedState, ///< The button is disabled and unselected.
- DisabledSelectedState, ///< The button is disabled and selected.
- };
-
- /**
- * Enum to specify which decoration when getting and setting decorations.
- */
- enum DecorationState
- {
- UNSELECTED_DECORATION = 0,
- SELECTED_DECORATION,
- DECORATION_STATES
- };
-
ButtonState GetState();
PaintState GetPaintState();
void SetDecoration( DecorationState state, Actor actor );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
TextureSet textureSet = TextureSet::New();
- textureSet.SetImage( 0u, mImagePostFilter);
+ TextureSetImage( textureSet, 0u, mImagePostFilter );
self.GetRendererAt( 0 ).SetTextures( textureSet );
mRendererPostFilter.SetDepthIndex( DepthIndex::CONTENT );
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/adaptor-framework/file-loader.h>
+#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/model3d-view/obj-loader.h>
namespace
{
+// Texture indices are constants.
+enum TextureIndex
+{
+ DIFFUSE_TEXTURE_INDEX,
+ NORMAL_TEXTURE_INDEX,
+ GLOSS_TEXTURE_INDEX
+};
+
+/**
+ * @brief Loads a texture from a file.
+ * @param[in] imageUrl The URL of the file
+ * @return A texture if loading succeeds, an empty handle otherwise
+ */
+Texture LoadTexture( const char* imageUrl )
+{
+ Texture texture;
+ Dali::BitmapLoader loader = Dali::BitmapLoader::New( imageUrl );
+ loader.Load();
+ PixelData pixelData = loader.GetPixelData();
+ if( pixelData )
+ {
+ texture = Texture::New( TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() );
+ texture.Upload( pixelData );
+ texture.GenerateMipmaps();
+ }
+
+ return texture;
+}
+
// Type registration
BaseHandle Create()
{
using namespace Dali;
-void LookAt(Matrix& result, const Vector3& eye, const Vector3& target, const Vector3& up)
-{
- Vector3 vZ = target - eye;
- vZ.Normalize();
-
- Vector3 vX = up.Cross(vZ);
- vX.Normalize();
-
- Vector3 vY = vZ.Cross(vX);
- vY.Normalize();
-
- result.SetInverseTransformComponents(vX, vY, vZ, eye);
-}
-
-
Model3dView::Model3dView()
: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) )
{
- mTexture0Url = "";
- mTexture1Url = "";
- mTexture2Url = "";
-
mIlluminationType = Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP;
mCameraFOV = Math::PI_OVER_180 * 45.f;
void Model3dView::LoadTextures()
{
if( !mTextureSet )
- return ;
-
- if( (mTexture0Url != "") && (mIlluminationType != Toolkit::Model3dView::DIFFUSE) )
{
- std::string imgUrl = mImagesUrl + mTexture0Url;
-
- //Load textures
- Image tex0 = ResourceImage::New( imgUrl );
- if( tex0 )
- {
- mTextureSet.SetImage( 0u, tex0 );
- }
+ return;
}
- if( (mTexture1Url != "") && (mIlluminationType == Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP) )
+ Sampler sampler = Sampler::New();
+ sampler.SetFilterMode( FilterMode::LINEAR_MIPMAP_LINEAR, FilterMode::LINEAR_MIPMAP_LINEAR );
+
+ // Setup diffuse texture.
+ if( !mTexture0Url.empty() && ( mIlluminationType != Toolkit::Model3dView::DIFFUSE ) )
{
- std::string imgUrl = mImagesUrl + mTexture1Url;
+ std::string imageUrl = mImagesUrl + mTexture0Url;
//Load textures
- Image tex1 = ResourceImage::New( imgUrl );
- if (tex1)
+ Texture diffuseTexture = LoadTexture( imageUrl.c_str() );
+ if( diffuseTexture )
{
- mTextureSet.SetImage( 1u, tex1 );
+ mTextureSet.SetTexture( DIFFUSE_TEXTURE_INDEX, diffuseTexture );
+ mTextureSet.SetSampler( DIFFUSE_TEXTURE_INDEX, sampler );
}
}
- if( (mTexture2Url != "") && (mIlluminationType == Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP) )
+ if( mIlluminationType == Toolkit::Model3dView::DIFFUSE_WITH_NORMAL_MAP )
{
- std::string imgUrl = mImagesUrl + mTexture2Url;
+ // Setup normal map texture.
+ if( !mTexture1Url.empty() )
+ {
+ std::string imageUrl = mImagesUrl + mTexture1Url;
- //Load textures
- Image tex2 = ResourceImage::New( imgUrl );
- if( tex2 )
+ //Load textures
+ Texture normalTexture = LoadTexture( imageUrl.c_str() );
+ if( normalTexture )
+ {
+ mTextureSet.SetTexture( NORMAL_TEXTURE_INDEX, normalTexture );
+ mTextureSet.SetSampler( NORMAL_TEXTURE_INDEX, sampler );
+ }
+ }
+ if( !mTexture2Url.empty() )
{
- mTextureSet.SetImage( 2u, tex2 );
+ // Setup gloss map texture.
+ std::string imageUrl = mImagesUrl + mTexture2Url;
+
+ //Load textures
+ Texture glossTexture = LoadTexture( imageUrl.c_str() );
+ if( glossTexture )
+ {
+ mTextureSet.SetTexture( GLOSS_TEXTURE_INDEX, glossTexture );
+ mTextureSet.SetSampler( GLOSS_TEXTURE_INDEX, sampler );
+ }
}
}
}
-#ifndef __DALI_TOOLKIT_INTERNAL_MODEL3D_VIEW_H__
-#define __DALI_TOOLKIT_INTERNAL_MODEL3D_VIEW_H__
+#ifndef DALI_TOOLKIT_INTERNAL_MODEL3D_VIEW_H
+#define DALI_TOOLKIT_INTERNAL_MODEL3D_VIEW_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
*/
// EXTERNAL INCLUDES
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
} // namespace Dali
-#endif // __DALI_TOOLKIT_INTERNAL_MODEL_VIEW_H__
+#endif // DALI_TOOLKIT_INTERNAL_MODEL_VIEW_H
-#ifndef __DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H__
-#define __DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H__
+#ifndef DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H
+#define DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
*/
// EXTERNAL INCLUDES
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
#include <limits>
namespace Dali
-#endif // __DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H__
+#endif // DALI_TOOLKIT_INTERNAL_OBJ_LOADER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/devel-api/images/texture-set-image.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
textureSet = TextureSet::New();
}
- textureSet.SetImage( 0u, image );
+ TextureSetImage( textureSet, 0u, image );
}
void PageTurnView::Page::UseEffect(Shader newShader)
-#ifndef __DALI_TOOLKIT_INTERNAL_PAGE_TURN_VIEW_IMPL_H__
-#define __DALI_TOOLKIT_INTERNAL_PAGE_TURN_VIEW_IMPL_H__
+#ifndef DALI_TOOLKIT_INTERNAL_PAGE_TURN_VIEW_IMPL_H
+#define DALI_TOOLKIT_INTERNAL_PAGE_TURN_VIEW_IMPL_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <dali/devel-api/common/map-wrapper.h>
#include <dali/public-api/actors/layer.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
} // namespace Toolkit
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_PAGE_TURN_VIEW_IMPL_H__ */
+
+#endif // DALI_TOOLKIT_INTERNAL_PAGE_TURN_VIEW_IMPL_H
-#ifndef __DALI_TOOLKIT_INTERNAL_BORDER_RENDERER_H__
-#define __DALI_TOOLKIT_INTERNAL_BORDER_RENDERER_H__
+#ifndef DALI_TOOLKIT_INTERNAL_BORDER_RENDERER_H
+#define DALI_TOOLKIT_INTERNAL_BORDER_RENDERER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
* limitations under the License.
*
*/
+
// EXTERNAL INCLUDES
-#include <dali/devel-api/rendering/geometry.h>
+#include <dali/public-api/rendering/geometry.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/renderers/control-renderer-impl.h>
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_BORDER_RENDERER_H__ */
+#endif // DALI_TOOLKIT_INTERNAL_BORDER_RENDERER_H
Geometry geometry = mFactoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
- geometry = Geometry::QUAD();
+ geometry = RendererFactoryCache::CreateQuadGeometry();
mFactoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
}
-#ifndef __DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_DATA_IMPL_H__
-#define __DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_DATA_IMPL_H__
+#ifndef DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_DATA_IMPL_H
+#define DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_DATA_IMPL_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <dali/public-api/math/vector2.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
+// INTERNAL INCLUDES
#include <dali-toolkit/internal/controls/renderers/control-renderer-impl.h>
namespace Dali
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_DATA_IMPL_H__ */
+#endif // DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_DATA_IMPL_H
-#ifndef __DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_H__
-#define __DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_H__
+#ifndef DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_H
+#define DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
*
*/
-
// EXTERNAL INCLUDES
-#include <dali/public-api/object/base-object.h>
#include <dali/public-api/images/image-operations.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/rendering/shader.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
#include <dali-toolkit/devel-api/controls/renderer-factory/control-renderer.h>
+#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
#include <dali-toolkit/internal/controls/renderers/renderer-factory-cache.h>
namespace Dali
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_H___ */
+#endif // DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
Geometry geometry = mFactoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
- geometry = Geometry::QUAD();
+ geometry = RendererFactoryCache::CreateQuadGeometry();
mFactoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
}
//Set up the texture set
TextureSet textureSet = TextureSet::New();
- Dali::BufferImage lookupTexture = mGradient->GenerateLookupTexture();
- textureSet.SetImage( 0u, lookupTexture );
+ Dali::Texture lookupTexture = mGradient->GenerateLookupTexture();
+ textureSet.SetTexture( 0u, lookupTexture );
Dali::WrapMode::Type wrap = GetWrapMode( mGradient->GetSpreadMethod() );
Sampler sampler = Sampler::New();
sampler.SetWrapMode( wrap, wrap );
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
* If the stops have not covered the whole zero to one range,
* the REPEAT spread behaves different from the two others in the lookup texture generation.
*/
-BufferImage Gradient::GenerateLookupTexture()
+Dali::Texture Gradient::GenerateLookupTexture()
{
std::sort( mGradientStops.Begin(), mGradientStops.End() );
* Generate the pixels with the color transit from one stop to next.
*/
unsigned int resolution = EstimateTextureResolution();
- BufferImage texture = BufferImage::New( resolution, 1 );
- PixelBuffer* pixels = texture.GetBuffer();
+
+ unsigned int bufferSize = resolution * 4u;
+ unsigned char* pixels = new unsigned char[ bufferSize ];
+ PixelData pixelData = PixelData::New( pixels, bufferSize, resolution, 1u, Pixel::RGBA8888, PixelData::DELETE_ARRAY );
+
int segmentStart = 0;
int segmentEnd = 0;
int k = 0;
segmentStart = segmentEnd;
}
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, resolution, 1u );
+ texture.Upload( pixelData );
+
// remove the stops added temporarily for generating the pixels, as the spread method might get changed later
if( tempLastStop )
{
-#ifndef __DALI_TOOLKIT_INTERNAL_GRADIENT_H__
-#define __DALI_TOOLKIT_INTERNAL_GRADIENT_H__
+#ifndef DALI_TOOLKIT_INTERNAL_GRADIENT_H
+#define DALI_TOOLKIT_INTERNAL_GRADIENT_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
*/
//EXTERNAL INCLUDES
-#include <dali/public-api/math/matrix3.h>
-#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/images/buffer-image.h>
+#include <dali/public-api/math/matrix3.h>
+#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/rendering/texture.h>
namespace Dali
{
/**
* Generate the lookup texture with the gradient stops.
- * @return the lookup texture which transit smoothly between stops.
+ * @return The lookup texture which transit smoothly between stops.
*/
- BufferImage GenerateLookupTexture();
+ Dali::Texture GenerateLookupTexture();
private:
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_GRADIENT_RENDERER_H__ */
+#endif // DALI_TOOLKIT_INTERNAL_GRADIENT_RENDERER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include "image-atlas-manager.h"
// EXTERNAL HEADER
+#include <dali/devel-api/images/texture-set-image.h>
#include <dali/public-api/images/resource-image.h>
namespace Dali
}
mAtlasList.push_back( newAtlas );
TextureSet textureSet = TextureSet::New();
- textureSet.SetImage( 0u, newAtlas.GetAtlas() );
+ TextureSetImage( textureSet, 0u, newAtlas.GetAtlas() );
mTextureSetList.push_back( textureSet );
}
-#ifndef __DALI_TOOLKIT_IMAGE_ATLAS_MANAGER_H__
-#define __DALI_TOOLKIT_IMAGE_ATLAS_MANAGER_H__
+#ifndef DALI_TOOLKIT_IMAGE_ATLAS_MANAGER_H
+#define DALI_TOOLKIT_IMAGE_ATLAS_MANAGER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <string>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/ref-object.h>
-#include <dali/devel-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/texture-set.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/image-atlas/image-atlas.h>
} // namespace Dali
-#endif // __DALI_TOOLKIT_ATLAS_MANAGER_H__
+#endif // DALI_TOOLKIT_ATLAS_MANAGER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/images/native-image.h>
#include <dali/devel-api/images/atlas.h>
+#include <dali/devel-api/images/texture-set-image.h>
#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
#include <dali/integration-api/debug.h>
geometry = factoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
- geometry = Geometry::QUAD();
+ geometry = RendererFactoryCache::CreateQuadGeometry();
factoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
}
}
{
// use broken image
textureSet = TextureSet::New();
- textureSet.SetImage( 0u, RendererFactory::GetBrokenRendererImage() );
+ TextureSetImage( textureSet, 0u, RendererFactory::GetBrokenRendererImage() );
}
else
{
Atlas image = Atlas::New( mPixels.GetWidth(), mPixels.GetHeight(), mPixels.GetPixelFormat() );
image.Upload( mPixels, 0, 0 );
textureSet = TextureSet::New();
- textureSet.SetImage( 0u, image );
+ TextureSetImage( textureSet, 0u, image );
}
}
}
ResourceImage resourceImage = Dali::ResourceImage::New( url, mDesiredSize, mFittingMode, mSamplingMode );
resourceImage.LoadingFinishedSignal().Connect( this, &ImageRenderer::OnImageLoaded );
textureSet = TextureSet::New();
- textureSet.SetImage( 0u, resourceImage );
+ TextureSetImage( textureSet, 0u, resourceImage );
}
}
textureSet = TextureSet::New();
mImpl->mRenderer.SetTextures( textureSet );
}
- textureSet.SetImage( 0u, image );
+ TextureSetImage( textureSet, 0u, image );
}
}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/integration-api/platform-abstraction.h>
#include <dali/public-api/images/buffer-image.h>
#include <dali/public-api/images/resource-image.h>
+#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL IINCLUDES
#include <dali-toolkit/internal/controls/renderers/renderer-factory-impl.h>
TextureSet textureSet = mImpl->mRenderer.GetTextures();
if( textureSet )
{
- textureSet.SetImage( 0u, mCroppedImage );
+ TextureSetImage( textureSet, 0u, mCroppedImage );
if( mStretchPixelsX.Size() == 1 && mStretchPixelsY.Size() == 1 )
{
-#ifndef __DALI_TOOLKIT_INTERNAL_N_PATCH_RENDERER_H__
-#define __DALI_TOOLKIT_INTERNAL_N_PATCH_RENDERER_H__
+#ifndef DALI_TOOLKIT_INTERNAL_N_PATCH_RENDERER_H
+#define DALI_TOOLKIT_INTERNAL_N_PATCH_RENDERER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/nine-patch-image.h>
#include <dali/public-api/images/image-operations.h>
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/shader.h>
-#include <dali/devel-api/rendering/sampler.h>
+#include <dali/public-api/images/nine-patch-image.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/sampler.h>
+#include <dali/public-api/rendering/shader.h>
namespace Dali
{
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_N_PATCH_RENDERER_H__ */
+#endif // DALI_TOOLKIT_INTERNAL_N_PATCH_RENDERER_H
return mDebugRenderer;
}
+Geometry RendererFactoryCache::CreateQuadGeometry()
+{
+ const float halfWidth = 0.5f;
+ const float halfHeight = 0.5f;
+ struct QuadVertex { Vector2 position;};
+ QuadVertex quadVertexData[4] =
+ {
+ { Vector2(-halfWidth, -halfHeight) },
+ { Vector2(-halfWidth, halfHeight) },
+ { Vector2( halfWidth, -halfHeight) },
+ { Vector2( halfWidth, halfHeight) }
+ };
+
+ Property::Map quadVertexFormat;
+ quadVertexFormat["aPosition"] = Property::VECTOR2;
+ PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+ quadVertices.SetData( quadVertexData, 4 );
+
+ // Create the geometry object
+ Geometry geometry = Geometry::New();
+ geometry.AddVertexBuffer( quadVertices );
+ geometry.SetGeometryType( Geometry::TRIANGLE_STRIP );
+
+ return geometry;
+}
+
SvgRasterizeThread* RendererFactoryCache::GetSVGRasterizationThread()
{
if( !mSvgRasterizeThread )
-#ifndef __DALI_TOOLKIT_RENDERER_FACTORY_CACHE_H__
-#define __DALI_TOOLKIT_RENDERER_FACTORY_CACHE_H__
+#ifndef DALI_TOOLKIT_RENDERER_FACTORY_CACHE_H
+#define DALI_TOOLKIT_RENDERER_FACTORY_CACHE_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <dali/public-api/math/uint-16-pair.h>
#include <dali/public-api/object/ref-object.h>
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/shader.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/shader.h>
#include <dali/devel-api/common/owner-container.h>
#include <dali/devel-api/object/weak-handle.h>
*/
void SaveShader( ShaderType type, Shader shader );
+ /*
+ * Greate the quad geometry.
+ * Quad geometry is shared by multiple kind of Renderer, so implement it in the factory-cache.
+ */
+ static Geometry CreateQuadGeometry();
+
/**
* Create the grid geometry.
* @param[in] gridSize The size of the grid.
} // namespace Dali
-#endif /*__DALI_TOOLKIT_RENDERER_FACTORY_CACHE_H__ */
+#endif // DALI_TOOLKIT_RENDERER_FACTORY_CACHE_H
-#ifndef __DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H__
-#define __DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H__
+#ifndef DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H
+#define DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/mutex.h>
#include <dali/devel-api/threading/thread.h>
-#include <dali/devel-api/rendering/texture-set.h>
-#include <dali/devel-api/images/pixel-data.h>
#include <dali/public-api/images/buffer-image.h>
+#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/ref-object.h>
-#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
+#include <dali/public-api/rendering/texture-set.h>
struct NSVGimage;
struct NSVGrasterizer;
} // namespace Dali
-#endif /* __DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H__ */
+#endif // DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H
#include <dali/public-api/common/stage.h>
#include <dali/public-api/math/vector4.h>
#include <dali/devel-api/images/atlas.h>
+#include <dali/devel-api/images/texture-set-image.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
Geometry geometry = mFactoryCache.GetGeometry( RendererFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
- geometry = Geometry::QUAD();
+ geometry = mFactoryCache.CreateQuadGeometry();
mFactoryCache.SaveGeometry( RendererFactoryCache::QUAD_GEOMETRY, geometry );
}
TextureSet textureSet = TextureSet::New();
if( textureSet )
{
- textureSet.SetImage( 0u, texture );
+ TextureSetImage( textureSet, 0u, texture );
}
}
}
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/object/property-map.h>
-#include <dali/devel-api/object/property-buffer.h>
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/texture-set.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/property-buffer.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/shader.h>
+#include <dali/public-api/rendering/texture-set.h>
namespace Dali
{
-#ifndef __DALI_TOOLKIT_INTERNAL_BOUNCING_EFFECT_ACTOR_H__
-#define __DALI_TOOLKIT_INTERNAL_BOUNCING_EFFECT_ACTOR_H__
+#ifndef DALI_TOOLKIT_INTERNAL_BOUNCING_EFFECT_ACTOR_H
+#define DALI_TOOLKIT_INTERNAL_BOUNCING_EFFECT_ACTOR_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_BOUNCING_EFFECT_ACTOR_H__ */
+#endif // DALI_TOOLKIT_INTERNAL_BOUNCING_EFFECT_ACTOR_H
}
}
-Vector2 ItemView::GetDomainSize() const
-{
- Actor self = Self();
-
- float minScrollPosition = self.GetProperty<float>(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN_Y);
- float maxScrollPosition = self.GetProperty<float>(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX_Y);
-
- return Vector2(0.0f, fabs(GetScrollPosition(minScrollPosition, self.GetCurrentSize()) - GetScrollPosition(-maxScrollPosition, self.GetCurrentSize())));
-}
-
bool ItemView::IsLayoutScrollable(const Vector3& layoutSize)
{
Actor self = Self();
void ReplaceItems(const ItemContainer& replacementItems, float durationSeconds);
/**
- * @copydoc Toolkit::Scrollable::GetDomainSize
- */
- Vector2 GetDomainSize() const;
-
- /**
* @copydoc Toolkit::Scrollable::GetCurrentScrollPosition
*/
Vector2 GetCurrentScrollPosition() const;
return -GetPropertyPosition();
}
-Vector2 ScrollView::GetDomainSize() const
-{
- Vector3 size = Self().GetCurrentSize();
-
- const RulerDomain& xDomain = GetRulerX()->GetDomain();
- const RulerDomain& yDomain = GetRulerY()->GetDomain();
-
- Vector2 domainSize;
- domainSize.x = xDomain.max - xDomain.min - size.x;
- domainSize.y = yDomain.max - yDomain.min - size.y;
- return domainSize;
-}
-
void ScrollView::TransformTo(const Vector2& position,
DirectionBias horizontalBias, DirectionBias verticalBias)
{
Vector2 GetCurrentScrollPosition() const;
/**
- * @copydoc Toolkit::Scrollable::GetDomainSize
- */
- Vector2 GetDomainSize() const;
-
- /**
* @copydoc ScrollTo(const Vector2&)
*/
void TransformTo(const Vector2& position,
void SetOvershootEnabled(bool enable);
/**
- * Gets the size of the domain (minimum/maximum extents for each axis to scroll to)
- * @return the domain size
- */
- virtual Vector2 GetDomainSize() const = 0;
-
- /**
* Adds actor as an Overlay to Scrollable
* This method is called by Add-on UI components
* such as scroll bars, page indicators.
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
#include <cmath>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/common/stage.h>
-#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
{
#if defined(DEBUG_ENABLED)
- Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS");
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS");
#endif
- const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+const float DEFAULT_SCROLL_SPEED = 1200.f; ///< The default scroll speed for the text editor in pixels/second.
} // unnamed namespace
namespace
mController->GetLayoutEngine().SetLayout( LayoutEngine::MULTI_LINE_BOX );
+ // Enables the text input.
mController->EnableTextInput( mDecorator );
+ // Enables the vertical scrolling after the text input has been enabled.
+ mController->SetVerticalScrollEnabled( true );
+
+ // Disables the horizontal scrolling.
+ mController->SetHorizontalScrollEnabled( false );
+
mController->SetMaximumNumberOfCharacters( std::numeric_limits<Length>::max() );
+ // Enable the smooth handle panning.
+ mController->SetSmoothHandlePanEnabled( true );
+
// Forward input events to controller
EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
GetTapGestureDetector().SetMaximumTapsRequired( 2 );
mDecorator->SetBoundingBox( Rect<int>( 0.0f, 0.0f, stageSize.width, stageSize.height ) );
}
- // Flip vertically the 'left' selection handle
- mDecorator->FlipHandleVertically( LEFT_SELECTION_HANDLE, true );
+ // Whether to flip the selection handles as soon as they cross.
+ mDecorator->FlipSelectionHandlesOnCrossEnabled( true );
+
+ // Set the default scroll speed.
+ mDecorator->SetScrollSpeed( DEFAULT_SCROLL_SPEED );
// Fill-parent area by default
self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
mController->GetLayoutEngine().SetLayout( LayoutEngine::SINGLE_LINE_BOX );
+ // Enables the text input.
mController->EnableTextInput( mDecorator );
+ // Enables the horizontal scrolling after the text input has been enabled.
+ mController->SetHorizontalScrollEnabled( true );
+
+ // Disables the vertical scrolling.
+ mController->SetVerticalScrollEnabled( false );
+
+ // Disable the smooth handle panning.
+ mController->SetSmoothHandlePanEnabled( false );
+
// Forward input events to controller
EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
GetTapGestureDetector().SetMaximumTapsRequired( 2 );
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/devel-api/rendering/renderer.h>
-
-// INTERNAL INCLUDES
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/devel-api/images/texture-set-image.h>
namespace Dali
{
// Add effect texture to blend-two-image custom shader
TextureSet textureSet = mActorForBlending.GetRendererAt(0).GetTextures();
- textureSet.SetImage( 1u, mInputImage );
+ TextureSetImage( textureSet, 1u, mInputImage );
SetupCamera();
CreateRenderTasks();
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/common/stage.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/devel-api/images/texture-set-image.h>
+
+// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
namespace Dali
InitializeControlRenderer( mActorForComposite, mRendererForEmboss2, rendererMap );
TextureSet textureSet1 = TextureSet::New();
- textureSet1.SetImage( 0, mImageForEmboss1 );
+ TextureSetImage( textureSet1, 0, mImageForEmboss1 );
mActorForComposite.GetRendererAt(0).SetTextures( textureSet1 );
mActorForComposite.GetRendererAt(0).RegisterProperty( COLOR_UNIFORM_NAME, Color::BLACK );
TextureSet textureSet2 = TextureSet::New();
- textureSet2.SetImage( 0, mImageForEmboss2 );
+ TextureSetImage( textureSet2, 0, mImageForEmboss2 );
mActorForComposite.GetRendererAt(1).SetTextures( textureSet2 );
mActorForComposite.GetRendererAt(1).RegisterProperty( COLOR_UNIFORM_NAME, Color::WHITE );
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <dali/public-api/common/stage.h>
#include <dali/public-api/render-tasks/render-task-list.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
namespace
{
( isFirstPositionOfLine && !isRightToLeftParagraph ) );
cursorInfo.secondaryPosition.x = -glyphMetrics.xBearing + secondaryPosition.x + ( addGlyphAdvance ? glyphMetrics.advance : 0.f );
- cursorInfo.secondaryPosition.y = cursorInfo.lineOffset + cursorInfo.lineHeight - cursorInfo.secondaryCursorHeight - line.descender - ( glyphMetrics.fontHeight - glyphMetrics.ascender );
+ cursorInfo.secondaryPosition.y = cursorInfo.lineOffset + cursorInfo.lineHeight - cursorInfo.secondaryCursorHeight;
// Transform the cursor info from line's coords to text's coords.
cursorInfo.secondaryPosition.x += line.alignmentOffset;
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <dali/integration-api/debug.h>
-
-#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/events/pan-gesture.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/property-notification.h>
-
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
const Dali::Vector4 HANDLE_COLOR( 0.0f, (183.0f / 255.0f), (229.0f / 255.0f), 1.0f );
-const unsigned int CURSOR_BLINK_INTERVAL = 500u; // Cursor blink interval
-const float TO_MILLISECONDS = 1000.f;
-const float TO_SECONDS = 1.f / TO_MILLISECONDS;
+const unsigned int CURSOR_BLINK_INTERVAL = 500u; ///< Cursor blink interval in milliseconds.
+const float TO_MILLISECONDS = 1000.f; ///< Converts from seconds to milliseconds.
+const float TO_SECONDS = 1.f / TO_MILLISECONDS; ///< Converts from milliseconds to seconds.
-const unsigned int SCROLL_TICK_INTERVAL = 50u;
+const unsigned int SCROLL_TICK_INTERVAL = 50u; ///< Scroll interval in milliseconds.
+const float SCROLL_THRESHOLD = 10.f; ///< Threshold in pixels close to the edges of the decorator boundaries from where the scroll timer starts to emit signals.
+const float SCROLL_SPEED = 300.f; ///< The scroll speed in pixels/second.
-const float SCROLL_THRESHOLD = 10.f;
-const float SCROLL_SPEED = 300.f;
-const float SCROLL_DISTANCE = SCROLL_SPEED * SCROLL_TICK_INTERVAL * TO_SECONDS;
+const float SCROLL_DISTANCE = SCROLL_SPEED * SCROLL_TICK_INTERVAL * TO_SECONDS; ///< Distance in pixels scrolled in one second.
-const float CURSOR_WIDTH = 1.f;
+const float CURSOR_WIDTH = 1.f; ///< The cursor's width in pixels.
/**
* structure to hold coordinates of each quad, which will make up the mesh.
{
HandleImpl()
: position(),
+ globalPosition(),
size(),
lineHeight( 0.0f ),
grabDisplacementX( 0.f ),
ImageView markerActor;
Vector2 position;
+ Vector2 globalPosition;
Size size;
float lineHeight; ///< Not the handle height
float grabDisplacementX;
mFlipSelectionHandlesOnCross( false ),
mFlipLeftSelectionHandleDirection( false ),
mFlipRightSelectionHandleDirection( false ),
- mHandlePanning( false ),
- mHandleCurrentCrossed( false ),
- mHandlePreviousCrossed( false ),
- mNotifyEndOfScroll( false )
+ mIsHandlePanning( false ),
+ mIsHandleCurrentlyCrossed( false ),
+ mIsHandlePreviouslyCrossed( false ),
+ mNotifyEndOfScroll( false ),
+ mHorizontalScrollingEnabled( false ),
+ mVerticalScrollingEnabled( false )
{
mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
mHighlightShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
if( mPrimaryCursor )
{
const CursorImpl& cursor = mCursor[PRIMARY_CURSOR];
- mPrimaryCursorVisible = ( cursor.position.x + mCursorWidth <= mControlSize.width ) && ( cursor.position.x >= 0.f );
+ mPrimaryCursorVisible = ( ( cursor.position.x + mCursorWidth <= mControlSize.width ) &&
+ ( cursor.position.x >= 0.f ) &&
+ ( cursor.position.y + cursor.cursorHeight <= mControlSize.height ) &&
+ ( cursor.position.y >= 0.f ) );
if( mPrimaryCursorVisible )
{
mPrimaryCursor.SetPosition( cursor.position.x,
if( mSecondaryCursor )
{
const CursorImpl& cursor = mCursor[SECONDARY_CURSOR];
- mSecondaryCursorVisible = ( cursor.position.x + mCursorWidth <= mControlSize.width ) && ( cursor.position.x >= 0.f );
+ mSecondaryCursorVisible = ( ( cursor.position.x + mCursorWidth <= mControlSize.width ) &&
+ ( cursor.position.x >= 0.f ) &&
+ ( cursor.position.y + cursor.cursorHeight <= mControlSize.height ) &&
+ ( cursor.position.y >= 0.f ) );
if( mSecondaryCursorVisible )
{
mSecondaryCursor.SetPosition( cursor.position.x,
bool newGrabHandlePosition = false;
if( grabHandle.active )
{
- const bool isVisible = ( grabHandle.position.x + floor( 0.5f * mCursorWidth ) <= mControlSize.width ) && ( grabHandle.position.x >= 0.f );
+ const bool isVisible = ( ( grabHandle.position.x + floor( 0.5f * mCursorWidth ) <= mControlSize.width ) &&
+ ( grabHandle.position.x >= 0.f ) &&
+ ( grabHandle.position.y <= mControlSize.height - grabHandle.lineHeight ) &&
+ ( grabHandle.position.y >= 0.f ) );
if( isVisible )
{
bool newSecondaryHandlePosition = false;
if( primary.active || secondary.active )
{
- const bool isPrimaryVisible = ( primary.position.x <= mControlSize.width ) && ( primary.position.x >= 0.f );
- const bool isSecondaryVisible = ( secondary.position.x <= mControlSize.width ) && ( secondary.position.x >= 0.f );
+ const bool isPrimaryVisible = ( ( primary.position.x <= mControlSize.width ) &&
+ ( primary.position.x >= 0.f ) &&
+ ( primary.position.y <= mControlSize.height - primary.lineHeight ) &&
+ ( primary.position.y >= 0.f ) );
+ const bool isSecondaryVisible = ( ( secondary.position.x <= mControlSize.width ) &&
+ ( secondary.position.x >= 0.f ) &&
+ ( secondary.position.y <= mControlSize.height - secondary.lineHeight ) &&
+ ( secondary.position.y >= 0.f ) );
if( isPrimaryVisible || isSecondaryVisible )
{
void SetupGestures()
{
+ // Will consume tap gestures on handles.
mTapDetector = TapGestureDetector::New();
- mTapDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnTap );
- mPanGestureDetector = PanGestureDetector::New();
- mPanGestureDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnPan );
+ // Will consume double tap gestures on handles.
+ mTapDetector.SetMaximumTapsRequired( 2u );
+
+ // Will consume long press gestures on handles.
+ mLongPressDetector = LongPressGestureDetector::New();
+
+ // Detects pan gestures on handles.
+ mPanDetector = PanGestureDetector::New();
+ mPanDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnPan );
}
void CreateActiveLayer()
grabHandle.actor.SetColor( mHandleColor );
grabHandle.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnGrabHandleTouched );
- mTapDetector.Attach( grabHandle.grabArea );
- mPanGestureDetector.Attach( grabHandle.grabArea );
+
+ // The grab handle's actor is attached to the tap and long press detectors in order to consume these events.
+ // Note that no callbacks are connected to any signal emitted by the tap and long press detectors.
+ mTapDetector.Attach( grabHandle.actor );
+ mLongPressDetector.Attach( grabHandle.actor );
+
+ // The grab handle's area is attached to the pan detector.
+ // The OnPan() method is connected to the signals emitted by the pan detector.
+ mPanDetector.Attach( grabHandle.grabArea );
mActiveLayer.Add( grabHandle.actor );
}
primary.grabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
- mTapDetector.Attach( primary.grabArea );
- mPanGestureDetector.Attach( primary.grabArea );
primary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
+ // The handle's actor is attached to the tap and long press detectors in order to consume these events.
+ // Note that no callbacks are connected to any signal emitted by the tap and long press detectors.
+ mTapDetector.Attach( primary.actor );
+ mLongPressDetector.Attach( primary.actor );
+
+ // The handle's area is attached to the pan detector.
+ // The OnPan() method is connected to the signals emitted by the pan detector.
+ mPanDetector.Attach( primary.grabArea );
+
primary.actor.Add( primary.grabArea );
CreateHandleMarker( primary, mHandleImages[LEFT_SELECTION_HANDLE_MARKER][HANDLE_IMAGE_RELEASED], LEFT_SELECTION_HANDLE );
secondary.grabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
- mTapDetector.Attach( secondary.grabArea );
- mPanGestureDetector.Attach( secondary.grabArea );
secondary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
+ // The handle's actor is attached to the tap and long press detectors in order to consume these events.
+ // Note that no callbacks are connected to any signal emitted by the tap and long press detectors.
+ mTapDetector.Attach( secondary.actor );
+ mLongPressDetector.Attach( secondary.actor );
+
+ // The handle's area is attached to the pan detector.
+ // The OnPan() method is connected to the signals emitted by the pan detector.
+ mPanDetector.Attach( secondary.grabArea );
+
secondary.actor.Add( secondary.grabArea );
CreateHandleMarker( secondary, mHandleImages[RIGHT_SELECTION_HANDLE_MARKER][HANDLE_IMAGE_RELEASED], RIGHT_SELECTION_HANDLE );
// The grab handle position in world coords.
// The active layer's world position is the center of the active layer. The origin of the
// coord system of the handles is the top left of the active layer.
- position.x = parentWorldPosition.x - 0.5f * mControlSize.width + handle.position.x;
- position.y = parentWorldPosition.y - 0.5f * mControlSize.height + handle.position.y;
+ position.x = parentWorldPosition.x - 0.5f * mControlSize.width + handle.position.x + ( mSmoothHandlePanEnabled ? handle.grabDisplacementX : 0.f );
+ position.y = parentWorldPosition.y - 0.5f * mControlSize.height + handle.position.y + ( mSmoothHandlePanEnabled ? handle.grabDisplacementY : 0.f );
}
void SetGrabHandlePosition()
if( grabHandle.actor )
{
- grabHandle.actor.SetPosition( grabHandle.position.x + floor( 0.5f * mCursorWidth ),
- yLocalPosition ); // TODO : Fix for multiline.
+ grabHandle.actor.SetPosition( grabHandle.position.x + floor( 0.5f * mCursorWidth ) + ( mSmoothHandlePanEnabled ? grabHandle.grabDisplacementX : 0.f ),
+ yLocalPosition + ( mSmoothHandlePanEnabled ? grabHandle.grabDisplacementY : 0.f ) );
}
}
// Whether to flip the handles if they are crossed.
bool crossFlip = false;
- if( mFlipSelectionHandlesOnCross || !mHandlePanning )
+ if( mFlipSelectionHandlesOnCross || !mIsHandlePanning )
{
- crossFlip = mHandleCurrentCrossed;
+ crossFlip = mIsHandleCurrentlyCrossed;
}
+ // Whether the handle was crossed before start the panning.
+ const bool isHandlePreviouslyCrossed = mFlipSelectionHandlesOnCross ? false : mIsHandlePreviouslyCrossed;
+
// Does not flip if both conditions are true (double flip)
- flipHandle = flipHandle != ( crossFlip || mHandlePreviousCrossed );
+ flipHandle = flipHandle != ( crossFlip || isHandlePreviouslyCrossed );
// Will flip the handles vertically if the user prefers it.
bool verticallyFlippedPreferred = handle.verticallyFlippedPreferred;
- if( crossFlip || mHandlePreviousCrossed )
+ if( crossFlip || isHandlePreviouslyCrossed )
{
if( isPrimaryHandle )
{
if( handle.actor )
{
- handle.actor.SetPosition( handle.position.x,
- yLocalPosition ); // TODO : Fix for multiline.
+ handle.actor.SetPosition( handle.position.x + ( mSmoothHandlePanEnabled ? handle.grabDisplacementX : 0.f ),
+ yLocalPosition + ( mSmoothHandlePanEnabled ? handle.grabDisplacementY : 0.f ) );
}
}
}
}
- void OnTap( Actor actor, const TapGesture& tap )
- {
- if( actor == mHandle[GRAB_HANDLE].actor )
- {
- // TODO
- }
- }
-
void DoPan( HandleImpl& handle, HandleType type, const PanGesture& gesture )
{
if( Gesture::Started == gesture.state )
{
handle.grabDisplacementX = handle.grabDisplacementY = 0.f;
+
+ handle.globalPosition.x = handle.position.x;
+ handle.globalPosition.y = handle.position.y;
}
handle.grabDisplacementX += gesture.displacement.x;
handle.grabDisplacementY += ( handle.verticallyFlipped ? -gesture.displacement.y : gesture.displacement.y );
- const float x = handle.position.x + handle.grabDisplacementX;
- const float y = handle.position.y + handle.lineHeight*0.5f + handle.grabDisplacementY;
+ const float x = handle.globalPosition.x + handle.grabDisplacementX;
+ const float y = handle.globalPosition.y + handle.grabDisplacementY + 0.5f * handle.lineHeight;
+ const float yVerticallyFlippedCorrected = y - ( handle.verticallyFlipped ? handle.lineHeight : 0.f );
- if( Gesture::Started == gesture.state ||
- Gesture::Continuing == gesture.state )
+ if( ( Gesture::Started == gesture.state ) ||
+ ( Gesture::Continuing == gesture.state ) )
{
Vector2 targetSize;
mController.GetTargetSize( targetSize );
- if( x < mScrollThreshold )
+ if( mHorizontalScrollingEnabled &&
+ ( x < mScrollThreshold ) )
{
mScrollDirection = SCROLL_RIGHT;
mHandleScrolling = type;
StartScrollTimer();
}
- else if( x > targetSize.width - mScrollThreshold )
+ else if( mHorizontalScrollingEnabled &&
+ ( x > targetSize.width - mScrollThreshold ) )
{
mScrollDirection = SCROLL_LEFT;
mHandleScrolling = type;
StartScrollTimer();
}
+ else if( mVerticalScrollingEnabled &&
+ ( yVerticallyFlippedCorrected < mScrollThreshold ) )
+ {
+ mScrollDirection = SCROLL_TOP;
+ mHandleScrolling = type;
+ StartScrollTimer();
+ }
+ else if( mVerticalScrollingEnabled &&
+ ( yVerticallyFlippedCorrected + handle.lineHeight > targetSize.height - mScrollThreshold ) )
+ {
+ mScrollDirection = SCROLL_BOTTOM;
+ mHandleScrolling = type;
+ StartScrollTimer();
+ }
else
{
mHandleScrolling = HANDLE_TYPE_COUNT;
mController.DecorationEvent( type, HANDLE_PRESSED, x, y );
}
- mHandlePanning = true;
+ mIsHandlePanning = true;
}
- else if( Gesture::Finished == gesture.state ||
- Gesture::Cancelled == gesture.state )
+ else if( ( Gesture::Finished == gesture.state ) ||
+ ( Gesture::Cancelled == gesture.state ) )
{
if( mScrollTimer &&
( mScrollTimer.IsRunning() || mNotifyEndOfScroll ) )
}
handle.pressed = false;
- mHandlePanning = false;
+ mIsHandlePanning = false;
}
}
bool OnGrabHandleTouched( Actor actor, const TouchData& touch )
{
+ HandleImpl& grabHandle = mHandle[GRAB_HANDLE];
+
// Switch between pressed/release grab-handle images
if( touch.GetPointCount() > 0 &&
- mHandle[GRAB_HANDLE].actor )
+ grabHandle.actor )
{
const PointState::Type state = touch.GetState( 0 );
if( PointState::DOWN == state )
{
- mHandle[GRAB_HANDLE].pressed = true;
+ grabHandle.pressed = true;
}
else if( ( PointState::UP == state ) ||
( PointState::INTERRUPTED == state ) )
{
- mHandle[GRAB_HANDLE].pressed = false;
+ grabHandle.pressed = false;
}
SetHandleImage( GRAB_HANDLE );
bool OnHandleOneTouched( Actor actor, const TouchData& touch )
{
+ HandleImpl& primarySelectionHandle = mHandle[LEFT_SELECTION_HANDLE];
+
// Switch between pressed/release selection handle images
if( touch.GetPointCount() > 0 &&
- mHandle[LEFT_SELECTION_HANDLE].actor )
+ primarySelectionHandle.actor )
{
const PointState::Type state = touch.GetState( 0 );
if( PointState::DOWN == state )
{
- mHandle[LEFT_SELECTION_HANDLE].pressed = true;
+ primarySelectionHandle.pressed = true;
}
else if( ( PointState::UP == state ) ||
( PointState::INTERRUPTED == state ) )
{
- mHandle[LEFT_SELECTION_HANDLE].pressed = false;
- mHandlePreviousCrossed = mHandleCurrentCrossed;
- mHandlePanning = false;
+ primarySelectionHandle.pressed = false;
+ mIsHandlePreviouslyCrossed = mIsHandleCurrentlyCrossed;
+ mIsHandlePanning = false;
}
SetHandleImage( LEFT_SELECTION_HANDLE );
bool OnHandleTwoTouched( Actor actor, const TouchData& touch )
{
+ HandleImpl& secondarySelectionHandle = mHandle[RIGHT_SELECTION_HANDLE];
+
// Switch between pressed/release selection handle images
if( touch.GetPointCount() > 0 &&
- mHandle[RIGHT_SELECTION_HANDLE].actor )
+ secondarySelectionHandle.actor )
{
const PointState::Type state = touch.GetState( 0 );
if( PointState::DOWN == state )
{
- mHandle[RIGHT_SELECTION_HANDLE].pressed = true;
+ secondarySelectionHandle.pressed = true;
}
else if( ( PointState::UP == state ) ||
( PointState::INTERRUPTED == state ) )
{
- mHandle[RIGHT_SELECTION_HANDLE].pressed = false;
- mHandlePreviousCrossed = mHandleCurrentCrossed;
- mHandlePanning = false;
+ secondarySelectionHandle.pressed = false;
+ mIsHandlePreviouslyCrossed = mIsHandleCurrentlyCrossed;
+ mIsHandlePanning = false;
}
SetHandleImage( RIGHT_SELECTION_HANDLE );
{
if( HANDLE_TYPE_COUNT != mHandleScrolling )
{
+ float x = 0.f;
+ float y = 0.f;
+
+ switch( mScrollDirection )
+ {
+ case SCROLL_RIGHT:
+ {
+ x = mScrollDistance;
+ break;
+ }
+ case SCROLL_LEFT:
+ {
+ x = -mScrollDistance;
+ break;
+ }
+ case SCROLL_TOP:
+ {
+ y = mScrollDistance;
+ break;
+ }
+ case SCROLL_BOTTOM:
+ {
+ y = -mScrollDistance;
+ break;
+ }
+ default:
+ break;
+ }
+
mController.DecorationEvent( mHandleScrolling,
HANDLE_SCROLLING,
- mScrollDirection == SCROLL_RIGHT ? mScrollDistance : -mScrollDistance,
- 0.f );
+ x,
+ y );
}
return true;
ControllerInterface& mController;
- TapGestureDetector mTapDetector;
- PanGestureDetector mPanGestureDetector;
+ TapGestureDetector mTapDetector;
+ PanGestureDetector mPanDetector;
+ LongPressGestureDetector mLongPressDetector;
+
Timer mCursorBlinkTimer; ///< Timer to signal cursor to blink
Timer mScrollTimer; ///< Timer used to scroll the text when the grab handle is moved close to the edges.
bool mFlipSelectionHandlesOnCross : 1; ///< Whether to flip the selection handles as soon as they cross.
bool mFlipLeftSelectionHandleDirection : 1; ///< Whether to flip the left selection handle image because of the character's direction.
bool mFlipRightSelectionHandleDirection : 1; ///< Whether to flip the right selection handle image because of the character's direction.
- bool mHandlePanning : 1; ///< Whether any of the handles is moving.
- bool mHandleCurrentCrossed : 1; ///< Whether the handles are crossed.
- bool mHandlePreviousCrossed : 1; ///< Whether the handles where crossed at the last handle touch up.
+ bool mIsHandlePanning : 1; ///< Whether any of the handles is moving.
+ bool mIsHandleCurrentlyCrossed : 1; ///< Whether the handles are crossed.
+ bool mIsHandlePreviouslyCrossed : 1; ///< Whether the handles where crossed at the last handle touch up.
bool mNotifyEndOfScroll : 1; ///< Whether to notify the end of the scroll.
+ bool mHorizontalScrollingEnabled : 1; ///< Whether the horizontal scrolling is enabled.
+ bool mVerticalScrollingEnabled : 1; ///< Whether the vertical scrolling is enabled.
+ bool mSmoothHandlePanEnabled : 1; ///< Whether to pan smoothly the handles.
};
DecoratorPtr Decorator::New( ControllerInterface& controller,
void Decorator::SetPosition( Cursor cursor, float x, float y, float cursorHeight, float lineHeight )
{
- mImpl->mCursor[cursor].position.x = x;
- mImpl->mCursor[cursor].position.y = y;
- mImpl->mCursor[cursor].cursorHeight = cursorHeight;
- mImpl->mCursor[cursor].lineHeight = lineHeight;
+ Impl::CursorImpl& cursorImpl = mImpl->mCursor[cursor];
+
+ cursorImpl.position.x = x;
+ cursorImpl.position.y = y;
+ cursorImpl.cursorHeight = cursorHeight;
+ cursorImpl.lineHeight = lineHeight;
}
void Decorator::GetPosition( Cursor cursor, float& x, float& y, float& cursorHeight, float& lineHeight ) const
{
- x = mImpl->mCursor[cursor].position.x;
- y = mImpl->mCursor[cursor].position.y;
- cursorHeight = mImpl->mCursor[cursor].cursorHeight;
- lineHeight = mImpl->mCursor[cursor].lineHeight;
+ const Impl::CursorImpl& cursorImpl = mImpl->mCursor[cursor];
+
+ x = cursorImpl.position.x;
+ y = cursorImpl.position.y;
+ cursorHeight = cursorImpl.cursorHeight;
+ lineHeight = cursorImpl.lineHeight;
}
const Vector2& Decorator::GetPosition( Cursor cursor ) const
{
if( ( LEFT_SELECTION_HANDLE == handleType ) || ( RIGHT_SELECTION_HANDLE == handleType ) )
{
- mImpl->mHandlePreviousCrossed = false;
+ mImpl->mIsHandlePreviouslyCrossed = false;
}
// TODO: this is a work-around.
// Adjust handle's displacement
Impl::HandleImpl& handle = mImpl->mHandle[handleType];
- handle.grabDisplacementX -= x - handle.position.x;
- handle.grabDisplacementY -= y - handle.position.y;
-
handle.position.x = x;
handle.position.y = y;
handle.lineHeight = height;
+
+ if( mImpl->mSmoothHandlePanEnabled )
+ {
+ handle.grabDisplacementX = 0.f;
+ handle.grabDisplacementY = 0.f;
+ }
}
void Decorator::GetPosition( HandleType handleType, float& x, float& y, float& height ) const
void Decorator::SetSelectionHandleFlipState( bool indicesSwapped, bool left, bool right )
{
- mImpl->mHandleCurrentCrossed = indicesSwapped;
+ mImpl->mIsHandleCurrentlyCrossed = indicesSwapped;
mImpl->mFlipLeftSelectionHandleDirection = left;
mImpl->mFlipRightSelectionHandleDirection = right;
}
mImpl->NotifyEndOfScroll();
}
+void Decorator::SetHorizontalScrollEnabled( bool enable )
+{
+ mImpl->mHorizontalScrollingEnabled = enable;
+}
+
+bool Decorator::IsHorizontalScrollEnabled() const
+{
+ return mImpl->mHorizontalScrollingEnabled;
+}
+
+void Decorator::SetVerticalScrollEnabled( bool enable )
+{
+ mImpl->mVerticalScrollingEnabled = enable;
+}
+
+bool Decorator::IsVerticalScrollEnabled() const
+{
+ return mImpl->mVerticalScrollingEnabled;
+}
+
+void Decorator::SetSmoothHandlePanEnabled( bool enable )
+{
+ mImpl->mSmoothHandlePanEnabled = enable;
+}
+
+bool Decorator::IsSmoothHandlePanEnabled() const
+{
+ return mImpl->mSmoothHandlePanEnabled;
+}
+
Decorator::~Decorator()
{
delete mImpl;
/**
* @brief Retrieves the blink-interval for a cursor.
*
- * @return The cursor blink-interval.
+ * @return The cursor blink-interval in seconds.
*/
float GetCursorBlinkInterval() const;
/**
* @brief Retrieves the blink-duration for a cursor.
*
- * @return The cursor blink-duration.
+ * @return The cursor blink-duration in seconds.
*/
float GetCursorBlinkDuration() const;
* It defines a square area inside the control, close to the edge.
* When the cursor enters this area, the decorator starts to send scroll events.
*
- * @param[in] threshold The scroll threshold.
+ * @param[in] threshold The scroll threshold in pixels.
*/
void SetScrollThreshold( float threshold );
/**
* @brief Retrieves the scroll threshold.
*
- * @retunr The scroll threshold.
+ * @retunr The scroll threshold in pixels.
*/
float GetScrollThreshold() const;
*
* Is the distance the text is going to be scrolled during a scroll interval.
*
- * @param[in] speed The scroll speed.
+ * @param[in] speed The scroll speed in pixels/second.
*/
void SetScrollSpeed( float speed );
/**
* @brief Retrieves the scroll speed.
*
- * @return The scroll speed.
+ * @return The scroll speed in pixels/second.
*/
float GetScrollSpeed() const;
*/
void NotifyEndOfScroll();
+ /**
+ * @copydoc Text::Controller::SetHorizontalScrollEnabled()
+ */
+ void SetHorizontalScrollEnabled( bool enable );
+
+ /**
+ * @copydoc Text::Controller::IsHorizontalScrollEnabled()
+ */
+ bool IsHorizontalScrollEnabled() const;
+
+ /**
+ * @copydoc Text::Controller::SetVerticalScrollEnabled()
+ */
+ void SetVerticalScrollEnabled( bool enable );
+
+ /**
+ * @copydoc Text::Controller::IsVerticalScrollEnabled()
+ */
+ bool IsVerticalScrollEnabled() const;
+
+ /**
+ * @copydoc Text::Controller::SetSmoothHandlePanEnabled()
+ */
+ void SetSmoothHandlePanEnabled( bool enable );
+
+ /**
+ * @copydoc Text::Controller::IsSmoothHandlePanEnabled()
+ */
+ bool IsSmoothHandlePanEnabled() const;
+
protected:
/**
if( isValidFont &&
isEmojiScript )
{
- const BufferImage bitmap = fontClient.CreateBitmap( fontId, glyphIndex );
+ const PixelData bitmap = fontClient.CreateBitmap( fontId, glyphIndex );
// For color emojis, the font is valid if the bitmap is RGBA.
isValidFont = bitmap && ( Pixel::BGRA8888 == bitmap.GetPixelFormat() );
}
void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph,
- const BufferImage& bitmap,
+ const PixelData& bitmap,
Dali::Toolkit::AtlasManager::AtlasSlot& slot )
{
DALI_LOG_INFO( gLogFilter, Debug::General, "Added glyph, font: %d index: %d\n", glyph.fontId, glyph.index );
if ( mAtlasManager.Add( bitmap, slot ) )
{
// A new atlas was created so set the texture set details for the atlas
- Dali::Atlas atlas = mAtlasManager.GetAtlasContainer( slot.mAtlasId );
+ Dali::Texture atlas = mAtlasManager.GetAtlasContainer( slot.mAtlasId );
TextureSet textureSet = TextureSet::New();
- textureSet.SetImage( 0u, atlas );
+ textureSet.SetTexture( 0u, atlas );
mAtlasManager.SetTextures( slot.mAtlasId, textureSet );
}
* @copydoc Toolkit::AtlasGlyphManager::Add
*/
void Add( const Text::GlyphInfo& glyph,
- const BufferImage& bitmap,
+ const PixelData& bitmap,
Dali::Toolkit::AtlasManager::AtlasSlot& slot );
/**
}
void AtlasGlyphManager::Add( const Text::GlyphInfo& glyph,
- const BufferImage& bitmap,
+ const PixelData& bitmap,
AtlasManager::AtlasSlot& slot )
{
GetImplementation(*this).Add( glyph, bitmap, slot );
* @param[out] slot information returned by atlas manager for addition
*/
void Add( const Text::GlyphInfo& glyph,
- const BufferImage& bitmap,
+ const PixelData& bitmap,
AtlasManager::AtlasSlot& slot );
/**
const uint32_t DEFAULT_BLOCK_HEIGHT( 16u );
const uint32_t SINGLE_PIXEL_PADDING( 1u );
const uint32_t DOUBLE_PIXEL_PADDING( SINGLE_PIXEL_PADDING << 1 );
- const uint32_t FILLED_PIXEL( -1 );
Toolkit::AtlasManager::AtlasSize EMPTY_SIZE;
}
return 0;
}
- Dali::Atlas atlas = Dali::Atlas::New( width, height, pixelformat );
- atlas.Clear( Vector4::ZERO );
+ Dali::Texture atlas = Dali::Texture::New( TextureType::TEXTURE_2D, pixelformat, width, height );
AtlasDescriptor atlasDescriptor;
atlasDescriptor.mAtlas = atlas;
atlasDescriptor.mSize = size;
atlasDescriptor.mTotalBlocks = ( ( width - 1u ) / blockWidth ) * ( ( height - 1u ) / blockHeight );
atlasDescriptor.mAvailableBlocks = atlasDescriptor.mTotalBlocks;
- atlasDescriptor.mHorizontalStrip = BufferImage::New( blockWidth, SINGLE_PIXEL_PADDING, pixelformat );
- atlasDescriptor.mVerticalStrip = BufferImage::New( SINGLE_PIXEL_PADDING, blockHeight - DOUBLE_PIXEL_PADDING, pixelformat );
-
- PixelBuffer* buffer = atlasDescriptor.mHorizontalStrip.GetBuffer();
- if( buffer == NULL )
- {
- DALI_LOG_ERROR("atlasDescriptor.mHorizontalStrip.GetBuffer() returns NULL\n");
- return 0;
- }
- memset( buffer, 0, atlasDescriptor.mHorizontalStrip.GetBufferSize() );
-
- buffer = atlasDescriptor.mVerticalStrip.GetBuffer();
- if( buffer == NULL )
- {
- DALI_LOG_ERROR("atlasDescriptor.mVerticalStrip.GetBuffer() returns NULL\n");
- return 0;
- }
- memset( buffer, 0, atlasDescriptor.mVerticalStrip.GetBufferSize() );
-
- BufferImage filledPixelImage = BufferImage::New( 1u, 1u, pixelformat );
- buffer = filledPixelImage.GetBuffer();
- if( buffer == NULL)
- {
- DALI_LOG_ERROR("filledPixelImage.GetBuffer() returns NULL\n");
- return 0;
- }
-
- memset( buffer, 0xFF, filledPixelImage.GetBufferSize() );
- atlas.Upload( filledPixelImage, 0, 0 );
+ unsigned int bufferSize( blockWidth * SINGLE_PIXEL_PADDING * Dali::Pixel::GetBytesPerPixel(pixelformat) );
+ unsigned char* bufferHorizontalStrip = new unsigned char[bufferSize];
+ memset( bufferHorizontalStrip, 0, bufferSize );
+ atlasDescriptor.mHorizontalStrip = PixelData::New( bufferHorizontalStrip, bufferSize, blockWidth, SINGLE_PIXEL_PADDING, pixelformat, PixelData::DELETE_ARRAY );
+
+ bufferSize = SINGLE_PIXEL_PADDING * (blockHeight - DOUBLE_PIXEL_PADDING) * Dali::Pixel::GetBytesPerPixel(pixelformat);
+ unsigned char* bufferVerticalStrip = new unsigned char[bufferSize];
+ memset( bufferVerticalStrip, 0, bufferSize );
+ atlasDescriptor.mVerticalStrip = PixelData::New( bufferVerticalStrip, bufferSize, SINGLE_PIXEL_PADDING, blockHeight - DOUBLE_PIXEL_PADDING, pixelformat, PixelData::DELETE_ARRAY );
+
+ bufferSize = Dali::Pixel::GetBytesPerPixel(pixelformat);
+ unsigned char* buffer = new unsigned char[bufferSize];
+ memset( buffer, 0xFF, bufferSize );
+ PixelData filledPixelImage = PixelData::New( buffer, bufferSize, 1u, 1u, pixelformat, PixelData::DELETE_ARRAY );
+ atlas.Upload( filledPixelImage, 0u, 0u, 0u, 0u, 1u, 1u );
mAtlasList.push_back( atlasDescriptor );
return mAtlasList.size();
}
mAddFailPolicy = policy;
}
-bool AtlasManager::Add( const BufferImage& image,
+bool AtlasManager::Add( const PixelData& image,
Toolkit::AtlasManager::AtlasSlot& slot,
Toolkit::AtlasManager::AtlasId atlas )
{
return result;
}
-void AtlasManager::UploadImage( const BufferImage& image,
+void AtlasManager::UploadImage( const PixelData& image,
const AtlasSlotDescriptor& desc )
{
// Get the atlas to upload the image to
SizeType height = image.GetHeight();
// Blit image 1 pixel to the right and down into the block to compensate for texture filtering
- if ( !mAtlasList[ atlas ].mAtlas.Upload( image,
+ if ( !mAtlasList[ atlas ].mAtlas.Upload( image, 0u, 0u,
blockOffsetX + SINGLE_PIXEL_PADDING,
- blockOffsetY + SINGLE_PIXEL_PADDING ) )
+ blockOffsetY + SINGLE_PIXEL_PADDING,
+ width, height) )
{
DALI_LOG_ERROR("Uploading image to Atlas Failed!.\n");
}
// Blit top strip
- if ( !mAtlasList[ atlas ].mAtlas.Upload( mAtlasList[ atlas ].mHorizontalStrip,
+ if ( !mAtlasList[ atlas ].mAtlas.Upload( mAtlasList[ atlas ].mHorizontalStrip, 0u, 0u,
blockOffsetX,
- blockOffsetY ) )
+ blockOffsetY,
+ mAtlasList[ atlas ].mHorizontalStrip.GetWidth(),
+ mAtlasList[ atlas ].mHorizontalStrip.GetHeight()) )
{
DALI_LOG_ERROR("Uploading top strip to Atlas Failed!\n");
}
// Blit left strip
- if ( !mAtlasList[ atlas ].mAtlas.Upload( mAtlasList[ atlas ].mVerticalStrip,
+ if ( !mAtlasList[ atlas ].mAtlas.Upload( mAtlasList[ atlas ].mVerticalStrip, 0u, 0u,
blockOffsetX,
- blockOffsetY + SINGLE_PIXEL_PADDING ) )
+ blockOffsetY + SINGLE_PIXEL_PADDING,
+ mAtlasList[ atlas ].mVerticalStrip.GetWidth(),
+ mAtlasList[ atlas ].mVerticalStrip.GetHeight() ) )
{
DALI_LOG_ERROR("Uploading left strip to Atlas Failed!\n");
}
// Blit bottom strip
if ( blockOffsetY + height + DOUBLE_PIXEL_PADDING <= mAtlasList[ atlas ].mSize.mHeight )
{
- if ( !mAtlasList[ atlas ].mAtlas.Upload( mAtlasList[ atlas ].mHorizontalStrip,
+ if ( !mAtlasList[ atlas ].mAtlas.Upload( mAtlasList[ atlas ].mHorizontalStrip, 0u, 0u,
blockOffsetX,
- blockOffsetY + height + SINGLE_PIXEL_PADDING ) )
+ blockOffsetY + height + SINGLE_PIXEL_PADDING,
+ mAtlasList[ atlas ].mHorizontalStrip.GetWidth(),
+ mAtlasList[ atlas ].mHorizontalStrip.GetHeight() ) )
{
DALI_LOG_ERROR("Uploading bottom strip to Atlas Failed!.\n");
}
// Blit right strip
if ( blockOffsetX + width + DOUBLE_PIXEL_PADDING <= mAtlasList[ atlas ].mSize.mWidth )
{
- if ( !mAtlasList[ atlas ].mAtlas.Upload( mAtlasList[ atlas ].mVerticalStrip,
+ if ( !mAtlasList[ atlas ].mAtlas.Upload( mAtlasList[ atlas ].mVerticalStrip, 0u, 0u,
blockOffsetX + width + SINGLE_PIXEL_PADDING,
- blockOffsetY + SINGLE_PIXEL_PADDING ) )
+ blockOffsetY + SINGLE_PIXEL_PADDING,
+ mAtlasList[ atlas ].mVerticalStrip.GetWidth(),
+ mAtlasList[ atlas ].mVerticalStrip.GetHeight() ) )
{
DALI_LOG_ERROR("Uploading right strip to Atlas Failed!.\n");
}
}
}
-Dali::Atlas AtlasManager::GetAtlasContainer( AtlasId atlas ) const
+Dali::Texture AtlasManager::GetAtlasContainer( AtlasId atlas ) const
{
DALI_ASSERT_DEBUG( atlas && atlas <= mAtlasList.size() );
- Dali::Atlas atlasContainer;
+ Dali::Texture atlasContainer;
if ( atlas && atlas-- <= mAtlasList.size() )
{
atlasContainer = mAtlasList[ atlas ].mAtlas;
*/
struct AtlasDescriptor
{
- Dali::Atlas mAtlas; // atlas image
+ Dali::Texture mAtlas; // atlas image
Toolkit::AtlasManager::AtlasSize mSize; // size of atlas
Pixel::Format mPixelFormat; // pixel format used by atlas
- BufferImage mHorizontalStrip; // Image used to pad upload
- BufferImage mVerticalStrip; // Image used to pad upload
+ PixelData mHorizontalStrip; // Image used to pad upload
+ PixelData mVerticalStrip; // Image used to pad upload
TextureSet mTextureSet; // Texture set used for atlas texture
SizeType mTotalBlocks; // total number of blocks in atlas
SizeType mAvailableBlocks; // number of blocks available in atlas
/**
* @copydoc Toolkit::AtlasManager::Add
*/
- bool Add( const BufferImage& image,
+ bool Add( const PixelData& image,
Toolkit::AtlasManager::AtlasSlot& slot,
Toolkit::AtlasManager::AtlasId atlas );
/**
* @copydoc Toolkit::AtlasManager::GetAtlasContainer
*/
- Dali::Atlas GetAtlasContainer( AtlasId atlas ) const;
+ Dali::Texture GetAtlasContainer( AtlasId atlas ) const;
/**
* @copydoc Toolkit::AtlasManager::GetAtlas
SizeType height,
Pixel::Format pixelFormat );
- void UploadImage( const BufferImage& image,
+ void UploadImage( const PixelData& image,
const AtlasSlotDescriptor& desc );
};
GetImplementation(*this).SetAddPolicy( policy );
}
-bool AtlasManager::Add( const BufferImage& image,
+bool AtlasManager::Add( const PixelData& image,
AtlasManager::AtlasSlot& slot,
AtlasManager::AtlasId atlas )
{
addReference );
}
-Dali::Atlas AtlasManager::GetAtlasContainer( AtlasId atlas ) const
+Dali::Texture AtlasManager::GetAtlasContainer( AtlasId atlas ) const
{
return GetImplementation(*this).GetAtlasContainer( atlas );
}
-#ifndef __DALI_TOOLKIT_ATLAS_MANAGER_H__
-#define __DALI_TOOLKIT_ATLAS_MANAGER_H__
+#ifndef DALI_TOOLKIT_ATLAS_MANAGER_H
+#define DALI_TOOLKIT_ATLAS_MANAGER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <stdint.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/images/buffer-image.h>
+#include <dali/public-api/rendering/texture-set.h>
#include <dali/devel-api/images/atlas.h>
-#include <dali/devel-api/rendering/texture-set.h>
namespace Dali
{
* If an add is made before an atlas is created under this policy,
* then a default size atlas will be created
*
- * @param[in] image reference to a bitmapimage
+ * @param[in] image PixelData object containing the image data
* @param[out] slot result of add operation
* @param[in] atlas optional preferred atlas
*
* @return true if a new atlas was created
*/
- bool Add( const BufferImage& image,
+ bool Add( const PixelData& image,
AtlasSlot& slot,
AtlasId atlas = 0 );
*
* @return Atlas Handle
*/
- Dali::Atlas GetAtlasContainer( AtlasId atlas ) const;
+ Dali::Texture GetAtlasContainer( AtlasId atlas ) const;
/**
* @brief Get the Id of the atlas containing an image
} // namespace Dali
-#endif // __DALI_TOOLKIT_ATLAS_MANAGER_H__
+#endif // DALI_TOOLKIT_ATLAS_MANAGER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.h>
// EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/geometry.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h>
#include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
}
// Create a new image for the glyph
- BufferImage bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index );
+ PixelData bitmap = mFontClient.CreateBitmap( glyph.fontId, glyph.index );
if( bitmap )
{
MaxBlockSize& blockSize = mBlockSizes[currentBlockSize];
-#ifndef __DALI_TOOLKIT_TEXT_GLYPHY_SHADER_H__
-#define __DALI_TOOLKIT_TEXT_GLYPHY_SHADER_H__
+#ifndef DALI_TOOLKIT_TEXT_GLYPHY_SHADER_H
+#define DALI_TOOLKIT_TEXT_GLYPHY_SHADER_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
// INTERNEL INCLUDES
#include <dali/public-api/math/vector4.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/shader.h>
namespace Dali
{
} // namespace Dali
-#endif // __DALI_TOOLKIT_TEXT_GLYPHY_SHADER_H__
+#endif // DALI_TOOLKIT_TEXT_GLYPHY_SHADER_H
#include <dali-toolkit/internal/text/rendering/vector-based/vector-based-renderer.h>
// EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/geometry.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h>
#include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/glyph-run.h>
#include <dali-toolkit/internal/text/rendering/vector-based/vector-blob-atlas.h>
// EXTERNAL INCLUDES
+#include <dali/devel-api/images/texture-set-image.h>
#include <dali/integration-api/debug.h>
namespace
mAtlasTexture = BufferImage::New( textureWidth, textureHeight, Pixel::RGBA8888 );
mTextureSet = TextureSet::New();
- mTextureSet.SetImage( 0, mAtlasTexture );
+ TextureSetImage( mTextureSet, 0, mAtlasTexture );
}
bool VectorBlobAtlas::IsFull() const
-#ifndef __DALI_TOOLKIT_TEXT_VECTOR_BLOB_ATLAS_H__
-#define __DALI_TOOLKIT_TEXT_VECTOR_BLOB_ATLAS_H__
+#ifndef DALI_TOOLKIT_TEXT_VECTOR_BLOB_ATLAS_H
+#define DALI_TOOLKIT_TEXT_VECTOR_BLOB_ATLAS_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/images/buffer-image.h>
-#include <dali/devel-api/rendering/texture-set.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/rendering/shader.h>
+#include <dali/public-api/rendering/texture-set.h>
#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
// INTERNAL INCLUDES
} // namespace Dali
-#endif // __DALI_TOOLKIT_TEXT_VECTOR_BLOB_ATLAS_H__
+#endif // DALI_TOOLKIT_TEXT_VECTOR_BLOB_ATLAS_H
mRightSelectionPosition( 0u ),
mPreEditStartPosition( 0u ),
mPreEditLength( 0u ),
+ mCursorHookPositionX( 0.f ),
mIsShowingPlaceholderText( false ),
mPreEditFlag( false ),
mDecoratorUpdated( false ),
mGrabHandleEnabled( true ),
mGrabHandlePopupEnabled( true ),
mSelectionEnabled( true ),
- mHorizontalScrollingEnabled( true ),
- mVerticalScrollingEnabled( false ),
mUpdateCursorPosition( false ),
+ mUpdateGrabHandlePosition( false ),
mUpdateLeftSelectionPosition( false ),
mUpdateRightSelectionPosition( false ),
+ mUpdateHighlightBox( false ),
mScrollAfterUpdatePosition( false ),
mScrollAfterDelete( false ),
mAllTextSelected( false ),
}
if( mEventData->mUpdateCursorPosition ||
- mEventData->mUpdateLeftSelectionPosition ||
- mEventData->mUpdateRightSelectionPosition )
+ mEventData->mUpdateHighlightBox )
{
NotifyImfManager();
}
{
// Updates the cursor position and scrolls the text to make it visible.
CursorInfo cursorInfo;
+ // Calculate the cursor position from the new cursor index.
GetCursorPosition( mEventData->mPrimaryCursorPosition,
cursorInfo );
+ if( mEventData->mUpdateCursorHookPosition )
+ {
+ // Update the cursor hook position. Used to move the cursor with the keys 'up' and 'down'.
+ mEventData->mCursorHookPositionX = cursorInfo.primaryPosition.x;
+ mEventData->mUpdateCursorHookPosition = false;
+ }
+
// Scroll first the text after delete ...
if( mEventData->mScrollAfterDelete )
{
// ... then, text can be scrolled to make the cursor visible.
if( mEventData->mScrollAfterUpdatePosition )
{
- ScrollToMakePositionVisible( cursorInfo.primaryPosition );
+ const Vector2 currentCursorPosition( cursorInfo.primaryPosition.x, cursorInfo.lineOffset );
+ ScrollToMakePositionVisible( currentCursorPosition, cursorInfo.lineHeight );
}
mEventData->mScrollAfterUpdatePosition = false;
mEventData->mScrollAfterDelete = false;
mEventData->mDecoratorUpdated = true;
mEventData->mUpdateCursorPosition = false;
+ mEventData->mUpdateGrabHandlePosition = false;
}
else
{
- bool leftScroll = false;
- bool rightScroll = false;
-
CursorInfo leftHandleInfo;
CursorInfo rightHandleInfo;
- if( mEventData->mUpdateLeftSelectionPosition )
+ if( mEventData->mUpdateHighlightBox )
{
GetCursorPosition( mEventData->mLeftSelectionPosition,
leftHandleInfo );
- if( mEventData->mScrollAfterUpdatePosition )
- {
- ScrollToMakePositionVisible( leftHandleInfo.primaryPosition );
- leftScroll = true;
- }
- }
-
- if( mEventData->mUpdateRightSelectionPosition )
- {
GetCursorPosition( mEventData->mRightSelectionPosition,
rightHandleInfo );
- if( mEventData->mScrollAfterUpdatePosition )
+ if( mEventData->mScrollAfterUpdatePosition && mEventData->mUpdateLeftSelectionPosition )
{
- ScrollToMakePositionVisible( rightHandleInfo.primaryPosition );
- rightScroll = true;
+ const Vector2 currentCursorPosition( leftHandleInfo.primaryPosition.x, leftHandleInfo.lineOffset );
+ ScrollToMakePositionVisible( currentCursorPosition, leftHandleInfo.lineHeight );
+ }
+
+ if( mEventData->mScrollAfterUpdatePosition && mEventData->mUpdateRightSelectionPosition )
+ {
+ const Vector2 currentCursorPosition( rightHandleInfo.primaryPosition.x, rightHandleInfo.lineOffset );
+ ScrollToMakePositionVisible( currentCursorPosition, rightHandleInfo.lineHeight );
}
}
SetPopupButtons();
mEventData->mDecoratorUpdated = true;
+ mEventData->mUpdateLeftSelectionPosition = false;
}
if( mEventData->mUpdateRightSelectionPosition )
SetPopupButtons();
mEventData->mDecoratorUpdated = true;
+ mEventData->mUpdateRightSelectionPosition = false;
}
- if( mEventData->mUpdateLeftSelectionPosition || mEventData->mUpdateRightSelectionPosition )
+ if( mEventData->mUpdateHighlightBox )
{
RepositionSelectionHandles();
mEventData->mUpdateLeftSelectionPosition = false;
mEventData->mUpdateRightSelectionPosition = false;
+ mEventData->mUpdateHighlightBox = false;
}
- if( leftScroll || rightScroll )
- {
- mEventData->mScrollAfterUpdatePosition = false;
- }
+ mEventData->mScrollAfterUpdatePosition = false;
}
if( mEventData->mUpdateInputStyle )
}
else if( Dali::DALI_KEY_CURSOR_UP == keyCode )
{
- // TODO
+ // Get first the line index of the current cursor position index.
+ CharacterIndex characterIndex = 0u;
+
+ if( mEventData->mPrimaryCursorPosition > 0u )
+ {
+ characterIndex = mEventData->mPrimaryCursorPosition - 1u;
+ }
+
+ const LineIndex lineIndex = mVisualModel->GetLineOfCharacter( characterIndex );
+
+ if( lineIndex > 0u )
+ {
+ // Retrieve the cursor position info.
+ CursorInfo cursorInfo;
+ GetCursorPosition( mEventData->mPrimaryCursorPosition,
+ cursorInfo );
+
+ // Get the line above.
+ const LineRun& line = *( mVisualModel->mLines.Begin() + ( lineIndex - 1u ) );
+
+ // Get the next hit 'y' point.
+ const float hitPointY = cursorInfo.lineOffset - 0.5f * ( line.ascender - line.descender );
+
+ // Use the cursor hook position 'x' and the next hit 'y' position to calculate the new cursor index.
+ mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mVisualModel,
+ mLogicalModel,
+ mMetrics,
+ mEventData->mCursorHookPositionX,
+ hitPointY );
+ }
}
else if( Dali::DALI_KEY_CURSOR_DOWN == keyCode )
{
- // TODO
+ // Get first the line index of the current cursor position index.
+ CharacterIndex characterIndex = 0u;
+
+ if( mEventData->mPrimaryCursorPosition > 0u )
+ {
+ characterIndex = mEventData->mPrimaryCursorPosition - 1u;
+ }
+
+ const LineIndex lineIndex = mVisualModel->GetLineOfCharacter( characterIndex );
+
+ if( lineIndex + 1u < mVisualModel->mLines.Count() )
+ {
+ // Retrieve the cursor position info.
+ CursorInfo cursorInfo;
+ GetCursorPosition( mEventData->mPrimaryCursorPosition,
+ cursorInfo );
+
+ // Get the line below.
+ const LineRun& line = *( mVisualModel->mLines.Begin() + lineIndex + 1u );
+
+ // Get the next hit 'y' point.
+ const float hitPointY = cursorInfo.lineOffset + cursorInfo.lineHeight + 0.5f * ( line.ascender - line.descender );
+
+ // Use the cursor hook position 'x' and the next hit 'y' position to calculate the new cursor index.
+ mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mVisualModel,
+ mLogicalModel,
+ mMetrics,
+ mEventData->mCursorHookPositionX,
+ hitPointY );
+ }
}
mEventData->mUpdateCursorPosition = true;
const float xPosition = event.p2.mFloat - mScrollPosition.x;
const float yPosition = event.p3.mFloat - mScrollPosition.y;
+ // Keep the tap 'x' position. Used to move the cursor.
+ mEventData->mCursorHookPositionX = xPosition;
+
mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mVisualModel,
mLogicalModel,
mMetrics,
}
mEventData->mUpdateCursorPosition = true;
+ mEventData->mUpdateGrabHandlePosition = true;
mEventData->mScrollAfterUpdatePosition = true;
mEventData->mUpdateInputStyle = true;
if( ( Gesture::Started == state ) ||
( Gesture::Continuing == state ) )
{
- const Vector2& actualSize = mVisualModel->GetLayoutSize();
- const Vector2 currentScroll = mScrollPosition;
-
- if( mEventData->mHorizontalScrollingEnabled )
+ if( mEventData->mDecorator )
{
- const float displacementX = event.p2.mFloat;
- mScrollPosition.x += displacementX;
+ const Vector2& layoutSize = mVisualModel->GetLayoutSize();
+ const Vector2 currentScroll = mScrollPosition;
- ClampHorizontalScroll( actualSize );
- }
+ if( mEventData->mDecorator->IsHorizontalScrollEnabled() )
+ {
+ const float displacementX = event.p2.mFloat;
+ mScrollPosition.x += displacementX;
- if( mEventData->mVerticalScrollingEnabled )
- {
- const float displacementY = event.p3.mFloat;
- mScrollPosition.y += displacementY;
+ ClampHorizontalScroll( layoutSize );
+ }
- ClampVerticalScroll( actualSize );
- }
+ if( mEventData->mDecorator->IsVerticalScrollEnabled() )
+ {
+ const float displacementY = event.p3.mFloat;
+ mScrollPosition.y += displacementY;
+
+ ClampVerticalScroll( layoutSize );
+ }
- if( mEventData->mDecorator )
- {
mEventData->mDecorator->UpdatePositions( mScrollPosition - currentScroll );
}
}
const unsigned int state = event.p1.mUint;
const bool handleStopScrolling = ( HANDLE_STOP_SCROLLING == state );
+ const bool isSmoothHandlePanEnabled = mEventData->mDecorator->IsSmoothHandlePanEnabled();
if( HANDLE_PRESSED == state )
{
const float xPosition = event.p2.mFloat - mScrollPosition.x;
const float yPosition = event.p3.mFloat - mScrollPosition.y;
+ // Need to calculate the handle's new position.
const CharacterIndex handleNewPosition = Text::GetClosestCursorIndex( mVisualModel,
mLogicalModel,
mMetrics,
if( handleNewPosition != mEventData->mPrimaryCursorPosition )
{
- mEventData->mPrimaryCursorPosition = handleNewPosition;
+ // Updates the cursor position if the handle's new position is different than the current one.
mEventData->mUpdateCursorPosition = true;
+ // Does not update the grab handle position if the smooth panning is enabled. (The decorator does it smooth).
+ mEventData->mUpdateGrabHandlePosition = !isSmoothHandlePanEnabled;
+ mEventData->mPrimaryCursorPosition = handleNewPosition;
}
+
+ // Updates the decorator if the soft handle panning is enabled. It triggers a relayout in the decorator and the new position of the handle is set.
+ mEventData->mDecoratorUpdated = isSmoothHandlePanEnabled;
}
else if( Event::LEFT_SELECTION_HANDLE_EVENT == event.type )
{
if( ( handleNewPosition != mEventData->mLeftSelectionPosition ) &&
( handleNewPosition != mEventData->mRightSelectionPosition ) )
{
+ // Updates the highlight box if the handle's new position is different than the current one.
+ mEventData->mUpdateHighlightBox = true;
+ // Does not update the selection handle position if the smooth panning is enabled. (The decorator does it smooth).
+ mEventData->mUpdateLeftSelectionPosition = !isSmoothHandlePanEnabled;
mEventData->mLeftSelectionPosition = handleNewPosition;
-
- mEventData->mUpdateLeftSelectionPosition = true;
}
+
+ // Updates the decorator if the soft handle panning is enabled. It triggers a relayout in the decorator and the new position of the handle is set.
+ mEventData->mDecoratorUpdated = isSmoothHandlePanEnabled;
}
else if( Event::RIGHT_SELECTION_HANDLE_EVENT == event.type )
{
if( ( handleNewPosition != mEventData->mRightSelectionPosition ) &&
( handleNewPosition != mEventData->mLeftSelectionPosition ) )
{
+ // Updates the highlight box if the handle's new position is different than the current one.
+ mEventData->mUpdateHighlightBox = true;
+ // Does not update the selection handle position if the smooth panning is enabled. (The decorator does it smooth).
+ mEventData->mUpdateRightSelectionPosition = !isSmoothHandlePanEnabled;
mEventData->mRightSelectionPosition = handleNewPosition;
-
- mEventData->mUpdateRightSelectionPosition = true;
}
+
+ // Updates the decorator if the soft handle panning is enabled. It triggers a relayout in the decorator and the new position of the handle is set.
+ mEventData->mDecoratorUpdated = isSmoothHandlePanEnabled;
}
} // end ( HANDLE_PRESSED == state )
else if( ( HANDLE_RELEASED == state ) ||
handleStopScrolling )
{
CharacterIndex handlePosition = 0u;
- if( handleStopScrolling )
+ if( handleStopScrolling || isSmoothHandlePanEnabled )
{
// Convert from decorator's coords to text's coords.
const float xPosition = event.p2.mFloat - mScrollPosition.x;
if( Event::GRAB_HANDLE_EVENT == event.type )
{
mEventData->mUpdateCursorPosition = true;
+ mEventData->mUpdateGrabHandlePosition = true;
mEventData->mUpdateInputStyle = true;
if( !IsClipboardEmpty() )
ChangeState( EventData::EDITING_WITH_PASTE_POPUP ); // Moving grabhandle will show Paste Popup
}
- if( handleStopScrolling )
+ if( handleStopScrolling || isSmoothHandlePanEnabled )
{
- mEventData->mScrollAfterUpdatePosition = mEventData->mPrimaryCursorPosition != handlePosition;
+ mEventData->mScrollAfterUpdatePosition = true;
mEventData->mPrimaryCursorPosition = handlePosition;
}
}
{
ChangeState( EventData::SELECTING );
- if( handleStopScrolling )
+ mEventData->mUpdateHighlightBox = true;
+ mEventData->mUpdateLeftSelectionPosition = true;
+
+ if( handleStopScrolling || isSmoothHandlePanEnabled )
{
- mEventData->mUpdateLeftSelectionPosition = ( mEventData->mRightSelectionPosition != handlePosition );
- mEventData->mScrollAfterUpdatePosition = mEventData->mUpdateLeftSelectionPosition;
+ mEventData->mScrollAfterUpdatePosition = true;
- if( mEventData->mUpdateLeftSelectionPosition )
+ if( ( handlePosition != mEventData->mRightSelectionPosition ) &&
+ ( handlePosition != mEventData->mLeftSelectionPosition ) )
{
mEventData->mLeftSelectionPosition = handlePosition;
}
{
ChangeState( EventData::SELECTING );
- if( handleStopScrolling )
+ mEventData->mUpdateHighlightBox = true;
+ mEventData->mUpdateRightSelectionPosition = true;
+
+ if( handleStopScrolling || isSmoothHandlePanEnabled )
{
- mEventData->mUpdateRightSelectionPosition = ( mEventData->mLeftSelectionPosition != handlePosition );
- mEventData->mScrollAfterUpdatePosition = mEventData->mUpdateRightSelectionPosition;
- if( mEventData->mUpdateRightSelectionPosition )
+ mEventData->mScrollAfterUpdatePosition = true;
+ if( ( handlePosition != mEventData->mRightSelectionPosition ) &&
+ ( handlePosition != mEventData->mLeftSelectionPosition ) )
{
mEventData->mRightSelectionPosition = handlePosition;
}
else if( HANDLE_SCROLLING == state )
{
const float xSpeed = event.p2.mFloat;
- const Vector2& actualSize = mVisualModel->GetLayoutSize();
+ const float ySpeed = event.p3.mFloat;
+ const Vector2& layoutSize = mVisualModel->GetLayoutSize();
const Vector2 currentScrollPosition = mScrollPosition;
mScrollPosition.x += xSpeed;
+ mScrollPosition.y += ySpeed;
- ClampHorizontalScroll( actualSize );
+ ClampHorizontalScroll( layoutSize );
+ ClampVerticalScroll( layoutSize );
bool endOfScroll = false;
if( Vector2::ZERO == ( currentScrollPosition - mScrollPosition ) )
// Set the position of the handle.
const bool scrollRightDirection = xSpeed > 0.f;
+ const bool scrollBottomDirection = ySpeed > 0.f;
const bool leftSelectionHandleEvent = Event::LEFT_SELECTION_HANDLE_EVENT == event.type;
const bool rightSelectionHandleEvent = Event::RIGHT_SELECTION_HANDLE_EVENT == event.type;
{
ChangeState( EventData::GRAB_HANDLE_PANNING );
+ // Get the grab handle position in decorator coords.
Vector2 position = mEventData->mDecorator->GetPosition( GRAB_HANDLE );
- // Position the grag handle close to either the left or right edge.
- position.x = scrollRightDirection ? 0.f : mVisualModel->mControlSize.width;
+ if( mEventData->mDecorator->IsHorizontalScrollEnabled() )
+ {
+ // Position the grag handle close to either the left or right edge.
+ position.x = scrollRightDirection ? 0.f : mVisualModel->mControlSize.width;
+ }
+
+ if( mEventData->mDecorator->IsVerticalScrollEnabled() )
+ {
+ position.x = mEventData->mCursorHookPositionX;
+
+ // Position the grag handle close to either the top or bottom edge.
+ position.y = scrollBottomDirection ? 0.f : mVisualModel->mControlSize.height;
+ }
// Get the new handle position.
// The grab handle's position is in decorator's coords. Need to transforms to text's coords.
position.x - mScrollPosition.x,
position.y - mScrollPosition.y );
- mEventData->mUpdateCursorPosition = mEventData->mPrimaryCursorPosition != handlePosition;
- mEventData->mScrollAfterUpdatePosition = mEventData->mUpdateCursorPosition;
- mEventData->mPrimaryCursorPosition = handlePosition;
+ if( mEventData->mPrimaryCursorPosition != handlePosition )
+ {
+ mEventData->mUpdateCursorPosition = true;
+ mEventData->mUpdateGrabHandlePosition = !isSmoothHandlePanEnabled;
+ mEventData->mScrollAfterUpdatePosition = true;
+ mEventData->mPrimaryCursorPosition = handlePosition;
+ }
mEventData->mUpdateInputStyle = mEventData->mUpdateCursorPosition;
+
+ // Updates the decorator if the soft handle panning is enabled.
+ mEventData->mDecoratorUpdated = isSmoothHandlePanEnabled;
}
else if( leftSelectionHandleEvent || rightSelectionHandleEvent )
{
- // TODO: This is recalculating the selection box every time the text is scrolled with the selection handles.
- // Think if something can be done to save power.
-
ChangeState( EventData::SELECTION_HANDLE_PANNING );
+ // Get the selection handle position in decorator coords.
Vector2 position = mEventData->mDecorator->GetPosition( leftSelectionHandleEvent ? Text::LEFT_SELECTION_HANDLE : Text::RIGHT_SELECTION_HANDLE );
- // Position the selection handle close to either the left or right edge.
- position.x = scrollRightDirection ? 0.f : mVisualModel->mControlSize.width;
+ if( mEventData->mDecorator->IsHorizontalScrollEnabled() )
+ {
+ // Position the selection handle close to either the left or right edge.
+ position.x = scrollRightDirection ? 0.f : mVisualModel->mControlSize.width;
+ }
+
+ if( mEventData->mDecorator->IsVerticalScrollEnabled() )
+ {
+ position.x = mEventData->mCursorHookPositionX;
+
+ // Position the grag handle close to either the top or bottom edge.
+ position.y = scrollBottomDirection ? 0.f : mVisualModel->mControlSize.height;
+ }
// Get the new handle position.
// The selection handle's position is in decorator's coords. Need to transform to text's coords.
if( leftSelectionHandleEvent )
{
const bool differentHandles = ( mEventData->mLeftSelectionPosition != handlePosition ) && ( mEventData->mRightSelectionPosition != handlePosition );
- mEventData->mUpdateLeftSelectionPosition = endOfScroll || differentHandles;
- if( differentHandles )
+
+ if( differentHandles || endOfScroll )
{
+ mEventData->mUpdateHighlightBox = true;
+ mEventData->mUpdateLeftSelectionPosition = !isSmoothHandlePanEnabled;
+ mEventData->mUpdateRightSelectionPosition = isSmoothHandlePanEnabled;
mEventData->mLeftSelectionPosition = handlePosition;
}
}
else
{
const bool differentHandles = ( mEventData->mRightSelectionPosition != handlePosition ) && ( mEventData->mLeftSelectionPosition != handlePosition );
- mEventData->mUpdateRightSelectionPosition = endOfScroll || differentHandles;
- if( differentHandles )
+ if( differentHandles || endOfScroll )
{
+ mEventData->mUpdateHighlightBox = true;
+ mEventData->mUpdateRightSelectionPosition = !isSmoothHandlePanEnabled;
+ mEventData->mUpdateLeftSelectionPosition = isSmoothHandlePanEnabled;
mEventData->mRightSelectionPosition = handlePosition;
}
}
{
RepositionSelectionHandles();
- mEventData->mScrollAfterUpdatePosition = true;
+ mEventData->mScrollAfterUpdatePosition = !isSmoothHandlePanEnabled;
}
}
mEventData->mDecoratorUpdated = true;
mEventData->mUpdateLeftSelectionPosition = true;
mEventData->mUpdateRightSelectionPosition = true;
+ mEventData->mUpdateHighlightBox = true;
mEventData->mUpdateCursorPosition = false;
mEventData->mScrollAfterUpdatePosition = ( mEventData->mLeftSelectionPosition != mEventData->mRightSelectionPosition );
mEventData->mScrollAfterUpdatePosition = true;
mEventData->mUpdateLeftSelectionPosition = true;
mEventData->mUpdateRightSelectionPosition = true;
+ mEventData->mUpdateHighlightBox = true;
}
}
Vector<Character>::Iterator last = first + lengthOfSelectedText;
utf32Characters.Erase( first, last );
- // Scroll after delete.
+ // Will show the cursor at the first character of the selection.
mEventData->mPrimaryCursorPosition = handlesCrossed ? mEventData->mRightSelectionPosition : mEventData->mLeftSelectionPosition;
}
+ else
+ {
+ // Will show the cursor at the last character of the selection.
+ mEventData->mPrimaryCursorPosition = handlesCrossed ? mEventData->mLeftSelectionPosition : mEventData->mRightSelectionPosition;
+ }
+
mEventData->mDecoratorUpdated = true;
}
}
const CharacterIndex* const glyphToCharacterBuffer = mVisualModel->mGlyphsToCharacters.Begin();
const CharacterDirection* const modelCharacterDirectionsBuffer = ( 0u != mLogicalModel->mCharacterDirections.Count() ) ? mLogicalModel->mCharacterDirections.Begin() : NULL;
- // TODO: Better algorithm to create the highlight box.
-
const bool isLastCharacter = selectionEnd >= mLogicalModel->mText.Count();
const CharacterDirection startDirection = ( ( NULL == modelCharacterDirectionsBuffer ) ? false : *( modelCharacterDirectionsBuffer + selectionStart ) );
const CharacterDirection endDirection = ( ( NULL == modelCharacterDirectionsBuffer ) ? false : *( modelCharacterDirectionsBuffer + ( selectionEnd - ( isLastCharacter ? 1u : 0u ) ) ) );
// The line's vertical offset of all the lines before the line where the first glyph is laid-out.
selectionBoxInfo->lineOffset = CalculateLineOffset( mVisualModel->mLines,
firstLineIndex );
+ selectionBoxInfo->lineOffset += mScrollPosition.y;
+
lineRun += firstLineIndex;
// The line height is the addition of the line ascender and the line descender.
const float xPosition = lineRun->alignmentOffset + position.x - glyph.xBearing + mScrollPosition.x + glyphAdvance * static_cast<float>( isCurrentRightToLeft ? ( numberOfCharactersStart - interGlyphIndex - numberOfCharacters ) : interGlyphIndex );
const float xPositionAdvance = xPosition + static_cast<float>( numberOfCharacters ) * glyphAdvance;
- const float yPosition = selectionBoxInfo->lineOffset + mScrollPosition.y;
+ const float yPosition = selectionBoxInfo->lineOffset;
// Store the min and max 'x' for each line.
selectionBoxInfo->minX = std::min( selectionBoxInfo->minX, xPosition );
const float xPosition = lineRun->alignmentOffset + position.x - glyph.xBearing + mScrollPosition.x + ( isCurrentRightToLeft ? ( glyphAdvance * static_cast<float>( numberOfCharacters ) ) : 0.f );
const float xPositionAdvance = xPosition + static_cast<float>( interGlyphIndex ) * glyphAdvance;
- const float yPosition = selectionBoxInfo->lineOffset + mScrollPosition.y;
+ const float yPosition = selectionBoxInfo->lineOffset;
// Store the min and max 'x' for each line.
selectionBoxInfo->minX = std::min( selectionBoxInfo->minX, xPosition );
const float xPosition = lineRun->alignmentOffset + position.x - glyph.xBearing + mScrollPosition.x;
const float xPositionAdvance = xPosition + glyph.advance;
- const float yPosition = selectionBoxInfo->lineOffset + mScrollPosition.y;
+ const float yPosition = selectionBoxInfo->lineOffset;
// Store the min and max 'x' for each line.
selectionBoxInfo->minX = std::min( selectionBoxInfo->minX, xPosition );
++lineIndex;
if( lineIndex < firstLineIndex + numberOfLines )
{
- // Get the selection box info for the next line.
+ // Keep the offset and height of the current selection box.
const float currentLineOffset = selectionBoxInfo->lineOffset;
+ const float currentLineHeight = selectionBoxInfo->lineHeight;
+
+ // Get the selection box info for the next line.
++selectionBoxInfo;
selectionBoxInfo->minX = MAX_FLOAT;
selectionBoxInfo->maxX = MIN_FLOAT;
+ // Update the line's vertical offset.
+ selectionBoxInfo->lineOffset = currentLineOffset + currentLineHeight;
+
// The line height is the addition of the line ascender and the line descender.
// However, the line descender has a negative value, hence the subtraction.
selectionBoxInfo->lineHeight = lineRun->ascender - lineRun->descender;
-
- // Update the line's vertical offset.
- selectionBoxInfo->lineOffset = currentLineOffset + selectionBoxInfo->lineHeight;
}
}
}
}
}
+ if( !mEventData->mDecorator->IsSmoothHandlePanEnabled() )
+ {
+ CursorInfo primaryCursorInfo;
+ GetCursorPosition( mEventData->mLeftSelectionPosition,
+ primaryCursorInfo );
- CursorInfo primaryCursorInfo;
- GetCursorPosition( mEventData->mLeftSelectionPosition,
- primaryCursorInfo );
+ const Vector2 primaryPosition = primaryCursorInfo.primaryPosition + mScrollPosition;
- CursorInfo secondaryCursorInfo;
- GetCursorPosition( mEventData->mRightSelectionPosition,
- secondaryCursorInfo );
+ mEventData->mDecorator->SetPosition( LEFT_SELECTION_HANDLE,
+ primaryPosition.x,
+ primaryCursorInfo.lineOffset + mScrollPosition.y,
+ primaryCursorInfo.lineHeight );
- const Vector2 primaryPosition = primaryCursorInfo.primaryPosition + mScrollPosition;
- const Vector2 secondaryPosition = secondaryCursorInfo.primaryPosition + mScrollPosition;
+ CursorInfo secondaryCursorInfo;
+ GetCursorPosition( mEventData->mRightSelectionPosition,
+ secondaryCursorInfo );
- mEventData->mDecorator->SetPosition( LEFT_SELECTION_HANDLE,
- primaryPosition.x,
- primaryCursorInfo.lineOffset + mScrollPosition.y,
- primaryCursorInfo.lineHeight );
+ const Vector2 secondaryPosition = secondaryCursorInfo.primaryPosition + mScrollPosition;
- mEventData->mDecorator->SetPosition( RIGHT_SELECTION_HANDLE,
- secondaryPosition.x,
- secondaryCursorInfo.lineOffset + mScrollPosition.y,
- secondaryCursorInfo.lineHeight );
+ mEventData->mDecorator->SetPosition( RIGHT_SELECTION_HANDLE,
+ secondaryPosition.x,
+ secondaryCursorInfo.lineOffset + mScrollPosition.y,
+ secondaryCursorInfo.lineHeight );
+ }
// Cursor to be positioned at end of selection so if selection interrupted and edit mode restarted the cursor will be at end of selection
mEventData->mPrimaryCursorPosition = ( indicesSwapped ) ? mEventData->mLeftSelectionPosition : mEventData->mRightSelectionPosition;
cursorIndex += numberOfCharacters;
}
+ // Will update the cursor hook position.
+ mEventData->mUpdateCursorHookPosition = true;
+
return cursorIndex;
}
cursorInfo.lineHeight );
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Primary cursor position: %f,%f\n", cursorPosition.x, cursorPosition.y );
- // Sets the grab handle position.
- mEventData->mDecorator->SetPosition( GRAB_HANDLE,
- cursorPosition.x,
- cursorInfo.lineOffset + mScrollPosition.y,
- cursorInfo.lineHeight );
+ if( mEventData->mUpdateGrabHandlePosition )
+ {
+ // Sets the grab handle position.
+ mEventData->mDecorator->SetPosition( GRAB_HANDLE,
+ cursorPosition.x,
+ cursorInfo.lineOffset + mScrollPosition.y,
+ cursorInfo.lineHeight );
+ }
if( cursorInfo.isSecondaryCursor )
{
}
}
-void Controller::Impl::ScrollToMakePositionVisible( const Vector2& position )
+void Controller::Impl::ScrollToMakePositionVisible( const Vector2& position, float lineHeight )
{
- const float cursorWidth = mEventData->mDecorator ? mEventData->mDecorator->GetCursorWidth() : 0.f;
+ const float cursorWidth = mEventData->mDecorator ? static_cast<float>( mEventData->mDecorator->GetCursorWidth() ) : 0.f;
// position is in actor's coords.
- const float positionEnd = position.x + cursorWidth;
+ const float positionEndX = position.x + cursorWidth;
+ const float positionEndY = position.y + lineHeight;
// Transform the position to decorator coords.
- const float decoratorPositionBegin = position.x + mScrollPosition.x;
- const float decoratorPositionEnd = positionEnd + mScrollPosition.x;
+ const float decoratorPositionBeginX = position.x + mScrollPosition.x;
+ const float decoratorPositionEndX = positionEndX + mScrollPosition.x;
+
+ const float decoratorPositionBeginY = position.y + mScrollPosition.y;
+ const float decoratorPositionEndY = positionEndY + mScrollPosition.y;
- if( decoratorPositionBegin < 0.f )
+ if( decoratorPositionBeginX < 0.f )
{
mScrollPosition.x = -position.x;
}
- else if( decoratorPositionEnd > mVisualModel->mControlSize.width )
+ else if( decoratorPositionEndX > mVisualModel->mControlSize.width )
+ {
+ mScrollPosition.x = mVisualModel->mControlSize.width - positionEndX;
+ }
+
+ if( decoratorPositionBeginY < 0.f )
+ {
+ mScrollPosition.y = -position.y;
+ }
+ else if( decoratorPositionEndY > mVisualModel->mControlSize.height )
{
- mScrollPosition.x = mVisualModel->mControlSize.width - positionEnd;
+ mScrollPosition.y = mVisualModel->mControlSize.height - positionEndY;
}
}
// Calculate the offset to match the cursor position before the character was deleted.
mScrollPosition.x = currentCursorPosition.x - cursorInfo.primaryPosition.x;
+ mScrollPosition.y = currentCursorPosition.y - cursorInfo.lineOffset;
ClampHorizontalScroll( mVisualModel->GetLayoutSize() );
+ ClampVerticalScroll( mVisualModel->GetLayoutSize() );
// Makes the new cursor position visible if needed.
- ScrollToMakePositionVisible( cursorInfo.primaryPosition );
+ ScrollToMakePositionVisible( cursorInfo.primaryPosition, cursorInfo.lineHeight );
}
void Controller::Impl::RequestRelayout()
CharacterIndex mPreEditStartPosition; ///< Used to remove the pre-edit text if necessary.
Length mPreEditLength; ///< Used to remove the pre-edit text if necessary.
+ float mCursorHookPositionX; ///< Used to move the cursor with the keys or when scrolling the text vertically with the handles.
+
bool mIsShowingPlaceholderText : 1; ///< True if the place-holder text is being displayed.
bool mPreEditFlag : 1; ///< True if the model contains text in pre-edit state.
bool mDecoratorUpdated : 1; ///< True if the decorator was updated during event processing.
bool mGrabHandleEnabled : 1; ///< True if grab handle is enabled.
bool mGrabHandlePopupEnabled : 1; ///< True if the grab handle popu-up should be shown.
bool mSelectionEnabled : 1; ///< True if selection handles, highlight etc. are enabled.
- bool mHorizontalScrollingEnabled : 1; ///< True if horizontal scrolling is enabled.
- bool mVerticalScrollingEnabled : 1; ///< True if vertical scrolling is enabled.
+ bool mUpdateCursorHookPosition : 1; ///< True if the cursor hook position must be updated. Used to move the cursor with the keys 'up' and 'down'.
bool mUpdateCursorPosition : 1; ///< True if the visual position of the cursor must be recalculated.
+ bool mUpdateGrabHandlePosition : 1; ///< True if the visual position of the grab handle must be recalculated.
bool mUpdateLeftSelectionPosition : 1; ///< True if the visual position of the left selection handle must be recalculated.
bool mUpdateRightSelectionPosition : 1; ///< True if the visual position of the right selection handle must be recalculated.
+ bool mUpdateHighlightBox : 1; ///< True if the text selection high light box must be updated.
bool mScrollAfterUpdatePosition : 1; ///< Whether to scroll after the cursor position is updated.
bool mScrollAfterDelete : 1; ///< Whether to scroll after delete characters.
bool mAllTextSelected : 1; ///< True if the selection handles are selecting all the text.
* @pre mEventData must not be NULL. (there is a text-input or selection capabilities).
*
* @param[in] position A position in text coords.
+ * @param[in] lineHeight The line height for the given position.
*
* This method is called after inserting text, moving the cursor with the grab handle or the keypad,
* or moving the selection handles.
*/
- void ScrollToMakePositionVisible( const Vector2& position );
+ void ScrollToMakePositionVisible( const Vector2& position, float lineHeight );
/**
* @brief Scrolls the text to make the cursor visible.
// Recalculate the selection highlight as the metrics may have changed.
eventData->mUpdateLeftSelectionPosition = true;
eventData->mUpdateRightSelectionPosition = true;
+ eventData->mUpdateHighlightBox = true;
return fontDescriptionRun;
}
return offset;
}
+void Controller::SetHorizontalScrollEnabled( bool enable )
+{
+ if( ( NULL != mImpl->mEventData ) &&
+ mImpl->mEventData->mDecorator )
+ {
+ mImpl->mEventData->mDecorator->SetHorizontalScrollEnabled( enable );
+ }
+}
+
+bool Controller::IsHorizontalScrollEnabled() const
+{
+ if( ( NULL != mImpl->mEventData ) &&
+ mImpl->mEventData->mDecorator )
+ {
+ return mImpl->mEventData->mDecorator->IsHorizontalScrollEnabled();
+ }
+
+ return false;
+}
+
+void Controller::SetVerticalScrollEnabled( bool enable )
+{
+ if( ( NULL != mImpl->mEventData ) &&
+ mImpl->mEventData->mDecorator )
+ {
+ if( mImpl->mEventData->mDecorator )
+ {
+ mImpl->mEventData->mDecorator->SetVerticalScrollEnabled( enable );
+ }
+ }
+}
+
+bool Controller::IsVerticalScrollEnabled() const
+{
+ if( ( NULL != mImpl->mEventData ) &&
+ mImpl->mEventData->mDecorator )
+ {
+ return mImpl->mEventData->mDecorator->IsVerticalScrollEnabled();
+ }
+
+ return false;
+}
+
+void Controller::SetSmoothHandlePanEnabled( bool enable )
+{
+ if( ( NULL != mImpl->mEventData ) &&
+ mImpl->mEventData->mDecorator )
+ {
+ mImpl->mEventData->mDecorator->SetSmoothHandlePanEnabled( enable );
+ }
+}
+
+bool Controller::IsSmoothHandlePanEnabled() const
+{
+ if( ( NULL != mImpl->mEventData ) &&
+ mImpl->mEventData->mDecorator )
+ {
+ return mImpl->mEventData->mDecorator->IsSmoothHandlePanEnabled();
+ }
+
+ return false;
+}
+
void Controller::SetText( const std::string& text )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText\n" );
// As the font changes, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;
+ mImpl->mEventData->mUpdateHighlightBox = true;
mImpl->mEventData->mScrollAfterUpdatePosition = true;
}
}
// As the font might change, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;
+ mImpl->mEventData->mUpdateHighlightBox = true;
mImpl->mEventData->mScrollAfterUpdatePosition = true;
}
}
// As the font might change, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;
+ mImpl->mEventData->mUpdateHighlightBox = true;
mImpl->mEventData->mScrollAfterUpdatePosition = true;
}
}
// As the font might change, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;
+ mImpl->mEventData->mUpdateHighlightBox = true;
mImpl->mEventData->mScrollAfterUpdatePosition = true;
}
}
// As the font might change, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;
+ mImpl->mEventData->mUpdateHighlightBox = true;
mImpl->mEventData->mScrollAfterUpdatePosition = true;
}
}
}
else
{
+ // Show cursor and grabhandle on first tap, this matches the behaviour of tapping when already editing
mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
}
relayoutNeeded = true;
}
void Controller::PanEvent( Gesture::State state, const Vector2& displacement )
- // Show cursor and grabhandle on first tap, this matches the behaviour of tapping when already editing
{
DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected PanEvent" );
case Toolkit::TextSelectionPopup::COPY:
{
mImpl->SendSelectionToClipboard( false ); // Text not modified
- mImpl->RequestRelayout(); // Handles, Selection Highlight, Popup
+
+ mImpl->mEventData->mUpdateCursorPosition = true;
+
+ mImpl->RequestRelayout(); // Cursor, Handles, Selection Highlight, Popup
break;
}
case Toolkit::TextSelectionPopup::PASTE:
float GetAutoScrollLineAlignment() const;
/**
+ * @brief Enables the horizontal scrolling.
+ *
+ * @param[in] enable Whether to enable the horizontal scrolling.
+ */
+ void SetHorizontalScrollEnabled( bool enable );
+
+ /**
+ * @brief Retrieves whether the horizontal scrolling is enabled.
+ *
+ * @return @e true if the horizontal scrolling is enabled, otherwise it returns @e false.
+ */
+ bool IsHorizontalScrollEnabled() const;
+
+ /**
+ * @brief Enables the vertical scrolling.
+ *
+ * @param[in] enable Whether to enable the vertical scrolling.
+ */
+ void SetVerticalScrollEnabled( bool enable );
+
+ /**
+ * @brief Retrieves whether the verticall scrolling is enabled.
+ *
+ * @return @e true if the vertical scrolling is enabled, otherwise it returns @e false.
+ */
+ bool IsVerticalScrollEnabled() const;
+
+ /**
+ * @brief Enables the smooth handle panning.
+ *
+ * @param[in] enable Whether to enable the smooth handle panning.
+ */
+ void SetSmoothHandlePanEnabled( bool enable );
+
+ /**
+ * @brief Retrieves whether the smooth handle panning is enabled.
+ *
+ * @return @e true if the smooth handle panning is enabled.
+ */
+ bool IsSmoothHandlePanEnabled() const;
+
+ /**
* @brief Replaces any text previously set.
*
* @note This will be converted into UTF-32 when stored in the text model.
#include <dali-toolkit/internal/text/text-scroller.h>
// EXTERNAL INCLUDES
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/sampler.h>
-#include <dali/devel-api/rendering/shader.h>
-#include <dali/integration-api/debug.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/images/frame-buffer-image.h>
#include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/sampler.h>
+#include <dali/public-api/rendering/shader.h>
+#include <dali/devel-api/images/texture-set-image.h>
+#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/text-scroller-interface.h>
sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST );
TextureSet textureSet = TextureSet::New();
- textureSet.SetImage( 0u, frameBufferImage );
+ TextureSetImage( textureSet, 0u, frameBufferImage );
textureSet.SetSampler( 0u, sampler );
Geometry meshGeometry;
#include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
#include <dali/integration-api/debug.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/renderers/renderer-factory-cache.h>
+
namespace Dali
{
{
Control::OnStageConnection( depth );
- Geometry geometry = Geometry::QUAD();
+ Geometry geometry = RendererFactoryCache::CreateQuadGeometry();
Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
TextureSet textureSet = TextureSet::New();
- if( mCurrentImage )
+ if( mCurrentTexture )
{
- textureSet.SetImage( 0u, mCurrentImage );
+ textureSet.SetTexture( 0u, mCurrentTexture );
}
mCurrentRenderer = Renderer::New( geometry, shader );
mCurrentRenderer.SetTextures( textureSet );
return mIsAnimating;
}
-void CubeTransitionEffect::SetCurrentImage( Image image )
+void CubeTransitionEffect::SetCurrentTexture( Texture texture )
{
- mCurrentImage = image;
+ mCurrentTexture = texture;
+
if( mCurrentRenderer )
{
TextureSet textureSet = mCurrentRenderer.GetTextures();
- textureSet.SetImage( 0u, mCurrentImage );
+ textureSet.SetTexture( 0u, mCurrentTexture);
}
}
-void CubeTransitionEffect::SetTargetImage( Image image )
+void CubeTransitionEffect::SetTargetTexture( Texture texture )
{
- mTargetImage = image;
+ mTargetTexture = texture;
if( mTargetRenderer )
{
TextureSet textureSet = mTargetRenderer.GetTextures();
- textureSet.SetImage( 0u, mTargetImage );
+ textureSet.SetTexture( 0u, mTargetTexture );
}
}
//create the target renderer
TextureSet textureSet = TextureSet::New();
- if( mTargetImage )
+ if( mTargetTexture )
{
- textureSet.SetImage( 0u, mTargetImage );
+ textureSet.SetTexture( 0u, mTargetTexture );
}
Geometry geometry = mCurrentRenderer.GetGeometry();
Shader shader( mCurrentRenderer.GetShader() );
std::swap( mCurrentTiles, mTargetTiles );
std::swap( mCurrentRenderer, mTargetRenderer );
- std::swap( mCurrentImage, mTargetImage );
+ std::swap( mCurrentTexture, mTargetTexture );
ResetToInitialState();
//Emit signal
Toolkit::CubeTransitionEffect handle( GetOwner() );
- mTransitionCompletedSignal.Emit( handle, mCurrentImage );
+ mTransitionCompletedSignal.Emit( handle, mCurrentTexture );
}
Toolkit::CubeTransitionEffect::TransitionCompletedSignalType& CubeTransitionEffect::TransitionCompletedSignal()
-#ifndef __DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_EFFECT_H__
-#define __DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_EFFECT_H__
+#ifndef DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_EFFECT_H
+#define DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_EFFECT_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/transition-effects/cube-transition-effect.h>
bool IsTransitioning();
/**
- * @copydoc Toolkit::CubeTransitionEffect::SetFirstImage
+ * @copydoc Toolkit::CubeTransitionEffect::SetCurrentTexture
*/
- void SetCurrentImage( Image image );
+ void SetCurrentTexture( Texture texture );
/**
- * @copydoc Toolkit::CubeTransitionEffect::SetTargetImage
+ * @copydoc Toolkit::CubeTransitionEffect::SetTargetTexture
*/
- void SetTargetImage( Image image );
+ void SetTargetTexture( Texture texture );
/**
* @copydoc Toolkit::CubeTransitionEffect::StartTransition(bool)
Renderer mCurrentRenderer;
Renderer mTargetRenderer;
- Image mCurrentImage;
- Image mTargetImage;
+ Texture mCurrentTexture;
+ Texture mTargetTexture;
+
Animation mAnimation;
Vector2 mTileSize;
} // namespace Dali
-#endif /* __DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_EFFECT_H__ */
+#endif // DALI_TOOLKIT_INTERNAL_CUBE_TRANSITION_EFFECT_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/public-api/object/type-registry-helper.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
-#ifndef __DALI_TOOLKIT_CONTROL_IMPL_H__
-#define __DALI_TOOLKIT_CONTROL_IMPL_H__
+#ifndef DALI_TOOLKIT_CONTROL_IMPL_H
+#define DALI_TOOLKIT_CONTROL_IMPL_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
} // namespace Dali
-#endif // __DALI_TOOLKIT_CONTROL_IMPL_H__
+#endif // DALI_TOOLKIT_CONTROL_IMPL_H
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 42;
+const unsigned int TOOLKIT_MICRO_VERSION = 43;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.1.42
+Version: 1.1.43
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
%define dali_toolkit_profile MOBILE
%endif
-%if 0%{?enable_coverage}
-CXXFLAGS+=" -fprofile-arcs -ftest-coverage --coverage "
-LDFLAGS+=" -fprofile-arcs -ftest-coverage --coverage -lgcov "
-%endif
-
-
%description
The OpenGLES Canvas Core Library Toolkit - a set of controls that provide
user interface functionality.
CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections "
LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "
+%if 0%{?enable_coverage}
+CXXFLAGS+=" --coverage "
+LDFLAGS+=" --coverage "
+%endif
+
libtoolize --force
cd %{_builddir}/dali-toolkit-%{version}/build/tizen
autoreconf --install
| Name | Description | Parameters passed to call back |
|-----------------|----------------------------------------|--------------------------|
-|touched | touch event | (actor, touchEvent ) |
+|touch | touch | (actor, touchData ) |
|hovered | mouse or pointer hovering over actor | (actor, hoverEvent) |
|mouseWheelEvent | mouse wheel events | (actor, wheelEvent) |
|onStage | actor has been moved on stage | (actor) |
#### Touch event
Used to detect multiple touch events on the actor. The state of each touch point can be:
-+ "down" = touch down
-+ "up" = Touch up
-+ "motion" = Finger dragged or hovered
-+ "leave" = Leave the boundary of an actor
-+ "stationary" = No change from last event. Useful when a multi-point event occurs where
-all points are sent but indicates that this particular point has not changed since the last time
-+ "interrupted" = A system event has occurred which has interrupted the touch or hover event sequence
++ "DOWN" = touch down
++ "UP" = Touch up
++ "MOTION" = Finger dragged or hovered
++ "LEAVE" = Leave the boundary of an actor
++ "STATIONARY" = No change from last event. Useful when a multi-point event occurs where
+ all points are sent but indicates that this particular point has not changed
+ since the last time
++ "INTERRUPTED" = A system event has occurred which has interrupted the touch or hover event sequence
```
-touchEvent = {
+touchData = {
pointCount: int, // number of points touched ( multi-touch )
time: int, // The time in milliseconds that the touch event occurred.
- points = [ touchPoints ], // array of TouchPoints, to support
+ points = [ Points ], // array of Points
- TouchPoint = {
-
- "deviceId" : int, // Each touch point has a unique device ID
- "state" : string, // touch state ="down,up,motion,leave,stationary, interrupted }
- "sourceActor" : actor, // the actor that is emitting the callback (the actor that is hit maybe a child of it)
- "hitActor" : actor, // actor that was hit
- "local" : {x,y}, // co-ordinates of top left of hit actor (local.x, local.y)
- "screen" : {x,y} // co-ordinates of top left of hit actor (screen.x, screen.y)
- }
+ Point = {
+ "deviceId" : int, // Each touch point has a unique device ID
+ "state" : string, // touch state ="DOWN","UP","MOTION","LEAVE","STATIONARY","INTERRUPTED"
+ "sourceActor" : actor, // the actor that is emitting the callback (the actor that is hit maybe a child of it)
+ "hitActor" : actor, // actor that was hit
+ "local" : {x,y}, // co-ordinates of top left of hit actor (local.x, local.y)
+ "screen" : {x,y}, // co-ordinates of top left of hit actor (screen.x, screen.y)
+ "radius" : float, // radius of the press point (average of both the horizontal & vertical radii)
+ "ellipseRadius" : {x,y}, // both the horizontal and the vertical radii of the press point
+ "pressure" : float, // the touch pressure
+ "angle" : float // angle of the press point relative to the Y-Axis (in degrees)
+ }
}
-function OnPressed( actor, touchEvent )
+function onPressed( actor, touchData )
{
- var firstPoint = touchEvent.points[0];
- log("first touch point = " + firstPoint.screen.x + "," +firstPoint.screen.x + "actor= "+firstPoint.hitActor );
+ var firstPoint = touchData.points[0];
+ log("first touch point = " + firstPoint.screen.x + "," + firstPoint.screen.x + "actor= " + firstPoint.hitActor );
var anim = new dali.Animation( 4 );
var rotation = new dali.Rotation( 90, 0, 0 ); // pitch, yaw, roll
}
// connect to touch events
-myActor.on( "touched", onPressed );
+myActor.on( "touch", onPressed );
```
points[] // array of TouchPoints
TouchPoint = {
- // See touchEvent TouchPoint object
+ "deviceId" : int, // Each touch point has a unique device ID
+ "state" : string, // touch state ="down,up,motion,leave,stationary, interrupted }
+ "sourceActor" : actor, // the actor that is emitting the callback (the actor that is hit maybe a child of it)
+ "hitActor" : actor, // actor that was hit
+ "local" : {x,y}, // co-ordinates of top left of hit actor (local.x, local.y)
+ "screen" : {x,y} // co-ordinates of top left of hit actor (screen.x, screen.y)
}
}
```
/**
* Actors sensitive flag
- * brief Sets whether an actor should emit touch event signals; @see SignalTouched().
+ * brief Sets whether an actor should emit touch event signals; @see SignalTouch().
*
- * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouched(),
+ * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
* the touch event signal will be emitted.
*
* If the application wishes to temporarily disable the touch event signal emission, then they can do so by calling
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
#include <dali/public-api/actors/sampling.h>
#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/common/loading-state.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/geometry.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
namespace
{
-struct PointState
+struct TouchDataPointState
+{
+ PointState::Type state;
+ const char* name;
+};
+
+const TouchDataPointState TouchDataPointStateLookup[]=
+{
+ { PointState::DOWN, "DOWN" },
+ { PointState::UP, "UP" },
+ { PointState::MOTION, "MOTION" },
+ { PointState::LEAVE, "LEAVE" },
+ { PointState::STATIONARY, "STATIONARY" },
+ { PointState::INTERRUPTED, "INTERRUPT" },
+ { PointState::STARTED, "STARTED" },
+ { PointState::FINISHED, "FINISHED" },
+};
+
+const unsigned int TouchDataPointStateLookupCount = sizeof(TouchDataPointStateLookup)/sizeof(TouchDataPointStateLookup[0]);
+
+struct TouchPointState
{
TouchPoint::State state;
const char* name;
};
-const PointState PointStateLookup[]=
+const TouchPointState PointStateLookup[]=
{
{ TouchPoint::Down, "down" }, /**< Screen touched */
{ TouchPoint::Up, "up" }, /**< Touch stopped */
const unsigned int GestureStateLookupCount = sizeof(GestureStateLookup)/sizeof(GestureStateLookup[0]);
+const char* GetTouchDataPointStateName( PointState::Type state )
+{
+ // could use the enum as index, but dali-core may change, so for now just do a lookup
+ for( unsigned int i = 0; i < TouchDataPointStateLookupCount; i++ )
+ {
+ if( TouchDataPointStateLookup[i].state == state )
+ {
+ return TouchDataPointStateLookup[i].name;
+ }
+ }
+ return "error point state not found";
+}
+
const char* GetTouchPointStateName( TouchPoint::State state )
{
// could use the enum as index, but dali-core may change, so for now just do a lookup
} // un-named namespace
-v8::Handle<v8::Object> EventObjectGenerator::CreateTouchEvent( v8::Isolate* isolate, const TouchEvent& touchEvent)
+v8::Handle<v8::Object> EventObjectGenerator::CreateTouchData( v8::Isolate* isolate, const TouchData& touch )
{
// we are creating a touch event object that looks like this
//
// event.pointCount = points touched
// event.time = The time (in ms) that the touch event occurred.
- // event.point[] = array of TouchPoints
+ // event.point[] = array of Points
//
- // A TouchPoint =
+ // A Point =
// { "deviceId", int } Each touch point has a unique device ID
// { "state", string } touch state ="Down,Up,Motion,Leave,Stationary, Interrupted }
// { "sourceActor", actor } the actor that is emitting the callback (the actor that is hit maybe a child of it)
// { "hitActor", actor } actor that was hit
// { "local", {x,y} } co-ordinates of top left of hit actor
// { "screen", {x,y} } co-ordinates of top left of hit actor
+ // { "radius", float } radius of the press point (average of both the horizontal & vertical radii)
+ // { "ellipseRadius", {x,y} } both the horizontal and the vertical radii of the press point
+ // { "pressure", float } the touch pressure
+ // { "angle", float } angle of the press point relative to the Y-Axis
//
v8::EscapableHandleScope handleScope( isolate );
v8::Local<v8::Object> touchObject = v8::Object::New( isolate );
// Set the pointCount
- touchObject->Set( v8::String::NewFromUtf8( isolate, "pointCount" ), v8::Integer::New( isolate, touchEvent.GetPointCount() ) );
+ touchObject->Set( v8::String::NewFromUtf8( isolate, "pointCount" ), v8::Integer::New( isolate, touch.GetPointCount() ) );
// Set the time
- touchObject->Set( v8::String::NewFromUtf8( isolate, "time" ), v8::Number::New( isolate, touchEvent.time ) );
+ touchObject->Set( v8::String::NewFromUtf8( isolate, "time" ), v8::Number::New( isolate, touch.GetTime() ) );
// Set the emitting actor
// touchObject->Set( v8::String::NewFromUtf8( isolate, "sourceActor" ), ActorWrapper::WrapActor(isolate, emittingActor));
// Create the array of touch points
- v8::Local < v8::Array > pointArrayObject = v8::Array::New( isolate, touchEvent.GetPointCount() );
- for( unsigned int i = 0 ; i < touchEvent.GetPointCount() ; ++i )
+ v8::Local < v8::Array > pointArrayObject = v8::Array::New( isolate, touch.GetPointCount() );
+ for( unsigned int i = 0 ; i < touch.GetPointCount() ; ++i )
{
- v8::Local < v8::Object > pointObject = CreateTouchPoint( isolate, touchEvent.points[i] );
+ v8::Local<v8::Object> pointObject = v8::Object::New( isolate );
+
+ // set device id
+ pointObject->Set( v8::String::NewFromUtf8( isolate, "deviceId" ), v8::Integer::New( isolate, touch.GetDeviceId( i ) ) );
+
+ // set state
+ pointObject->Set( v8::String::NewFromUtf8( isolate, "state" ), v8::String::NewFromUtf8( isolate, GetTouchDataPointStateName( touch.GetState( i ) ) ) );
+
+ Actor hitActor = touch.GetHitActor( i );
+ if( hitActor )
+ {
+ // set the hit actor
+ pointObject->Set( v8::String::NewFromUtf8( isolate, "hitActor" ), ActorWrapper::WrapActor( isolate, hitActor ) );
+ }
+
+ // set the local co-ordinates
+ const Vector2& local = touch.GetLocalPosition( i );
+ v8::Local<v8::Object> localPointObject = v8::Object::New( isolate );
+ localPointObject->Set( v8::String::NewFromUtf8( isolate, "x" ), v8::Integer::New( isolate, local.x ) );
+ localPointObject->Set( v8::String::NewFromUtf8( isolate, "y" ), v8::Integer::New( isolate, local.y ) );
+ pointObject->Set( v8::String::NewFromUtf8( isolate, "local" ), localPointObject );
+
+ // set the screen co-ordinates
+ const Vector2& screen = touch.GetScreenPosition( i );
+ v8::Local<v8::Object> screenPointObject = v8::Object::New( isolate );
+ screenPointObject->Set( v8::String::NewFromUtf8( isolate, "x" ), v8::Integer::New( isolate, screen.x ) );
+ screenPointObject->Set( v8::String::NewFromUtf8( isolate, "y" ), v8::Integer::New( isolate, screen.y ) );
+ pointObject->Set( v8::String::NewFromUtf8( isolate, "screen" ), screenPointObject );
+
+ // set the radius
+ pointObject->Set( v8::String::NewFromUtf8( isolate, "radius" ), v8::Integer::New( isolate, touch.GetRadius( i ) ) );
+
+ // set the ellipse Radius
+ const Vector2& ellipse = touch.GetEllipseRadius( i );
+ v8::Local<v8::Object> ellipseObject = v8::Object::New( isolate );
+ ellipseObject->Set( v8::String::NewFromUtf8( isolate, "x" ), v8::Integer::New( isolate, ellipse.x ) );
+ ellipseObject->Set( v8::String::NewFromUtf8( isolate, "y" ), v8::Integer::New( isolate, ellipse.y ) );
+ pointObject->Set( v8::String::NewFromUtf8( isolate, "ellipseRadius" ), ellipseObject );
+
+ // set the pressure
+ pointObject->Set( v8::String::NewFromUtf8( isolate, "pressure" ), v8::Integer::New( isolate, touch.GetPressure( i ) ) );
+
+ // set the angle
+ pointObject->Set( v8::String::NewFromUtf8( isolate, "angle" ), v8::Integer::New( isolate, touch.GetAngle( i ).degree ) );
+
+ // add the point
pointArrayObject->Set( v8::Number::New( isolate, i ), pointObject );
}
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/events/hover-event.h>
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/key-event.h>
namespace EventObjectGenerator
{
- v8::Handle<v8::Object> CreateTouchEvent( v8::Isolate* isolate, const TouchEvent& touchEvent);
+ v8::Handle<v8::Object> CreateTouchData( v8::Isolate* isolate, const TouchData& touch );
v8::Handle<v8::Object> CreateHoverEvent( v8::Isolate* isolate, const HoverEvent& hoverEvent);
v8::Handle<v8::Object> CreateWheelEvent( v8::Isolate* isolate, const WheelEvent& wheelEvent);
v8::Handle<v8::Object> CreateKeyEvent( v8::Isolate* isolate, const KeyEvent& keyEvent);
-#ifndef __DALI_V8PLUGIN_PROPERTY_BUFFER_API_H__
-#define __DALI_V8PLUGIN_PROPERTY_BUFFER_API_H__
+#ifndef DALI_V8PLUGIN_PROPERTY_BUFFER_API_H
+#define DALI_V8PLUGIN_PROPERTY_BUFFER_API_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/object/property-buffer.h>
+#include <dali/public-api/rendering/property-buffer.h>
namespace Dali
*/
void SetData( const v8::FunctionCallbackInfo< v8::Value >& args );
-}; // namespace PropertyBufferApi
+} // namespace PropertyBufferApi
} // namespace V8Plugin
} // namespace Dali
-#endif // header __DALI_V8PLUGIN_PROPERTY_BUFFER_API_H__
+#endif // DALI_V8PLUGIN_PROPERTY_BUFFER_API_H
-#ifndef __DALI_V8PLUGIN_PROPERTY_BUFFER_WRAPPER_H__
-#define __DALI_V8PLUGIN_PROPERTY_BUFFER_WRAPPER_H__
+#ifndef DALI_V8PLUGIN_PROPERTY_BUFFER_WRAPPER_H
+#define DALI_V8PLUGIN_PROPERTY_BUFFER_WRAPPER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/object/property-buffer.h>
+#include <dali/public-api/rendering/property-buffer.h>
// INTERNAL INCLUDES
#include <shared/base-wrapped-object.h>
*/
virtual ~PropertyBufferWrapper()
{
- };
+ }
/**
* @brief Creates a new PropertyBuffer wrapped inside a Javascript Object.
} // namespace Dali
-#endif // __DALI_V8PLUGIN_PROPERTY_BUFFER_WRAPPER_H__
+#endif // DALI_V8PLUGIN_PROPERTY_BUFFER_WRAPPER_H
-#ifndef __DALI_V8PLUGIN_GEOMETRY_API_H__
-#define __DALI_V8PLUGIN_GEOMETRY_API_H__
+#ifndef DALI_V8PLUGIN_GEOMETRY_API_H
+#define DALI_V8PLUGIN_GEOMETRY_API_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/geometry.h>
+#include <dali/public-api/rendering/geometry.h>
namespace Dali
} // namespace Dali
-#endif // header __DALI_V8PLUGIN_GEOMETRY_API_H__
+#endif // DALI_V8PLUGIN_GEOMETRY_API_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
-#ifndef __DALI_V8PLUGIN_GEOMETRY_WRAPPER_H__
-#define __DALI_V8PLUGIN_GEOMETRY_WRAPPER_H__
+#ifndef DALI_V8PLUGIN_GEOMETRY_WRAPPER_H
+#define DALI_V8PLUGIN_GEOMETRY_WRAPPER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/geometry.h>
+#include <dali/public-api/rendering/geometry.h>
// INTERNAL INCLUDES
#include <object/handle-wrapper.h>
} // namespace Dali
-#endif // __DALI_V8PLUGIN_GEOMETRY_WRAPPER_H__
+#endif // DALI_V8PLUGIN_GEOMETRY_WRAPPER_H
-#ifndef __DALI_V8PLUGIN_RENDERER_API_H__
-#define __DALI_V8PLUGIN_RENDERER_API_H__
+#ifndef DALI_V8PLUGIN_RENDERER_API_H
+#define DALI_V8PLUGIN_RENDERER_API_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
namespace Dali
} // namespace Dali
-#endif // header __DALI_V8PLUGIN_RENDERER_API_H__
+#endif // DALI_V8PLUGIN_RENDERER_API_H
-#ifndef __DALI_V8PLUGIN_RENDERER_WRAPPER_H__
-#define __DALI_V8PLUGIN_RENDERER_WRAPPER_H__
+#ifndef DALI_V8PLUGIN_RENDERER_WRAPPER_H
+#define DALI_V8PLUGIN_RENDERER_WRAPPER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/renderer.h>
+#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
#include <object/handle-wrapper.h>
} // namespace Dali
-#endif // __DALI_V8PLUGIN_RENDERER_WRAPPER_H__
+#endif // DALI_V8PLUGIN_RENDERER_WRAPPER_H
-#ifndef __DALI_V8PLUGIN_SAMPLER_API_H__
-#define __DALI_V8PLUGIN_SAMPLER_API_H__
+#ifndef DALI_V8PLUGIN_SAMPLER_API_H
+#define DALI_V8PLUGIN_SAMPLER_API_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/sampler.h>
+#include <dali/public-api/rendering/sampler.h>
namespace Dali
{
} // namespace Dali
-#endif // header __DALI_V8PLUGIN_SAMPLER_API_H__
+#endif // DALI_V8PLUGIN_SAMPLER_API_H
-#ifndef __DALI_V8PLUGIN_SAMPLER_WRAPPER_H__
-#define __DALI_V8PLUGIN_SAMPLER_WRAPPER_H__
+#ifndef DALI_V8PLUGIN_SAMPLER_WRAPPER_H
+#define DALI_V8PLUGIN_SAMPLER_WRAPPER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/sampler.h>
+#include <dali/public-api/rendering/sampler.h>
// INTERNAL INCLUDES
#include <shared/base-wrapped-object.h>
} // namespace Dali
-#endif // __DALI_V8PLUGIN_SAMPLER_WRAPPER_H__
+#endif // DALI_V8PLUGIN_SAMPLER_WRAPPER_H
-#ifndef __DALI_V8PLUGIN_SHADER_API_H__
-#define __DALI_V8PLUGIN_SHADER_API_H__
+#ifndef DALI_V8PLUGIN_SHADER_API_H
+#define DALI_V8PLUGIN_SHADER_API_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/shader.h>
namespace Dali
} // namespace Dali
-#endif // header __DALI_V8PLUGIN_SHADER_API_H__
+#endif // DALI_V8PLUGIN_SHADER_API_H
-#ifndef __DALI_V8PLUGIN_SHADER_WRAPPER_H__
-#define __DALI_V8PLUGIN_SHADER_WRAPPER_H__
+#ifndef DALI_V8PLUGIN_SHADER_WRAPPER_H
+#define DALI_V8PLUGIN_SHADER_WRAPPER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/shader.h>
// INTERNAL INCLUDES
#include <object/handle-wrapper.h>
} // namespace Dali
-#endif // __DALI_V8PLUGIN_SHADER_WRAPPER_H__
+#endif // DALI_V8PLUGIN_SHADER_WRAPPER_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
return TextureSet::New();
}
-
-/**
- * Sets the image to be used by a given texture
- * @method setImage
- * @for TextureSet
- * @param {integer} index The index of the texture in the array of textures
- * @param {Object} image The image used by this sampler
- */
-void TextureSetApi::SetImage( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- TextureSet textureSet = GetTextureSet( isolate, args );
-
- bool found( false );
- int index = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 /* default */);
- if( !found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "invalid index parameter" );
- return;
- }
-
- found = false;
- Image image = V8Utils::GetImageParameter( PARAMETER_1, found, isolate, args );
- if( !found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "missing image from param 1" );
- }
- else
- {
- textureSet.SetImage(index, image);
- }
-}
-
/**
* Set the sampler used by a given texture
* @method setSampler
-#ifndef __DALI_V8PLUGIN_TEXURE_SET_API_H__
-#define __DALI_V8PLUGIN_TEXURE_SET_API_H__
+#ifndef DALI_V8PLUGIN_TEXURE_SET_API_H
+#define DALI_V8PLUGIN_TEXURE_SET_API_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/texture-set.h>
namespace Dali
} // namespace Dali
-#endif // header __DALI_V8PLUGIN_TEXURE_SET_API_H__
+#endif // DALI_V8PLUGIN_TEXURE_SET_API_H
-#ifndef __DALI_V8PLUGIN_TEXTURE_SET_WRAPPER_H__
-#define __DALI_V8PLUGIN_TEXTURE_SET_WRAPPER_H__
+#ifndef DALI_V8PLUGIN_TEXTURE_SET_WRAPPER_H
+#define DALI_V8PLUGIN_TEXTURE_SET_WRAPPER_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
// EXTERNAL INCLUDES
#include <v8.h>
-#include <dali/devel-api/rendering/texture-set.h>
+#include <dali/public-api/rendering/texture-set.h>
// INTERNAL INCLUDES
#include <object/handle-wrapper.h>
} // namespace Dali
-#endif // __DALI_V8PLUGIN_TEXTURE_SET_WRAPPER_H__
+#endif // DALI_V8PLUGIN_TEXTURE_SET_WRAPPER_H
{
returnValue = PropertyValueWrapper::WrapDaliProperty( isolate, value.Get<Vector3>() );
}
- else if( typeInfo == typeid( Dali::TouchEvent ) )
+ else if( typeInfo == typeid( Dali::TouchData ) )
{
- returnValue = EventObjectGenerator::CreateTouchEvent( isolate, value.Get<TouchEvent>() );
+ returnValue = EventObjectGenerator::CreateTouchData( isolate, value.Get<TouchData>() );
}
else if( typeInfo == typeid( Dali::HoverEvent ) )
{
#include <dali/public-api/events/pan-gesture-detector.h>
#include <dali/public-api/object/any.h>
#include <dali/public-api/images/image.h>
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/events/hover-event.h>
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/key-event.h>
namespace // un-named namespace
{
-const char* const SIGNAL_TOUCHED = "touched";
+const char* const SIGNAL_TOUCH = "touch";
const char* const SIGNAL_HOVERED = "hovered";
const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
const char* const SIGNAL_ON_STAGE = "onStage";
const char* const STAGE_SIGNAL_KEY_EVENT = "keyEvent";
const char* const STAGE_SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
-const char* const STAGE_SIGNAL_TOUCHED = "touched";
+const char* const STAGE_SIGNAL_TOUCH = "touch";
const char* const SIGNAL_IMAGE_LOADING_FINISHED = "imageLoadingFinished";
const char* const SIGNAL_IMAGE_UPLOADED = "uploaded";
mActor(actor)
{
}
- bool OnTouch( Actor actor, const TouchEvent& event)
+ bool OnTouch( Actor actor, const TouchData& touch )
{
std::vector< Dali::Any > arguments; // Dali::Vector considers Dali::Any to be a non trivial type so won't compile
Dali::Any returnValue(false);
arguments.push_back( actor );
- arguments.push_back( event );
+ arguments.push_back( touch );
CallJavaScript( returnValue, arguments );
bool ret;
returnValue.Get(ret);
Dali::Any returnValue; //no return
CallJavaScript( returnValue, arguments );
}
- void TouchedSignal( const TouchEvent& touchEvent)
+ void TouchSignal( const TouchData& touch )
{
std::vector< Dali::Any > arguments;
Dali::Any returnValue; //no return
- arguments.push_back( touchEvent );
+ arguments.push_back( touch );
CallJavaScript( returnValue, arguments );
}
};
ActorCallback* callback =new ActorCallback( isolate, javaScriptCallback, signalName, actor );
- if( strcmp( signalName.c_str(), SIGNAL_TOUCHED ) == 0 )
+ if( strcmp( signalName.c_str(), SIGNAL_TOUCH ) == 0 )
{
- actor.TouchedSignal().Connect( callback, &ActorCallback::OnTouch );
+ actor.TouchSignal().Connect( callback, &ActorCallback::OnTouch );
}
else if( strcmp( signalName.c_str(), SIGNAL_HOVERED ) == 0 )
{
{
stage.EventProcessingFinishedSignal().Connect( callback, &StageCallback::EventProcessingFinishedSignal );
}
- else if (strcmp( signalName.c_str(), STAGE_SIGNAL_TOUCHED ) == 0 )
+ else if (strcmp( signalName.c_str(), STAGE_SIGNAL_TOUCH ) == 0 )
{
- stage.TouchedSignal().Connect( callback, &StageCallback::TouchedSignal );
+ stage.TouchSignal().Connect( callback, &StageCallback::TouchSignal );
}
else
{
// first paramter = signal to connect to
// Second parameter = function ( to run )
// args.This() = myActor
- // e.g. myActor.Connect("touched", myJavaScriptActorTouched );
+ // e.g. myActor.Connect("touch", myJavaScriptActorTouched );
// Inside Callback on myJavaScriptActorTouched
- // myActor.Disconnect("touched", myJavaScriptActorTouched );
+ // myActor.Disconnect("touch", myJavaScriptActorTouched );
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope handleScope( isolate );