X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftable-view%2Ftable-view-impl.h;h=b9b708f5b36639312c3e7334573518f7f3e9dce2;hp=55a7d7bd78f2f3aa80f12c57fcacbbd0d648af0f;hb=b1e8521ad77e7b4e62b59613b2edef64429130e9;hpb=834ddf7832598a57fc18c282371554a1ed8f0a78 diff --git a/dali-toolkit/internal/controls/table-view/table-view-impl.h b/dali-toolkit/internal/controls/table-view/table-view-impl.h old mode 100644 new mode 100755 index 55a7d7b..b9b708f --- a/dali-toolkit/internal/controls/table-view/table-view-impl.h +++ b/dali-toolkit/internal/controls/table-view/table-view-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_TABLE_VIEW_H__ -#define __DALI_TOOLKIT_INTERNAL_TABLE_VIEW_H__ +#ifndef DALI_TOOLKIT_INTERNAL_TABLE_VIEW_H +#define DALI_TOOLKIT_INTERNAL_TABLE_VIEW_H /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -18,9 +18,12 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include -#include +#include #include "array-2d.h" namespace Dali @@ -41,16 +44,6 @@ class TableView : public Control public: /** - * Enum for the size policies of rows and columns - */ - enum CellSizePolicy - { - FILL, ///< Fill up available space, may have a ratio associated with it - FIXED, ///< A specific fixed width or height - FIT ///< Fit around actors in the row or column - }; - - /** * Create a new TableView. * @return A smart-pointer to the newly allocated TableView. */ @@ -127,36 +120,24 @@ public: Size GetCellPadding(); /** - * @brief Set a row policy - * - * @param[in] rowIndex The row to set the policy for - * @param[in] policy The policy to set + * @copydoc Toolkit::TableView::SetFitHeight */ - void SetRowPolicy( unsigned int rowIndex, CellSizePolicy policy ); + void SetFitHeight( unsigned int rowIndex ); /** - * @brief Querry a row policy - * - * @param[in] rowIndex The row to querry - * @return Return the policy + * @copydoc Toolkit::TableView::IsFitHeight */ - CellSizePolicy GetRowPolicy( unsigned int rowIndex ) const; + bool IsFitHeight( unsigned int rowIndex ) const; /** - * @brief Set a column policy - * - * @param[in] columnIndex The column to set the policy for - * @param[in] policy The policy to set + * @copydoc Toolkit::TableView::SetFitWidth */ - void SetColumnPolicy( unsigned int columnIndex, CellSizePolicy policy ); + void SetFitWidth( unsigned int columnIndex ); /** - * @brief Querry a column policy - * - * @param[in] columnIndex The column to querry - * @return Return the policy + * @copydoc Toolkit::TableView::IsFitWidth */ - CellSizePolicy GetColumnPolicy( unsigned int columnIndex ) const; + bool IsFitWidth( unsigned int columnIndex ) const; /** * @copydoc Toolkit::TableView::SetFixedWidth @@ -234,14 +215,14 @@ public: private: // From Control /** - * @copydoc Control::OnControlChildAdd(Actor& child) + * @copydoc Control::OnChildAdd(Actor& child) */ - virtual void OnControlChildAdd( Actor& child ); + virtual void OnChildAdd( Actor& child ); /** - * @copydoc Control::OnControlChildRemove(Actor& child) + * @copydoc Control::OnChildRemove(Actor& child) */ - virtual void OnControlChildRemove( Actor& child ); + virtual void OnChildRemove( Actor& child ); /** * @copydoc Control::OnRelayout @@ -251,7 +232,7 @@ private: // From Control /** * @copydoc Control::CalculateChildSize */ - virtual float CalculateChildSize( const Actor& child, Dimension dimension ); + virtual float CalculateChildSize( const Actor& child, Dimension::Type dimension ); /** * @copydoc Control::OnInitialize() @@ -261,7 +242,7 @@ private: // From Control /** * @copydoc Control::GetNextKeyboardFocusableActor */ - virtual Actor GetNextKeyboardFocusableActor( Actor currentFocusedActor, Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled ); + virtual Actor GetNextKeyboardFocusableActor( Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled ); /** * @copydoc Control::GetNaturalSize() @@ -271,17 +252,22 @@ private: // From Control /** * @copydoc Control::RelayoutDependentOnChildren() */ - virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS ); + virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS ); /** * @copydoc Control::OnCalculateRelayoutSize */ - virtual void OnCalculateRelayoutSize( Dimension dimension ); + virtual void OnCalculateRelayoutSize( Dimension::Type dimension ); /** * @copydoc Control::OnLayoutNegotiated */ - virtual void OnLayoutNegotiated( float size, Dimension dimension ); + virtual void OnLayoutNegotiated( float size, Dimension::Type dimension ); + + /** + * @copydoc CustomActorImpl::OnSizeSet( const Vector3& size ) + */ + virtual void OnSizeSet( const Vector3& size ); private: // Implementation @@ -289,7 +275,7 @@ private: // Implementation * Struct to hold data for rows and columns * * If sizePolicy is FIXED then size is the absolute size to use. - * If sizePolicy is FIT or FILL then size is the calculated value of size. + * If sizePolicy is FIT, RELATIVE or FILL then size is the calculated value of size. */ struct RowColumnData { @@ -299,8 +285,8 @@ private: // Implementation RowColumnData() : size( 0.0f ), fillRatio( 0.0f ), - sizePolicy( FILL ), - userFillRatio( false ) + position( 0.0f ), + sizePolicy( Toolkit::TableView::FILL ) { } @@ -310,18 +296,18 @@ private: // Implementation * @param[in] newSize The size to set for this data * @param[in] newSizePolicy The policy used to interpret the size value */ - RowColumnData( float newSize, float newFillRatio, CellSizePolicy newSizePolicy, bool newUserFillRatio ) + RowColumnData( float newSize, float newFillRatio, Toolkit::TableView::LayoutPolicy newSizePolicy ) : size( newSize ), fillRatio( newFillRatio ), - sizePolicy( newSizePolicy ), - userFillRatio( newUserFillRatio ) + position( 0.0f ), + sizePolicy( newSizePolicy ) { } - float size; ///< Set or calculated size - float fillRatio; ///< Ratio to fill remaining space - CellSizePolicy sizePolicy; ///< The size policy used to interpret the size value - bool userFillRatio : 1; ///< FillRatio was set by user + float size; ///< Set or calculated size + float fillRatio; ///< Ratio to fill remaining space, only valid with RELATIVE or FILL policy + float position; ///< Position of the row/column, this value is updated during every Relayout round + Toolkit::TableView::LayoutPolicy sizePolicy; ///< The size policy used to interpret the size value }; typedef Dali::Vector RowColumnArray; @@ -387,11 +373,11 @@ private: bool RemoveAllInstances( const Actor& child ); /** - * @brief Compute relative sizes for an array + * @brief Calculate the ratio of FILL rows/columns * * @param[in] data The RowColumn data to compute the relative sizes for */ - void ComputeRelativeSizes( RowColumnArray& data ); + void CalculateFillSizes( RowColumnArray& data ); /** * @brief Calculate the total fixed sizes for a row or column @@ -401,20 +387,12 @@ private: float CalculateTotalFixedSize( const RowColumnArray& data ); /** - * @brief Calculate the fixed sizes for a row or column - * - * @param[in] data The row or column data to process - * @param[in] dimension The dimension being calculated: row == HEIGHT, column == WIDTH - */ - void CalculateFixedSizes( RowColumnArray& data, Dimension dimension ); - - /** - * @brief Calculate the value of the relative sizes + * @brief Calculate the sizes of FIT rows/columns * * @param[in] data The row or column data to process - * @param[in] size The size of the table view in that dimension + * @param[in] dimension The dimension being calculated: row == Dimension::HEIGHT, column == Dimension::WIDTH */ - void CalculateRelativeSizes( RowColumnArray& data, float size ); + void CalculateFitSizes( RowColumnArray& data, Dimension::Type dimension ); /** * @brief Search for a FIT cell in the array @@ -425,9 +403,12 @@ private: bool FindFit( const RowColumnArray& data ); /** - * @brief Calculate row and column data when it is dirty + * @brief Return the cell padding for a given dimension + * + * @param[in] dimension The dimension to return the padding for + * @return Return the padding (x = low, y = high) */ - void CalculateRowColumnData(); + Vector2 GetCellPadding( Dimension::Type dimension ); /** * A reference counted object may only be deleted by calling Unreference() @@ -439,13 +420,15 @@ private: // scripting support /** * Called to set the heights/widths property. * @param[in] tableViewImpl The object whose property is set. - * @param[in] funcFixed The set function to call, it can be SetFixedHeight or SetFixedWidths. - * @param[in] funcRelative The set function to call, it can be SetRelativeHeight or SetRelativeWidths. + * @param[in] funcFixed The set function to call, it can be SetFixedHeight or SetFixedWidth. + * @param[in] funcRelative The set function to call, it can be SetRelativeHeight or SetRelativeWidth. + * @param[in] funcFit The set function to call, it can be SetFitHeight or SetFiltWidth. * @param[in] value The new property value. */ static void SetHeightOrWidthProperty( TableView& tableViewImpl, void(TableView::*funcFixed)(unsigned int, float), void(TableView::*funcRelative)(unsigned int, float), + void(TableView::*funcFit)(unsigned int), const Property::Value& map ); /** @@ -510,15 +493,18 @@ private: private: // Data - Array2d mCellData; ///< Data for each cell: Actor, alignment settings etc + Array2d mCellData; ///< Data for each cell: Actor, alignment settings etc RowColumnArray mRowData; ///< Data for each row RowColumnArray mColumnData; ///< Data for each column Size mFixedTotals; ///< Accumulated totals for fixed width and height Size mPadding; ///< Padding to apply to each cell + + WeakHandle mPreviousFocusedActor; ///< Perviously focused actor bool mLayoutingChild; ///< Can't be a bitfield due to Relayouting lock - bool mRowColumnDirty : 1; ///< Flag to indicate the row column data is dirty + bool mRowDirty : 1; ///< Flag to indicate the row data is dirty + bool mColumnDirty : 1; ///< Flag to indicate the column data is dirty }; } // namespace Internal @@ -547,4 +533,4 @@ inline const Toolkit::Internal::TableView& GetImpl( const Toolkit::TableView& ta } // namespace Dali -#endif // __DALI_TOOLKIT_INTERNAL_TABLE_VIEW_H__ +#endif // DALI_TOOLKIT_INTERNAL_TABLE_VIEW_H