-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.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://floralicense.org/license/
-//
-// 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.
-//
+/*
+ * 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/internal/controls/scrollable/item-view/item-view-impl.h>
#include <dali/public-api/events/mouse-wheel-event.h>
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
#include <dali-toolkit/internal/controls/scrollable/scroll-connector-impl.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
using namespace std;
using namespace Dali;
const float MILLISECONDS_PER_SECONDS = 1000.0f;
-const char* OVERSHOOT_OVERLAY_RIPPLE_IMAGE_PATH = DALI_IMAGE_DIR "overshoot_ripple.png";
const Rect<int> OVERSHOOT_BOUNCE_IMAGE_1_PIXEL_AREA( 0, 0, 720, 58 );
const Vector4 OVERSHOOT_OVERLAY_NINE_PATCH_BORDER(0.0f, 0.0f, 1.0f, 12.0f);
const float MAXIMUM_OVERSHOOT_HEIGHT = 36.0f; // 36 pixels
mIsFlicking(false),
mGestureState(Gesture::Clear),
mAddingItems(false),
- mRefreshEnabled(true)
+ mRefreshEnabled(true),
+ mItemsParentOrigin( ParentOrigin::CENTER),
+ mItemsAnchorPoint( AnchorPoint::CENTER)
{
SetRequiresMouseWheelEvents(true);
SetKeyboardNavigationSupport(true);
void ItemView::SetupActor( Item item, float durationSeconds )
{
- item.second.SetParentOrigin( ParentOrigin::CENTER );
- item.second.SetAnchorPoint( AnchorPoint::CENTER );
+ item.second.SetParentOrigin( mItemsParentOrigin );
+ item.second.SetAnchorPoint( mItemsAnchorPoint );
if( mActiveLayout )
{
return true;
}
-Actor ItemView::GetNextKeyboardFocusableActor(Actor actor, Control::KeyboardFocusNavigationDirection direction, bool loopEnabled)
+Actor ItemView::GetNextKeyboardFocusableActor(Actor actor, Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled)
{
Actor nextFocusActor;
if(mActiveLayout)
Actor self = Self();
if( enable )
{
- mOvershootEffect = OvershootRippleEffect::New();
- Image overshootImage = Image::New( OVERSHOOT_OVERLAY_RIPPLE_IMAGE_PATH );
- mOvershootOverlay = ImageActor::New( overshootImage );
+ mOvershootEffect = BouncingEffect::New(Scrollable::DEFAULT_OVERSHOOT_COLOUR);
+ mOvershootOverlay = CreateSolidColorActor(Vector4::ONE);
mOvershootOverlay.SetParentOrigin(ParentOrigin::TOP_LEFT);
mOvershootOverlay.SetAnchorPoint(AnchorPoint::TOP_LEFT);
mOvershootOverlay.SetDrawMode(DrawMode::OVERLAY);
mOvershootOverlay.SetShaderEffect(mOvershootEffect);
- mOvershootOverlay.SetPixelArea(OVERSHOOT_BOUNCE_IMAGE_1_PIXEL_AREA);
self.Add(mOvershootOverlay);
Constraint constraint = Constraint::New<float>( Actor::SIZE_WIDTH,
ParentSource( mPropertyScrollDirection ),
OvershootOverlayVisibilityConstraint() );
mOvershootOverlay.ApplyConstraint(constraint);
- int effectOvershootPropertyIndex = mOvershootEffect.GetPropertyIndex(mOvershootEffect.GetOvershootPropertyName());
+ int effectOvershootPropertyIndex = mOvershootEffect.GetPropertyIndex(mOvershootEffect.GetProgressRatePropertyName());
Actor self = Self();
constraint = Constraint::New<float>( effectOvershootPropertyIndex,
Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ),
mAnimatingOvershootOn = animatingOn;
}
+void ItemView::SetItemsParentOrigin( const Vector3& parentOrigin )
+{
+ if( parentOrigin != mItemsParentOrigin )
+ {
+ mItemsParentOrigin = parentOrigin;
+ for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ {
+ iter->second.SetParentOrigin(parentOrigin);
+ }
+ }
+}
+
+Vector3 ItemView::GetItemsParentOrigin() const
+{
+ return mItemsParentOrigin;
+}
+
+void ItemView::SetItemsAnchorPoint( const Vector3& anchorPoint )
+{
+ if( anchorPoint != mItemsAnchorPoint )
+ {
+ mItemsAnchorPoint = anchorPoint;
+ for (ItemPoolIter iter = mItemPool.begin(); iter != mItemPool.end(); ++iter)
+ {
+ iter->second.SetAnchorPoint(anchorPoint);
+ }
+ }
+}
+
+Vector3 ItemView::GetItemsAnchorPoint() const
+{
+ return mItemsAnchorPoint;
+}
+
} // namespace Internal
} // namespace Toolkit