utc-Dali-ConfirmationPopup.cpp
utc-Dali-CubeTransitionEffect.cpp
utc-Dali-EffectsView.cpp
+ utc-Dali-Fade.cpp
utc-Dali-FlexContainer.cpp
utc-Dali-FlexNode.cpp
utc-Dali-GaussianBlurView.cpp
--- /dev/null
+/*
+ * Copyright (c) 2021 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.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/public-api/transition/transition-set.h>
+#include <dali-toolkit/public-api/transition/transition-base.h>
+#include <dali-toolkit/public-api/transition/fade.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+// Functor to test whether a Finish signal is emitted
+struct TransitionFinishCheck
+{
+ TransitionFinishCheck(bool& signalReceived)
+ : mSignalReceived(signalReceived)
+ {
+ }
+
+ void operator()(TransitionSet& transitionSet)
+ {
+ mSignalReceived = true;
+ }
+
+ void Reset()
+ {
+ mSignalReceived = false;
+ }
+
+ void CheckSignalReceived()
+ {
+ if(!mSignalReceived)
+ {
+ tet_printf("Expected Finish signal was not received\n");
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ void CheckSignalNotReceived()
+ {
+ if(mSignalReceived)
+ {
+ tet_printf("Unexpected Finish signal was received\n");
+ tet_result(TET_FAIL);
+ }
+ else
+ {
+ tet_result(TET_PASS);
+ }
+ }
+
+ bool& mSignalReceived; // owned by individual tests
+};
+
+int UtcDaliFadeSetGetProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliFadeSetGetProperty");
+
+ Control control = Control::New();
+
+ Fade fade = Fade::New(control, 0.5, TimePeriod(-0.5f, -0.5f));
+
+ TimePeriod timePeriod = fade.GetTimePeriod();
+ DALI_TEST_EQUALS(0.0f, timePeriod.delaySeconds, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, timePeriod.durationSeconds, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliFadeWithOffScene(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliFadeWithOffScene");
+
+ Control control = Control::New();
+ control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
+ control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
+ control.SetProperty(Actor::Property::OPACITY, 1.0f);
+ Property::Map controlProperty;
+ controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
+ controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
+
+ application.SendNotification();
+ application.Render(20);
+
+ DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+ Fade fade = Fade::New(control, 0.5, TimePeriod(0.5f));
+ fade.SetAppearingTransition(false); // set fade out
+ TransitionSet transitionSet = TransitionSet::New();
+ transitionSet.AddTransition(fade);
+ transitionSet.Play();
+
+ bool signalReceived(false);
+ TransitionFinishCheck finishCheck(signalReceived);
+ transitionSet.FinishedSignal().Connect(&application, finishCheck);
+
+ application.SendNotification();
+ application.Render(400);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(200);
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ application.SendNotification();
+ application.Render(20);
+
+ DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliFadeOut(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliFadeOut");
+
+ Control control = Control::New();
+ control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
+ control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
+ control.SetProperty(Actor::Property::OPACITY, 1.0f);
+ Property::Map controlProperty;
+ controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
+ controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
+
+ application.GetScene().Add(control);
+
+ application.SendNotification();
+ application.Render(20);
+
+ DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+ Fade fade = Fade::New(control, 0.5, TimePeriod(0.5f));
+ fade.SetAppearingTransition(false); // set fade out
+ TransitionSet transitionSet = TransitionSet::New();
+ transitionSet.AddTransition(fade);
+ transitionSet.Play();
+
+ bool signalReceived(false);
+ TransitionFinishCheck finishCheck(signalReceived);
+ transitionSet.FinishedSignal().Connect(&application, finishCheck);
+
+ application.SendNotification();
+ application.Render(400);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ float currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
+ DALI_TEST_CHECK(currentOpacity <= 0.7 && currentOpacity >= 0.5);
+
+ application.SendNotification();
+ application.Render(200);
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ application.SendNotification();
+ application.Render(20);
+
+ // Property is reset after animation.
+ DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliFadeIn(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliFadeIn");
+
+ Control control = Control::New();
+ control.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ control.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ control.SetProperty(Actor::Property::POSITION, Vector3(100, 200, 0));
+ control.SetProperty(Actor::Property::SIZE, Vector3(150, 150, 0));
+ control.SetProperty(Actor::Property::OPACITY, 1.0f);
+ Property::Map controlProperty;
+ controlProperty.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
+ controlProperty.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ control.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty);
+
+ application.GetScene().Add(control);
+
+ application.SendNotification();
+ application.Render(20);
+
+ DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+ Fade fade = Fade::New(control, 0.5, TimePeriod(0.5f));
+ fade.SetAppearingTransition(true); // set fade in
+ TransitionSet transitionSet = TransitionSet::New();
+ transitionSet.AddTransition(fade);
+ transitionSet.Play();
+
+ bool signalReceived(false);
+ TransitionFinishCheck finishCheck(signalReceived);
+ transitionSet.FinishedSignal().Connect(&application, finishCheck);
+
+ application.SendNotification();
+ application.Render(400);
+
+ // We didn't expect the animation to finish yet
+ application.SendNotification();
+ finishCheck.CheckSignalNotReceived();
+
+ float currentOpacity = control.GetCurrentProperty<float>(Actor::Property::OPACITY);
+ DALI_TEST_CHECK(currentOpacity <= 1.0 && currentOpacity >= 0.8);
+
+ application.SendNotification();
+ application.Render(200);
+
+ // We did expect the animation to finish
+ application.SendNotification();
+ finishCheck.CheckSignalReceived();
+
+ application.SendNotification();
+ application.Render(20);
+
+ DALI_TEST_EQUALS(1.0f, control.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
+
+ END_TEST;
+}
${toolkit_src_dir}/text/rendering/text-backend-impl.cpp
${toolkit_src_dir}/text/rendering/text-typesetter.cpp
${toolkit_src_dir}/text/rendering/view-model.cpp
+ ${toolkit_src_dir}/transition/fade-impl.cpp
${toolkit_src_dir}/transition/transition-base-impl.cpp
${toolkit_src_dir}/transition/transition-impl.cpp
${toolkit_src_dir}/transition/transition-lifecycle-controller.cpp
--- /dev/null
+/*
+ * Copyright (c) 2021 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/transition/fade-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/type-registry.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+namespace
+{
+const Dali::AlphaFunction DEFAULT_ALPHA_FUNCTION(Dali::AlphaFunction::DEFAULT);
+
+} // anonymous namespace
+
+FadePtr Fade::New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod)
+{
+ float delaySeconds = timePeriod.delaySeconds;
+ if(delaySeconds < 0.0f)
+ {
+ DALI_LOG_WARNING("delay should be greater than 0.0f.\n");
+ delaySeconds = 0.0f;
+ }
+
+ float durationSeconds = timePeriod.durationSeconds;
+ if(durationSeconds < 0.0f)
+ {
+ DALI_LOG_WARNING("duration should be greater than 0.0f.\n");
+ durationSeconds = 0.0f;
+ }
+
+ FadePtr fade = new Fade(control, Dali::Clamp(opacity, 0.0f, 1.0f), TimePeriod(delaySeconds, durationSeconds));
+
+ // Second-phase construction
+ fade->Initialize();
+
+ return fade;
+}
+
+Fade::Fade(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod)
+: TransitionBase(),
+ mTargetControl(control),
+ mOpacity(opacity)
+{
+ SetTarget(control);
+ SetTimePeriod(timePeriod);
+}
+
+Fade::~Fade()
+{
+}
+
+void Fade::OnPlay()
+{
+ Dali::Toolkit::Control targetControl = mTargetControl.GetHandle();
+ if(!targetControl || !targetControl[Dali::Actor::Property::CONNECTED_TO_SCENE])
+ {
+ DALI_LOG_ERROR("The Control is not added on the window\n");
+ return;
+ }
+
+ Property::Map initialPropertyMap;
+ Property::Map startPropertyMap;
+ Property::Map finishPropertyMap;
+
+ if(IsAppearingTransition())
+ {
+ initialPropertyMap.Insert(Dali::Actor::Property::OPACITY, 0.0f);
+ startPropertyMap.Insert(Dali::Actor::Property::OPACITY, mOpacity);
+ finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetControl[Dali::Actor::Property::OPACITY]);
+ }
+ else
+ {
+ initialPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetControl[Dali::Actor::Property::OPACITY]);
+ startPropertyMap.Insert(Dali::Actor::Property::OPACITY, targetControl[Dali::Actor::Property::OPACITY]);
+ finishPropertyMap.Insert(Dali::Actor::Property::OPACITY, mOpacity);
+ }
+
+ SetInitialPropertyMap(initialPropertyMap);
+ SetStartPropertyMap(startPropertyMap);
+ SetFinishPropertyMap(finishPropertyMap);
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_FADE_H
+#define DALI_TOOLKIT_INTERNAL_FADE_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/transition/transition-base-impl.h>
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/transition/fade.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/weak-handle.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+using FadePtr = IntrusivePtr<Fade>;
+
+class Fade : public TransitionBase
+{
+public:
+ /**
+ * @brief Create a new Fade object.
+ * @param[in] control A control of this transition.
+ * @param[in] opacity opacity value the control Opacity property will be changed from/to.
+ * @param[in] timePeriod The duration of the animation.
+ * @return A smart-pointer to the newly allocated Fade.
+ */
+ static FadePtr New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod);
+
+protected:
+ /**
+ * @copydoc Dali::Toolkit::Fade::OnPlay()
+ */
+ void OnPlay() override;
+
+protected:
+ /**
+ * @brief Construct a new Fade.
+ */
+ Fade(Dali::Toolkit::Control control,
+ float opacity,
+ TimePeriod timePeriod);
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference()
+ */
+ ~Fade() override;
+
+private:
+ // Undefined
+ Fade(const Fade&);
+
+ // Undefined
+ Fade& operator=(const Fade& rhs);
+
+private:
+ WeakHandle<Dali::Toolkit::Control> mTargetControl;
+ float mOpacity;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::Fade& GetImplementation(Dali::Toolkit::Fade& fade)
+{
+ DALI_ASSERT_ALWAYS(fade && "Fade handle is empty");
+
+ BaseObject& handle = fade.GetBaseObject();
+
+ return static_cast<Internal::Fade&>(handle);
+}
+
+inline const Internal::Fade& GetImplementation(const Dali::Toolkit::Fade& fade)
+{
+ DALI_ASSERT_ALWAYS(fade && "Fade handle is empty");
+
+ const BaseObject& handle = fade.GetBaseObject();
+
+ return static_cast<const Internal::Fade&>(handle);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_FADE_H
: mAlphaFunction(DEFAULT_ALPHA_FUNCTION),
mTimePeriod(TimePeriod(0.0f)),
mTransitionWithChild(false),
- mMoveTargetChildren(false)
+ mMoveTargetChildren(false),
+ mIsAppearingTransition(true)
{
}
*/
void TransitionFinished();
+ /**
+ * @brief Set this transition is appearing transition or not.
+ * @param[in] appearingTransition True if this transition is appearing transition.
+ */
+ void SetAppearingTransition(bool appearingTransition)
+ {
+ mIsAppearingTransition = appearingTransition;
+ }
+
protected:
/**
* @brief Set property map which will be used as a initial properties.
/**
* @brief Returns whether this transition will be applied to children of target or not.
*/
- bool IsTransitionWithChild()
+ bool IsTransitionWithChild() const
{
return mTransitionWithChild;
}
+ /**
+ * @brief Returns whether this transition is appearing transition or not
+ */
+ bool IsAppearingTransition() const
+ {
+ return mIsAppearingTransition;
+ }
+
protected:
/**
* Construct a new TransitionBase.
bool mTransitionWithChild; ///< True, if mTarget transition is inherit to its child Actors.
///< If this is false, the child Actors are moved to the child of mCopiedActor that will have original properties of target Actor during Transition.
bool mMoveTargetChildren; ///< Flag, if mTransitionWithChild is false and mTarget has children than True.
+ bool mIsAppearingTransition; ///< True, if this transition is appearing transition.
};
} // namespace Internal
void Transition::OnPlay()
{
- if(!mSourceControl[Dali::Actor::Property::CONNECTED_TO_SCENE] ||
- !mDestinationControl[Dali::Actor::Property::CONNECTED_TO_SCENE])
+ Dali::Toolkit::Control sourceControl = mSourceControl.GetHandle();
+ Dali::Toolkit::Control destinationControl = mDestinationControl.GetHandle();
+ if(!sourceControl || !sourceControl[Dali::Actor::Property::CONNECTED_TO_SCENE] ||
+ !destinationControl || !destinationControl[Dali::Actor::Property::CONNECTED_TO_SCENE])
{
DALI_LOG_ERROR("The source or destination is not added on the window\n");
return;
}
//Make startPropertyMap and finishPropertyMap to use for property animation.
- Matrix sourceWorldTransform = mSourceControl[Dali::Actor::Property::WORLD_MATRIX];
+ Matrix sourceWorldTransform = sourceControl[Dali::Actor::Property::WORLD_MATRIX];
Vector3 sourcePosition, sourceScale;
Quaternion sourceOrientation;
sourceWorldTransform.GetTransformComponents(sourcePosition, sourceOrientation, sourceScale);
- Matrix destinationWorldTransform = GetWorldTransform(mDestinationControl);
+ Matrix destinationWorldTransform = GetWorldTransform(destinationControl);
Vector3 destinationPosition, destinationScale;
Quaternion destinationOrientation;
destinationWorldTransform.GetTransformComponents(destinationPosition, destinationOrientation, destinationScale);
- Vector3 targetSize = mDestinationControl[Dali::Actor::Property::SIZE];
- Vector4 targetColor = GetWorldColor(mDestinationControl);
+ Vector3 targetSize = destinationControl[Dali::Actor::Property::SIZE];
+ Vector4 targetColor = GetWorldColor(destinationControl);
Property::Map startPropertyMap;
Property::Map finishPropertyMap;
// Use world transform if this transition requires animation of transform.
- mDestinationControl[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
- mDestinationControl[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
- mDestinationControl[Dali::Actor::Property::POSITION_USES_ANCHOR_POINT] = true;
- mDestinationControl[Dali::Actor::Property::INHERIT_POSITION] = false;
- mDestinationControl[Dali::Actor::Property::INHERIT_ORIENTATION] = false;
- mDestinationControl[Dali::Actor::Property::INHERIT_SCALE] = false;
- mDestinationControl[Dali::Actor::Property::COLOR_MODE] = Dali::ColorMode::USE_OWN_COLOR;
+ destinationControl[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ destinationControl[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+ destinationControl[Dali::Actor::Property::POSITION_USES_ANCHOR_POINT] = true;
+ destinationControl[Dali::Actor::Property::INHERIT_POSITION] = false;
+ destinationControl[Dali::Actor::Property::INHERIT_ORIENTATION] = false;
+ destinationControl[Dali::Actor::Property::INHERIT_SCALE] = false;
+ destinationControl[Dali::Actor::Property::COLOR_MODE] = Dali::ColorMode::USE_OWN_COLOR;
// Set animation of Transform
startPropertyMap.Insert(Dali::Actor::Property::POSITION, sourcePosition);
startPropertyMap.Insert(Dali::Actor::Property::SCALE, sourceScale);
finishPropertyMap.Insert(Dali::Actor::Property::SCALE, destinationScale);
- Vector4 sourceColor = mSourceControl.GetCurrentProperty<Vector4>(Dali::Actor::Property::WORLD_COLOR);
+ Vector4 sourceColor = sourceControl.GetCurrentProperty<Vector4>(Dali::Actor::Property::WORLD_COLOR);
startPropertyMap.Insert(Dali::Actor::Property::COLOR, sourceColor);
finishPropertyMap.Insert(Dali::Actor::Property::COLOR, targetColor);
// Set animation for other properties if source and destination is different.
- Vector3 sourceSize = mSourceControl.GetCurrentProperty<Vector3>(Dali::Actor::Property::SIZE);
+ Vector3 sourceSize = sourceControl.GetCurrentProperty<Vector3>(Dali::Actor::Property::SIZE);
if(sourceSize != targetSize)
{
startPropertyMap.Insert(Dali::Actor::Property::SIZE, sourceSize);
// source View becomes transparent during transition.
if(IsTransitionWithChild())
{
- mSourceControl[Dali::Actor::Property::VISIBLE] = false;
+ sourceControl[Dali::Actor::Property::VISIBLE] = false;
}
else
{
- GetImplementation(mSourceControl).SetTransparent(true);
+ GetImplementation(sourceControl).SetTransparent(true);
}
Dali::Animation animation = GetAnimation();
DALI_LOG_ERROR("animation is still not initialized\n");
return;
}
- Dali::Toolkit::DevelControl::CreateTransitions(mDestinationControl, animation, mSourceControl, GetAlphaFunction(), GetTimePeriod());
+ Dali::Toolkit::DevelControl::CreateTransitions(destinationControl, animation, sourceControl, GetAlphaFunction(), GetTimePeriod());
}
void Transition::OnFinished()
{
+ Dali::Toolkit::Control sourceControl = mSourceControl.GetHandle();
+ if(!sourceControl)
+ {
+ return;
+ }
+
if(IsTransitionWithChild())
{
- mSourceControl[Dali::Actor::Property::VISIBLE] = true;
+ sourceControl[Dali::Actor::Property::VISIBLE] = true;
}
else
{
- GetImplementation(mSourceControl).SetTransparent(false);
+ GetImplementation(sourceControl).SetTransparent(false);
}
}
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/transition/transition.h>
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/weak-handle.h>
+
namespace Dali
{
namespace Toolkit
* @brief Create a new Transition object.
* @param[in] source A source control of this transition.
* @param[in] destination A destination control of this transition.
- * @param[in] durationSeconds The duration of the animation.
+ * @param[in] timePeriod The timePeriod of the animation.
* @return A smart-pointer to the newly allocated Transition.
*/
static TransitionPtr New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, TimePeriod timePeriod);
Transition& operator=(const Transition& rhs);
private:
- Dali::Toolkit::Control mSourceControl;
- Dali::Toolkit::Control mDestinationControl;
+ WeakHandle<Dali::Toolkit::Control> mSourceControl;
+ WeakHandle<Dali::Toolkit::Control> mDestinationControl;
};
} // namespace Internal
${public_api_src_dir}/image-loader/async-image-loader.cpp
${public_api_src_dir}/image-loader/sync-image-loader.cpp
${public_api_src_dir}/styling/style-manager.cpp
+ ${public_api_src_dir}/transition/fade.cpp
${public_api_src_dir}/transition/transition-base.cpp
${public_api_src_dir}/transition/transition-set.cpp
${public_api_src_dir}/transition/transition.cpp
)
SET( public_api_transition_header_files
+ ${public_api_src_dir}/transition/fade.h
${public_api_src_dir}/transition/transition-base.h
${public_api_src_dir}/transition/transition-set.h
${public_api_src_dir}/transition/transition.h
--- /dev/null
+/*
+ * Copyright (c) 2021 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/public-api/transition/fade.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/transition/fade-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+Fade::Fade() = default;
+
+Fade::Fade(Internal::Fade* fade)
+: TransitionBase(fade)
+{
+}
+
+Fade Fade::New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod)
+{
+ Internal::FadePtr internal = Dali::Toolkit::Internal::Fade::New(control, opacity, timePeriod);
+
+ return Fade(internal.Get());
+}
+
+Fade Fade::DownCast(BaseHandle handle)
+{
+ return Fade(dynamic_cast<Dali::Toolkit::Internal::Fade*>(handle.GetObjectPtr()));
+}
+
+Fade::~Fade() = default;
+
+Fade::Fade(const Fade& handle) = default;
+
+Fade& Fade::operator=(const Fade& rhs) = default;
+
+Fade::Fade(Fade&& rhs) = default;
+
+Fade& Fade::operator=(Fade&& rhs) = default;
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_FADE_H
+#define DALI_TOOLKIT_FADE_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/transition/transition-base.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal DALI_INTERNAL
+{
+class Fade;
+}
+
+/**
+ * @brief Fade provides smoothly appearing/disappearing effects for target Control.
+ */
+class DALI_TOOLKIT_API Fade : public TransitionBase
+{
+public:
+ /**
+ * @brief Creates an uninitialized Fade; this can be initialized with Fade::New().
+ *
+ * Calling member functions with an uninitialized Fade handle is not allowed.
+ */
+ Fade();
+
+ /**
+ * @brief Creates an initialized Fade.
+ *
+ * @param[in] control A control of this transition.
+ * @param[in] opacity opacity value the control Opacity property will be changed from/to. Opacity must be between [0, 1].
+ * @param[in] timePeriod The duration of the animation.
+ * @return A handle to a newly allocated Dali resource
+ */
+ static Fade New(Dali::Toolkit::Control control, float opacity, TimePeriod timePeriod);
+
+ /**
+ * @brief Downcasts a handle to Fade handle.
+ *
+ * If handle points to an Fade object, the downcast produces valid handle.
+ * If not, the returned handle is left uninitialized.
+ *
+ * @param[in] handle Handle to an object
+ * @return Handle to an Fade object or an uninitialized handle
+ */
+ static Fade DownCast(BaseHandle handle);
+
+ /**
+ * @brief Destructor.
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~Fade();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param[in] handle A reference to the copied handle
+ */
+ Fade(const Fade& handle);
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param[in] rhs A reference to the copied handle
+ * @return A reference to this
+ */
+ Fade& operator=(const Fade& rhs);
+
+ /**
+ * @brief Move constructor.
+ *
+ * @param[in] rhs A reference to the moved handle
+ */
+ Fade(Fade&& rhs);
+
+ /**
+ * @brief Move assignment operator.
+ *
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this handle
+ */
+ Fade& operator=(Fade&& rhs);
+
+public: // Not intended for use by Application developers
+ /// @cond internal
+ /**
+ * @brief This constructor is used by Fade::New() methods.
+ * @param[in] fade A pointer to a newly allocated Dali resource
+ */
+ explicit DALI_INTERNAL Fade(Internal::Fade* fade);
+ /// @endcond
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_FADE_H
void TransitionBase::TransitionWithChild(bool transitionWithChild)
{
- return GetImplementation(*this).TransitionWithChild(transitionWithChild);
+ GetImplementation(*this).TransitionWithChild(transitionWithChild);
+}
+
+void TransitionBase::SetAppearingTransition(bool appearingTransition)
+{
+ GetImplementation(*this).SetAppearingTransition(appearingTransition);
}
} // namespace Toolkit
AlphaFunction GetAlphaFunction() const;
/**
- * @brief A View could be transition with its child Views or without them.
+ * @brief A Control could be transition with its child Controls or without them.
+ * @param[in] transitionWithChild True if the Control is transitioned with children.
*/
void TransitionWithChild(bool transitionWithChild);
+ /**
+ * @brief Set this transition is appearing transition or not.
+ * @param[in] appearingTransition True if this transition is appearing transition.
+ */
+ void SetAppearingTransition(bool appearingTransition);
+
public: // Not intended for use by Application developers
/// @cond internal
/**