for( unsigned int i = 0u; i < 10; ++i )
{
- Actor child = view.GetChildAt( i );
+ Actor child = view.GetItem( i );
Actor newActor = Actor::New();
newActor.SetName("Replaced");
- replaceList.push_back( Item( view.GetItemId(child), newActor ) );
+ replaceList.push_back( Item( i, newActor ) );
}
if( !replaceList.empty() )
// Set up a scrollView...
ScrollView scrollView = ScrollView::New();
+ scrollView.SetOvershootEnabled(true);
Stage::GetCurrent().Add( scrollView );
Vector2 stageSize = Stage::GetCurrent().GetSize();
scrollView.SetSize(stageSize);
// Set up a scrollView...
ScrollView scrollView = ScrollView::New();
+ scrollView.SetOvershootEnabled(true);
Stage::GetCurrent().Add( scrollView );
Vector2 stageSize = Stage::GetCurrent().GetSize();
scrollView.SetSize(stageSize);
# Build the Dali Toolkit library
-toolkit_images_dir = ../../../dali-toolkit/images
+toolkit_images_dir = ../../../dali-toolkit/styles/images-common
toolkit_sounds_dir = ../../../dali-toolkit/sounds
toolkit_src_dir = ../../../dali-toolkit/internal
public_api_src_dir = ../../../dali-toolkit/public-api
devel_api_src_dir = ../../../dali-toolkit/devel-api
toolkit_styles_dir = $(STYLE_DIR)
+toolkit_style_images_dir = $(STYLE_DIR)/images
-include ../../../dali-toolkit/images/file.list
include ../../../dali-toolkit/sounds/file.list
include ../../../dali-toolkit/styles/file.list
+include ../../../dali-toolkit/styles/images-common/file.list
include ../../../dali-toolkit/internal/file.list
include ../../../dali-toolkit/public-api/file.list
include ../../../dali-toolkit/devel-api/file.list
dalistyledir = ${dataReadOnlyDir}/toolkit/styles/
dalistyle_DATA = ${dali_toolkit_style_files}
+dalistyleimagesdir = ${dataReadOnlyDir}/toolkit/styles/images/
+dalistyleimages_DATA = ${dali_toolkit_style_images}
+
libdali_toolkit_la_DEPENDENCIES =
libdali_toolkit_la_CXXFLAGS = -DDALI_COMPILATION \
-DDALI_IMAGE_DIR="\"${daliimagedir}\"" \
-DDALI_SOUND_DIR="\"${dalisounddir}\"" \
-DDALI_STYLE_DIR="\"${dalistyledir}\"" \
+ -DDALI_STYLE_IMAGE_DIR="\"${dalistyleimagesdir}\"" \
-DDALI_DATA_READ_ONLY_DIR="\"${dataReadOnlyDir}\"" \
-Werror -Wall \
-I../../../ \
defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR;
defaultDirs[ TOKEN_STRING(DALI_SOUND_DIR) ] = DALI_SOUND_DIR;
defaultDirs[ TOKEN_STRING(DALI_STYLE_DIR) ] = DALI_STYLE_DIR;
+ defaultDirs[ TOKEN_STRING(DALI_STYLE_IMAGE_DIR) ] = DALI_STYLE_IMAGE_DIR;
AddConstants( defaultDirs );
}
}
-/**
- * ZrelativeToYconstraint
- *
- * f(current, property, scale) = Vector3(current.x, current.y, property.y * scale)
- */
-struct ZrelativeToYconstraint
-{
- ZrelativeToYconstraint( float scale )
- : mScale( scale )
- {}
-
- Vector3 operator()(const Vector3& current,
- const PropertyInput& property)
- {
- Vector3 v;
-
- v.x = current.x;
- v.y = current.y;
- v.z = property.GetVector3().y * mScale;
-
- return v;
- }
-
- float mScale;
-};
-
void GaussianBlurView::OnSizeSet(const Vector3& targetSize)
{
mTargetSize = Vector2(targetSize);
};
std::string mCachedRendererKey; ///< The key to use for caching of the renderer. If it is empty then no caching will occur
- RendererFactoryCache::CachedRendererPtr mCachedRenderer; ///< The current cached renderer from the Factory Cache. mCachedRenderer == null whilst this control render is offstage
Renderer mRenderer;
CustomShader* mCustomShader;
}
else
{
- //remove the cached renderer from the cache if we and the cache are the only things that hold a reference to it
- if( mImpl->mCachedRenderer && mImpl->mCachedRenderer->ReferenceCount() == 2 )
- {
- mFactoryCache.RemoveRenderer( mImpl->mCachedRenderer->mKey );
- }
- mImpl->mCachedRenderer.Reset();
+ //clean the renderer from the cache since it may no longer be in use
+ mFactoryCache.CleanRendererCache( mImpl->mCachedRendererKey );
//add the new renderer
mImpl->mCachedRendererKey = cachedRendererKey;
if( !mImpl->mCachedRendererKey.empty() && !mImpl->mCustomShader )
{
DALI_ASSERT_DEBUG( mImpl->mRenderer && "The control render is on stage but it doesn't have a valid renderer.");
- mImpl->mCachedRenderer = mFactoryCache.SaveRenderer( mImpl->mCachedRendererKey, mImpl->mRenderer );
+ mFactoryCache.SaveRenderer( mImpl->mCachedRendererKey, mImpl->mRenderer );
}
}
}
{
if( !mImpl->mCachedRendererKey.empty() && !mImpl->mCustomShader )
{
- mImpl->mCachedRenderer = mFactoryCache.GetRenderer( mImpl->mCachedRendererKey );
- if( !mImpl->mCachedRenderer || !mImpl->mCachedRenderer->mRenderer )
+ mImpl->mRenderer = mFactoryCache.GetRenderer( mImpl->mCachedRendererKey );
+ if( !mImpl->mRenderer )
{
InitializeRenderer( mImpl->mRenderer );
- mImpl->mCachedRenderer = mFactoryCache.SaveRenderer( mImpl->mCachedRendererKey, mImpl->mRenderer );
- }
-
- if( mImpl->mCachedRenderer && mImpl->mCachedRenderer->mRenderer )
- {
- mImpl->mRenderer = mImpl->mCachedRenderer->mRenderer;
+ mFactoryCache.SaveRenderer( mImpl->mCachedRendererKey, mImpl->mRenderer );
}
}
if( mImpl->mIsOnStage )
{
DoSetOffStage( actor );
-
- //remove the cached renderer from the cache if we and the cache are the only things that hold a reference to it
- if( mImpl->mCachedRenderer && mImpl->mCachedRenderer->ReferenceCount() == 2 )
- {
- mFactoryCache.RemoveRenderer( mImpl->mCachedRenderer->mKey );
- }
- mImpl->mCachedRenderer.Reset();
-
actor.RemoveRenderer( mImpl->mRenderer );
mImpl->mRenderer.Reset();
+ //clean the renderer from the cache since it may no longer be in use
+ mFactoryCache.CleanRendererCache( mImpl->mCachedRendererKey );
+
mImpl->mIsOnStage = false;
}
}
if( it != mRendererHashes.End() )
{
int index = it - mRendererHashes.Begin();
- const CachedRendererPtr& cachedRenderer = mRenderers[ index ];
+ const CachedRenderer* cachedRenderer = mRenderers[ index ];
if( cachedRenderer && cachedRenderer->mKey == key )
{
return -1;
}
-RendererFactoryCache::CachedRendererPtr RendererFactoryCache::GetRenderer( const std::string& key ) const
+Renderer RendererFactoryCache::GetRenderer( const std::string& key ) const
{
int index = FindRenderer( key );
if( index != -1 )
{
- return mRenderers[ index ];
+ return mRenderers[ index ]->mRenderer.GetHandle();
}
else
{
- return CachedRendererPtr();
+ return Renderer();
}
}
-RendererFactoryCache::CachedRendererPtr RendererFactoryCache::SaveRenderer( const std::string& key, Renderer& renderer )
+void RendererFactoryCache::SaveRenderer( const std::string& key, Renderer& renderer )
{
int hash = Dali::CalculateHash( key );
- CachedRendererPtr newCachedRenderer = new CachedRenderer( key, renderer );
+ const CachedRenderer* cachedRenderer = new CachedRenderer( key, renderer );
- CachedRenderers::iterator it = std::find(mRenderers.begin(), mRenderers.end(), CachedRendererPtr() );
- if( it != mRenderers.end() )
+ CachedRenderers::Iterator it = std::find( mRenderers.Begin(), mRenderers.End(), static_cast< CachedRenderer* >( NULL ) );
+ if( it != mRenderers.End() )
{
- *it = newCachedRenderer;
- int index = it - mRenderers.begin();
+ *it = cachedRenderer;
+ int index = it - mRenderers.Begin();
mRendererHashes[ index ] = hash;
}
else
{
mRendererHashes.PushBack( hash );
- mRenderers.push_back( newCachedRenderer );
+ mRenderers.PushBack( cachedRenderer );
}
-
- return newCachedRenderer;
}
-void RendererFactoryCache::RemoveRenderer( const std::string& key )
+void RendererFactoryCache::CleanRendererCache( const std::string& key )
{
int index = FindRenderer( key );
if( index != -1 )
{
- mRendererHashes[ index ] = Dali::CalculateHash( "" );
- mRenderers[ index ].Reset();
+ const CachedRenderer*& cachedRenderer = mRenderers[ index ];
+ if( !cachedRenderer->mRenderer.GetHandle() )
+ {
+ mRendererHashes[ index ] = Dali::INITIAL_HASH_VALUE;
+
+ delete cachedRenderer;
+ cachedRenderer = NULL;
+ }
}
}
#include <dali/devel-api/rendering/geometry.h>
#include <dali/devel-api/rendering/shader.h>
#include <dali/devel-api/rendering/renderer.h>
+#include <dali/devel-api/common/owner-container.h>
+#include <dali/devel-api/object/weak-handle.h>
+
namespace Dali
{
static Geometry CreateQuadGeometry();
public:
- struct CachedRenderer : RefObject
- {
- std::string mKey;
- Renderer mRenderer;
-
- CachedRenderer( const std::string& key, const Renderer& renderer )
- : mKey( key ),
- mRenderer( renderer )
- {}
- };
-
- typedef IntrusivePtr< CachedRenderer > CachedRendererPtr;
/**
* @brief Request renderer from the url
*
- * @return The cached renderer if exist in the cache. Otherwise null is returned.
+ * @return The cached renderer if exist in the cache. Otherwise an empty handle is returned.
*/
- CachedRendererPtr GetRenderer( const std::string& key ) const;
+ Renderer GetRenderer( const std::string& key ) const;
/**
* @brief Cache the renderer based on the given key.
*
* @param[in] key The key to use for caching
* @param[in] renderer The Renderer to be cached
- *
- * @return The cached renderer stored in the cache
*/
- CachedRendererPtr SaveRenderer( const std::string& key, Renderer& renderer );
+ void SaveRenderer( const std::string& key, Renderer& renderer );
/**
- * @brief Removes the renderer from the cache based on the given key
+ * @brief Cleans the renderer cache by removing the renderer from the cache based on the given key if there are no longer any references to it
*
* @param[in] key The key used for caching
*/
- void RemoveRenderer( const std::string& key );
+ void CleanRendererCache( const std::string& key );
protected:
RendererFactoryCache& operator=(const RendererFactoryCache& rhs);
private:
+ struct CachedRenderer
+ {
+ std::string mKey;
+ WeakHandle< Renderer > mRenderer;
+
+ CachedRenderer( const std::string& key, Renderer& renderer )
+ : mKey( key ),
+ mRenderer( renderer)
+ {}
+ };
+
typedef Dali::Vector< std::size_t > HashVector;
- typedef std::vector< CachedRendererPtr > CachedRenderers;
+ typedef Dali::OwnerContainer< const CachedRenderer* > CachedRenderers;
/**
* @brief Finds the first index into the cached renderers from the url
namespace
{
// Bouncing effect is presented by stacked three layers with same color and opacity
-const Vector3 LAYER_HEIGHTS( 1.f, 27.f/42.f, 13.f/42.f);
+const float LAYER_HEIGHTS[5] =
+{
+ 1.f,
+ 26.f * 4.f/ 130.f,
+ 26.f * 3.f / 130.f,
+ 26.f * 2.f / 130.f,
+ 26.f / 130.f
+};
#define MAKE_SHADER(A)#A
Vector3 position2;
};
// 4 vertices 2 triangles per layer. The depth interval between each layer is 0.01
- VertexPosition vertexData[12] = {
- //bottom layer
+ VertexPosition vertexData[20] = {
+ // bottom layer
{ Vector3( -0.5f, -0.5f, 0.f ), Vector3( -0.5f, -0.5f, 0.f ) },
{ Vector3( 0.5f, -0.5f, 0.f ), Vector3( 0.5f, -0.5f, 0.f ) },
{ Vector3( -0.5f, -0.5f, 0.f ), Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[0], 0.f ) },
{ Vector3( 0.5f, -0.5f, 0.f ), Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[0], 0.f ) },
- // middle layer
+ // mid-bottom layer
{ Vector3( -0.5f, -0.5f, 0.01f ), Vector3( -0.5f, -0.5f, 0.01f ) },
{ Vector3( 0.5f, -0.5f, 0.01f ), Vector3( 0.5f, -0.5f, 0.01f ) },
{ Vector3( -0.5f, -0.5f, 0.01f ), Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[1], 0.01f ) },
{ Vector3( 0.5f, -0.5f, 0.01f ), Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[1], 0.01f ) },
- // top layer
+ // middle layer
{ Vector3( -0.5f, -0.5f, 0.02f ), Vector3( -0.5f, -0.5f, 0.02f ) },
{ Vector3( 0.5f, -0.5f, 0.02f ), Vector3( 0.5f, -0.5f, 0.02f ) },
{ Vector3( -0.5f, -0.5f, 0.02f ), Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[2], 0.02f ) },
- { Vector3( 0.5f, -0.5f, 0.02f ), Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[2], 0.02f ) }
+ { Vector3( 0.5f, -0.5f, 0.02f ), Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[2], 0.02f ) },
+ // mid-top layer
+ { Vector3( -0.5f, -0.5f, 0.03f ), Vector3( -0.5f, -0.5f, 0.03f ) },
+ { Vector3( 0.5f, -0.5f, 0.03f ), Vector3( 0.5f, -0.5f, 0.03f ) },
+ { Vector3( -0.5f, -0.5f, 0.03f ), Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[3], 0.03f ) },
+ { Vector3( 0.5f, -0.5f, 0.03f ), Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[3], 0.03f ) },
+ // top layer
+ { Vector3( -0.5f, -0.5f, 0.04f ), Vector3( -0.5f, -0.5f, 0.04f ) },
+ { Vector3( 0.5f, -0.5f, 0.04f ), Vector3( 0.5f, -0.5f, 0.04f ) },
+ { Vector3( -0.5f, -0.5f, 0.04f ), Vector3( -0.5f, -0.5f + LAYER_HEIGHTS[4], 0.04f ) },
+ { Vector3( 0.5f, -0.5f, 0.04f ), Vector3( 0.5f, -0.5f+ LAYER_HEIGHTS[4], 0.04f ) }
};
Property::Map vertexFormat;
vertexFormat["aPosition1"] = Property::VECTOR3;
vertexFormat["aPosition2"] = Property::VECTOR3;
- PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, 12u );
+ PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, 20u );
vertices.SetData( vertexData );
- unsigned int indexData[18] = { 0,3,1,0,2,3,4,7,5,4,6,7,8,11,9,8,10,11 };
+ unsigned int indexData[30] = { 0,3,1,0,2,3,4,7,5,4,6,7,8,11,9,8,10,11,12,15,13,12,14,15,16,19,17,16,18,19};
Property::Map indexFormat;
indexFormat["indices"] = Property::INTEGER;
- PropertyBuffer indices = PropertyBuffer::New( indexFormat, 18u );
+ PropertyBuffer indices = PropertyBuffer::New( indexFormat, 30u );
indices.SetData( indexData );
Geometry meshGeometry = Geometry::New();
const float MILLISECONDS_PER_SECONDS = 1000.0f;
-const Vector2 OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE( 720.0f, 42.0f );
const float OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD = 180.0f;
const Vector4 OVERSHOOT_OVERLAY_NINE_PATCH_BORDER(0.0f, 0.0f, 1.0f, 12.0f);
const float DEFAULT_KEYBOARD_FOCUS_SCROLL_DURATION = 0.2f;
}
// Overshoot overlay constraints
-void OvershootOverlaySizeConstraint( Vector3& current, const PropertyInputContainer& inputs )
+struct OvershootOverlaySizeConstraint
{
- const Vector2& parentScrollDirection = inputs[0]->GetVector2();
- const Toolkit::ControlOrientation::Type& layoutOrientation = static_cast<Toolkit::ControlOrientation::Type>(inputs[1]->GetInteger());
- const Vector3& parentSize = inputs[2]->GetVector3();
-
- if(Toolkit::IsVertical(layoutOrientation))
+ OvershootOverlaySizeConstraint( float height )
+ : mOvershootHeight( height )
{
- current.width = fabsf(parentScrollDirection.y) > Math::MACHINE_EPSILON_1 ? parentSize.x : parentSize.y;
}
- else
+
+ void operator()( Vector3& current, const PropertyInputContainer& inputs )
{
- current.width = fabsf(parentScrollDirection.x) > Math::MACHINE_EPSILON_1 ? parentSize.y : parentSize.x;
+ const Vector2& parentScrollDirection = inputs[0]->GetVector2();
+ const Toolkit::ControlOrientation::Type& layoutOrientation = static_cast<Toolkit::ControlOrientation::Type>(inputs[1]->GetInteger());
+ const Vector3& parentSize = inputs[2]->GetVector3();
+
+ if(Toolkit::IsVertical(layoutOrientation))
+ {
+ current.width = fabsf(parentScrollDirection.y) > Math::MACHINE_EPSILON_1 ? parentSize.x : parentSize.y;
+ }
+ else
+ {
+ current.width = fabsf(parentScrollDirection.x) > Math::MACHINE_EPSILON_1 ? parentSize.y : parentSize.x;
+ }
+
+ current.height = ( current.width > OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD ) ? mOvershootHeight : mOvershootHeight*0.5f;
}
- current.height = ( current.width > OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD ) ? OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height : OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height*0.5f;
-}
+ float mOvershootHeight;
+};
void OvershootOverlayRotationConstraint( Quaternion& current, const PropertyInputContainer& inputs )
{
{
Actor self = Self();
- SetOvershootEnabled(true);
-
Vector2 stageSize = Stage::GetCurrent().GetSize();
mWheelScrollDistanceStep = stageSize.y * DEFAULT_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION;
mOvershootOverlay.SetDrawMode( DrawMode::OVERLAY_2D );
self.Add(mOvershootOverlay);
- Constraint constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::SIZE, OvershootOverlaySizeConstraint );
+ Constraint constraint = Constraint::New<Vector3>( mOvershootOverlay, Actor::Property::SIZE, OvershootOverlaySizeConstraint(mOvershootSize.height) );
constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
constraint.AddSource( ParentSource( Toolkit::ItemView::Property::LAYOUT_ORIENTATION ) );
constraint.AddSource( ParentSource( Actor::Property::SIZE ) );
constraint.Apply();
- mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height);
+ mOvershootOverlay.SetSize(mOvershootSize.width, mOvershootSize.height);
constraint = Constraint::New<Quaternion>( mOvershootOverlay, Actor::Property::ORIENTATION, OvershootOverlayRotationConstraint );
constraint.AddSource( ParentSource( Toolkit::ItemView::Property::SCROLL_DIRECTION ) );
namespace
{
-const Vector2 OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE( 720.0f, 42.0f );
+
const float OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD = 180.0f;
// local helper function to resize the height of the bounce actor
-float GetBounceActorHeight( float width )
+float GetBounceActorHeight( float width, float defaultHeight )
{
- return (width > OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD) ? OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height : OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height * 0.5f;
+ return (width > OVERSHOOT_BOUNCE_ACTOR_RESIZE_THRESHOLD) ? defaultHeight : defaultHeight * 0.5f;
}
const float MAX_OVERSHOOT_NOTIFY_AMOUNT = 0.99f; // maximum amount to set notification for increased overshoot, beyond this we just wait for it to reduce again
mOvershootProperty(Property::INVALID_INDEX),
mEffectOvershootProperty(Property::INVALID_INDEX),
mOvershoot(0.0f),
+ mOvershootSize( scrollable.GetOvershootSize() ),
mAnimationStateFlags(0)
{
mOvershootOverlay = CreateBouncingEffectActor(mEffectOvershootProperty);
mOvershootProperty = IsVertical() ? Toolkit::ScrollView::Property::OVERSHOOT_Y : Toolkit::ScrollView::Property::OVERSHOOT_X;
// make sure height is set, since we only create a constraint for image width
- mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height);
+ mOvershootOverlay.SetSize( mOvershootSize );
mAttachedScrollView.AddOverlay(mOvershootOverlay);
if(IsVertical())
{
mOvershootOverlay.SetOrientation( Quaternion( Radian( 0.0f ), Vector3::ZAXIS ) );
- mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width), size.depth);
+ mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width, mOvershootSize.height), size.depth);
}
else
{
mOvershootOverlay.SetOrientation( Quaternion( Radian( 1.5f * Math::PI ), Vector3::ZAXIS ) );
- mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height), size.depth);
+ mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height, mOvershootSize.height), size.depth);
relativeOffset = Vector3(0.0f, 1.0f, 0.0f);
}
mOvershootOverlay.SetPosition(relativeOffset * parentSize);
if(IsVertical())
{
mOvershootOverlay.SetOrientation( Quaternion( Radian( Math::PI ), Vector3::ZAXIS ) );
- mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width), size.depth);
+ mOvershootOverlay.SetSize(parentSize.width, GetBounceActorHeight(parentSize.width, mOvershootSize.height), size.depth);
relativeOffset = Vector3(1.0f, 1.0f, 0.0f);
}
else
{
mOvershootOverlay.SetOrientation( Quaternion( Radian( 0.5f * Math::PI ), Vector3::ZAXIS ) );
- mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height), size.depth);
+ mOvershootOverlay.SetSize(parentSize.height, GetBounceActorHeight(parentSize.height, mOvershootSize.height), size.depth);
relativeOffset = Vector3(1.0f, 0.0f, 0.0f);
}
mOvershootOverlay.SetPosition(relativeOffset * parentSize);
PropertyNotification mOvershootDecreaseNotification;///< notification used to inform as overshoot decreases
Property::Index mOvershootProperty; ///< index of the overshoot property in the scrollable actor
Property::Index mEffectOvershootProperty; ///< index of the effect's overshoot property
- float mOvershoot; ///< last overshoot value as detected by notifications
- unsigned short mAnimationStateFlags; ///< contains flags indicating the current state of the overshoot animation
+ float mOvershoot; ///< last overshoot value as detected by notifications
+ Vector2 mOvershootSize; ///< The size of the overshoot effect
+ unsigned short mAnimationStateFlags; ///< contains flags indicating the current state of the overshoot animation
};
} // namespace Internal
mRulerX = ruler;
mRulerY = ruler;
- SetOvershootEnabled(true);
-
self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, mCanScrollVertical);
self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, mCanScrollHorizontal);
void ScrollView::EnableScrollOvershoot(bool enable)
{
- if(enable && !mOvershootIndicator)
- {
- mOvershootIndicator = ScrollOvershootIndicator::New();
- }
- if( enable )
+ if (enable)
{
+ if (!mOvershootIndicator)
+ {
+ mOvershootIndicator = ScrollOvershootIndicator::New();
+ }
+
mOvershootIndicator->AttachToScrollable(*this);
}
else
{
mMaxOvershoot = mUserMaxOvershoot;
- mOvershootIndicator->DetachFromScrollable(*this);
+
+ if (mOvershootIndicator)
+ {
+ mOvershootIndicator->DetachFromScrollable(*this);
+ }
}
+
UpdateMainInternalConstraint();
}
DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshoot-effect-color", VECTOR4, OVERSHOOT_EFFECT_COLOR )
DALI_PROPERTY_REGISTRATION( Toolkit, Scrollable, "overshoot-animation-speed", FLOAT, OVERSHOOT_ANIMATION_SPEED )
+const int OVERSHOOT_SIZE = Dali::Toolkit::Scrollable::Property::OVERSHOOT_ANIMATION_SPEED + 1; // OVERSHOOT_SIZE is not public yet
+Dali::PropertyRegistration p1( typeRegistration, "overshoot-size", OVERSHOOT_SIZE, Property::VECTOR2, Dali::Toolkit::Internal::Scrollable::SetProperty, Dali::Toolkit::Internal::Scrollable::GetProperty );
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scroll-relative-position", VECTOR2, SCROLL_RELATIVE_POSITION)
DALI_ANIMATABLE_PROPERTY_REGISTRATION( Toolkit, Scrollable, "scroll-position-min", VECTOR2, SCROLL_POSITION_MIN)
const Vector4 DEFAULT_OVERSHOOT_COLOUR(0.0f, 0.64f, 0.85f, 0.25f);
const float DEFAULT_OVERSHOOT_ANIMATION_SPEED(120.0f); // 120 pixels per second
+const Vector2 OVERSHOOT_DEFAULT_SIZE( 720.0f, 42.0f );
}
: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | DISABLE_SIZE_NEGOTIATION ) ),
mOvershootEffectColor( DEFAULT_OVERSHOOT_COLOUR ),
mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ),
- mOvershootEnabled(false)
+ mOvershootSize( OVERSHOOT_DEFAULT_SIZE ),
+ mOvershootEnabled(true)
{
}
: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | behaviourFlags ) ),
mOvershootEffectColor( DEFAULT_OVERSHOOT_COLOUR ),
mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ),
- mOvershootEnabled(false)
+ mOvershootSize( OVERSHOOT_DEFAULT_SIZE ),
+ mOvershootEnabled(true)
{
}
return mOvershootAnimationSpeed;
};
+const Vector2& Scrollable::GetOvershootSize() const
+{
+ return mOvershootSize;
+}
+
Toolkit::Scrollable::ScrollStartedSignalType& Scrollable::ScrollStartedSignal()
{
return mScrollStartedSignal;
scrollableImpl.SetOvershootAnimationSpeed( value.Get<float>() );
break;
}
+ case OVERSHOOT_SIZE: // OVERSHOOT_SIZE is not public yet
+ {
+ Vector2 input;
+ if( value.Get( input ) )
+ {
+ scrollableImpl.mOvershootSize = input;
+ }
+ scrollableImpl.EnableScrollOvershoot( scrollableImpl.IsOvershootEnabled() );
+ break;
+ }
}
}
}
value = scrollableImpl.GetOvershootAnimationSpeed();
break;
}
+ case OVERSHOOT_SIZE: // OVERSHOOT_SIZE is not public yet
+ {
+ value = scrollableImpl.mOvershootSize;
+ break;
+ }
}
}
*/
float GetOvershootAnimationSpeed() const;
+ /**
+ * @copydoc Dali::Toolkit::Scrollable::GetOvershootSize()
+ */
+ const Vector2& GetOvershootSize() const;
+
private:
/**
Vector4 mOvershootEffectColor; ///<The color of the overshoot bouncing effect
float mOvershootAnimationSpeed; ///<The speed of the overshoot animation (pixels per second)
+ Vector2 mOvershootSize; ///<The size of the overshoot effect
Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal;
Toolkit::Scrollable::ScrollUpdatedSignalType mScrollUpdatedSignal;
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 5;
+const unsigned int TOOLKIT_MICRO_VERSION = 6;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
"secondary-cursor-color":[0.0,0.72,0.9,1.0],
"cursor-width":1,
"selection-highlight-color":[0.75,0.96,1.0,1.0],
- "grab-handle-image" : "{DALI_IMAGE_DIR}cursor_handler_drop_center.png",
- "selection-handle-image-left" : {"filename":"{DALI_IMAGE_DIR}selection_handle_drop_left.png" },
- "selection-handle-image-right": {"filename":"{DALI_IMAGE_DIR}selection_handle_drop_right.png" }
+ "grab-handle-image" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+ "selection-handle-image-left" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+ "selection-handle-image-right": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
"textfield-font-size-0":
},
"scrollview":
{
- "overshoot-effect-color":"B018"
+ "overshoot-effect-color":"B018",
+ "overshoot-animation-speed":120.0,
+ "overshoot-size":[480.0,42.0]
+ },
+ "itemview":
+ {
+ "overshoot-effect-color":"B018",
+ "overshoot-animation-speed":120.0,
+ "overshoot-size":[480.0,42.0]
}
}
}
"secondary-cursor-color":[0.0,0.72,0.9,1.0],
"cursor-width":3,
"selection-highlight-color":[0.75,0.96,1.0,1.0],
- "grab-handle-image" : "{DALI_IMAGE_DIR}cursor_handler_drop_center.png",
- "selection-handle-image-left" : {"filename":"{DALI_IMAGE_DIR}selection_handle_drop_left.png" },
- "selection-handle-image-right": {"filename":"{DALI_IMAGE_DIR}selection_handle_drop_right.png" }
+ "grab-handle-image" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+ "selection-handle-image-left" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+ "selection-handle-image-right": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
"textfield-font-size-0":
},
"scrollview":
{
- "overshoot-effect-color":"B018"
+ "overshoot-effect-color":"B018",
+ "overshoot-animation-speed":360.0,
+ "overshoot-size":[720.0,130.0]
+ },
+ "itemview":
+ {
+ "overshoot-effect-color":"B018",
+ "overshoot-animation-speed":360.0,
+ "overshoot-size":[720.0,130.0]
}
}
}
dali_toolkit_style_files =\
$(toolkit_styles_dir)/*.json
+
+dali_toolkit_style_images =\
+ $(toolkit_style_images_dir)/*.png
+ [Relative To Constraint](@ref constraints-relative-to)
+ [Multi-threading Notes](@ref animation-multi-threading-notes)
+ [Shader Animation](@ref animation-shader)
+ + [Styling](@ref styling)
### Resources
+ [Resource Image](@ref resource-image)
--- /dev/null
+/*! \page styling Styling
+ *
+@section styling-controls Styling Controls
+
+DALi Controls can be styled to look and behaviour differently.
+
+There are 2 ways to style a control, 1 is recommended.
+
+1) json markup in one of the style files.
+
+~~~
+ ...
+ "control":
+ {
+ "filename":"{IMAGES}file_name.png"
+ },
+ ...
+~~~
+
+or 2) via code using SetProperty
+
+@code
+Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
+control.SetProperty( Control::BACKGROUND, "file_name.png" );
+@endcode
+
+By setting the properties in the json file and not in code it prevents the need to edit code and recompile if changes required.
+
+In the example above, if the png file needs to be changed, method 1 only requires the json file to be changed and no actual code change.
+
+@section choosing-style-at-build Choosing Style files at build time
+
+When building for a target, a style selector should be specified.
+
+The selectors are resolution biased e.g; 720 and 480.
+
+Below can be added to configure to select a style
+
+@code
+./configure --with-style=480
+@endcode
+
+@code
+./configure --with-style=720
+@endcode
+
+
+or for gbs the below define added to the build command
+
+@code
+--define "dali_style 480x800"
+@endcode
+
+@section resources-for-styling Style specific resources
+
+Each style selector can have resource folders associated with it.
+
+Images for that style should be in their own folder named images.
+
+Common images not specific for a particular style will be in the images-common folder located in the style folder.
+*
+*/
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.1.5
+Version: 1.1.6
Release: 1
Group: System/Libraries
License: Apache-2.0, BSD-2.0, MIT