END_TEST;
}
+
+int UtcDaliItemViewSetGetProperty(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+ DALI_TEST_CHECK(view);
+
+ // Event side properties
+
+ // Test "minimumSwipeSpeed" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("minimumSwipeSpeed") == ItemView::Property::MINIMUM_SWIPE_SPEED );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_SPEED).Get<float>(), view.GetMinimumSwipeSpeed(), TEST_LOCATION );
+ view.SetProperty( ItemView::Property::MINIMUM_SWIPE_SPEED, 2.5f );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_SPEED).Get<float>(), 2.5f, TEST_LOCATION );
+
+ // Test "minimumSwipeDistance" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("minimumSwipeDistance") == ItemView::Property::MINIMUM_SWIPE_DISTANCE );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_DISTANCE).Get<float>(), view.GetMinimumSwipeDistance(), TEST_LOCATION );
+ view.SetProperty( ItemView::Property::MINIMUM_SWIPE_DISTANCE, 8.725f );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::MINIMUM_SWIPE_DISTANCE).Get<float>(), 8.725f, TEST_LOCATION );
+
+ // Test "wheelScrollDistanceStep" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("wheelScrollDistanceStep") == ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<float>(), view.GetWheelScrollDistanceStep(), TEST_LOCATION );
+ view.SetProperty( ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP, 5.0f );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<float>(), 5.0f, TEST_LOCATION );
+
+ // Test "snapToItemEnabled" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("snapToItemEnabled") == ItemView::Property::SNAP_TO_ITEM_ENABLED );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SNAP_TO_ITEM_ENABLED).Get<bool>(), view.GetAnchoring(), TEST_LOCATION );
+ view.SetProperty( ItemView::Property::SNAP_TO_ITEM_ENABLED, true );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SNAP_TO_ITEM_ENABLED).Get<bool>(), true, TEST_LOCATION );
+
+ // Test "refreshInterval" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("refreshInterval") == ItemView::Property::REFRESH_INTERVAL );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), view.GetRefreshInterval(), TEST_LOCATION );
+ view.SetProperty( ItemView::Property::REFRESH_INTERVAL, 11.0f );
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), 11.0f, TEST_LOCATION );
+
+ // Test "overshootEnabled" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED );
+ DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), view.IsOvershootEnabled(), TEST_LOCATION );
+ view.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
+ DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), false, TEST_LOCATION );
+
+ // Animatable properties
+
+ // Test "layoutPosition" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("layoutPosition") == ItemView::Property::LAYOUT_POSITION );
+ view.SetProperty( ItemView::Property::LAYOUT_POSITION, 20.5f );
+ Wait(application);
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::LAYOUT_POSITION).Get<float>(), 20.5f, TEST_LOCATION );
+
+ // Test "scrollSpeed" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("scrollSpeed") == ItemView::Property::SCROLL_SPEED );
+ view.SetProperty( ItemView::Property::SCROLL_SPEED, 3.35f );
+ Wait(application);
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_SPEED).Get<float>(), 3.35f, TEST_LOCATION );
+
+ // Test "overshoot" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("overshoot") == ItemView::Property::OVERSHOOT );
+ view.SetProperty( ItemView::Property::OVERSHOOT, 0.15f );
+ Wait(application);
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::OVERSHOOT).Get<float>(), 0.15f, TEST_LOCATION );
+
+ // Test "scrollDirection" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("scrollDirection") == ItemView::Property::SCROLL_DIRECTION );
+ view.SetProperty( ItemView::Property::SCROLL_DIRECTION, Vector2(0.85f, 0.5f) );
+ Wait(application);
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_DIRECTION).Get<Vector2>(), Vector2(0.85f, 0.5f), TEST_LOCATION );
+
+ // Test "layoutOrientation" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("layoutOrientation") == ItemView::Property::LAYOUT_ORIENTATION );
+ view.SetProperty( ItemView::Property::LAYOUT_ORIENTATION, 2 );
+ Wait(application);
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::LAYOUT_ORIENTATION).Get<int>(), 2, TEST_LOCATION );
+
+ // Test "scrollContentSize" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("scrollContentSize") == ItemView::Property::SCROLL_CONTENT_SIZE );
+ view.SetProperty( ItemView::Property::SCROLL_CONTENT_SIZE, 250.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::SCROLL_CONTENT_SIZE).Get<float>(), 250.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
tet_result(TET_PASS);
END_TEST;
}
+
+
+int UtcDaliJsonParserMerge1(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("JSON tree merge");
+
+ std::string s1( ReplaceQuotes(" \
+{ \
+ 'styles': \
+ { \
+ 'button': \
+ { \
+ 'backgroundColor':[0.8, 0.0, 1.0, 1.0], \
+ 'foregroundColor':[1, 1, 1, 1] \
+ } \
+ } \
+} \
+"));
+
+ JsonParser parser = JsonParser::New();
+ JsonParser testParser = JsonParser::New();
+
+ testParser.Parse( s1 );
+
+ parser.Parse( s1 );
+ parser.Parse( s1 ); // Merge the tree into itself. The value array should not grow.
+
+ DALI_TEST_CHECK(parser.GetRoot());
+
+ CompareTrees( *parser.GetRoot(), *testParser.GetRoot() );
+
+ END_TEST;
+}
END_TEST;
}
+
+int UtcDaliScrollViewSetGetProperty(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ScrollView actor
+ ScrollView scrollView = ScrollView::New();
+ DALI_TEST_CHECK(scrollView);
+
+ // Event side properties
+
+ // Test "wrapEnabled" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrapEnabled") == ScrollView::Property::WRAP_ENABLED );
+ scrollView.SetProperty( ScrollView::Property::WRAP_ENABLED, true );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP_ENABLED).Get<bool>(), true, TEST_LOCATION );
+
+ // Test "panningEnabled" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("panningEnabled") == ScrollView::Property::PANNING_ENABLED );
+ scrollView.SetProperty( ScrollView::Property::PANNING_ENABLED, false );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING_ENABLED).Get<bool>(), false, TEST_LOCATION );
+
+ // Test "axisAutoLockEnabled" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("axisAutoLockEnabled") == ScrollView::Property::AXIS_AUTO_LOCK_ENABLED );
+ scrollView.SetProperty( ScrollView::Property::AXIS_AUTO_LOCK_ENABLED, false );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::AXIS_AUTO_LOCK_ENABLED).Get<bool>(), false, TEST_LOCATION );
+
+ // Test "wheelScrollDistanceStep" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("wheelScrollDistanceStep") == ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP );
+ scrollView.SetProperty( ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP, Vector2(100.0f, 50.0f) );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WHEEL_SCROLL_DISTANCE_STEP).Get<Vector2>(), Vector2(100.0f, 50.0f), TEST_LOCATION );
+
+ // Test "overshootEnabled" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED );
+ DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), scrollView.IsOvershootEnabled(), TEST_LOCATION );
+ scrollView.SetProperty( Scrollable::Property::OVERSHOOT_ENABLED, false );
+ DALI_TEST_EQUALS( scrollView.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), false, TEST_LOCATION );
+
+ // Animatable properties
+
+ // Test "scrollPosition" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPosition") == ScrollView::Property::SCROLL_POSITION );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION, Vector2(320.0f, 550.0f) );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION).Get<Vector2>(), Vector2(320.0f, 550.0f), TEST_LOCATION );
+
+ // Test "scrollPrePosition", "scrollPrePositionX" and "scrollPrePositionY" properties
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePosition") == ScrollView::Property::SCROLL_PRE_POSITION );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION, Vector2(300.0f, 500.0f) );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(300.0f, 500.0f), TEST_LOCATION );
+
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionX") == ScrollView::Property::SCROLL_PRE_POSITION_X );
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionY") == ScrollView::Property::SCROLL_PRE_POSITION_Y );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 300.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 500.0f, TEST_LOCATION );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_X, 400.0f );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_Y, 600.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_X).Get<float>(), 400.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_Y).Get<float>(), 600.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION).Get<Vector2>(), Vector2(400.0f, 600.0f), TEST_LOCATION );
+
+ // Test "scrollPrePositionMax", "scrollPrePositionMaxX" and "scrollPrePositionMaxY" properties
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMax") == ScrollView::Property::SCROLL_PRE_POSITION_MAX );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX, Vector2(100.0f, 200.0f) );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(100.0f, 200.0f), TEST_LOCATION );
+
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxX") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_X );
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPrePositionMaxY") == ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 100.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 200.0f, TEST_LOCATION );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_X, 300.0f );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y, 400.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_X).Get<float>(), 300.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX_Y).Get<float>(), 400.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_PRE_POSITION_MAX).Get<Vector2>(), Vector2(300.0f, 400.0f), TEST_LOCATION );
+
+ // Test "overshootX" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootX") == ScrollView::Property::OVERSHOOT_X );
+ scrollView.SetProperty( ScrollView::Property::OVERSHOOT_X, 0.8f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X).Get<float>(), 0.8f, TEST_LOCATION );
+
+ // Test "overshootY" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("overshootY") == ScrollView::Property::OVERSHOOT_Y );
+ scrollView.SetProperty( ScrollView::Property::OVERSHOOT_Y, 0.8f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y).Get<float>(), 0.8f, TEST_LOCATION );
+
+ // Test "scrollFinal", "scrollFinalX" and "scrollFinalY" properties
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinal") == ScrollView::Property::SCROLL_FINAL );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL, Vector2(200.0f, 300.0f) );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(200.0f, 300.0f), TEST_LOCATION );
+
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalX") == ScrollView::Property::SCROLL_FINAL_X );
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollFinalY") == ScrollView::Property::SCROLL_FINAL_Y );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 200.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 300.0f, TEST_LOCATION );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_X, 500.0f );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_FINAL_Y, 600.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_X).Get<float>(), 500.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL_Y).Get<float>(), 600.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_FINAL).Get<Vector2>(), Vector2(500.0f, 600.0f), TEST_LOCATION );
+
+ // Test "wrap" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("wrap") == ScrollView::Property::WRAP );
+ scrollView.SetProperty( ScrollView::Property::WRAP, false );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::WRAP).Get<bool>(), false, TEST_LOCATION );
+
+ // Test "panning" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("panning") == ScrollView::Property::PANNING );
+ scrollView.SetProperty( ScrollView::Property::PANNING, true );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::PANNING).Get<bool>(), true, TEST_LOCATION );
+
+ // Test "scrolling" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrolling") == ScrollView::Property::SCROLLING );
+ scrollView.SetProperty( ScrollView::Property::SCROLLING, false );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLLING).Get<bool>(), false, TEST_LOCATION );
+
+ // Test "scrollDomainSize", "scrollDomainSizeX" and "scrollDomainSizeY" properties
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSize") == ScrollView::Property::SCROLL_DOMAIN_SIZE );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE, Vector2(1200.0f, 1300.0f) );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1200.0f, 1300.0f), TEST_LOCATION );
+
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeX") == ScrollView::Property::SCROLL_DOMAIN_SIZE_X );
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainSizeY") == ScrollView::Property::SCROLL_DOMAIN_SIZE_Y );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1200.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1300.0f, TEST_LOCATION );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_X, 1500.0f );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_SIZE_Y, 1600.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_X).Get<float>(), 1500.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE_Y).Get<float>(), 1600.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_SIZE).Get<Vector2>(), Vector2(1500.0f, 1600.0f), TEST_LOCATION );
+
+ // Test "scrollDomainOffset" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollDomainOffset") == ScrollView::Property::SCROLL_DOMAIN_OFFSET );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_DOMAIN_OFFSET, Vector2(500.0f, 200.0f) );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_DOMAIN_OFFSET).Get<Vector2>(), Vector2(500.0f, 200.0f), TEST_LOCATION );
+
+ // Test "scrollPositionDelta" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("scrollPositionDelta") == ScrollView::Property::SCROLL_POSITION_DELTA );
+ scrollView.SetProperty( ScrollView::Property::SCROLL_POSITION_DELTA, Vector2(10.0f, 30.0f) );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION_DELTA).Get<Vector2>(), Vector2(10.0f, 30.0f), TEST_LOCATION );
+
+ // Test "startPagePosition" property
+ DALI_TEST_CHECK( scrollView.GetPropertyIndex("startPagePosition") == ScrollView::Property::START_PAGE_POSITION );
+ scrollView.SetProperty( ScrollView::Property::START_PAGE_POSITION, Vector3(50.0f, 100.0f, 20.0f) );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetProperty(ScrollView::Property::START_PAGE_POSITION).Get<Vector3>(), Vector3(50.0f, 100.0f, 20.0f), TEST_LOCATION );
+
+ END_TEST;
+}
parser.GetErrorDescription().c_str() );
DALI_ASSERT_ALWAYS(!"Cannot parse JSON");
-
}
else
{
}
DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Cannot parse JSON");
-
}
void Builder::AddConstants( const Property::Map& map )
mParser = Dali::Toolkit::JsonParser::New();
Property::Map defaultDirs;
- defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR;
- defaultDirs[ TOKEN_STRING(DALI_SOUND_DIR) ] = DALI_SOUND_DIR;
- defaultDirs[ TOKEN_STRING(DALI_STYLE_DIR) ] = DALI_STYLE_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_SOUND_DIR) ] = DALI_SOUND_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_STYLE_DIR) ] = DALI_STYLE_DIR;
defaultDirs[ TOKEN_STRING(DALI_STYLE_IMAGE_DIR) ] = DALI_STYLE_IMAGE_DIR;
AddConstants( defaultDirs );
TreeNodeManipulator modify(node);
modify.SetName(name);
- // Set the type of the existing node, this may remove children where necessary
- // (changing from container type to value type)
+
+ // Set the type of the existing node.
+ // Where the new type is different, then any children of this node will
+ // be deleted.
+ // When the type is an array of numbers, then this will also remove any children
+ // When the type is an object or other array, then the children will not be removed,
+ // but will instead follow these replace rules.
modify.SetType(type);
mCurrent = modify;
namespace
{
-void Indent(std::ostream& o, int indent)
+void Indent(std::ostream& o, int level, int indentWidth)
{
- for (int i = 0; i < indent; ++i)
+ for (int i = 0; i < level*indentWidth; ++i)
{
o << " ";
}
}
+std::string EscapeQuotes( const char* aString)
+{
+ std::string escapedString;
+ int length = strlen(aString);
+ escapedString.reserve(length);
+
+ const char* end = aString+length;
+ for( const char* iter = aString; iter != end ; ++iter)
+ {
+ if(*iter != '\"')
+ {
+ escapedString.push_back(*iter);
+ }
+ else
+ {
+ escapedString.append("\\\"");
+ }
+ }
+ return escapedString;
}
+} // anonymous namespace
+
TreeNodeManipulator::TreeNodeManipulator(TreeNode* node)
: mNode(node)
{
}
}
}
+ else if( TreeNode::ARRAY == mNode->mType )
+ {
+ if( mNode->mFirstChild != NULL )
+ {
+ TreeNode::NodeType type = mNode->mFirstChild->GetType();
+
+ if( TreeNode::FLOAT == type || TreeNode::INTEGER == type )
+ {
+ // Arrays of numbers should be replaced, not appended to.
+ RemoveChildren();
+ }
+ }
+ }
}
void TreeNodeManipulator::SetName( const char* name )
void TreeNodeManipulator::Write(std::ostream& output, int indent) const
{
DALI_ASSERT_DEBUG(mNode && "Operation on NULL JSON node");
- DoWrite(mNode, output, indent);
+ DoWrite(mNode, output, 0, indent, false);
}
-void TreeNodeManipulator::DoWrite(const TreeNode *value, std::ostream& output, int indent) const
+void TreeNodeManipulator::DoWrite(const TreeNode *value, std::ostream& output, int level, int indentWidth, bool groupChildren) const
{
DALI_ASSERT_DEBUG(value && "Operation on NULL JSON node");
- Indent(output, indent);
+ if(!groupChildren)
+ {
+ Indent(output, level, indentWidth);
+ }
if (value->GetName())
{
output << "null";
if(NULL != value->mNextSibling)
{
- output << ",";
+ output << ", ";
}
- if(indent)
+ if( !groupChildren )
{
output << std::endl;
}
case TreeNode::OBJECT:
case TreeNode::ARRAY:
{
+ bool groupMyChildren = false;
+
+ if( TreeNode::ARRAY == value->GetType() &&
+ ( TreeNode::INTEGER == value->mFirstChild->GetType() ||
+ TreeNode::FLOAT == value->mFirstChild->GetType() ) )
+ {
+ groupMyChildren = true;
+ }
+
if( value->GetType() == TreeNode::OBJECT)
{
+ output << std::endl;
+ Indent(output, level, indentWidth);
output << "{";
- if(indent)
- {
- output << std::endl;
- }
}
else
{
- output << "[";
- if(indent)
+ if( !groupMyChildren )
{
output << std::endl;
+ Indent(output, level, indentWidth);
}
+ output << "[";
+ }
+
+ if( groupMyChildren )
+ {
+ output << " ";
+ }
+ else
+ {
+ output << std::endl;
}
for (TreeNode::ConstIterator it = value->CBegin(); it != value->CEnd(); ++it)
{
- DoWrite( &((*it).second), output, indent + 1);
+ DoWrite( &((*it).second), output, level+1, indentWidth, groupMyChildren );
}
- Indent(output, indent);
+
+ if( !groupMyChildren )
+ {
+ Indent(output, level, indentWidth);
+ }
+
if( value->GetType() == TreeNode::OBJECT )
{
output << "}";
- if(indent)
- {
- output << std::endl;
- }
}
else
{
output << "]";
- if(indent)
- {
- output << std::endl;
- }
}
+
+ if( NULL != value->mNextSibling )
+ {
+ output << ",";
+ }
+
+ if( !groupChildren )
+ {
+ output << std::endl;
+ }
+
+ groupChildren = false;
break;
}
case TreeNode::STRING:
{
- output << "\"" << value->GetString() << "\"";
+ std::string escapedString = EscapeQuotes(value->GetString());
+ output << "\"" << escapedString << "\"";
if(NULL != value->mNextSibling)
{
output << ",";
}
- if(indent)
+
+ if( groupChildren )
+ {
+ output << " ";
+ }
+ else
{
output << std::endl;
}
-
break;
}
case TreeNode::INTEGER:
{
output << ",";
}
- if(indent)
+
+ if( groupChildren )
+ {
+ output << " ";
+ }
+ else
{
output << std::endl;
}
-
break;
}
case TreeNode::FLOAT:
{
output << ",";
}
- if(indent)
+
+ if( groupChildren )
+ {
+ output << " ";
+ }
+ else
{
output << std::endl;
}
{
output << "false";
}
+
if(NULL != value->mNextSibling)
{
output << ",";
}
- if(indent)
+
+ if( groupChildren )
+ {
+ output << " ";
+ }
+ else
{
output << std::endl;
}
} // namespace Toolkit
} // namespace Dali
-
/*
* Do write to string stream
*/
- void DoWrite(const TreeNode *value, std::ostream& output, int ident) const;
+ void DoWrite(const TreeNode *value, std::ostream& output, int level, int ident, bool groupChildren) const;
};
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "minimumSwipeSpeed", FLOAT, MINIMUM_SWIPE_SPEED )
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "minimumSwipeDistance", FLOAT, MINIMUM_SWIPE_DISTANCE )
-DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "wheelScrollDistanceStep", FLOAT, WHELL_SCROLL_DISTANCE_SPEED )
+DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "wheelScrollDistanceStep", FLOAT, WHEEL_SCROLL_DISTANCE_STEP )
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "snapToItemEnabled", BOOLEAN, SNAP_TO_ITEM_ENABLED )
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "refreshInterval", FLOAT, REFRESH_INTERVAL )
itemViewImpl.SetMinimumSwipeDistance( value.Get<float>() );
break;
}
- case Toolkit::ItemView::Property::WHELL_SCROLL_DISTANCE_SPEED:
+ case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
{
itemViewImpl.SetWheelScrollDistanceStep( value.Get<float>() );
break;
value = itemViewImpl.GetMinimumSwipeDistance();
break;
}
- case Toolkit::ItemView::Property::WHELL_SCROLL_DISTANCE_SPEED:
+ case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
{
value = itemViewImpl.GetWheelScrollDistanceStep();
break;
void TextSelectionPopup::ShowPopup()
{
- if ( !mPopupShowing || mButtonsChanged )
+ if( ( !mPopupShowing || mButtonsChanged ) &&
+ ( Toolkit::TextSelectionPopup::NONE != mEnabledButtons ) )
{
Actor self = Self();
AddPopupOptionsToToolbar( mShowIcons, mShowCaptions );
: mOrientationDegrees( 0 ), // Portrait
mDefaultFontSize( -1 ),
mDefaultFontFamily(""),
- mThemeFile( DEFAULT_THEME ),
mFeedbackStyle( NULL )
{
// Add theme builder constants
// Sound & haptic style
mFeedbackStyle = new FeedbackStyle();
-
}
StyleManager::~StyleManager()
mOrientationDegrees = orientation;
// TODO: if orientation changed, apply the new style to all controls
// dont want to really do the whole load from file again if the bundle contains both portrait & landscape
- SetTheme();
+ SetTheme( mThemeFile );
}
}
}
}
-std::string StyleManager::GetDefaultFontFamily() const
+Orientation StyleManager::GetOrientation()
{
- return mDefaultFontFamily;
+ return mOrientation;
}
-Orientation StyleManager::GetOrientation()
+std::string StyleManager::GetDefaultFontFamily() const
{
- return mOrientation;
+ return mDefaultFontFamily;
}
void StyleManager::SetStyleConstant( const std::string& key, const Property::Value& value )
return false;
}
-void StyleManager::OnOrientationChanged( Orientation orientation )
+void StyleManager::RequestThemeChange( const std::string& themeFile )
{
- mOrientation = orientation;
- // TODO: if orientation changed, apply the new style to all controls
- // dont want to really do the whole load from file again if the bundle contains both portrait & landscape
- SetTheme();
+ SetTheme( themeFile );
+}
+
+void StyleManager::RequestDefaultTheme()
+{
+ std::string empty;
+ SetTheme( empty );
+}
+
+void StyleManager::ApplyThemeStyle( Toolkit::Control control )
+{
+ if( !mThemeBuilder )
+ {
+ RequestDefaultTheme();
+ }
+
+ if( mThemeBuilder )
+ {
+ ApplyStyle( mThemeBuilder, control );
+ }
+}
+
+void StyleManager::ApplyThemeStyleAtInit( Toolkit::Control control )
+{
+ ApplyThemeStyle( control );
+
+ if(mFeedbackStyle)
+ {
+ mFeedbackStyle->ObjectCreated( control );
+ }
+}
+
+void StyleManager::ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName )
+{
+ bool builderReady = false;
+
+ // First look in the cache
+ Toolkit::Builder builder = FindCachedBuilder( jsonFileName );
+ if( builder )
+ {
+ builderReady = true;
+ }
+ else
+ {
+ // Merge theme and style constants
+ Property::Map constants( mThemeBuilderConstants );
+ constants.Merge( mStyleBuilderConstants );
+
+ // Create it
+ builder = CreateBuilder( constants );
+
+ if( LoadJSON( builder, jsonFileName ) )
+ {
+ CacheBuilder( builder, jsonFileName );
+ builderReady = true;
+ }
+ }
+
+ // Apply the style to the control
+ if( builderReady )
+ {
+ builder.ApplyStyle( styleName, control );
+ }
+}
+
+Toolkit::StyleManager::StyleChangeSignalType& StyleManager::StyleChangeSignal()
+{
+ return mStyleChangeSignal;
+}
+
+void StyleManager::SetTheme( const std::string& themeFile )
+{
+ bool themeLoaded = false;
+
+ mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
+
+ // Always load the default theme first, then merge in the custom theme if present
+ themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME );
+
+ if( ! themeFile.empty() )
+ {
+ mThemeFile = themeFile;
+ themeLoaded = LoadJSON( mThemeBuilder, mThemeFile );
+ }
+
+ if( themeLoaded )
+ {
+ if(mFeedbackStyle)
+ {
+ mFeedbackStyle->StyleChanged( mThemeFile, StyleChange::THEME_CHANGE );
+ }
+
+ mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), StyleChange::THEME_CHANGE );
+ }
+ else
+ {
+ mThemeBuilder.Reset();
+ }
+}
+
+bool StyleManager::LoadFile( const std::string& filename, std::string& stringOut )
+{
+ DALI_ASSERT_DEBUG( 0 != filename.length());
+
+ // as toolkit is platform agnostic, it cannot load files from filesystem
+ // ask style monitor to load the style sheet
+ if( mStyleMonitor )
+ {
+ return mStyleMonitor.LoadThemeFile( filename, stringOut );
+ }
+
+ return false;
}
Toolkit::Builder StyleManager::CreateBuilder( const Property::Map& constants )
}
}
-void StyleManager::ApplyThemeStyle( Toolkit::Control control )
-{
- if( !mThemeBuilder )
- {
- RequestDefaultTheme();
- }
-
- if( mThemeBuilder )
- {
- ApplyStyle( mThemeBuilder, control );
- }
-}
-
-void StyleManager::ApplyThemeStyleAtInit( Toolkit::Control control )
-{
- ApplyThemeStyle( control );
-
- if(mFeedbackStyle)
- {
- mFeedbackStyle->ObjectCreated( control );
- }
-}
-
-void StyleManager::ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName )
-{
- bool builderReady = false;
-
- // First look in the cache
- Toolkit::Builder builder = FindCachedBuilder( jsonFileName );
- if( builder )
- {
- builderReady = true;
- }
- else
- {
- // Merge theme and style constants
- Property::Map constants( mThemeBuilderConstants );
- constants.Merge( mStyleBuilderConstants );
-
- // Create it
- builder = CreateBuilder( constants );
-
- if( LoadJSON( builder, jsonFileName ) )
- {
- CacheBuilder( builder, jsonFileName );
- builderReady = true;
- }
- }
-
- // Apply the style to the control
- if( builderReady )
- {
- builder.ApplyStyle( styleName, control );
- }
-}
-
-bool StyleManager::LoadFile( const std::string& filename, std::string& stringOut )
-{
- DALI_ASSERT_DEBUG( 0 != filename.length());
-
- // as toolkit is platform agnostic, it cannot load files from filesystem
- // ask style monitor to load the style sheet
- if( mStyleMonitor )
- {
- return mStyleMonitor.LoadThemeFile( filename, stringOut );
- }
-
- return false;
-}
-
-Toolkit::StyleManager::StyleChangeSignalType& StyleManager::StyleChangeSignal()
-{
- return mStyleChangeSignal;
-}
-
-void StyleManager::RequestThemeChange( const std::string& themeFile )
-{
- mThemeFile = themeFile;
-
- // need to do style change synchronously as app might create a UI control on the next line
- SetTheme();
-}
-
-void StyleManager::RequestDefaultTheme()
+void StyleManager::OnOrientationChanged( Orientation orientation )
{
- RequestThemeChange( DEFAULT_THEME );
+ mOrientation = orientation;
+ // TODO: if orientation changed, apply the new style to all controls
+ // dont want to really do the whole load from file again if the bundle contains both portrait & landscape
+ SetTheme( mThemeFile );
}
-void StyleManager::SetTheme()
-{
- mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
-
- if( LoadJSON( mThemeBuilder, mThemeFile ) )
- {
- if(mFeedbackStyle)
- {
- mFeedbackStyle->StyleChanged( mThemeFile, StyleChange::THEME_CHANGE );
- }
-
- mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), StyleChange::THEME_CHANGE );
- }
- else
- {
- mThemeBuilder.Reset();
- }
-}
Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key )
{
case StyleChange::THEME_CHANGE:
{
- const std::string& newTheme = styleMonitor.GetTheme();
- if( ! newTheme.empty() )
- {
- mThemeFile = newTheme;
- }
- else
- {
- mThemeFile = DEFAULT_THEME;
- }
-
- SetTheme();
+ SetTheme( styleMonitor.GetTheme() );
break;
}
}
class StyleManager : public Dali::BaseObject, public ConnectionTracker
{
public:
-
/**
* Singleton access
*
*/
StyleManager();
+protected:
+ /**
+ * @brief Destructor
+ */
+ virtual ~StyleManager();
+
+public: // Public API
+
/**
* @copydoc Toolkit::StyleManager::SetOrientationValue
*/
void RequestDefaultTheme();
/**
- * Determine if a theme change has been requested
- * @return Whether a theme request is pending
- */
- bool IsThemeRequestPending();
-
- /**
* @brief Apply the theme style to a control.
*
* @param[in] control The control to apply style.
*/
Toolkit::StyleManager::StyleChangeSignalType& StyleChangeSignal();
-protected:
-
- /**
- * @brief Destructor
- */
- virtual ~StyleManager();
-
-
-public:
+private:
+ typedef std::vector<std::string> StringList;
/**
* @brief Set the current theme. Called only once per event processing cycle.
+ * @param[in] themeFile The name of the theme file to read.
*/
- void SetTheme();
-
-private:
-
- typedef std::vector<std::string> StringList;
+ void SetTheme( const std::string& themeFile );
/**
* @brief Internal helper method to read a file from file system.
int mOrientationDegrees; ///< Directly set value of orientation
int mDefaultFontSize; ///< Logical size, not a point-size
-
std::string mDefaultFontFamily;
-
std::string mThemeFile; ///< The full path of the current theme file
Property::Map mThemeBuilderConstants; ///< Contants to give the theme builder
} // namespace Dali
#endif // __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__
-
// Event side properties
MINIMUM_SWIPE_SPEED = PROPERTY_START_INDEX, ///< Property, name "minimumSwipeSpeed", @see SetMinimumSwipeSpeed(), type float, @since DALi 1.1.18
MINIMUM_SWIPE_DISTANCE, ///< Property, name "minimumSwipeDistance", @see SetMinimumSwipeDistance(), type float, @since DALi 1.1.18
- WHELL_SCROLL_DISTANCE_SPEED, ///< Property, name "wheelScrollDistanceStep", @see SetWheelScrollDistanceStep(), type float, @since DALi 1.1.18
+ WHEEL_SCROLL_DISTANCE_STEP, ///< Property, name "wheelScrollDistanceStep", @see SetWheelScrollDistanceStep(), type float, @since DALi 1.1.18
SNAP_TO_ITEM_ENABLED, ///< Property, name "snapToItemEnabled", @see SetAnchoring(), type bool, @since DALi 1.1.18
REFRESH_INTERVAL, ///< Property, name "refreshInterval", @see SetRefreshInterval(), type float, @since DALi 1.1.18
*/
enum PropertyRange
{
- PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @since DALi 1.1.18
- PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices, @since DALi 1.1.18
+ PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices
ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,
ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve animatable property indices
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 17;
+const unsigned int TOOLKIT_MICRO_VERSION = 18;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
{
PrintVersion()
{
- std::cout << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << " (" << TOOLKIT_BUILD_DATE << ")" << std::endl;
+ std::cerr << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << " (" << TOOLKIT_BUILD_DATE << ")" << std::endl;
}
};
PrintVersion TOOLKIT_VERSION;
"grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
"selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
+ },
+ "popup":
+ {
+ "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
+ },
+ "confirmationpopup":
+ {
+ "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
}
}
}
'<(DALI_JS_DIR)/controls/control-wrapper.cpp',
'<(DALI_JS_DIR)/controls/item-factory-wrapper.cpp',
'<(DALI_JS_DIR)/controls/item-view-api.cpp',
+ '<(DALI_JS_DIR)/controls/scroll-view-api.cpp',
'<(DALI_JS_DIR)/animation/animation-api.cpp',
'<(DALI_JS_DIR)/animation/animation-wrapper.cpp',
'<(DALI_JS_DIR)/animation/constrainer-api.cpp',
${PLUGING_SRC_DIR}/actors/actor-api.cpp
${PLUGING_SRC_DIR}/actors/layer-api.cpp
${PLUGING_SRC_DIR}/actors/camera-actor-api.cpp
+ ${PLUGING_SRC_DIR}/controls/control-wrapper.cpp
+ ${PLUGING_SRC_DIR}/controls/item-factory-wrapper.cpp
+ ${PLUGING_SRC_DIR}/controls/item-view-api.cpp
+ ${PLUGING_SRC_DIR}/controls/scroll-view-api.cpp
${PLUGING_SRC_DIR}/constants/constants-wrapper.cpp
${PLUGING_SRC_DIR}/animation/animation-api.cpp
${PLUGING_SRC_DIR}/animation/animation-wrapper.cpp
--- /dev/null
+ var window= {
+ x:0,
+ y:0,
+ width:1920,
+ height:1080,
+ transparent: false,
+ name:'scrollview-example'
+ };
+
+ var viewMode={
+ 'stereoscopic-mode':'mono', // stereo-horizontal, stereo-vertical, stereo-interlaced,
+ 'stereoBase': 65 // Distance in millimeters between left/right cameras typically between (50-70mm)
+ };
+
+ var options= {
+ 'window': window,
+ 'viewMode': viewMode,
+ }
+
+//desktop
+//var dali = require('../build/Release/dali')( options );
+
+//target
+var dali = require('dali')( options );
+
+var stageSize;
+var scrollView;
+var scrollBar;
+
+var imageDir = "./images/";
+
+var daliApp = {};
+
+daliApp.createScrollView = function() {
+
+ // Create a scroll view
+ scrollView = new dali.Control("ScrollView");
+ stageSize = dali.stage.getSize();
+ scrollView.size = [stageSize.x, stageSize.y, 0.0];
+ scrollView.parentOrigin = dali.CENTER;
+ scrollView.anchorPoint = dali.CENTER;
+
+ dali.stage.add( scrollView );
+
+ // Add actors to a scroll view with 4 pages
+ var pageRows = 1;
+ var pageColumns = 3;
+ for(var pageRow = 0; pageRow < pageRows; pageRow++)
+ {
+ for(var pageColumn = 0; pageColumn < pageColumns; pageColumn++)
+ {
+ var pageActor = new dali.Control();
+ pageActor.widthResizePolicy = "FILL_TO_PARENT";
+ pageActor.heightResizePolicy = "FILL_TO_PARENT";
+ pageActor.parentOrigin = dali.CENTER;
+ pageActor.anchorPoint = dali.CENTER;
+ pageActor.position = [pageColumn * stageSize.x, pageRow * stageSize.y, 0.0];
+ pageActor.name = "pageActor" + pageColumn;
+
+ // Add images in a 5x4 grid layout for each page
+ var imageRows = 4;
+ var imageColumns = 5;
+ var margin = 10.0;
+ var imageSize = [(stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0];
+
+ for(var row = 0; row < imageRows; row++)
+ {
+ for(var column = 0; column < imageColumns;column++)
+ {
+ var imageView = new dali.Control("ImageView");
+ var imageId = (row * imageColumns + column) % 2 + 1;
+ imageView.image = imageDir + "image-" + imageId + ".jpg";
+ imageView.parentOrigin = dali.CENTER;
+ imageView.anchorPoint = dali.CENTER;
+ imageView.size = imageSize;
+ imageView.position = [ margin * 0.5 + (imageSize[0] + margin) * column - stageSize.x * 0.5 + imageSize[0] * 0.5,
+ margin * 0.5 + (imageSize[1] + margin) * row - stageSize.y * 0.5 + imageSize[1] * 0.5,
+ 0.0 ];
+ pageActor.add(imageView);
+ var position = imageView.position;
+ }
+ }
+
+ scrollView.add( pageActor );
+ }
+ }
+
+ // Set scroll view to have 3 pages in X axis and allow page snapping,
+ // and also disable scrolling in Y axis.
+ var scrollMode = {
+ xAxisScrollEnabled : true,
+ xAxisSnapToInterval : stageSize.x, // Define the snap points
+ xAxisScrollBoundary : stageSize.x * pageColumns, // i.e. Define 3 pages
+ yAxisScrollEnabled : false
+ }
+
+ scrollView.setScrollMode(scrollMode);
+
+ // Create a horizontal scroll bar in the bottom of scroll view (optional)
+ scrollBar = new dali.Control("ScrollBar");
+ scrollBar.parentOrigin = dali.BOTTOM_LEFT;
+ scrollBar.anchorPoint = dali.TOP_LEFT;
+ scrollBar.widthResizePolicy = "FIT_TO_CHILDREN";
+ scrollBar.heightResizePolicy = "FILL_TO_PARENT";
+ scrollBar.orientation = [0, 0, 270];
+ scrollBar.scrollDirection = "Horizontal";
+ scrollView.add(scrollBar);
+
+ // Connect to the onRelayout signal
+ scrollView.on("onRelayout", daliApp.onScrollViewRelayout);
+}
+
+daliApp.onScrollViewRelayout = function( button ) {
+
+ // Set the correct scroll bar size after size negotiation of scroll view is done
+ scrollBar.size = [0.0, scrollView.getRelayoutSize(dali.DIMENSION_WIDTH), 0.0 ];
+}
+
+function startup()
+{
+ daliApp.init();
+}
+
+daliApp.init = function()
+{
+ daliApp.createScrollView();
+}
+
+startup();
+
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.1.17
+Version: 1.1.18
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
var anim = new dali.Animation( 4 );
var rotation = new dali.Rotation( 90, 0, 0 ); // pitch, yaw, roll
- anim.animateBy( actor, "rotation", rotation );
+ anim.animateBy( actor, "orientation", rotation );
anim.play();
return true;
}
worldPositionX |FLOAT | ✘ | ✘
worldPositionY |FLOAT | ✘ | ✘
worldPositionZ |FLOAT | ✘ | ✘
- rotation |ROTATION | ✔ | ✔
- worldRotation |ROTATION | ✘ | ✘
+ orientation |ROTATION | ✔ | ✔
+ worldOrientation |ROTATION | ✘ | ✘
scale |VECTOR3 | ✔ | ✔
scaleX |FLOAT | ✔ | ✔
scaleY |FLOAT | ✔ | ✔
name |STRING | ✔ | ✘
sensitive |BOOLEAN | ✔ | ✘
leaveRequired |BOOLEAN | ✔ | ✘
- inheritRotation |BOOLEAN | ✔ | ✘
+ inheritOrientation |BOOLEAN | ✔ | ✘
inheritScale |BOOLEAN | ✔ | ✘
colorMode |NUMBER | ✔ | ✘
positionInheritance |NUMBER | ✔ | ✘
/**
- * Actors rotation
- * @property rotation
+ * Actors orientation
+ * @property orientation
* @type dali Rotation object
*/
-ROTATION
+ORIENTATION
/**
- * Actors world-rotation
- * @property worldRotation
+ * Actors world-orientation
+ * @property worldOrientation
* @type dali Rotation object ( read only)
*/
-WORLD_ROTATION
+WORLD_ORIENTATION
/**
* Actors scale
/**
* Set whether a child actor inherits it's parent's orientation.
* @type Boolean
- * @property inheritRotation
+ * @property inheritOrientation
* @default true
*/
-INHERIT_ROTATION,
+INHERIT_ORIENTATION,
/**
var anim = new dali.Animation(1); // default duration is increased if length of all animations is greater than it.
var animOptions = {
- alpha: "linear",
+ alpha: dali.ALPHA_FUNCTION_LINEAR,
delay: 0.5, // used to delay the start of the animation
duration: 3, // duration of the animation
};
// rotate back to correct orientation
var endRotation = new dali.Rotation(0,0,0);
- animOptions.alpha = "easeInOutSine";
+ animOptions.alpha = dali.ALPHA_FUNCTION_EASE_IN_OUT_SINE;
anim.animateTo(myActor1, "orientation", endRotation, animOptions);
// Delay the myActor2 by a second
animOptions.delay = 0.0;
- animOptions.alpha = "linear";
+ animOptions.alpha = dali.ALPHA_FUNCTION_LINEAR;
anim.animateTo(myActor2, "positionZ", 0, animOptions);
// rotate back to correct orientation
- animOptions.alpha = "easeInOutSine";
+ animOptions.alpha = dali.ALPHA_FUNCTION_EASE_IN_OUT_SINE;
anim.animateTo(myActor2, "orientation", endRotation, animOptions);
return anim;
var shaderAnim = new dali.Animation(duration+delay);
var animOptions = {
- alpha: "doubleEaseInOutSine60",
+ alpha: dali.ALPHA_FUNCTION_EASE_IN_OUT_SINE,
delay: delay,
duration: duration,
};
// also rotate the imageView 90 degrees at the same time.
var rotation = new dali.Rotation(90,0,0,1);
-shaderAnim.animateTo(imageView, "orientation", rotation, { alpha:"linear", duration:duration, delay:delay });
+shaderAnim.animateTo(imageView, "orientation", rotation, { alpha:dali.ALPHA_FUNCTION_LINEAR, duration:duration, delay:delay });
shaderAnim.play();
### Animation alpha functions
-| Name | Description |
-|--------------------|--------------|
-|default |Linear |
-|linear |Linear |
-|square |Square (x^2) |
-|reverse |Reverse linear |
-|easeIn |Speeds up and comes to a sudden stop |
-|easeOut |Sudden start and slows to a gradual stop|
-|easeInOut |Speeds up and slows to a gradual stop|
-|easeInSine |Speeds up and comes to a sudden stop|
-|easeOutSine |Sudden start and slows to a gradual stop|
-|easeInOutSine |Speeds up and slows to a gradual stop |
-|easeInSine33 |Speeds up and comes to a sudden stop |
-|easeOutSine33 |Sudden start and slows to a gradual stop |
-|easeInOutSine33 |Speeds up and slows to a gradual stop |
-|easeInOutSine50 |Speeds up and slows to a gradual stop |
-|easeInOutSine60 |Speeds up and slows to a gradual stop |
-|easeInOutSine70 |Speeds up and slows to a gradual stop |
-|easeInOutSine80 |Speeds up and slows to a gradual stop |
-|easeInOutSine90 |Speeds up and slows to a gradual stop |
-|doubleEaseInOutSine6|Speeds up and slows to a gradual stop, then speeds up again and slows to a gradual stop |
-|easeOutQuint50 |Sudden start and slows to a gradual stop |
-|easeOutQuint80 |Sudden start and slows to a gradual stop |
-|bounce |Sudden start, loses momentum and ** Returns to start position ** |
-|bounceBack |Sudden start, loses momentum and returns to exceed start position ** Returns to start position ** |
-|easeInBack |Slow start, exceed start position and quickly reach destination |
-|easeOutBack |Sudden start, exceed end position and return to a gradual stop|
-|easeInOutBack |Slow start, exceed start position, fast middle, exceed end position and return to a gradual stop|
-|sin |full 360 revolution ** Returns to start position ** |
-|sin2x |full 720 revolution ** Returns to start position ** |
+| Name | Description |
+|----------------------------------|----------------|
+|ALPHA_FUNCTION_DEFAULT |Linear |
+|ALPHA_FUNCTION_LINEAR |Linear |
+|ALPHA_FUNCTION_REVERSE |Reverse linear |
+|ALPHA_FUNCTION_EASE_IN_SQUARE |Speeds up and comes to a sudden stop (Square) |
+|ALPHA_FUNCTION_EASE_OUT_SQUARE |Sudden start and slows to a gradual stop (Square) |
+|ALPHA_FUNCTION_EASE_IN |Speeds up and comes to a sudden stop |
+|ALPHA_FUNCTION_EASE_OUT |Sudden start and slows to a gradual stop|
+|ALPHA_FUNCTION_EASE_IN_OUT |Speeds up and slows to a gradual stop|
+|ALPHA_FUNCTION_EASE_IN_SINE |Speeds up and comes to a sudden stop|
+|ALPHA_FUNCTION_EASE_OUT_SINE |Sudden start and slows to a gradual stop|
+|ALPHA_FUNCTION_EASE_IN_OUT_SINE |Speeds up and slows to a gradual stop |
+|ALPHA_FUNCTION_BOUNCE |Sudden start, loses momentum and ** Returns to start position ** |
+|ALPHA_FUNCTION_SIN |full 360 revolution ** Returns to start position ** |
+|ALPHA_FUNCTION_EASE_OUT_BACK |Sudden start, exceed end position and return to a gradual stop|
|GEOMETRY_TRIANGLE_STRIP | integer value |
|**Property type ** | |
-|PROPERTY_NONE | integer value |
+|PROPERTY_NONE | none |
|PROPERTY_BOOLEAN | integer value |
-|PROPERTY_FLOAT | integer value |
+|PROPERTY_FLOAT | float value |
|PROPERTY_INTEGER | integer value |
-|PROPERTY_VECTOR2 | integer value |
-|PROPERTY_VECTOR3 | integer value |
-|PROPERTY_VECTOR4 | integer value |
-|PROPERTY_MATRIX3 | integer value |
-|PROPERTY_MATRIX | integer value |
-|PROPERTY_RECTANGLE | integer value |
-|PROPERTY_ROTATION | integer value |
-|PROPERTY_STRING | integer value |
-|PROPERTY_ARRAY | integer value |
-|PROPERTY_MAP | integer value |
-|PROPERTY_INVALID_INDEX | integer value |
-|PROPERTY_READ_ONLY | integer value |
-|PROPERTY_READ_WRITE | integer value |
-|PROPERTY_ANIMATABLE | integer value |
+|PROPERTY_VECTOR2 | Array[ float, float ] |
+|PROPERTY_VECTOR3 | Array[ float, float, float ] |
+|PROPERTY_VECTOR4 | Array[ float, float, float, float ] |
+|PROPERTY_MATRIX3 | Object |
+|PROPERTY_MATRIX | Object |
+|PROPERTY_RECTANGLE | Object |
+|PROPERTY_ORIENTATION | Object |
+|PROPERTY_STRING | String |
+|PROPERTY_ARRAY | Object |
+|PROPERTY_MAP | Object |
+
+|**Layout dimensions ** | |
+|DIMENSION_WIDTH | integer value |
+|DIMENSION_HEIGHT | integer value |
|**Item layout type ** | |
|ITEM_LAYOUT_LIST | integer value |
|ITEM_LAYOUT_GRID | integer value |
+|**Scroll direction bias ** | |
+|DIRECTION_BIAS_NONE | integer value |
+|DIRECTION_BIAS_LEFT | integer value |
+|DIRECTION_BIAS_RIGHT | integer value |
+
+|**Animation alpha function ** | |
+|ALPHA_FUNCTION_DEFAULT | integer value |
+|ALPHA_FUNCTION_LINEAR | integer value |
+|ALPHA_FUNCTION_REVERSE | integer value |
+|ALPHA_FUNCTION_EASE_IN_SQUARE | integer value |
+|ALPHA_FUNCTION_EASE_OUT_SQUARE | integer value |
+|ALPHA_FUNCTION_EASE_IN | integer value |
+|ALPHA_FUNCTION_EASE_OUT | integer value |
+|ALPHA_FUNCTION_EASE_IN_OUT | integer value |
+|ALPHA_FUNCTION_EASE_IN_SINE | integer value |
+|ALPHA_FUNCTION_EASE_OUT_SINE | integer value |
+|ALPHA_FUNCTION_EASE_IN_OUT_SINE | integer value |
+|ALPHA_FUNCTION_BOUNCE | integer value |
+|ALPHA_FUNCTION_SIN | integer value |
+|ALPHA_FUNCTION_EASE_OUT_BACK | integer value |
+
* @class Constants
*/
* "title_text" : "Item 1" }
* ];
*
- * itemFactory.data = itemViewData; // ItemFactory will look for the template from this JSON file
+ * itemFactory.data = itemViewData; // ItemFactory will create items from this data
*
* @type Array
* @property data
dali.stage.add( imageView );
var animation = new dali.Animation(2.0);
- var animOptions = { alpha:"easeInOutSine", delay:0.5, duration:1.5 };
+ var animOptions = { alpha:dali.ALPHA_FUNCTION_EASE_IN_OUT_SINE, delay:0.5, duration:1.5 };
var forward = new dali.Vector3(1,0,0);
animation.animate( imageView, myPath, forward, animOptions );
--- /dev/null
+/**
+ *
+## ScrollView API
+
+ScrollView is a container where the actors inside it can be scrolled manually
+(via touch or pan gesture) or automatically.
+
+By default, ScrollView can scroll to any position both horizontally and
+vertically and no snapping is enabled.
+
+Scroll mode can be specified to define how ScrollView should handle scrolling
+in X and Y axes respectively (i.e. whether scrolling is enabled horizontally
+or vertically, how scrolling is snapped, and the boundary to prevent ScrollView
+to scroll beyond a certain position in the axes).
+
+![ ](../assets/img/scroll-view/scroll-view.png)
+
+### Example of creating a ScrollView
+
+```
+ // Create a scroll view
+ var scrollView = new dali.Control("ScrollView");
+ var stageSize = dali.stage.getSize();
+ scrollView.size = [stageSize.x, stageSize.y, 0.0];
+ scrollView.parentOrigin = dali.CENTER;
+ scrollView.anchorPoint = dali.CENTER;
+
+ dali.stage.add( scrollView );
+
+ // Add actors to a scroll view with 3 pages
+ var pageRows = 1;
+ var pageColumns = 3;
+ for(var pageRow = 0; pageRow < pageRows; pageRow++)
+ {
+ for(var pageColumn = 0; pageColumn < pageColumns; pageColumn++)
+ {
+ var pageActor = new dali.Control();
+ pageActor.widthResizePolicy = "FILL_TO_PARENT";
+ pageActor.heightResizePolicy = "FILL_TO_PARENT";
+ pageActor.parentOrigin = dali.CENTER;
+ pageActor.anchorPoint = dali.CENTER;
+ pageActor.position = [pageColumn * stageSize.x, pageRow * stageSize.y, 0.0];
+ pageActor.name = "pageActor" + pageColumn;
+
+ // Add images in a 3x4 grid layout for each page
+ var imageRows = 4;
+ var imageColumns = 3;
+ var margin = 10.0;
+ var imageSize = [(stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0];
+
+ for(var row = 0; row < imageRows; row++)
+ {
+ for(var column = 0; column < imageColumns;column++)
+ {
+ var imageView = new dali.Control("ImageView");
+ var imageId = row * imageColumns + column;
+ imageView.image = "./image-" + imageId + ".jpg";
+ imageView.parentOrigin = dali.CENTER;
+ imageView.anchorPoint = dali.CENTER;
+ imageView.size = imageSize;
+ imageView.position = [ margin * 0.5 + (imageSize[0] + margin) * column - stageSize.x * 0.5 + imageSize[0] * 0.5,
+ margin * 0.5 + (imageSize[1] + margin) * row - stageSize.y * 0.5 + imageSize[1] * 0.5,
+ 0.0 ];
+ pageActor.add(imageView);
+ var position = imageView.position;
+ }
+ }
+
+ scrollView.add( pageActor );
+ }
+ }
+
+ // Set scroll view to have 3 pages in X axis and allow page snapping,
+ // and also disable scrolling in Y axis.
+ var scrollMode = {
+ xAxisScrollEnabled : true,
+ xAxisSnapToInterval : stageSize.x, // Define the snap points
+ xAxisScrollBoundary : stageSize.x * pageColumns, // i.e. Define 3 pages
+ yAxisScrollEnabled : false
+ }
+
+ scrollView.setScrollMode(scrollMode);
+
+```
+
+ @class ScrollView
+ @extends Actor
+
+*/
$(v8_plugin_dir)/controls/control-wrapper.cpp \
$(v8_plugin_dir)/controls/item-factory-wrapper.cpp \
$(v8_plugin_dir)/controls/item-view-api.cpp \
+ $(v8_plugin_dir)/controls/scroll-view-api.cpp \
$(v8_plugin_dir)/constants/constants-wrapper.cpp \
$(v8_plugin_dir)/animation/animation-api.cpp \
$(v8_plugin_dir)/animation/animation-wrapper.cpp \
}
/**
+ * Return the value of negotiated dimension for the given dimension
+ *
+ * @for Actor
+ * @method getRelayoutSize
+ * @param {Integer} dimension The dimension of layout to retrieve (either dali.DIMENSION_WIDTH or dali.DIMENSION_HEIGHT)
+ * @return {Number} The value of the negotiated dimension
+ */
+void ActorApi::GetRelayoutSize( const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+ Actor actor = GetActor( isolate, args );
+
+ bool found;
+ int dimension = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "missing dimension parameter");
+ return;
+ }
+
+ args.GetReturnValue().Set( v8::Number::New( isolate, actor.GetRelayoutSize( static_cast<Dimension::Type>(dimension) ) ) );
+}
+
+/**
* Calculate the width of the actor given a height
*
* The natural size is used for default calculation.
void SetKeyboardFocusable( const v8::FunctionCallbackInfo< v8::Value >& args );
void IsKeyboardFocusable( const v8::FunctionCallbackInfo< v8::Value >& args );
void GetNaturalSize( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void GetRelayoutSize( const v8::FunctionCallbackInfo< v8::Value >& args );
void GetWidthForHeight( const v8::FunctionCallbackInfo<v8::Value>& args );
void GetHeightForWidth( const v8::FunctionCallbackInfo<v8::Value>& args );
void TranslateBy( const v8::FunctionCallbackInfo< v8::Value >& args );
// ignore. SetSize() use Actor.size
// ignore. GetCurrentSize() use Actor.size
{ "GetNaturalSize", ActorApi::GetNaturalSize, ACTOR_API },
+ { "GetRelayoutSize", ActorApi::GetRelayoutSize, ACTOR_API },
{ "GetWidthForHeight",ActorApi::GetWidthForHeight, ACTOR_API },
{ "GetHeightForWidth",ActorApi::GetHeightForWidth, ACTOR_API },
// ignore. SetPosition(....) use Actor.position
#include "path-wrapper.h"
// EXTERNAL INCLUDES
-#include <cstring> // for strcmp
#include <dali/integration-api/debug.h>
namespace // un named namespace
{
-// @todo think about alternative ways of passing around
-struct AlphaFuncStruct
-{
- const char* const name;
- AlphaFunction alphaFunc;
-};
-/**
- * Contains a list of alpha functions that can be used.
- */
-const AlphaFuncStruct AlphaFunctionTable[]=
-{
-
- {"default" , AlphaFunction::DEFAULT },
- {"linear" , AlphaFunction::LINEAR },
- {"reverse" , AlphaFunction::REVERSE },
-
- {"easeInSquare" , AlphaFunction::EASE_IN_SQUARE },
- {"easeOutSquare" , AlphaFunction::EASE_OUT_SQUARE },
-
- {"easeIn" , AlphaFunction::EASE_IN },
- {"easeOut" , AlphaFunction::EASE_OUT },
- {"easeInOut" , AlphaFunction::EASE_IN_OUT },
-
- {"easeInSine" , AlphaFunction::EASE_IN_SINE },
- {"easeOutSine" , AlphaFunction::EASE_OUT_SINE },
- {"easeInOutSine" , AlphaFunction::EASE_IN_OUT_SINE },
-
- {"bounce" , AlphaFunction::BOUNCE },
- {"sin" , AlphaFunction::SIN },
- {"easeOutBack" , AlphaFunction::EASE_OUT_BACK },
-
-};
-const unsigned int AlphaFunctionTableCount = sizeof(AlphaFunctionTable)/sizeof(AlphaFunctionTable[0]);
-const char* const DEFAULT_ALPHA_NAME = "default";
-static AlphaFunction DEFAULT_ALPHA_FUNCTION = AlphaFunction::DEFAULT;
-
-
-
-AlphaFunction GetAlphaFunction( const std::string& alphaFuncName )
-{
- // This will normally get called just a few times during the application, so no point in doing anything clever
- for( unsigned int i = 0; i < AlphaFunctionTableCount; i++)
- {
- const AlphaFuncStruct& alphaStruct( AlphaFunctionTable[i] );
-
- if( std::strcmp( alphaStruct.name , alphaFuncName.c_str() ) == 0 )
- {
- return alphaStruct.alphaFunc;
- }
- }
-
- DALI_LOG_ERROR("Failed to find alpha func |%s| \n", alphaFuncName.c_str() );
- return DEFAULT_ALPHA_FUNCTION;
-}
-
-const char* const GetAlphaFunctionName( AlphaFunction alphaFunc )
-{
- // This may get called 3 times during the application, so no point
- // in doing anything clever
-
- for( unsigned int i = 0; i < AlphaFunctionTableCount; i++)
- {
- const AlphaFuncStruct& alphaStruct( AlphaFunctionTable[i] );
-
-
- if( alphaStruct.alphaFunc.GetBuiltinFunction() == alphaFunc.GetBuiltinFunction() )
- {
- return alphaStruct.name;
- }
- }
- return "default";
-}
-
-
struct AnimationParameters
{
AnimationParameters( const Animation& anim)
: propertyIndex( Property::INVALID_INDEX ),
- alphaFunction( DEFAULT_ALPHA_FUNCTION),
+ alphaFunction( AlphaFunction::DEFAULT),
delay( 0.f ),
duration(anim.GetDuration()),
optionsFound( false )
{
v8::Local<v8::Object> obj = options->ToObject();
v8::Local<v8::Value> alphaValue = obj->Get( v8::String::NewFromUtf8( isolate, "alpha" ) );
- if( alphaValue->IsString() )
+ if( alphaValue->IsUint32() )
{
animParams.optionsFound = true;
- std::string alphaName = V8Utils::v8StringToStdString( alphaValue );
- animParams.alphaFunction = GetAlphaFunction( alphaName );
+ animParams.alphaFunction = static_cast<AlphaFunction::BuiltinFunction>(alphaValue->ToUint32()->Value());
}
v8::Local<v8::Value> delayValue = obj->Get( v8::String::NewFromUtf8( isolate, "delay" ) );
// get keyframe.alpha
v8::Handle<v8::Value> alphaValue = keyFrameObject->Get(v8::String::NewFromUtf8( isolate, "alpha"));
- if( alphaValue->IsString() )
+ if( alphaValue->IsUint32() )
{
- std::string alphaName = V8Utils::v8StringToStdString( alphaValue );
- AlphaFunction alphaFunction = GetAlphaFunction( alphaName );
+ AlphaFunction alphaFunction = static_cast<AlphaFunction::BuiltinFunction>(alphaValue->ToUint32()->Value());
keyframes.Add( progress->NumberValue(), value, alphaFunction );
}
else
* Set the default alpha function for an animation.
* @method setDefaultAlphaFunction
* @for Animation
- * @param {string} alpha function
+ * @param {Integer} alpha function
*/
void AnimationApi::SetDefaultAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args )
{
Animation anim = GetAnimation( isolate, args );
bool found( false );
- std::string alphaFunc = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
+ int alphaFunc = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
if( !found )
{
DALI_SCRIPT_EXCEPTION( isolate, "bad parameter" );
}
else
{
- AlphaFunction func = GetAlphaFunction( alphaFunc );
+ AlphaFunction func = static_cast<AlphaFunction::BuiltinFunction>(alphaFunc);
anim.SetDefaultAlphaFunction( func );
}
-
}
/**
* Get the default alpha function for an animation.
* @method getDefaultAlphaFunction
* @for Animation
- * @return {string} alpha function
+ * @return {Integer} alpha function
*/
void AnimationApi::GetDefaultAlphaFunction( const v8::FunctionCallbackInfo<v8::Value>& args )
{
Animation anim = GetAnimation( isolate, args );
- std::string alphaName = GetAlphaFunctionName( anim.GetDefaultAlphaFunction() );
+ AlphaFunction alphaFunc = anim.GetDefaultAlphaFunction();
- args.GetReturnValue().Set( v8::String::NewFromUtf8( isolate, alphaName.c_str() ) );
+ args.GetReturnValue().Set( v8::Integer::New( isolate, alphaFunc.GetBuiltinFunction() ) );
}
/**
targetPropertyIndex = targetActor.GetPropertyIndex( propertyName );
if( targetPropertyIndex == Property::INVALID_INDEX )
{
- targetPropertyIndex = targetActor.GetPropertyIndex( propertyName );
-
- if( targetPropertyIndex == Property::INVALID_INDEX )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "Target property not found" );
- return false;
- }
+ DALI_SCRIPT_EXCEPTION( isolate, "Target property not found" );
+ return false;
}
}
else
sourcePropertyIndex = targetActor.GetPropertyIndex( propertyName );
if( sourcePropertyIndex == Property::INVALID_INDEX )
{
- sourcePropertyIndex = targetActor.GetPropertyIndex( propertyName );
-
- if( sourcePropertyIndex == Property::INVALID_INDEX )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "Source property not found" );
- return false;
+ DALI_SCRIPT_EXCEPTION( isolate, "Source property not found" );
+ return false;
}
- }
}
else
{
#include <dali/devel-api/rendering/material.h>
#include <dali/devel-api/rendering/geometry.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 Dali
{
{ "PROPERTY_READ_WRITE", Property::READ_WRITE },
{ "PROPERTY_ANIMATABLE", Property::ANIMATABLE },
+ { "DIMENSION_WIDTH", Dimension::WIDTH },
+ { "DIMENSION_HEIGHT", Dimension::HEIGHT },
+
{ "ITEM_LAYOUT_LIST", Toolkit::DefaultItemLayout::LIST },
{ "ITEM_LAYOUT_GRID", Toolkit::DefaultItemLayout::GRID },
+ { "DIRECTION_BIAS_NONE", Toolkit::DirectionBiasNone },
+ { "DIRECTION_BIAS_LEFT", Toolkit::DirectionBiasLeft },
+ { "DIRECTION_BIAS_RIGHT", Toolkit::DirectionBiasRight },
+
+ { "ALPHA_FUNCTION_DEFAULT", AlphaFunction::DEFAULT },
+ { "ALPHA_FUNCTION_LINEAR", AlphaFunction::LINEAR },
+ { "ALPHA_FUNCTION_REVERSE", AlphaFunction::REVERSE },
+ { "ALPHA_FUNCTION_EASE_IN_SQUARE", AlphaFunction::EASE_IN_SQUARE },
+ { "ALPHA_FUNCTION_EASE_OUT_SQUARE", AlphaFunction::EASE_OUT_SQUARE },
+ { "ALPHA_FUNCTION_EASE_IN", AlphaFunction::EASE_IN },
+ { "ALPHA_FUNCTION_EASE_OUT", AlphaFunction::EASE_OUT },
+ { "ALPHA_FUNCTION_EASE_IN_OUT", AlphaFunction::EASE_IN_OUT },
+ { "ALPHA_FUNCTION_EASE_IN_SINE", AlphaFunction::EASE_IN_SINE },
+ { "ALPHA_FUNCTION_EASE_OUT_SINE", AlphaFunction::EASE_OUT_SINE },
+ { "ALPHA_FUNCTION_EASE_IN_OUT_SINE", AlphaFunction::EASE_IN_OUT_SINE },
+ { "ALPHA_FUNCTION_BOUNCE", AlphaFunction::BOUNCE },
+ { "ALPHA_FUNCTION_SIN", AlphaFunction::SIN },
+ { "ALPHA_FUNCTION_EASE_OUT_BACK", AlphaFunction::EASE_OUT_BACK },
+
};
const unsigned int EnumTableCount = sizeof(EnumTable)/sizeof(EnumTable[0]);
// INTERNAL INCLUDES
#include <controls/item-view-api.h>
+#include <controls/scroll-view-api.h>
#include <v8-utils.h>
#include <dali-wrapper.h>
v8::Persistent<v8::ObjectTemplate> ControlWrapper::mControlTemplate;
v8::Persistent<v8::ObjectTemplate> ControlWrapper::mItemViewTemplate;
+v8::Persistent<v8::ObjectTemplate> ControlWrapper::mScrollViewTemplate;
Vector< void* > ControlWrapper::mControlGarbageContainer;
const ControlTemplate ControlTemplateLookup[]=
{
{ &ControlWrapper::mControlTemplate }, // CONTROL
- { &ControlWrapper::mItemViewTemplate } // ITEMVIEW
+ { &ControlWrapper::mItemViewTemplate }, // ITEMVIEW
+ { &ControlWrapper::mScrollViewTemplate } // SCROLLVIEW
};
/**
enum ControlApiBitMask
{
CONTROL_API = 1 << 0,
- ITEMVIEW_API = 1 << 1
+ ITEMVIEW_API = 1 << 1,
+ SCROLLVIEW_API = 1 << 2
};
/**
{
{"Control", ControlWrapper::CONTROL, NULL, CONTROL_API },
{"ItemView", ControlWrapper::ITEMVIEW, ItemViewApi::New, CONTROL_API | ITEMVIEW_API },
+ {"ScrollView", ControlWrapper::SCROLLVIEW, ScrollViewApi::New, CONTROL_API | SCROLLVIEW_API }
};
const unsigned int ControlApiLookupCount = sizeof(ControlApiLookup)/sizeof(ControlApiLookup[0]);
{ "GetItemId", ItemViewApi::GetItemId, ITEMVIEW_API },
{ "GetItemsRange", ItemViewApi::GetItemsRange, ITEMVIEW_API },
+ /**************************************
+ * ScrollView API
+ **************************************/
+ { "SetScrollMode", ScrollViewApi::SetScrollMode, SCROLLVIEW_API },
+ { "GetCurrentPage", ScrollViewApi::GetCurrentPage, SCROLLVIEW_API },
+ { "ScrollToPosition", ScrollViewApi::ScrollToPosition, SCROLLVIEW_API },
+ { "ScrollToPage", ScrollViewApi::ScrollToPage, SCROLLVIEW_API },
+ { "ScrollToActor", ScrollViewApi::ScrollToActor, SCROLLVIEW_API },
+ { "ScrollToSnapInterval", ScrollViewApi::ScrollToSnapInterval, SCROLLVIEW_API },
+ { "SetScrollFlickAlphaFunction", ScrollViewApi::SetScrollFlickAlphaFunction, SCROLLVIEW_API },
+ { "SetScrollSnapAlphaFunction", ScrollViewApi::SetScrollSnapAlphaFunction, SCROLLVIEW_API },
+ { "SetSnapOvershootAlphaFunction", ScrollViewApi::SetSnapOvershootAlphaFunction, SCROLLVIEW_API },
+
};
const unsigned int ControlFunctionTableCount = sizeof(ControlFunctionTable)/sizeof(ControlFunctionTable[0]);
{
UNKNOWN_CONTROL = -1,
CONTROL = 0,
- ITEMVIEW = 1
+ ITEMVIEW = 1,
+ SCROLLVIEW = 2
};
/**
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "scroll-view-api.h"
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <v8-utils.h>
+#include <actors/actor-wrapper.h>
+#include <controls/control-wrapper.h>
+
+namespace Dali
+{
+
+namespace V8Plugin
+{
+
+namespace // unanmed namespace
+{
+
+Toolkit::ScrollView GetScrollView( v8::Isolate* isolate, const v8::FunctionCallbackInfo<v8::Value>& args )
+{
+ HandleWrapper* handleWrapper = HandleWrapper::Unwrap( isolate, args.This() );
+ return Toolkit::ScrollView::DownCast( handleWrapper->mHandle );
+}
+
+} //unanmed namespace
+
+/***************************************
+ * SCROLLVIEW API FUNCTIONS
+ ***************************************/
+
+/**
+ * Constructor
+ *
+ * @for ScrollView
+ * @constructor
+ * @method ScrollView
+ * @return {Object} scrollView
+ */
+Toolkit::Control ScrollViewApi::New( const v8::FunctionCallbackInfo< v8::Value >& args )
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = Toolkit::ScrollView::New();
+ return scrollView;
+}
+
+/**
+ * Set the scroll mode of ScrollView.
+ *
+ * This defines whether scrolling is enabled horizontally or vertically, how
+ * scrolling is snapped, and the boundary in which the scroll view can pan.
+ *
+ * When no specific scroll mode is set, scroll view can scroll to any position
+ * both horizontally and vertically and no snapping is enabled.
+ *
+ * Example of setting the scroll boundary of scroll view in the X axis to
+ * three pages (page size equals to the width of scroll view) and allowing
+ * snapping between pages, and disabling scrolling in the Y axis.
+ *
+ * ```
+ * var scrollMode = {
+ * xAxisScrollEnabled : true,
+ * xAxisSnapToInterval : scrollView.sizeWidth,
+ * xAxisScrollBoundary : scrollView.sizeWidth * 3,
+ * yAxisScrollEnabled : false
+ * }
+ *
+ * scrollView.setScrollMode(scrollMode);
+ * ```
+ *
+ * @for ScrollView
+ * @method setScrollMode
+ * @param {Object} scrollMode
+ * @param {Boolean} scrollMode.xAxisScrollEnabled True if the content can be scrolled in X axis or false if not.
+ * @param {Float} [scrollMode.xAxisSnapToInterval] When set, causes scroll view to snap to multiples of the value of the interval in the X axis while flicking. (by default no snapping)
+ * @param {Float} [scrollMode.xAxisScrollBoundary] When set, causes scroll view unable to scroll beyond the value of the boundary in the X axis (by default no boundary)
+ * @param {Boolean} scrollMode.yAxisScrollEnabled True if the content can be scrolled in Y axis or false if not.
+ * @param {Float} [scrollMode.yAxisSnapToInterval] When set, causes scroll view to snap to multiples of the value of the interval in the Y axis while flicking. (by default no snapping)
+ * @param {Float} [scrollMode.yAxisScrollBoundary] When set, causes scroll view unable to scroll beyond the value of the boundary in the Y axis (by default no boundary)
+ */
+void ScrollViewApi::SetScrollMode( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ v8::Local<v8::Value> scrollMode( args[0] );
+ if( !scrollMode->IsObject() )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid scroll mode parameter" );
+ return;
+ }
+
+ v8::Local<v8::Object> scrollModeObj = scrollMode->ToObject();
+
+ Toolkit::RulerPtr rulerX, rulerY;
+
+ // Check the scroll mode in the X axis
+ bool xAxisScrollEnabled = true;
+ v8::Local<v8::Value> xAxisScrollEnabledValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "xAxisScrollEnabled" ) );
+ if( xAxisScrollEnabledValue->IsBoolean() )
+ {
+ xAxisScrollEnabled = xAxisScrollEnabledValue->ToBoolean()->Value();
+ }
+ else
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "Missing xAxisScrollEnabled");
+ return;
+ }
+
+ if(!xAxisScrollEnabled)
+ {
+ // Default ruler and disabled
+ rulerX = new Toolkit::DefaultRuler();
+ rulerX->Disable();
+ }
+ else
+ {
+ v8::Local<v8::Value> xAxisSnapToIntervalValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "xAxisSnapToInterval" ) );
+ if( xAxisSnapToIntervalValue->IsNumber() )
+ {
+ // Fixed ruler and enabled
+ float xAxisSnapToInterval = xAxisSnapToIntervalValue->ToNumber()->Value();
+ rulerX = new Toolkit::FixedRuler(xAxisSnapToInterval);
+ }
+ else
+ {
+ // Default ruler and enabled
+ rulerX = new Toolkit::DefaultRuler();
+ }
+
+ v8::Local<v8::Value> xAxisScrollBoundaryValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "xAxisScrollBoundary" ) );
+ if( xAxisScrollBoundaryValue->IsNumber() )
+ {
+ // By default ruler domain is disabled unless set
+ float xAxisScrollBoundary = xAxisScrollBoundaryValue->ToNumber()->Value();
+ rulerX->SetDomain( Toolkit::RulerDomain( 0, xAxisScrollBoundary, true ) );
+ }
+ }
+
+ // Check the scroll mode in the Y axis
+ bool yAxisScrollEnabled = true;
+ v8::Local<v8::Value> yAxisScrollEnabledValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "yAxisScrollEnabled" ) );
+ if( yAxisScrollEnabledValue->IsBoolean() )
+ {
+ yAxisScrollEnabled = yAxisScrollEnabledValue->ToBoolean()->Value();
+ }
+ else
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "Missing yAxisScrollEnabled");
+ return;
+ }
+
+ if(!yAxisScrollEnabled)
+ {
+ // Default ruler and disabled
+ rulerY = new Toolkit::DefaultRuler();
+ rulerY->Disable();
+ }
+ else
+ {
+ v8::Local<v8::Value> yAxisSnapToIntervalValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "yAxisSnapToInterval" ) );
+ if( yAxisSnapToIntervalValue->IsNumber() )
+ {
+ // Fixed ruler and enabled
+ float yAxisSnapToInterval = yAxisSnapToIntervalValue->ToNumber()->Value();
+ rulerY = new Toolkit::FixedRuler(yAxisSnapToInterval);
+ }
+ else
+ {
+ // Default ruler and enabled
+ rulerY = new Toolkit::DefaultRuler();
+ }
+
+ v8::Local<v8::Value> yAxisScrollBoundaryValue= scrollModeObj->Get( v8::String::NewFromUtf8( isolate, "yAxisScrollBoundary" ) );
+ if( yAxisScrollBoundaryValue->IsNumber() )
+ {
+ // By default ruler domain is disabled unless set
+ float yAxisScrollBoundary = yAxisScrollBoundaryValue->ToNumber()->Value();
+ rulerY->SetDomain( Toolkit::RulerDomain( 0, yAxisScrollBoundary, true ) );
+ }
+ }
+
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+}
+
+/**
+ * Retrieves current scroll page based on the defined snap interval being the
+ * size of one page, and all pages laid out in a grid fashion, increasing from
+ * left to right until the end of the scroll boundary. Pages start from 0 as the
+ * first page.
+ *
+ * If no snap interval is defined, this API will return undefined value.
+ *
+ * @for ScrollView
+ * @method getCurrentPage
+ * @return {Integer} The index of current page in scroll view
+ */
+void ScrollViewApi::GetCurrentPage( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+ args.GetReturnValue().Set( v8::Integer::New( isolate, scrollView.GetCurrentPage() ) );
+}
+
+/**
+ * Scrolls the contents to the given position.
+ *
+ * Position 0,0 is the origin. Increasing X scrolls contents left, while
+ * increasing Y scrolls contents up. If Rulers have been applied to the axes,
+ * then the contents will scroll until reaching the scroll boundary.
+ * Contents will not snap.
+ *
+ * The biasing parameters are provided such that in scenarios with 2 or 2x2 pages
+ * in wrap mode, the application developer can decide whether to scroll left or
+ * right to get to the target page.
+ *
+ * @for ScrollView
+ * @method scrollToPosition
+ * @param {Array} position The position to scroll to.
+ * @param {Float} [durationSeconds] The duration of the scroll animation in seconds (default value is scrollView.scrollSnapDuration)
+ * @param {Integer} [alphaFunction] The alpha function to use.
+ * @param {Integer} [horizontalBias] Whether to bias scrolling to left or right (by default no bias).
+ * @param {Integer} [verticalBias] Whether to bias scrolling to top or bottom (by default no bias).
+ * @example
+ * // scroll direction bias is one of the following
+ * dali.DIRECTION_BIAS_NONE // Don't bias scroll snap
+ * dali.DIRECTION_BIAS_LEFT // Bias scroll snap to Left
+ * dali.DIRECTION_BIAS_RIGHT // Bias scroll snap to Right
+ *
+ * scrollView.scrollToPosition( [150.0, 100.0], 0.5, dali.ALPHA_FUNCTION_EASE_IN_OUT, dali.DIRECTION_BIAS_LEFT, dali.DIRECTION_BIAS_NONE );
+ */
+void ScrollViewApi::ScrollToPosition( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ Vector2 position = V8Utils::GetVector2Parameter( PARAMETER_0, found, isolate, args );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "bad position parameter" );
+ return;
+ }
+
+ float durationSeconds = V8Utils::GetFloatParameter( PARAMETER_1, found, isolate, args, scrollView.GetScrollSnapDuration() );
+
+ AlphaFunction alphaFunction = scrollView.GetScrollSnapAlphaFunction();
+
+ found = false;
+ int alpha = V8Utils::GetIntegerParameter( PARAMETER_2, found, isolate, args, 0 );
+ if(found)
+ {
+ alphaFunction = static_cast<AlphaFunction::BuiltinFunction>(alpha);
+ }
+
+ Toolkit::DirectionBias horizontalBias = static_cast<Toolkit::DirectionBias>( V8Utils::GetIntegerParameter( PARAMETER_3, found, isolate, args, Toolkit::DirectionBiasNone ) );
+ Toolkit::DirectionBias verticalBias = static_cast<Toolkit::DirectionBias>( V8Utils::GetIntegerParameter( PARAMETER_4, found, isolate, args, Toolkit::DirectionBiasNone ) );
+
+ scrollView.ScrollTo( position, durationSeconds, alphaFunction, horizontalBias, verticalBias );
+}
+
+/**
+ * Scrolls the contents to the page with the given index.
+ *
+ * This is based on assumption that the page index starts from 0 and the
+ * position of each page is: [pageIndex * snapToInterval, 0].
+ *
+ * If no snap interval is defined, calling this API will cause unexpected
+ * behaviour.
+ *
+ * The biasing parameter is provided such that in scenarios with 2 pages
+ * in wrap mode, the application developer can decide whether to scroll
+ * left or right to get to the target page.
+ *
+ * @for ScrollView
+ * @method scrollToPage
+ * @param {Integer} pageIndex The index of the page to scroll to.
+ * @param {Float} [durationSeconds] The duration of the scroll animation in seconds (default value is scrollView.scrollSnapDuration)
+ * @param {Integer} [bias] Whether to bias scrolling to left or right (by default no bias).
+ * @example
+ * // scroll direction bias is one of the following
+ * dali.DIRECTION_BIAS_NONE // Don't bias scroll snap
+ * dali.DIRECTION_BIAS_LEFT // Bias scroll snap to Left
+ * dali.DIRECTION_BIAS_RIGHT // Bias scroll snap to Right
+ *
+ * scrollView.scrollToPage( 1, 0.5, dali.DIRECTION_BIAS_RIGHT );
+ */
+void ScrollViewApi::ScrollToPage( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ int pageIndex = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "bad page index parameter" );
+ return;
+ }
+
+ float durationSeconds = V8Utils::GetFloatParameter( PARAMETER_1, found, isolate, args, scrollView.GetScrollSnapDuration() );
+ Toolkit::DirectionBias bias = static_cast<Toolkit::DirectionBias>( V8Utils::GetIntegerParameter( PARAMETER_2, found, isolate, args, Toolkit::DirectionBiasNone ) );
+
+ scrollView.ScrollTo( pageIndex, durationSeconds, bias );
+}
+
+/**
+ * Scrolls the contents such that the given actor appears in the center of
+ * the scroll view.
+ *
+ * The actor must be a direct child of scroll view.
+ *
+ * @for ScrollView
+ * @method scrollToActor
+ * @param {Object} actor The actor to scroll to.
+ * @param {Float} [durationSeconds] The duration of the scroll animation in seconds (default value is scrollView.scrollSnapDuration)
+ * @example
+ * scrollView.scrollToActor( childActor, 0.5 );
+ */
+void ScrollViewApi::ScrollToActor( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ Actor actor = V8Utils::GetActorParameter( 0, found, isolate, args );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid actor parameter" );
+ return;
+ }
+
+ float durationSeconds = V8Utils::GetFloatParameter( PARAMETER_1, found, isolate, args, scrollView.GetScrollSnapDuration() );
+
+ scrollView.ScrollTo( actor, durationSeconds );
+}
+
+/**
+ * Scrolls the content to the nearest snap point as specified by the snap interval.
+ * If already at snap points, it will not scroll.
+ *
+ * @for ScrollView
+ * @method scrollToSnapInterval
+ * @return {Boolean} True if snapping is needed or false if already at snap points
+ * @example
+ * var success = scrollView.scrollToSnapInterval();
+ */
+void ScrollViewApi::ScrollToSnapInterval( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ args.GetReturnValue().Set( v8::Boolean::New( isolate, scrollView.ScrollToSnapPoint() ) );
+}
+
+/**
+ * Set the alpha function of flick animation.
+ *
+ * @for ScrollView
+ * @method setScrollFlickAlphaFunction
+ * @param {Integer} alphaFunction The alpha function to use.
+ * @example
+ * scrollView.setScrollFlickAlphaFunction( dali.ALPHA_FUNCTION_EASE_IN_OUT );
+ */
+void ScrollViewApi::SetScrollFlickAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ int alphaFunction = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid alpha function parameter" );
+ return;
+ }
+ else
+ {
+ scrollView.SetScrollFlickAlphaFunction( static_cast<AlphaFunction::BuiltinFunction>(alphaFunction) );
+ }
+}
+
+/**
+ * Set the alpha function of snap animation.
+ *
+ * @for ScrollView
+ * @method setScrollSnapAlphaFunction
+ * @param {String} alphaFunction The alpha function to use.
+ * @example
+ * scrollView.setScrollSnapAlphaFunction( dali.ALPHA_FUNCTION_EASE_IN_OUT );
+ */
+void ScrollViewApi::SetScrollSnapAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ int alphaFunction = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid alpha function parameter" );
+ return;
+ }
+ else
+ {
+ scrollView.SetScrollSnapAlphaFunction( static_cast<AlphaFunction::BuiltinFunction>(alphaFunction) );
+ }
+}
+
+/**
+ * Set the alpha function of overshoot snap animation.
+ *
+ * @for ScrollView
+ * @method setSnapOvershootAlphaFunction
+ * @param {String} alphaFunction The alpha function to use.
+ * @example
+ * scrollView.setSnapOvershootAlphaFunction( dali.ALPHA_FUNCTION_EASE_IN_OUT );
+ */
+void ScrollViewApi::SetSnapOvershootAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args)
+{
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::HandleScope handleScope( isolate );
+
+ Toolkit::ScrollView scrollView = GetScrollView( isolate, args );
+
+ bool found( false );
+ int alphaFunction = V8Utils::GetIntegerParameter( PARAMETER_0, found, isolate, args, 0 );
+ if( !found )
+ {
+ DALI_SCRIPT_EXCEPTION( isolate, "invalid alpha function parameter" );
+ return;
+ }
+ else
+ {
+ scrollView.SetSnapOvershootAlphaFunction( static_cast<AlphaFunction::BuiltinFunction>(alphaFunction) );
+ }
+}
+
+} // namespace V8Plugin
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_V8PLUGIN_SCROLL_VIEW_API_H__
+#define __DALI_V8PLUGIN_SCROLL_VIEW_API_H__
+
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <v8.h>
+#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
+
+namespace Dali
+{
+
+namespace V8Plugin
+{
+
+namespace ScrollViewApi
+{
+
+ /**
+ * constructor
+ */
+ Toolkit::Control New( const v8::FunctionCallbackInfo< v8::Value >& args );
+
+ /**
+ * ScrollView API. See scroll-view.h for description of functions
+ */
+ void SetScrollMode( const v8::FunctionCallbackInfo< v8::Value >& args);
+ void GetCurrentPage( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void ScrollToPosition( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void ScrollToPage( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void ScrollToActor( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void ScrollToSnapInterval( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void SetScrollFlickAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void SetScrollSnapAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void SetSnapOvershootAlphaFunction( const v8::FunctionCallbackInfo< v8::Value >& args );
+
+}; // namespace ScrollViewApi
+
+} // namespace V8Plugin
+
+} // namespace Dali
+
+#endif // header __DALI_V8PLUGIN_SCROLL_VIEW_API_H__
ACTOR_PROPERTY,
ITEMVIEW,
ITEMFACTORY,
+ SCROLLVIEW,
RENDER_TASK,
RENDER_TASK_LIST,
TIMER,