#include <dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
+
using namespace Dali;
using namespace Toolkit;
END_TEST;
}
+int UtcDaliItemLayoutSetAndGetLayoutProperties(void)
+{
+ ToolkitTestApplication application;
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+
+ // Set the property of the grid layout
+ Property::Map gridLayoutProperty;
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::GRID) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(200, 200,50)) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ROW_SPACING, Dali::Property::Value(50.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_NUMBER, Dali::Property::Value(4) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_SPACING, Dali::Property::Value(50.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_TOP_MARGIN, Dali::Property::Value(95.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_BOTTOM_MARGIN, Dali::Property::Value(20.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_SIDE_MARGIN, Dali::Property::Value(20.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_SCROLL_SPEED_FACTOR, Dali::Property::Value(0.03f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ITEM_FLICK_ANIMATION_DURATION, Dali::Property::Value(0.015f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_MAXIMUM_SWIPE_SPEED, Dali::Property::Value(100.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::ORIENTATION, Dali::Property::Value((int)ControlOrientation::Up) );
+ gridLayout->SetLayoutProperties(gridLayoutProperty);
+
+ view.AddLayout(*gridLayout);
+ ItemLayoutPtr layout = view.GetLayout(0);
+ DALI_TEST_CHECK(gridLayout == layout);
+ Property::Map firstLayout = gridLayout->GetLayoutProperties();
+
+ //Check all the properties of grid layout
+ DALI_TEST_EQUALS( gridLayoutProperty.Count(), firstLayout.Count(), TEST_LOCATION );
+
+ for( unsigned int mapIdx = 0, mapCount = firstLayout.Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( firstLayout.GetKeyValue( mapIdx ) );
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::GRID, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
+ {
+ Vector3 size = propertyPair.second.Get<Vector3>();
+ DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ROW_SPACING)
+ {
+ float rowSpacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS( rowSpacing, 50.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_NUMBER)
+ {
+ int number = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS(number, 4, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_SPACING)
+ {
+ float columnSpacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(columnSpacing, 50.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_TOP_MARGIN)
+ {
+ float topMargin = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(topMargin, 95.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_BOTTOM_MARGIN)
+ {
+ float bottomMargin = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(bottomMargin, 20.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_SIDE_MARGIN)
+ {
+ float sideMargin = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(sideMargin, 20.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_SCROLL_SPEED_FACTOR)
+ {
+ float scrollSpeedFactor = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(scrollSpeedFactor, 0.03f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ITEM_FLICK_ANIMATION_DURATION)
+ {
+ float animationDuration = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(animationDuration, 0.015f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_MAXIMUM_SWIPE_SPEED)
+ {
+ float swipSpeed = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(swipSpeed, 100.0f, TEST_LOCATION );
+ }
+ }
+ ItemLayoutPtr depthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
+
+ // Set the property of the depth layout
+ Property::Map depthLayoutProperty;
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::DEPTH) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER, Dali::Property::Value(3) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_NUMBER, Dali::Property::Value(26.0f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_SPACING, Dali::Property::Value(55.0f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_TILT_ANGLE, Dali::Property::Value(Math::PI*0.15f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ITEM_TILT_ANGLE, Dali::Property::Value(-Math::PI*0.025f ) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_SCROLL_SPEED_FACTOR, Dali::Property::Value(0.02f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ITEM_FLICK_ANIMATION_DURATION, Dali::Property::Value(0.03f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_MAXIMUM_SWIPE_SPEED, Dali::Property::Value(50.0f) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::ORIENTATION, Dali::Property::Value((int)ControlOrientation::Up) );
+ depthLayout->SetLayoutProperties(depthLayoutProperty);
+
+ view.AddLayout(*depthLayout);
+ layout = view.GetLayout(1);
+ DALI_TEST_CHECK(depthLayout == layout);
+
+ Property::Map secondLayout = depthLayout->GetLayoutProperties();
+
+ //Check all the properties of grid layout
+ DALI_TEST_EQUALS( depthLayoutProperty.Count(), secondLayout.Count(), TEST_LOCATION );
+ for( unsigned int mapIdx = 0, mapCount = secondLayout.Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( secondLayout.GetKeyValue( mapIdx ) );
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::DEPTH, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ORIENTATION)
+ {
+ int orientation = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS(orientation, (int)ControlOrientation::Up, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
+ {
+ Vector3 size = propertyPair.second.Get<Vector3>();
+ DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
+ }
+
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER)
+ {
+ int columnNumber = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( columnNumber, 3, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ROW_NUMBER)
+ {
+ float rowNumber = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(rowNumber, 26.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ROW_SPACING)
+ {
+ float rowSpacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(rowSpacing, 55.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_TILT_ANGLE)
+ {
+ float tiltAngle = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(tiltAngle, Math::PI*0.15f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ITEM_TILT_ANGLE)
+ {
+ float itemTiltAngle = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(itemTiltAngle, -Math::PI*0.025f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_SCROLL_SPEED_FACTOR)
+ {
+ float scrollSpeedFactor = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(scrollSpeedFactor, 0.02f, TEST_LOCATION );
+ }
+
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_ITEM_FLICK_ANIMATION_DURATION)
+ {
+ float animationDuration = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(animationDuration, 0.03f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::DEPTH_MAXIMUM_SWIPE_SPEED)
+ {
+ float swipSpeed = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(swipSpeed, 50.0f, TEST_LOCATION );
+ }
+ }
+ ItemLayoutPtr spiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
+
+ // Set the property of the spiral layout
+ Property::Map spiralLayoutPrperty;
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::SPIRAL) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING, Dali::Property::Value((Math::PI*2.0f)/9.5f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT, Dali::Property::Value(-0.125f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_REVOLUTION_DISTANCE, Dali::Property::Value(190.0f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_SCROLL_SPEED_FACTOR, Dali::Property::Value(0.01f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_FLICK_ANIMATION_DURATION, Dali::Property::Value(0.1f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_MAXIMUM_SWIPE_SPEED, Dali::Property::Value(30.0f) );
+ spiralLayout->SetLayoutProperties(spiralLayoutPrperty);
+
+ view.AddLayout(*spiralLayout);
+ layout = view.GetLayout(2);
+ DALI_TEST_CHECK(spiralLayout == layout);
+
+ Property::Map thridLayout = spiralLayout->GetLayoutProperties();
+
+ //Check all the properties of grid layout
+ DALI_TEST_EQUALS( spiralLayoutPrperty.Count(), thridLayout.Count(), TEST_LOCATION );
+
+ for( unsigned int mapIdx = 0, mapCount = thridLayout.Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( thridLayout.GetKeyValue( mapIdx ) );
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::SPIRAL, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING)
+ {
+ float columnNumber = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS( columnNumber, (Math::PI*2.0f)/9.5f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT)
+ {
+ float rowNumber = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(rowNumber, -0.125f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_REVOLUTION_DISTANCE)
+ {
+ float rowSpacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(rowSpacing, 190.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_SCROLL_SPEED_FACTOR)
+ {
+ float scrollSpeedFactor = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(scrollSpeedFactor, 0.01f, TEST_LOCATION );
+ }
+
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_ITEM_FLICK_ANIMATION_DURATION)
+ {
+ float animationDuration = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(animationDuration, 0.1f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::SPIRAL_MAXIMUM_SWIPE_SPEED)
+ {
+ float swipSpeed = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS(swipSpeed, 30.0f, TEST_LOCATION );
+ }
+ }
+ Dali::Stage stage = Dali::Stage::GetCurrent();
+ Vector3 stageSize(stage.GetSize());
+ view.ActivateLayout(0, stageSize, 0.5f);
+ view.ActivateLayout(1, stageSize, 0.5f);
+ view.ActivateLayout(2, stageSize, 0.5f);
+ END_TEST;
+
+}
+
+int UtcDaliItemLayoutSetandGetLayoutChangedFlag(void)
+{
+ ToolkitTestApplication application;
+
+ TestItemLayoutPtr layout = TestItemLayout::New();
+ DALI_TEST_CHECK( layout );
+ layout->ResetLayoutChangedFlag();
+ DALI_TEST_CHECK(layout->HasLayoutChanged() == false);
+
+ END_TEST;
+}
+
int UtcDaliItemRangeIntersection(void)
{
ToolkitTestApplication application;
#include <dali-toolkit/dali-toolkit.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/pan-gesture-event.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/item-view-devel.h>
using namespace Dali;
view.SetProperty( ItemView::Property::REFRESH_INTERVAL, 11.0f );
DALI_TEST_EQUALS( view.GetProperty(ItemView::Property::REFRESH_INTERVAL).Get<float>(), 11.0f, TEST_LOCATION );
+ // Test "layout" property
+ DALI_TEST_CHECK( view.GetPropertyIndex("layout") == DevelItemView::Property::LAYOUT );
+ Property::Map gridLayoutProperty;
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::GRID) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(200, 200,50)) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_ROW_SPACING, Dali::Property::Value(50.0f) );
+ gridLayoutProperty.Insert( DefaultItemLayoutProperty::GRID_COLUMN_NUMBER, Dali::Property::Value(4) );
+
+ Property::Map depthLayoutProperty;
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::DEPTH) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER, Dali::Property::Value(3) );
+ depthLayoutProperty.Insert( DefaultItemLayoutProperty::DEPTH_ROW_NUMBER, Dali::Property::Value(26.0f) );
+
+ Property::Map spiralLayoutPrperty;
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::SPIRAL) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING, Dali::Property::Value((Math::PI*2.0f)/9.5f) );
+ spiralLayoutPrperty.Insert( DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT, Dali::Property::Value(-0.125f) );
+
+ Property::Map listLayoutPrperty;
+ listLayoutPrperty.Insert( DefaultItemLayoutProperty::TYPE, Dali::Property::Value((int)DefaultItemLayout::LIST) );
+ listLayoutPrperty.Insert( DefaultItemLayoutProperty::ITEM_SIZE, Dali::Property::Value(Vector3(100, 100,50)) );
+
+
+ Property::Array layoutArray;
+ layoutArray.PushBack(gridLayoutProperty);
+ layoutArray.PushBack(depthLayoutProperty);
+ layoutArray.PushBack(spiralLayoutPrperty);
+ layoutArray.PushBack(listLayoutPrperty);
+
+ view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray);
+
+ Property::Array getLayoutArray;
+ DALI_TEST_CHECK( view.GetProperty(DevelItemView::Property::LAYOUT ).Get( getLayoutArray ) );
+
+ //Check that the result is the same as
+ DALI_TEST_EQUALS( layoutArray.Count(), getLayoutArray.Count(), TEST_LOCATION );
+ Property::Map firstLayout = *((getLayoutArray.GetElementAt( 0 )).GetMap());
+
+ for( unsigned int mapIdx = 0, mapCount = firstLayout.Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( firstLayout.GetKeyValue( mapIdx ) );
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS( layoutType, (int)DefaultItemLayout::GRID, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
+ {
+ Vector3 size = propertyPair.second.Get<Vector3>();
+ DALI_TEST_EQUALS( size, Vector3(200, 200,50), TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_ROW_SPACING)
+ {
+ float spacing = propertyPair.second.Get<float>();
+ DALI_TEST_EQUALS( spacing, 50.0f, TEST_LOCATION );
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::GRID_COLUMN_NUMBER)
+ {
+ int number = propertyPair.second.Get<int>();
+ DALI_TEST_EQUALS(number, 4, TEST_LOCATION );
+ }
+ }
+ view.SetProperty( DevelItemView::Property::LAYOUT, layoutArray);
+
+
// Test "overshootEnabled" property
DALI_TEST_CHECK( view.GetPropertyIndex("overshootEnabled") == Scrollable::Property::OVERSHOOT_ENABLED );
DALI_TEST_EQUALS( view.GetProperty(Scrollable::Property::OVERSHOOT_ENABLED).Get<bool>(), view.IsOvershootEnabled(), TEST_LOCATION );
develapieffectsviewdir = $(develapicontrolsdir)/effects-view
develapigaussianblurviewdir = $(develapicontrolsdir)/gaussian-blur-view
develapimagnifierdir = $(develapicontrolsdir)/magnifier
+develapiitemviewdir = $(develapicontrolsdir)/scrollable/item-view
develapinavigationviewdir = $(develapicontrolsdir)/navigation-view
develapipageturnviewdir = $(develapicontrolsdir)/page-turn-view
develapipopupdir = $(develapicontrolsdir)/popup
develapifocusmanager_HEADERS = $(devel_api_focus_manager_header_files)
develapigaussianblurview_HEADERS = $(devel_api_gaussian_blur_view_header_files)
develapiimageloader_HEADERS = $(devel_api_image_loader_header_files)
+develapiitemview_HEADERS = $(devel_api_item_view_header_files)
develapimagnifier_HEADERS = $(devel_api_magnifier_header_files)
develapinavigationview_HEADERS = $(devel_api_navigation_view_header_files)
develapipageturnview_HEADERS = $(devel_api_page_turn_view_header_files)
--- /dev/null
+#ifndef DALI_TOOLKIT_DEFAULT_ITEM_LAYOUT_PROPERTY_H
+#define DALI_TOOLKIT_DEFAULT_ITEM_LAYOUT_PROPERTY_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+/**
+ * @brief Default item layout property.
+ */
+namespace DefaultItemLayoutProperty
+{
+
+/**
+ * @brief The properties of each type of item layout.
+ */
+enum Property
+{
+ /**
+ * @brief The type of the Layout.
+ * @details Name "type", type(Dali::Toolkit::DefaultItemLayout::Type),Property::INTEGER
+ * @note Mandatory.
+ */
+ TYPE = 0,
+
+ /**
+ * @brief The size of each item in the Layout.
+ * @details Name "itemSize",Property::VECTOR3
+ * @note Optional.
+ * @note If not supplied, see ItemLayout::GetDefaultItemSize().
+ */
+ ITEM_SIZE,
+
+ /**
+ * @brief The internal orientation of the Layout.
+ * @details Name "orientation",type(@ref Dali::Toolkit::ControlOrientation::Type),Property::INTEGER
+ * @note Optional.
+ * @note If not supplied, the default is ControlOrientation::Up, The contents of control are in a vertical layout, from top to bottom.
+ */
+ ORIENTATION,
+
+ /**
+ * @brief The number of columns in the GridLayout.
+ * @details Name "gridColumnNumber",Property::INTEGER.
+ * @note Optional.
+ * @note If not supplied, the default is 4.
+ */
+ GRID_COLUMN_NUMBER,
+
+ /**
+ * @brief The spacing between rows in the GridLayout.
+ * @details Name "gridRowSpacing",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 20.0f.
+ */
+ GRID_ROW_SPACING,
+
+ /**
+ * @brief The spacing between columns in the GridLayout.
+ * @details Name "gridColumnSpacing",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 20.0f.
+ */
+ GRID_COLUMN_SPACING,
+
+ /**
+ * @brief The margin in the top of the GridLayout.
+ * @details Name "gridTopMargin",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 95.0f.
+ */
+ GRID_TOP_MARGIN,
+
+ /**
+ * @brief The margin in the bottom of the GridLayout.
+ * @details Name "gridBottomMargin",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 20.0f.
+ */
+ GRID_BOTTOM_MARGIN,
+
+ /**
+ * @brief The margin in the left and right of the GridLayout.
+ * @details Name "gridSideMargin",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 20.0f.
+ */
+ GRID_SIDE_MARGIN,
+
+ /**
+ * @brief The factor used to customise the scroll speed while dragging and swiping the GridLayout.
+ * @details Name "gridScrollSpeedFactor",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 0.03f.
+ */
+ GRID_SCROLL_SPEED_FACTOR,
+
+ /**
+ * @brief The maximum swipe speed in pixels per second of GridLayout.
+ * @details Name "gridMaximumSwipSpeed",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 100.0f.
+ */
+ GRID_MAXIMUM_SWIPE_SPEED,
+
+ /**
+ * @brief The duration of the flick animation in seconds of GridLayout.
+ * @details Name "gridItemFlickAnimationDuration",Property::FLOAT
+ * @note Optional.
+ * @note 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.
+ * @note Must be greater than zero;If not supplied, the default is 0.015f.
+ */
+ GRID_ITEM_FLICK_ANIMATION_DURATION,
+
+ /**
+ * @brief The number of columns in the DepthLayout.
+ * @details Name "depthColumnNumber",Property::INTEGER
+ * @note Optional.
+ * @note If not supplied, the default is 3.
+ */
+ DEPTH_COLUMN_NUMBER,
+
+ /**
+ * @brief The number of rows in the DepthLayout.
+ * @details Name "depthRowNumber",Property::INTEGER
+ * @note Optional.
+ * @note If not supplied, the default is 26.
+ */
+ DEPTH_ROW_NUMBER,
+
+ /**
+ * @brief The spacing between rows in the DepthLayout.
+ * @details Name "depthRowSpacing",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 55.0f.
+ */
+ DEPTH_ROW_SPACING,
+
+ /**
+ * @brief The factor used to customise the scroll speed while dragging and swiping the DepthLayout.
+ * @details Name "depthScrollSpeedFactor",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 0.02f.
+ */
+ DEPTH_SCROLL_SPEED_FACTOR,
+
+ /**
+ * @brief The maximumSwipSpeed of the DepthLayout.
+ * @details Name "depthMaximumSwipSpeed",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 50.0f.
+ */
+ DEPTH_MAXIMUM_SWIPE_SPEED,
+
+ /**
+ * @brief The duration of the flick animation in seconds of DepthLayout.
+ * @details Name "depthItemFlickAnimationDuration",Property::FLOAT
+ * @note Optional.
+ * @note 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.
+ * @note Must be greater than zero; If not supplied, the default is 0.03f.
+ */
+ DEPTH_ITEM_FLICK_ANIMATION_DURATION,
+
+ /**
+ * @brief The tilt angle of DepthLayout.
+ * @details Name "depthTiltAngle",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is (Math::PI)*0.15f.
+ * @note This is clamped between -45 & 45 degrees.
+ */
+ DEPTH_TILT_ANGLE,
+
+ /**
+ * @brief The tilt angle of the individual items in the DepthLayout.
+ * @details Name "depthItemTiltAngle",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is -(Math::PI)*0.025f.
+ */
+ DEPTH_ITEM_TILT_ANGLE,
+
+ /**
+ * @brief The spacing angle between items in the SpiralLayout.
+ * @details Name "spiralItemSpacing",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 9.5f.
+ */
+ SPIRAL_ITEM_SPACING,
+
+ /**
+ * @brief The factor used to customise the scroll speed while dragging and swiping the SpiralLayout.
+ * @details Name "spiralScrollSpeedFactor",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 0.01f.
+ */
+ SPIRAL_SCROLL_SPEED_FACTOR,
+
+ /**
+ * @brief The maximum swipe speed in pixels per second of the SpiralLayout.
+ * @details Name "spiralMaximumSwipSpeed",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 30.0f.
+ */
+ SPIRAL_MAXIMUM_SWIPE_SPEED,
+
+ /**
+ * @brief The duration of the flick animation in seconds of the SpiralLayout.
+ * @details Name "spiralItemFlickAnimationDuration",Property::FLOAT
+ * @note Optional.
+ * @note 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.
+ * @note Must be greater than zero; If not supplied, the default is 0.1f.
+ */
+ SPIRAL_ITEM_FLICK_ANIMATION_DURATION,
+
+ /**
+ * @brief The vertical distance for one revolution of the SpiralLayout.
+ * @details Name "spiralRevolutionDistance",Property::FLOAT
+ * @note Optional.
+ * @note If not supplied, the default is 190.0f.
+ */
+ SPIRAL_REVOLUTION_DISTANCE,
+
+ /**
+ * @brief The alignment of the top-item, when at the beginning of the SpiralLayout.
+ * @details Name "spiralTopItemAlignment",Property::FLOAT
+ * @note Optional.
+ * @note When at the beginning of the spiral (with a first-item layout-position of zero).A value of 0 indicates that the top-item is centered in the middle of the layout.
+ * A value of -0.5 or 0.5 indicates that the top-item is centred at the top or bottom of the layout respectively.
+ * @note If not supplied, the default is (-0.125f).
+ */
+ SPIRAL_TOP_ITEM_ALIGNMENT,
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+}
+
+#endif // DALI_TOOLKIT_DEFAULT_ITEM_LAYOUT_PROPERTY_H
+
--- /dev/null
+#ifndef DALI_TOOLKIT_ITEM_VIEW_DEVEL_H
+#define DALI_TOOLKIT_ITEM_VIEW_DEVEL_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelItemView
+{
+
+namespace Property
+{
+
+enum
+{
+ // Event side properties
+ MINIMUM_SWIPE_SPEED = Dali::Toolkit::ItemView::Property::MINIMUM_SWIPE_SPEED,
+ MINIMUM_SWIPE_DISTANCE = Dali::Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE,
+ WHEEL_SCROLL_DISTANCE_STEP = Dali::Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP,
+ SNAP_TO_ITEM_ENABLED = Dali::Toolkit::ItemView::Property::SNAP_TO_ITEM_ENABLED,
+ REFRESH_INTERVAL = Dali::Toolkit::ItemView::Property::REFRESH_INTERVAL,
+
+ /**
+ * @brief The layout used.
+ * @details Name "layout", type Property::ARRAY
+ * @see SetLayout()
+ */
+ LAYOUT = REFRESH_INTERVAL + 1,
+
+ // Animatable properties
+ LAYOUT_POSITION = Dali::Toolkit::ItemView::Property::LAYOUT_POSITION,
+ SCROLL_SPEED = Dali::Toolkit::ItemView::Property::SCROLL_SPEED,
+ OVERSHOOT = Dali::Toolkit::ItemView::Property::OVERSHOOT,
+ SCROLL_DIRECTION = Dali::Toolkit::ItemView::Property::SCROLL_DIRECTION,
+ LAYOUT_ORIENTATION = Dali::Toolkit::ItemView::Property::LAYOUT_ORIENTATION,
+ SCROLL_CONTENT_SIZE = Dali::Toolkit::ItemView::Property::SCROLL_CONTENT_SIZE
+};
+
+} // namespace Property
+
+} // namespace DevelItemView
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_ITEM_VIEW_DEVEL_H
devel_api_effects_view_header_files = \
$(devel_api_src_dir)/controls/effects-view/effects-view.h
+devel_api_item_view_header_files = \
+ $(devel_api_src_dir)/controls/scrollable/item-view/default-item-layout-property.h \
+ $(devel_api_src_dir)/controls/scrollable/item-view/item-view-devel.h
+
devel_api_magnifier_header_files = \
$(devel_api_src_dir)/controls/magnifier/magnifier.h
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
using namespace Dali;
using namespace Dali::Toolkit;
void DepthLayout::ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor )
{
+
+ if(HasLayoutChanged())
+ {
+ SetDepthLayoutProperties(GetLayoutProperties());
+ }
Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast( itemViewActor );
if( itemView )
{
}
}
+void DepthLayout::SetDepthLayoutProperties(const Property::Map& properties)
+{
+ // Set any properties specified for DepthLayout.
+ for( unsigned int idx = 0, mapCount = properties.Count(); idx < mapCount; ++idx )
+ {
+ KeyValuePair propertyPair = properties.GetKeyValue( idx );
+ switch(DefaultItemLayoutProperty::Property(propertyPair.first.indexKey))
+ {
+ case DefaultItemLayoutProperty::DEPTH_COLUMN_NUMBER:
+ {
+ SetNumberOfColumns(propertyPair.second.Get<int>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_ROW_NUMBER:
+ {
+ SetNumberOfRows(propertyPair.second.Get<int>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_ROW_SPACING:
+ {
+ SetRowSpacing(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_MAXIMUM_SWIPE_SPEED:
+ {
+ SetMaximumSwipeSpeed(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_SCROLL_SPEED_FACTOR:
+ {
+ SetScrollSpeedFactor(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_TILT_ANGLE:
+ {
+ SetTiltAngle(Degree(Radian(propertyPair.second.Get<float>())));
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_ITEM_TILT_ANGLE:
+ {
+ SetItemTiltAngle(Degree(Radian(propertyPair.second.Get<float>())));
+ break;
+ }
+ case DefaultItemLayoutProperty::DEPTH_ITEM_FLICK_ANIMATION_DURATION:
+ {
+ SetItemFlickAnimationDuration(propertyPair.second.Get<float>());
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ ResetLayoutChangedFlag();
+}
+
Vector3 DepthLayout::GetItemPosition( int itemID, float currentLayoutPosition, const Vector3& layoutSize ) const
{
Vector3 itemPosition = Vector3::ZERO;
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+
+
namespace Dali
{
virtual ~DepthLayout();
/**
+ * Apply depth layout Properties.
+ * @param[in] properties The properties of the layout.
+ */
+ void SetDepthLayoutProperties(const Property::Map& properties);
+
+ /**
* Set the number of columns in the layout.
* @param[in] columns The number of columns.
*/
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
using namespace Dali;
using namespace Dali::Toolkit;
void GridLayout::ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor )
{
+ if(HasLayoutChanged())
+ {
+ SetGridLayoutProperties(GetLayoutProperties());
+ }
// This just implements the default behaviour of constraint application.
// Custom layouts can override this function to apply their custom constraints.
Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast( itemViewActor );
}
}
+void GridLayout::SetGridLayoutProperties(const Property::Map& properties)
+{
+ // Set any properties specified for gridLayout.
+ for( unsigned int idx = 0, mapCount = properties.Count(); idx < mapCount; ++idx )
+ {
+ KeyValuePair propertyPair = properties.GetKeyValue( idx );
+ switch(DefaultItemLayoutProperty::Property(propertyPair.first.indexKey))
+ {
+ case DefaultItemLayoutProperty::GRID_COLUMN_NUMBER:
+ {
+ SetNumberOfColumns(propertyPair.second.Get<int>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_ROW_SPACING:
+ {
+ SetRowSpacing(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_COLUMN_SPACING:
+ {
+ SetColumnSpacing(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_TOP_MARGIN:
+ {
+ SetTopMargin(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_BOTTOM_MARGIN:
+ {
+ SetBottomMargin(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_SIDE_MARGIN:
+ {
+ SetSideMargin(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_SCROLL_SPEED_FACTOR:
+ {
+ SetScrollSpeedFactor(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_MAXIMUM_SWIPE_SPEED:
+ {
+ SetMaximumSwipeSpeed(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::GRID_ITEM_FLICK_ANIMATION_DURATION:
+ {
+ SetItemFlickAnimationDuration(propertyPair.second.Get<float>());
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ ResetLayoutChangedFlag();
+}
+
Vector3 GridLayout::GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const
{
Vector3 itemPosition = Vector3::ZERO;
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+#include <dali/public-api/common/dali-common.h>
+
+
namespace Dali
{
virtual ~GridLayout();
/**
+ * Apply grid layout Properties.
+ * @param[in] properties The properties of the layout.
+ */
+ void SetGridLayoutProperties(const Property::Map& properties);
+
+ /**
* @brief Set the number of columns in the layout.
*
* @param[in] columns The number of columns.
// EXTERNAL INCLUDES
#include <cstring> // for strcmp
#include <algorithm>
+#include <dali/public-api/actors/layer.h>
+
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/devel-api/common/set-wrapper.h>
#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/devel-api/object/property-helper-devel.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
+#include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/item-view-devel.h>
+#include <dali-toolkit/internal/controls/scrollable/item-view/grid-layout.h>
+#include <dali-toolkit/internal/controls/scrollable/item-view/depth-layout.h>
+#include <dali-toolkit/internal/controls/scrollable/item-view/spiral-layout.h>
#include <dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.h>
using std::string;
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "wheelScrollDistanceStep", FLOAT, WHEEL_SCROLL_DISTANCE_STEP )
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "snapToItemEnabled", BOOLEAN, SNAP_TO_ITEM_ENABLED )
DALI_PROPERTY_REGISTRATION( Toolkit, ItemView, "refreshInterval", FLOAT, REFRESH_INTERVAL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, ItemView, "layout", ARRAY, LAYOUT )
+
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "layoutPosition", FLOAT, LAYOUT_POSITION)
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "scrollSpeed", FLOAT, SCROLL_SPEED)
// Remove constraints from previous layout
actor.RemoveConstraints();
+ mActiveLayout->ApplyConstraints(actor, itemId, targetSize, Self() );
+
Vector3 size;
mActiveLayout->GetItemSize( itemId, targetSize, size );
actor.SetSize( size.GetVectorXY() );
-
- mActiveLayout->ApplyConstraints(actor, itemId, targetSize, Self() );
}
// Refresh the new layout
itemViewImpl.SetRefreshInterval( value.Get<float>() );
break;
}
+ case Toolkit::DevelItemView::Property::LAYOUT:
+ {
+ // Get a Property::Array from the property if possible.
+ Property::Array layoutArray;
+ if( value.Get( layoutArray ) )
+ {
+ itemViewImpl.SetLayoutArray( layoutArray );
+ }
+ break;
+ }
+ }
+ }
+}
+
+Property::Array ItemView::GetLayoutArray()
+{
+ return mlayoutArray;
+}
+
+void ItemView::SetLayoutArray( const Property::Array& layouts )
+{
+ mlayoutArray = layouts;
+ if(GetLayoutCount() > 0)
+ {
+ for(unsigned int index = GetLayoutCount() - 1; index >= 0; --index)
+ {
+ RemoveLayout(index);
+ if(index == 0) break;
+ }
+ }
+
+ for( unsigned int arrayIdx = 0, arrayCount = layouts.Count(); arrayIdx < arrayCount; ++arrayIdx )
+ {
+ const Property::Value& element = layouts.GetElementAt( arrayIdx );
+
+ Property::Map* layout = element.GetMap();
+ if( layout != NULL )
+ {
+ for( unsigned int mapIdx = 0, mapCount = (*layout).Count(); mapIdx < mapCount; ++mapIdx )
+ {
+ KeyValuePair propertyPair( (*layout).GetKeyValue( mapIdx ) );
+
+ if(propertyPair.first == DefaultItemLayoutProperty::TYPE)
+ {
+ int layoutType = propertyPair.second.Get<int>();
+ if(layoutType <= DefaultItemLayout::SPIRAL && layoutType >= DefaultItemLayout::DEPTH)
+ {
+ //DEPTH, GRID, LIST, SPIRAL
+ switch(DefaultItemLayout::Type(layoutType))
+ {
+ case DefaultItemLayout::DEPTH:
+ {
+ Internal::DepthLayoutPtr depthLayout = Internal::DepthLayout::New();
+ (*depthLayout).SetLayoutProperties(*layout);
+ AddLayout(*depthLayout);
+ break;
+ }
+ case DefaultItemLayout::GRID:
+ {
+ Internal::GridLayoutPtr gridLayout = Internal::GridLayout::New();
+ (*gridLayout).SetLayoutProperties(*layout);
+ AddLayout(*gridLayout);
+ break;
+ }
+ case DefaultItemLayout::LIST:
+ {
+ Internal::GridLayoutPtr listLayout = Internal::GridLayout::New();
+ listLayout->SetNumberOfColumns( 1 );
+ (*listLayout).SetLayoutProperties(*layout);
+ AddLayout(*listLayout);
+ break;
+ }
+ case DefaultItemLayout::SPIRAL:
+ {
+ Internal::SpiralLayoutPtr spiralLayout = Internal::SpiralLayout::New();
+ (*spiralLayout).SetLayoutProperties(*layout);
+ AddLayout(*spiralLayout);
+ break;
+ }
+ }
+ }
+ }
+ }
}
}
}
value = itemViewImpl.GetRefreshInterval();
break;
}
+ case Toolkit::DevelItemView::Property::LAYOUT:
+ {
+ Property::Array layouts= itemViewImpl.GetLayoutArray();
+ value = layouts;
+ break;
+ }
+
}
}
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/object/property-notification.h>
#include <dali/devel-api/common/map-wrapper.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/object/property-array.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
private:
/**
+ * Get all the layouts used in the ItemView.
+ * @return The layout array
+ */
+ Property::Array GetLayoutArray();
+
+ /**
+ * Set all the layouts. that will be used in the ItemView.
+ * @param[in] layouts The layouts used in the itemView.
+ */
+ void SetLayoutArray( const Property::Array& layouts );
+
+ /**
* Remove an Actor if found in the ItemPool.
* @param[in] itemId The item to remove.
* @return True if the remaining actors were reordered.
typedef ItemPool::iterator ItemPoolIter;
typedef ItemPool::const_iterator ConstItemPoolIter;
+ Property::Array mlayoutArray;
+
ItemPool mItemPool;
ItemFactory& mItemFactory;
std::vector< ItemLayoutPtr > mLayouts; ///< Container of Dali::Toolkit::ItemLayout objects
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
using namespace Dali;
using namespace Dali::Toolkit;
void SpiralLayout::ApplyConstraints( Actor& actor, const int itemId, const Vector3& layoutSize, const Actor& itemViewActor )
{
+
+ if(HasLayoutChanged())
+ {
+ SetSpiralLayoutProperties(GetLayoutProperties());
+ }
// This just implements the default behaviour of constraint application.
// Custom layouts can override this function to apply their custom constraints.
Dali::Toolkit::ItemView itemView = Dali::Toolkit::ItemView::DownCast( itemViewActor );
}
}
+void SpiralLayout::SetSpiralLayoutProperties(const Property::Map& properties)
+{
+ // Set any properties specified for SpiralLayout.
+ for( unsigned int idx = 0, mapCount = properties.Count(); idx < mapCount; ++idx )
+ {
+ KeyValuePair propertyPair = properties.GetKeyValue( idx );
+ switch(DefaultItemLayoutProperty::Property(propertyPair.first.indexKey))
+ {
+ case DefaultItemLayoutProperty::SPIRAL_ITEM_SPACING:
+ {
+ SetItemSpacing(Radian(propertyPair.second.Get<float>()));
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_MAXIMUM_SWIPE_SPEED:
+ {
+ SetMaximumSwipeSpeed(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_TOP_ITEM_ALIGNMENT:
+ {
+ SetTopItemAlignment(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_SCROLL_SPEED_FACTOR:
+ {
+ SetScrollSpeedFactor(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_REVOLUTION_DISTANCE:
+ {
+ SetRevolutionDistance(propertyPair.second.Get<float>());
+ break;
+ }
+ case DefaultItemLayoutProperty::SPIRAL_ITEM_FLICK_ANIMATION_DURATION:
+ {
+ SetItemFlickAnimationDuration(propertyPair.second.Get<float>());
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ ResetLayoutChangedFlag();
+}
+
Vector3 SpiralLayout::GetItemPosition(int itemID, float currentLayoutPosition, const Vector3& layoutSize) const
{
Vector3 itemPosition = Vector3::ZERO;
{
positionConstraint.OrientationDown( itemPosition, currentLayoutPosition + itemID, layoutSize );
}
- else // orientation == ControlOrientation::Right
+ else //orientation == ControlOrientation::Right
{
positionConstraint.OrientationRight( itemPosition, currentLayoutPosition + itemID, layoutSize );
}
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+
namespace Dali
{
virtual ~SpiralLayout();
/**
+ * Apply spiral layout Properties.
+ * @param[in] properties The properties of the layout.
+ */
+ void SetSpiralLayoutProperties(const Property::Map& properties);
+
+ /**
* Set spacing angle between items.
* @param[in] itemSpacing The angle in radians.
*/
void Control::OnControlChildAdd( Actor& child )
{
- DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: OnControlChildAdd() is deprecated and will be removed from next release. Override OnChildAdd instead.\n" );
}
void Control::OnControlChildRemove( Actor& child )
{
- DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: OnControlChildRemove() is deprecated and will be removed from next release. Override OnChildRemove instead.\n" );
}
void Control::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
*/
static Toolkit::Control New();
+protected:
+ /**
+ * @brief Virtual destructor.
+ * @SINCE_1_0.0
+ */
+ virtual ~Control();
+
+public:
// Styling
/**
Control( ControlBehaviour behaviourFlags );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
- */
- virtual ~Control();
-
- /**
* @brief Second phase initialization.
* @SINCE_1_0.0
*/
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+#include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
namespace Dali
{
{
Vector3 mItemSize; ///< The size of an item in the layout
ControlOrientation::Type mOrientation; ///< the orientation of the layout.
+ Property::Map mProperties;
+ bool mHasLayoutChanged;
};
ItemLayout::ItemLayout()
return GetScrollSpeedFactor();
}
+void ItemLayout::SetLayoutProperties(const Property::Map& properties)
+{
+ for( unsigned int idx = 0, mapCount = properties.Count(); idx < mapCount; ++idx )
+ {
+ KeyValuePair propertyPair( properties.GetKeyValue( idx ) );
+
+ if(propertyPair.first == DefaultItemLayoutProperty::ITEM_SIZE)
+ {
+ SetItemSize(propertyPair.second.Get<Vector3>());
+ }
+ else if(propertyPair.first == DefaultItemLayoutProperty::ORIENTATION)
+ {
+ //Up, Left, Down, Right
+ int orientationType = propertyPair.second.Get<int>();
+ if(orientationType <= ControlOrientation::Right && orientationType >= ControlOrientation::Up)
+ {
+ SetOrientation(ControlOrientation::Type(orientationType));
+ }
+ }
+ }
+ mImpl->mHasLayoutChanged = true;
+ mImpl->mProperties = properties;
+}
+
+Property::Map ItemLayout::GetLayoutProperties()
+{
+ return mImpl->mProperties;
+}
+
+bool ItemLayout::HasLayoutChanged()
+{
+ return mImpl->mHasLayoutChanged;
+}
+
+void ItemLayout::ResetLayoutChangedFlag()
+{
+ mImpl->mHasLayoutChanged = false;
+}
+
} // namespace Toolkit
} // namespace Dali
// EXTERNAL INCLUDES
#include <dali/public-api/animation/alpha-function.h>
+#include <dali/public-api/object/property-key.h>
+#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/enums.h>
DALI_IMPORT_API ControlOrientation::Type GetOrientation() const;
/**
+ * @brief Apply the layout Properties.
+ * @SINCE_1_2.20
+ * @param[in] properties The properties the layout.
+ */
+ void SetLayoutProperties(const Property::Map& properties);
+
+ /**
+ * @brief Get the layout Properties.
+ * @SINCE_1_2.20
+ * @return the property of the layout.
+ */
+ Property::Map GetLayoutProperties();
+
+ /**
+ * @brief Check if the Property has been changed.
+ * @SINCE_1_2.20
+ * @return whether the layout has been changed or not.if changed, return true.
+ */
+ bool HasLayoutChanged();
+
+ /**
+ * @brief Set the layout changed flag to false.
+ * @SINCE_1_2.20
+ */
+ void ResetLayoutChangedFlag();
+
+ /**
* @brief Retrieve the target size of an item in the layout.
*
* This will return the default size for the layout unless overridden by calling SetItemSize().
return "down";
break;
}
+ case Dali::Toolkit::Control::KeyboardFocus::PAGE_UP:
+ {
+ return "pageUp";
+ break;
+ }
+ case Dali::Toolkit::Control::KeyboardFocus::PAGE_DOWN:
+ {
+ return "pageDown";
+ break;
+ }
}
return "unknown direction";
}
%rename(LoadImageSynchronously) Dali::Toolkit::SyncImageLoader::Load;
%rename(ControlOrientationType) Dali::Toolkit::ControlOrientation::Type;
%rename(DefaultItemLayoutType) Dali::Toolkit::DefaultItemLayout::Type;
+%rename(DefaultItemLayoutProperty) Dali::Toolkit::DefaultItemLayoutProperty::Property;
%rename(NewItemLayout) Dali::Toolkit::DefaultItemLayout::New;
%rename(ContentDirectionType) Dali::Toolkit::FlexContainer::ContentDirection;
%rename(FlexDirectionType) Dali::Toolkit::FlexContainer::FlexDirection;
%include <dali-toolkit/public-api/enums.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
+%include <dali-toolkit/devel-api/controls/scrollable/item-view/default-item-layout-property.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
%include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>