utc-Dali-JsonParser.cpp
utc-Dali-KeyInputFocusManager.cpp
utc-Dali-NavigationControl.cpp
- utc-Dali-NavigationLayout.cpp
utc-Dali-OverlayEffect.cpp
utc-Dali-Page.cpp
utc-Dali-PageTurnEffect.cpp
utc-Dali-PageTurnView.cpp
- utc-Dali-RollLayout.cpp
utc-Dali-ScrollView.cpp
utc-Dali-ShadowView.cpp
utc-Dali-ShearEffect.cpp
waveEffect.SetTargetImage( imageActor );
waveEffect.StartTransition(true);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
waveEffect.SetTargetImage( imageActor );
waveEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
waveEffect.SetTargetImage( imageActor );
waveEffect.StartTransition(false);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
waveEffect.SetTargetImage( imageActor );
waveEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
END_TEST;
crossEffect.SetTargetImage( imageActor );
crossEffect.StartTransition(true);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
crossEffect.SetTargetImage( imageActor );
crossEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
crossEffect.SetTargetImage( imageActor );
crossEffect.StartTransition(false);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
crossEffect.SetTargetImage( imageActor );
crossEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
END_TEST;
foldEffect.SetTargetImage( imageActor );
foldEffect.StartTransition(true);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
foldEffect.SetTargetImage( imageActor );
foldEffect.StartTransition(PAN_POSITION1, PAN_DISPLACEMENT1);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
foldEffect.SetTargetImage( imageActor );
foldEffect.StartTransition(false);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(),fullBrightness, FLT_EPISILON, TEST_LOCATION );
foldEffect.SetTargetImage( imageActor );
foldEffect.StartTransition(PAN_POSITION2, PAN_DISPLACEMENT2);
Wait( application, TRANSITION_DURATION );
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
END_TEST;
waveEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
waveEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
waveEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
waveEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
END_TEST;
crossEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
crossEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
crossEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
crossEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::XAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
END_TEST;
foldEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
foldEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 2.f*Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
foldEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( -Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( Math::PI_2, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
foldEffect.StopTransition();
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( cube1.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
- DALI_TEST_EQUALS( cube0.GetCurrentRotation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube1.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
+ DALI_TEST_EQUALS( cube0.GetCurrentOrientation(), Quaternion( 0.f, Vector3::YAXIS), FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(0).GetCurrentColor(), fullBrightness, FLT_EPISILON, TEST_LOCATION );
DALI_TEST_EQUALS( cube0.GetChildAt(1).GetCurrentColor(), halfBrightness, FLT_EPISILON, TEST_LOCATION );
END_TEST;
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <float.h> // for FLT_MAX
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-namespace
-{
-const unsigned int TOTAL_ITEM_NUMBER = 200;
-
-
-// Implementation of ItemFactory for providing actors to ItemView
-class TestItemFactory : public ItemFactory
-{
-public:
-
- /**
- * Constructor
- * @param application class, stored as reference
- */
- TestItemFactory()
- {
- }
-
-public: // From ItemFactory
-
- /**
- * Query the number of items available from the factory.
- * The maximum available item has an ID of GetNumberOfItems() - 1.
- */
- virtual unsigned int GetNumberOfItems()
- {
- return TOTAL_ITEM_NUMBER;
- }
-
- /**
- * Create an Actor to represent a visible item.
- * @param itemId
- * @return the created actor.
- */
- virtual Actor NewItem(unsigned int itemId)
- {
- // Create an test actor for this item
- ImageActor actor = CreateSolidColorActor(Color::RED);
- actor.SetSize(64.0f, 64.0f);
-
- return actor;
- }
-};
-} // namespace
-
-
-// Positive test case for a method
-int UtcDaliNavigationLayoutNew(void)
-{
- ToolkitTestApplication application;
-
- // Create a navigation layout
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- navigationLayout->SetNumberOfColumns(6);
- DALI_TEST_CHECK(navigationLayout);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutColumns(void)
-{
- ToolkitTestApplication application;
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
-
- navigationLayout->SetNumberOfColumns(6);
- // Check whether we get the correct number of columns
- DALI_TEST_CHECK(navigationLayout->GetNumberOfColumns() == 6);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutSetGetOrientation(void)
-{
- ToolkitTestApplication application;
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
-
- navigationLayout->SetNumberOfColumns(6);
- navigationLayout->SetOrientation(ControlOrientation::Right);
- DALI_TEST_CHECK(navigationLayout->GetOrientation() == ControlOrientation::Right);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutTestConstraintLeft(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- navigationLayout->SetNumberOfColumns(6);
-
- view.SetName("view actor");
- view.AddLayout(*navigationLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- navigationLayout->SetOrientation(ControlOrientation::Left);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- // Confirm: we have actors in the view and all of them is positioned at X = 0
- // and the series is monotonely decreasing.
- int nonZeroXCount = 0;
- int elementsFound = 0;
- int wrongDirectionCount = 0;
- float prevY = FLT_MAX;
- for(unsigned int i = 0; i < 10; i++)
- {
- Actor testActor = view.GetItem(i);
- if (testActor)
- {
- elementsFound++;
- Vector3 pos = testActor.GetCurrentPosition();
-
- if (pos.x != 0.0f)
- {
- nonZeroXCount++;
- }
-
- if (pos.y >= prevY)
- {
- wrongDirectionCount++;
- }
-
- prevY = pos.y;
- }
- }
-
- DALI_TEST_CHECK((elementsFound > 0) && (nonZeroXCount == 0) && (wrongDirectionCount == 0));
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutTestConstraintRight(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- navigationLayout->SetNumberOfColumns(6);
-
- view.SetName("view actor");
- view.AddLayout(*navigationLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- navigationLayout->SetOrientation(ControlOrientation::Right);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- // Confirm: we have actors in the view and all of them is positioned at X = 0
- // and the series is monotonely increasing.
- int nonZeroXCount = 0;
- int elementsFound = 0;
- int wrongDirectionCount = 0;
- float prevY = -FLT_MAX;
- for(unsigned int i = 0; i < 10; i++)
- {
- Actor testActor = view.GetItem(i);
- if (testActor)
- {
- elementsFound++;
- Vector3 pos = testActor.GetCurrentPosition();
-
- if (pos.x != 0.0f)
- {
- nonZeroXCount++;
- }
-
- if (pos.y <= prevY)
- {
- wrongDirectionCount++;
- }
-
- prevY = pos.y;
- }
- }
-
- DALI_TEST_CHECK((elementsFound > 0) && (nonZeroXCount == 0) && (wrongDirectionCount == 0));
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutTestConstraintUp(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- navigationLayout->SetNumberOfColumns(6);
-
- view.SetName("view actor");
- view.AddLayout(*navigationLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- navigationLayout->SetOrientation(ControlOrientation::Up);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- // Confirm: we have actors in the view and all of them is positioned at X = 0
- // and the series is monotonely decreasing.
- int nonZeroYCount = 0;
- int elementsFound = 0;
- int wrongDirectionCount = 0;
- float prevX = -FLT_MAX;
- for(unsigned int i = 0; i < 10; i++)
- {
- Actor testActor = view.GetItem(i);
- if (testActor)
- {
- elementsFound++;
- Vector3 pos = testActor.GetCurrentPosition();
-
- if (pos.y != 0.0f)
- {
- nonZeroYCount++;
- }
-
- if (pos.x <= prevX)
- {
- wrongDirectionCount++;
- }
-
- prevX = pos.x;
- }
- }
-
- DALI_TEST_CHECK((elementsFound > 0) && (nonZeroYCount == 0) && (wrongDirectionCount == 0));
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutTestConstraintDown(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- navigationLayout->SetNumberOfColumns(6);
-
- view.SetName("view actor");
- view.AddLayout(*navigationLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- navigationLayout->SetOrientation(ControlOrientation::Down);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- // Confirm: we have actors in the view and all of them is positioned at X = 0
- // and the series is monotonely decreasing.
- int nonZeroYCount = 0;
- int elementsFound = 0;
- int wrongDirectionCount = 0;
- float prevX = FLT_MAX;
- for(unsigned int i = 0; i < 10; i++)
- {
- Actor testActor = view.GetItem(i);
- if (testActor)
- {
- elementsFound++;
- Vector3 pos = testActor.GetCurrentPosition();
-
- if (pos.y != 0.0f)
- {
- nonZeroYCount++;
- }
-
- if (pos.x > prevX)
- {
- wrongDirectionCount++;
- }
-
- prevX = pos.x;
- }
- }
-
- DALI_TEST_CHECK((elementsFound > 0) && (nonZeroYCount == 0) && (wrongDirectionCount == 0));
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
-
-
-int UtcDaliNavigationLayoutScrollDirection(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- navigationLayout->SetNumberOfColumns(6);
-
- view.SetName("view actor");
- view.AddLayout(*navigationLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- navigationLayout->SetOrientation(ControlOrientation::Left);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- ItemLayoutPtr layout = navigationLayout;
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- navigationLayout->SetOrientation(ControlOrientation::Up);
- view.ActivateLayout(0, vec, 0.0f);
- application.SendNotification();
- application.Render();
-
- Degree deg = layout->GetScrollDirection();
- DALI_TEST_CHECK(deg == (180.0f - 45.0f));
-
- navigationLayout->SetOrientation(ControlOrientation::Down);
- view.ActivateLayout(0, vec, 0.0f);
- application.SendNotification();
- application.Render();
-
- deg = layout->GetScrollDirection();
- DALI_TEST_CHECK((deg == -45.0f));
-
- layout->SetOrientation(ControlOrientation::Left);
- view.ActivateLayout(0, vec, 0.0f);
- application.SendNotification();
- application.Render();
-
- deg = layout->GetScrollDirection();
- DALI_TEST_CHECK(deg == (270.0f - 45.0f));
-
- navigationLayout->SetOrientation(ControlOrientation::Right);
- view.ActivateLayout(0, vec, 0.0f);
- application.SendNotification();
- application.Render();
-
- deg = layout->GetScrollDirection();
- DALI_TEST_CHECK(deg == (90.0f - 45.0f));
-
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutSetGetColumnSpacing(void)
-{
- ToolkitTestApplication application;
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- const float testValue = 11.0f;
-
- navigationLayout->SetNumberOfColumns(6);
- navigationLayout->SetColumnSpacing(testValue);
- DALI_TEST_CHECK(navigationLayout->GetColumnSpacing() == testValue);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutSetGetTopMargin(void)
-{
- ToolkitTestApplication application;
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- const float testValue = 11.0f;
-
- navigationLayout->SetNumberOfColumns(6);
- navigationLayout->SetTopMargin(testValue);
- DALI_TEST_CHECK(navigationLayout->GetTopMargin() == testValue);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutSetGetBottomMargin(void)
-{
- ToolkitTestApplication application;
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- const float testValue = 12.0f;
-
- navigationLayout->SetNumberOfColumns(6);
- navigationLayout->SetBottomMargin(testValue);
- DALI_TEST_CHECK(navigationLayout->GetBottomMargin() == testValue);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutSetGetScrollSpeedFactor(void)
-{
- ToolkitTestApplication application;
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- const float testValue = 15.0f;
-
- navigationLayout->SetNumberOfColumns(6);
- navigationLayout->SetScrollSpeedFactor(testValue);
- DALI_TEST_CHECK(navigationLayout->GetScrollSpeedFactor() == testValue);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutSetGetMaximumSwipeSpeed(void)
-{
- ToolkitTestApplication application;
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
- const float testValue = 10.0f;
-
- navigationLayout->SetNumberOfColumns(6);
- navigationLayout->SetMaximumSwipeSpeed(testValue);
- DALI_TEST_CHECK(navigationLayout->GetMaximumSwipeSpeed() == testValue);
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutSetAndGetItemFlickAnimationDuration(void)
-{
- ToolkitTestApplication application;
-
- // Create a navigation layout
- NavigationLayoutPtr navigationLayout = NavigationLayout::New();
-
- // Set the flick animaiton duration
- navigationLayout->SetItemFlickAnimationDuration(0.35f);
-
- // Check whether we get the correct flick animaiton duration
- DALI_TEST_EQUALS( navigationLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliNavigationLayoutGetScrollToPosition(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- NavigationLayoutPtr layout = NavigationLayout::New();
-
- view.SetName("view actor");
- view.AddLayout(*layout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- layout->SetOrientation(ControlOrientation::Up);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- // Confirm: we have actors in the view.
- std::vector<unsigned int> indices;
- for(unsigned int i = 0; i < 10; i++)
- {
- Actor testActor = view.GetItem(i);
- if (testActor)
- {
- indices.push_back(i);
- }
- }
-
- try
- {
- if (!indices.empty())
- {
- const unsigned int firstTargetIndex = indices[indices.size()-1];
- // scroll to last item
- view.ScrollToItem(firstTargetIndex, 0.00f);
- application.Render(16); // 60hz frames
-
- std::size_t moveCount = 0;
- for(std::size_t i = 0; i < indices.size(); i++)
- {
- float layoutPosBefore = view.GetCurrentLayoutPosition(i);
- view.ScrollToItem(indices[i], 0.0f);
-
- application.Render(16); // 60hz frame
-
- float layoutPosAfter = view.GetCurrentLayoutPosition(i);
-
- if (fabs(layoutPosBefore-layoutPosAfter) <= FLT_EPSILON)
- {
- ++moveCount;
- }
- }
-
- DALI_TEST_CHECK((moveCount == indices.size()));
- }
- }
- catch(...)
- {
- tet_result(TET_FAIL);
- }
-
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/dali-toolkit.h>
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-namespace
-{
-const unsigned int TOTAL_ITEM_NUMBER = 200;
-
-Vector3 RollLayoutItemSizeFunction(float layoutWidth, float layoutHeight, float rowSpacing)
-{
- float height = (layoutHeight - rowSpacing) * 0.5f;
- return Vector3(layoutWidth, height, height);
-}
-
-} // namespace
-
-
-// Implementation of ItemFactory for providing actors to ItemView
-class TestItemFactory : public ItemFactory
-{
-public:
-
- /**
- * Constructor
- */
- TestItemFactory()
- {
- }
-
-public: // From ItemFactory
-
- /**
- * Query the number of items available from the factory.
- * The maximum available item has an ID of GetNumberOfItems() - 1.
- */
- virtual unsigned int GetNumberOfItems()
- {
- return TOTAL_ITEM_NUMBER;
- }
-
- /**
- * Create an Actor to represent a visible item.
- * @param itemId
- * @return the created actor.
- */
- virtual Actor NewItem(unsigned int itemId)
- {
- // Create an test actor for this item
- ImageActor actor = CreateSolidColorActor(Color::RED);
- actor.SetSize(64.0f, 64.0f);
- return actor;
- }
-};
-
-void dali_roll_layout_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void dali_roll_layout_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-
-
-int UtcDaliRollLayoutNew(void)
-{
- ToolkitTestApplication application;
-
- // Create a roll layout
- RollLayoutPtr rollLayout = RollLayout::New();
-
- DALI_TEST_CHECK(rollLayout);
- END_TEST;
-}
-
-int UtcDaliRollLayoutSetAndGetRowSpacing(void)
-{
- ToolkitTestApplication application;
-
- // Create a roll layout
- RollLayoutPtr rollLayout = RollLayout::New();
-
- // Set the row spacing
- rollLayout->SetRowSpacing(10.0f);
-
- // Check whether we get the correct row spacing
- DALI_TEST_EQUALS(rollLayout->GetRowSpacing(), 10.0f, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliRollLayoutSetAndGetItemSizeFunction(void)
-{
- ToolkitTestApplication application;
-
- // Create a roll layout
- RollLayoutPtr rollLayout = RollLayout::New();
-
- // Set the item size function
- rollLayout->SetItemSizeFunction(RollLayoutItemSizeFunction);
-
- // Check whether we get the correct item size function
- DALI_TEST_CHECK(rollLayout->GetItemSizeFunction() == RollLayoutItemSizeFunction);
- END_TEST;
-}
-
-int UtcDaliRollLayoutSetAndGetScrollSpeedFactor(void)
-{
- ToolkitTestApplication application;
-
- // Create a roll layout
- RollLayoutPtr rollLayout = RollLayout::New();
-
- // Set the scroll speed factor
- rollLayout->SetScrollSpeedFactor(0.05f);
-
- // Check whether we get the correct scroll speed factor
- DALI_TEST_EQUALS(rollLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliRollLayoutSetAndGetMaximumSwipeSpeed(void)
-{
- ToolkitTestApplication application;
-
- // Create a roll layout
- RollLayoutPtr rollLayout = RollLayout::New();
-
- // Set the maximum swipe speed
- rollLayout->SetMaximumSwipeSpeed(50.0f);
-
- // Check whether we get the correct maximum swipe speed
- DALI_TEST_EQUALS(rollLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliRollLayoutSetAndGetItemFlickAnimationDuration(void)
-{
- ToolkitTestApplication application;
-
- // Create a roll layout
- RollLayoutPtr rollLayout = RollLayout::New();
-
- // Set the flick animaiton duration
- rollLayout->SetItemFlickAnimationDuration(0.35f);
-
- // Check whether we get the correct flick animaiton duration
- DALI_TEST_EQUALS( rollLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliRollLayoutConstraintLeft(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- RollLayoutPtr rollLayout = RollLayout::New();
-
- view.SetName("view actor");
- view.AddLayout(*rollLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- rollLayout->SetOrientation(ControlOrientation::Left);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- // Confirm: we have actors in the view and they are positioned some distance from the origin.
- int nonZeroCount = 0;
- int elementsFound = 0;
- for(unsigned int i = 0; i < 10; i++)
- {
- Actor testActor = view.GetItem(i);
- if (testActor)
- {
- elementsFound++;
- Vector3 pos = testActor.GetCurrentPosition();
-
- if (pos.LengthSquared() > 0.0f)
- {
- nonZeroCount++;
- }
- }
- }
-
- DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
-
-int UtcDaliRollLayoutConstraintRight(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- RollLayoutPtr rollLayout = RollLayout::New();
-
- view.SetName("view actor");
- view.AddLayout(*rollLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- rollLayout->SetOrientation(ControlOrientation::Right);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- // Confirm: we have actors in the view and they are positioned some distance from the origin.
- int nonZeroCount = 0;
- int elementsFound = 0;
- for(unsigned int i = 0; i < 10; i++)
- {
- Actor testActor = view.GetItem(i);
- if (testActor)
- {
- elementsFound++;
- Vector3 pos = testActor.GetCurrentPosition();
-
- if (pos.LengthSquared() > 0.0f)
- {
- nonZeroCount++;
- }
- }
- }
-
- DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
-
-int UtcDaliRollLayoutConstraintUp(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- RollLayoutPtr rollLayout = RollLayout::New();
-
- view.SetName("view actor");
- view.AddLayout(*rollLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- rollLayout->SetOrientation(ControlOrientation::Up);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- // Confirm: we have actors in the view and they are positioned some distance from the origin.
- int nonZeroCount = 0;
- int elementsFound = 0;
- for(unsigned int i = 0; i < 10; i++)
- {
- Actor testActor = view.GetItem(i);
- if (testActor)
- {
- elementsFound++;
- Vector3 pos = testActor.GetCurrentPosition();
-
- if (pos.LengthSquared() > 0.0f)
- {
- nonZeroCount++;
- }
- }
- }
-
- DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
-
-int UtcDaliRollLayoutConstraintDown(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- RollLayoutPtr rollLayout = RollLayout::New();
-
- view.SetName("view actor");
- view.AddLayout(*rollLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- rollLayout->SetOrientation(ControlOrientation::Down);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- // Confirm: we have actors in the view and they are positioned some distance from the origin.
- int nonZeroCount = 0;
- int elementsFound = 0;
- for(unsigned int i = 0; i < 10; i++)
- {
- Actor testActor = view.GetItem(i);
- if (testActor)
- {
- elementsFound++;
- Vector3 pos = testActor.GetCurrentPosition();
-
- if (pos.LengthSquared() > 0.0f)
- {
- nonZeroCount++;
- }
- }
- }
-
- DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound));
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
-
-int UtcDaliRollLayoutScrollDirection(void)
-{
- ToolkitTestApplication application;
-
- // Create the ItemView actor
- TestItemFactory factory;
- ItemView view = ItemView::New(factory);
- Vector3 vec(480.0f, 800.0f, 0.0f);
- RollLayoutPtr rollLayout = RollLayout::New();
-
- view.SetName("view actor");
- view.AddLayout(*rollLayout);
- view.SetSize(vec);
-
- Stage::GetCurrent().Add(view);
- rollLayout->SetOrientation(ControlOrientation::Left);
- view.ActivateLayout(0, vec, 0.0f);
-
- application.SendNotification();
- application.Render(0);
-
- ItemLayoutPtr layout = rollLayout;
-
- // render 10 frames
- for(int i = 0; i < 10; ++i)
- {
- application.Render(16); // 60hz frames
- }
-
- rollLayout->SetOrientation(ControlOrientation::Up);
- view.ActivateLayout(0, vec, 0.0f);
- application.SendNotification();
- application.Render();
-
- Degree deg = layout->GetScrollDirection();
- DALI_TEST_CHECK(deg == 0.0f);
-
- rollLayout->SetOrientation(ControlOrientation::Down);
- view.ActivateLayout(0, vec, 0.0f);
- application.SendNotification();
- application.Render();
-
- deg = layout->GetScrollDirection();
- DALI_TEST_CHECK((deg == 180.0f));
-
- layout->SetOrientation(ControlOrientation::Left);
- view.ActivateLayout(0, vec, 0.0f);
- application.SendNotification();
- application.Render();
-
- deg = layout->GetScrollDirection();
- DALI_TEST_CHECK(deg == 90.f);
-
- rollLayout->SetOrientation(ControlOrientation::Right);
- view.ActivateLayout(0, vec, 0.0f);
- application.SendNotification();
- application.Render();
-
- deg = layout->GetScrollDirection();
- DALI_TEST_CHECK(deg == 270.0f);
-
- Stage::GetCurrent().Remove(view);
- END_TEST;
-}
# Tizen Profile options
AC_ARG_ENABLE([profile],
- [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,LITE,WEARABLE,TV],
+ [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,WEARABLE,TV],
[Select the variant of tizen])],
[dali_profile=$enableval],
[dali_profile=COMMON])
../../../../dali-adaptor/plugins \
../../../../dali-adaptor/platform-abstractions/interfaces \
../../../../dali-adaptor/platform-abstractions/portable \
- ../../../../dali-adaptor/platform-abstractions/slp \
+ ../../../../dali-adaptor/platform-abstractions/tizen \
../../../dali-toolkit \
../../../texture-atlas-exporter \
../../../../dali/automated-tests \
# newlines.
ALIASES =
+# Clip alias inserts the specified file between two text markers.
+# EG: @clip{"button.h",public,private}
+# Shows all lines between public and private *inclusive*.
+ALIASES += clip{3}="\dontinclude \1 \n \skip \2 \n \until \3"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH =
+EXAMPLE_PATH = @DOXYGEN_DOCS_DIR@/../
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
# Fortran comments will always remain visible.
# The default value is: YES.
-STRIP_CODE_COMMENTS = YES
+STRIP_CODE_COMMENTS = NO
# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
# function all documented functions referencing it will be listed.
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
-#include <dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h>
-#include <dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-carousel-effect.h>
#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-constraints.h>
mRenderDownsampledCamera.SetNearClippingPlane(1.0f);
mRenderDownsampledCamera.SetAspectRatio(mDownsampledWidth / mDownsampledHeight);
mRenderDownsampledCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
- mRenderDownsampledCamera.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); // Rotate to look at origin
mRenderDownsampledCamera.SetPosition(0.0f, 0.0f, ((mDownsampledHeight * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f)));
mRenderFullSizeCamera.SetNearClippingPlane(1.0f);
mRenderFullSizeCamera.SetAspectRatio(mTargetSize.width / mTargetSize.height);
mRenderFullSizeCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
- mRenderFullSizeCamera.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); // Rotate to look at origin
float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f);
mRenderFullSizeCamera.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale);
{
label.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
label.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
- label.MoveBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
+ label.TranslateBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
if( IsDisabled() && GetDisabledBackgroundImage() )
{
{
label.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
label.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
- label.MoveBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
+ label.TranslateBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL );
if( IsSelected() )
{
Animation animation = Animation::New(period.delaySeconds + period.durationSeconds);
animation.AnimateTo( Property(child, Actor::Property::POSITION), position, AlphaFunctions::EaseOut, period);
animation.AnimateTo( Property(child, Actor::Property::SCALE), scale, AlphaFunctions::EaseOut, period);
- animation.AnimateTo( Property(child, Actor::Property::ROTATION), rotation, AlphaFunctions::EaseOut, period);
+ animation.AnimateTo( Property(child, Actor::Property::ORIENTATION), rotation, AlphaFunctions::EaseOut, period);
animation.Play();
}
}
{
actor.SetPosition( position );
actor.SetSize( size );
- actor.SetRotation( rotation );
+ actor.SetOrientation( rotation );
actor.SetScale( scale );
}
}
mCameraForChildren.SetAspectRatio(mTargetSize.width / mTargetSize.height);
mCameraForChildren.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
mCameraForChildren.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosScale);
- mCameraForChildren.SetRotation(Quaternion(M_PI, Vector3::YAXIS));
mCameraForChildren.SetZ( mTargetSize.height * cameraPosScale );
}
mRenderDownsampledCamera.SetNearClippingPlane(1.0f);
mRenderDownsampledCamera.SetAspectRatio(mDownsampledWidth / mDownsampledHeight);
mRenderDownsampledCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
- // Point the camera back into the scene
- mRenderDownsampledCamera.SetRotation(Quaternion(M_PI, Vector3::YAXIS));
mRenderDownsampledCamera.SetPosition(0.0f, 0.0f, ((mDownsampledHeight * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f)));
mRenderFullSizeCamera.SetNearClippingPlane(1.0f);
mRenderFullSizeCamera.SetAspectRatio(mTargetSize.width / mTargetSize.height);
mRenderFullSizeCamera.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
- // Point the camera back into the scene
- mRenderFullSizeCamera.SetRotation(Quaternion(M_PI, Vector3::YAXIS));
float cameraPosConstraintScale = 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f);
mRenderFullSizeCamera.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale);
self.Add( mSourceImageActor );
mSourceImageActor.SetParentOrigin( ParentOrigin::CENTER );
mSourceImageActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
- mSourceImageActor.SetInheritRotation( false );
+ mSourceImageActor.SetInheritOrientation( false );
mSourceImageActor.SetInheritScale( false );
mSourceImageActor.SetColorMode( USE_OWN_COLOR );
mSourceImageActor.SetSize( Vector3::ONE );
mCameraActor = CameraActor::New();
mCameraActor.SetType(Camera::FREE_LOOK);
- mCameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS)); // Look at stage
stage.Add(mCameraActor);
mTask.SetCameraActor( mCameraActor );
animation.AnimateTo( Property( mTurnEffect[mIndex], mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName() ),
originalCenter,
AlphaFunctions::EaseOut, PAGE_TURN_OVER_ANIMATION_DURATION*0.75f );
- animation.AnimateBy( Property( actor, Actor::Property::ROTATION ), AngleAxis( Degree( 180.0f ), Vector3::YAXIS ) ,AlphaFunctions::EaseOut );
+ animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( Degree( 180.0f ), Vector3::YAXIS ) ,AlphaFunctions::EaseOut );
animation.Play();
ImageActor::DownCast(actor).SetCullFace( CullBack );
animation.FinishedSignal().Connect( this, &PageTurnPortraitView::OnTurnedOver );
GetImpl( mTurnEffect[mIndex] ).ApplyInternalConstraint();
float distance = offset.Length();
- Constraint rotationConstraint = Constraint::New<Quaternion>( Actor::Property::ROTATION,
+ Constraint rotationConstraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
Source( self, mPropertyPanDisplacement[mIndex] ),
RotationConstraint(distance, mPageSize.width, mIsTurnBack[mPanActor]));
mPanActor.ApplyConstraint( rotationConstraint );
mSlider.ApplyConstraint( constraint );
mSliderWrap.ApplyConstraint( constraint );
- constraint = Constraint::New<Quaternion>( Actor::Property::ROTATION,
+ constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ),
ScrollBarInternalRotationConstraint( vertical ) );
mSlider.ApplyConstraint( constraint );
const float parentOvershoot = parentOvershootProperty.GetFloat();
const Toolkit::ControlOrientation::Type& parentOrientation = static_cast<Toolkit::ControlOrientation::Type>(parentScrollDirection.z);
- Quaternion rotation;
-
+ float multiplier = 0;
if(Toolkit::IsVertical(parentOrientation))
{
if(fabsf(parentScrollDirection.y) <= Math::MACHINE_EPSILON_1)
if( (parentOrientation == Toolkit::ControlOrientation::Up && parentOvershoot < Math::MACHINE_EPSILON_0)
|| (parentOrientation == Toolkit::ControlOrientation::Down && parentOvershoot > Math::MACHINE_EPSILON_0) )
{
- rotation = Quaternion(0.5f * Math::PI, Vector3::ZAXIS);
+ multiplier = 0.5f;
}
else
{
- rotation = Quaternion(1.5f * Math::PI, Vector3::ZAXIS);
+ multiplier = 1.5f;
}
}
else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.y > Math::MACHINE_EPSILON_0)
|| (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.y < Math::MACHINE_EPSILON_0) )
{
- rotation = Quaternion(0.0f, Vector3::ZAXIS);
+ multiplier = 0.0f;
}
else
{
- rotation = Quaternion(Math::PI, Vector3::ZAXIS);
+ multiplier = 1.0f;
}
}
else
if( (parentOrientation == Toolkit::ControlOrientation::Left && parentOvershoot > Math::MACHINE_EPSILON_0)
||(parentOrientation == Toolkit::ControlOrientation::Right && parentOvershoot < Math::MACHINE_EPSILON_0) )
{
- rotation = Quaternion(Math::PI, Vector3::ZAXIS);
+ multiplier = 1.0f;
}
else
{
- rotation = Quaternion(0.0f, Vector3::ZAXIS);
+ multiplier = 0.0f;
}
}
else if( (parentOvershoot > Math::MACHINE_EPSILON_0 && parentScrollDirection.x > Math::MACHINE_EPSILON_0)
|| (parentOvershoot < Math::MACHINE_EPSILON_0 && parentScrollDirection.x < Math::MACHINE_EPSILON_0) )
{
- rotation = Quaternion(1.5f * Math::PI, Vector3::ZAXIS);
+ multiplier = 1.5f;
}
else
{
- rotation = Quaternion(0.5f * Math::PI, Vector3::ZAXIS);
+ multiplier = 0.5f;
}
}
+ Quaternion rotation( Radian( multiplier * Math::PI ), Vector3::ZAXIS );
+
return rotation;
}
};
mOvershootOverlay.ApplyConstraint(constraint);
mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height);
- constraint = Constraint::New<Quaternion>( Actor::Property::ROTATION,
+ constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
ParentSource( mPropertyScrollDirection ),
Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
OvershootOverlayRotationConstraint() );
const Vector3 parentSize = self.GetCurrentSize();
if(IsVertical())
{
- mOvershootOverlay.SetRotation(Quaternion(0.0f, Vector3::ZAXIS));
+ mOvershootOverlay.SetOrientation(Quaternion(0.0f, Vector3::ZAXIS));
mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width), size.depth);
}
else
{
- mOvershootOverlay.SetRotation(Quaternion(1.5f * Math::PI, Vector3::ZAXIS));
+ mOvershootOverlay.SetOrientation(Quaternion(1.5f * Math::PI, Vector3::ZAXIS));
mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height), size.depth);
relativeOffset = Vector3(0.0f, 1.0f, 0.0f);
}
const Vector3 parentSize = self.GetCurrentSize();
if(IsVertical())
{
- mOvershootOverlay.SetRotation(Quaternion(Math::PI, Vector3::ZAXIS));
+ mOvershootOverlay.SetOrientation(Quaternion(Math::PI, Vector3::ZAXIS));
mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width), size.depth);
relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
}
else
{
- mOvershootOverlay.SetRotation(Quaternion(0.5f * Math::PI, Vector3::ZAXIS));
+ mOvershootOverlay.SetOrientation(Quaternion(0.5f * Math::PI, Vector3::ZAXIS));
mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height), size.depth);
relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
}
constraint.SetRemoveAction( Constraint::Discard );
child.ApplyConstraint( constraint );
- constraint = Constraint::New<Quaternion>( Actor::Property::ROTATION,
+ constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
LocalSource( Actor::Property::POSITION ),
LocalSource( Actor::Property::SCALE ),
LocalSource( Actor::Property::SIZE ),
{
// Apply constraints to this actor //
Constraint constraint;
- constraint = Constraint::New<Quaternion>( Actor::Property::ROTATION,
+ constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
Source(parentPage, Actor::Property::POSITION),
Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ),
Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ),
{
// Apply constraints to this actor //
Constraint constraint;
- constraint = Constraint::New<Quaternion>( Actor::Property::ROTATION,
+ constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
LocalSource(Actor::Property::POSITION),
Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ),
Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ),
{
// Apply constraints to this actor //
Constraint constraint;
- constraint = Constraint::New<Quaternion>( Actor::Property::ROTATION,
+ constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
LocalSource(Actor::Property::POSITION),
Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ),
Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ),
// Target is constrained to point at the shadow plane origin
mCameraActor.SetNearClippingPlane( 1.0f );
mCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Camera orientation constrained to point at shadow plane world position
- mCameraActor.SetRotation(Radian(Degree(180)), Vector3::YAXIS);
+ mCameraActor.SetOrientation(Radian(Degree(180)), Vector3::YAXIS);
mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION);
mShadowRenderShader = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE,
// Turn off inheritance to ensure filter renders properly
mBlurRootActor.SetPositionInheritanceMode(USE_PARENT_POSITION);
- mBlurRootActor.SetInheritRotation(false);
+ mBlurRootActor.SetInheritOrientation(false);
mBlurRootActor.SetInheritScale(false);
mBlurRootActor.SetColorMode(USE_OWN_COLOR);
// is under control of application, can't use transform inheritance)
Constraint cameraOrientationConstraint =
- Constraint::New<Quaternion> ( Actor::Property::ROTATION,
+ Constraint::New<Quaternion> ( Actor::Property::ORIENTATION,
Source( mShadowPlane, Actor::Property::WORLD_POSITION ),
Source( mPointLight, Actor::Property::WORLD_POSITION ),
- Source( mShadowPlane, Actor::Property::WORLD_ROTATION ),
+ Source( mShadowPlane, Actor::Property::WORLD_ORIENTATION ),
&LookAt );
mCameraActor.ApplyConstraint( cameraOrientationConstraint );
mCameraForBlur.SetNearClippingPlane(1.0f);
mCameraForBlur.SetAspectRatio(mTargetSize.width / mTargetSize.height);
mCameraForBlur.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
- mCameraForBlur.SetRotation(Quaternion(M_PI, Vector3::YAXIS));
mCameraForBlur.SetPosition(0.0f, 0.0f, ((mTargetSize.height * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f)));
}
mCameraActor.SetNearClippingPlane(1.0f);
mCameraActor.SetAspectRatio(mTargetSize.width / mTargetSize.height);
mCameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
- mCameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS));
mCameraActor.SetPosition(0.0f, 0.0f, ((mTargetSize.height * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f)));
}
mCameraActor.SetNearClippingPlane(1.0f);
mCameraActor.SetAspectRatio(mTargetSize.width / mTargetSize.height);
mCameraActor.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
- mCameraActor.SetRotation(Quaternion(M_PI, Vector3::YAXIS));
mCameraActor.SetPosition(0.0f, 0.0f, ((mTargetSize.height * 0.5f) / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f)));
}
mOffscreenRootActor = Layer::New();
mOffscreenRootActor.SetColorMode( USE_OWN_COLOR );
mOffscreenRootActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
- mOffscreenRootActor.SetInheritRotation( false );
mOffscreenRootActor.SetInheritScale( false );
mOffscreenRootActor.SetDepthTestDisabled( true );
mOffscreenRootActor.SetSize( offscreenSize );
for( unsigned int x = y%2; x < mNumColumns; x=x+2)
{
idx = y*mNumColumns + x;
- mBoxes[idx].SetRotation( Radian(angle), Vector3::XAXIS );
+ mBoxes[idx].SetOrientation( Radian(angle), Vector3::XAXIS );
}
for( unsigned int x = (y+1)%2; x < mNumColumns; x=x+2)
{
idx = y*mNumColumns + x;
- mBoxes[idx].SetRotation( Radian(-angle), Vector3::YAXIS );
+ mBoxes[idx].SetOrientation( Radian(-angle), Vector3::YAXIS );
}
}
}
{
if ( mFirstTransition && (!mIsToNextImage) ) // for the first transition and it is going to previous image
{
- mTiles[mContainerIndex][actorIndex].SetRotation( Radian( angle), axis );
+ mTiles[mContainerIndex][actorIndex].SetOrientation( Radian( angle), axis );
}
else if( !mChangeTurningDirection ) // reset rotation, translation and color
{
- mTiles[mContainerIndex][actorIndex].MoveBy( resetTranslation );
- mTiles[mContainerIndex][actorIndex].SetRotation( Radian( angle), axis );
+ mTiles[mContainerIndex][actorIndex].TranslateBy( resetTranslation );
+ mTiles[mContainerIndex][actorIndex].SetOrientation( Radian( angle), axis );
}
mAnimation.RotateTo( mBoxes[actorIndex], Radian( -angle ), axis, AlphaFunctions::EaseInOutSine );
Vector3 position(mBoxes[actorIndex].GetCurrentPosition());
idx = y*mNumColumns;
for( unsigned int x = y%2; x < mNumColumns; x=x+2)
{
- mBoxes[idx+x].SetRotation( Radian(angle), Vector3::YAXIS );
+ mBoxes[idx+x].SetOrientation( Radian(angle), Vector3::YAXIS );
}
for( unsigned int x = (y+1)%2; x < mNumColumns; x=x+2)
{
- mBoxes[idx+x].SetRotation( Radian(-angle), Vector3::YAXIS );
+ mBoxes[idx+x].SetOrientation( Radian(-angle), Vector3::YAXIS );
}
}
}
ImageActor frontTile = mTiles[mContainerIndex^1][actorIndex];
if ( mFirstTransition && (!mIsToNextImage) ) // for the first transition, it is going to previous image
{
- sideTile.SetRotation( Radian( angle), Vector3::YAXIS );
+ sideTile.SetOrientation( Radian( angle), Vector3::YAXIS );
}
else if( !mChangeTurningDirection ) // reset rotation, translation and color
{
- sideTile.MoveBy( resetTranslation );
- sideTile.SetRotation( Radian( angle), Vector3::YAXIS );
+ sideTile.TranslateBy( resetTranslation );
+ sideTile.SetOrientation( Radian( angle), Vector3::YAXIS );
}
mAnimation.RotateTo( currentCube, Radian( -angle ), Vector3::YAXIS, AlphaFunctions::Linear );
Vector3 position(currentCube.GetCurrentPosition());
{
for( unsigned int idx = 0; idx < totalNum; idx++ )
{
- mTiles[mContainerIndex][idx].SetRotation( Degree( angle), Vector3::YAXIS );
+ mTiles[mContainerIndex][idx].SetOrientation( Degree( angle), Vector3::YAXIS );
}
}
else if(!mChangeTurningDirection) // reset rotation, translation
{
for( unsigned int idx = 0; idx < totalNum; idx++ )
{
- mTiles[mContainerIndex][idx].MoveBy( translation );
- mTiles[mContainerIndex][idx].SetRotation( Degree( angle), Vector3::YAXIS );
+ mTiles[mContainerIndex][idx].TranslateBy( translation );
+ mTiles[mContainerIndex][idx].SetOrientation( Degree( angle), Vector3::YAXIS );
}
}
unsigned int totalNum = mNumRows * mNumColumns;
for( unsigned int idx = 0; idx < totalNum; idx++ )
{
- mBoxes[idx].SetRotation( Degree( angle ), Vector3::YAXIS );
+ mBoxes[idx].SetOrientation( Degree( angle ), Vector3::YAXIS );
}
}
{
WrappedQuaternionConstraint wrapped(rotationConstraint, itemId);
- Constraint constraint = Constraint::New<Quaternion>( Actor::Property::ROTATION,
+ Constraint constraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
Source( scrollPositionObject, scrollPositionProperty ),
ParentSource( scrollSpeedProperty ),
ParentSource( Actor::Property::SIZE ),
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <algorithm>
-
-#include <dali-toolkit/public-api/controls/scrollable/item-view/navigation-layout.h>
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-namespace // unnamed namespace
-{
-const unsigned int DEFAULT_NUMBER_OF_COLUMNS = 3;
-const float DEFAULT_TOP_MARGIN = 0.3f;
-const float DEFAULT_BOTTOM_MARGIN = 0.3f;
-const float DEFAULT_SIDE_MARGIN = 0.2f;
-const float DEFAULT_COLUMN_SPACING = 20.0f;
-const float DEFAULT_ROW_SPACING = 20.0f;
-const float DEFAULT_SCROLL_SPEED_FACTOR = 0.01f;
-const float DEFAULT_MAXIMUM_SWIPE_SPEED = 3.0f;
-const float DEFAULT_ITEM_FLICK_ANIMATION_DURATION = 0.05f;
-const float DEFAULT_SIZE_EXTEND = 1.4f;
-const float DEFAULT_HEIGHT_FACTOR = 0.6f;
-
-// 4 orientations are supported
-struct NavigationPositionConstraintUp
-{
- NavigationPositionConstraintUp(const unsigned int columnIndex,
- const unsigned int numberOfColumns,
- const float columnSpacing,
- const float sizeExtend,
- const float bottomMargin,
- const float topMargin)
- : mColumnIndex(columnIndex),
- mNumberOfColumns(numberOfColumns),
- mColumnSpacing(columnSpacing),
- mSizeExtend(sizeExtend),
- mBottomMargin(bottomMargin),
- mTopMargin(topMargin)
- {
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float itemWidth = (layoutSize.width * mSizeExtend- mColumnSpacing * (mNumberOfColumns - 1))/( mNumberOfColumns );
-
- Vector3 itemPosition;
-
- float z = (sinf((layoutPosition + 1.0f) * Math::PI *0.5f) - 1.0f) * itemWidth * 2.0f;
-
- itemPosition = Vector3( (layoutPosition + 1.0f) * (itemWidth + mColumnSpacing) + itemWidth * 0.5f - layoutSize.width * mSizeExtend * 0.5f,
- (- mBottomMargin + mTopMargin) * layoutSize.width * 0.5f ,
- z);
- return itemPosition;
- }
-
-public:
- unsigned int mColumnIndex;
- unsigned int mNumberOfColumns;
- float mColumnSpacing;
- float mSizeExtend;
- float mBottomMargin;
- float mTopMargin;
-};
-
-struct NavigationPositionConstraintLeft
-{
- NavigationPositionConstraintLeft(const unsigned int columnIndex,
- const unsigned int numberOfColumns,
- const float columnSpacing,
- const float sizeExtend,
- const float bottomMargin,
- const float topMargin)
- : mColumnIndex(columnIndex),
- mNumberOfColumns(numberOfColumns),
- mColumnSpacing(columnSpacing),
- mSizeExtend(sizeExtend),
- mBottomMargin(bottomMargin),
- mTopMargin(topMargin)
- {
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float itemWidth = (DEFAULT_HEIGHT_FACTOR * layoutSize.height * mSizeExtend- mColumnSpacing * (mNumberOfColumns - 1))/( mNumberOfColumns );
- Vector3 itemPosition;
- float z = (sinf((layoutPosition + 1.0f) * Math::PI *0.5f) - 1.0f) * itemWidth * 1.5f;
- itemPosition = Vector3( (- mBottomMargin + mTopMargin) * 0.5f * layoutSize.width ,
- -((layoutPosition+ 1.0) * (itemWidth + mColumnSpacing) + itemWidth * 0.5f - DEFAULT_HEIGHT_FACTOR * layoutSize.height * mSizeExtend * 0.5f ),
- z);
- return itemPosition;
- }
-
-public:
- unsigned int mColumnIndex;
- unsigned int mNumberOfColumns;
- float mColumnSpacing;
- float mSizeExtend;
- float mBottomMargin;
- float mTopMargin;
-};
-
-struct NavigationPositionConstraintDown
-{
- NavigationPositionConstraintDown(const unsigned int columnIndex,
- const unsigned int numberOfColumns,
- const float columnSpacing,
- const float sizeExtend,
- const float bottomMargin,
- const float topMargin)
- : mColumnIndex(columnIndex),
- mNumberOfColumns(numberOfColumns),
- mColumnSpacing(columnSpacing),
- mSizeExtend(sizeExtend),
- mBottomMargin(bottomMargin),
- mTopMargin(topMargin)
- {
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float itemWidth = (layoutSize.width * mSizeExtend- mColumnSpacing * (mNumberOfColumns - 1))/( mNumberOfColumns );
- Vector3 itemPosition;
-
- float z = (sinf((layoutPosition + 1.0f ) * Math::PI *0.5f) - 1.0f) * itemWidth * 2.0f;
- itemPosition = Vector3( -((layoutPosition + 1.0f) * (itemWidth + mColumnSpacing) + itemWidth * 0.5f - layoutSize.width * mSizeExtend * 0.5f),
- (- mBottomMargin + mTopMargin)* layoutSize.width * 0.5f,
- z);
- return itemPosition;
- }
-
- public:
- unsigned int mColumnIndex;
- unsigned int mNumberOfColumns;
- float mColumnSpacing;
- float mSizeExtend;
- float mBottomMargin;
- float mTopMargin;
-};
-
-struct NavigationPositionConstraintRight
-{
- NavigationPositionConstraintRight(const unsigned int columnIndex,
- const unsigned int numberOfColumns,
- const float columnSpacing,
- const float sizeExtend,
- const float bottomMargin,
- const float topMargin)
- : mColumnIndex(columnIndex),
- mNumberOfColumns(numberOfColumns),
- mColumnSpacing(columnSpacing),
- mSizeExtend(sizeExtend),
- mBottomMargin(bottomMargin),
- mTopMargin(topMargin)
- {
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float itemWidth = (DEFAULT_HEIGHT_FACTOR * layoutSize.height * mSizeExtend- mColumnSpacing * (mNumberOfColumns - 1))/( mNumberOfColumns );
- Vector3 itemPosition;
- float z = (sinf((layoutPosition + 1.0f) * Math::PI *0.5f) - 1.0f) * itemWidth * 1.5f;
- itemPosition = Vector3( (- mBottomMargin + mTopMargin) * layoutSize.width * 0.5f,
- ((layoutPosition + 1.0f) * (itemWidth + mColumnSpacing) + itemWidth * 0.5f - DEFAULT_HEIGHT_FACTOR * layoutSize.height * mSizeExtend *0.5f ),
- z);
- return itemPosition;
- }
-
-public:
- unsigned int mColumnIndex;
- unsigned int mNumberOfColumns;
- float mColumnSpacing;
- float mSizeExtend;
- float mBottomMargin;
- float mTopMargin;
-};
-
-struct NavigationRotationConstraintUp
-{
- Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float angle = 0.0f;
- float _layoutPosition = layoutPosition + 1.0f;
- if(_layoutPosition >= 1.0f)
- {
- angle = - sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f;
- }
- else
- {
- angle = sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f;
- }
- return Quaternion(angle, Vector3::YAXIS);
- }
-
-};
-
-struct NavigationRotationConstraintLeft
-{
- Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float angle = 0.0f;
- float _layoutPosition = layoutPosition + 1.0f;
- if(_layoutPosition >= 1.0f)
- {
- angle = - sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f;
- }
- else
- {
- angle = sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f;
- }
- return Quaternion(Math::PI * 0.5f, Vector3::ZAXIS) * Quaternion(angle, Vector3::YAXIS);
- }
-};
-
-struct NavigationRotationConstraintDown
-{
- Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float angle = 0.0f;
- float _layoutPosition = layoutPosition + 1.0f;
- if(_layoutPosition >= 1.0f)//right side
- {
- //rotation angle by z axis
- angle = - sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f;
- }
- else // left side
- {
- angle = sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f;
- }
- return Quaternion(Math::PI, Vector3::ZAXIS) * Quaternion(angle, Vector3::YAXIS);
- }
-};
-
-struct NavigationRotationConstraintRight
-{
- Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float angle = 0.0f;
- float _layoutPosition = layoutPosition + 1.0f;
- if(_layoutPosition >= 1.0f)
- {
- angle = - sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f;
- }
- else
- {
- angle = sinf(Math::PI * _layoutPosition) * Math::PI * 0.2f;
- }
- return Quaternion(Math::PI * 1.5f, Vector3::ZAXIS) * Quaternion(angle, Vector3::YAXIS);
- }
-};
-
-struct NavigationColorConstraint
-{
- NavigationColorConstraint(unsigned int numberOfColumns)
- : mNumberOfColumns(numberOfColumns)
- {
-
- }
- Vector4 operator()(const Vector4& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float darkness = 1.0f;
- float alpha = 1.0f;
-
- float pos = ( layoutPosition + 1.0f);
- darkness = (-0.25f) * (pos + 1.0f) * (pos + 1.0f) + 1.0f * (pos + 1.0f) + 0.2f;
-
- darkness = fabs(darkness);
- darkness /= 1.2f;
-
- return Vector4(darkness, darkness, darkness, current.a * alpha);
- }
- unsigned int mNumberOfColumns;
-
-};
-
-struct NavigationVisibilityConstraint
-{
- NavigationVisibilityConstraint(const unsigned int columnIndex,
- const unsigned int numberOfColumns,
- const float columnSpacing )
- : mColumnIndex(columnIndex),
- mNumberOfColumns(numberOfColumns),
- mColumnSpacing(columnSpacing)
- {
- }
-
- bool operator()(const bool& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float index = layoutPosition + 1.0f;
- return (index >= -1.0f) && (index <= mNumberOfColumns );
- }
-
-public:
- unsigned int mColumnIndex;
- unsigned int mNumberOfColumns;
- float mColumnSpacing;
-};
-}//end namespace
-
-namespace Dali
-{
-namespace Toolkit
-{
-struct NavigationLayout::Impl
-{
- Impl()
- : mNumberOfColumns(DEFAULT_NUMBER_OF_COLUMNS),
- mColumnSpacing(DEFAULT_COLUMN_SPACING),
- mTopMargin(DEFAULT_TOP_MARGIN),
- mBottomMargin(DEFAULT_BOTTOM_MARGIN),
- mSideMargin(DEFAULT_SIDE_MARGIN),
- mScrollSpeedFactor(DEFAULT_SCROLL_SPEED_FACTOR),
- mMaximumSwipeSpeed(DEFAULT_MAXIMUM_SWIPE_SPEED),
- mItemFlickAnimationDuration(DEFAULT_ITEM_FLICK_ANIMATION_DURATION),
- mSizeExtend(DEFAULT_SIZE_EXTEND)
- {
- mColorConstraint = NavigationColorConstraint(mNumberOfColumns);
- mRotationConstraint[0] = NavigationRotationConstraintUp();
- mRotationConstraint[1] = NavigationRotationConstraintLeft();
- mRotationConstraint[2] = NavigationRotationConstraintDown();
- mRotationConstraint[3] = NavigationRotationConstraintRight();
- }
-
- unsigned int mNumberOfColumns;
- float mColumnSpacing;
- float mTopMargin;
- float mBottomMargin;
- float mSideMargin;
- float mScrollSpeedFactor;
- float mMaximumSwipeSpeed;
- float mItemFlickAnimationDuration;
- float mSizeExtend;
-
- ItemLayout::QuaternionFunction mRotationConstraint[4];
-
- ItemLayout::Vector4Function mColorConstraint;
-};
-
-NavigationLayoutPtr NavigationLayout::New()
-{
- return NavigationLayoutPtr(new NavigationLayout());
-}
-
-NavigationLayout::~NavigationLayout()
-{
- delete mImpl;
-}
-
-void NavigationLayout::SetNumberOfColumns(unsigned int columns)
-{
- mImpl->mNumberOfColumns = columns;
-}
-
-unsigned int NavigationLayout::GetNumberOfColumns() const
-{
- return mImpl->mNumberOfColumns;
-}
-
-void NavigationLayout::SetColumnSpacing(float spacing)
-{
- mImpl->mColumnSpacing = spacing;
-}
-
-float NavigationLayout::GetColumnSpacing() const
-{
- return mImpl->mColumnSpacing;
-}
-
-void NavigationLayout::SetTopMargin(float margin)
-{
- mImpl->mTopMargin = margin;
-}
-
-float NavigationLayout::GetTopMargin() const
-{
- return mImpl->mTopMargin;
-}
-
-void NavigationLayout::SetBottomMargin(float margin)
-{
- mImpl->mBottomMargin = margin;
-}
-
-float NavigationLayout::GetBottomMargin() const
-{
- return mImpl->mBottomMargin;
-}
-
-void NavigationLayout::SetSideMargin(float margin)
-{
- mImpl->mSideMargin = margin;
- mImpl->mSizeExtend = (1.0f - margin) * 3.0f;
-}
-
-void NavigationLayout::SetScrollSpeedFactor(float scrollSpeed)
-{
- mImpl->mScrollSpeedFactor = scrollSpeed;
-}
-
-void NavigationLayout::SetMaximumSwipeSpeed(float speed)
-{
- mImpl->mMaximumSwipeSpeed = speed;
-}
-
-void NavigationLayout::SetItemFlickAnimationDuration(float durationSeconds)
-{
- mImpl->mItemFlickAnimationDuration = durationSeconds;
-}
-
-float NavigationLayout::GetScrollSpeedFactor() const
-{
- return mImpl->mScrollSpeedFactor;
-}
-
-float NavigationLayout::GetMaximumSwipeSpeed() const
-{
- return mImpl->mMaximumSwipeSpeed;
-}
-
-float NavigationLayout::GetItemFlickAnimationDuration() const
-{
- return mImpl->mItemFlickAnimationDuration;
-}
-
-float NavigationLayout::GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const
-{
- unsigned int itemsLastRow = numberOfItems % mImpl->mNumberOfColumns;
- if (itemsLastRow == 0)
- {
- itemsLastRow = mImpl->mNumberOfColumns;
- }
-
- float itemsLastPage = static_cast<float>(itemsLastRow);
- return itemsLastPage - static_cast<float>(numberOfItems) - 2.0f;
-
-}
-
-float NavigationLayout::GetClosestAnchorPosition(float layoutPosition) const
-{
- return round(layoutPosition);
-}
-
-float NavigationLayout::GetItemScrollToPosition(unsigned int itemId) const
-{
- return - static_cast<float>(itemId);
-}
-
-ItemRange NavigationLayout::GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const
-{
- int itemsPerPage = mImpl->mNumberOfColumns;
-
- int firstItemIndex = std::max(0.0f, -firstItemPosition -1.0f );
- int lastItemIndex = std::max(0.0f, -(firstItemPosition) + itemsPerPage );
-
- return ItemRange(firstItemIndex , lastItemIndex );
-}
-
-unsigned int NavigationLayout::GetReserveItemCount(Vector3 layoutSize) const
-{
- float layoutWidth = IsHorizontal(mOrientation) ? layoutSize.height : layoutSize.width;
- float itemWidth = (layoutWidth * mImpl->mSizeExtend - mImpl->mColumnSpacing * (mImpl->mNumberOfColumns - 1))/( mImpl->mNumberOfColumns );
- return static_cast<unsigned int>(layoutWidth / itemWidth);
-}
-
-bool NavigationLayout::GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const
-{
- float layoutWidth = IsHorizontal(mOrientation) ? (DEFAULT_HEIGHT_FACTOR * layoutSize.height) : layoutSize.width;
- layoutWidth = layoutWidth * mImpl->mSizeExtend;
-
- float itemWidth = (layoutWidth - mImpl->mColumnSpacing*(mImpl->mNumberOfColumns-1)) / mImpl->mNumberOfColumns;
- float itemHeight = layoutWidth * (1.0f - mImpl->mBottomMargin - mImpl->mTopMargin);
- itemSize = Vector3(itemWidth, itemHeight, (itemWidth/4)*3);
-
- return true;
-}
-
-void NavigationLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const
-{
-}
-
-bool NavigationLayout::GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const
-{
- unsigned int columnIndex = itemId % mImpl->mNumberOfColumns;
- if (mOrientation == ControlOrientation::Left)
- {
- constraint = NavigationPositionConstraintLeft(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing, mImpl->mSizeExtend, mImpl->mBottomMargin, mImpl->mTopMargin);
- }
- else if (mOrientation == ControlOrientation::Up)
- {
- constraint = NavigationPositionConstraintUp(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing, mImpl->mSizeExtend, mImpl->mBottomMargin, mImpl->mTopMargin);
- }
- else if (mOrientation == ControlOrientation::Down)
- {
- constraint = NavigationPositionConstraintDown(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing, mImpl->mSizeExtend, mImpl->mBottomMargin, mImpl->mTopMargin);
- }
- else if (mOrientation == ControlOrientation::Right)
- {
- constraint = NavigationPositionConstraintRight(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing, mImpl->mSizeExtend, mImpl->mBottomMargin, mImpl->mTopMargin);
- }
-
- return true;
-}
-
-bool NavigationLayout::GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const
-{
- return false; // No scaling
-}
-
-bool NavigationLayout::GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const
-{
- constraint = mImpl->mRotationConstraint[mOrientation];
- return true;
-}
-
-bool NavigationLayout::GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const
-{
- constraint = mImpl->mColorConstraint;
- return true;
-}
-
-bool NavigationLayout::GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const
-{
- unsigned int columnIndex = itemId % mImpl->mNumberOfColumns;
- constraint = NavigationVisibilityConstraint(columnIndex, mImpl->mNumberOfColumns, mImpl->mColumnSpacing);
- return true;
-}
-
-Degree NavigationLayout::GetScrollDirection() const
-{
- Degree scrollDirection(0);
- if (mOrientation == ControlOrientation::Down)
- {
- scrollDirection = 0.0f - 45.0f;
- }
- else if (mOrientation == ControlOrientation::Right)
- {
- scrollDirection = 90.0f - 45.0f;
- }
- else if (mOrientation == ControlOrientation::Up)
- {
- scrollDirection = 180.0f - 45.0f;
- }
- else // mOrientation == ControlOrientation::Left
- {
- scrollDirection = 270.0f - 45.0f;
- }
-
- return scrollDirection;
-}
-
-NavigationLayout::NavigationLayout()
- :mImpl(NULL)
-{
- mImpl = new Impl();
-}
-
-}
-}
+++ /dev/null
-#ifndef __DALI_TOOLKIT_NAVIGATION_LAYOUT_H__
-#define __DALI_TOOLKIT_NAVIGATION_LAYOUT_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-class NavigationLayout;
-
-typedef IntrusivePtr<NavigationLayout> NavigationLayoutPtr;
-
-/**
- * An ItemView layout which arranges items in navigation mode.
- */
-class DALI_IMPORT_API NavigationLayout: public ItemLayout
-{
-public:
-
- typedef boost::function<Vector3 (const Vector3& layoutSize,
- const unsigned int orientation,
- const unsigned int numberOfColumns,
- const float columnSpacing,
- const float sideMargin)> ResizeFunction;
-
- /**
- * Create a new navigation layout
- */
- static NavigationLayoutPtr New();
-
- /**
- * Virtual destructor.
- */
- virtual ~NavigationLayout();
-
- /**
- * Set the number of columns in the layout.
- * @param[in] columns The number of columns.
- */
- void SetNumberOfColumns(unsigned int columns);
-
- /**
- * Get the number of columns in the layout.
- * @return The number of columns.
- */
- unsigned int GetNumberOfColumns() const;
-
- /**
- * Set the spacing between columns.
- * @param[in] spacing The spacing.
- */
- void SetColumnSpacing(float spacing);
-
- /**
- * Get the spacing between columns.
- * @return The spacing.
- */
- float GetColumnSpacing() const;
-
- /**
- * Set the margin in the top of the layout
- * @param[in] margin The layout top margin.
- */
- void SetTopMargin(float margin);
-
- /**
- * Get the margin in the top of the layout
- * @return The layout top margin.
- */
- float GetTopMargin() const;
-
- /**
- * Set the margin in the bottom of the layout
- * @param[in] margin The layout bottom margin.
- */
- void SetBottomMargin(float margin);
-
- /**
- * Get the margin in the bottom of the layout
- * @return The layout bottom margin.
- */
- float GetBottomMargin() const;
-
- /**
- * Set the margin in the left and right of the layout
- * @param[in] margin The layout side margin.
- */
- void SetSideMargin(float margin);
-
- /**
- * Get the margin in the left and right of the layout
- * @return The layout side margin.
- */
- float GetSideMargin() const;
-
- /**
- * Set the factor used to customise the scroll speed while dragging and swiping the layout.
- * @param[in] scrollSpeed The scroll speed factor.
- */
- void SetScrollSpeedFactor(float scrollSpeed);
-
- /**
- * Set the maximum swipe speed in pixels per second.
- * @param[in] speed The maximum swipe speed.
- */
- void SetMaximumSwipeSpeed(float speed);
-
- /**
- * Set the duration of the flick animation in second. This is the time taken to animate each
- * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
- * by a swipe gesture.
- * @pre durationSeconds must be greater than zero.
- * @param[in] durationSeconds The duration of flick animation in seconds.
- */
- void SetItemFlickAnimationDuration(float durationSeconds);
-
- /**
- * @copydoc ItemLayout::GetScrollSpeedFactor()
- */
- virtual float GetScrollSpeedFactor() const;
-
- /**
- * @copydoc ItemLayout::GetMaximumSwipeSpeed()
- */
- virtual float GetMaximumSwipeSpeed() const;
-
- /**
- * @copydoc ItemLayout::GetItemFlickAnimationDuration()
- */
- virtual float GetItemFlickAnimationDuration() const;
-
-private:
-
- /**
- * @copydoc ItemLayout::GetMinimumLayoutPosition()
- */
- virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
-
- /**
- * @copydoc ItemLayout::GetClosestAnchorPosition()
- */
- virtual float GetClosestAnchorPosition(float layoutPosition) const;
-
- /**
- * @copydoc ItemLayout::GetItemScrollToPosition()
- */
- virtual float GetItemScrollToPosition(unsigned int itemId) const;
-
- /**
- * @copydoc ItemLayout::GetItemsWithinArea()
- */
- virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
-
- /**
- * @copydoc ItemLayout::GetReserveItemCount()
- */
- virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
-
- /**
- * @copydoc ItemLayout::GetItemSize()
- */
- virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
-
- /**
- * @copydoc ItemLayout::GetResizeAnimation()
- */
- virtual void GetResizeAnimation(Animation& animation,
- Actor actor,
- Vector3 size,
- float durationSeconds) const;
-
- /**
- * @copydoc ItemLayout::GetPositionConstraint()
- */
- virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetRotationConstraint()
- */
- virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetScaleConstraint()
- */
- virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetColorConstraint()
- */
- virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetVisibilityConstraint()
- */
- virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetScrollDirection()
- */
- virtual Degree GetScrollDirection() const;
-
-protected:
-
- /**
- * Protected constructor; see also GridLayout::New()
- */
- NavigationLayout();
-
-private:
-
- struct Impl;
- Impl* mImpl;
-};
-
-}
-}
-#endif //__DALI_TOOLKIT_NAVIGATION_LAYOUT_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 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 <dali-toolkit/public-api/controls/scrollable/item-view/roll-layout.h>
-
-// EXTERNAL INCLUDES
-#include <algorithm>
-#include <dali/public-api/animation/animation.h>
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-namespace // unnamed namespace
-{
-
-const float DEFAULT_ROW_SPACING = 20.0f;
-const float DEFAULT_SCROLL_SPEED_FACTOR = 0.0015f;
-const float DEFAULT_MAXIMUM_SWIPE_SPEED = 8.0f;
-const float DEFAULT_ITEM_FLICK_ANIMATION_DURATION = 0.4f;
-
-// 4 orientations are supported
-static const unsigned int ORIENTATION_COUNT = 4;
-
-static Vector3 GetItemSizeDefaultFunction(float layoutWidth, float layoutHeight, float rowSpacing)
-{
- float height = (layoutHeight - rowSpacing) * 0.5f;
- return Vector3(layoutWidth, height, height);
-}
-
-struct RollPositionConstraint0
-{
- RollPositionConstraint0(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction)
- : mRowSpacing(rowSpacing),
- mItemSizeFunction(itemSizeFunction)
- {
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- Vector3 itemSize = mItemSizeFunction(layoutSize.width, layoutSize.height, mRowSpacing);
-
- float adjustedLayoutPosition = layoutPosition;
- float scrollSpeedFactor = scrollSpeed * scrollSpeed * scrollSpeed * scrollSpeed;
- float y = 0.0f;
-
- float adjustedRowSpacing = mRowSpacing + scrollSpeedFactor;
-
- if(adjustedLayoutPosition > Math::MACHINE_EPSILON_0 && adjustedLayoutPosition -2.0f < Math::MACHINE_EPSILON_0)
- {
- float adjustment = 1.0f - Dali::AlphaFunctions::EaseInOutSine60((2.0f - adjustedLayoutPosition) * 0.5f);
- adjustedLayoutPosition = adjustment * 2.0f;
- y = ((itemSize.y + adjustedRowSpacing ) * adjustedLayoutPosition) - layoutSize.height * 0.5f + itemSize.y * 0.5f;
- }
- else
- {
- float yStep = std::max(50.0f, std::min(itemSize.y, scrollSpeedFactor));
- y = adjustedLayoutPosition < Math::MACHINE_EPSILON_0 ? adjustedLayoutPosition * yStep : (layoutSize.height * 0.5f + adjustedRowSpacing) + (adjustedLayoutPosition - 1.0f) * yStep;
- y += itemSize.y * 0.5f - layoutSize.height * 0.5f;
- }
-
- float z = adjustedLayoutPosition * (10.0f + scrollSpeedFactor);
- z -= std::min(3000.0f, scrollSpeedFactor * 2.0f);
-
- return Vector3(itemSize.x * 0.5f - layoutSize.x * 0.5f, y, z);
- }
-
-public:
-
- float mRowSpacing;
- RollLayout::ItemSizeFunction mItemSizeFunction;
-};
-
-struct RollPositionConstraint90
-{
- RollPositionConstraint90(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction)
- : mRowSpacing(rowSpacing),
- mItemSizeFunction(itemSizeFunction)
- {
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- Vector3 itemSize = mItemSizeFunction(layoutSize.height, layoutSize.width, mRowSpacing);
-
- float adjustedLayoutPosition = layoutPosition;
- float scrollSpeedFactor = scrollSpeed * scrollSpeed * scrollSpeed;
- float x = 0.0f;
-
- float adjustedRowSpacing = mRowSpacing + scrollSpeedFactor;
-
- if(adjustedLayoutPosition > Math::MACHINE_EPSILON_0 && adjustedLayoutPosition -2.0f < Math::MACHINE_EPSILON_0)
- {
- float adjustment = 1.0f - Dali::AlphaFunctions::EaseInOutSine60((2.0f - adjustedLayoutPosition) * 0.5f);
- adjustedLayoutPosition = adjustment * 2.0f;
- x = ((itemSize.y + adjustedRowSpacing ) * adjustedLayoutPosition) - layoutSize.width * 0.5f + itemSize.y * 0.5f;
- }
- else
- {
- float xStep = std::max(50.0f, std::min(itemSize.y, scrollSpeedFactor));
- x = adjustedLayoutPosition < Math::MACHINE_EPSILON_0 ? adjustedLayoutPosition * xStep : (layoutSize.width * 0.5f + adjustedRowSpacing) + (adjustedLayoutPosition - 1.0f) * xStep;
- x += itemSize.y * 0.5f - layoutSize.width * 0.5f;
- }
-
- float z = adjustedLayoutPosition * (10.0f + scrollSpeedFactor);
- z -= std::min(3000.0f, scrollSpeedFactor * 2.0f);
-
- return Vector3(x, itemSize.x * 0.5f - layoutSize.y * 0.5f, z);
- }
-
-public:
-
- float mRowSpacing;
- RollLayout::ItemSizeFunction mItemSizeFunction;
-};
-
-struct RollPositionConstraint180
-{
- RollPositionConstraint180(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction)
- : mRowSpacing(rowSpacing),
- mItemSizeFunction(itemSizeFunction)
- {
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- Vector3 itemSize = mItemSizeFunction(layoutSize.width, layoutSize.height, mRowSpacing);
-
- float adjustedLayoutPosition = layoutPosition;
- float scrollSpeedFactor = scrollSpeed * scrollSpeed * scrollSpeed;
- float y = 0.0f;
-
- float adjustedRowSpacing = mRowSpacing + scrollSpeedFactor;
-
- if(adjustedLayoutPosition > Math::MACHINE_EPSILON_0 && adjustedLayoutPosition -2.0f < Math::MACHINE_EPSILON_0)
- {
- float adjustment = 1.0f - Dali::AlphaFunctions::EaseInOutSine60((2.0f - adjustedLayoutPosition) * 0.5f);
- adjustedLayoutPosition = adjustment * 2.0f;
- y = ((itemSize.y + adjustedRowSpacing ) * adjustedLayoutPosition) - layoutSize.height * 0.5f + itemSize.y * 0.5f;
- }
- else
- {
- float yStep = std::max(50.0f, std::min(itemSize.y, scrollSpeedFactor));
- y = adjustedLayoutPosition < Math::MACHINE_EPSILON_0 ? adjustedLayoutPosition * yStep : (layoutSize.height * 0.5f + adjustedRowSpacing) + (adjustedLayoutPosition - 1.0f) * yStep;
- y += itemSize.y * 0.5f - layoutSize.height * 0.5f;
- }
-
- float z = adjustedLayoutPosition * (10.0f + scrollSpeedFactor);
- z -= std::min(3000.0f, scrollSpeedFactor * 2.0f);
-
-
- return Vector3(-(itemSize.x * 0.5f - layoutSize.x * 0.5f),
- -y,
- z);
- }
-
-public:
-
- float mRowSpacing;
- RollLayout::ItemSizeFunction mItemSizeFunction;
-};
-
-struct RollPositionConstraint270
-{
- RollPositionConstraint270(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction)
- : mRowSpacing(rowSpacing),
- mItemSizeFunction(itemSizeFunction)
- {
- }
-
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- Vector3 itemSize = mItemSizeFunction(layoutSize.height, layoutSize.width, mRowSpacing);
-
- float adjustedLayoutPosition = layoutPosition;
- float scrollSpeedFactor = scrollSpeed * scrollSpeed * scrollSpeed;
- float x = 0.0f;
-
- float adjustedRowSpacing = mRowSpacing + scrollSpeedFactor;
-
- if(adjustedLayoutPosition > Math::MACHINE_EPSILON_0 && adjustedLayoutPosition -2.0f < Math::MACHINE_EPSILON_0)
- {
- float adjustment = 1.0f - Dali::AlphaFunctions::EaseInOutSine60((2.0f - adjustedLayoutPosition) * 0.5f);
- adjustedLayoutPosition = adjustment * 2.0f;
- x = ((itemSize.y + adjustedRowSpacing ) * adjustedLayoutPosition) - layoutSize.width * 0.5f + itemSize.y * 0.5f;
- }
- else
- {
- float xStep = std::max(50.0f, std::min(itemSize.y, scrollSpeedFactor));
- x = adjustedLayoutPosition < Math::MACHINE_EPSILON_0 ? adjustedLayoutPosition * xStep : (layoutSize.width * 0.5f + adjustedRowSpacing) + (adjustedLayoutPosition - 1.0f) * xStep;
- x += itemSize.y * 0.5f - layoutSize.width * 0.5f;
- }
-
- float z = adjustedLayoutPosition * (10.0f + scrollSpeedFactor);
- z -= std::min(3000.0f, scrollSpeedFactor * 2.0f);
-
- return Vector3(-x,
- itemSize.x * 0.5f - layoutSize.y * 0.5f,
- z);
- }
-
-public:
-
- float mRowSpacing;
- RollLayout::ItemSizeFunction mItemSizeFunction;
-};
-
-struct RollRotationConstraint0
-{
- Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- return Quaternion(0.0f, Vector3::ZAXIS);
- }
-};
-
-struct RollRotationConstraint90
-{
- Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- return Quaternion(1.5f * Math::PI, Vector3::ZAXIS);
- }
-};
-
-struct RollRotationConstraint180
-{
- Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- return Quaternion(Math::PI, Vector3::ZAXIS);
- }
-};
-
-struct RollRotationConstraint270
-{
- Quaternion operator()(const Quaternion& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- return Quaternion(0.5f * Math::PI, Vector3::ZAXIS);
- }
-};
-
-struct RollScaleConstraint
-{
- Vector3 operator()(const Vector3& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float adjustedLayoutPosition = layoutPosition;
- float factor = 0.0f;
- if(adjustedLayoutPosition < Math::MACHINE_EPSILON_0)
- {
- factor = fabsf(adjustedLayoutPosition);
- }
- if(adjustedLayoutPosition - 1.0f > Math::MACHINE_EPSILON_0)
- {
- factor = adjustedLayoutPosition - 1.0f;
- }
-
- float scale = std::min(1.0f, std::max(0.1f, 1.0f - 0.1f * factor));
- if(scrollSpeed > 0.0f)
- {
- scale *= std::min(1.0f, std::max(0.1f, 1.0f / (scrollSpeed * 0.05f)));
- }
-
- return Vector3(scale, scale, scale);
- }
-};
-
-struct RollColorConstraint
-{
- Vector4 operator()(const Vector4& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- float adjustedLayoutPosition = layoutPosition;
-
- float factor = 0.0f;
- if(adjustedLayoutPosition < Math::MACHINE_EPSILON_0)
- {
- factor = fabsf(adjustedLayoutPosition);
- }
- if(adjustedLayoutPosition - 1.0f > Math::MACHINE_EPSILON_0)
- {
- factor = adjustedLayoutPosition - 1.0f;
- }
-
- float darkness = std::min(1.0f, std::max(0.5f, 1.0f - 0.5f * factor));
- float alpha = std::min(1.0f, std::max(0.0f, 1.0f - 0.9f * factor));
- return Vector4(darkness, darkness, darkness, alpha);
- }
-};
-
-struct RollVisibilityConstraintPortrait
-{
- RollVisibilityConstraintPortrait(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction)
- : mRowSpacing(rowSpacing),
- mItemSizeFunction(itemSizeFunction)
- {
- }
-
- bool operator()(const bool& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- Vector3 itemSize = mItemSizeFunction(layoutSize.width, layoutSize.height, mRowSpacing);
- int rowsPerPage = ceil(layoutSize.height / (itemSize.y + mRowSpacing));
- return (layoutPosition > -rowsPerPage) && (layoutPosition < rowsPerPage);
- }
-
-public:
-
- float mRowSpacing;
- RollLayout::ItemSizeFunction mItemSizeFunction;
-};
-
-struct RollVisibilityConstraintLandscape
-{
- RollVisibilityConstraintLandscape(const float rowSpacing, RollLayout::ItemSizeFunction itemSizeFunction)
- : mRowSpacing(rowSpacing),
- mItemSizeFunction(itemSizeFunction)
- {
- }
-
- bool operator()(const bool& current, const float& layoutPosition, const float& scrollSpeed, const Vector3& layoutSize)
- {
- Vector3 itemSize = mItemSizeFunction(layoutSize.height, layoutSize.width, mRowSpacing);
- int rowsPerPage = ceil(layoutSize.width / (itemSize.y + mRowSpacing));
- return (layoutPosition + 2.0f > Math::MACHINE_EPSILON_0) && (layoutPosition < rowsPerPage);
- }
-
-public:
-
- float mRowSpacing;
- RollLayout::ItemSizeFunction mItemSizeFunction;
-};
-
-} // unnamed namespace
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-struct RollLayout::Impl
-{
- Impl()
- : mRowSpacing(DEFAULT_ROW_SPACING),
- mScrollSpeedFactor(DEFAULT_SCROLL_SPEED_FACTOR),
- mMaximumSwipeSpeed(DEFAULT_MAXIMUM_SWIPE_SPEED),
- mItemFlickAnimationDuration(DEFAULT_ITEM_FLICK_ANIMATION_DURATION),
- mItemSizeFunction(GetItemSizeDefaultFunction)
- {
- mScaleConstraint = RollScaleConstraint();
- mColorConstraint = RollColorConstraint();
-
- mRotationConstraint[0] = RollRotationConstraint0();
- mRotationConstraint[1] = RollRotationConstraint90();
- mRotationConstraint[2] = RollRotationConstraint180();
- mRotationConstraint[3] = RollRotationConstraint270();
- }
-
- float mRowSpacing;
-
- float mScrollSpeedFactor;
- float mMaximumSwipeSpeed;
- float mItemFlickAnimationDuration;
-
- ItemLayout::QuaternionFunction mRotationConstraint[ORIENTATION_COUNT];
- ItemLayout::Vector3Function mScaleConstraint;
- ItemLayout::Vector4Function mColorConstraint;
-
- ItemSizeFunction mItemSizeFunction;
-};
-
-RollLayoutPtr RollLayout::New()
-{
- return RollLayoutPtr(new RollLayout());
-}
-
-RollLayout::~RollLayout()
-{
- delete mImpl;
-}
-
-void RollLayout::SetRowSpacing(float spacing)
-{
- mImpl->mRowSpacing = spacing;
-}
-
-float RollLayout::GetRowSpacing() const
-{
- return mImpl->mRowSpacing;
-}
-
-void RollLayout::SetItemSizeFunction(ItemSizeFunction function)
-{
- mImpl->mItemSizeFunction = function;
-}
-
-RollLayout::ItemSizeFunction RollLayout::GetItemSizeFunction() const
-{
- return mImpl->mItemSizeFunction;
-}
-
-void RollLayout::SetScrollSpeedFactor(float scrollSpeed)
-{
- mImpl->mScrollSpeedFactor = scrollSpeed;
-}
-
-void RollLayout::SetMaximumSwipeSpeed(float speed)
-{
- mImpl->mMaximumSwipeSpeed = speed;
-}
-
-void RollLayout::SetItemFlickAnimationDuration(float durationSeconds)
-{
- mImpl->mItemFlickAnimationDuration = durationSeconds;
-}
-
-float RollLayout::GetScrollSpeedFactor() const
-{
- return mImpl->mScrollSpeedFactor;
-}
-
-float RollLayout::GetMaximumSwipeSpeed() const
-{
- return mImpl->mMaximumSwipeSpeed;
-}
-
-float RollLayout::GetItemFlickAnimationDuration() const
-{
- return mImpl->mItemFlickAnimationDuration;
-}
-
-float RollLayout::GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const
-{
- return 2.0f - static_cast<float>(numberOfItems);
-}
-
-float RollLayout::GetClosestAnchorPosition(float layoutPosition) const
-{
- return static_cast<float>(round(layoutPosition));
-}
-
-float RollLayout::GetItemScrollToPosition(unsigned int itemId) const
-{
- return 0.0f - static_cast<float>(itemId);
-}
-
-ItemRange RollLayout::GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const
-{
- float layoutWidth = IsHorizontal(mOrientation) ? layoutSize.height : layoutSize.width;
- float layoutHeight = IsHorizontal(mOrientation) ? layoutSize.width : layoutSize.height;
-
- Vector3 itemSize = mImpl->mItemSizeFunction( layoutWidth,layoutHeight, mImpl->mRowSpacing);
-
- float itemsPerPage = (layoutHeight / (itemSize.y + mImpl->mRowSpacing));
- if(firstItemPosition + 0.001f >= Math::MACHINE_EPSILON_0)
- {
- itemsPerPage = std::max(0.0f, itemsPerPage - 1.0f);
- }
- int firstVisibleItem = -(static_cast<int>(firstItemPosition));
-
- int firstItemIndex = std::max(0, firstVisibleItem);
- int lastItemIndex = std::max(0, static_cast<int>(ceil(firstVisibleItem + itemsPerPage - 1)));
- return ItemRange(firstItemIndex, lastItemIndex);
-}
-
-unsigned int RollLayout::GetReserveItemCount(Vector3 layoutSize) const
-{
- float layoutWidth = IsHorizontal(mOrientation) ? layoutSize.height : layoutSize.width;
- float layoutHeight = IsHorizontal(mOrientation) ? layoutSize.width : layoutSize.height;
-
- Vector3 itemSize = mImpl->mItemSizeFunction(layoutWidth, layoutHeight, mImpl->mRowSpacing);
- int itemsPerPage = ceil(layoutHeight / (itemSize.y + mImpl->mRowSpacing));
- return itemsPerPage * 5;
-}
-
-bool RollLayout::GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const
-{
- // Note: itemId is not checked, since every item has the same size
- float layoutWidth = IsHorizontal(mOrientation) ? layoutSize.height : layoutSize.width;
- float layoutHeight = IsHorizontal(mOrientation) ? layoutSize.width : layoutSize.height;
-
- itemSize = mImpl->mItemSizeFunction(layoutWidth, layoutHeight, mImpl->mRowSpacing);
-
- return true;
-}
-
-void RollLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const
-{
- if(animation)
- {
- animation.Resize(actor, size);
- }
-}
-
-bool RollLayout::GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const
-{
- if (mOrientation == ControlOrientation::Up)
- {
- constraint = RollPositionConstraint0(mImpl->mRowSpacing, mImpl->mItemSizeFunction);
- }
- else if (mOrientation == ControlOrientation::Left)
- {
- constraint = RollPositionConstraint90(mImpl->mRowSpacing, mImpl->mItemSizeFunction);
- }
- else if (mOrientation == ControlOrientation::Down)
- {
- constraint = RollPositionConstraint180(mImpl->mRowSpacing, mImpl->mItemSizeFunction);
- }
- else // mOrientation == ControlOrientation::Right
- {
- constraint = RollPositionConstraint270(mImpl->mRowSpacing, mImpl->mItemSizeFunction);
- }
-
- return true;
-}
-
-bool RollLayout::GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const
-{
- constraint = mImpl->mRotationConstraint[mOrientation];
- return true;
-}
-
-bool RollLayout::GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const
-{
- constraint = mImpl->mScaleConstraint;
- return true;
-}
-
-bool RollLayout::GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const
-{
- constraint = mImpl->mColorConstraint;
- return true;
-}
-
-bool RollLayout::GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const
-{
- if (IsVertical(mOrientation))
- {
- constraint = RollVisibilityConstraintPortrait(mImpl->mRowSpacing, mImpl->mItemSizeFunction);
- }
- else // horizontal
- {
- constraint = RollVisibilityConstraintLandscape(mImpl->mRowSpacing, mImpl->mItemSizeFunction);
- }
-
- return true;
-}
-
-Degree RollLayout::GetScrollDirection() const
-{
- Degree scrollDirection(0.0f);
-
- if (mOrientation == ControlOrientation::Up)
- {
- scrollDirection = 0.0f;
- }
- else if (mOrientation == ControlOrientation::Left)
- {
- scrollDirection = 90.0f;
- }
- else if (mOrientation == ControlOrientation::Down)
- {
- scrollDirection = 180.0f;
- }
- else // mOrientation == ControlOrientation::Right
- {
- scrollDirection = 270.0f;
- }
-
- return scrollDirection;
-}
-
-RollLayout::RollLayout()
-: mImpl(NULL)
-{
- mImpl = new Impl();
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_ROLL_LAYOUT_H__
-#define __DALI_TOOLKIT_ROLL_LAYOUT_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// INTERNAL INCLUDES
-
-#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-class RollLayout;
-
-typedef IntrusivePtr<RollLayout> RollLayoutPtr;
-
-/**
- * An ItemView layout which arranges items in a roll.
- */
-class DALI_IMPORT_API RollLayout : public ItemLayout
-{
-public:
-
- typedef boost::function<Vector3 (float layoutWidth, float layoutHeight, float rowSpacing)> ItemSizeFunction;
-
- /**
- * Create a new roll layout
- */
- static RollLayoutPtr New();
-
- /**
- * Virtual destructor.
- */
- virtual ~RollLayout();
-
- /**
- * Set the spacing between rows.
- * @param[in] spacing The row spacing.
- */
- void SetRowSpacing(float spacing);
-
- /**
- * Get the spacing between rows.
- * @return The row spacing.
- */
- float GetRowSpacing() const;
-
- /**
- * Set the function used to calculate the item-size, for a given layout-size.
- * @param[in] function The item-size function.
- */
- void SetItemSizeFunction(ItemSizeFunction function);
-
- /**
- * Get the function used to calculate the item-size.
- * @return The item-size function.
- */
- ItemSizeFunction GetItemSizeFunction() const;
-
- /**
- * Set the factor used to customise the scroll speed while dragging and swiping the layout.
- * @param[in] scrollSpeed The scroll speed factor.
- */
- void SetScrollSpeedFactor(float scrollSpeed);
-
- /**
- * Set the maximum swipe speed in pixels per second.
- * @param[in] speed The maximum swipe speed.
- */
- void SetMaximumSwipeSpeed(float speed);
-
- /**
- * Set the duration of the flick animation in second. This is the time taken to animate each
- * item to its next layout position (e.g. from 1.0 to 2.0) when a flick animation is triggered
- * by a swipe gesture.
- * @pre durationSeconds must be greater than zero.
- * @param[in] durationSeconds The duration of flick animation in seconds.
- */
- void SetItemFlickAnimationDuration(float durationSeconds);
-
- /**
- * @copydoc ItemLayout::GetScrollSpeedFactor()
- */
- virtual float GetScrollSpeedFactor() const;
-
- /**
- * @copydoc ItemLayout::GetMaximumSwipeSpeed()
- */
- virtual float GetMaximumSwipeSpeed() const;
-
- /**
- * @copydoc ItemLayout::GetItemFlickAnimationDuration()
- */
- virtual float GetItemFlickAnimationDuration() const;
-
-private:
-
- /**
- * @copydoc ItemLayout::GetMinimumLayoutPosition()
- */
- virtual float GetMinimumLayoutPosition(unsigned int numberOfItems, Vector3 layoutSize) const;
-
- /**
- * @copydoc ItemLayout::GetClosestAnchorPosition()
- */
- virtual float GetClosestAnchorPosition(float layoutPosition) const;
-
- /**
- * @copydoc ItemLayout::GetItemScrollToPosition()
- */
- virtual float GetItemScrollToPosition(unsigned int itemId) const;
-
- /**
- * @copydoc ItemLayout::GetItemsWithinArea()
- */
- virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) const;
-
- /**
- * @copydoc ItemLayout::GetReserveItemCount()
- */
- virtual unsigned int GetReserveItemCount(Vector3 layoutSize) const;
-
- /**
- * @copydoc ItemLayout::GetItemSize()
- */
- virtual bool GetItemSize(unsigned int itemId, Vector3 layoutSize, Vector3& itemSize) const;
-
- /**
- * @copydoc ItemLayout::GetResizeAnimation()
- */
- virtual void GetResizeAnimation(Animation& animation, Actor actor, Vector3 size, float durationSeconds) const;
-
- /**
- * @copydoc ItemLayout::GetPositionConstraint()
- */
- virtual bool GetPositionConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetRotationConstraint()
- */
- virtual bool GetRotationConstraint(unsigned int itemId, ItemLayout::QuaternionFunction& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetScaleConstraint()
- */
- virtual bool GetScaleConstraint(unsigned int itemId, ItemLayout::Vector3Function& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetColorConstraint()
- */
- virtual bool GetColorConstraint(unsigned int itemId, ItemLayout::Vector4Function& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetVisibilityConstraint()
- */
- virtual bool GetVisibilityConstraint(unsigned int itemId, ItemLayout::BoolFunction& constraint) const;
-
- /**
- * @copydoc ItemLayout::GetScrollDirection()
- */
- virtual Degree GetScrollDirection() const;
-
-protected:
-
- /**
- * Protected constructor; see also RollLayout::New()
- */
- RollLayout();
-
-private:
-
- struct Impl;
- Impl* mImpl;
-};
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_ROLL_LAYOUT_H__
$(public_api_src_dir)/controls/scrollable/item-view/item-factory.cpp \
$(public_api_src_dir)/controls/scrollable/item-view/item-layout.cpp \
$(public_api_src_dir)/controls/scrollable/item-view/item-view.cpp \
- $(public_api_src_dir)/controls/scrollable/item-view/navigation-layout.cpp \
- $(public_api_src_dir)/controls/scrollable/item-view/roll-layout.cpp \
$(public_api_src_dir)/controls/scrollable/item-view/spiral-layout.cpp \
$(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-carousel-effect.cpp \
$(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-constraints.cpp \
$(public_api_src_dir)/controls/scrollable/item-view/item-layout.h \
$(public_api_src_dir)/controls/scrollable/item-view/item-view-declarations.h \
$(public_api_src_dir)/controls/scrollable/item-view/item-view.h \
- $(public_api_src_dir)/controls/scrollable/item-view/navigation-layout.h \
- $(public_api_src_dir)/controls/scrollable/item-view/roll-layout.h \
$(public_api_src_dir)/controls/scrollable/item-view/spiral-layout.h
public_api_magnifier_header_files = \
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <sstream>
+
+using namespace Dali;
+
+namespace
+{
+
+// The name we will use to register our custom property by.
+const char* const TAG_PROPERTY_NAME = "tag-identifier";
+
+const char* const PUSHBUTTON_PRESS_IMAGE = DALI_IMAGE_DIR "button-down.9.png";
+const char* const PUSHBUTTON_BUTTON_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
+
+// Define the grid geometry.
+#define BUTTON_ROWS 9.0f
+#define BUTTON_COLUMNS 7.0f
+#define BUTTON_GAP 10.0f
+
+} // namespace
+
+/**
+ * This example shows how to register and look-up custom properties.
+ * A button grid is created, each with a new "tag" property which is set to a unique value.
+ * When pressed, the "tag" property is looked up to retrieve the unique value and display it.
+ */
+class PropertyButtonsController: public ConnectionTracker
+{
+ public:
+
+ PropertyButtonsController( Application& application )
+ {
+ // Connect to the Application's Init signal
+ application.InitSignal().Connect( this, &PropertyButtonsController::Create );
+ }
+
+ ~PropertyButtonsController()
+ {
+ }
+
+ void Create( Application& application )
+ {
+ // Setup precalculations for button size and start positions.
+ Toolkit::PushButton button;
+ int index = 0;
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ float buttonSize = ( stageSize.x - ( BUTTON_GAP * ( BUTTON_COLUMNS + 1 ) ) ) / BUTTON_COLUMNS;
+ float yStart = ( stageSize.y - ( ( buttonSize * BUTTON_ROWS ) + ( BUTTON_GAP * ( BUTTON_ROWS - 1 ) ) ) ) / 2.0f;
+
+ // Create a grid of buttons.
+ for( int y = 0; y < BUTTON_ROWS; ++y )
+ {
+ for( int x = 0; x < BUTTON_COLUMNS; ++x )
+ {
+ // Create a button and position it.
+ button = Toolkit::PushButton::New();
+ button.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ button.SetPosition( Vector3( BUTTON_GAP + ( x * ( buttonSize + BUTTON_GAP ) ), yStart + ( y * ( buttonSize + BUTTON_GAP ) ), 0.0f ) );
+ button.SetSize( Vector3( buttonSize, buttonSize, 0) );
+ button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
+ button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
+
+ // Label the button with a unique value.
+ std::stringstream label;
+ label << index;
+ button.SetLabel( label.str() );
+
+ // Register our custom property, and use it to store a unique number.
+ // Store the index to the property so we can look it up later.
+ // Note: This is much faster than looking the property up by name and should always be used if possible.
+ // As all our control types are the same (PushButtons) the indecies to our unique property is the same for each one.
+ Property::Value tag = ( float )index;
+ mTagPropertyIndex = button.RegisterProperty( TAG_PROPERTY_NAME, tag );
+
+ // Hook a callback when the button is clicked.
+ button.ClickedSignal().Connect( this, &PropertyButtonsController::OnButtonClicked );
+
+ // Add the button to the stage.
+ Stage::GetCurrent().Add( button );
+ index++;
+ }
+ }
+
+ // Create the last selected button text view.
+ mTagText = Toolkit::TextView::New( "None selected" );
+ mTagText.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
+ mTagText.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
+ mTagText.SetPosition( Vector3( 0.0f, -30.0f, 0.0f ) );
+ Stage::GetCurrent().Add( mTagText );
+ }
+
+ /**
+ * Called when any button within the grid is clicked.
+ * param[in] The clicked button control
+ * return Set to true if the signal was consumed correctly
+ */
+ bool OnButtonClicked( Toolkit::Button button )
+ {
+ std::stringstream valueText;
+ // Look up the tag property by the cached property index.
+ // Note: If the property belongs to a control in another library, or we do not know the index, we can look the index up first with:
+ // Property::Index index = button.GetPropertyIndex( TAG_PROPERTY_NAME );
+ valueText << "Selected: " << button.GetProperty< float >( mTagPropertyIndex );
+
+ mTagText.SetText( valueText.str() );
+
+ return true;
+ }
+
+ private:
+
+ Toolkit::TextView mTagText; ///< A text label used to show the last button pressed.
+ Property::Index mTagPropertyIndex; ///< A cached property index of our custom tag property.
+};
+
+// Entry point for applications.
+int main( int argc, char **argv )
+{
+ Application application = Application::New( &argc, &argv );
+
+ PropertyButtonsController test( application );
+ application.MainLoop();
+
+ return 0;
+}
*
* @code
* Dali::Actor actor;
- * actor.SetRotation(Quaternion(Radian(Degree(45.0f)).value, Vector3::XAXIS)),
+ * actor.SetOrientation(Quaternion(Radian(Degree(45.0f)).value, Vector3::XAXIS)),
*
* Quaternion q(Radian(Degree(30.0f)).value, Vector3(1.0f, 1.0f, 0.0f));
* actor.RotateBy(q);
* $ dali-demo
* $
* $ ...
- * $ I/DALI ( 5692): slp-logging.cpp: LogMessage(40) > Update , min 0.59 ms, max 6.43 ms, total (3.4 secs), avg 1.26 ms
- * $ I/DALI ( 5692): slp-logging.cpp: LogMessage(40) > Render , min 1.67 ms, max 5.01 ms, total (4.5 secs), avg 3.71 ms
+ * $ I/DALI ( 5692): tizen-logging.cpp: LogMessage(40) > Update , min 0.59 ms, max 6.43 ms, total (3.4 secs), avg 1.26 ms
+ * $ I/DALI ( 5692): tizen-logging.cpp: LogMessage(40) > Render , min 1.67 ms, max 5.01 ms, total (4.5 secs), avg 3.71 ms
* \endcode
*
* If nothing is animating Dali will enter a paused state to save power. At this
/*! \page properties Properties
*
+@section what-is-a-property What is a property?
+
+A property is a value used by an object that can be modified or read externally to that object.
+This could be from within Dali or externally by an application.
+
+<h2 class="pg">What is a property used for?</h2>
+
+Properties can be set externally by an application, allowing that application to change the configuration or behaviour of an actor.
+This could include the physical geometry of the actor, or how it is drawn or moves.
+
+Properties can also be read. This feature can be used in conjunction with constraints to allow changes to a property within one actor to cause changes to the property of another actor. For example, an actor following the movement of another separate actor (that it is not a child of).
+
+Properties can be used to expose any useful information or behaviour of an actor.
+Other actor variables that are used to implement this bevahiour, or do not make useful sense from an application developers point of view should not be exposed.
+
+<h2 class="pg">How to implement a property within Dali-core:</h2>
+
+<b>There are two stages:</b>
+
+- Define the properties as an enum in the public-api header file.
+- Define the property details using the pre-defined macros to build up a table of property information.
+
+There are some pre-defined macros designed to help with and standardise the definition of the propery details table per class.
+
+These macros generate an array of property details which allow efficient lookup of flags like "animatable" or "constraint input".
+
+<b>Example: ImageActor</b>
+
+Within the public-api header file; image-actor.h:
+
+@code
+/**
+ * @brief An enumeration of properties belonging to the ImageActor class.
+ * Properties additional to RenderableActor.
+ */
+struct Property
+{
+ enum
+ {
+ PIXEL_AREA = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, ///< name "pixel-area", type Rect<int>
+ STYLE, ///< name "style", type std::string
+ BORDER, ///< name "border", type Vector4
+ IMAGE, ///< name "image", type Map {"filename":"", "load-policy":...}
+ };
+};
+@endcode
+From @ref Dali::ImageActor::Property
+
+<b>Notes:</b>
+
+- The properties are enumerated within a named struct to give them a namespace.
+- The properties are then refered to as <OBJECT>::%Property::<PROPERTY_NAME>.
+
+Within the internal implementation; <b>image-actor-impl.cpp</b>:
+
+@code
+namespace // Unnamed namespace
+{
+
+// Properties
+
+// Name Type writable animatable constraint-input enum for index-checking
+DALI_PROPERTY_TABLE_BEGIN
+DALI_PROPERTY( "pixel-area", RECTANGLE, true, false, true, Dali::ImageActor::Property::PIXEL_AREA )
+DALI_PROPERTY( "style", STRING, true, false, true, Dali::ImageActor::Property::STYLE )
+DALI_PROPERTY( "border", VECTOR4, true, false, true, Dali::ImageActor::Property::BORDER )
+DALI_PROPERTY( "image", MAP, true, false, false, Dali::ImageActor::Property::IMAGE )
+DALI_PROPERTY_TABLE_END( DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX )
+@endcode
+
+<b>Notes:</b>
+
+- The table lays within an unnamed namespace.
+- The table should be in the same order as the enum.
+- The table should be the only place where the text names of the properties are defined.
+- The information in the table should be used within the classes IsDefaultPropertyWritable / Animatable / ConstraintInput methods for quick lookup.
+- The last entry in the table is optionally used in debug builds for index checking.
+- The parameter to DALI_PROPERTY_TABLE_END should match the start index of the property enumeration.
+
+<br>
+<h2 class="pg">How to implement a property within Dali-toolkit:</h2>
+
+Note that toolkit properties have extra limitations in that they cannot be animated or used as a constraint input. For this reason there is no requirement for a table of property details.
+Macros are still used to define properties, but for the following reasons:
+
+To standardise the way properties are defined.
+To handle type-registering for properties, signals and actions in one place.
+To facilitate the posibility of running the code with the type-registry disabled.
+
+<b>There are two stages:</b>
+
+- Define the properties as an enum in the public-api header file, along with a definition of the property ranges.
+- Define the property details using the pre-defined macros to perform the type-registering of the properties. This is done for signals and actions also.
+
+<b>Example: Button</b>
+
+Source file: <b>button.h</b>:
+Note that the “PropertyRange” contents “PROPERTY_START_INDEX” is also used by the macro for order checking.
+
+@code
+ /**
+ * @brief The start and end property ranges for this control.
+ */
+ enum PropertyRange
+ {
+ PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
+ };
+
+ /**
+ * @brief An enumeration of properties belonging to the Button class.
+ */
+ struct Property
+ {
+ enum
+ {
+ DISABLED = PROPERTY_START_INDEX, ///< name "disabled", @see SetDisabled(), type bool
+ AUTO_REPEATING, ///< name "auto-repeating", @see SetAutoRepeating(), type bool
+ INITIAL_AUTO_REPEATING_DELAY, ///< name "initial-auto-repeating-delay", @see SetInitialAutoRepeatingDelay(), type float
+ NEXT_AUTO_REPEATING_DELAY, ///< name "next-auto-repeating-delay", @see SetNextAutoRepeatingDelay(), type float
+ TOGGLABLE, ///< name "togglable", @see SetTogglableButton(), type bool
+ SELECTED, ///< name "selected", @see SetSelected(), type bool
+ NORMAL_STATE_ACTOR, ///< name "normal-state-actor", @see SetButtonImage(), type Map
+ SELECTED_STATE_ACTOR, ///< name "selected-state-actor", @see SetSelectedImage(), type Map
+ DISABLED_STATE_ACTOR, ///< name "disabled-state-actor", @see SetDisabledImage(), type Map
+ LABEL_ACTOR, ///< name "label-actor", @see SetLabel(), type Map
+ };
+ };
+@endcode
+
+Source file: <b>button-impl.cpp</b>, within an unnamed namespace:
+
+@clip{"button-impl.cpp",DALI_TYPE_REGISTRATION_BEGIN,DALI_TYPE_REGISTRATION_END}
+
+<b>Notes:</b>
+
+- The “Create” parameter to the begin macro is the function pointer to the creation function.
+- Properties should be in the same order as in the enum.
+- Signals and actions are registered likewise in that order.
+- Properties type-registered using these macros will have their order checked at compile time. If you get an indexing compile error, check the order matches the enum order.
+
+
+<br>
+<hr>
@section property-indices Property Indices
+The properties are enumerated to give them a unique index. This index can be used to access them.
+The indecies must be unique per flattened derivation heirachy.
+EG:
+- CameraActor derives from Actor. No property indicies in either CameraActor or Actor should collide with each other.
+- ActiveConstraintBase derives from Object. It CAN have property indices that match Actor or CameraActor.
+
+There are some predefined start indecies and ranges that should be used for common cases, these are defined below:
+
+
DALi has a property system and provides several different kinds of properties. The following table
shows the index range of the different properties in place.
<table>
- <tr> <td><b>Kind</b></td> <td><b>Description</b></td> <td style="text-align:center;"><b>Range</b></td> </tr>
- <tr> <td>Default</td> <td>Properties defined within DALi Core, e.g. Dali::Actor, Dali::ShaderEffect default properties etc.</td> <td style="text-align:center;">0 to 9999999</td> </tr>
- <tr> <td>Registered</td> <td>Properties registered using Dali::PropertyRegistration</td> <td style="text-align:center;">10000000 to 19999999</td> </tr>
- <tr> <td>Control</td> <td>Property range reserved by Dali::Toolkit::Control</td> <td style="text-align:center;">10000000 to 10001000<br>
- \link Dali::Toolkit::Control::CONTROL_PROPERTY_START_INDEX CONTROL_PROPERTY_START_INDEX\endlink
- to \link Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX CONTROL_PROPERTY_END_INDEX\endlink</td> </tr>
- <tr> <td>Derived Control</td> <td>Property range for control deriving directly from Dali::Toolkit::Control</td> <td style="text-align:center;">10001001 to 19999999</td> </tr>
- <tr> <td>Custom</td> <td>Custom properties added to instance using Dali::Handle::RegisterProperty</td> <td style="text-align:center;">50000000 onwards</td> </tr>
+ <tr> <td><b>Kind</b></td> <td><b>Description</b></td> <td style="text-align:center;"><b>Start Index</b></td><td><b>End Index</b></td> </tr>
+ <tr> <td>Default</td> <td>Properties defined within DALi Core, e.g. Dali::Actor, Dali::ShaderEffect default properties etc.</td> <td style="text-align:center;">\link Dali::DEFAULT_OBJECT_PROPERTY_START_INDEX DEFAULT_OBJECT_PROPERTY_START_INDEX\endlink (0)</td><td>9999999</td> </tr>
+ <tr> <td>Registered</td> <td>Properties registered using Dali::PropertyRegistration</td> <td style="text-align:center;">\link Dali::PROPERTY_REGISTRATION_START_INDEX PROPERTY_REGISTRATION_START_INDEX\endlink (10000000)</td><td>\link Dali::PROPERTY_REGISTRATION_MAX_INDEX PROPERTY_REGISTRATION_MAX_INDEX\endlink (19999999)</td> </tr>
+ <tr> <td>Control</td> <td>Property range reserved by Dali::Toolkit::Control</td> <td style="text-align:center;">\link Dali::Toolkit::Control::CONTROL_PROPERTY_START_INDEX CONTROL_PROPERTY_START_INDEX\endlink (10000000)</td><td>
+ \link Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX CONTROL_PROPERTY_END_INDEX\endlink (10001000)</td></tr>
+ <tr> <td>Derived Control</td> <td>Property range for control deriving directly from Dali::Toolkit::Control</td> <td style="text-align:center;">10001001</td><td>\link Dali::PROPERTY_REGISTRATION_MAX_INDEX PROPERTY_REGISTRATION_MAX_INDEX\endlink (19999999)</td> </tr>
+ <tr> <td>Custom</td> <td>Custom properties added to instance using Dali::Handle::RegisterProperty</td> <td style="text-align:center;">\link Dali::PROPERTY_CUSTOM_START_INDEX PROPERTY_CUSTOM_START_INDEX\endlink (50000000)</td><td>Onwards...</td> </tr>
</table>
+
+<br>
+<hr>
+@section property-use-example-cpp Property use example C++
+
+Common uses for properties are constraints and animations.
+
+An application developer can use an existing property, or, if necessary, register their own.
+
+Here is a code example.
+
+This example shows how to register and look-up custom properties.
+A grid of buttons is created, each with a new "tag" property which is set to a unique value. The index to this property is cached for later use.
+When pressed, the property is looked up by index (as this is much faster than a text lookup of the property name).
+
+Property lookup via index should always be used unless the indecies cannot be known. If the property reader was completely decoupled from the creation, EG. A custom control with a custom property being used by external application code, then it may be necessary. In this case the application writer should aim to perform the text lookup once at start-up, and cache the property index locally.
+
+@clip{"property-example.cpp", void Create, return true;}
+
+Once run, a grid of buttons will appear. When a button is pressed, the unique number stored in the property (in this case the index) is displayed at the bottom of the screen.
+
+<br>
+<hr>
+@section property-use-example-js Property use in JavaScript
+
+Note that constraints cannot be used within JavaScript, so below is a simple example that sets one of the default properties; scale:
+
+@code
+var image = new dali.ResourceImage( {url:"background.png"} );
+var imageActor = new dali.ImageActor( image );
+
+// by default an actor is anchored to the top-left of it's parent actor
+// change it to the middle
+imageActor.parentOrigin = dali.CENTER;
+
+// scale it up by 2 times in x,y
+imageActor.scale = [ 2, 2, 1 ];
+
+// add to the stage
+dali.stage.add( imageActor );
+@endcode
+
+For a more detailed example see the ShaderEffect example in the JavaScript documentation.
+
+<br>
+<hr>
+@section property-use-example-json Property use in JSON
+
+This is a basic example of a button defined in JSON by setting the default properties.
+
+@code
+{
+ "constants": {
+ "CONFIG_SCRIPT_LOG_LEVEL": "Verbose"
+ },
+ "stage": [
+ // First Button
+ {
+ "type": "PushButton",
+ "parent-origin": "TOP_CENTER",
+ "anchor-point": "TOP_CENTER",
+ "position": [0, 0, 0],
+ "size": [0, 200, 0],
+ "normal-state-actor": {
+ "type": "ImageActor",
+ "image": {
+ "filename": "{DALI_IMAGE_DIR}blocks-brick-1.png"
+ }
+ },
+ "selected-state-actor": {
+ "type": "ImageActor",
+ "image": {
+ "filename": "{DALI_IMAGE_DIR}blocks-brick-2.png"
+ }
+ },
+ "label-actor": {
+ "type": "TextView",
+ "text": "Normal"
+ }
+ }
+ ]
+}
+@endcode
+
*
*/
--- /dev/null
+/**
+ *
+## Writing documentation for the DALi programing guide
+
+To allow documentation to be shared between C++ and JavaScript, please follow these guidelines:
+
+ - Create a mark down file (.md) using GitHub Flavoured Markdown https://help.github.com/articles/github-flavored-markdown/
+ - Put it into the shared C++ / JavaScript documentation: ~dali-toolkit/docs/content/shared-javascript-and-cpp-documentation/~
+ - Include code samples for both C++ and JavaScript in the mark down.
+ - See multi-touch-guide.md in toolkit for an example
+
+Why use GitHub flavoured markdown?
+ - Table support is good and language specific code blocks are easier to define ( javascript/C++).
+ - Doxygen and YUIDOC both support it.
+
+
+@class Writing_DALi_Programming_Guide_Documentation
+*/
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
- * @type dali Rotation object
+ * Actors orientation
+ * @property orientation
+ * @type dali orientation object
*/
-ROTATION
+ORIENTATION
/**
- * Actors world-rotation
- * @property worldRotation
- * @type dali Rotation object ( read only)
+ * Actors world-orientation
+ * @property worldOrientation
+ * @type dali Orientation 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,
/**
* @type Vector3
* @property sizeModeFactor
*/
-SIZE_MODE_FACTOR
\ No newline at end of file
+SIZE_MODE_FACTOR
There are two types of camera actor, FREE_LOOK and LOOK_AT_TARGET. By default
the camera actor will be FREE_LOOK.
-A FREE_LOOK camera uses actor's rotation to control where the camera is looking.
+A FREE_LOOK camera uses actor's orientation to control where the camera is looking.
If no additional rotations are specified, the camera looks in the negative Z direction.
-For LOOK_AT_TARGET the actor's rotation is ignored, instead the camera looks at TARGET_POSITION
+For LOOK_AT_TARGET the actor's orientation is ignored, instead the camera looks at TARGET_POSITION
in world coordinates.
```
// get the camera currently used
* @example
*
* // using an array
- * actor.moveBy( [20,40,0] );
+ * actor.translateBy( [20,40,0] );
*
* @for Actor
- * @method moveBy
+ * @method translateBy
* @param {object} an array of 3 numbers
*/
-void ActorApi::MoveBy( const v8::FunctionCallbackInfo<v8::Value>& args )
+void ActorApi::TranslateBy( const v8::FunctionCallbackInfo<v8::Value>& args )
{
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope handleScope( isolate );
DALI_SCRIPT_EXCEPTION( isolate, "Vector3 move parameter missing" );
return;
}
- actor.MoveBy( vector );
+ actor.TranslateBy( vector );
}
bool found( false );
Property::Value rotation = V8Utils::GetPropertyValueParameter( PARAMETER_0, found, isolate, args );
- if( rotation.GetType() != Property::ROTATION )
+ if( rotation.GetType() != Property::ORIENTATION )
{
DALI_SCRIPT_EXCEPTION( isolate, "Rotation parameter missing" );
return;
}
actor.ScaleBy( vector );
}
-/**
- * Apply a relative scale to an actor.
- * Actor opacity ranges from 0 (see through ) to 1 ( solid )
- * @example
- * // reduce actor opactiy by a half
- * actor.opaictyBy(-0.5);
- *
- * @for Actor
- * @method OpacityBy
- * @param {float} relative opacity
- */
-void ActorApi::OpacityBy( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
- Actor actor = GetActor( isolate, args );
-
- // void OpacityBy(float relativeOpacity);
- bool found;
- float opacity = V8Utils::GetFloatParameter( PARAMETER_0, found, isolate, args, 0.f );
- if( !found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "float parameter missing" );
- return;
- }
- actor.OpacityBy( opacity );
-}
-
-/**
- * Apply a relative color change to an actor.
- *
- * @example
- * // increase actor red by half
- * actor.colorBy( [0.5, 0, 0, 0]);
- *
- *
- * @for Actor
- * @method colorBy
- * @param {Object} Color JavaScript array
- */
-void ActorApi::ColorBy( const v8::FunctionCallbackInfo<v8::Value>& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
- Actor actor = GetActor( isolate, args );
-
- bool found;
- int argCount( args.Length() );
- Vector4 color;
-
- if( argCount == 1 )
- {
- color = V8Utils::GetVector4Parameter( PARAMETER_0, found, isolate, args );
- if( !found )
- {
- DALI_SCRIPT_EXCEPTION( isolate, "Vector4 parameter missing" );
- return;
- }
- }
- else
- {
- DALI_SCRIPT_EXCEPTION( isolate, "Vector4 parameter missing" );
- return;
- }
-
- actor.ColorBy( color );
-}
-
} // namespace V8Plugin
void ScreenToLocal( const v8::FunctionCallbackInfo< v8::Value >& args );
void SetKeyboardFocusable( const v8::FunctionCallbackInfo< v8::Value >& args );
void IsKeyboardFocusable( const v8::FunctionCallbackInfo< v8::Value >& args );
- void MoveBy( const v8::FunctionCallbackInfo< v8::Value >& args );
+ void TranslateBy( const v8::FunctionCallbackInfo< v8::Value >& args );
void RotateBy( const v8::FunctionCallbackInfo< v8::Value >& args );
void ScaleBy( const v8::FunctionCallbackInfo< v8::Value >& args );
- void OpacityBy( const v8::FunctionCallbackInfo< v8::Value >& args );
- void ColorBy( const v8::FunctionCallbackInfo< v8::Value >& args );
// new function just for JavaScript API, to help developers know what type of actor
// they're dealing with, returns actor name as a string
// ignore. GetCurrentSize() use Actor.size
// ignore. SetPosition(....) use Actor.position
// ignore. SetX, SetY, SetZ, use Actor.position.x, Actor.position.y, Actor.position.z
- { "MoveBy", ActorApi::MoveBy, ACTOR_API },
+ { "TranslateBy", ActorApi::TranslateBy, ACTOR_API },
// ignore GetCurrentPosition(). use Actor.position
// ignore GetCurrentWorldPosition() use Actor.worldPosition
// ignore SetPositionInheritanceMode() use Actor.positionInheritance
// ignore GetPositionInheritanceMode() use Actor.positionInheritance
- // ignore SetRotation() use Actor.rotation
+ // ignore SetOrientation() use Actor.orientation
{ "RotateBy", ActorApi::RotateBy, ACTOR_API },
- // ignore GetCurrentRotation() use Actor.rotation
- // ignore SetInheritRotation() use Actor.inheritRotation
- // ignore IsRotationInherited() use Actor.inheritRotation
- // ignore GetCurrentWorldRotation() use Actor.worldRotation
+ // ignore GetCurrentOrientation() use Actor.orientation
+ // ignore SetInheritOrientation() use Actor.inheritOrientation
+ // ignore IsOrientationInherited() use Actor.inheritOrientation
+ // ignore GetCurrentWorldOrientation() use Actor.worldOrientation
// ignore SetScale() use Actor.scale
{ "ScaleBy", ActorApi::ScaleBy, ACTOR_API },
// ignore GetCurrentScale() use Actor.scale
// ignore SetVisible() use Actor.visible
// ignore IsVisible() use Actor.visible
// ignore SetOpacity() use Actor.opacity
- { "OpactiyBy", ActorApi::OpacityBy, ACTOR_API },
// ignore GetCurrentOpacity() use Actor.opacity
// ignore SetColor() use Actor.color
- { "ColorBy", ActorApi::ColorBy, ACTOR_API },
// ignore GetCurrentColor() use Actor.color
// ignore SetColorMode() use Actor.colorMode
// ignore GetColorMode() use Actor.colorMode
*
*
* // ImageActor.js
- * function ImageActor( position, rotation, image, name )
+ * function ImageActor( position, orientation, image, name )
* {
* this = new dali.ImageActor( image );
* this.position = position;
- * this.rotation = rotation;
+ * this.orientation = orientation;
* this.name = name;
* }
* module.exports = ImageActor;
*
* var ImageActor = require(" ImageActor.js");
*
- * var imageActor = new ImageActor( position, rotation, image, "my first image actor");
+ * var imageActor = new ImageActor( position, orientation, image, "my first image actor");
*
* #### Exporting as a singleton
*