-#ifndef __DALI_TOOLKIT_INTERNAL_FLEX_CONTAINER_H__
-#define __DALI_TOOLKIT_INTERNAL_FLEX_CONTAINER_H__
+#ifndef DALI_TOOLKIT_INTERNAL_FLEX_CONTAINER_H
+#define DALI_TOOLKIT_INTERNAL_FLEX_CONTAINER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
*/
// EXTERNAL INCLUDES
-#include <dali/devel-api/object/weak-handle.h>
+#include <dali/public-api/object/weak-handle.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/flex-container/flex-container.h>
-extern "C"
-{
-#include <dali-toolkit/third-party/facebook-flexbox/layout.h>
-}
+#include <dali-toolkit/third-party/yoga/Yoga.h>
namespace Dali
{
-
namespace Toolkit
{
-
namespace Internal
{
-
/**
- * FlexContainer is a custom control for laying out actors in a flexbox layout
+ * FlexContainer is a custom control for laying out actors in a Flexbox layout
* @see Dali::Toolkit:FlexContainer for more details
*/
class FlexContainer : public Control
{
public:
-
/**
* The structure to store the style properties and layout information of flex item
*/
struct FlexItemNode
{
- WeakHandle< Dali::Actor > actor; ///< Actor handle of the flex item
- css_node_t* node; ///< The style properties and layout information
+ WeakHandle<Dali::Actor> actor; ///< Actor handle of the flex item
+ YGNodeRef node; ///< The style properties and layout information
};
- typedef std::vector< FlexItemNode > FlexItemNodeContainer;
+ typedef std::vector<FlexItemNode> FlexItemNodeContainer;
public:
-
/**
* Construct a new FlexContainer.
*/
* @param[in] index The property index.
* @param[in] value The new property value.
*/
- static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+ static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value);
/**
* Called to retrieve a property of an object of this type.
* @param[in] index The property index.
* @return The current value of the property.
*/
- static Property::Value GetProperty( BaseObject* object, Property::Index index );
+ static Property::Value GetProperty(BaseObject* object, Property::Index index);
private: // From Control
-
/**
* @copydoc Control::OnInitialize()
*/
- virtual void OnInitialize();
+ void OnInitialize() override;
/**
* @copydoc Control::OnChildAdd(Actor& child)
*/
- virtual void OnChildAdd( Actor& child );
+ void OnChildAdd(Actor& child) override;
/**
* @copydoc Control::OnChildRemove(Actor& child)
*/
- virtual void OnChildRemove( Actor& child );
+ void OnChildRemove(Actor& child) override;
/**
* @copydoc Control::OnRelayout
*/
- virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
/**
* @copydoc Control::RelayoutDependentOnChildren()
*/
- virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS );
+ bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS) override;
/**
* @copydoc Control::GetNextKeyboardFocusableActor
*/
- virtual Actor GetNextKeyboardFocusableActor( Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled );
+ Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled) override;
/**
* @copydoc CustomActorImpl::OnSizeSet( const Vector3& size )
*/
- virtual void OnSizeSet( const Vector3& size );
+ void OnSizeSet(const Vector3& size) override;
/**
- * @copydoc CustomActorImpl::OnSizeAnimation(Animation&, const Vector3&)
- */
- virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
+ * @copydoc OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type )
+ * @param[in] actor The actor whose layoutDirection is changed.
+ * @param[in] type The layoutDirection.
+ */
+ void OnLayoutDirectionChanged(Dali::Actor actor, Dali::LayoutDirection::Type type);
private: // Implementation
-
/**
* Calculate the layout properties of all the children
*/
virtual ~FlexContainer();
private:
-
// Undefined copy constructor and assignment operators
FlexContainer(const FlexContainer&);
FlexContainer& operator=(const FlexContainer& rhs);
-private: // Data
-
- FlexItemNode mRootNode; ///< Style properties and layout information of flex container
- FlexItemNodeContainer mChildrenNodes; ///< Style properties and layout information of flex items in the container
+private: // Data
+ FlexItemNode mRootNode; ///< Style properties and layout information of flex container
+ FlexItemNodeContainer mChildrenNodes; ///< Style properties and layout information of flex items in the container
- Toolkit::FlexContainer::ContentDirection mContentDirection; ///< The content direction of the container
- Toolkit::FlexContainer::FlexDirection mFlexDirection; ///< The flex direction of the container
- Toolkit::FlexContainer::WrapType mFlexWrap; ///< The wrap type of the container
- Toolkit::FlexContainer::Justification mJustifyContent; ///< The alignment of flex items in the container on the main-axis
- Toolkit::FlexContainer::Alignment mAlignItems; ///< The alignment of flex items in the container on the cross-axis
- Toolkit::FlexContainer::Alignment mAlignContent; ///< The alignment of flex lines in the container on the cross-axis
+ Toolkit::FlexContainer::ContentDirection mContentDirection; ///< The content direction of the container
+ Toolkit::FlexContainer::FlexDirection mFlexDirection; ///< The flex direction of the container
+ Toolkit::FlexContainer::WrapType mFlexWrap; ///< The wrap type of the container
+ Toolkit::FlexContainer::Justification mJustifyContent; ///< The alignment of flex items in the container on the main-axis
+ Toolkit::FlexContainer::Alignment mAlignItems; ///< The alignment of flex items in the container on the cross-axis
+ Toolkit::FlexContainer::Alignment mAlignContent; ///< The alignment of flex lines in the container on the cross-axis
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::FlexContainer& GetImpl( Toolkit::FlexContainer& flexContainer )
+inline Toolkit::Internal::FlexContainer& GetImpl(Toolkit::FlexContainer& flexContainer)
{
DALI_ASSERT_ALWAYS(flexContainer);
return static_cast<Toolkit::Internal::FlexContainer&>(handle);
}
-inline const Toolkit::Internal::FlexContainer& GetImpl( const Toolkit::FlexContainer& flexContainer )
+inline const Toolkit::Internal::FlexContainer& GetImpl(const Toolkit::FlexContainer& flexContainer)
{
DALI_ASSERT_ALWAYS(flexContainer);
} // namespace Dali
-#endif // __DALI_TOOLKIT_INTERNAL_FLEX_CONTAINER_H__
+#endif // DALI_TOOLKIT_INTERNAL_FLEX_CONTAINER_H