*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/object/type-registry.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/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/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/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>
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_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_PROPERTY_REGISTRATION( Toolkit, ItemView, "layout", ARRAY, LAYOUT )
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "layoutPosition", FLOAT, LAYOUT_POSITION)
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, ItemView, "layoutPosition", FLOAT, LAYOUT_POSITION)
{
ItemRange range = GetItemRange(*mActiveLayout, mActiveLayoutTargetSize, currentLayoutPosition, cacheExtra/*reserve extra*/);
RemoveActorsOutsideRange( range );
{
ItemRange range = GetItemRange(*mActiveLayout, mActiveLayoutTargetSize, currentLayoutPosition, cacheExtra/*reserve extra*/);
RemoveActorsOutsideRange( range );
SetupActor( replacementItem, layoutSize );
Self().Add( replacementItem.second );
SetupActor( replacementItem, layoutSize );
Self().Add( replacementItem.second );
// Total number of items may change dynamically.
// Always recalculate the domain size to reflect that.
// Total number of items may change dynamically.
// Always recalculate the domain size to reflect that.
- item.second.SetParentOrigin( mItemsParentOrigin );
- item.second.SetAnchorPoint( mItemsAnchorPoint );
+ item.second.SetProperty( Actor::Property::PARENT_ORIGIN, mItemsParentOrigin );
+ item.second.SetProperty( Actor::Property::ANCHOR_POINT, mItemsAnchorPoint );
mActiveLayout->ApplyConstraints( item.second, item.first, layoutSize, Self() );
}
mActiveLayout->ApplyConstraints( item.second, item.first, layoutSize, Self() );
}
float layoutPositionDelta = GetCurrentLayoutPosition(0) - (event.z * mWheelScrollDistanceStep * mActiveLayout->GetScrollSpeedFactor());
float firstItemScrollPosition = ClampFirstItemPosition(layoutPositionDelta, layoutSize, *mActiveLayout);
float layoutPositionDelta = GetCurrentLayoutPosition(0) - (event.z * mWheelScrollDistanceStep * mActiveLayout->GetScrollSpeedFactor());
float firstItemScrollPosition = ClampFirstItemPosition(layoutPositionDelta, layoutSize, *mActiveLayout);
- float firstItemScrollPosition = ClampFirstItemPosition(GetCurrentLayoutPosition(0), Self().GetCurrentSize(), *mActiveLayout);
+ float firstItemScrollPosition = ClampFirstItemPosition(GetCurrentLayoutPosition(0), Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), *mActiveLayout);
if(!nextFocusActor)
{
// likely the current item is not buffered, so not in our item pool, probably best to get first viewable item
if(!nextFocusActor)
{
// likely the current item is not buffered, so not in our item pool, probably best to get first viewable item
{
int nextItemID = GetItemId(commitedFocusableActor);
float layoutPosition = GetCurrentLayoutPosition(0);
{
int nextItemID = GetItemId(commitedFocusableActor);
float layoutPosition = GetCurrentLayoutPosition(0);
float scrollTo = mActiveLayout->GetClosestOnScreenLayoutPosition(nextItemID, layoutPosition, layoutSize);
ScrollTo(Vector2(0.0f, scrollTo), DEFAULT_KEYBOARD_FOCUS_SCROLL_DURATION);
float scrollTo = mActiveLayout->GetClosestOnScreenLayoutPosition(nextItemID, layoutPosition, layoutSize);
ScrollTo(Vector2(0.0f, scrollTo), DEFAULT_KEYBOARD_FOCUS_SCROLL_DURATION);
float firstItemScrollPosition = ClampFirstItemPosition(mActiveLayout->GetItemScrollToPosition(itemId), layoutSize, *mActiveLayout);
if(durationSeconds > 0.0f)
float firstItemScrollPosition = ClampFirstItemPosition(mActiveLayout->GetItemScrollToPosition(itemId), layoutSize, *mActiveLayout);
if(durationSeconds > 0.0f)
- return Vector2(0.0f, GetScrollPosition(GetCurrentLayoutPosition(0), Self().GetCurrentSize()));
+ return Vector2(0.0f, GetScrollPosition(GetCurrentLayoutPosition(0), Self().GetCurrentProperty< Vector3 >( Actor::Property::SIZE )));
{
Property::Index effectOvershootPropertyIndex = Property::INVALID_INDEX;
mOvershootOverlay = CreateBouncingEffectActor( effectOvershootPropertyIndex );
{
Property::Index effectOvershootPropertyIndex = Property::INVALID_INDEX;
mOvershootOverlay = CreateBouncingEffectActor( effectOvershootPropertyIndex );
- mOvershootOverlay.SetColor(mOvershootEffectColor);
- mOvershootOverlay.SetParentOrigin(ParentOrigin::TOP_LEFT);
- mOvershootOverlay.SetAnchorPoint(AnchorPoint::TOP_LEFT);
- mOvershootOverlay.SetDrawMode( DrawMode::OVERLAY_2D );
+ mOvershootOverlay.SetProperty( Actor::Property::COLOR,mOvershootEffectColor);
+ mOvershootOverlay.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT );
+ mOvershootOverlay.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ mOvershootOverlay.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
self.Add(mOvershootOverlay);
ApplyOvershootSizeConstraint( mOvershootOverlay, mOvershootSize.height );
self.Add(mOvershootOverlay);
ApplyOvershootSizeConstraint( mOvershootOverlay, mOvershootSize.height );
Actor self = Self();
float scrollDistance = CalculateScrollDistance(mTotalPanDisplacement, *mActiveLayout) * mActiveLayout->GetScrollSpeedFactor();
float positionDelta = GetCurrentLayoutPosition(0) + scrollDistance;
Actor self = Self();
float scrollDistance = CalculateScrollDistance(mTotalPanDisplacement, *mActiveLayout) * mActiveLayout->GetScrollSpeedFactor();
float positionDelta = GetCurrentLayoutPosition(0) + scrollDistance;
self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, Vector2(0.0f, -minLayoutPosition));
float clamppedPosition = std::min(0.0f, std::max(minLayoutPosition, positionDelta));
overshoot = positionDelta - clamppedPosition;
self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, Vector2(0.0f, -minLayoutPosition));
float clamppedPosition = std::min(0.0f, std::max(minLayoutPosition, positionDelta));
overshoot = positionDelta - clamppedPosition;
mItemsParentOrigin = parentOrigin;
for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
mItemsParentOrigin = parentOrigin;
for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
mItemsAnchorPoint = anchorPoint;
for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
mItemsAnchorPoint = anchorPoint;
for (ItemIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
{
case Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE:
{
itemViewImpl.SetMinimumSwipeDistance( value.Get<float>() );
break;
}
case Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE:
{
itemViewImpl.SetMinimumSwipeDistance( value.Get<float>() );
break;
}
case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
{
itemViewImpl.SetWheelScrollDistanceStep( value.Get<float>() );
break;
}
case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
{
itemViewImpl.SetWheelScrollDistanceStep( value.Get<float>() );
break;
}
case Toolkit::ItemView::Property::SNAP_TO_ITEM_ENABLED:
{
itemViewImpl.SetAnchoring( value.Get<bool>() );
break;
}
case Toolkit::ItemView::Property::SNAP_TO_ITEM_ENABLED:
{
itemViewImpl.SetAnchoring( value.Get<bool>() );
break;
}
case Toolkit::ItemView::Property::REFRESH_INTERVAL:
{
itemViewImpl.SetRefreshInterval( value.Get<float>() );
break;
}
case Toolkit::ItemView::Property::REFRESH_INTERVAL:
{
itemViewImpl.SetRefreshInterval( value.Get<float>() );
break;
}
case Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE:
{
value = itemViewImpl.GetMinimumSwipeDistance();
break;
}
case Toolkit::ItemView::Property::MINIMUM_SWIPE_DISTANCE:
{
value = itemViewImpl.GetMinimumSwipeDistance();
break;
}
case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
{
value = itemViewImpl.GetWheelScrollDistanceStep();
break;
}
case Toolkit::ItemView::Property::WHEEL_SCROLL_DISTANCE_STEP:
{
value = itemViewImpl.GetWheelScrollDistanceStep();
break;
}