From: Richard Huang Date: Tue, 10 May 2016 15:16:25 +0000 (+0100) Subject: Make FlexContainer as public API X-Git-Tag: dali_1.1.35~1^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=refs%2Fchanges%2F60%2F68960%2F5 Make FlexContainer as public API Change-Id: Ieae39bee5056b9e45f1ed291fae7a6493fd6d7b0 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-FlexContainer.cpp b/automated-tests/src/dali-toolkit/utc-Dali-FlexContainer.cpp index a2009d0..b92e8e7 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-FlexContainer.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-FlexContainer.cpp @@ -19,7 +19,6 @@ #include #include #include -#include using namespace Dali; using namespace Toolkit; @@ -43,6 +42,9 @@ const char* const PROPERTY_NAME_FLEX_WRAP = "flexWrap"; const char* const PROPERTY_NAME_JUSTIFY_CONTENT = "justifyContent"; const char* const PROPERTY_NAME_ALIGN_ITEMS = "alignItems"; const char* const PROPERTY_NAME_ALIGN_CONTENT = "alignContent"; +const char* const CHILD_PROPERTY_NAME_FLEX = "flex"; +const char* const CHILD_PROPERTY_NAME_ALIGN_SELF = "alignSelf"; +const char* const CHILD_PROPERTY_NAME_FLEX_MARGIN = "flexMargin"; } // namespace @@ -145,6 +147,18 @@ int UtcDaliToolkitFlexContainerSetPropertyP(void) FlexContainer flexContainer = FlexContainer::New(); DALI_TEST_CHECK( flexContainer ); + // Add flex container to the stage + Stage::GetCurrent().Add( flexContainer ); + + // Create two actors and add them to the container + Actor actor1 = Actor::New(); + Actor actor2 = Actor::New(); + DALI_TEST_CHECK( actor1 ); + DALI_TEST_CHECK( actor2 ); + + flexContainer.Add(actor1); + flexContainer.Add(actor2); + // Check content direction property. flexContainer.SetProperty( FlexContainer::Property::CONTENT_DIRECTION, FlexContainer::RTL ); DALI_TEST_EQUALS( (FlexContainer::ContentDirection)flexContainer.GetProperty( FlexContainer::Property::CONTENT_DIRECTION ), FlexContainer::RTL, TEST_LOCATION ); @@ -172,3 +186,37 @@ int UtcDaliToolkitFlexContainerSetPropertyP(void) END_TEST; } +int UtcDaliToolkitFlexContainerSetChildPropertyP(void) +{ + ToolkitTestApplication application; + tet_infoline(" UtcDaliToolkitFlexContainerSetChildPropertyP"); + FlexContainer flexContainer = FlexContainer::New(); + DALI_TEST_CHECK( flexContainer ); + + // Add flex container to the stage + Stage::GetCurrent().Add( flexContainer ); + + // Create an actor and add it to the container + Actor actor = Actor::New(); + DALI_TEST_CHECK( actor ); + + flexContainer.Add(actor); + + // Check flex child property. + actor.SetProperty( FlexContainer::ChildProperty::FLEX, 2.0f ); + DALI_TEST_EQUALS( actor.GetProperty( FlexContainer::ChildProperty::FLEX ), 2.0f, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetPropertyIndex( CHILD_PROPERTY_NAME_FLEX ) == FlexContainer::ChildProperty::FLEX ); + + // Check align self child property. + actor.SetProperty( FlexContainer::ChildProperty::ALIGN_SELF, FlexContainer::ALIGN_FLEX_END ); + DALI_TEST_EQUALS( (FlexContainer::Alignment)actor.GetProperty( FlexContainer::ChildProperty::ALIGN_SELF ), FlexContainer::ALIGN_FLEX_END, TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetPropertyIndex( CHILD_PROPERTY_NAME_ALIGN_SELF ) == FlexContainer::ChildProperty::ALIGN_SELF ); + + // Check flex margin child property. + actor.SetProperty( FlexContainer::ChildProperty::FLEX_MARGIN, Vector4( 10.0f, 10.0f, 10.0f, 10.0f ) ); + DALI_TEST_EQUALS( actor.GetProperty( FlexContainer::ChildProperty::FLEX_MARGIN ), Vector4( 10.0f, 10.0f, 10.0f, 10.0f ), TEST_LOCATION ); + DALI_TEST_CHECK( actor.GetPropertyIndex( CHILD_PROPERTY_NAME_FLEX_MARGIN ) == FlexContainer::ChildProperty::FLEX_MARGIN ); + + END_TEST; +} + diff --git a/build/tizen/dali-toolkit/Makefile.am b/build/tizen/dali-toolkit/Makefile.am index f967eb5..75aa867 100644 --- a/build/tizen/dali-toolkit/Makefile.am +++ b/build/tizen/dali-toolkit/Makefile.am @@ -98,7 +98,6 @@ develapicontrolsdir = $(develapidir)/controls develapibloomviewdir = $(develapicontrolsdir)/bloom-view develapibubbleemitterdir = $(develapicontrolsdir)/bubble-effect develapieffectsviewdir = $(develapicontrolsdir)/effects-view -develapiflexcontainerdir = $(develapicontrolsdir)/flex-container develapimagnifierdir = $(develapicontrolsdir)/magnifier develapirendererfactorydir = $(develapicontrolsdir)/renderer-factory develapipopupdir = $(develapicontrolsdir)/popup @@ -119,7 +118,6 @@ develapibloomview_HEADERS = $(devel_api_bloom_view_header_files) develapibubbleemitter_HEADERS = $(devel_api_bubble_emitter_header_files) develapibuilder_HEADERS = $(devel_api_builder_header_files) develapieffectsview_HEADERS = $(devel_api_effects_view_header_files) -develapiflexcontainer_HEADERS = $(devel_api_flex_container_header_files) develapifocusmanager_HEADERS = $(devel_api_focus_manager_header_files) develapiimageatlas_HEADERS = $(devel_api_image_atlas_header_files) develapimagnifier_HEADERS = $(devel_api_magnifier_header_files) @@ -141,6 +139,7 @@ publicapiaccessibilitymanagerdir = $(publicapidir)/accessibility-manager publicapialignmentdir = $(publicapicontrolsdir)/alignment publicapibuttonsdir = $(publicapicontrolsdir)/buttons publicapidefaultcontrolsdir = $(publicapicontrolsdir)/default-controls +publicapiflexcontainerdir = $(publicapicontrolsdir)/flex-container publicapigaussianblurviewdir = $(publicapicontrolsdir)/gaussian-blur-view publicapiimageviewdir = $(publicapicontrolsdir)/image-view publicapimodel3dviewdir = $(publicapicontrolsdir)/model3d-view @@ -162,6 +161,7 @@ publicapiaccessibilitymanager_HEADERS = $(public_api_accessibility_manager_heade publicapialignment_HEADERS = $(public_api_alignment_header_files) publicapibuttons_HEADERS = $(public_api_buttons_header_files) publicapidefaultcontrols_HEADERS = $(public_api_default_controls_header_files) +publicapiflexcontainer_HEADERS = $(public_api_flex_container_header_files) publicapigaussianblurview_HEADERS = $(public_api_gaussian_blur_view_header_files) publicapiimageview_HEADERS = $(public_api_image_view_header_files) publicapiitemview_HEADERS = $(public_api_item_view_header_files) diff --git a/dali-toolkit/dali-toolkit.h b/dali-toolkit/dali-toolkit.h index 36484f1..637d534 100644 --- a/dali-toolkit/dali-toolkit.h +++ b/dali-toolkit/dali-toolkit.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/dali-toolkit/devel-api/file.list b/dali-toolkit/devel-api/file.list index f28fa71..e6b7576 100755 --- a/dali-toolkit/devel-api/file.list +++ b/dali-toolkit/devel-api/file.list @@ -7,7 +7,6 @@ devel_api_src_files = \ $(devel_api_src_dir)/controls/bloom-view/bloom-view.cpp \ $(devel_api_src_dir)/controls/bubble-effect/bubble-emitter.cpp \ $(devel_api_src_dir)/controls/effects-view/effects-view.cpp \ - $(devel_api_src_dir)/controls/flex-container/flex-container.cpp \ $(devel_api_src_dir)/controls/magnifier/magnifier.cpp \ $(devel_api_src_dir)/controls/popup/confirmation-popup.cpp \ $(devel_api_src_dir)/controls/popup/popup.cpp \ @@ -47,9 +46,6 @@ devel_api_builder_header_files = \ devel_api_effects_view_header_files = \ $(devel_api_src_dir)/controls/effects-view/effects-view.h -devel_api_flex_container_header_files = \ - $(devel_api_src_dir)/controls/flex-container/flex-container.h - devel_api_magnifier_header_files = \ $(devel_api_src_dir)/controls/magnifier/magnifier.h 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 17ea2b6..2005f9c 100644 --- a/dali-toolkit/internal/controls/flex-container/flex-container-impl.h +++ b/dali-toolkit/internal/controls/flex-container/flex-container-impl.h @@ -23,7 +23,7 @@ // INTERNAL INCLUDES #include -#include +#include extern "C" { #include "layout.h" diff --git a/dali-toolkit/devel-api/controls/flex-container/flex-container.cpp b/dali-toolkit/public-api/controls/flex-container/flex-container.cpp similarity index 95% rename from dali-toolkit/devel-api/controls/flex-container/flex-container.cpp rename to dali-toolkit/public-api/controls/flex-container/flex-container.cpp index ab51c4f..ec95d8c 100644 --- a/dali-toolkit/devel-api/controls/flex-container/flex-container.cpp +++ b/dali-toolkit/public-api/controls/flex-container/flex-container.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // INTERNAL INCLUDES #include diff --git a/dali-toolkit/devel-api/controls/flex-container/flex-container.h b/dali-toolkit/public-api/controls/flex-container/flex-container.h similarity index 79% rename from dali-toolkit/devel-api/controls/flex-container/flex-container.h rename to dali-toolkit/public-api/controls/flex-container/flex-container.h index fcf8f58..856c83a 100644 --- a/dali-toolkit/devel-api/controls/flex-container/flex-container.h +++ b/dali-toolkit/public-api/controls/flex-container/flex-container.h @@ -98,6 +98,7 @@ class FlexContainer; * "flexMargin":[10, 10, 10, 10] // property to specify the space around the item. * } * @endcode + * @SINCE_1_1.35 */ class DALI_IMPORT_API FlexContainer : public Control @@ -107,139 +108,161 @@ public: /** * @brief The direction of the main axis in the flex container. This determines * the direction that flex items are laid out in the flex container. + * @SINCE_1_1.35 */ enum FlexDirection { - COLUMN, ///< The flexible items are displayed vertically as a column - COLUMN_REVERSE, ///< The flexible items are displayed vertically as a column, but in reverse order - ROW, ///< The flexible items are displayed horizontally as a row - ROW_REVERSE ///< The flexible items are displayed horizontally as a row, but in reverse order + COLUMN, ///< The flexible items are displayed vertically as a column @SINCE_1_1.35 + COLUMN_REVERSE, ///< The flexible items are displayed vertically as a column, but in reverse order @SINCE_1_1.35 + ROW, ///< The flexible items are displayed horizontally as a row @SINCE_1_1.35 + ROW_REVERSE ///< The flexible items are displayed horizontally as a row, but in reverse order @SINCE_1_1.35 }; /** * @brief The primary direction in which content is ordered in the flex container * and on which sides the “start” and “end” are. + * @SINCE_1_1.35 */ enum ContentDirection { - INHERIT, ///< Inherits the same direction from the parent - LTR, ///< From left to right - RTL ///< From right to left + INHERIT, ///< Inherits the same direction from the parent @SINCE_1_1.35 + LTR, ///< From left to right @SINCE_1_1.35 + RTL ///< From right to left @SINCE_1_1.35 }; /** * @brief Alignment of the flex items when the items do not use all available * space on the main-axis. + * @SINCE_1_1.35 */ enum Justification { - JUSTIFY_FLEX_START, ///< Items are positioned at the beginning of the container - JUSTIFY_CENTER, ///< Items are positioned at the center of the container - JUSTIFY_FLEX_END, ///< Items are positioned at the end of the container - JUSTIFY_SPACE_BETWEEN, ///< Items are positioned with equal space between the lines - JUSTIFY_SPACE_AROUND ///< Items are positioned with equal space before, between, and after the lines + JUSTIFY_FLEX_START, ///< Items are positioned at the beginning of the container @SINCE_1_1.35 + JUSTIFY_CENTER, ///< Items are positioned at the center of the container @SINCE_1_1.35 + JUSTIFY_FLEX_END, ///< Items are positioned at the end of the container @SINCE_1_1.35 + JUSTIFY_SPACE_BETWEEN, ///< Items are positioned with equal space between the lines @SINCE_1_1.35 + JUSTIFY_SPACE_AROUND ///< Items are positioned with equal space before, between, and after the lines @SINCE_1_1.35 }; /** * @brief Alignment of the flex items or lines when the items or lines do not * use all available space on the cross-axis. + * @SINCE_1_1.35 */ enum Alignment { - ALIGN_AUTO, ///< Inherits the same alignment from the parent (only valid for "alignSelf" property) - ALIGN_FLEX_START, ///< At the beginning of the container - ALIGN_CENTER, ///< At the center of the container - ALIGN_FLEX_END, ///< At the end of the container - ALIGN_STRETCH ///< Stretch to fit the container + ALIGN_AUTO, ///< Inherits the same alignment from the parent (only valid for "alignSelf" property) @SINCE_1_1.35 + ALIGN_FLEX_START, ///< At the beginning of the container @SINCE_1_1.35 + ALIGN_CENTER, ///< At the center of the container @SINCE_1_1.35 + ALIGN_FLEX_END, ///< At the end of the container @SINCE_1_1.35 + ALIGN_STRETCH ///< Stretch to fit the container @SINCE_1_1.35 }; /** * @brief The wrap type of the flex container when there is no enough room for * all the items on one flex line. + * @SINCE_1_1.35 */ enum WrapType { - NO_WRAP, ///< Flex items laid out in single line (shrunk to fit the flex container along the main axis) - WRAP ///< Flex items laid out in multiple lines if needed + NO_WRAP, ///< Flex items laid out in single line (shrunk to fit the flex container along the main axis) @SINCE_1_1.35 + WRAP ///< Flex items laid out in multiple lines if needed @SINCE_1_1.35 }; public: /** * @brief The start and end property ranges for this control. + * @SINCE_1_1.35 */ enum PropertyRange { - PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, - PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices + PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_1.35 + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices @SINCE_1_1.35 - CHILD_PROPERTY_START_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX, - CHILD_PROPERTY_END_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve child property indices + CHILD_PROPERTY_START_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX, ///< @SINCE_1_1.35 + CHILD_PROPERTY_END_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve child property indices @SINCE_1_1.35 }; /** * @brief An enumeration of properties belonging to the FlexContainer class. + * @SINCE_1_1.35 */ struct Property { enum { - CONTENT_DIRECTION = PROPERTY_START_INDEX, ///< name "contentDirection", The primary direction in which content is ordered, @see FlexContainer::ContentDirection, type INTEGER - FLEX_DIRECTION, ///< name "flexDirection", The direction of the main-axis which determines the direction that flex items are laid out, @see FlexContainer::FlexDirection, type INTEGER - FLEX_WRAP, ///< name "flexWrap", Whether the flex items should wrap or not if there is no enough room for them on one flex line, @see FlexContainer::WrapType, type INTEGER - JUSTIFY_CONTENT, ///< name "justifyContent", The alignment of flex items when the items do not use all available space on the main-axis, @see FlexContainer::Justification, type INTEGER - ALIGN_ITEMS, ///< name "alignItems", The alignment of flex items when the items do not use all available space on the cross-axis, @see FlexContainer::Alignment, type INTEGER - ALIGN_CONTENT ///< name "alignContent", Similar to "alignItems", but it aligns flex lines, so only works when there are multiple lines, @see FlexContainer::Alignment, type INTEGER + // Event side properties + CONTENT_DIRECTION = PROPERTY_START_INDEX, ///< name "contentDirection", The primary direction in which content is ordered, @see FlexContainer::ContentDirection, type INTEGER @SINCE_1_1.35 + FLEX_DIRECTION, ///< name "flexDirection", The direction of the main-axis which determines the direction that flex items are laid out, @see FlexContainer::FlexDirection, type INTEGER @SINCE_1_1.35 + FLEX_WRAP, ///< name "flexWrap", Whether the flex items should wrap or not if there is no enough room for them on one flex line, @see FlexContainer::WrapType, type INTEGER @SINCE_1_1.35 + JUSTIFY_CONTENT, ///< name "justifyContent", The alignment of flex items when the items do not use all available space on the main-axis, @see FlexContainer::Justification, type INTEGER @SINCE_1_1.35 + ALIGN_ITEMS, ///< name "alignItems", The alignment of flex items when the items do not use all available space on the cross-axis, @see FlexContainer::Alignment, type INTEGER @SINCE_1_1.35 + ALIGN_CONTENT ///< name "alignContent", Similar to "alignItems", but it aligns flex lines, so only works when there are multiple lines, @see FlexContainer::Alignment, type INTEGER @SINCE_1_1.35 }; }; /** * @brief An enumeration of child properties belonging to the FlexContainer class. + * @SINCE_1_1.35 */ struct ChildProperty { enum { // Event side child properties - FLEX = CHILD_PROPERTY_START_INDEX, ///< name "flex", The proportion of the free space in the container the flex item will receive. If all items in the container set this property, their sizes will be proportional to the specified flex factor, type FLOAT - ALIGN_SELF, ///< name "alignSelf", The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container, @see FlexContainer::Alignment, type INTEGER - FLEX_MARGIN ///< name "flexMargin", The space around the flex item, type VECTOR4 + FLEX = CHILD_PROPERTY_START_INDEX, ///< name "flex", The proportion of the free space in the container the flex item will receive. If all items in the container set this property, their sizes will be proportional to the specified flex factor, type FLOAT @SINCE_1_1.35 + ALIGN_SELF, ///< name "alignSelf", The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container, @see FlexContainer::Alignment, type INTEGER @SINCE_1_1.35 + FLEX_MARGIN ///< name "flexMargin", The space around the flex item, type VECTOR4 @SINCE_1_1.35 }; }; /** * @brief Create a FlexContainer handle; this can be initialised with FlexContainer::New() * Calling member functions with an uninitialised handle is not allowed. + * @SINCE_1_1.35 */ FlexContainer(); /** - * Copy constructor. Creates another handle that points to the same real object - * @param handle to copy from + * @brief Copy constructor. Creates another handle that points to the same real object + * @SINCE_1_1.35 + * + * @param[in] handle The handle to copy from */ FlexContainer( const FlexContainer& handle ); /** - * Assignment operator. Changes this handle to point to another real object + * @brief Assignment operator. Changes this handle to point to another real object + * @SINCE_1_1.35 */ FlexContainer& operator=( const FlexContainer& handle ); /** * @brief Destructor * - * This is non-virtual since derived Handle types must not contain data or virtual methods. + * @details This is non-virtual since derived Handle types must not contain data or virtual methods. + * + * @SINCE_1_1.35 */ ~FlexContainer(); /** - * Create the FlexContainer control. + * @brief Create the FlexContainer control. + * @SINCE_1_1.35 + * * @return A handle to the FlexContainer control. */ static FlexContainer New(); /** - * Downcast an Object handle to FlexContainer. If handle points to a FlexContainer the - * downcast produces valid handle. If not the returned handle is left uninitialized. + * @brief Downcast an Object handle to FlexContainer. + * + * @details If handle points to a FlexContainer the downcast produces + * valid handle. If not the returned handle is left uninitialized. + * + * @SINCE_1_1.35 + * * @param[in] handle Handle to an object * @return handle to a FlexContainer or an uninitialized handle */ @@ -250,6 +273,7 @@ public: // Not intended for application developers /** * @brief Creates a handle using the Toolkit::Internal implementation. + * @SINCE_1_1.35 * * @param[in] implementation The Control implementation. */ @@ -257,6 +281,7 @@ public: // Not intended for application developers /** * @brief Allows the creation of this Control from an Internal::CustomActor pointer. + * @SINCE_1_1.35 * * @param[in] internal A pointer to the internal CustomActor. */ diff --git a/dali-toolkit/public-api/file.list b/dali-toolkit/public-api/file.list index 16d923f..a7b1a02 100755 --- a/dali-toolkit/public-api/file.list +++ b/dali-toolkit/public-api/file.list @@ -9,6 +9,7 @@ public_api_src_files = \ $(public_api_src_dir)/controls/buttons/push-button.cpp \ $(public_api_src_dir)/controls/buttons/radio-button.cpp \ $(public_api_src_dir)/controls/default-controls/solid-color-actor.cpp \ + $(public_api_src_dir)/controls/flex-container/flex-container.cpp \ $(public_api_src_dir)/controls/image-view/image-view.cpp \ $(public_api_src_dir)/controls/model3d-view/model3d-view.cpp \ $(public_api_src_dir)/controls/page-turn-view/page-turn-landscape-view.cpp \ @@ -58,6 +59,9 @@ public_api_default_controls_header_files = \ public_api_model3d_view_header_files = \ $(public_api_src_dir)/controls/model3d-view/model3d-view.h +public_api_flex_container_header_files = \ + $(public_api_src_dir)/controls/flex-container/flex-container.h + public_api_gaussian_blur_view_header_files = \ $(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.h diff --git a/docs/content/shared-javascript-and-cpp-documentation/flex-container.md b/docs/content/shared-javascript-and-cpp-documentation/flex-container.md index 8acacaa..056ea1e 100644 --- a/docs/content/shared-javascript-and-cpp-documentation/flex-container.md +++ b/docs/content/shared-javascript-and-cpp-documentation/flex-container.md @@ -249,23 +249,23 @@ flexContainer.SetProperty( Dali::Toolkit::FlexContainer::Property::FLEX_DIRECTIO // Create flex items and set the proportion Dali::Toolkit::Control item1 = Dali::Toolkit::Control::New(); -item1.RegisterProperty( "flex", 1.0f, Dali::Property::READ_WRITE ); +item1.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 1.0f ); flexContainer.Add( item1 ); Dali::Toolkit::Control item2 = Dali::Toolkit::Control::New(); -item2.RegisterProperty( "flex", 3.0f, Dali::Property::READ_WRITE ); +item2.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 3.0f ); flexContainer.Add( item2 ); Dali::Toolkit::Control item3 = Dali::Toolkit::Control::New(); -item3.RegisterProperty( "flex", 1.0f, Dali::Property::READ_WRITE ); +item3.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 1.0f ); flexContainer.Add( item3 ); Dali::Toolkit::Control item4 = Dali::Toolkit::Control::New(); -item4.RegisterProperty( "flex", 2.0f, Dali::Property::READ_WRITE ); +item4.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 2.0f ); flexContainer.Add( item4 ); Dali::Toolkit::Control item5 = Dali::Toolkit::Control::New(); -item5.RegisterProperty( "flex", 1.0f, Dali::Property::READ_WRITE ); +item5.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 1.0f ); flexContainer.Add( item5 ); ~~~ @@ -338,14 +338,14 @@ flexContainer.SetProperty( Dali::Toolkit::FlexContainer::Property::ALIGN_ITEMS, // Create flex items and add them to the flex container Dali::Toolkit::Control item1 = Dali::Toolkit::Control::New(); -item1.RegisterProperty( "alignSelf", Dali::Toolkit::FlexContainer::ALIGN_CENTER, Dali::Property::READ_WRITE ); // Align item1 at the center of the container +item1.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::ALIGN_SELF, Dali::Toolkit::FlexContainer::ALIGN_CENTER ); // Align item1 at the center of the container flexContainer.Add( item1 ); Dali::Toolkit::Control item2 = Dali::Toolkit::Control::New(); flexContainer.Add( item2 ); // item2 is aligned at the beginning of ther container Dali::Toolkit::Control item3 = Dali::Toolkit::Control::New(); -item3.RegisterProperty( "alignSelf", Dali::Toolkit::FlexContainer::ALIGN_FLEX_END, Dali::Property::READ_WRITE ); // Align item3 at the bottom of the container +item3.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::ALIGN_SELF, Dali::Toolkit::FlexContainer::ALIGN_FLEX_END ); // Align item3 at the bottom of the container flexContainer.Add( item3 ); Dali::Toolkit::Control item4 = Dali::Toolkit::Control::New(); @@ -411,7 +411,7 @@ Dali::Toolkit::FlexContainer flexContainer = Dali::Toolkit::FlexContainer::New() Dali::Toolkit::Control item = Dali::Toolkit::Control::New(); // Add the margin around the item -item.RegisterProperty( "flexMargin", Vector4(10.0f, 10.0f, 10.0f, 10.0f), Dali::Property::READ_WRITE ); +item.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN, Vector4(10.0f, 10.0f, 10.0f, 10.0f) ); // Add the item to the container flexContainer.Add( item ); @@ -526,7 +526,7 @@ This can be achieved by setting the flex property. toolBar.SetProperty( Dali::Toolkit::FlexContainer::Property::FLEX_DIRECTION, Dali::Toolkit::FlexContainer::ROW ); // display toolbar items horizontally toolBar.SetProperty( Dali::Toolkit::FlexContainer::Property::ALIGN_ITEMS, Dali::Toolkit::FlexContainer::ALIGN_CENTER ); // align toolbar items vertically center -toolBar.RegisterProperty( "flex", 0.1f, Dali::Property::READ_WRITE ); // 10 percent of available space in the cross axis +toolBar.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 0.1f ); // 10 percent of available space in the cross axis ~~~ ~~~{.js} @@ -550,7 +550,7 @@ content.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT ); content.SetProperty( Dali::Toolkit::FlexContainer::Property::FLEX_DIRECTION, Dali::Toolkit::FlexContainer::ROW ); // display items horizontally content.SetProperty( Dali::Toolkit::FlexContainer::Property::JUSTIFY_CONTENT, Dali::Toolkit::FlexContainer::JUSTIFY_CENTER ); // align items horizontally center content.SetProperty( Dali::Toolkit::FlexContainer::Property::ALIGN_ITEMS, Dali::Toolkit::FlexContainer::ALIGN_CENTER ); // align items vertically center -content.RegisterProperty( "flex", 0.9f, Dali::Property::READ_WRITE ); // 90 percent of available space in the cross axis +content.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 0.9f ); // 90 percent of available space in the cross axis // Add it to the main container flexContainer.Add( content ); @@ -584,7 +584,7 @@ Dali::Toolkit::PushButton prevButton = Dali::Toolkit::PushButton::New(); prevButton.SetParentOrigin( Dali::ParentOrigin::TOP_LEFT ); prevButton.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT ); prevButton.SetMinimumSize( Dali::Vector2( 100.0f, 60.0f ) ); // this is the minimum size the button should keep -prevButton.RegisterProperty( "flexMargin", Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f), Dali::Property::READ_WRITE ); // set 10 pixel margin around the button +prevButton.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN, Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f) ); // set 10 pixel margin around the button toolBar.Add( prevButton ); // Set the button text @@ -600,8 +600,8 @@ title.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT ); title.SetResizePolicy( Dali::ResizePolicy::USE_NATURAL_SIZE, Dali::Dimension::ALL_DIMENSIONS ); title.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); title.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); -title.RegisterProperty( "flex", 1.0f, Dali::Property::READ_WRITE ); // take all the available space left apart from the two buttons -title.RegisterProperty( "flexMargin", Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f), Dali::Property::READ_WRITE ); // set 10 pixel margin around the title +title.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX, 1.0f ); // take all the available space left apart from the two buttons +title.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN, Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f) ); // set 10 pixel margin around the title toolBar.Add( title ); // Add a button to the right of the toolbar @@ -609,7 +609,7 @@ Dali::Toolkit::PushButton nextButton = Dali::Toolkit::PushButton::New(); nextButton.SetParentOrigin( Dali::ParentOrigin::TOP_LEFT ); nextButton.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT ); nextButton.SetMinimumSize( Dali::Vector2( 100.0f, 60.0f ) ); // this is the minimum size the button should keep -nextButton.RegisterProperty( "flexMargin", Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f), Dali::Property::READ_WRITE ); // set 10 pixel margin around the button +nextButton.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::FLEX_MARGIN, Dali::Vector4(10.0f, 10.0f, 10.0f, 10.0f) ); // set 10 pixel margin around the button toolBar.Add( nextButton ); // Set the button text