From: Adeel Kazmi Date: Fri, 6 Jan 2017 16:27:11 +0000 (-0800) Subject: Merge "Added nested TableView KeyboardFocus support" into devel/master X-Git-Tag: dali_1.2.22~6 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=db152116b8c7de79b206d7d361c9d3875d05d0ac;hp=4b39e83277d8bdd962e5a2933aedcfe10df75f83 Merge "Added nested TableView KeyboardFocus support" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp index e8c266d..ed4d02c 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -207,12 +207,12 @@ void DummyControlImplOverride::OnPinch(const PinchGesture& pinch) { pinchCalled void DummyControlImplOverride::OnPan(const PanGesture& pan) { panCalled = true; } void DummyControlImplOverride::OnTap(const TapGesture& tap) { tapCalled = true; } void DummyControlImplOverride::OnLongPress(const LongPressGesture& longPress) { longPressCalled = true; } -void DummyControlImplOverride::OnStageConnection( int depth ) { Control::OnStageConnection( depth ); stageConnectionCalled = true; } +void DummyControlImplOverride::OnStageConnection( int depth ) { stageConnectionCalled = true; Control::OnStageConnection( depth ); } void DummyControlImplOverride::OnStageDisconnection() { stageDisconnectionCalled = true; Control::OnStageDisconnection(); } -void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; } -void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; } -void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { Control::OnSizeSet( targetSize ); sizeSetCalled = true; } -void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { Control::OnSizeAnimation( animation, targetSize ); sizeAnimationCalled = true; } +void DummyControlImplOverride::OnChildAdd(Actor& child) { childAddCalled = true; Control::OnChildAdd( child ); } +void DummyControlImplOverride::OnChildRemove(Actor& child) { childRemoveCalled = true; Control::OnChildRemove( child ); } +void DummyControlImplOverride::OnSizeSet(const Vector3& targetSize) { sizeSetCalled = true; Control::OnSizeSet( targetSize ); } +void DummyControlImplOverride::OnSizeAnimation(Animation& animation, const Vector3& targetSize) { sizeAnimationCalled = true; Control::OnSizeAnimation( animation, targetSize ); } bool DummyControlImplOverride::OnTouchEvent(const TouchEvent& event) { touchEventCalled = true; return false; } bool DummyControlImplOverride::OnHoverEvent(const HoverEvent& event) { hoverEventCalled = true; return false; } bool DummyControlImplOverride::OnWheelEvent(const WheelEvent& event) { wheelEventCalled = true; return false; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp index 81a5781..93ee34e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -607,3 +607,117 @@ int UtcDaliControlImplGetControlExtensionP(void) END_TEST; } + +int UtcDaliControlAutoClipping(void) +{ + ToolkitTestApplication application; + Control control = Control::New(); + + tet_infoline( "Test to see if a renderer gets added when we are clipping children" ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliControlAutoClippingN(void) +{ + ToolkitTestApplication application; + Control control = Control::New(); + control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Visual::Property::TYPE, Visual::COLOR ) + .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) ); + + tet_infoline( "Test to ensure that a renderer does NOT get added when we are clipping children and already have renderers/visuals" ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Only 1, not 2 + + // Ensure the background color is still RED rather than what's set by the automatic clipping + Property::Value value = control.GetProperty( Control::Property::BACKGROUND ); + Property::Map* map = value.GetMap(); + DALI_TEST_CHECK( map ); + Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR ); + DALI_TEST_CHECK( colorValue ); + DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliControlAutoClippingWhenAlreadyOnStage(void) +{ + ToolkitTestApplication application; + Control control = Control::New(); + + tet_infoline( "Test to see if a renderer gets added when we are clipping children and when already on stage" ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliControlAutoClippingWhenAlreadyOnStageN(void) +{ + ToolkitTestApplication application; + Control control = Control::New(); + control.SetProperty( Control::Property::BACKGROUND, Property::Map().Add( Visual::Property::TYPE, Visual::COLOR ) + .Add( ColorVisual::Property::MIX_COLOR, Color::RED ) ); + + tet_infoline( "Test to ensure that a renderer does NOT get added when we are clipping children and already have renderers/visuals and when already on stage" ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 1, control.GetRendererCount(), TEST_LOCATION ); // Still should be 1 + + // Ensure the background color is still RED rather than what's set by the automatic clipping + Property::Value value = control.GetProperty( Control::Property::BACKGROUND ); + Property::Map* map = value.GetMap(); + DALI_TEST_CHECK( map ); + Property::Value* colorValue = map->Find(ColorVisual::Property::MIX_COLOR ); + DALI_TEST_CHECK( colorValue ); + DALI_TEST_EQUALS( colorValue->Get< Vector4 >(), Color::RED, TEST_LOCATION ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp index 4a29efc..77c2436 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -1351,3 +1351,69 @@ int UtcDaliControlImplRegisterTwoVisualsAndEnableOnlyOne(void) END_TEST; } +int UtcDaliControlImplAutoClippingWithVisuals(void) +{ + ToolkitTestApplication application; + + tet_infoline( "Test to ensure a renderer does NOT get added when we've already registered a visual which we haven't enabled" ); + + DummyControl control = DummyControl::New(); + DummyControlImpl& controlImpl = static_cast( control.GetImplementation() ); + + Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get(); + Toolkit::Visual::Base visual; + Property::Map map; + map[Visual::Property::TYPE] = Visual::COLOR; + map[ColorVisual::Property::MIX_COLOR] = Color::RED; + visual = visualFactory.CreateVisual( map ); + DALI_TEST_CHECK(visual); + controlImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual, false ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + END_TEST; +} + +int UtcDaliControlImplAutoClippingWithVisualsAlreadyOnStage(void) +{ + ToolkitTestApplication application; + + tet_infoline( "Test to ensure a renderer does NOT get added when we've already registered a visual which we haven't enabled and we're already on the stage" ); + + DummyControl control = DummyControl::New(); + DummyControlImpl& controlImpl = static_cast( control.GetImplementation() ); + + Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get(); + Toolkit::Visual::Base visual; + Property::Map map; + map[Visual::Property::TYPE] = Visual::COLOR; + map[ColorVisual::Property::MIX_COLOR] = Color::RED; + visual = visualFactory.CreateVisual( map ); + DALI_TEST_CHECK(visual); + controlImpl.RegisterVisual( Control::CONTROL_PROPERTY_END_INDEX + 1, visual, false ); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + Stage::GetCurrent().Add( control ); + + application.SendNotification(); + application.Render(); + + control.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( 0, control.GetRendererCount(), TEST_LOCATION ); + + END_TEST; +} diff --git a/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp b/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp index 9bfb68c..085772e 100644 --- a/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp +++ b/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -277,8 +277,6 @@ void BloomView::OnInitialize() void BloomView::OnSizeSet(const Vector3& targetSize) { - Control::OnSizeSet( targetSize ); - mTargetSize = Vector2(targetSize); mChildrenRoot.SetSize(targetSize); mCompositeImageView.SetSize(targetSize); @@ -300,16 +298,18 @@ void BloomView::OnSizeSet(const Vector3& targetSize) Deactivate(); Activate(); } + + Control::OnSizeSet( targetSize ); } void BloomView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - if( child != mChildrenRoot && child != mInternalRoot) { mChildrenRoot.Add( child ); } + + Control::OnChildAdd( child ); } void BloomView::OnChildRemove( Actor& child ) diff --git a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp index 44bc39b..08cfc16 100644 --- a/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp +++ b/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -289,8 +289,6 @@ void EffectsView::OnInitialize() void EffectsView::OnSizeSet(const Vector3& targetSize) { - Control::OnSizeSet( targetSize ); - mTargetSize = Vector2(targetSize); // if we are already on stage, need to update render target sizes now to reflect the new size of this actor @@ -304,13 +302,15 @@ void EffectsView::OnSizeSet(const Vector3& targetSize) } mChildrenRoot.SetSize( targetSize ); + + Control::OnSizeSet( targetSize ); } void EffectsView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - Enable(); + + Control::OnStageConnection( depth ); } void EffectsView::OnStageDisconnection() @@ -328,12 +328,12 @@ void EffectsView::OnStageDisconnection() void EffectsView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - if( child != mChildrenRoot && child != mCameraForChildren ) { mChildrenRoot.Add( child ); } + + Control::OnChildAdd( child ); } void EffectsView::OnChildRemove( Actor& child ) diff --git a/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp b/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp index 94a92a7..03d4583 100644 --- a/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp +++ b/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -465,8 +465,6 @@ Property::Value FlexContainer::GetProperty( BaseObject* object, Property::Index void FlexContainer::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - // Anchor actor to top left of the container child.SetAnchorPoint( AnchorPoint::TOP_LEFT ); child.SetParentOrigin( ParentOrigin::TOP_LEFT ); @@ -478,6 +476,8 @@ void FlexContainer::OnChildAdd( Actor& child ) childNode.node->get_child = GetChildNodeAtIndex; childNode.node->is_dirty = IsNodeDirty; mChildrenNodes.push_back(childNode); + + Control::OnChildAdd( child ); } void FlexContainer::OnChildRemove( Actor& child ) @@ -562,11 +562,8 @@ void FlexContainer::OnSizeSet( const Vector3& size ) RelayoutRequest(); } -} -void FlexContainer::OnSizeAnimation( Animation& animation, const Vector3& targetSize ) -{ - // @todo Animate the children to their target size and position + Control::OnSizeSet( size ); } void FlexContainer::ComputeLayout() diff --git a/dali-toolkit/internal/controls/flex-container/flex-container-impl.h b/dali-toolkit/internal/controls/flex-container/flex-container-impl.h index f89c1f4..ce09e23 100644 --- a/dali-toolkit/internal/controls/flex-container/flex-container-impl.h +++ b/dali-toolkit/internal/controls/flex-container/flex-container-impl.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_INTERNAL_FLEX_CONTAINER_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -205,11 +205,6 @@ private: // From Control */ virtual void OnSizeSet( const Vector3& size ); - /** - * @copydoc CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&) - */ - virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize); - private: // Implementation /** diff --git a/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp b/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp index a202236..2dddad7 100644 --- a/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp +++ b/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -330,8 +330,6 @@ void GaussianBlurView::OnInitialize() void GaussianBlurView::OnSizeSet(const Vector3& targetSize) { - Control::OnSizeSet( targetSize ); - mTargetSize = Vector2(targetSize); mChildrenRoot.SetSize(targetSize); @@ -356,16 +354,18 @@ void GaussianBlurView::OnSizeSet(const Vector3& targetSize) Deactivate(); Activate(); } + + Control::OnSizeSet( targetSize ); } void GaussianBlurView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - if( child != mChildrenRoot && child != mInternalRoot) { mChildrenRoot.Add( child ); } + + Control::OnChildAdd( child ); } void GaussianBlurView::OnChildRemove( Actor& child ) diff --git a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp index 12205a6..bb48404 100644 --- a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp +++ b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -288,8 +288,6 @@ void Magnifier::SetFrameVisibility(bool visible) void Magnifier::OnSizeSet(const Vector3& targetSize) { - Control::OnSizeSet( targetSize ); - // TODO: Once Camera/CameraActor properties function as proper animatable properties // this code can disappear. // whenever the size of the magnifier changes, the field of view needs to change @@ -297,6 +295,8 @@ void Magnifier::OnSizeSet(const Vector3& targetSize) // a constraint yet as Camera/CameraActor properties are not animatable/constrainable. mActorSize = targetSize; Update(); + + Control::OnSizeSet( targetSize ); } float Magnifier::GetMagnificationFactor() const diff --git a/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp b/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp index dd90747..9c22982 100644 --- a/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp +++ b/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -428,8 +428,6 @@ Property::Value Model3dView::GetProperty( BaseObject* object, Property::Index in void Model3dView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - CustomActor self = Self(); self.AddRenderer( mRenderer ); @@ -449,6 +447,8 @@ void Model3dView::OnStageConnection( int depth ) constraint.AddSource( Source( self, Toolkit::Model3dView::Property::LIGHT_POSITION ) ); constraint.Apply(); } + + Control::OnStageConnection( depth ); } /////////////////////////////////////////////////////////// diff --git a/dali-toolkit/internal/controls/navigation-view/navigation-view-impl.cpp b/dali-toolkit/internal/controls/navigation-view/navigation-view-impl.cpp index 1d15650..5ddf48c 100644 --- a/dali-toolkit/internal/controls/navigation-view/navigation-view-impl.cpp +++ b/dali-toolkit/internal/controls/navigation-view/navigation-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -74,6 +74,8 @@ Toolkit::NavigationView NavigationView::New() void NavigationView::OnStageConnection( int depth ) { Self().SetSensitive(true); + + Control::OnStageConnection( depth ); } void NavigationView::Push( Actor& actor ) diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index dc60e63..a66813a 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -473,9 +473,9 @@ void PageTurnView::SetupShadowView() void PageTurnView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - SetupShadowView(); + + Control::OnStageConnection( depth ); } void PageTurnView::OnStageDisconnection() diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index d12e273..9794921 100644 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -1574,16 +1574,14 @@ bool Popup::OnDialogTouched( Actor actor, const TouchData& touch ) void Popup::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - mLayoutDirty = true; RelayoutRequest(); + + Control::OnStageConnection( depth ); } void Popup::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - // Re-parent any children added by user to the body layer. if( mAlterAddedChild ) { @@ -1594,6 +1592,8 @@ void Popup::OnChildAdd( Actor& child ) mLayoutDirty = true; RelayoutRequest(); } + + Control::OnChildAdd( child ); } void Popup::LayoutContext( const Vector2& size ) diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp index 2192d5e..6e301cb 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -496,6 +496,8 @@ void ScrollBar::OnSizeSet( const Vector3& size ) { mIndicator.SetSize(size.width, mIndicatorFixedHeight); } + + Control::OnSizeSet( size ); } void ScrollBar::SetScrollDirection( Toolkit::ScrollBar::Direction direction ) diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index 7770147..a5741ab 100755 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -997,6 +997,8 @@ void ItemView::OnChildAdd(Actor& child) Toolkit::ItemView::Property::SCROLL_CONTENT_SIZE); } } + + Scrollable::OnChildAdd( child ); } bool ItemView::OnWheelEvent(const WheelEvent& event) diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 0d8becc..0da1660 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -701,8 +701,6 @@ void ScrollView::OnInitialize() void ScrollView::OnStageConnection( int depth ) { - ScrollBase::OnStageConnection( depth ); - DALI_LOG_SCROLL_STATE("[0x%X]", this); if ( mSensitive ) @@ -710,11 +708,14 @@ void ScrollView::OnStageConnection( int depth ) SetScrollSensitive( false ); SetScrollSensitive( true ); } + if(IsOvershootEnabled()) { // try and make sure property notifications are set EnableScrollOvershoot(true); } + + ScrollBase::OnStageConnection( depth ); } void ScrollView::OnStageDisconnection() @@ -1941,6 +1942,8 @@ void ScrollView::OnSizeSet( const Vector3& size ) { mOvershootIndicator->Reset(); } + + ScrollBase::OnSizeSet( size ); } void ScrollView::OnChildAdd(Actor& child) diff --git a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp index b486fbb..c8605c1 100644 --- a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp +++ b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -297,12 +297,12 @@ void ShadowView::OnInitialize() void ShadowView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - if( child != mChildrenRoot && child != mBlurRootActor) { mChildrenRoot.Add( child ); } + + Control::OnChildAdd( child ); } void ShadowView::OnChildRemove( Actor& child ) diff --git a/dali-toolkit/internal/controls/slider/slider-impl.cpp b/dali-toolkit/internal/controls/slider/slider-impl.cpp index 1d2e001..f322618 100755 --- a/dali-toolkit/internal/controls/slider/slider-impl.cpp +++ b/dali-toolkit/internal/controls/slider/slider-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -205,10 +205,6 @@ void Slider::OnInitialize() self.TouchSignal().Connect( this, &Slider::OnTouch ); } -void Slider::OnSizeSet( const Vector3& size ) -{ -} - void Slider::OnRelayout( const Vector2& size, RelayoutContainer& container ) { SetHitRegion( Vector2( size.x, GetHitRegion().y ) ); diff --git a/dali-toolkit/internal/controls/slider/slider-impl.h b/dali-toolkit/internal/controls/slider/slider-impl.h index 7879f37..cbb23b0 100755 --- a/dali-toolkit/internal/controls/slider/slider-impl.h +++ b/dali-toolkit/internal/controls/slider/slider-impl.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_INTERNAL_SLIDER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -282,11 +282,6 @@ protected: virtual ~Slider(); /** - * @copydoc CustomActorImpl::OnSizeSet( const Vector3& size ) - */ - virtual void OnSizeSet( const Vector3& size ); - - /** * @copydoc CustomActorImpl::OnRelayout */ virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); diff --git a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp index 4e74276..a93257d 100644 --- a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp +++ b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -292,6 +292,8 @@ void SuperBlurView::OnSizeSet( const Vector3& targetSize ) SetImage( mInputImage ); } } + + Control::OnSizeSet( targetSize ); } void SuperBlurView::OnStageConnection( int depth ) @@ -301,7 +303,7 @@ void SuperBlurView::OnStageConnection( int depth ) return; } - // Chaining up first ensures visuals have SetOnStage called to create their renderers + // Exception to the rule, chaining up first ensures visuals have SetOnStage called to create their renderers Control::OnStageConnection( depth ); Actor self = Self(); @@ -310,6 +312,7 @@ void SuperBlurView::OnStageConnection( int depth ) // Note that the renderer indices are depending on the order they been added to the actor // which might be different from the blur level of its texture. // We can check the depth index of the renderer to know which blurred image it renders. + // All visuals WILL have renderers at this point as we are simply creating visuals with an Image handle. Renderer renderer = self.GetRendererAt( i ); int depthIndex = renderer.GetProperty(Renderer::Property::DEPTH_INDEX); if( depthIndex > 0 ) @@ -322,11 +325,6 @@ void SuperBlurView::OnStageConnection( int depth ) } } -void SuperBlurView::OnStageDisconnection( ) -{ - Control::OnStageDisconnection(); -} - Vector3 SuperBlurView::GetNaturalSize() { if( mInputImage ) diff --git a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h index 4380a6e..0c782c9 100644 --- a/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h +++ b/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_INTERNAL_SUPER_BLUR_VIEW_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -132,11 +132,6 @@ private: // from Control virtual void OnStageConnection( int depth ); /** - * @copydoc CustomActorImpl::OnStageDisconnection() - */ - virtual void OnStageDisconnection(); - - /** * @copydoc CustomActorImpl::GetNaturalSize() */ virtual Vector3 GetNaturalSize(); diff --git a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp index b616fcf..a674abb 100644 --- a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp +++ b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -795,6 +795,8 @@ void TableView::OnSizeSet( const Vector3& size ) // rows and columns must be recalculated or the new size will not take effect. mRowDirty = mColumnDirty = true; RelayoutRequest(); + + Control::OnSizeSet( size ); } void TableView::OnRelayout( const Vector2& size, RelayoutContainer& container ) @@ -961,98 +963,101 @@ Property::Value TableView::GetProperty( BaseObject* object, Property::Index inde void TableView::OnChildAdd( Actor& child ) { - Control::OnChildAdd( child ); - - if( mLayoutingChild ) + if( ! mLayoutingChild ) { - // we're in the middle of laying out children so no point doing anything here - return; - } + // Ensure we're not in the middle of laying out children - // Check child properties on actor to decide its position inside the table - HorizontalAlignment::Type horizontalAlignment = HorizontalAlignment::LEFT; - VerticalAlignment::Type verticalAlignment = VerticalAlignment::TOP; + // Check child properties on actor to decide its position inside the table + HorizontalAlignment::Type horizontalAlignment = HorizontalAlignment::LEFT; + VerticalAlignment::Type verticalAlignment = VerticalAlignment::TOP; - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ) != Property::NONE ) - { - std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ).Get(); - Scripting::GetEnumeration< HorizontalAlignment::Type >( value.c_str(), - HORIZONTAL_ALIGNMENT_STRING_TABLE, - HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT, - horizontalAlignment ); - } + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ) != Property::NONE ) + { + std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_HORIZONTAL_ALIGNMENT ).Get(); + Scripting::GetEnumeration< HorizontalAlignment::Type >( value.c_str(), + HORIZONTAL_ALIGNMENT_STRING_TABLE, + HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT, + horizontalAlignment ); + } - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ) != Property::NONE ) - { - std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ).Get(); - Scripting::GetEnumeration< VerticalAlignment::Type >( value.c_str(), - VERTICAL_ALIGNMENT_STRING_TABLE, - VERTICAL_ALIGNMENT_STRING_TABLE_COUNT, - verticalAlignment ); - } + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ) != Property::NONE ) + { + std::string value = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_VERTICAL_ALIGNMENT ).Get(); + Scripting::GetEnumeration< VerticalAlignment::Type >( value.c_str(), + VERTICAL_ALIGNMENT_STRING_TABLE, + VERTICAL_ALIGNMENT_STRING_TABLE_COUNT, + verticalAlignment ); + } - Toolkit::TableView::CellPosition cellPosition; - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::ROW_SPAN ) != Property::NONE ) - { - cellPosition.rowSpan = static_cast( child.GetProperty( Toolkit::TableView::ChildProperty::ROW_SPAN ).Get() ); - } + Toolkit::TableView::CellPosition cellPosition; + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::ROW_SPAN ) != Property::NONE ) + { + cellPosition.rowSpan = static_cast( child.GetProperty( Toolkit::TableView::ChildProperty::ROW_SPAN ).Get() ); + } - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::COLUMN_SPAN ) != Property::NONE ) - { - cellPosition.columnSpan = static_cast( child.GetProperty( Toolkit::TableView::ChildProperty::COLUMN_SPAN ).Get() ); - } + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::COLUMN_SPAN ) != Property::NONE ) + { + cellPosition.columnSpan = static_cast( child.GetProperty( Toolkit::TableView::ChildProperty::COLUMN_SPAN ).Get() ); + } - if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_INDEX ) != Property::NONE ) - { - Vector2 indices = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_INDEX ).Get(); - cellPosition.rowIndex = static_cast( indices.x ); - cellPosition.columnIndex = static_cast( indices.y ); + if( child.GetPropertyType( Toolkit::TableView::ChildProperty::CELL_INDEX ) != Property::NONE ) + { + Vector2 indices = child.GetProperty( Toolkit::TableView::ChildProperty::CELL_INDEX ).Get(); + cellPosition.rowIndex = static_cast( indices.x ); + cellPosition.columnIndex = static_cast( indices.y ); - AddChild( child, cellPosition ); - SetCellAlignment(cellPosition, horizontalAlignment, verticalAlignment); + AddChild( child, cellPosition ); + SetCellAlignment(cellPosition, horizontalAlignment, verticalAlignment); + } + else + { + bool availableCellFound = false; - // Do not continue - return; - } + // Find the first available cell to store the actor in + const unsigned int rowCount = mCellData.GetRows(); + const unsigned int columnCount = mCellData.GetColumns(); + for( unsigned int row = 0; row < rowCount && !availableCellFound; ++row ) + { + for( unsigned int column = 0; column < columnCount && !availableCellFound; ++column ) + { + if( !(mCellData[ row ][ column ].actor) ) + { + // Put the actor in the cell + CellData data; + data.actor = child; + data.position.columnIndex = column; + data.position.rowIndex = row; + data.horizontalAlignment = horizontalAlignment; + data.verticalAlignment = verticalAlignment; + mCellData[ row ][ column ] = data; + + availableCellFound = true; + break; + } + } + } - // Find the first available cell to store the actor in - const unsigned int rowCount = mCellData.GetRows(); - const unsigned int columnCount = mCellData.GetColumns(); - for( unsigned int row = 0; row < rowCount; ++row ) - { - for( unsigned int column = 0; column < columnCount; ++column ) - { - if( !(mCellData[ row ][ column ].actor) ) + if( ! availableCellFound ) { - // Put the actor in the cell + // No empty cells, so increase size of the table + unsigned int newColumnCount = ( columnCount > 0 ) ? columnCount : 1; + ResizeContainers( rowCount + 1, newColumnCount ); + + // Put the actor in the first cell of the new row CellData data; data.actor = child; - data.position.columnIndex = column; - data.position.rowIndex = row; + data.position.rowIndex = rowCount; + data.position.columnIndex = 0; data.horizontalAlignment = horizontalAlignment; data.verticalAlignment = verticalAlignment; - mCellData[ row ][ column ] = data; - - // Don't continue - RelayoutRequest(); - return; + mCellData[ rowCount ][ 0 ] = data; } + + RelayoutRequest(); } } - // No empty cells, so increase size of the table - unsigned int newColumnCount = ( columnCount > 0 ) ? columnCount : 1; - ResizeContainers( rowCount + 1, newColumnCount ); - - // Put the actor in the first cell of the new row - CellData data; - data.actor = child; - data.position.rowIndex = rowCount; - data.position.columnIndex = 0; - data.horizontalAlignment = horizontalAlignment; - data.verticalAlignment = verticalAlignment; - mCellData[ rowCount ][ 0 ] = data; - RelayoutRequest(); + Control::OnChildAdd( child ); } void TableView::OnChildRemove( Actor& child ) diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index fec052a..aab4f95 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -1374,13 +1374,13 @@ void TextEditor::KeyboardStatusChanged(bool keyboardShown) void TextEditor::OnStageConnection( int depth ) { - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - // Sets the depth to the visuals inside the text's decorator. mDecorator->SetTextDepth( depth ); // The depth of the text renderer is set in the RenderText() called from OnRelayout(). + + // Call the Control::OnStageConnection() to set the depth of the background. + Control::OnStageConnection( depth ); } bool TextEditor::OnTouched( Actor actor, const TouchData& touch ) diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 44dc851..63568e6 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -1572,13 +1572,13 @@ void TextField::KeyboardStatusChanged(bool keyboardShown) void TextField::OnStageConnection( int depth ) { - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - // Sets the depth to the visuals inside the text's decorator. mDecorator->SetTextDepth( depth ); // The depth of the text renderer is set in the RenderText() called from OnRelayout(). + + // Call the Control::OnStageConnection() to set the depth of the background. + Control::OnStageConnection( depth ); } bool TextField::OnTouched( Actor actor, const TouchData& touch ) diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index e4a8b53..9f7863f 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -790,14 +790,6 @@ void TextLabel::OnStageConnect( Dali::Actor actor ) } } -void TextLabel::OnStageConnection( int depth ) -{ - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - - // The depth of the text renderer is set in the RenderText() called from OnRelayout(). -} - void TextLabel::ScrollingFinished() { // Pure Virtual from TextScroller Interface diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.h b/dali-toolkit/internal/controls/text-controls/text-label-impl.h index c928763..bc2459f 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -95,11 +95,6 @@ private: // From Control */ virtual float GetHeightForWidth( float width ); - /** - * @copydoc Control::OnStageConnection() - */ - virtual void OnStageConnection( int depth ); - // From ControlInterface /** diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index c91f71d..459e534 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -394,15 +394,6 @@ void TextSelectionPopup::OnInitialize() self.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); } -void TextSelectionPopup::OnStageConnection( int depth ) -{ - DALI_LOG_INFO( gLogFilter, Debug::General, "TextSelectionPopup::OnStageConnection\n" ); - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - - // TextSelectionToolbar::OnStageConnection() will set the depths of all the popup's components. -} - void TextSelectionPopup::HideAnimationFinished( Animation& animation ) { Actor self = Self(); diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h index e2a9497..419720f 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -142,11 +142,6 @@ private: // From Control */ virtual void OnInitialize(); - /** - * @copydoc Control::OnStageConnection() - */ - virtual void OnStageConnection( int depth ); - private: // Implementation void HideAnimationFinished( Animation& animation ); diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp index 00c74f4..cdd2226 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -151,15 +151,6 @@ void TextSelectionToolbar::OnRelayout( const Vector2& size, RelayoutContainer& c mScrollView.SetRulerX( mRulerX ); } -void TextSelectionToolbar::OnStageConnection( int depth ) -{ - // Call the Control::OnStageConnection() to set the depth of the background. - Control::OnStageConnection( depth ); - - // Texts are controls, they have their own OnStageConnection() implementation. - // Icons are inside a TableView. It has it's own OnStageConnection() implementation. -} - void TextSelectionToolbar::SetPopupMaxSize( const Size& maxSize ) { mMaxSize = maxSize; diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h index 46e633b..d44daf0 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -97,11 +97,6 @@ private: // From Control virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); /** - * @copydoc Control::OnStageConnection() - */ - virtual void OnStageConnection( int depth ); - - /** * @brief Set max size of Popup * @param[in] maxSize Size (Vector2) */ diff --git a/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp b/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp index 851945d..441b640 100644 --- a/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp +++ b/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -317,8 +317,6 @@ void ToolBar::OnInitialize() void ToolBar::OnChildAdd(Actor& child) { - Control::OnChildAdd( child ); - if( !mInitializing ) { // An actor is being added through the Actor's API. @@ -335,6 +333,8 @@ void ToolBar::OnChildAdd(Actor& child) // No OnChildRemove method required because Actors are added to the mLayout table view, so if an // actor is removed using the Actor::RemoveChild method it will not remove anything because the // actor is in mLayout not in Self(). + + Control::OnChildAdd( child ); } } // namespace Internal diff --git a/dali-toolkit/internal/controls/video-view/video-view-impl.cpp b/dali-toolkit/internal/controls/video-view/video-view-impl.cpp index 51bf9a2..2ec07ef 100644 --- a/dali-toolkit/internal/controls/video-view/video-view-impl.cpp +++ b/dali-toolkit/internal/controls/video-view/video-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -439,13 +439,13 @@ void VideoView::SetDepthIndex( int depthIndex ) void VideoView::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - if( mVisual ) { CustomActor self = Self(); Toolkit::GetImplementation(mVisual).SetOnStage( self ); } + + Control::OnStageConnection( depth ); } void VideoView::OnStageDisconnection() diff --git a/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp index ffa43e0..460ea31 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -246,8 +246,6 @@ void CubeTransitionEffect::Initialize() void CubeTransitionEffect::OnStageConnection( int depth ) { - Control::OnStageConnection( depth ); - Geometry geometry = VisualFactoryCache::CreateQuadGeometry(); Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); @@ -262,6 +260,8 @@ void CubeTransitionEffect::OnStageConnection( int depth ) mCurrentRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, depth ); Self().AddRenderer( mCurrentRenderer ); + + Control::OnStageConnection( depth ); } void CubeTransitionEffect::OnStageDisconnection() diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index 5103060..c62684f 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,11 @@ namespace Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_CONTROL_VISUALS"); #endif +DALI_ENUM_TO_STRING_TABLE_BEGIN( CLIPPING_MODE ) +DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, DISABLED ) +DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, CLIP_CHILDREN ) +DALI_ENUM_TO_STRING_TABLE_END( CLIPPING_MODE ) + /** * Struct used to store Visual within the control, index is a unique key for each visual. */ @@ -1149,16 +1155,33 @@ void Control::OnStageConnection( int depth ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageConnection number of registered visuals(%d)\n", mImpl->mVisuals.Size() ); + Actor self( Self() ); + for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++) { // Check whether the visual is empty and enabled if( (*iter)->visual && (*iter)->enabled ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageConnection Setting visual(%d) on stage\n", (*iter)->index ); - Actor self( Self() ); Toolkit::GetImplementation((*iter)->visual).SetOnStage( self ); } } + + if( mImpl->mVisuals.Empty() && ! self.GetRendererCount() ) + { + Property::Value clippingValue = self.GetProperty( Actor::Property::CLIPPING_MODE ); + int clippingMode = ClippingMode::DISABLED; + if( clippingValue.Get( clippingMode ) ) + { + // Add a transparent background if we do not have any renderers or visuals so we clip our children + + if( clippingMode == ClippingMode::CLIP_CHILDREN ) + { + // Create a transparent background visual which will also get staged. + SetBackgroundColor( Color::TRANSPARENT ); + } + } + } } void Control::OnStageDisconnection() @@ -1197,6 +1220,29 @@ void Control::OnChildRemove(Actor& child) OnControlChildRemove( child ); } +void Control::OnPropertySet( Property::Index index, Property::Value propertyValue ) +{ + Actor self( Self() ); + if( index == Actor::Property::CLIPPING_MODE ) + { + // Only set the background if we're already on the stage and have no renderers or visuals + + if( mImpl->mVisuals.Empty() && ! self.GetRendererCount() && self.OnStage() ) + { + ClippingMode::Type clippingMode = ClippingMode::DISABLED; + if( Scripting::GetEnumerationProperty< ClippingMode::Type >( propertyValue, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, clippingMode ) ) + { + // Add a transparent background if we do not have one so we clip children + + if( clippingMode == ClippingMode::CLIP_CHILDREN ) + { + SetBackgroundColor( Color::TRANSPARENT ); + } + } + } + } +} + void Control::OnSizeSet(const Vector3& targetSize) { Toolkit::Visual::Base visual = GetVisual( Toolkit::Control::Property::BACKGROUND ); diff --git a/dali-toolkit/public-api/controls/control-impl.h b/dali-toolkit/public-api/controls/control-impl.h index 541d489..d850eb4 100644 --- a/dali-toolkit/public-api/controls/control-impl.h +++ b/dali-toolkit/public-api/controls/control-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_CONTROL_IMPL_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -393,7 +393,7 @@ protected: // From CustomActorImpl, not to be used by application developers /** * @copydoc CustomActorImpl::OnStageConnection() - * @note If overridden, then an up-call to Control::OnStageConnection MUST be made at the start. + * @note If overridden, then an up-call to Control::OnStageConnection MUST be made at the end. */ virtual void OnStageConnection( int depth ); @@ -405,7 +405,7 @@ protected: // From CustomActorImpl, not to be used by application developers /** * @copydoc CustomActorImpl::OnChildAdd() - * @note If overridden, then an up-call to Control::OnChildAdd MUST be made at the start. + * @note If overridden, then an up-call to Control::OnChildAdd MUST be made at the end. */ virtual void OnChildAdd( Actor& child ); @@ -416,14 +416,20 @@ protected: // From CustomActorImpl, not to be used by application developers virtual void OnChildRemove( Actor& child ); /** + * @copydoc CustomActorImpl::OnPropertySet() + * @note If overridden, then an up-call to Control::OnChildRemove MUST be made at the end. + */ + virtual void OnPropertySet( Property::Index index, Property::Value propertyValue ); + + /** * @copydoc CustomActorImpl::OnSizeSet() - * @note If overridden, then an up-call to Control::OnSizeSet MUST be made at the start. + * @note If overridden, then an up-call to Control::OnSizeSet MUST be made at the end. */ virtual void OnSizeSet( const Vector3& targetSize ); /** * @copydoc CustomActorImpl::OnSizeAnimation() - * @note If overridden, then an up-call to Control::OnSizeAnimation MUST be made at the start. + * @note If overridden, then an up-call to Control::OnSizeAnimation MUST be made at the end. */ virtual void OnSizeAnimation( Animation& animation, const Vector3& targetSize ); diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 6932c51..4d7751b 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 2; -const unsigned int TOOLKIT_MICRO_VERSION = 20; +const unsigned int TOOLKIT_MICRO_VERSION = 21; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/docs/content/shared-javascript-and-cpp-documentation/creating-custom-controls.md b/docs/content/shared-javascript-and-cpp-documentation/creating-custom-controls.md index a1451ee..54a0220 100644 --- a/docs/content/shared-javascript-and-cpp-documentation/creating-custom-controls.md +++ b/docs/content/shared-javascript-and-cpp-documentation/creating-custom-controls.md @@ -341,10 +341,10 @@ An up call to the Control class is necessary if these methods are overridden. // C++ void MyUIControlImpl::OnChildAdd( Actor& child ); { - // Up call to Control first - Control::OnChildAdd( child ); - // Do any other operations required upon child addition + + // Up call to Control at the end + Control::OnChildAdd( child ); } ~~~ ~~~{.cpp} @@ -371,10 +371,10 @@ An up call to the Control class is necessary if these methods are overridden. // C++ void MyUIControlImpl::OnStageConnection( int depth ) { - // Up call to Control first - Control::OnStageConnection( depth ); - // Do any other operations required upon stage connection + + // Up call to Control at the end + Control::OnStageConnection( depth ); } ~~~ ~~~{.cpp} @@ -449,6 +449,18 @@ More information on size negotiation can be found [here](@ref size-negotiation-c ___________________________________________________________________________________________________ +### Clipping Support {#creating-controls-clipping} + +When an Actor is set to clip its children, the renderers have to be added manually in order to specify what its children need to clip to. +The Control base class automates the creation of the renderers/visuals when it is set to clip its children. + +This is only done if the application or custom control writer has not added any renderers to the Control or registered any visuals +(regardless of whether these visuals are enabled or not). + +If custom control writers want to define the clipping visuals themselves, then they should register all required visuals before the control is staged. + +___________________________________________________________________________________________________ + ### Other Features {#creating-controls-other} + [Background](@ref background) diff --git a/packaging/dali-addon.spec b/packaging/dali-addon.spec index bee48fd..66af4d1 100644 --- a/packaging/dali-addon.spec +++ b/packaging/dali-addon.spec @@ -1,6 +1,6 @@ Name: dali-addon Summary: DALi module for Node.JS -Version: 1.2.20 +Version: 1.2.21 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 6cf533c..35d0ed9 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.2.20 +Version: 1.2.21 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-2-Clause and MIT