From: Kingsley Stephens Date: Fri, 10 Apr 2015 09:24:25 +0000 (+0100) Subject: Size negotiation patch 3: Scope size negotiation enums X-Git-Tag: dali_1.0.38~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82ce98f2392846c669be20560d0697f502f47599;p=platform%2Fcore%2Fuifw%2Fdali-demo.git Size negotiation patch 3: Scope size negotiation enums Fix buttons and logging examples Change-Id: I21699757ea591f73d5a09393caa01fd2b621726c --- diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index 8c43418..63d8b69 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -58,6 +58,8 @@ int main(int argc, char **argv) demo.AddExample(Example("animated-shapes.example", DALI_DEMO_STR_TITLE_ANIMATED_SHAPES)); demo.AddExample(Example("path-animation.example", DALI_DEMO_STR_TITLE_PATH_ANIMATION)); demo.AddExample(Example("size-negotiation.example", DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE)); + demo.AddExample(Example("buttons.example", DALI_DEMO_STR_TITLE_BUTTONS)); + demo.AddExample(Example("logging.example", DALI_DEMO_STR_TITLE_LOGGING)); demo.SortAlphabetically( true ); diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 54490fb..127c82f 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -106,7 +106,7 @@ ImageActor CreateBackground( std::string imagePath ) background.SetAnchorPoint( AnchorPoint::CENTER ); background.SetParentOrigin( ParentOrigin::CENTER ); background.SetZ( -1.0f ); - background.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); return background; } @@ -228,7 +228,7 @@ void DaliTableView::Initialize( Application& application ) mRootActor = TableView::New( 4, 1 ); mRootActor.SetAnchorPoint( AnchorPoint::CENTER ); mRootActor.SetParentOrigin( ParentOrigin::CENTER ); - mRootActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mRootActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Stage::GetCurrent().Add( mRootActor ); // Toolbar at top @@ -244,7 +244,7 @@ void DaliTableView::Initialize( Application& application ) // Add logo Dali::ImageActor logo = CreateLogo( LOGO_PATH ); logo.SetName( "LOGO_IMAGE" ); - logo.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + logo.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y ); const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO; @@ -258,8 +258,8 @@ void DaliTableView::Initialize( Application& application ) Alignment alignment = Alignment::New(); alignment.SetName( "LOGO_ALIGNMENT" ); alignment.Add( logo ); - alignment.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - alignment.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); + alignment.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + alignment.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); Actor alignmentActor = alignment; alignmentActor.SetPadding( Padding( 0.0f, 0.0f, logoMargin, logoMargin )); mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) ); @@ -271,7 +271,7 @@ void DaliTableView::Initialize( Application& application ) mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); mScrollView.SetParentOrigin( ParentOrigin::CENTER ); - mScrollView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); const float buttonsPageMargin = ( 1.0f - TABLE_RELATIVE_SIZE.x ) * 0.5f * stageSize.width; mScrollView.SetPadding( Padding( buttonsPageMargin, buttonsPageMargin, 0.0f, 0.0f ) ); @@ -284,13 +284,13 @@ void DaliTableView::Initialize( Application& application ) mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER ); mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER ); mScrollViewLayer.SetDrawMode( DrawMode::OVERLAY ); - mScrollViewLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mScrollViewLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); // Create solid background colour. ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR ); backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER ); backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER ); - backgroundColourActor.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + backgroundColourActor.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); backgroundColourActor.SetSizeModeFactor( Vector3( 1.0f, 1.5f, 1.0f ) ); backgroundColourActor.SetZ( BACKGROUND_Z ); mScrollViewLayer.Add( backgroundColourActor ); @@ -298,7 +298,7 @@ void DaliTableView::Initialize( Application& application ) // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show Actor bubbleContainer = Actor::New(); bubbleContainer.SetRelayoutEnabled( true ); - bubbleContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + bubbleContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER ); bubbleContainer.SetParentOrigin( ParentOrigin::CENTER ); mScrollViewLayer.Add( bubbleContainer ); @@ -306,7 +306,7 @@ void DaliTableView::Initialize( Application& application ) SetupBackground( bubbleContainer ); Alignment buttonsAlignment = Alignment::New(); - buttonsAlignment.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + buttonsAlignment.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); buttonsAlignment.Add( mScrollViewLayer ); mScrollViewLayer.Add( mScrollView ); @@ -395,7 +395,7 @@ void DaliTableView::Populate() TableView page = TableView::New( 3, 3 ); page.SetAnchorPoint( AnchorPoint::CENTER ); page.SetParentOrigin( ParentOrigin::CENTER ); - page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mScrollView.Add( page ); // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi. @@ -492,7 +492,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit content.SetAnchorPoint( AnchorPoint::CENTER ); content.SetParentOrigin( ParentOrigin::CENTER ); content.SetRelayoutEnabled( true ); - content.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + content.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); content.SetSizeModeFactor( sizeMultiplier ); // create background image @@ -503,7 +503,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit image.SetAnchorPoint( AnchorPoint::CENTER ); image.SetParentOrigin( ParentOrigin::CENTER ); // make the image 100% of tile - image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); // move image back to get text appear in front image.SetZ( -1 ); @@ -513,7 +513,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit // Add stencil ImageActor stencil = NewStencilImage(); - stencil.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + stencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); image.Add( stencil ); } @@ -524,7 +524,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit label.SetProperty( TextLabel::Property::TEXT, title ); label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); - label.SetResizePolicy( FILL_TO_PARENT, HEIGHT ); + label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); label.SetColor( TABLE_TEXT_STYLE_COLOR ); content.Add( label ); @@ -1000,9 +1000,9 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap mVersionPopup = Dali::Toolkit::Popup::New(); mVersionPopup.SetParentOrigin( ParentOrigin::CENTER ); mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER ); - mVersionPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, WIDTH ); + mVersionPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH ); mVersionPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) ); - mVersionPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); + mVersionPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); mVersionPopup.SetTitle( stream.str() ); mVersionPopup.HideTail(); mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup ); diff --git a/examples/animated-shapes/animated-shapes-example.cpp b/examples/animated-shapes/animated-shapes-example.cpp index 5eb6f36..ba34cea 100644 --- a/examples/animated-shapes/animated-shapes-example.cpp +++ b/examples/animated-shapes/animated-shapes-example.cpp @@ -56,7 +56,7 @@ public: //Create a view mView = Dali::Toolkit::View::New(); - mView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); stage.Add( mView ); //Set background image for the view diff --git a/examples/blocks/blocks-example.cpp b/examples/blocks/blocks-example.cpp index 9aa0894..972f95c 100644 --- a/examples/blocks/blocks-example.cpp +++ b/examples/blocks/blocks-example.cpp @@ -359,7 +359,7 @@ private: mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER ); mLevelContainer.SetParentOrigin( ParentOrigin::CENTER ); mLevelContainer.SetRelayoutEnabled( true ); - mLevelContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mLevelContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mContentLayer.Add( mLevelContainer ); mBrickCount = 0; diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index e00c114..5578d7c 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -395,7 +395,7 @@ public: { TextLabel label = TextLabel::New( ShortName( text ) ); label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "builderlabel" ); - label.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); // Hook up tap detector mTapDetector.Attach( label ); diff --git a/examples/buttons/buttons-example.cpp b/examples/buttons/buttons-example.cpp index 297dbfb..88aa86f 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -21,21 +21,9 @@ using namespace Dali; -namespace -{ -// Used to produce visually same dimensions on desktop and device builds -float ScalePointSize( int pointSize ) -{ - Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi(); - float meanDpi = (dpi.height + dpi.width) * 0.5f; - return pointSize * meanDpi / 220.0f; -} - -} // namespace - // Define this so that it is interchangeable // "DP" stands for Device independent Pixels -#define DP(x) ScalePointSize(x) +#define DP(x) x namespace @@ -67,7 +55,7 @@ const char* const CHECKBOX_SELECTED_IMAGE = DALI_IMAGE_DIR "checkbox-selected.pn const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f ); // Layout sizes -const int RADIO_LABEL_THUMBNAIL_SIZE = 48; +const int RADIO_LABEL_THUMBNAIL_SIZE = 60; const int RADIO_IMAGE_SPACING = 8; const int BUTTON_HEIGHT = 48; @@ -122,25 +110,45 @@ class ButtonsController: public ConnectionTracker TOOLBAR_IMAGE, TOOLBAR_TITLE ); - int yPos = TOP_MARGIN + MARGIN_SIZE; + Toolkit::TableView contentTable = Toolkit::TableView::New( 4, 1 ); + contentTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + contentTable.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + contentTable.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + contentTable.SetParentOrigin( ParentOrigin::TOP_LEFT ); + contentTable.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) ); +// contentTable.TouchedSignal().Connect( this, &ButtonsController::OnTouchEvent ); + + for( unsigned int i = 0; i < contentTable.GetRows(); ++i ) + { + contentTable.SetFitHeight( i ); + } + + contentTable.SetPosition( 0.0f, TOP_MARGIN ); + + mContentLayer.Add( contentTable ); // Image selector radio group - Actor radioGroup2Background = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - radioGroup2Background.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioGroup2Background.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioGroup2Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - radioGroup2Background.SetRelayoutEnabled( true ); - radioGroup2Background.SetSize( DP(348), DP(GROUP2_HEIGHT) ); - mContentLayer.Add( radioGroup2Background ); - - Actor radioButtonsGroup2 = Actor::New(); - radioButtonsGroup2.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioButtonsGroup2.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioButtonsGroup2.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); - radioButtonsGroup2.SetRelayoutEnabled( true ); - radioButtonsGroup2.SetSize( DP(100), DP(160) ); - - radioGroup2Background.Add( radioButtonsGroup2 ); + Toolkit::TableView radioGroup2Background = Toolkit::TableView::New( 2, 2 ); + radioGroup2Background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + radioGroup2Background.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + radioGroup2Background.SetBackgroundColor( BACKGROUND_COLOUR ); + radioGroup2Background.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + radioGroup2Background.SetFitHeight( 0 ); + radioGroup2Background.SetFitHeight( 1 ); + radioGroup2Background.SetFitWidth( 0 ); + + contentTable.Add( radioGroup2Background ); + + Toolkit::TableView radioButtonsGroup2 = Toolkit::TableView::New( 3, 1 ); + radioButtonsGroup2.SetCellPadding( Size( 0.0f, MARGIN_SIZE * 0.5f ) ); + radioButtonsGroup2.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + for( unsigned int i = 0; i < radioButtonsGroup2.GetRows(); ++i ) + { + radioButtonsGroup2.SetFitHeight( i ); + } + radioButtonsGroup2.SetFitWidth( 0 ); + + radioGroup2Background.AddChild( radioButtonsGroup2, Toolkit::TableView::CellPosition( 0, 0 ) ); int radioY = 0; @@ -189,11 +197,8 @@ class ButtonsController: public ConnectionTracker // Create select button mUpdateButton = Toolkit::PushButton::New(); - mUpdateButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); - mUpdateButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - mUpdateButton.SetPosition( 0, DP(MARGIN_SIZE) ); mUpdateButton.SetLabel( "Select" ); - mUpdateButton.SetSize( DP(100), DP(BUTTON_HEIGHT) ); + mUpdateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); mUpdateButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); mUpdateButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); @@ -201,7 +206,7 @@ class ButtonsController: public ConnectionTracker mUpdateButton.ClickedSignal().Connect( this, &ButtonsController::OnButtonClicked ); - radioButtonsGroup2.Add(mUpdateButton); + radioGroup2Background.AddChild( mUpdateButton, Toolkit::TableView::CellPosition( 1, 0 ) ); // ImageActor to display selected image mBigImage1 = ResourceImage::New( BIG_IMAGE_1 ); @@ -209,43 +214,48 @@ class ButtonsController: public ConnectionTracker mBigImage3 = ResourceImage::New( BIG_IMAGE_3 ); mImage = ImageActor::New( mBigImage1 ); - mImage.SetParentOrigin( ParentOrigin::TOP_RIGHT ); - mImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mImage.SetPosition( DP(MARGIN_SIZE), 0 ); - mImage.SetSize( DP(218), DP(218) ); - radioButtonsGroup2.Add( mImage ); + mImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); + mImage.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::WIDTH ); + radioGroup2Background.AddChild( mImage, Toolkit::TableView::CellPosition( 0, 1, 2, 1 ) ); // The enable/disable radio group - yPos += GROUP2_HEIGHT + MARGIN_SIZE; + Toolkit::TableView radioGroup1Background = Toolkit::TableView::New( 1, 1 ); + radioGroup1Background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + radioGroup1Background.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + radioGroup1Background.SetBackgroundColor( BACKGROUND_COLOUR ); + radioGroup1Background.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + radioGroup1Background.SetFitHeight( 0 ); - Actor radioGroup1Background = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - radioGroup1Background.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioGroup1Background.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioGroup1Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - radioGroup1Background.SetRelayoutEnabled( true ); - radioGroup1Background.SetSize( DP(348), DP(GROUP1_HEIGHT) ); - mContentLayer.Add( radioGroup1Background ); + contentTable.Add( radioGroup1Background ); // Radio group - Actor radioButtonsGroup1 = Actor::New(); - radioButtonsGroup1.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioButtonsGroup1.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioButtonsGroup1.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); + Toolkit::TableView radioButtonsGroup1 = Toolkit::TableView::New( 2, 1 ); + radioButtonsGroup1.SetCellPadding( Size( 0.0f, MARGIN_SIZE * 0.5f ) ); + radioButtonsGroup1.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + for( unsigned int i = 0; i < radioButtonsGroup1.GetRows(); ++i ) + { + radioButtonsGroup1.SetFitHeight( i ); + } + radioButtonsGroup1.SetFitWidth( 0 ); radioGroup1Background.Add( radioButtonsGroup1 ); // First radio button { Toolkit::TableView tableView = Toolkit::TableView::New( 1, 2 ); - tableView.SetSize( DP(260), 0.0f ); - tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + tableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + tableView.SetFitHeight( 0 ); + tableView.SetFitWidth( 0 ); + tableView.SetFitWidth( 1 ); Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( "Select enabled" ); + textLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); + textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); + textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); tableView.AddChild( textLabel, Toolkit::TableView::CellPosition( 0, 0 ) ); ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) ); imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); - imageActor.SetResizePolicy( FIXED, ALL_DIMENSIONS ); imageActor.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) ); tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) ); @@ -275,27 +285,25 @@ class ButtonsController: public ConnectionTracker } // CheckBoxes - yPos += GROUP1_HEIGHT + MARGIN_SIZE; + Toolkit::TableView checkBoxBackground = Toolkit::TableView::New( 3, 1 ); + checkBoxBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + checkBoxBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + checkBoxBackground.SetBackgroundColor( BACKGROUND_COLOUR ); + checkBoxBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); - Actor checkBoxBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - checkBoxBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - checkBoxBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); - checkBoxBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - checkBoxBackground.SetRelayoutEnabled( true ); - checkBoxBackground.SetSize( DP(430), DP(GROUP3_HEIGHT) ); - mContentLayer.Add( checkBoxBackground ); + for( unsigned int i = 0; i < checkBoxBackground.GetRows(); ++i ) + { + checkBoxBackground.SetFitHeight( i ); + } + + contentTable.Add( checkBoxBackground ); Dali::Image unselected = Dali::ResourceImage::New( CHECKBOX_UNSELECTED_IMAGE ); Dali::Image selected = Dali::ResourceImage::New( CHECKBOX_SELECTED_IMAGE ); - int checkYPos = MARGIN_SIZE; - { Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New(); checkBox.SetName( "checkbox1" ); - checkBox.SetPosition( DP(MARGIN_SIZE), DP(checkYPos) ); - checkBox.SetParentOrigin( ParentOrigin::TOP_LEFT ); - checkBox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); checkBox.SetBackgroundImage( unselected ); checkBox.SetSelectedImage( selected ); checkBox.SetLabel( "CheckBox1 is unselected" ); @@ -304,13 +312,9 @@ class ButtonsController: public ConnectionTracker checkBoxBackground.Add( checkBox ); } - checkYPos += 60; - { Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New(); checkBox.SetName( "checkbox2" ); - checkBox.SetPosition( DP(MARGIN_SIZE), DP(checkYPos) ); - checkBox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); checkBox.SetBackgroundImage( unselected ); checkBox.SetSelectedImage( selected ); checkBox.SetLabel( "CheckBox2 is selected" ); @@ -320,13 +324,9 @@ class ButtonsController: public ConnectionTracker checkBoxBackground.Add( checkBox ); } - checkYPos += 60; - { Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New(); checkBox.SetName( "checkbox3" ); - checkBox.SetPosition( DP(MARGIN_SIZE), DP(checkYPos) ); - checkBox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); checkBox.SetBackgroundImage( unselected ); checkBox.SetSelectedImage( selected ); checkBox.SetLabel( "CheckBox3 is unselected" ); @@ -336,23 +336,25 @@ class ButtonsController: public ConnectionTracker } // Create togglabe button - yPos += GROUP3_HEIGHT + MARGIN_SIZE; + Toolkit::TableView toggleBackground = Toolkit::TableView::New( 3, 1 ); + toggleBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + toggleBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + toggleBackground.SetBackgroundColor( BACKGROUND_COLOUR ); + toggleBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + + for( unsigned int i = 0; i < toggleBackground.GetRows(); ++i ) + { + toggleBackground.SetFitHeight( i ); + } + + contentTable.Add( toggleBackground ); - Actor toggleBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - toggleBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - toggleBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); - toggleBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - toggleBackground.SetRelayoutEnabled( true ); - toggleBackground.SetSize( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) ); - mContentLayer.Add( toggleBackground ); Toolkit::PushButton toggleButton = Toolkit::PushButton::New(); toggleButton.SetTogglableButton( true ); - toggleButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - toggleButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - toggleButton.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); toggleButton.SetLabel( "Unselected" ); - toggleButton.SetSize( DP(150), DP(BUTTON_HEIGHT) ); + toggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + toggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); toggleButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); toggleButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); @@ -465,6 +467,34 @@ class ButtonsController: public ConnectionTracker return true; } + bool OnTouchEvent( Actor actor, const TouchEvent& event ) + { + if( 1u == event.GetPointCount() ) + { + const TouchPoint::State state = event.GetPoint(0u).state; + + // Clamp to integer values; this is to reduce flicking due to pixel misalignment + const float localPoint = static_cast( static_cast( event.GetPoint( 0 ).local.y ) ); + + if( TouchPoint::Down == state ) + { + mLastPoint = localPoint; + mAnimation = Animation::New( 0.25f ); + } + else if( TouchPoint::Motion == state ) + { + if( mAnimation ) + { + mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear ); + mAnimation.Play(); + mLastPoint = localPoint; + } + } + } + + return true; + } + private: Application& mApplication; @@ -478,6 +508,9 @@ class ButtonsController: public ConnectionTracker Toolkit::PushButton mUpdateButton; + Animation mAnimation; + float mLastPoint; + Image mBigImage1; Image mBigImage2; Image mBigImage3; diff --git a/examples/cluster/cluster-example.cpp b/examples/cluster/cluster-example.cpp index 5558b79..c6d97a9 100644 --- a/examples/cluster/cluster-example.cpp +++ b/examples/cluster/cluster-example.cpp @@ -490,7 +490,7 @@ public: // Scale ScrollView to fit parent (mContentLayer) mScrollView.SetRelayoutEnabled( true ); - mScrollView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); // Add the scroll view to the content layer mContentLayer.Add(mScrollView); @@ -580,7 +580,7 @@ public: shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f)); // Apply size-relative mode to auto-size the image shadow - shadowActor.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + shadowActor.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE ); actor.Add( shadowActor ); @@ -589,7 +589,7 @@ public: ImageActor imageActor = ImageActor::New( image ); imageActor.SetParentOrigin( ParentOrigin::CENTER ); imageActor.SetAnchorPoint( AnchorPoint::CENTER ); - imageActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + imageActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); actor.Add( imageActor ); // Add a border image child actor (with a fixed size offset from parent). @@ -599,7 +599,7 @@ public: borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE ); borderActor.SetPosition( Vector3( 0.0f, 0.0f, 1.0f ) ); - borderActor.SetResizePolicy( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS ); + borderActor.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); borderActor.SetSizeModeFactor( Vector3( CLUSTER_IMAGE_BORDER_INDENT - 1.0f, CLUSTER_IMAGE_BORDER_INDENT - 1.0f, 0.0f ) * 2.0f ); actor.Add( borderActor ); @@ -630,7 +630,7 @@ public: pageView.SetParentOrigin(ParentOrigin::CENTER); pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); pageView.SetRelayoutEnabled( true ); - pageView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + pageView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); // Create cluster actors, add them to scroll view, and set the shear effect with the given center point. Cluster cluster = CreateClusterActor(clusterType, style); diff --git a/examples/cube-transition-effect/cube-transition-effect-example.cpp b/examples/cube-transition-effect/cube-transition-effect-example.cpp index cd0e389..691fe06 100644 --- a/examples/cube-transition-effect/cube-transition-effect-example.cpp +++ b/examples/cube-transition-effect/cube-transition-effect-example.cpp @@ -288,8 +288,8 @@ void CubeTransitionApp::OnInit( Application& application ) // show the first image mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); - mCurrentImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - mCurrentImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); + mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); mParent.Add( mCurrentImage ); mCurrentEffect = mCubeWaveEffect; @@ -328,8 +328,8 @@ void CubeTransitionApp::GoToNextImage() mNextImage = ImageActor::New( image ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); - mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); + mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); mNextImage.SetRelayoutEnabled( false ); mCurrentEffect.SetTargetImage(mNextImage); if( image.GetLoadingState() == ResourceLoadingSucceeded ) diff --git a/examples/dissolve-effect/dissolve-effect-example.cpp b/examples/dissolve-effect/dissolve-effect-example.cpp index 93b96ad..59da358 100644 --- a/examples/dissolve-effect/dissolve-effect-example.cpp +++ b/examples/dissolve-effect/dissolve-effect-example.cpp @@ -256,8 +256,8 @@ void DissolveEffectApp::OnInit( Application& application ) mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); mCurrentImage.SetRelayoutEnabled( false ); mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); - mCurrentImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - mCurrentImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); + mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); mParent.Add( mCurrentImage ); mPanGestureDetector.Attach( mCurrentImage ); @@ -287,8 +287,8 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) mNextImage = ImageActor::New( image ); mNextImage.SetRelayoutEnabled( false ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); - mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); + mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); mNextImage.SetZ(INITIAL_DEPTH); mParent.Add( mNextImage ); Vector2 size = Vector2( mCurrentImage.GetCurrentSize() ); @@ -399,8 +399,8 @@ bool DissolveEffectApp::OnTimerTick() Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); mNextImage = ImageActor::New( image ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); - mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); + mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); mNextImage.SetZ(INITIAL_DEPTH); mParent.Add( mNextImage ); switch( mCentralLineIndex%4 ) diff --git a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp index 17ceccd..8fb6496 100644 --- a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp +++ b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp @@ -424,7 +424,7 @@ public: Actor gridActor = Actor::New(); gridActor.SetRelayoutEnabled( true ); - gridActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + gridActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); gridActor.SetParentOrigin( ParentOrigin::CENTER ); gridActor.SetAnchorPoint( AnchorPoint::CENTER ); diff --git a/examples/item-view/item-view-example.cpp b/examples/item-view/item-view-example.cpp index 448735c..a750d4f 100644 --- a/examples/item-view/item-view-example.cpp +++ b/examples/item-view/item-view-example.cpp @@ -894,7 +894,7 @@ public: // From ItemFactory borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) ); borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor - borderActor.SetResizePolicy( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS ); + borderActor.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE ); actor.Add(borderActor); actor.SetKeyboardFocusable( true ); @@ -988,7 +988,7 @@ private: mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu ); TableView tableView = TableView::New( 0, 0 ); - tableView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + tableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mMenu.Add( tableView ); Slider slider = Slider::New(); @@ -997,21 +997,21 @@ private: slider.SetProperty( Slider::Property::VALUE, mDurationSeconds ); slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 ); slider.SetProperty( Slider::Property::SHOW_POPUP, true ); - slider.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + slider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange ); tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) ); TextLabel text = TextLabel::New( "Duration" ); text.SetAnchorPoint( ParentOrigin::TOP_LEFT ); text.SetParentOrigin( ParentOrigin::TOP_LEFT ); - text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - text.SetResizePolicy( FIXED, HEIGHT ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + text.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); text.SetSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) ); slider.Add( text ); Actor textContainer = Actor::New(); textContainer.SetRelayoutEnabled( true ); - textContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + textContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] ); mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER ); mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER ); @@ -1025,7 +1025,7 @@ private: text = TextLabel::New( "Alpha Function" ); text.SetAnchorPoint( ParentOrigin::TOP_LEFT ); text.SetParentOrigin( ParentOrigin::TOP_LEFT ); - text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); textContainer.Add( text ); diff --git a/examples/logging/logging-example.cpp b/examples/logging/logging-example.cpp index 184deb2..2abc12b 100644 --- a/examples/logging/logging-example.cpp +++ b/examples/logging/logging-example.cpp @@ -23,21 +23,9 @@ using namespace Dali; -namespace -{ -// Used to produce visually same dimensions on desktop and device builds -float ScalePointSize( int pointSize ) -{ - Dali::Vector2 dpi = Dali::Stage::GetCurrent().GetDpi(); - float meanDpi = (dpi.height + dpi.width) * 0.5f; - return pointSize * meanDpi / 220.0f; -} - -} // namespace - // Define this so that it is interchangeable // "DP" stands for Device independent Pixels -#define DP(x) ScalePointSize(x) +#define DP(x) x //enum ButtonType //{ @@ -186,17 +174,34 @@ class LoggingController: public ConnectionTracker TOOLBAR_IMAGE, TOOLBAR_TITLE ); - Vector2 stageSize = Stage::GetCurrent().GetSize(); + Toolkit::TableView contentTable = Toolkit::TableView::New( 6, 1 ); + contentTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + contentTable.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + contentTable.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + contentTable.SetParentOrigin( ParentOrigin::TOP_LEFT ); + contentTable.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) ); +// contentTable.TouchedSignal().Connect( this, &LoggingController::OnTouchEvent ); + + for( unsigned int i = 0; i < contentTable.GetRows(); ++i ) + { + contentTable.SetFitHeight( i ); + } + + contentTable.SetPosition( 0.0f, TOP_MARGIN ); + + mContentLayer.Add( contentTable ); - int yPos = TOP_MARGIN + MARGIN_SIZE; // Logger selector radio group - Actor radioGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - radioGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + Toolkit::TableView radioGroupBackground = Toolkit::TableView::New( 2, 1 ); + radioGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + radioGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + radioGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR ); radioGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - radioGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_RADIO_GROUP_HEIGHT) ); - mContentLayer.Add( radioGroupBackground ); + radioGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + radioGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) ); + + contentTable.Add( radioGroupBackground ); // Label { @@ -204,20 +209,27 @@ class LoggingController: public ConnectionTracker label.SetParentOrigin( ParentOrigin::TOP_LEFT ); label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); label.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); + label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); radioGroupBackground.Add( label ); + radioGroupBackground.SetFitHeight( 0 ); } // Radio group - Actor radioButtonsGroup = Actor::New(); - radioButtonsGroup.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioButtonsGroup.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioButtonsGroup.SetPosition( DP(MARGIN_SIZE), 0 ); + Toolkit::TableView radioButtonsGroup = Toolkit::TableView::New( 3, 1 ); + radioButtonsGroup.SetCellPadding( Size( 0.0f, MARGIN_SIZE * 0.5f ) ); + radioButtonsGroup.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + for( unsigned int i = 0; i < radioButtonsGroup.GetRows(); ++i ) + { + radioButtonsGroup.SetFitHeight( i ); + } + radioButtonsGroup.SetFitWidth( 0 ); radioGroupBackground.Add( radioButtonsGroup ); + radioGroupBackground.SetFitHeight( 1 ); int radioX = 0; - int radioY = MARGIN_SIZE + 28; + int radioY = 0; // Radio 1 { @@ -267,26 +279,21 @@ class LoggingController: public ConnectionTracker } // Create/delete/disable group - yPos += LOGGER_RADIO_GROUP_HEIGHT + MARGIN_SIZE; + Toolkit::TableView createGroupBackground = Toolkit::TableView::New( 1, 2 ); + createGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + createGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + createGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR ); + createGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + createGroupBackground.SetFitHeight( 0 ); - Actor createGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - createGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - createGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); - createGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - createGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_GROUP_HEIGHT) ); - mContentLayer.Add( createGroupBackground ); - - int buttonXDP = DP(MARGIN_SIZE); - int buttonWidthDP = (createGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2; + contentTable.Add( createGroupBackground ); { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( CREATE_BUTTON_ID ); button.SetLabel( CREATE_BUTTON_TEXT ); - button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); - button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - button.SetPosition( buttonXDP, 0 ); - button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); @@ -298,15 +305,11 @@ class LoggingController: public ConnectionTracker } { - buttonXDP += DP(MARGIN_SIZE) + buttonWidthDP; - Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( DELETE_BUTTON_ID ); button.SetLabel( DELETE_BUTTON_TEXT ); - button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); - button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - button.SetPosition( buttonXDP, 0 ); - button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); @@ -318,26 +321,22 @@ class LoggingController: public ConnectionTracker } // Start/stop group - yPos += LOGGER_GROUP_HEIGHT + MARGIN_SIZE; - Actor timingGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - timingGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - timingGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); - timingGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - timingGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_GROUP_HEIGHT) ); - mContentLayer.Add( timingGroupBackground ); + Toolkit::TableView timingGroupBackground = Toolkit::TableView::New( 1, 2 ); + timingGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + timingGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + timingGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR ); + timingGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + timingGroupBackground.SetFitHeight( 0 ); - buttonXDP = DP(MARGIN_SIZE); - buttonWidthDP = (timingGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2; + contentTable.Add( timingGroupBackground ); { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( START_BUTTON_ID ); button.SetLabel( START_BUTTON_TEXT ); - button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); - button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - button.SetPosition( buttonXDP, 0 ); - button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); @@ -349,15 +348,11 @@ class LoggingController: public ConnectionTracker } { - buttonXDP += DP(MARGIN_SIZE) + buttonWidthDP; - Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( STOP_BUTTON_ID ); button.SetLabel( STOP_BUTTON_TEXT ); - button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); - button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - button.SetPosition( buttonXDP, 0 ); - button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); @@ -369,26 +364,21 @@ class LoggingController: public ConnectionTracker } // Enable/disable group - yPos += LOGGER_GROUP_HEIGHT + MARGIN_SIZE; - - Actor enableGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - enableGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - enableGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); - enableGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - enableGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_GROUP_HEIGHT) ); - mContentLayer.Add( enableGroupBackground ); + Toolkit::TableView enableGroupBackground = Toolkit::TableView::New( 1, 2 ); + enableGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + enableGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + enableGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR ); + enableGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + enableGroupBackground.SetFitHeight( 0 ); - buttonXDP = DP(MARGIN_SIZE); - buttonWidthDP = (enableGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2; + contentTable.Add( enableGroupBackground ); { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( ENABLE_BUTTON_ID ); button.SetLabel( ENABLE_BUTTON_TEXT ); - button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); - button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - button.SetPosition( buttonXDP, 0 ); - button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); @@ -400,15 +390,11 @@ class LoggingController: public ConnectionTracker } { - buttonXDP += DP(MARGIN_SIZE) + buttonWidthDP; - Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( DISABLE_BUTTON_ID ); button.SetLabel( DISABLE_BUTTON_TEXT ); - button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); - button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - button.SetPosition( buttonXDP, 0 ); - button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); @@ -419,47 +405,37 @@ class LoggingController: public ConnectionTracker enableGroupBackground.Add( button ); } - yPos += LOGGER_GROUP_HEIGHT + MARGIN_SIZE; - // Logger selector radio group - unsigned int groupHeight = LOGGER_GROUP_HEIGHT + 30; + Toolkit::TableView frequencyRadioGroupBackground = Toolkit::TableView::New( 2, 1 ); + frequencyRadioGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + frequencyRadioGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + frequencyRadioGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR ); + frequencyRadioGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) ); + frequencyRadioGroupBackground.SetFitHeight( 0 ); + frequencyRadioGroupBackground.SetFitHeight( 1 ); - Actor frequencyRadioGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - frequencyRadioGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - frequencyRadioGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); - frequencyRadioGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - frequencyRadioGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(groupHeight) ); - mContentLayer.Add( frequencyRadioGroupBackground ); + contentTable.Add( frequencyRadioGroupBackground ); // Label { Toolkit::TextLabel label = Toolkit::TextLabel::New( FREQUENCY_TEXT ); - label.SetParentOrigin( ParentOrigin::TOP_LEFT ); - label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - label.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); frequencyRadioGroupBackground.Add( label ); } // Radio group - Actor frequencyRadioButtonsGroup = Actor::New(); - frequencyRadioButtonsGroup.SetParentOrigin( ParentOrigin::TOP_LEFT ); - frequencyRadioButtonsGroup.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - frequencyRadioButtonsGroup.SetPosition( DP(MARGIN_SIZE), DP(40) ); + Toolkit::TableView frequencyRadioButtonsGroup = Toolkit::TableView::New( 1, 3 ); + frequencyRadioButtonsGroup.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + frequencyRadioButtonsGroup.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + frequencyRadioButtonsGroup.SetFitHeight( 0 ); + frequencyRadioButtonsGroup.SetPadding( Padding( 0.0f, 0.0f, MARGIN_SIZE, 0.0f ) ); frequencyRadioGroupBackground.Add( frequencyRadioButtonsGroup ); - radioX = 0; - radioY = 0; - const int frequencyRadioWidth = 100; - // Radio 1 { Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_1_RADIO_TEXT ); radioButton.SetName( FREQUENCY_1_RADIO_ID ); - radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioButton.SetPosition( DP(radioX), DP(radioY) ); radioButton.StateChangedSignal().Connect( this, &LoggingController::FrequencyRadioSelect ); @@ -469,13 +445,9 @@ class LoggingController: public ConnectionTracker // Radio 2 { - radioX += frequencyRadioWidth; - Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_2_RADIO_TEXT ); radioButton.SetName( FREQUENCY_2_RADIO_ID ); - radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioButton.SetPosition( DP(radioX), DP(radioY) ); + radioButton.SetSelected( true ); radioButton.StateChangedSignal().Connect( this, &LoggingController::FrequencyRadioSelect ); @@ -486,13 +458,8 @@ class LoggingController: public ConnectionTracker // Radio 3 { - radioX += frequencyRadioWidth; - Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_3_RADIO_TEXT ); radioButton.SetName( FREQUENCY_3_RADIO_ID ); - radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioButton.SetPosition( DP(radioX), DP(radioY) ); radioButton.StateChangedSignal().Connect( this, &LoggingController::FrequencyRadioSelect ); @@ -501,26 +468,21 @@ class LoggingController: public ConnectionTracker } // Vsync group - yPos += groupHeight + MARGIN_SIZE; - - Actor vsyncGroupBackground = Toolkit::CreateSolidColorActor( BACKGROUND_COLOUR ); - vsyncGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - vsyncGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); - vsyncGroupBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); - vsyncGroupBackground.SetSize( stageSize.width - 2 * DP(MARGIN_SIZE), DP(LOGGER_GROUP_HEIGHT) ); - mContentLayer.Add( vsyncGroupBackground ); + Toolkit::TableView vsyncGroupBackground = Toolkit::TableView::New( 1, 1 ); + vsyncGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + vsyncGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + vsyncGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR ); + vsyncGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + vsyncGroupBackground.SetFitHeight( 0 ); - buttonXDP = DP(MARGIN_SIZE); - buttonWidthDP = vsyncGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 2; + contentTable.Add( vsyncGroupBackground ); { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( VSYNC_BUTTON_ID ); button.SetLabel( VSYNC_BUTTON_TEXT ); - button.SetParentOrigin( ParentOrigin::CENTER_LEFT ); - button.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - button.SetPosition( buttonXDP, 0 ); - button.SetSize( buttonWidthDP, DP(BUTTON_HEIGHT) ); + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); button.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); @@ -720,6 +682,34 @@ class LoggingController: public ConnectionTracker return true; } + bool OnTouchEvent( Actor actor, const TouchEvent& event ) + { + if( 1u == event.GetPointCount() ) + { + const TouchPoint::State state = event.GetPoint(0u).state; + + // Clamp to integer values; this is to reduce flicking due to pixel misalignment + const float localPoint = static_cast( static_cast( event.GetPoint( 0 ).local.y ) ); + + if( TouchPoint::Down == state ) + { + mLastPoint = localPoint; + mAnimation = Animation::New( 0.25f ); + } + else if( TouchPoint::Motion == state ) + { + if( mAnimation ) + { + mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear ); + mAnimation.Play(); + mLastPoint = localPoint; + } + } + } + + return true; + } + private: struct LoggerState @@ -736,6 +726,9 @@ class LoggingController: public ConnectionTracker Toolkit::ToolBar mToolBar; ///< The View's Toolbar. Layer mContentLayer; ///< Content layer + Animation mAnimation; + float mLastPoint; + typedef std::vector< std::string > Strings; Strings mPerformanceLoggerNames; diff --git a/examples/path-animation/path-animation.cpp b/examples/path-animation/path-animation.cpp index 369f0b0..18c5140 100644 --- a/examples/path-animation/path-animation.cpp +++ b/examples/path-animation/path-animation.cpp @@ -65,8 +65,8 @@ public: Actor CreateVectorComponentControl( const std::string& label, const Vector3& size, bool(PathController::*callback)(Slider,float) ) { TextLabel text = TextLabel::New(label); - text.SetResizePolicy( USE_NATURAL_SIZE, WIDTH ); - text.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + text.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); + text.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); text.SetColor( Vector4(0.0f,0.0f,0.0f,1.0f)); Slider slider = Slider::New(); diff --git a/examples/radial-menu/radial-menu-example.cpp b/examples/radial-menu/radial-menu-example.cpp index 028265a..ac735bf 100644 --- a/examples/radial-menu/radial-menu-example.cpp +++ b/examples/radial-menu/radial-menu-example.cpp @@ -167,7 +167,7 @@ void RadialMenuExample::OnInit(Application& app) Image dial = ResourceImage::New( TEST_DIAL_FILENAME ); mDialActor = ImageActor::New( dial ); - mDialActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + mDialActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); mDialActor.SetPositionInheritanceMode(USE_PARENT_POSITION); mDialActor.SetScale(scale); Layer dialLayer = Layer::New(); @@ -245,7 +245,7 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, mImageActor = ImageActor::New(image); mImageActor.SetParentOrigin(ParentOrigin::CENTER); mImageActor.SetAnchorPoint(AnchorPoint::CENTER); - mImageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + mImageActor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); // Create the stencil Vector2 imageSize = ResourceImage::GetImageSize(imageName); diff --git a/examples/scroll-view/scroll-view-example.cpp b/examples/scroll-view/scroll-view-example.cpp index 6a083be..4fa6c22 100644 --- a/examples/scroll-view/scroll-view-example.cpp +++ b/examples/scroll-view/scroll-view-example.cpp @@ -302,7 +302,7 @@ private: { Actor page = Actor::New(); page.SetRelayoutEnabled( true ); - page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); page.SetParentOrigin( ParentOrigin::CENTER ); page.SetAnchorPoint( AnchorPoint::CENTER ); @@ -455,7 +455,7 @@ private: { page.RemoveConstraints(); page.SetRelayoutEnabled( true ); - page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); switch( mEffectMode ) { diff --git a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp b/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp index 99fffb7..74b1a88 100644 --- a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp +++ b/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp @@ -201,7 +201,7 @@ public: mShadowView.SetParentOrigin(ParentOrigin::CENTER); mShadowView.SetAnchorPoint(AnchorPoint::CENTER); mShadowView.SetRelayoutEnabled( true ); - mShadowView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mShadowView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f); mContents.Add(mShadowView); @@ -234,8 +234,7 @@ public: TextLabel text = TextLabel::New( "Light" ); text.SetProperty( TextLabel::Property::POINT_SIZE, 20.0f ); - text.SetResizePolicy( USE_NATURAL_SIZE, WIDTH ); - text.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + text.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); text.SetColor( Color::BLUE ); mCastingLight.Add(text); @@ -256,9 +255,9 @@ public: mImageActor2 = ImageActor::New( ResourceImage::New(SCENE_IMAGE_2) ); mImageActor3 = ImageActor::New( ResourceImage::New(SCENE_IMAGE_3) ); - mImageActor1.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); - mImageActor2.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); - mImageActor3.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + mImageActor1.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + mImageActor2.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + mImageActor3.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); mImageActor2.SetParentOrigin(ParentOrigin::CENTER); diff --git a/examples/size-negotiation/size-negotiation-example.cpp b/examples/size-negotiation/size-negotiation-example.cpp index 2712ab2..cae5517 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -190,7 +190,7 @@ public: mItemView = Toolkit::ItemView::New( *this ); mItemView.SetParentOrigin( ParentOrigin::CENTER ); mItemView.SetAnchorPoint( AnchorPoint::CENTER ); - mItemView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); // Use a grid layout for tests Toolkit::GridLayoutPtr gridLayout = Toolkit::GridLayout::New(); @@ -254,11 +254,11 @@ public: mMenu.HideTail(); mMenu.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::HideMenu ); mMenu.SetSize( popupWidth, 0.0f ); - mMenu.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); + mMenu.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); Toolkit::TableView tableView = Toolkit::TableView::New( 0, 0 ); - tableView.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + tableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + tableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); mMenu.Add( tableView ); for( unsigned int i = 0; i < MENU_ITEMS_COUNT; ++i ) @@ -430,6 +430,8 @@ public: text.SetProperty( TextLabel::Property::MULTI_LINE, true ); text.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) ); mPopup.Add( text ); @@ -441,8 +443,8 @@ public: mPopup = CreatePopup(); ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) ); - image.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - image.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); image.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) ); mPopup.Add( image ); @@ -453,11 +455,11 @@ public: { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) ); - image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.Add( image ); @@ -467,12 +469,12 @@ public: { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) ); - image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - image.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + image.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); mPopup.Add( image ); @@ -482,12 +484,12 @@ public: { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) ); - image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - image.SetSizeScalePolicy( FILL_WITH_ASPECT_RATIO ); + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + image.SetSizeScalePolicy( SizeScalePolicy::FILL_WITH_ASPECT_RATIO ); mPopup.Add( image ); @@ -500,9 +502,9 @@ public: Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT ); text.SetName( "POPUP_CONTENT_TEXT" ); - text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); text.SetProperty( TextLabel::Property::MULTI_LINE, true ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) ); mPopup.Add( text ); @@ -516,9 +518,9 @@ public: Toolkit::TextLabel text = Toolkit::TextLabel::New( CONTENT_TEXT ); text.SetName( "POPUP_CONTENT_TEXT" ); - text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); text.SetProperty( TextLabel::Property::MULTI_LINE, true ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) ); mPopup.Add( text ); @@ -553,8 +555,8 @@ public: // Content Toolkit::TableView content = Toolkit::TableView::New( 2, 2 ); content.SetName( "COMPLEX_TABLEVIEW" ); - content.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - content.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + content.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + content.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); content.SetFitHeight( 0 ); content.SetFitHeight( 1 ); content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) ); @@ -562,9 +564,9 @@ public: // Text { Toolkit::TextLabel text = Toolkit::TextLabel::New( "Do you really want to quit?" ); - text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); text.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + text.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) ); } @@ -573,8 +575,8 @@ public: { ImageActor image = ImageActor::New( ResourceImage::New( IMAGE1 ) ); image.SetName( "COMPLEX_IMAGE" ); - image.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - image.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); + image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + image.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) ); content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); } @@ -582,8 +584,8 @@ public: // Text 2 { Toolkit::TableView root = Toolkit::TableView::New( 1, 2 ); - root.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - root.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + root.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + root.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); root.SetFitHeight( 0 ); root.SetFitWidth( 0 ); root.SetPadding( Padding( 0.0f, 0.0f, 0.0f, 20.0f ) ); @@ -634,12 +636,12 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); Toolkit::TableView table = Toolkit::TableView::New( 0, 0 ); - table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.Add( table ); @@ -648,16 +650,16 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); Toolkit::TableView table = Toolkit::TableView::New( 0, 0 ); table.SetName( "TABLEVIEW_BUTTON_1CELL_ID" ); - table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.Add( backing ); mPopup.Add( table ); @@ -667,26 +669,26 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); Toolkit::TableView table = Toolkit::TableView::New( 0, 0 ); - table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.Add( backing ); } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.Add( backing ); } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.Add( backing ); } @@ -697,61 +699,61 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); Toolkit::TableView table = Toolkit::TableView::New( 3, 3 ); - table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); // Column 0 { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) ); } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) ); } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) ); } // Column 1 { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 1 ) ); } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 1 ) ); } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 1.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 1 ) ); } // Column 2 { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 2 ) ); } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.5f, 0.5f, 0.5f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 2 ) ); } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.5f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 2 ) ); } @@ -762,20 +764,20 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); - table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.SetFixedHeight( 0, 50.0f ); { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); backing.Add( text ); @@ -783,9 +785,9 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetParentOrigin( ParentOrigin::CENTER ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -794,9 +796,9 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetParentOrigin( ParentOrigin::CENTER ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -811,22 +813,22 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); - table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.SetFixedHeight( 0, 50.0f ); table.SetFixedHeight( 2, 50.0f ); { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -835,11 +837,11 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -848,11 +850,11 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -867,24 +869,24 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); - table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.SetFitHeight( 0 ); table.SetFitHeight( 2 ); { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); backing.SetSize( 0.0f, 100.0f ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -894,12 +896,12 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -909,13 +911,13 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); backing.SetSize( 0.0f, 100.0f ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -931,21 +933,21 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); - table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); table.SetFitHeight( 1 ); { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -955,11 +957,11 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); backing.SetSize( 0.0f, 200.0f ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -971,12 +973,12 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -992,26 +994,26 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, WIDTH ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) ); - mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); + mPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); - table.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + table.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); table.SetFitHeight( 0 ); table.SetFitHeight( 1 ); table.SetFitHeight( 2 ); { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); backing.SetSize( 0.0f, 100.0f ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -1021,13 +1023,13 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); backing.SetSize( 0.0f, 200.0f ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -1037,13 +1039,13 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); backing.SetSize( 0.0f, 300.0f ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -1059,26 +1061,26 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, WIDTH ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) ); - mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); + mPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); - table.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + table.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); table.SetFitHeight( 0 ); table.SetFitHeight( 1 ); { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - backing.SetResizePolicy( FIXED, HEIGHT ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + backing.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); backing.SetSize( 0.0f, 100.0f ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -1088,13 +1090,13 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); backing.SetSize( 0.0f, 200.0f ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -1110,24 +1112,24 @@ public: else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID ) { mPopup = CreatePopup(); - mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, WIDTH ); + mPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH ); mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) ); - mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); + mPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT ); Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); - table.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + table.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + table.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); table.SetFixedHeight( 0, 20.0f ); table.SetFitHeight( 1 ); { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -1137,13 +1139,13 @@ public: } { Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); - backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); + backing.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); backing.SetSize( 0.0f, 200.0f ); Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" ); text.SetAnchorPoint( AnchorPoint::CENTER ); text.SetParentOrigin( ParentOrigin::CENTER ); - text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); text.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); text.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -1251,7 +1253,7 @@ public: // From ItemFactory Toolkit::PushButton popupButton = Toolkit::PushButton::New(); popupButton.SetName( buttonDataArray[ itemId ].name ); popupButton.SetLabel( buttonDataArray[ itemId ].text ); - popupButton.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); popupButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); popupButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); diff --git a/examples/text-field/text-field-example.cpp b/examples/text-field/text-field-example.cpp index cbce666..0bc8e70 100644 --- a/examples/text-field/text-field-example.cpp +++ b/examples/text-field/text-field-example.cpp @@ -74,7 +74,6 @@ public: mContainer = Control::New(); mContainer.SetName( "Container" ); mContainer.SetParentOrigin( ParentOrigin::CENTER ); - mContainer.SetResizePolicy( FIXED, ALL_DIMENSIONS ); mContainer.SetSize( Vector2(stageSize.width*0.6f, stageSize.width*0.6f) ); mContainer.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) ); mContainer.GetChildAt(0).SetZ(-1.0f); @@ -82,8 +81,8 @@ public: TextField field = TextField::New(); field.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - field.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - field.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); + field.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + field.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); mContainer.Add( field ); diff --git a/examples/text-label-emojis/text-label-emojis.cpp b/examples/text-label-emojis/text-label-emojis.cpp index af33376..8529904 100644 --- a/examples/text-label-emojis/text-label-emojis.cpp +++ b/examples/text-label-emojis/text-label-emojis.cpp @@ -59,8 +59,8 @@ public: stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent); mTableView = Toolkit::TableView::New( NUMBER_OF_EMOJIS, 1 ); - mTableView.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - mTableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT ); mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mTableView.TouchedSignal().Connect( this, &EmojiExample::OnTouchEvent ); diff --git a/examples/text-label-multi-language/text-label-multi-language-example.cpp b/examples/text-label-multi-language/text-label-multi-language-example.cpp index b25dea5..436b213 100644 --- a/examples/text-label-multi-language/text-label-multi-language-example.cpp +++ b/examples/text-label-multi-language/text-label-multi-language-example.cpp @@ -64,8 +64,8 @@ public: stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent); mTableView = Toolkit::TableView::New( NUMBER_OF_LANGUAGES, 1 ); - mTableView.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - mTableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); + mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT ); mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mTableView.TouchedSignal().Connect( this, &TextLabelMultiLanguageExample::OnTouchEvent ); diff --git a/examples/text-label/text-label-example.cpp b/examples/text-label/text-label-example.cpp index 6271cc7..fc89fa8 100644 --- a/examples/text-label/text-label-example.cpp +++ b/examples/text-label/text-label-example.cpp @@ -106,7 +106,6 @@ public: mContainer = Control::New(); mContainer.SetName( "Container" ); mContainer.SetParentOrigin( ParentOrigin::CENTER ); - mContainer.SetResizePolicy( FIXED, ALL_DIMENSIONS ); mLayoutSize = Vector2(stageSize.width*0.6f, stageSize.width*0.6f); mContainer.SetSize( mLayoutSize ); mContainer.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) ); @@ -118,7 +117,6 @@ public: mGrabCorner.SetName( "GrabCorner" ); mGrabCorner.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT ); mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT ); - mGrabCorner.SetResizePolicy( FIXED, ALL_DIMENSIONS ); mGrabCorner.SetSize( Vector2(stageSize.width*0.1f, stageSize.width*0.1f) ); mGrabCorner.SetZ(1.0f); mContainer.Add( mGrabCorner ); @@ -130,8 +128,8 @@ public: mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" ); mLabel.SetName( "TextLabel" ); mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mLabel.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - mLabel.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); + mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mLabel.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT ); mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) ); mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); diff --git a/shared/dali-demo-strings.h b/shared/dali-demo-strings.h index 5d54d63..56adecf 100644 --- a/shared/dali-demo-strings.h +++ b/shared/dali-demo-strings.h @@ -54,6 +54,8 @@ extern "C" #define DALI_DEMO_STR_TITLE_ANIMATED_SHAPES dgettext(DALI_DEMO_STR_TITLE_ANIMATED_SHAPES) #define DALI_DEMO_STR_TITLE_PATH_ANIMATION dgettext(DALI_DEMO_STR_TITLE_PATH_ANIMATION) #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE dgettext(DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE) +#define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS") +#define DALI_DEMO_STR_TITLE_LOGGING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LOGGING") #else // !INTERNATIONALIZATION_ENABLED @@ -79,6 +81,8 @@ extern "C" #define DALI_DEMO_STR_TITLE_ANIMATED_SHAPES "Animated Shapes" #define DALI_DEMO_STR_TITLE_PATH_ANIMATION "Animated Path" #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE "Negotiate Size" +#define DALI_DEMO_STR_TITLE_BUTTONS "Buttons" +#define DALI_DEMO_STR_TITLE_LOGGING "Logging" #endif diff --git a/shared/view.h b/shared/view.h index 1a87f67..f5fa893 100644 --- a/shared/view.h +++ b/shared/view.h @@ -77,7 +77,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); toolBarLayer.SetSize( 0.0f, style.mToolBarHeight ); - toolBarLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::WIDTH ); + toolBarLayer.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::WIDTH ); // Raise tool bar layer to the top. toolBarLayer.RaiseToTop(); @@ -86,13 +86,13 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, Dali::Image image = Dali::ResourceImage::New( toolbarImagePath ); Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image ); toolBarBackground.SetName( "TOOLBAR_BACKGROUND" ); - toolBarBackground.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS ); + toolBarBackground.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); toolBar = Dali::Toolkit::ToolBar::New(); toolBar.SetName( "TOOLBAR" ); toolBar.SetBackground( toolBarBackground ); toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); - toolBar.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS ); + toolBar.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); toolBarBackground.SetSortModifier(1.0f); // Add the tool bar to the too bar layer. @@ -108,7 +108,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, label.SetProperty( Dali::Toolkit::TextLabel::Property::TEXT, title ); label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); - label.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::HEIGHT ); + label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT ); label.SetColor( DEFAULT_TEXT_STYLE_COLOR ); // Add title to the tool bar. @@ -131,7 +131,7 @@ Dali::Layer CreateView( Dali::Application& application, // Create default View. view = Dali::Toolkit::View::New(); - view.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS ); + view.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); // Add the view to the stage before setting the background. stage.Add( view ); @@ -162,7 +162,7 @@ Dali::Layer CreateView( Dali::Application& application, Dali::Layer contentLayer = Dali::Layer::New(); contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER ); contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER ); - contentLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS ); + contentLayer.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); view.AddContentLayer( contentLayer ); contentLayer.LowerBelow( toolBarLayer ); @@ -176,7 +176,7 @@ Dali::Toolkit::TextLabel CreateToolBarLabel( const std::string& text ) label.SetDrawMode( Dali::DrawMode::OVERLAY ); label.SetProperty( Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); label.SetProperty( Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); - label.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::HEIGHT ); + label.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::HEIGHT ); label.SetColor( DEFAULT_TEXT_STYLE_COLOR ); return label;