Commit e47588a2c4b176b79b182da6906dae2f8b179910
[dali_1.0.36] Merge branch 'tizen'
Change-Id: I932fde5506e5de977fc35a8156f2d1d2854d61c0
Showing
35 changed files
with
2077 additions
and
227 deletions
com.samsung.dali-demo.xml
| @@ -52,6 +52,9 @@ | @@ -52,6 +52,9 @@ | ||
| 52 | <ui-application appid="refraction-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/refraction-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 52 | <ui-application appid="refraction-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/refraction-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 53 | <label>Refraction effect</label> | 53 | <label>Refraction effect</label> |
| 54 | </ui-application> | 54 | </ui-application> |
| 55 | + <ui-application appid="scripting.example" exec="/usr/apps/com.samsung.dali-demo/bin/scripting.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 56 | + <label>Scroll View</label> | ||
| 57 | + </ui-application> | ||
| 55 | <ui-application appid="scroll-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/scroll-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 58 | <ui-application appid="scroll-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/scroll-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 56 | <label>Scroll View</label> | 59 | <label>Scroll View</label> |
| 57 | </ui-application> | 60 | </ui-application> |
| @@ -68,7 +71,7 @@ | @@ -68,7 +71,7 @@ | ||
| 68 | <label>Image Scaling Modes</label> | 71 | <label>Image Scaling Modes</label> |
| 69 | </ui-application> | 72 | </ui-application> |
| 70 | <ui-application appid="buttons.example" exec="/usr/apps/com.samsung.dali-demo/bin/buttons.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 73 | <ui-application appid="buttons.example" exec="/usr/apps/com.samsung.dali-demo/bin/buttons.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 71 | - <label>Radio Buttons</label> | 74 | + <label>Buttons</label> |
| 72 | </ui-application> | 75 | </ui-application> |
| 73 | <ui-application appid="text-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 76 | <ui-application appid="text-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 74 | <label>Text View</label> | 77 | <label>Text View</label> |
| @@ -85,4 +88,7 @@ | @@ -85,4 +88,7 @@ | ||
| 85 | <ui-application appid="atlas.example" exec="/usr/apps/com.samsung.dali-demo/bin/atlas.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 88 | <ui-application appid="atlas.example" exec="/usr/apps/com.samsung.dali-demo/bin/atlas.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 86 | <label>Atlas</label> | 89 | <label>Atlas</label> |
| 87 | </ui-application> | 90 | </ui-application> |
| 91 | + <ui-application appid="size-negotiation.example" exec="/usr/apps/com.samsung.dali-demo/bin/size-negotiation.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | ||
| 92 | + <label>Size Negotiation</label> | ||
| 93 | + </ui-application> | ||
| 88 | </manifest> | 94 | </manifest> |
demo/dali-demo.cpp
| @@ -39,11 +39,15 @@ int main(int argc, char **argv) | @@ -39,11 +39,15 @@ int main(int argc, char **argv) | ||
| 39 | demo.AddExample(Example("refraction-effect.example", "Refraction")); | 39 | demo.AddExample(Example("refraction-effect.example", "Refraction")); |
| 40 | demo.AddExample(Example("scroll-view.example", "Scroll View")); | 40 | demo.AddExample(Example("scroll-view.example", "Scroll View")); |
| 41 | demo.AddExample(Example("shadow-bone-lighting.example", "Lights and shadows")); | 41 | demo.AddExample(Example("shadow-bone-lighting.example", "Lights and shadows")); |
| 42 | - demo.AddExample(Example("builder.example", "Script Based UI")); | 42 | +// demo.AddExample(Example("builder.example", "Script Based UI")); |
| 43 | demo.AddExample(Example("image-scaling-irregular-grid.example", "Image Scaling Modes")); | 43 | demo.AddExample(Example("image-scaling-irregular-grid.example", "Image Scaling Modes")); |
| 44 | demo.AddExample(Example("text-view.example", "Text View")); | 44 | demo.AddExample(Example("text-view.example", "Text View")); |
| 45 | demo.AddExample(Example("animated-shapes.example", "Animated Shapes")); | 45 | demo.AddExample(Example("animated-shapes.example", "Animated Shapes")); |
| 46 | demo.AddExample(Example("path-animation.example", "Path Animation")); | 46 | demo.AddExample(Example("path-animation.example", "Path Animation")); |
| 47 | + demo.AddExample(Example("size-negotiation.example", "Size Negotiation")); | ||
| 48 | + | ||
| 49 | + demo.SortAlphabetically( true ); | ||
| 50 | + | ||
| 47 | app.MainLoop(); | 51 | app.MainLoop(); |
| 48 | 52 | ||
| 49 | return 0; | 53 | return 0; |
demo/dali-table-view.cpp
| @@ -55,10 +55,10 @@ const int MAX_PAGES = 256; ///< Maximum pag | @@ -55,10 +55,10 @@ const int MAX_PAGES = 256; ///< Maximum pag | ||
| 55 | const int EXAMPLES_PER_ROW = 3; | 55 | const int EXAMPLES_PER_ROW = 3; |
| 56 | const int ROWS_PER_PAGE = 3; | 56 | const int ROWS_PER_PAGE = 3; |
| 57 | const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE; | 57 | const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE; |
| 58 | -const float LOGO_MARGIN_RATIO = 0.5f / 0.9f; | 58 | +const float LOGO_MARGIN_RATIO = 0.1f / 0.3f; |
| 59 | const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f; | 59 | const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f; |
| 60 | const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< ScrollView's relative size to its parent | 60 | const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< ScrollView's relative size to its parent |
| 61 | -const Vector3 TABLE_RELATIVE_SIZE(0.9f, 0.9f, 0.8f ); ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights. | 61 | +const Vector3 TABLE_RELATIVE_SIZE(0.95f, 0.9f, 0.8f ); ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights. |
| 62 | const float STENCIL_RELATIVE_SIZE = 1.0f; | 62 | const float STENCIL_RELATIVE_SIZE = 1.0f; |
| 63 | 63 | ||
| 64 | const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects | 64 | const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects |
| @@ -75,7 +75,6 @@ const float SCALE_SPEED_SIN = 0.1f; | @@ -75,7 +75,6 @@ const float SCALE_SPEED_SIN = 0.1f; | ||
| 75 | const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs | 75 | const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs |
| 76 | 76 | ||
| 77 | const float BACKGROUND_Z = -1.0f; | 77 | const float BACKGROUND_Z = -1.0f; |
| 78 | -const float BACKGROUND_SIZE_SCALE = 1.0f; | ||
| 79 | const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); | 78 | const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); |
| 80 | 79 | ||
| 81 | const float BUBBLE_MIN_Z = -1.0; | 80 | const float BUBBLE_MIN_Z = -1.0; |
| @@ -124,10 +123,11 @@ ImageActor CreateBackground( std::string imagePath ) | @@ -124,10 +123,11 @@ ImageActor CreateBackground( std::string imagePath ) | ||
| 124 | { | 123 | { |
| 125 | Image image = ResourceImage::New( imagePath ); | 124 | Image image = ResourceImage::New( imagePath ); |
| 126 | ImageActor background = ImageActor::New( image ); | 125 | ImageActor background = ImageActor::New( image ); |
| 127 | - | 126 | + background.SetName( "BACKGROUND" ); |
| 128 | background.SetAnchorPoint( AnchorPoint::CENTER ); | 127 | background.SetAnchorPoint( AnchorPoint::CENTER ); |
| 129 | background.SetParentOrigin( ParentOrigin::CENTER ); | 128 | background.SetParentOrigin( ParentOrigin::CENTER ); |
| 130 | background.SetZ( -1.0f ); | 129 | background.SetZ( -1.0f ); |
| 130 | + background.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 131 | 131 | ||
| 132 | return background; | 132 | return background; |
| 133 | } | 133 | } |
| @@ -139,7 +139,7 @@ const float IMAGE_BORDER_TOP = IMAGE_BORDER_LEFT; | @@ -139,7 +139,7 @@ const float IMAGE_BORDER_TOP = IMAGE_BORDER_LEFT; | ||
| 139 | const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT; | 139 | const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT; |
| 140 | 140 | ||
| 141 | /** | 141 | /** |
| 142 | - * Constraint to return a position for a bubble based on the scroll value and vertical wrapping. | 142 | + * Constraint to return a position for a bubble based on the scroll value and vertical wrapping |
| 143 | */ | 143 | */ |
| 144 | struct AnimateBubbleConstraint | 144 | struct AnimateBubbleConstraint |
| 145 | { | 145 | { |
| @@ -154,15 +154,15 @@ public: | @@ -154,15 +154,15 @@ public: | ||
| 154 | Vector3 operator()( const Vector3& current, const PropertyInput& scrollProperty, const PropertyInput& parentSize ) | 154 | Vector3 operator()( const Vector3& current, const PropertyInput& scrollProperty, const PropertyInput& parentSize ) |
| 155 | { | 155 | { |
| 156 | Vector3 pos( current ); | 156 | Vector3 pos( current ); |
| 157 | + const float parentHeight = parentSize.GetVector3().height; | ||
| 157 | 158 | ||
| 158 | - // Wrap bubbles verically. | ||
| 159 | - if( pos.y + mShapeSize * 0.5f < -parentSize.GetVector3().y * 0.5f ) | 159 | + // Wrap bubbles vertically |
| 160 | + if( pos.y + mShapeSize * 0.5f < -parentHeight * 0.5f ) | ||
| 160 | { | 161 | { |
| 161 | - pos.y += parentSize.GetVector3().y + mShapeSize; | 162 | + pos.y = parentHeight * 0.5f + mShapeSize * 0.5f; |
| 162 | } | 163 | } |
| 163 | 164 | ||
| 164 | - // Bubbles X position moves parallax to horizontal | ||
| 165 | - // panning by a scale factor unique to each bubble. | 165 | + // Bubbles X position moves parallax to horizontal panning by a scale factor unique to each bubble |
| 166 | pos.x = mInitialX + ( scrollProperty.GetVector3().x * mScale ); | 166 | pos.x = mInitialX + ( scrollProperty.GetVector3().x * mScale ); |
| 167 | return pos; | 167 | return pos; |
| 168 | } | 168 | } |
| @@ -186,7 +186,6 @@ DaliTableView::DaliTableView( Application& application ) | @@ -186,7 +186,6 @@ DaliTableView::DaliTableView( Application& application ) | ||
| 186 | mRootActor(), | 186 | mRootActor(), |
| 187 | mRotateAnimation(), | 187 | mRotateAnimation(), |
| 188 | mBackground(), | 188 | mBackground(), |
| 189 | - mLogo(), | ||
| 190 | mPressedAnimation(), | 189 | mPressedAnimation(), |
| 191 | mScrollViewLayer(), | 190 | mScrollViewLayer(), |
| 192 | mScrollView(), | 191 | mScrollView(), |
| @@ -242,15 +241,14 @@ void DaliTableView::Initialize( Application& application ) | @@ -242,15 +241,14 @@ void DaliTableView::Initialize( Application& application ) | ||
| 242 | const Vector2 stageSize = Stage::GetCurrent().GetSize(); | 241 | const Vector2 stageSize = Stage::GetCurrent().GetSize(); |
| 243 | 242 | ||
| 244 | // Background | 243 | // Background |
| 245 | - mBackground = CreateBackground( mBackgroundImagePath ); | ||
| 246 | - // set same size as parent actor | ||
| 247 | - mBackground.SetSize( stageSize ); | ||
| 248 | - Stage::GetCurrent().Add( mBackground ); | 244 | + Actor background = CreateBackground( mBackgroundImagePath ); |
| 245 | + Stage::GetCurrent().Add( background ); | ||
| 249 | 246 | ||
| 250 | // Render entire content as overlays, as is all on same 2D plane. | 247 | // Render entire content as overlays, as is all on same 2D plane. |
| 251 | mRootActor = TableView::New( 4, 1 ); | 248 | mRootActor = TableView::New( 4, 1 ); |
| 252 | mRootActor.SetAnchorPoint( AnchorPoint::CENTER ); | 249 | mRootActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 253 | mRootActor.SetParentOrigin( ParentOrigin::CENTER ); | 250 | mRootActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 251 | + mRootActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 254 | Stage::GetCurrent().Add( mRootActor ); | 252 | Stage::GetCurrent().Add( mRootActor ); |
| 255 | 253 | ||
| 256 | // Toolbar at top | 254 | // Toolbar at top |
| @@ -262,37 +260,42 @@ void DaliTableView::Initialize( Application& application ) | @@ -262,37 +260,42 @@ void DaliTableView::Initialize( Application& application ) | ||
| 262 | DemoHelper::GetDefaultTextStyle()); | 260 | DemoHelper::GetDefaultTextStyle()); |
| 263 | 261 | ||
| 264 | mRootActor.AddChild( toolBarLayer, TableView::CellPosition( 0, 0 ) ); | 262 | mRootActor.AddChild( toolBarLayer, TableView::CellPosition( 0, 0 ) ); |
| 265 | - const float toolbarHeight = DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight; | ||
| 266 | - mRootActor.SetFixedHeight( 0, toolbarHeight ); | 263 | + mRootActor.SetFitHeight( 0 ); |
| 267 | 264 | ||
| 268 | // Add logo | 265 | // Add logo |
| 269 | - mLogo = CreateLogo( LOGO_PATH ); | 266 | + Dali::ImageActor logo = CreateLogo( LOGO_PATH ); |
| 267 | + logo.SetName( "LOGO_IMAGE" ); | ||
| 268 | + logo.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); | ||
| 270 | const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y ); | 269 | const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y ); |
| 271 | const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO; | 270 | const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO; |
| 272 | - const float logoHeight = mLogo.GetImage().GetHeight() + logoMargin; | ||
| 273 | - mRootActor.SetFixedHeight( 1, logoHeight ); | ||
| 274 | 271 | ||
| 275 | // Show version in a popup when log is tapped | 272 | // Show version in a popup when log is tapped |
| 276 | mLogoTapDetector = TapGestureDetector::New(); | 273 | mLogoTapDetector = TapGestureDetector::New(); |
| 277 | - mLogoTapDetector.Attach( mLogo ); | 274 | + mLogoTapDetector.Attach( logo ); |
| 278 | mLogoTapDetector.DetectedSignal().Connect( this, &DaliTableView::OnLogoTapped ); | 275 | mLogoTapDetector.DetectedSignal().Connect( this, &DaliTableView::OnLogoTapped ); |
| 279 | 276 | ||
| 280 | const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO; | 277 | const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO; |
| 281 | - mButtonsPageRelativeSize = Vector3( TABLE_RELATIVE_SIZE.x, 1.f - ( toolbarHeight + logoHeight + bottomMargin) / stageSize.height, TABLE_RELATIVE_SIZE.z ); | ||
| 282 | - mRootActor.SetFixedHeight( 2, mButtonsPageRelativeSize.y * stageSize.height ); | ||
| 283 | 278 | ||
| 284 | Alignment alignment = Alignment::New(); | 279 | Alignment alignment = Alignment::New(); |
| 285 | - alignment.Add(mLogo); | 280 | + alignment.SetName( "LOGO_ALIGNMENT" ); |
| 281 | + alignment.Add( logo ); | ||
| 282 | + alignment.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 283 | + alignment.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); | ||
| 284 | + Actor alignmentActor = alignment; | ||
| 285 | + alignmentActor.SetPadding( Padding( 0.0f, 0.0f, logoMargin, logoMargin )); | ||
| 286 | mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) ); | 286 | mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) ); |
| 287 | + mRootActor.SetFitHeight( 1 ); | ||
| 287 | 288 | ||
| 288 | // scrollview occupying the majority of the screen | 289 | // scrollview occupying the majority of the screen |
| 289 | mScrollView = ScrollView::New(); | 290 | mScrollView = ScrollView::New(); |
| 291 | + mScrollView.SetRelayoutEnabled( true ); | ||
| 290 | 292 | ||
| 291 | mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); | 293 | mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); |
| 292 | mScrollView.SetParentOrigin( ParentOrigin::CENTER ); | 294 | mScrollView.SetParentOrigin( ParentOrigin::CENTER ); |
| 293 | - // Note: Currently, changing mScrollView to use SizeMode RELATIVE_TO_PARENT | ||
| 294 | - // will cause scroll ends to appear in the wrong position. | ||
| 295 | - mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) ); | 295 | + mScrollView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 296 | + const float buttonsPageMargin = ( 1.0f - TABLE_RELATIVE_SIZE.x ) * 0.5f * stageSize.width; | ||
| 297 | + mScrollView.SetPadding( Padding( buttonsPageMargin, buttonsPageMargin, 0.0f, 0.0f ) ); | ||
| 298 | + | ||
| 296 | mScrollView.SetAxisAutoLock( true ); | 299 | mScrollView.SetAxisAutoLock( true ); |
| 297 | mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete ); | 300 | mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete ); |
| 298 | mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart ); | 301 | mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart ); |
| @@ -302,12 +305,36 @@ void DaliTableView::Initialize( Application& application ) | @@ -302,12 +305,36 @@ void DaliTableView::Initialize( Application& application ) | ||
| 302 | mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER ); | 305 | mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER ); |
| 303 | mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER ); | 306 | mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER ); |
| 304 | mScrollViewLayer.SetDrawMode( DrawMode::OVERLAY ); | 307 | mScrollViewLayer.SetDrawMode( DrawMode::OVERLAY ); |
| 308 | + mScrollViewLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 309 | + | ||
| 310 | + // Create solid background colour. | ||
| 311 | + ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR ); | ||
| 312 | + backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 313 | + backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 314 | + backgroundColourActor.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 315 | + backgroundColourActor.SetSizeModeFactor( Vector3( 1.0f, 1.5f, 1.0f ) ); | ||
| 316 | + backgroundColourActor.SetZ( BACKGROUND_Z ); | ||
| 317 | + mScrollViewLayer.Add( backgroundColourActor ); | ||
| 305 | 318 | ||
| 306 | // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show | 319 | // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show |
| 307 | - SetupBackground( mScrollView, mScrollViewLayer, stageSize ); | 320 | + Actor bubbleContainer = Actor::New(); |
| 321 | + bubbleContainer.SetRelayoutEnabled( true ); | ||
| 322 | + bubbleContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 323 | + bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 324 | + bubbleContainer.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 325 | + mScrollViewLayer.Add( bubbleContainer ); | ||
| 326 | + | ||
| 327 | + SetupBackground( bubbleContainer ); | ||
| 328 | + | ||
| 329 | + Alignment buttonsAlignment = Alignment::New(); | ||
| 330 | + buttonsAlignment.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 331 | + buttonsAlignment.Add( mScrollViewLayer ); | ||
| 308 | 332 | ||
| 309 | mScrollViewLayer.Add( mScrollView ); | 333 | mScrollViewLayer.Add( mScrollView ); |
| 310 | - mRootActor.AddChild( mScrollViewLayer, TableView::CellPosition( 2, 0 ) ); | 334 | + |
| 335 | + mRootActor.AddChild( buttonsAlignment, TableView::CellPosition( 2, 0 ) ); | ||
| 336 | + | ||
| 337 | + mRootActor.SetFixedHeight( 3, bottomMargin ); | ||
| 311 | 338 | ||
| 312 | // Add scroll view effect and setup constraints on pages | 339 | // Add scroll view effect and setup constraints on pages |
| 313 | ApplyScrollViewEffect(); | 340 | ApplyScrollViewEffect(); |
| @@ -333,7 +360,7 @@ void DaliTableView::Initialize( Application& application ) | @@ -333,7 +360,7 @@ void DaliTableView::Initialize( Application& application ) | ||
| 333 | 360 | ||
| 334 | winHandle.ShowIndicator( Dali::Window::INVISIBLE ); | 361 | winHandle.ShowIndicator( Dali::Window::INVISIBLE ); |
| 335 | 362 | ||
| 336 | - // | 363 | + // Background animation |
| 337 | mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION ); | 364 | mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION ); |
| 338 | mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation ); | 365 | mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation ); |
| 339 | mAnimationTimer.Start(); | 366 | mAnimationTimer.Start(); |
| @@ -349,12 +376,10 @@ void DaliTableView::ApplyCubeEffectToActors() | @@ -349,12 +376,10 @@ void DaliTableView::ApplyCubeEffectToActors() | ||
| 349 | { | 376 | { |
| 350 | Actor page = *pageIter; | 377 | Actor page = *pageIter; |
| 351 | 378 | ||
| 352 | - unsigned int numChildren = page.GetChildCount(); | ||
| 353 | - Actor pageActor = page; | ||
| 354 | - for( unsigned int i=0; i<numChildren; ++i) | 379 | + for( unsigned int i = 0, numChildren = page.GetChildCount(); i < numChildren; ++i) |
| 355 | { | 380 | { |
| 356 | // Remove old effect's manual constraints. | 381 | // Remove old effect's manual constraints. |
| 357 | - Actor child = pageActor.GetChildAt(i); | 382 | + Actor child = page.GetChildAt(i); |
| 358 | if( child ) | 383 | if( child ) |
| 359 | { | 384 | { |
| 360 | ApplyCubeEffectToActor( child ); | 385 | ApplyCubeEffectToActor( child ); |
| @@ -362,6 +387,12 @@ void DaliTableView::ApplyCubeEffectToActors() | @@ -362,6 +387,12 @@ void DaliTableView::ApplyCubeEffectToActors() | ||
| 362 | } | 387 | } |
| 363 | } | 388 | } |
| 364 | } | 389 | } |
| 390 | + | ||
| 391 | +void DaliTableView::OnButtonsPageRelayout( const Dali::Actor& actor ) | ||
| 392 | +{ | ||
| 393 | + | ||
| 394 | +} | ||
| 395 | + | ||
| 365 | void DaliTableView::Populate() | 396 | void DaliTableView::Populate() |
| 366 | { | 397 | { |
| 367 | const Vector2 stageSize = Stage::GetCurrent().GetSize(); | 398 | const Vector2 stageSize = Stage::GetCurrent().GetSize(); |
| @@ -382,20 +413,15 @@ void DaliTableView::Populate() | @@ -382,20 +413,15 @@ void DaliTableView::Populate() | ||
| 382 | for( int t = 0; t < mTotalPages; t++ ) | 413 | for( int t = 0; t < mTotalPages; t++ ) |
| 383 | { | 414 | { |
| 384 | // Create Table. (contains up to 9 Examples) | 415 | // Create Table. (contains up to 9 Examples) |
| 385 | - Actor page = Actor::New(); | ||
| 386 | - | ||
| 387 | - // Add tableView to container. | ||
| 388 | - mScrollView.Add( page ); | ||
| 389 | - | 416 | + TableView page = TableView::New( 3, 3 ); |
| 390 | page.SetAnchorPoint( AnchorPoint::CENTER ); | 417 | page.SetAnchorPoint( AnchorPoint::CENTER ); |
| 391 | page.SetParentOrigin( ParentOrigin::CENTER ); | 418 | page.SetParentOrigin( ParentOrigin::CENTER ); |
| 392 | - page.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | ||
| 393 | - | ||
| 394 | - // add cells to table | ||
| 395 | - const float margin = 4.0f; | 419 | + page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 420 | + mScrollView.Add( page ); | ||
| 396 | 421 | ||
| 397 | // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi. | 422 | // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi. |
| 398 | - const Size tileSize((stageSize.x * mButtonsPageRelativeSize.x / EXAMPLES_PER_ROW) - margin, (stageSize.y * mButtonsPageRelativeSize.y / ROWS_PER_PAGE) - margin ); | 423 | + const float margin = 2.0f; |
| 424 | + const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW; | ||
| 399 | 425 | ||
| 400 | for(int row = 0; row < ROWS_PER_PAGE; row++) | 426 | for(int row = 0; row < ROWS_PER_PAGE; row++) |
| 401 | { | 427 | { |
| @@ -403,7 +429,7 @@ void DaliTableView::Populate() | @@ -403,7 +429,7 @@ void DaliTableView::Populate() | ||
| 403 | { | 429 | { |
| 404 | const Example& example = ( *iter ); | 430 | const Example& example = ( *iter ); |
| 405 | 431 | ||
| 406 | - Actor tile = CreateTile( example.name, example.title, tileSize, true ); | 432 | + Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), true ); |
| 407 | FocusManager focusManager = FocusManager::Get(); | 433 | FocusManager focusManager = FocusManager::Get(); |
| 408 | focusManager.SetFocusOrder( tile, ++exampleCount ); | 434 | focusManager.SetFocusOrder( tile, ++exampleCount ); |
| 409 | focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL, | 435 | focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL, |
| @@ -412,12 +438,9 @@ void DaliTableView::Populate() | @@ -412,12 +438,9 @@ void DaliTableView::Populate() | ||
| 412 | focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT, | 438 | focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT, |
| 413 | "You can run this example" ); | 439 | "You can run this example" ); |
| 414 | 440 | ||
| 415 | - Vector3 position( margin * 0.5f + (tileSize.x + margin) * column - stageSize.width * mButtonsPageRelativeSize.x * 0.5f, | ||
| 416 | - margin * 0.5f + (tileSize.y + margin) * row - stageSize.height * mButtonsPageRelativeSize.y * 0.5f, | ||
| 417 | - 0.0f); | ||
| 418 | - tile.SetPosition( position + Vector3( tileSize.x, tileSize.y, 0.0f ) * 0.5f ); | ||
| 419 | - tile.SetSize( tileSize ); | ||
| 420 | - page.Add( tile ); | 441 | + tile.SetPadding( Padding( margin, margin, margin, margin ) ); |
| 442 | + | ||
| 443 | + page.AddChild( tile, TableView::CellPosition( row, column ) ); | ||
| 421 | 444 | ||
| 422 | iter++; | 445 | iter++; |
| 423 | 446 | ||
| @@ -434,7 +457,7 @@ void DaliTableView::Populate() | @@ -434,7 +457,7 @@ void DaliTableView::Populate() | ||
| 434 | } | 457 | } |
| 435 | 458 | ||
| 436 | // Set tableview position | 459 | // Set tableview position |
| 437 | - Vector3 pagePos( stageSize.x * mButtonsPageRelativeSize.x * t, 0.0f, 0.0f ); | 460 | + Vector3 pagePos( stageSize.width * TABLE_RELATIVE_SIZE.x * t, 0.0f, 0.0f ); |
| 438 | page.SetPosition( pagePos ); | 461 | page.SetPosition( pagePos ); |
| 439 | 462 | ||
| 440 | mPages.push_back( page ); | 463 | mPages.push_back( page ); |
| @@ -447,9 +470,9 @@ void DaliTableView::Populate() | @@ -447,9 +470,9 @@ void DaliTableView::Populate() | ||
| 447 | } | 470 | } |
| 448 | 471 | ||
| 449 | // Update Ruler info. | 472 | // Update Ruler info. |
| 450 | - mScrollRulerX = new FixedRuler( stageSize.width * mButtonsPageRelativeSize.x ); | 473 | + mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x ); |
| 451 | mScrollRulerY = new DefaultRuler(); | 474 | mScrollRulerY = new DefaultRuler(); |
| 452 | - mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * mButtonsPageRelativeSize.x, true ) ); | 475 | + mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * TABLE_RELATIVE_SIZE.x, true ) ); |
| 453 | mScrollRulerY->Disable(); | 476 | mScrollRulerY->Disable(); |
| 454 | mScrollView.SetRulerX( mScrollRulerX ); | 477 | mScrollView.SetRulerX( mScrollRulerX ); |
| 455 | mScrollView.SetRulerY( mScrollRulerY ); | 478 | mScrollView.SetRulerY( mScrollRulerY ); |
| @@ -478,17 +501,20 @@ void DaliTableView::Rotate( unsigned int degrees ) | @@ -478,17 +501,20 @@ void DaliTableView::Rotate( unsigned int degrees ) | ||
| 478 | } | 501 | } |
| 479 | 502 | ||
| 480 | mRotateAnimation = Animation::New( ROTATE_ANIMATION_TIME ); | 503 | mRotateAnimation = Animation::New( ROTATE_ANIMATION_TIME ); |
| 481 | - mRotateAnimation.RotateTo( mRootActor, Degree( 360 - degrees ), Vector3::ZAXIS, AlphaFunctions::EaseOut ); | ||
| 482 | - mRotateAnimation.Resize( mRootActor, targetSize, AlphaFunctions::EaseOut ); | 504 | + mRotateAnimation.AnimateTo( Property( mRootActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 - degrees ) ), Vector3::ZAXIS ), AlphaFunctions::EaseOut ); |
| 505 | + mRotateAnimation.AnimateTo( Property( mRootActor, Actor::Property::SIZE ), targetSize, AlphaFunctions::EaseOut ); | ||
| 483 | mRotateAnimation.Play(); | 506 | mRotateAnimation.Play(); |
| 484 | } | 507 | } |
| 485 | 508 | ||
| 486 | -Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Size& parentSize, bool addBackground ) | 509 | +Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground ) |
| 487 | { | 510 | { |
| 488 | - Actor tile = Actor::New(); | ||
| 489 | - tile.SetName( name ); | ||
| 490 | - tile.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 491 | - tile.SetParentOrigin( ParentOrigin::CENTER ); | 511 | + Actor content = Actor::New(); |
| 512 | + content.SetName( name ); | ||
| 513 | + content.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 514 | + content.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 515 | + content.SetRelayoutEnabled( true ); | ||
| 516 | + content.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 517 | + content.SetSizeModeFactor( sizeMultiplier ); | ||
| 492 | 518 | ||
| 493 | // create background image | 519 | // create background image |
| 494 | if( addBackground ) | 520 | if( addBackground ) |
| @@ -498,16 +524,17 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | @@ -498,16 +524,17 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | ||
| 498 | image.SetAnchorPoint( AnchorPoint::CENTER ); | 524 | image.SetAnchorPoint( AnchorPoint::CENTER ); |
| 499 | image.SetParentOrigin( ParentOrigin::CENTER ); | 525 | image.SetParentOrigin( ParentOrigin::CENTER ); |
| 500 | // make the image 100% of tile | 526 | // make the image 100% of tile |
| 501 | - image.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 527 | + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 528 | + | ||
| 502 | // move image back to get text appear in front | 529 | // move image back to get text appear in front |
| 503 | image.SetZ( -1 ); | 530 | image.SetZ( -1 ); |
| 504 | image.SetStyle( ImageActor::STYLE_NINE_PATCH ); | 531 | image.SetStyle( ImageActor::STYLE_NINE_PATCH ); |
| 505 | image.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) ); | 532 | image.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) ); |
| 506 | - tile.Add( image ); | 533 | + content.Add( image ); |
| 507 | 534 | ||
| 508 | // Add stencil | 535 | // Add stencil |
| 509 | ImageActor stencil = NewStencilImage(); | 536 | ImageActor stencil = NewStencilImage(); |
| 510 | - stencil.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 537 | + stencil.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 511 | image.Add( stencil ); | 538 | image.Add( stencil ); |
| 512 | } | 539 | } |
| 513 | 540 | ||
| @@ -518,22 +545,22 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | @@ -518,22 +545,22 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | ||
| 518 | text.SetMultilinePolicy( Toolkit::TextView::SplitByWord ); | 545 | text.SetMultilinePolicy( Toolkit::TextView::SplitByWord ); |
| 519 | text.SetLineJustification( Toolkit::TextView::Center ); | 546 | text.SetLineJustification( Toolkit::TextView::Center ); |
| 520 | text.SetTextAlignment( Toolkit::Alignment::Type( Alignment::HorizontalCenter | Alignment::VerticalCenter ) ); | 547 | text.SetTextAlignment( Toolkit::Alignment::Type( Alignment::HorizontalCenter | Alignment::VerticalCenter ) ); |
| 521 | - text.SetColor( Color::WHITE ); | ||
| 522 | text.SetZ( 1 ); | 548 | text.SetZ( 1 ); |
| 523 | // make the text 90% of tile | 549 | // make the text 90% of tile |
| 524 | - text.SetSize( 0.9f * parentSize.width, 0.9f * parentSize.height ); | 550 | + text.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); |
| 551 | + text.SetSizeModeFactor( Vector3( 0.9f, 0.9f, 0.0f ) ); | ||
| 525 | text.SetStyleToCurrentText( GetTableTextStyle() ); | 552 | text.SetStyleToCurrentText( GetTableTextStyle() ); |
| 526 | text.SetSnapshotModeEnabled( false ); | 553 | text.SetSnapshotModeEnabled( false ); |
| 527 | - tile.Add( text ); | 554 | + content.Add( text ); |
| 528 | 555 | ||
| 529 | // Set the tile to be keyboard focusable | 556 | // Set the tile to be keyboard focusable |
| 530 | - tile.SetKeyboardFocusable(true); | 557 | + content.SetKeyboardFocusable(true); |
| 531 | 558 | ||
| 532 | // connect to the touch events | 559 | // connect to the touch events |
| 533 | - tile.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed ); | ||
| 534 | - tile.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered ); | 560 | + content.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed ); |
| 561 | + content.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered ); | ||
| 535 | 562 | ||
| 536 | - return tile; | 563 | + return content; |
| 537 | } | 564 | } |
| 538 | 565 | ||
| 539 | ImageActor DaliTableView::NewStencilImage() | 566 | ImageActor DaliTableView::NewStencilImage() |
| @@ -592,10 +619,10 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event ) | @@ -592,10 +619,10 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event ) | ||
| 592 | 619 | ||
| 593 | // scale the content actor within the Tile, as to not affect the placement within the Table. | 620 | // scale the content actor within the Tile, as to not affect the placement within the Table. |
| 594 | Actor content = actor.GetChildAt(0); | 621 | Actor content = actor.GetChildAt(0); |
| 595 | - mPressedAnimation.ScaleTo( content, Vector3( 0.9f, 0.9f, 1.0f ), AlphaFunctions::EaseInOut, 0.0f, | ||
| 596 | - BUTTON_PRESS_ANIMATION_TIME * 0.5f ); | ||
| 597 | - mPressedAnimation.ScaleTo( content, Vector3::ONE, AlphaFunctions::EaseInOut, BUTTON_PRESS_ANIMATION_TIME * 0.5f, | ||
| 598 | - BUTTON_PRESS_ANIMATION_TIME * 0.5f ); | 622 | + mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3( 0.9f, 0.9f, 1.0f ), AlphaFunctions::EaseInOut, |
| 623 | + TimePeriod( 0.0f, BUTTON_PRESS_ANIMATION_TIME * 0.5f ) ); | ||
| 624 | + mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3::ONE, AlphaFunctions::EaseInOut, | ||
| 625 | + TimePeriod( BUTTON_PRESS_ANIMATION_TIME * 0.5f, BUTTON_PRESS_ANIMATION_TIME * 0.5f ) ); | ||
| 599 | mPressedAnimation.Play(); | 626 | mPressedAnimation.Play(); |
| 600 | mPressedAnimation.FinishedSignal().Connect( this, &DaliTableView::OnPressedAnimationFinished ); | 627 | mPressedAnimation.FinishedSignal().Connect( this, &DaliTableView::OnPressedAnimationFinished ); |
| 601 | } | 628 | } |
| @@ -654,8 +681,6 @@ void DaliTableView::OnScrollComplete( const Dali::Vector3& position ) | @@ -654,8 +681,6 @@ void DaliTableView::OnScrollComplete( const Dali::Vector3& position ) | ||
| 654 | // move focus to 1st item of new page | 681 | // move focus to 1st item of new page |
| 655 | FocusManager focusManager = FocusManager::Get(); | 682 | FocusManager focusManager = FocusManager::Get(); |
| 656 | focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) ); | 683 | focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) ); |
| 657 | - | ||
| 658 | - ApplyCubeEffectToActors(); | ||
| 659 | } | 684 | } |
| 660 | 685 | ||
| 661 | bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event ) | 686 | bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event ) |
| @@ -721,37 +746,65 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event ) | @@ -721,37 +746,65 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event ) | ||
| 721 | } | 746 | } |
| 722 | } | 747 | } |
| 723 | 748 | ||
| 724 | -void DaliTableView::SetupBackground( Actor bubbleContainer, Actor backgroundLayer, const Vector2& size ) | 749 | +void DaliTableView::SetupBackground( Actor bubbleContainer ) |
| 725 | { | 750 | { |
| 726 | // Create distance field shape. | 751 | // Create distance field shape. |
| 727 | BufferImage distanceField; | 752 | BufferImage distanceField; |
| 728 | Size imageSize( 512, 512 ); | 753 | Size imageSize( 512, 512 ); |
| 729 | CreateShapeImage( CIRCLE, imageSize, distanceField ); | 754 | CreateShapeImage( CIRCLE, imageSize, distanceField ); |
| 730 | 755 | ||
| 731 | - // Create solid background colour. | ||
| 732 | - ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR ); | ||
| 733 | - backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 734 | - backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 735 | - backgroundColourActor.SetSize( size * BACKGROUND_SIZE_SCALE ); | ||
| 736 | - backgroundColourActor.SetZ( BACKGROUND_Z ); | ||
| 737 | - backgroundColourActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION ); | ||
| 738 | - backgroundLayer.Add( backgroundColourActor ); | ||
| 739 | - | ||
| 740 | // Add bubbles to the bubbleContainer. | 756 | // Add bubbles to the bubbleContainer. |
| 741 | // Note: The bubbleContainer is parented externally to this function. | 757 | // Note: The bubbleContainer is parented externally to this function. |
| 742 | - AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField, size ); | 758 | + AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField ); |
| 743 | } | 759 | } |
| 744 | 760 | ||
| 745 | -void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField, const Dali::Vector2& size ) | 761 | +void DaliTableView::InitialiseBackgroundActors( Actor actor ) |
| 762 | +{ | ||
| 763 | + // Delete current animations | ||
| 764 | + mBackgroundAnimations.clear(); | ||
| 765 | + | ||
| 766 | + // Create new animations | ||
| 767 | + const Vector3 size = actor.GetTargetSize(); | ||
| 768 | + | ||
| 769 | + for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i ) | ||
| 770 | + { | ||
| 771 | + Actor child = actor.GetChildAt( i ); | ||
| 772 | + | ||
| 773 | + const Vector3 childSize = child.GetTargetSize(); | ||
| 774 | + | ||
| 775 | + // Calculate a random position | ||
| 776 | + Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ), | ||
| 777 | + Random::Range( -size.y * 0.5f - childSize.height, size.y * 0.5f + childSize.height ), | ||
| 778 | + Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) ); | ||
| 779 | + | ||
| 780 | + child.SetPosition( childPos ); | ||
| 781 | + | ||
| 782 | + // Define bubble horizontal parallax and vertical wrapping | ||
| 783 | + Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::POSITION, | ||
| 784 | + Source( mScrollView, ScrollView::Property::SCROLL_POSITION ), | ||
| 785 | + Dali::ParentSource( Dali::Actor::Property::SIZE ), | ||
| 786 | + AnimateBubbleConstraint( childPos, Random::Range( -0.85f, 0.25f ), childSize.height ) ); | ||
| 787 | + child.ApplyConstraint( animConstraint ); | ||
| 788 | + | ||
| 789 | + // Kickoff animation | ||
| 790 | + Animation animation = Animation::New( Random::Range( 40.0f, 80.0f ) ); | ||
| 791 | + animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -1.0f, 0.0f ), AlphaFunctions::Linear ); | ||
| 792 | + animation.SetLooping( true ); | ||
| 793 | + animation.Play(); | ||
| 794 | + mBackgroundAnimations.push_back( animation ); | ||
| 795 | + } | ||
| 796 | +} | ||
| 797 | + | ||
| 798 | +void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField ) | ||
| 746 | { | 799 | { |
| 747 | for( int i = 0; i < count; ++i ) | 800 | for( int i = 0; i < count; ++i ) |
| 748 | { | 801 | { |
| 749 | float randSize = Random::Range( 10.0f, 400.0f ); | 802 | float randSize = Random::Range( 10.0f, 400.0f ); |
| 750 | float hue = Random::Range( 0.3f, 1.0f ); | 803 | float hue = Random::Range( 0.3f, 1.0f ); |
| 751 | - Vector4 randColour( hue, hue*0.5, 0.0f, Random::Range( 0.3f, 0.6f )); | 804 | + Vector4 randColour( hue, hue * 0.5, 0.0f, Random::Range( 0.3f, 0.6f )); |
| 752 | 805 | ||
| 753 | ImageActor dfActor = ImageActor::New( distanceField ); | 806 | ImageActor dfActor = ImageActor::New( distanceField ); |
| 754 | - mBackgroundActors.push_back( dfActor ); | 807 | + dfActor.SetRelayoutEnabled( false ); |
| 755 | dfActor.SetSize( Vector2( randSize, randSize ) ); | 808 | dfActor.SetSize( Vector2( randSize, randSize ) ); |
| 756 | dfActor.SetParentOrigin( ParentOrigin::CENTER ); | 809 | dfActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 757 | 810 | ||
| @@ -761,33 +814,10 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis | @@ -761,33 +814,10 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis | ||
| 761 | effect.SetOutlineParams( Vector2( 0.55f, 0.00f ) ); | 814 | effect.SetOutlineParams( Vector2( 0.55f, 0.00f ) ); |
| 762 | effect.SetSmoothingEdge( 0.5f ); | 815 | effect.SetSmoothingEdge( 0.5f ); |
| 763 | layer.Add( dfActor ); | 816 | layer.Add( dfActor ); |
| 764 | - | ||
| 765 | - // Setup animation | ||
| 766 | - Vector3 actorPos( | ||
| 767 | - Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ), | ||
| 768 | - Random::Range( -size.y * 0.5f - randSize, size.y * 0.5f + randSize ), | ||
| 769 | - Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) ); | ||
| 770 | - dfActor.SetPosition( actorPos ); | ||
| 771 | - | ||
| 772 | - // Define bubble horizontal parallax and vertical wrapping | ||
| 773 | - Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::POSITION, | ||
| 774 | - Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), | ||
| 775 | - Dali::ParentSource( Dali::Actor::Property::SIZE ), | ||
| 776 | - AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.25f ), randSize ) ); | ||
| 777 | - dfActor.ApplyConstraint( animConstraint ); | ||
| 778 | - | ||
| 779 | - // Kickoff animation | ||
| 780 | - Animation animation = Animation::New( Random::Range( 40.0f, 200.0f ) ); | ||
| 781 | - KeyFrames keyframes = KeyFrames::New(); | ||
| 782 | - keyframes.Add( 0.0f, actorPos ); | ||
| 783 | - Vector3 toPos( actorPos ); | ||
| 784 | - toPos.y -= ( size.y + randSize ); | ||
| 785 | - keyframes.Add( 1.0f, toPos ); | ||
| 786 | - animation.AnimateBetween( Property( dfActor, Actor::Property::POSITION ), keyframes ); | ||
| 787 | - animation.SetLooping( true ); | ||
| 788 | - animation.Play(); | ||
| 789 | - mBackgroundAnimations.push_back( animation ); | ||
| 790 | } | 817 | } |
| 818 | + | ||
| 819 | + // Positioning will occur when the layer is relaid out | ||
| 820 | + layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors ); | ||
| 791 | } | 821 | } |
| 792 | 822 | ||
| 793 | void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut ) | 823 | void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut ) |
| @@ -860,7 +890,7 @@ ImageActor DaliTableView::CreateLogo( std::string imagePath ) | @@ -860,7 +890,7 @@ ImageActor DaliTableView::CreateLogo( std::string imagePath ) | ||
| 860 | ImageActor logo = ImageActor::New( image ); | 890 | ImageActor logo = ImageActor::New( image ); |
| 861 | 891 | ||
| 862 | logo.SetAnchorPoint( AnchorPoint::CENTER ); | 892 | logo.SetAnchorPoint( AnchorPoint::CENTER ); |
| 863 | - logo.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | 893 | + logo.SetParentOrigin( ParentOrigin::CENTER ); |
| 864 | 894 | ||
| 865 | return logo; | 895 | return logo; |
| 866 | } | 896 | } |
| @@ -994,14 +1024,17 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap | @@ -994,14 +1024,17 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap | ||
| 994 | stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")"; | 1024 | stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")"; |
| 995 | 1025 | ||
| 996 | mVersionPopup = Dali::Toolkit::Popup::New(); | 1026 | mVersionPopup = Dali::Toolkit::Popup::New(); |
| 997 | - mVersionPopup.SetTitle( stream.str() ); | ||
| 998 | mVersionPopup.SetParentOrigin( ParentOrigin::CENTER ); | 1027 | mVersionPopup.SetParentOrigin( ParentOrigin::CENTER ); |
| 999 | mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER ); | 1028 | mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER ); |
| 1029 | + mVersionPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, WIDTH ); | ||
| 1030 | + mVersionPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) ); | ||
| 1031 | + mVersionPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); | ||
| 1032 | + mVersionPopup.SetTitle( stream.str() ); | ||
| 1000 | mVersionPopup.HideTail(); | 1033 | mVersionPopup.HideTail(); |
| 1001 | mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup ); | 1034 | mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup ); |
| 1002 | mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden ); | 1035 | mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden ); |
| 1003 | 1036 | ||
| 1004 | - Dali::Stage::GetCurrent().Add( mVersionPopup ); | 1037 | + mVersionPopup.MarkDirtyForRelayout(); |
| 1005 | } | 1038 | } |
| 1006 | 1039 | ||
| 1007 | mVersionPopup.Show(); | 1040 | mVersionPopup.Show(); |
demo/dali-table-view.h
| @@ -165,7 +165,7 @@ private: // Application callbacks & implementation | @@ -165,7 +165,7 @@ private: // Application callbacks & implementation | ||
| 165 | * | 165 | * |
| 166 | * @return The Actor for the created tile. | 166 | * @return The Actor for the created tile. |
| 167 | */ | 167 | */ |
| 168 | - Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Size& parentSize, bool addBackground ); | 168 | + Dali::Actor CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground ); |
| 169 | 169 | ||
| 170 | /** | 170 | /** |
| 171 | * Create a stencil image | 171 | * Create a stencil image |
| @@ -276,9 +276,8 @@ private: // Application callbacks & implementation | @@ -276,9 +276,8 @@ private: // Application callbacks & implementation | ||
| 276 | * Create a depth field background | 276 | * Create a depth field background |
| 277 | * | 277 | * |
| 278 | * @param[in] bubbleLayer Add the graphics to this layer | 278 | * @param[in] bubbleLayer Add the graphics to this layer |
| 279 | - * @param[in] backgroundLayer Add the background to this layer | ||
| 280 | */ | 279 | */ |
| 281 | - void SetupBackground( Dali::Actor bubbleLayer, Dali::Actor backgroundLayer, const Dali::Vector2& size ); | 280 | + void SetupBackground( Dali::Actor bubbleLayer ); |
| 282 | 281 | ||
| 283 | /** | 282 | /** |
| 284 | * Create background actors for the given layer | 283 | * Create background actors for the given layer |
| @@ -286,9 +285,8 @@ private: // Application callbacks & implementation | @@ -286,9 +285,8 @@ private: // Application callbacks & implementation | ||
| 286 | * @param[in] layer The layer to add the actors to | 285 | * @param[in] layer The layer to add the actors to |
| 287 | * @param[in] count The number of actors to generate | 286 | * @param[in] count The number of actors to generate |
| 288 | * @param[in] distanceField The distance field bitmap to use | 287 | * @param[in] distanceField The distance field bitmap to use |
| 289 | - * @param[in] size The size of the actor | ||
| 290 | */ | 288 | */ |
| 291 | - void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage distanceField, const Dali::Vector2& size ); | 289 | + void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage distanceField ); |
| 292 | 290 | ||
| 293 | /** | 291 | /** |
| 294 | * Create a bitmap with the specified shape and also output a distance field | 292 | * Create a bitmap with the specified shape and also output a distance field |
| @@ -378,6 +376,20 @@ private: // Application callbacks & implementation | @@ -378,6 +376,20 @@ private: // Application callbacks & implementation | ||
| 378 | */ | 376 | */ |
| 379 | void PopupHidden(); | 377 | void PopupHidden(); |
| 380 | 378 | ||
| 379 | + /* | ||
| 380 | + * @brief Callback called when the buttons page actor is relaid out | ||
| 381 | + * | ||
| 382 | + * @param[in] actor The page actor | ||
| 383 | + */ | ||
| 384 | + void OnButtonsPageRelayout( const Dali::Actor& actor ); | ||
| 385 | + | ||
| 386 | + /** | ||
| 387 | + * @brief Callback called to set up background actors | ||
| 388 | + * | ||
| 389 | + * @param[in] actor The actor raising the callback | ||
| 390 | + */ | ||
| 391 | + void InitialiseBackgroundActors( Dali::Actor actor ); | ||
| 392 | + | ||
| 381 | private: | 393 | private: |
| 382 | 394 | ||
| 383 | Dali::Application& mApplication; ///< Application instance. | 395 | Dali::Application& mApplication; ///< Application instance. |
| @@ -385,7 +397,6 @@ private: | @@ -385,7 +397,6 @@ private: | ||
| 385 | Dali::Toolkit::TableView mRootActor; ///< All content (excluding background is anchored to this Actor) | 397 | Dali::Toolkit::TableView mRootActor; ///< All content (excluding background is anchored to this Actor) |
| 386 | Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor. | 398 | Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor. |
| 387 | Dali::ImageActor mBackground; ///< Background's static image. | 399 | Dali::ImageActor mBackground; ///< Background's static image. |
| 388 | - Dali::ImageActor mLogo; ///< Logo's static image. | ||
| 389 | Dali::Animation mPressedAnimation; ///< Button press scaling animation. | 400 | Dali::Animation mPressedAnimation; ///< Button press scaling animation. |
| 390 | Dali::Layer mScrollViewLayer; ///< ScrollView resides on a separate layer. | 401 | Dali::Layer mScrollViewLayer; ///< ScrollView resides on a separate layer. |
| 391 | Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples) | 402 | Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples) |
| @@ -413,6 +424,7 @@ private: | @@ -413,6 +424,7 @@ private: | ||
| 413 | bool mSortAlphabetically:1; ///< Sort examples alphabetically. | 424 | bool mSortAlphabetically:1; ///< Sort examples alphabetically. |
| 414 | bool mBackgroundAnimsPlaying:1; ///< Are background animations playing | 425 | bool mBackgroundAnimsPlaying:1; ///< Are background animations playing |
| 415 | bool mVersionPopupShown:1; ///< Whehter the version popup is shown or not | 426 | bool mVersionPopupShown:1; ///< Whehter the version popup is shown or not |
| 427 | + | ||
| 416 | }; | 428 | }; |
| 417 | 429 | ||
| 418 | #endif // __DALI_DEMO_H__ | 430 | #endif // __DALI_DEMO_H__ |
examples/animated-shapes/animated-shapes-example.cpp
| @@ -52,6 +52,7 @@ public: | @@ -52,6 +52,7 @@ public: | ||
| 52 | 52 | ||
| 53 | //Create a view | 53 | //Create a view |
| 54 | mView = Dali::Toolkit::View::New(); | 54 | mView = Dali::Toolkit::View::New(); |
| 55 | + mView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 55 | stage.Add( mView ); | 56 | stage.Add( mView ); |
| 56 | 57 | ||
| 57 | //Set background image for the view | 58 | //Set background image for the view |
| @@ -161,7 +162,7 @@ public: | @@ -161,7 +162,7 @@ public: | ||
| 161 | k0.Add( 1.0f, Vector3( -radius, 0.0f, 0.0f) ); | 162 | k0.Add( 1.0f, Vector3( -radius, 0.0f, 0.0f) ); |
| 162 | animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunctions::EaseInOutSine ); | 163 | animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunctions::EaseInOutSine ); |
| 163 | 164 | ||
| 164 | - animation.RotateBy(meshActor,Degree(90.0f), Vector3::ZAXIS ); | 165 | + animation.AnimateBy( Property( meshActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(90.0f) ), Vector3::ZAXIS ) ); |
| 165 | animation.SetLooping( true ); | 166 | animation.SetLooping( true ); |
| 166 | animation.Play(); | 167 | animation.Play(); |
| 167 | } | 168 | } |
| @@ -342,7 +343,7 @@ public: | @@ -342,7 +343,7 @@ public: | ||
| 342 | k0.Add( 1.0f, Vector3( -radius*2.0, 0.0f, 0.0f) ); | 343 | k0.Add( 1.0f, Vector3( -radius*2.0, 0.0f, 0.0f) ); |
| 343 | animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunctions::EaseInOutSine ); | 344 | animation.AnimateBetween( Property(shader, shader.GetPointPropertyName(10)),k0,AlphaFunctions::EaseInOutSine ); |
| 344 | 345 | ||
| 345 | - animation.RotateBy(meshActor,Degree(-90.0f), Vector3::ZAXIS ); | 346 | + animation.AnimateBy( Property( meshActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(-90.0f) ), Vector3::ZAXIS ) ); |
| 346 | animation.SetLooping( true ); | 347 | animation.SetLooping( true ); |
| 347 | animation.Play(); | 348 | animation.Play(); |
| 348 | } | 349 | } |
examples/blocks/blocks-example.cpp
| @@ -421,7 +421,8 @@ private: | @@ -421,7 +421,8 @@ private: | ||
| 421 | mLevelContainer = Actor::New(); | 421 | mLevelContainer = Actor::New(); |
| 422 | mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER ); | 422 | mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER ); |
| 423 | mLevelContainer.SetParentOrigin( ParentOrigin::CENTER ); | 423 | mLevelContainer.SetParentOrigin( ParentOrigin::CENTER ); |
| 424 | - mLevelContainer.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 424 | + mLevelContainer.SetRelayoutEnabled( true ); |
| 425 | + mLevelContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 425 | mContentLayer.Add( mLevelContainer ); | 426 | mContentLayer.Add( mLevelContainer ); |
| 426 | 427 | ||
| 427 | mBrickCount = 0; | 428 | mBrickCount = 0; |
| @@ -593,6 +594,7 @@ private: | @@ -593,6 +594,7 @@ private: | ||
| 593 | ImageActor brick = ImageActor::New(img); | 594 | ImageActor brick = ImageActor::New(img); |
| 594 | brick.SetParentOrigin(ParentOrigin::TOP_LEFT); | 595 | brick.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| 595 | brick.SetAnchorPoint(AnchorPoint::CENTER); | 596 | brick.SetAnchorPoint(AnchorPoint::CENTER); |
| 597 | + brick.SetRelayoutEnabled( false ); | ||
| 596 | brick.SetSize( brickSize ); | 598 | brick.SetSize( brickSize ); |
| 597 | brick.SetPosition( Vector3( position ) ); | 599 | brick.SetPosition( Vector3( position ) ); |
| 598 | 600 | ||
| @@ -625,6 +627,7 @@ private: | @@ -625,6 +627,7 @@ private: | ||
| 625 | ImageActor actor = ImageActor::New(img); | 627 | ImageActor actor = ImageActor::New(img); |
| 626 | actor.SetParentOrigin(ParentOrigin::TOP_LEFT); | 628 | actor.SetParentOrigin(ParentOrigin::TOP_LEFT); |
| 627 | actor.SetAnchorPoint(AnchorPoint::CENTER); | 629 | actor.SetAnchorPoint(AnchorPoint::CENTER); |
| 630 | + actor.SetRelayoutEnabled( false ); | ||
| 628 | return actor; | 631 | return actor; |
| 629 | } | 632 | } |
| 630 | 633 |
examples/builder/examples.cpp
| @@ -290,6 +290,7 @@ public: | @@ -290,6 +290,7 @@ public: | ||
| 290 | mFiles.clear(); | 290 | mFiles.clear(); |
| 291 | 291 | ||
| 292 | mItemView = ItemView::New(*this); | 292 | mItemView = ItemView::New(*this); |
| 293 | + mItemView.SetRelayoutEnabled( false ); | ||
| 293 | stage.Add( mItemView ); | 294 | stage.Add( mItemView ); |
| 294 | mItemView.SetParentOrigin(ParentOrigin::CENTER); | 295 | mItemView.SetParentOrigin(ParentOrigin::CENTER); |
| 295 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); | 296 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); |
| @@ -396,6 +397,7 @@ public: | @@ -396,6 +397,7 @@ public: | ||
| 396 | Actor MenuItem(const std::string& text) | 397 | Actor MenuItem(const std::string& text) |
| 397 | { | 398 | { |
| 398 | TextView t = TextView::New(); | 399 | TextView t = TextView::New(); |
| 400 | + t.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 399 | t.SetMarkupProcessingEnabled(true); | 401 | t.SetMarkupProcessingEnabled(true); |
| 400 | 402 | ||
| 401 | int size = static_cast<int>(DemoHelper::ScalePointSize(6)); | 403 | int size = static_cast<int>(DemoHelper::ScalePointSize(6)); |
| @@ -480,6 +482,8 @@ public: | @@ -480,6 +482,8 @@ public: | ||
| 480 | 482 | ||
| 481 | builder.AddActors( layer ); | 483 | builder.AddActors( layer ); |
| 482 | 484 | ||
| 485 | + // Force relayout on layer | ||
| 486 | + layer.RelayoutRequestTree(); | ||
| 483 | } | 487 | } |
| 484 | 488 | ||
| 485 | 489 |
examples/buttons/buttons-example.cpp
| @@ -127,6 +127,7 @@ class ButtonsController: public ConnectionTracker | @@ -127,6 +127,7 @@ class ButtonsController: public ConnectionTracker | ||
| 127 | radioGroup2Background.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 127 | radioGroup2Background.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 128 | radioGroup2Background.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 128 | radioGroup2Background.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 129 | radioGroup2Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | 129 | radioGroup2Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); |
| 130 | + radioGroup2Background.SetRelayoutEnabled( true ); | ||
| 130 | radioGroup2Background.SetSize( DP(348), DP(GROUP2_HEIGHT) ); | 131 | radioGroup2Background.SetSize( DP(348), DP(GROUP2_HEIGHT) ); |
| 131 | mContentLayer.Add( radioGroup2Background ); | 132 | mContentLayer.Add( radioGroup2Background ); |
| 132 | 133 | ||
| @@ -134,6 +135,7 @@ class ButtonsController: public ConnectionTracker | @@ -134,6 +135,7 @@ class ButtonsController: public ConnectionTracker | ||
| 134 | radioButtonsGroup2.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 135 | radioButtonsGroup2.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 135 | radioButtonsGroup2.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 136 | radioButtonsGroup2.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 136 | radioButtonsGroup2.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); | 137 | radioButtonsGroup2.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); |
| 138 | + radioButtonsGroup2.SetRelayoutEnabled( true ); | ||
| 137 | radioButtonsGroup2.SetSize( DP(100), DP(160) ); | 139 | radioButtonsGroup2.SetSize( DP(100), DP(160) ); |
| 138 | 140 | ||
| 139 | radioGroup2Background.Add( radioButtonsGroup2 ); | 141 | radioGroup2Background.Add( radioButtonsGroup2 ); |
| @@ -188,7 +190,7 @@ class ButtonsController: public ConnectionTracker | @@ -188,7 +190,7 @@ class ButtonsController: public ConnectionTracker | ||
| 188 | mUpdateButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | 190 | mUpdateButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); |
| 189 | mUpdateButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | 191 | mUpdateButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); |
| 190 | mUpdateButton.SetPosition( 0, DP(MARGIN_SIZE) ); | 192 | mUpdateButton.SetPosition( 0, DP(MARGIN_SIZE) ); |
| 191 | - mUpdateButton.SetLabel("Select"); | 193 | + mUpdateButton.SetLabel( "Select" ); |
| 192 | mUpdateButton.SetSize( DP(100), DP(BUTTON_HEIGHT) ); | 194 | mUpdateButton.SetSize( DP(100), DP(BUTTON_HEIGHT) ); |
| 193 | 195 | ||
| 194 | mUpdateButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | 196 | mUpdateButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); |
| @@ -218,6 +220,7 @@ class ButtonsController: public ConnectionTracker | @@ -218,6 +220,7 @@ class ButtonsController: public ConnectionTracker | ||
| 218 | radioGroup1Background.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 220 | radioGroup1Background.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 219 | radioGroup1Background.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 221 | radioGroup1Background.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 220 | radioGroup1Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | 222 | radioGroup1Background.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); |
| 223 | + radioGroup1Background.SetRelayoutEnabled( true ); | ||
| 221 | radioGroup1Background.SetSize( DP(348), DP(GROUP1_HEIGHT) ); | 224 | radioGroup1Background.SetSize( DP(348), DP(GROUP1_HEIGHT) ); |
| 222 | mContentLayer.Add( radioGroup1Background ); | 225 | mContentLayer.Add( radioGroup1Background ); |
| 223 | 226 | ||
| @@ -232,17 +235,17 @@ class ButtonsController: public ConnectionTracker | @@ -232,17 +235,17 @@ class ButtonsController: public ConnectionTracker | ||
| 232 | // First radio button | 235 | // First radio button |
| 233 | { | 236 | { |
| 234 | Toolkit::TableView tableView = Toolkit::TableView::New( 1, 2 ); | 237 | Toolkit::TableView tableView = Toolkit::TableView::New( 1, 2 ); |
| 235 | - tableView.SetSize( DP(260), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); | 238 | + tableView.SetSize( DP(260), 0.0f ); |
| 239 | + tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); | ||
| 236 | 240 | ||
| 237 | Toolkit::TextView textView = Toolkit::TextView::New( "Select enabled" ); | 241 | Toolkit::TextView textView = Toolkit::TextView::New( "Select enabled" ); |
| 238 | - Toolkit::Alignment alignment = Toolkit::Alignment::New( Toolkit::Alignment::HorizontalLeft ); | ||
| 239 | - alignment.Add( textView ); | ||
| 240 | - tableView.AddChild( alignment, Toolkit::TableView::CellPosition( 0, 0 ) ); | 242 | + tableView.AddChild( textView, Toolkit::TableView::CellPosition( 0, 0 ) ); |
| 241 | 243 | ||
| 242 | ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) ); | 244 | ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) ); |
| 243 | imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); | 245 | imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); |
| 246 | + imageActor.SetResizePolicy( FIXED, ALL_DIMENSIONS ); | ||
| 247 | + imageActor.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) ); | ||
| 244 | tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) ); | 248 | tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) ); |
| 245 | - tableView.SetFixedWidth( 1, DP(RADIO_LABEL_THUMBNAIL_SIZE) ); | ||
| 246 | 249 | ||
| 247 | Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( tableView ); | 250 | Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( tableView ); |
| 248 | radioButton.SetName( "radio-select-enable" ); | 251 | radioButton.SetName( "radio-select-enable" ); |
| @@ -276,6 +279,7 @@ class ButtonsController: public ConnectionTracker | @@ -276,6 +279,7 @@ class ButtonsController: public ConnectionTracker | ||
| 276 | checkBoxBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 279 | checkBoxBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 277 | checkBoxBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 280 | checkBoxBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 278 | checkBoxBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | 281 | checkBoxBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); |
| 282 | + checkBoxBackground.SetRelayoutEnabled( true ); | ||
| 279 | checkBoxBackground.SetSize( DP(430), DP(GROUP3_HEIGHT) ); | 283 | checkBoxBackground.SetSize( DP(430), DP(GROUP3_HEIGHT) ); |
| 280 | mContentLayer.Add( checkBoxBackground ); | 284 | mContentLayer.Add( checkBoxBackground ); |
| 281 | 285 | ||
| @@ -336,6 +340,7 @@ class ButtonsController: public ConnectionTracker | @@ -336,6 +340,7 @@ class ButtonsController: public ConnectionTracker | ||
| 336 | toggleBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 340 | toggleBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 337 | toggleBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 341 | toggleBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 338 | toggleBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); | 342 | toggleBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); |
| 343 | + toggleBackground.SetRelayoutEnabled( true ); | ||
| 339 | toggleBackground.SetSize( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) ); | 344 | toggleBackground.SetSize( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) ); |
| 340 | mContentLayer.Add( toggleBackground ); | 345 | mContentLayer.Add( toggleBackground ); |
| 341 | 346 |
examples/cluster/cluster-example.cpp
| @@ -477,6 +477,7 @@ public: | @@ -477,6 +477,7 @@ public: | ||
| 477 | 477 | ||
| 478 | // create and setup the scroll view... | 478 | // create and setup the scroll view... |
| 479 | mScrollView = ScrollView::New(); | 479 | mScrollView = ScrollView::New(); |
| 480 | + mScrollView.SetRelayoutEnabled( false ); | ||
| 480 | mScrollView.SetSize(stageSize); | 481 | mScrollView.SetSize(stageSize); |
| 481 | 482 | ||
| 482 | // attach Wobble Effect to ScrollView | 483 | // attach Wobble Effect to ScrollView |
| @@ -488,7 +489,8 @@ public: | @@ -488,7 +489,8 @@ public: | ||
| 488 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); | 489 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); |
| 489 | 490 | ||
| 490 | // Scale ScrollView to fit parent (mContentLayer) | 491 | // Scale ScrollView to fit parent (mContentLayer) |
| 491 | - mScrollView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 492 | + mScrollView.SetRelayoutEnabled( true ); |
| 493 | + mScrollView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 492 | 494 | ||
| 493 | // Add the scroll view to the content layer | 495 | // Add the scroll view to the content layer |
| 494 | mContentLayer.Add(mScrollView); | 496 | mContentLayer.Add(mScrollView); |
| @@ -515,6 +517,7 @@ public: | @@ -515,6 +517,7 @@ public: | ||
| 515 | Cluster clusterActor = Cluster::New(style); | 517 | Cluster clusterActor = Cluster::New(style); |
| 516 | clusterActor.SetParentOrigin(ParentOrigin::CENTER); | 518 | clusterActor.SetParentOrigin(ParentOrigin::CENTER); |
| 517 | clusterActor.SetAnchorPoint(AnchorPoint::CENTER); | 519 | clusterActor.SetAnchorPoint(AnchorPoint::CENTER); |
| 520 | + clusterActor.SetRelayoutEnabled( false ); | ||
| 518 | 521 | ||
| 519 | Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); | 522 | Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); |
| 520 | float minStageDimension = std::min(stageSize.x, stageSize.y); | 523 | float minStageDimension = std::min(stageSize.x, stageSize.y); |
| @@ -533,6 +536,7 @@ public: | @@ -533,6 +536,7 @@ public: | ||
| 533 | backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ShrinkToFit ); | 536 | backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ShrinkToFit ); |
| 534 | Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); | 537 | Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); |
| 535 | ImageActor image = ImageActor::New(bg); | 538 | ImageActor image = ImageActor::New(bg); |
| 539 | + image.SetRelayoutEnabled( false ); | ||
| 536 | clusterActor.SetBackgroundImage(image); | 540 | clusterActor.SetBackgroundImage(image); |
| 537 | 541 | ||
| 538 | // Add actors (pictures) as the children of the cluster | 542 | // Add actors (pictures) as the children of the cluster |
| @@ -576,7 +580,7 @@ public: | @@ -576,7 +580,7 @@ public: | ||
| 576 | shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f)); | 580 | shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f)); |
| 577 | 581 | ||
| 578 | // Apply size-relative mode to auto-size the image shadow | 582 | // Apply size-relative mode to auto-size the image shadow |
| 579 | - shadowActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); | 583 | + shadowActor.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); |
| 580 | shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE ); | 584 | shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE ); |
| 581 | actor.Add( shadowActor ); | 585 | actor.Add( shadowActor ); |
| 582 | 586 | ||
| @@ -585,7 +589,7 @@ public: | @@ -585,7 +589,7 @@ public: | ||
| 585 | ImageActor imageActor = ImageActor::New( image ); | 589 | ImageActor imageActor = ImageActor::New( image ); |
| 586 | imageActor.SetParentOrigin( ParentOrigin::CENTER ); | 590 | imageActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 587 | imageActor.SetAnchorPoint( AnchorPoint::CENTER ); | 591 | imageActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 588 | - imageActor.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 592 | + imageActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 589 | actor.Add( imageActor ); | 593 | actor.Add( imageActor ); |
| 590 | 594 | ||
| 591 | // Add a border image child actor (with a fixed size offset from parent). | 595 | // Add a border image child actor (with a fixed size offset from parent). |
| @@ -595,7 +599,7 @@ public: | @@ -595,7 +599,7 @@ public: | ||
| 595 | borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); | 599 | borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); |
| 596 | borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE ); | 600 | borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE ); |
| 597 | borderActor.SetPosition( Vector3( 0.0f, 0.0f, 1.0f ) ); | 601 | borderActor.SetPosition( Vector3( 0.0f, 0.0f, 1.0f ) ); |
| 598 | - borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT ); | 602 | + borderActor.SetResizePolicy( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS ); |
| 599 | borderActor.SetSizeModeFactor( Vector3( CLUSTER_IMAGE_BORDER_INDENT - 1.0f, CLUSTER_IMAGE_BORDER_INDENT - 1.0f, 0.0f ) * 2.0f ); | 603 | borderActor.SetSizeModeFactor( Vector3( CLUSTER_IMAGE_BORDER_INDENT - 1.0f, CLUSTER_IMAGE_BORDER_INDENT - 1.0f, 0.0f ) * 2.0f ); |
| 600 | actor.Add( borderActor ); | 604 | actor.Add( borderActor ); |
| 601 | 605 | ||
| @@ -625,7 +629,8 @@ public: | @@ -625,7 +629,8 @@ public: | ||
| 625 | mScrollView.Add(pageView); | 629 | mScrollView.Add(pageView); |
| 626 | pageView.SetParentOrigin(ParentOrigin::CENTER); | 630 | pageView.SetParentOrigin(ParentOrigin::CENTER); |
| 627 | pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); | 631 | pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); |
| 628 | - pageView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 632 | + pageView.SetRelayoutEnabled( true ); |
| 633 | + pageView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 629 | 634 | ||
| 630 | // Create cluster actors, add them to scroll view, and set the shear effect with the given center point. | 635 | // Create cluster actors, add them to scroll view, and set the shear effect with the given center point. |
| 631 | Cluster cluster = CreateClusterActor(clusterType, style); | 636 | Cluster cluster = CreateClusterActor(clusterType, style); |
examples/cube-transition-effect/cube-transition-effect-example.cpp
| @@ -182,7 +182,6 @@ private: | @@ -182,7 +182,6 @@ private: | ||
| 182 | ImageActor mNextImage; | 182 | ImageActor mNextImage; |
| 183 | unsigned int mIndex; | 183 | unsigned int mIndex; |
| 184 | bool mIsImageLoading; | 184 | bool mIsImageLoading; |
| 185 | - Constraint mImageConstraint; | ||
| 186 | 185 | ||
| 187 | PanGestureDetector mPanGestureDetector; | 186 | PanGestureDetector mPanGestureDetector; |
| 188 | 187 | ||
| @@ -283,11 +282,10 @@ void CubeTransitionApp::OnInit( Application& application ) | @@ -283,11 +282,10 @@ void CubeTransitionApp::OnInit( Application& application ) | ||
| 283 | mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick ); | 282 | mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick ); |
| 284 | 283 | ||
| 285 | // show the first image | 284 | // show the first image |
| 286 | - mImageConstraint = Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); | ||
| 287 | - | ||
| 288 | mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); | 285 | mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); |
| 289 | mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); | 286 | mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); |
| 290 | - mCurrentImage.ApplyConstraint( mImageConstraint ); | 287 | + mCurrentImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 288 | + mCurrentImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); | ||
| 291 | mParent.Add( mCurrentImage ); | 289 | mParent.Add( mCurrentImage ); |
| 292 | 290 | ||
| 293 | mCurrentEffect = mCubeWaveEffect; | 291 | mCurrentEffect = mCubeWaveEffect; |
| @@ -331,7 +329,9 @@ void CubeTransitionApp::GoToNextImage() | @@ -331,7 +329,9 @@ void CubeTransitionApp::GoToNextImage() | ||
| 331 | mNextImage = ImageActor::New( image ); | 329 | mNextImage = ImageActor::New( image ); |
| 332 | 330 | ||
| 333 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); | 331 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); |
| 334 | - mNextImage.ApplyConstraint( mImageConstraint ); | 332 | + mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 333 | + mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); | ||
| 334 | + mNextImage.SetRelayoutEnabled( false ); | ||
| 335 | mCurrentEffect.SetTargetImage(mNextImage); | 335 | mCurrentEffect.SetTargetImage(mNextImage); |
| 336 | if( image.GetLoadingState() == ResourceLoadingSucceeded ) | 336 | if( image.GetLoadingState() == ResourceLoadingSucceeded ) |
| 337 | { | 337 | { |
examples/dissolve-effect/dissolve-effect-example.cpp
| @@ -163,7 +163,6 @@ private: | @@ -163,7 +163,6 @@ private: | ||
| 163 | ImageActor mCurrentImage; | 163 | ImageActor mCurrentImage; |
| 164 | ImageActor mNextImage; | 164 | ImageActor mNextImage; |
| 165 | unsigned int mIndex; | 165 | unsigned int mIndex; |
| 166 | - Constraint mSizeConstraint; | ||
| 167 | 166 | ||
| 168 | Toolkit::DissolveEffect mCurrentImageEffect; | 167 | Toolkit::DissolveEffect mCurrentImageEffect; |
| 169 | Toolkit::DissolveEffect mNextImageEffect; | 168 | Toolkit::DissolveEffect mNextImageEffect; |
| @@ -251,12 +250,12 @@ void DissolveEffectApp::OnInit( Application& application ) | @@ -251,12 +250,12 @@ void DissolveEffectApp::OnInit( Application& application ) | ||
| 251 | mParent.SetPositionInheritanceMode( USE_PARENT_POSITION ); | 250 | mParent.SetPositionInheritanceMode( USE_PARENT_POSITION ); |
| 252 | mContent.Add( mParent ); | 251 | mContent.Add( mParent ); |
| 253 | 252 | ||
| 254 | - mSizeConstraint= Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); | ||
| 255 | - | ||
| 256 | // show the first image | 253 | // show the first image |
| 257 | mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); | 254 | mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); |
| 255 | + mCurrentImage.SetRelayoutEnabled( false ); | ||
| 258 | mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); | 256 | mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 259 | - mCurrentImage.ApplyConstraint( mSizeConstraint ); | 257 | + mCurrentImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 258 | + mCurrentImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); | ||
| 260 | mParent.Add( mCurrentImage ); | 259 | mParent.Add( mCurrentImage ); |
| 261 | 260 | ||
| 262 | mPanGestureDetector.Attach( mCurrentImage ); | 261 | mPanGestureDetector.Attach( mCurrentImage ); |
| @@ -284,8 +283,10 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | @@ -284,8 +283,10 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) | ||
| 284 | 283 | ||
| 285 | Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); | 284 | Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); |
| 286 | mNextImage = ImageActor::New( image ); | 285 | mNextImage = ImageActor::New( image ); |
| 286 | + mNextImage.SetRelayoutEnabled( false ); | ||
| 287 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); | 287 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 288 | - mNextImage.ApplyConstraint( mSizeConstraint ); | 288 | + mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 289 | + mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); | ||
| 289 | mNextImage.SetZ(INITIAL_DEPTH); | 290 | mNextImage.SetZ(INITIAL_DEPTH); |
| 290 | mParent.Add( mNextImage ); | 291 | mParent.Add( mNextImage ); |
| 291 | Vector2 size = Vector2( mCurrentImage.GetCurrentSize() ); | 292 | Vector2 size = Vector2( mCurrentImage.GetCurrentSize() ); |
| @@ -303,7 +304,7 @@ void DissolveEffectApp::StartTransition(Vector2 position, Vector2 displacement) | @@ -303,7 +304,7 @@ void DissolveEffectApp::StartTransition(Vector2 position, Vector2 displacement) | ||
| 303 | mAnimation.AnimateTo( Property(mCurrentImageEffect, mCurrentImageEffect.GetDistortionPropertyName()), 1.0f, AlphaFunctions::Linear ); | 304 | mAnimation.AnimateTo( Property(mCurrentImageEffect, mCurrentImageEffect.GetDistortionPropertyName()), 1.0f, AlphaFunctions::Linear ); |
| 304 | 305 | ||
| 305 | mNextImage.SetOpacity(0.0f); | 306 | mNextImage.SetOpacity(0.0f); |
| 306 | - mAnimation.OpacityTo( mNextImage, 1.0, AlphaFunctions::Linear ); | 307 | + mAnimation.AnimateTo( Property( mNextImage, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::Linear ); |
| 307 | 308 | ||
| 308 | if(mUseHighPrecision) | 309 | if(mUseHighPrecision) |
| 309 | { | 310 | { |
| @@ -314,7 +315,7 @@ void DissolveEffectApp::StartTransition(Vector2 position, Vector2 displacement) | @@ -314,7 +315,7 @@ void DissolveEffectApp::StartTransition(Vector2 position, Vector2 displacement) | ||
| 314 | } | 315 | } |
| 315 | else | 316 | else |
| 316 | { | 317 | { |
| 317 | - mAnimation.MoveTo(mNextImage, Vector3(0.0f, 0.0f, 0.0f), AlphaFunctions::Linear); | 318 | + mAnimation.AnimateTo( Property( mNextImage, Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), AlphaFunctions::Linear ); |
| 318 | } | 319 | } |
| 319 | 320 | ||
| 320 | mAnimation.FinishedSignal().Connect( this, &DissolveEffectApp::OnTransitionCompleted ); | 321 | mAnimation.FinishedSignal().Connect( this, &DissolveEffectApp::OnTransitionCompleted ); |
| @@ -397,7 +398,8 @@ bool DissolveEffectApp::OnTimerTick() | @@ -397,7 +398,8 @@ bool DissolveEffectApp::OnTimerTick() | ||
| 397 | Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); | 398 | Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); |
| 398 | mNextImage = ImageActor::New( image ); | 399 | mNextImage = ImageActor::New( image ); |
| 399 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); | 400 | mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); |
| 400 | - mNextImage.ApplyConstraint( mSizeConstraint ); | 401 | + mNextImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 402 | + mNextImage.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); | ||
| 401 | mNextImage.SetZ(INITIAL_DEPTH); | 403 | mNextImage.SetZ(INITIAL_DEPTH); |
| 402 | mParent.Add( mNextImage ); | 404 | mParent.Add( mNextImage ); |
| 403 | switch( mCentralLineIndex%4 ) | 405 | switch( mCentralLineIndex%4 ) |
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| @@ -421,7 +421,8 @@ public: | @@ -421,7 +421,8 @@ public: | ||
| 421 | // coordinates in a frame defined by a parent actor: | 421 | // coordinates in a frame defined by a parent actor: |
| 422 | 422 | ||
| 423 | Actor gridActor = Actor::New(); | 423 | Actor gridActor = Actor::New(); |
| 424 | - gridActor.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 424 | + gridActor.SetRelayoutEnabled( true ); |
| 425 | + gridActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 425 | gridActor.SetParentOrigin( ParentOrigin::CENTER ); | 426 | gridActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 426 | gridActor.SetAnchorPoint( AnchorPoint::CENTER ); | 427 | gridActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 427 | 428 | ||
| @@ -467,7 +468,7 @@ public: | @@ -467,7 +468,7 @@ public: | ||
| 467 | { | 468 | { |
| 468 | // Spin the image a few times: | 469 | // Spin the image a few times: |
| 469 | Animation animation = Animation::New(SPIN_DURATION); | 470 | Animation animation = Animation::New(SPIN_DURATION); |
| 470 | - animation.RotateBy( actor, Degree(360.0f * SPIN_DURATION), Vector3::XAXIS, AlphaFunctions::EaseOut); | 471 | + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f * SPIN_DURATION) ), Vector3::XAXIS ), AlphaFunctions::EaseOut ); |
| 471 | animation.Play(); | 472 | animation.Play(); |
| 472 | 473 | ||
| 473 | // Change the scaling mode: | 474 | // Change the scaling mode: |
examples/item-view/item-view-example.cpp
| @@ -279,9 +279,9 @@ public: | @@ -279,9 +279,9 @@ public: | ||
| 279 | mDeleteButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); | 279 | mDeleteButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); |
| 280 | mDeleteButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); | 280 | mDeleteButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); |
| 281 | mDeleteButton.SetDrawMode( DrawMode::OVERLAY ); | 281 | mDeleteButton.SetDrawMode( DrawMode::OVERLAY ); |
| 282 | - mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); | ||
| 283 | mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) ); | 282 | mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) ); |
| 284 | - mDeleteButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); | 283 | + mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); |
| 284 | + mDeleteButton.SetSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) ); | ||
| 285 | mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked); | 285 | mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked); |
| 286 | mDeleteButton.SetLeaveRequired( true ); | 286 | mDeleteButton.SetLeaveRequired( true ); |
| 287 | mDeleteButton.SetVisible( false ); | 287 | mDeleteButton.SetVisible( false ); |
| @@ -293,8 +293,8 @@ public: | @@ -293,8 +293,8 @@ public: | ||
| 293 | mInsertButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); | 293 | mInsertButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); |
| 294 | mInsertButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); | 294 | mInsertButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); |
| 295 | mInsertButton.SetDrawMode( DrawMode::OVERLAY ); | 295 | mInsertButton.SetDrawMode( DrawMode::OVERLAY ); |
| 296 | - mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); | ||
| 297 | mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) ); | 296 | mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) ); |
| 297 | + mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); | ||
| 298 | mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); | 298 | mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); |
| 299 | mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked); | 299 | mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked); |
| 300 | mInsertButton.SetLeaveRequired( true ); | 300 | mInsertButton.SetLeaveRequired( true ); |
| @@ -307,8 +307,8 @@ public: | @@ -307,8 +307,8 @@ public: | ||
| 307 | mReplaceButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); | 307 | mReplaceButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); |
| 308 | mReplaceButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); | 308 | mReplaceButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); |
| 309 | mReplaceButton.SetDrawMode( DrawMode::OVERLAY ); | 309 | mReplaceButton.SetDrawMode( DrawMode::OVERLAY ); |
| 310 | - mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); | ||
| 311 | mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) ); | 310 | mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) ); |
| 311 | + mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); | ||
| 312 | mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); | 312 | mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); |
| 313 | mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked); | 313 | mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked); |
| 314 | mReplaceButton.SetLeaveRequired( true ); | 314 | mReplaceButton.SetLeaveRequired( true ); |
| @@ -318,6 +318,7 @@ public: | @@ -318,6 +318,7 @@ public: | ||
| 318 | // Create the item view actor | 318 | // Create the item view actor |
| 319 | mImageAtlas = CreateImageAtlas(); | 319 | mImageAtlas = CreateImageAtlas(); |
| 320 | mItemView = ItemView::New(*this); | 320 | mItemView = ItemView::New(*this); |
| 321 | + mItemView.SetRelayoutEnabled( false ); | ||
| 321 | mItemView.SetParentOrigin(ParentOrigin::CENTER); | 322 | mItemView.SetParentOrigin(ParentOrigin::CENTER); |
| 322 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); | 323 | mItemView.SetAnchorPoint(AnchorPoint::CENTER); |
| 323 | 324 | ||
| @@ -897,7 +898,7 @@ public: // From ItemFactory | @@ -897,7 +898,7 @@ public: // From ItemFactory | ||
| 897 | borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); | 898 | borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); |
| 898 | borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) ); | 899 | borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) ); |
| 899 | borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor | 900 | borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor |
| 900 | - borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT ); | 901 | + borderActor.SetResizePolicy( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS ); |
| 901 | borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE ); | 902 | borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE ); |
| 902 | actor.Add(borderActor); | 903 | actor.Add(borderActor); |
| 903 | actor.SetKeyboardFocusable( true ); | 904 | actor.SetKeyboardFocusable( true ); |
| @@ -908,6 +909,7 @@ public: // From ItemFactory | @@ -908,6 +909,7 @@ public: // From ItemFactory | ||
| 908 | // Add a checkbox child actor; invisible until edit-mode is enabled | 909 | // Add a checkbox child actor; invisible until edit-mode is enabled |
| 909 | 910 | ||
| 910 | ImageActor checkbox = ImageActor::New( mWhiteImage ); | 911 | ImageActor checkbox = ImageActor::New( mWhiteImage ); |
| 912 | + checkbox.SetRelayoutEnabled( false ); | ||
| 911 | checkbox.SetName( "CheckBox" ); | 913 | checkbox.SetName( "CheckBox" ); |
| 912 | checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) ); | 914 | checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) ); |
| 913 | checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT ); | 915 | checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| @@ -924,6 +926,7 @@ public: // From ItemFactory | @@ -924,6 +926,7 @@ public: // From ItemFactory | ||
| 924 | actor.Add( checkbox ); | 926 | actor.Add( checkbox ); |
| 925 | 927 | ||
| 926 | ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) ); | 928 | ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) ); |
| 929 | + tick.SetRelayoutEnabled( false ); | ||
| 927 | tick.SetColorMode( USE_OWN_COLOR ); | 930 | tick.SetColorMode( USE_OWN_COLOR ); |
| 928 | tick.SetName( "Tick" ); | 931 | tick.SetName( "Tick" ); |
| 929 | tick.SetParentOrigin( ParentOrigin::TOP_RIGHT ); | 932 | tick.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| @@ -988,12 +991,11 @@ private: | @@ -988,12 +991,11 @@ private: | ||
| 988 | mMenu = Toolkit::Popup::New(); | 991 | mMenu = Toolkit::Popup::New(); |
| 989 | mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); | 992 | mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); |
| 990 | mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); | 993 | mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); |
| 994 | + mMenu.SetSize( popupWidth, MENU_OPTION_HEIGHT * 2 ); | ||
| 991 | mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu ); | 995 | mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu ); |
| 992 | - stage.Add( mMenu ); | ||
| 993 | 996 | ||
| 994 | TableView tableView = TableView::New( 0, 0 ); | 997 | TableView tableView = TableView::New( 0, 0 ); |
| 995 | - Vector2 tableSize = Vector2( popupWidth, MENU_OPTION_HEIGHT * 2 ); | ||
| 996 | - tableView.SetSize( tableSize ); | 998 | + tableView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); |
| 997 | mMenu.Add( tableView ); | 999 | mMenu.Add( tableView ); |
| 998 | 1000 | ||
| 999 | Slider slider = Slider::New(); | 1001 | Slider slider = Slider::New(); |
| @@ -1002,9 +1004,9 @@ private: | @@ -1002,9 +1004,9 @@ private: | ||
| 1002 | slider.SetProperty( Slider::Property::VALUE, mDurationSeconds ); | 1004 | slider.SetProperty( Slider::Property::VALUE, mDurationSeconds ); |
| 1003 | slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 ); | 1005 | slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 ); |
| 1004 | slider.SetProperty( Slider::Property::SHOW_POPUP, true ); | 1006 | slider.SetProperty( Slider::Property::SHOW_POPUP, true ); |
| 1007 | + slider.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 1005 | slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange ); | 1008 | slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange ); |
| 1006 | tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) ); | 1009 | tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) ); |
| 1007 | - tableView.SetRelativeHeight( 0, 0.5f ); | ||
| 1008 | 1010 | ||
| 1009 | TextStyle defaultTextStyle; | 1011 | TextStyle defaultTextStyle; |
| 1010 | defaultTextStyle.SetFontName(DEFAULT_TEXT_STYLE_FONT_FAMILY); | 1012 | defaultTextStyle.SetFontName(DEFAULT_TEXT_STYLE_FONT_FAMILY); |
| @@ -1018,19 +1020,20 @@ private: | @@ -1018,19 +1020,20 @@ private: | ||
| 1018 | text.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 1020 | text.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 1019 | text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft ); | 1021 | text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft ); |
| 1020 | text.SetStyleToCurrentText( defaultTextStyle ); | 1022 | text.SetStyleToCurrentText( defaultTextStyle ); |
| 1023 | + text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1021 | text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); | 1024 | text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); |
| 1022 | - text.ApplyConstraint( Dali::Constraint::New<float>( Dali::Actor::Property::SIZE_WIDTH, Dali::ParentSource( Dali::Actor::Property::SIZE_WIDTH ), Dali::EqualToConstraint() ) ); | ||
| 1023 | text.SetZ( -0.9f ); | 1025 | text.SetZ( -0.9f ); |
| 1024 | slider.Add( text ); | 1026 | slider.Add( text ); |
| 1025 | 1027 | ||
| 1026 | Actor textContainer = Actor::New(); | 1028 | Actor textContainer = Actor::New(); |
| 1029 | + textContainer.SetRelayoutEnabled( true ); | ||
| 1030 | + textContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 1027 | mAlphaFunctionText = TextView::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] ); | 1031 | mAlphaFunctionText = TextView::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] ); |
| 1028 | mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER ); | 1032 | mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER ); |
| 1029 | mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER ); | 1033 | mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER ); |
| 1030 | mAlphaFunctionText.SetTextAlignment( Toolkit::Alignment::VerticalCenter ); | 1034 | mAlphaFunctionText.SetTextAlignment( Toolkit::Alignment::VerticalCenter ); |
| 1031 | textContainer.Add( mAlphaFunctionText ); | 1035 | textContainer.Add( mAlphaFunctionText ); |
| 1032 | tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) ); | 1036 | tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) ); |
| 1033 | - tableView.SetRelativeHeight( 0, 0.5f ); | ||
| 1034 | 1037 | ||
| 1035 | mTapDetector = TapGestureDetector::New(); | 1038 | mTapDetector = TapGestureDetector::New(); |
| 1036 | mTapDetector.Attach(mAlphaFunctionText); | 1039 | mTapDetector.Attach(mAlphaFunctionText); |
| @@ -1041,10 +1044,11 @@ private: | @@ -1041,10 +1044,11 @@ private: | ||
| 1041 | text.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 1044 | text.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 1042 | text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft ); | 1045 | text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft ); |
| 1043 | text.SetStyleToCurrentText( defaultTextStyle ); | 1046 | text.SetStyleToCurrentText( defaultTextStyle ); |
| 1047 | + text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1044 | text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); | 1048 | text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y ); |
| 1045 | - text.ApplyConstraint( Dali::Constraint::New<float>( Dali::Actor::Property::SIZE_WIDTH, Dali::ParentSource( Dali::Actor::Property::SIZE_WIDTH ), Dali::EqualToConstraint() ) ); | ||
| 1046 | textContainer.Add( text ); | 1049 | textContainer.Add( text ); |
| 1047 | 1050 | ||
| 1051 | + mMenu.MarkDirtyForRelayout(); | ||
| 1048 | mMenu.Show(); | 1052 | mMenu.Show(); |
| 1049 | mMenuShown = true; | 1053 | mMenuShown = true; |
| 1050 | } | 1054 | } |
examples/logging/logging-example.cpp
| @@ -275,7 +275,7 @@ class LoggingController: public ConnectionTracker | @@ -275,7 +275,7 @@ class LoggingController: public ConnectionTracker | ||
| 275 | mContentLayer.Add( createGroupBackground ); | 275 | mContentLayer.Add( createGroupBackground ); |
| 276 | 276 | ||
| 277 | int buttonXDP = DP(MARGIN_SIZE); | 277 | int buttonXDP = DP(MARGIN_SIZE); |
| 278 | - int buttonWidthDP = (createGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2; | 278 | + int buttonWidthDP = (createGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2; |
| 279 | 279 | ||
| 280 | { | 280 | { |
| 281 | Toolkit::PushButton button = Toolkit::PushButton::New(); | 281 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| @@ -326,7 +326,7 @@ class LoggingController: public ConnectionTracker | @@ -326,7 +326,7 @@ class LoggingController: public ConnectionTracker | ||
| 326 | mContentLayer.Add( timingGroupBackground ); | 326 | mContentLayer.Add( timingGroupBackground ); |
| 327 | 327 | ||
| 328 | buttonXDP = DP(MARGIN_SIZE); | 328 | buttonXDP = DP(MARGIN_SIZE); |
| 329 | - buttonWidthDP = (timingGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2; | 329 | + buttonWidthDP = (timingGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2; |
| 330 | 330 | ||
| 331 | { | 331 | { |
| 332 | Toolkit::PushButton button = Toolkit::PushButton::New(); | 332 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| @@ -377,7 +377,7 @@ class LoggingController: public ConnectionTracker | @@ -377,7 +377,7 @@ class LoggingController: public ConnectionTracker | ||
| 377 | mContentLayer.Add( enableGroupBackground ); | 377 | mContentLayer.Add( enableGroupBackground ); |
| 378 | 378 | ||
| 379 | buttonXDP = DP(MARGIN_SIZE); | 379 | buttonXDP = DP(MARGIN_SIZE); |
| 380 | - buttonWidthDP = (enableGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2; | 380 | + buttonWidthDP = (enableGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2; |
| 381 | 381 | ||
| 382 | { | 382 | { |
| 383 | Toolkit::PushButton button = Toolkit::PushButton::New(); | 383 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| @@ -509,7 +509,7 @@ class LoggingController: public ConnectionTracker | @@ -509,7 +509,7 @@ class LoggingController: public ConnectionTracker | ||
| 509 | mContentLayer.Add( vsyncGroupBackground ); | 509 | mContentLayer.Add( vsyncGroupBackground ); |
| 510 | 510 | ||
| 511 | buttonXDP = DP(MARGIN_SIZE); | 511 | buttonXDP = DP(MARGIN_SIZE); |
| 512 | - buttonWidthDP = vsyncGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 2; | 512 | + buttonWidthDP = vsyncGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 2; |
| 513 | 513 | ||
| 514 | { | 514 | { |
| 515 | Toolkit::PushButton button = Toolkit::PushButton::New(); | 515 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
examples/magnifier/magnifier-example.cpp
| @@ -227,12 +227,14 @@ public: | @@ -227,12 +227,14 @@ public: | ||
| 227 | 227 | ||
| 228 | // Create magnifier (controlled by human touch) | 228 | // Create magnifier (controlled by human touch) |
| 229 | Layer overlay = Layer::New(); | 229 | Layer overlay = Layer::New(); |
| 230 | + overlay.SetRelayoutEnabled( false ); | ||
| 230 | overlay.SetSensitive(false); | 231 | overlay.SetSensitive(false); |
| 231 | overlay.SetParentOrigin( ParentOrigin::CENTER ); | 232 | overlay.SetParentOrigin( ParentOrigin::CENTER ); |
| 232 | overlay.SetSize(mStageSize); | 233 | overlay.SetSize(mStageSize); |
| 233 | Stage::GetCurrent().Add(overlay); | 234 | Stage::GetCurrent().Add(overlay); |
| 234 | 235 | ||
| 235 | mMagnifier = Toolkit::Magnifier::New(); | 236 | mMagnifier = Toolkit::Magnifier::New(); |
| 237 | + mMagnifier.SetRelayoutEnabled( false ); | ||
| 236 | mMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); | 238 | mMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); |
| 237 | mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width | 239 | mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width |
| 238 | mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); | 240 | mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); |
| @@ -251,6 +253,7 @@ public: | @@ -251,6 +253,7 @@ public: | ||
| 251 | 253 | ||
| 252 | // Create bouncing magnifier automatically bounces around screen. | 254 | // Create bouncing magnifier automatically bounces around screen. |
| 253 | mBouncingMagnifier = Toolkit::Magnifier::New(); | 255 | mBouncingMagnifier = Toolkit::Magnifier::New(); |
| 256 | + mBouncingMagnifier.SetRelayoutEnabled( false ); | ||
| 254 | mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); | 257 | mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); |
| 255 | mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width | 258 | mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width |
| 256 | mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); | 259 | mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); |
examples/motion-blur/motion-blur-example.cpp
| @@ -326,8 +326,9 @@ public: | @@ -326,8 +326,9 @@ public: | ||
| 326 | { | 326 | { |
| 327 | // has parent so we expect it to be on stage, start animation | 327 | // has parent so we expect it to be on stage, start animation |
| 328 | mRotateAnimation = Animation::New( ORIENTATION_DURATION ); | 328 | mRotateAnimation = Animation::New( ORIENTATION_DURATION ); |
| 329 | - mRotateAnimation.RotateTo( mView, Degree( -orientation ), Vector3::ZAXIS, AlphaFunctions::EaseOut ); | ||
| 330 | - mRotateAnimation.Resize( mView, targetSize.width, targetSize.height ); | 329 | + mRotateAnimation.AnimateTo( Property( mView, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -orientation ) ), Vector3::ZAXIS ), AlphaFunctions::EaseOut ); |
| 330 | + mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_WIDTH ), targetSize.width ); | ||
| 331 | + mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_HEIGHT ), targetSize.height ); | ||
| 331 | mRotateAnimation.Play(); | 332 | mRotateAnimation.Play(); |
| 332 | } | 333 | } |
| 333 | else | 334 | else |
| @@ -386,7 +387,7 @@ public: | @@ -386,7 +387,7 @@ public: | ||
| 386 | { | 387 | { |
| 387 | float animDuration = 1.0f; | 388 | float animDuration = 1.0f; |
| 388 | mActorAnimation = Animation::New(animDuration); | 389 | mActorAnimation = Animation::New(animDuration); |
| 389 | - mActorAnimation.RotateBy(mMotionBlurImageActor, Degree(720), Vector3::YAXIS, AlphaFunctions::EaseInOut); | 390 | + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunctions::EaseInOut ); |
| 390 | mActorAnimation.SetEndAction( Animation::Bake ); | 391 | mActorAnimation.SetEndAction( Animation::Bake ); |
| 391 | mActorAnimation.Play(); | 392 | mActorAnimation.Play(); |
| 392 | } | 393 | } |
| @@ -397,7 +398,7 @@ public: | @@ -397,7 +398,7 @@ public: | ||
| 397 | { | 398 | { |
| 398 | float animDuration = 1.0f; | 399 | float animDuration = 1.0f; |
| 399 | mActorAnimation = Animation::New(animDuration); | 400 | mActorAnimation = Animation::New(animDuration); |
| 400 | - mActorAnimation.RotateBy(mMotionBlurImageActor, Degree(720), Vector3::ZAXIS, AlphaFunctions::EaseInOut); | 401 | + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunctions::EaseInOut ); |
| 401 | mActorAnimation.SetEndAction( Animation::Bake ); | 402 | mActorAnimation.SetEndAction( Animation::Bake ); |
| 402 | mActorAnimation.Play(); | 403 | mActorAnimation.Play(); |
| 403 | } | 404 | } |
| @@ -408,8 +409,8 @@ public: | @@ -408,8 +409,8 @@ public: | ||
| 408 | { | 409 | { |
| 409 | float animDuration = 1.0f; | 410 | float animDuration = 1.0f; |
| 410 | mActorAnimation = Animation::New(animDuration); | 411 | mActorAnimation = Animation::New(animDuration); |
| 411 | - mActorAnimation.RotateBy(mMotionBlurImageActor, Degree(360), Vector3::YAXIS, AlphaFunctions::EaseInOut); | ||
| 412 | - mActorAnimation.RotateBy(mMotionBlurImageActor, Degree(360), Vector3::ZAXIS, AlphaFunctions::EaseInOut); | 412 | + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunctions::EaseInOut ); |
| 413 | + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunctions::EaseInOut ); | ||
| 413 | mActorAnimation.SetEndAction( Animation::Bake ); | 414 | mActorAnimation.SetEndAction( Animation::Bake ); |
| 414 | mActorAnimation.Play(); | 415 | mActorAnimation.Play(); |
| 415 | } | 416 | } |
| @@ -420,7 +421,7 @@ public: | @@ -420,7 +421,7 @@ public: | ||
| 420 | { | 421 | { |
| 421 | float animDuration = 1.0f; | 422 | float animDuration = 1.0f; |
| 422 | mActorAnimation = Animation::New(animDuration); | 423 | mActorAnimation = Animation::New(animDuration); |
| 423 | - mActorAnimation.ScaleBy(mMotionBlurImageActor, Vector3(2.0f, 2.0f, 2.0f), AlphaFunctions::Bounce, 0.0f, 1.0f); | 424 | + mActorAnimation.AnimateBy( Property( mMotionBlurImageActor, Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), AlphaFunctions::Bounce, TimePeriod( 0.0f, 1.0f ) ); |
| 424 | mActorAnimation.SetEndAction( Animation::Bake ); | 425 | mActorAnimation.SetEndAction( Animation::Bake ); |
| 425 | mActorAnimation.Play(); | 426 | mActorAnimation.Play(); |
| 426 | } | 427 | } |
examples/motion-stretch/motion-stretch-example.cpp
| @@ -218,8 +218,9 @@ public: | @@ -218,8 +218,9 @@ public: | ||
| 218 | { | 218 | { |
| 219 | // has parent so we expect it to be on stage, start animation | 219 | // has parent so we expect it to be on stage, start animation |
| 220 | mRotateAnimation = Animation::New( ORIENTATION_DURATION ); | 220 | mRotateAnimation = Animation::New( ORIENTATION_DURATION ); |
| 221 | - mRotateAnimation.RotateTo( mView, Degree( -orientation ), Vector3::ZAXIS, AlphaFunctions::EaseOut ); | ||
| 222 | - mRotateAnimation.Resize( mView, targetSize.width, targetSize.height ); | 221 | + mRotateAnimation.AnimateTo( Property( mView, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -orientation ) ), Vector3::ZAXIS ), AlphaFunctions::EaseOut ); |
| 222 | + mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_WIDTH ), targetSize.width ); | ||
| 223 | + mRotateAnimation.AnimateTo( Property( mView, Actor::Property::SIZE_HEIGHT ), targetSize.height ); | ||
| 223 | mRotateAnimation.Play(); | 224 | mRotateAnimation.Play(); |
| 224 | } | 225 | } |
| 225 | else | 226 | else |
| @@ -277,7 +278,7 @@ public: | @@ -277,7 +278,7 @@ public: | ||
| 277 | { | 278 | { |
| 278 | float animDuration = 1.0f; | 279 | float animDuration = 1.0f; |
| 279 | mActorAnimation = Animation::New(animDuration); | 280 | mActorAnimation = Animation::New(animDuration); |
| 280 | - mActorAnimation.RotateBy(mMotionStretchImageActor, Degree(720), Vector3::YAXIS, AlphaFunctions::EaseInOut); | 281 | + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunctions::EaseInOut ); |
| 281 | mActorAnimation.SetEndAction( Animation::Bake ); | 282 | mActorAnimation.SetEndAction( Animation::Bake ); |
| 282 | mActorAnimation.Play(); | 283 | mActorAnimation.Play(); |
| 283 | } | 284 | } |
| @@ -288,7 +289,7 @@ public: | @@ -288,7 +289,7 @@ public: | ||
| 288 | { | 289 | { |
| 289 | float animDuration = 1.0f; | 290 | float animDuration = 1.0f; |
| 290 | mActorAnimation = Animation::New(animDuration); | 291 | mActorAnimation = Animation::New(animDuration); |
| 291 | - mActorAnimation.RotateBy(mMotionStretchImageActor, Degree(720), Vector3::ZAXIS, AlphaFunctions::EaseInOut); | 292 | + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunctions::EaseInOut ); |
| 292 | mActorAnimation.SetEndAction( Animation::Bake ); | 293 | mActorAnimation.SetEndAction( Animation::Bake ); |
| 293 | mActorAnimation.Play(); | 294 | mActorAnimation.Play(); |
| 294 | } | 295 | } |
| @@ -299,8 +300,8 @@ public: | @@ -299,8 +300,8 @@ public: | ||
| 299 | { | 300 | { |
| 300 | float animDuration = 1.0f; | 301 | float animDuration = 1.0f; |
| 301 | mActorAnimation = Animation::New(animDuration); | 302 | mActorAnimation = Animation::New(animDuration); |
| 302 | - mActorAnimation.RotateBy(mMotionStretchImageActor, Degree(360), Vector3::YAXIS, AlphaFunctions::EaseInOut); | ||
| 303 | - mActorAnimation.RotateBy(mMotionStretchImageActor, Degree(360), Vector3::ZAXIS, AlphaFunctions::EaseInOut); | 303 | + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::YAXIS ), AlphaFunctions::EaseInOut ); |
| 304 | + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f) ), Vector3::ZAXIS ), AlphaFunctions::EaseInOut ); | ||
| 304 | mActorAnimation.SetEndAction( Animation::Bake ); | 305 | mActorAnimation.SetEndAction( Animation::Bake ); |
| 305 | mActorAnimation.Play(); | 306 | mActorAnimation.Play(); |
| 306 | } | 307 | } |
| @@ -311,7 +312,7 @@ public: | @@ -311,7 +312,7 @@ public: | ||
| 311 | { | 312 | { |
| 312 | float animDuration = 1.0f; | 313 | float animDuration = 1.0f; |
| 313 | mActorAnimation = Animation::New(animDuration); | 314 | mActorAnimation = Animation::New(animDuration); |
| 314 | - mActorAnimation.ScaleBy(mMotionStretchImageActor, Vector3(2.0f, 2.0f, 2.0f), AlphaFunctions::Bounce, 0.0f, 1.0f); | 315 | + mActorAnimation.AnimateBy( Property( mMotionStretchImageActor, Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), AlphaFunctions::Bounce, TimePeriod( 0.0f, 1.0f ) ); |
| 315 | mActorAnimation.SetEndAction( Animation::Bake ); | 316 | mActorAnimation.SetEndAction( Animation::Bake ); |
| 316 | mActorAnimation.Play(); | 317 | mActorAnimation.Play(); |
| 317 | } | 318 | } |
examples/page-turn-view/page-turn-view-example.cpp
| @@ -78,14 +78,20 @@ class PortraitPageFactory : public PageFactory | @@ -78,14 +78,20 @@ class PortraitPageFactory : public PageFactory | ||
| 78 | */ | 78 | */ |
| 79 | virtual Actor NewPage( unsigned int pageId ) | 79 | virtual Actor NewPage( unsigned int pageId ) |
| 80 | { | 80 | { |
| 81 | + ImageActor page; | ||
| 82 | + | ||
| 81 | if( pageId == 0 ) | 83 | if( pageId == 0 ) |
| 82 | { | 84 | { |
| 83 | - return ImageActor::New( ResourceImage::New( BOOK_COVER_PORTRAIT ) ); | 85 | + page = ImageActor::New( ResourceImage::New( BOOK_COVER_PORTRAIT ) ); |
| 84 | } | 86 | } |
| 85 | else | 87 | else |
| 86 | { | 88 | { |
| 87 | - return ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); | 89 | + page = ImageActor::New( ResourceImage::New( PAGE_IMAGES_PORTRAIT[ (pageId-1) % NUMBER_OF_PORTRAIT_IMAGE ] ) ); |
| 88 | } | 90 | } |
| 91 | + | ||
| 92 | + page.SetRelayoutEnabled( false ); | ||
| 93 | + | ||
| 94 | + return page; | ||
| 89 | } | 95 | } |
| 90 | }; | 96 | }; |
| 91 | 97 | ||
| @@ -120,6 +126,10 @@ class LandscapePageFactory : public PageFactory | @@ -120,6 +126,10 @@ class LandscapePageFactory : public PageFactory | ||
| 120 | pageBack = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); | 126 | pageBack = ImageActor::New( ResourceImage::New( PAGE_IMAGES_LANDSCAPE[ (imageId+1) % NUMBER_OF_LANDSCAPE_IMAGE ] ) ); |
| 121 | } | 127 | } |
| 122 | pageFront.Add(pageBack); | 128 | pageFront.Add(pageBack); |
| 129 | + | ||
| 130 | + pageFront.SetRelayoutEnabled( false ); | ||
| 131 | + pageBack.SetRelayoutEnabled( false ); | ||
| 132 | + | ||
| 123 | return pageFront; | 133 | return pageFront; |
| 124 | } | 134 | } |
| 125 | }; | 135 | }; |
| @@ -223,6 +233,7 @@ void PageTurnController::OnInit( Application& app ) | @@ -223,6 +233,7 @@ void PageTurnController::OnInit( Application& app ) | ||
| 223 | 233 | ||
| 224 | // Create default View. | 234 | // Create default View. |
| 225 | mView = View::New(); | 235 | mView = View::New(); |
| 236 | + mView.SetRelayoutEnabled( false ); | ||
| 226 | stage.Add( mView ); | 237 | stage.Add( mView ); |
| 227 | 238 | ||
| 228 | Dali::Window winHandle = app.GetWindow(); | 239 | Dali::Window winHandle = app.GetWindow(); |
| @@ -236,6 +247,7 @@ void PageTurnController::OnInit( Application& app ) | @@ -236,6 +247,7 @@ void PageTurnController::OnInit( Application& app ) | ||
| 236 | mView.OrientationAnimationStartedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); | 247 | mView.OrientationAnimationStartedSignal().Connect( this, &PageTurnController::OnOrientationAnimationStarted ); |
| 237 | 248 | ||
| 238 | mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize ); | 249 | mPageTurnPortraitView = PageTurnPortraitView::New( mPortraitPageFactory, stageSize ); |
| 250 | + mPageTurnPortraitView.SetRelayoutEnabled( false ); | ||
| 239 | mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) ); | 251 | mPageTurnPortraitView.SetSpineShadowParameter( Vector2(70.f, 30.f) ); |
| 240 | mPageTurnPortraitView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); | 252 | mPageTurnPortraitView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); |
| 241 | mPageTurnPortraitView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); | 253 | mPageTurnPortraitView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); |
| @@ -244,6 +256,7 @@ void PageTurnController::OnInit( Application& app ) | @@ -244,6 +256,7 @@ void PageTurnController::OnInit( Application& app ) | ||
| 244 | mPageTurnPortraitView.SetPositionInheritanceMode( USE_PARENT_POSITION ); | 256 | mPageTurnPortraitView.SetPositionInheritanceMode( USE_PARENT_POSITION ); |
| 245 | 257 | ||
| 246 | mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(stageSize.y*0.5f, stageSize.x) ); | 258 | mPageTurnLandscapeView = PageTurnLandscapeView::New( mLandscapePageFactory, Vector2(stageSize.y*0.5f, stageSize.x) ); |
| 259 | + mPageTurnLandscapeView.SetRelayoutEnabled( false ); | ||
| 247 | mPageTurnLandscapeView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); | 260 | mPageTurnLandscapeView.PageTurnStartedSignal().Connect( this, &PageTurnController::OnPageStartedTurn ); |
| 248 | mPageTurnLandscapeView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); | 261 | mPageTurnLandscapeView.PageTurnFinishedSignal().Connect( this, &PageTurnController::OnPageFinishedTurn ); |
| 249 | mPageTurnLandscapeView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan ); | 262 | mPageTurnLandscapeView.PagePanStartedSignal().Connect( this, &PageTurnController::OnPageStartedPan ); |
examples/path-animation/path-animation.cpp
| @@ -69,6 +69,7 @@ public: | @@ -69,6 +69,7 @@ public: | ||
| 69 | textActor.SetSize(size.y,size.y,0.0f); | 69 | textActor.SetSize(size.y,size.y,0.0f); |
| 70 | 70 | ||
| 71 | Slider slider = Slider::New(); | 71 | Slider slider = Slider::New(); |
| 72 | + slider.SetRelayoutEnabled( false ); | ||
| 72 | slider.SetAnchorPoint( AnchorPoint::CENTER_LEFT); | 73 | slider.SetAnchorPoint( AnchorPoint::CENTER_LEFT); |
| 73 | slider.SetParentOrigin( ParentOrigin::CENTER_RIGHT); | 74 | slider.SetParentOrigin( ParentOrigin::CENTER_RIGHT); |
| 74 | slider.SetProperty(Slider::Property::LOWER_BOUND, -1.0f ); | 75 | slider.SetProperty(Slider::Property::LOWER_BOUND, -1.0f ); |
| @@ -100,6 +101,7 @@ public: | @@ -100,6 +101,7 @@ public: | ||
| 100 | 101 | ||
| 101 | //TextInput | 102 | //TextInput |
| 102 | Dali::Layer controlsLayer = Dali::Layer::New(); | 103 | Dali::Layer controlsLayer = Dali::Layer::New(); |
| 104 | + controlsLayer.SetRelayoutEnabled( false ); | ||
| 103 | controlsLayer.SetSize( stage.GetSize().x, stage.GetSize().y*0.3f, 0.0 ); | 105 | controlsLayer.SetSize( stage.GetSize().x, stage.GetSize().y*0.3f, 0.0 ); |
| 104 | controlsLayer.SetPosition( 0.0f, stage.GetSize().y*0.8f, 0.0f ); | 106 | controlsLayer.SetPosition( 0.0f, stage.GetSize().y*0.8f, 0.0f ); |
| 105 | controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT); | 107 | controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT); |
| @@ -199,6 +201,7 @@ public: | @@ -199,6 +201,7 @@ public: | ||
| 199 | if( !mControlPoint[index] ) | 201 | if( !mControlPoint[index] ) |
| 200 | { | 202 | { |
| 201 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); | 203 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); |
| 204 | + mControlPoint[index].SetRelayoutEnabled( false ); | ||
| 202 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); | 205 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); |
| 203 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); | 206 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); |
| 204 | mControlPoint[index].SetSize( 20.0f, 20.0f ); | 207 | mControlPoint[index].SetSize( 20.0f, 20.0f ); |
| @@ -220,6 +223,7 @@ public: | @@ -220,6 +223,7 @@ public: | ||
| 220 | if( !mControlPoint[index]) | 223 | if( !mControlPoint[index]) |
| 221 | { | 224 | { |
| 222 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); | 225 | mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); |
| 226 | + mControlPoint[index].SetRelayoutEnabled( false ); | ||
| 223 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); | 227 | mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); |
| 224 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); | 228 | mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); |
| 225 | mControlPoint[index].SetSize( 20.0f, 20.0f ); | 229 | mControlPoint[index].SetSize( 20.0f, 20.0f ); |
| @@ -470,6 +474,7 @@ public: | @@ -470,6 +474,7 @@ public: | ||
| 470 | ImageAttributes attributes; | 474 | ImageAttributes attributes; |
| 471 | Image img = ResourceImage::New(ACTOR_IMAGE, attributes ); | 475 | Image img = ResourceImage::New(ACTOR_IMAGE, attributes ); |
| 472 | mActor = ImageActor::New( img ); | 476 | mActor = ImageActor::New( img ); |
| 477 | + mActor.SetRelayoutEnabled( false ); | ||
| 473 | mActor.SetAnchorPoint( AnchorPoint::CENTER ); | 478 | mActor.SetAnchorPoint( AnchorPoint::CENTER ); |
| 474 | mActor.SetSize( 100, 50, 1 ); | 479 | mActor.SetSize( 100, 50, 1 ); |
| 475 | stage.Add( mActor ); | 480 | stage.Add( mActor ); |
examples/radial-menu/radial-menu-example.cpp
| @@ -165,6 +165,7 @@ void RadialMenuExample::OnInit(Application& app) | @@ -165,6 +165,7 @@ void RadialMenuExample::OnInit(Application& app) | ||
| 165 | 165 | ||
| 166 | Image dial = ResourceImage::New( TEST_DIAL_FILENAME ); | 166 | Image dial = ResourceImage::New( TEST_DIAL_FILENAME ); |
| 167 | mDialActor = ImageActor::New( dial ); | 167 | mDialActor = ImageActor::New( dial ); |
| 168 | + mDialActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); | ||
| 168 | mDialActor.SetPositionInheritanceMode(USE_PARENT_POSITION); | 169 | mDialActor.SetPositionInheritanceMode(USE_PARENT_POSITION); |
| 169 | mDialActor.SetScale(scale); | 170 | mDialActor.SetScale(scale); |
| 170 | Layer dialLayer = Layer::New(); | 171 | Layer dialLayer = Layer::New(); |
| @@ -189,8 +190,8 @@ void RadialMenuExample::StartAnimation() | @@ -189,8 +190,8 @@ void RadialMenuExample::StartAnimation() | ||
| 189 | mRadialSweepView1.Activate(mAnimation, 0.0f, 3.0f); | 190 | mRadialSweepView1.Activate(mAnimation, 0.0f, 3.0f); |
| 190 | mRadialSweepView2.Activate(mAnimation, 1.5f, 3.0f); | 191 | mRadialSweepView2.Activate(mAnimation, 1.5f, 3.0f); |
| 191 | mRadialSweepView3.Activate(mAnimation, 3.0f, 3.0f); | 192 | mRadialSweepView3.Activate(mAnimation, 3.0f, 3.0f); |
| 192 | - mAnimation.OpacityTo(mDialActor, 1.0f, AlphaFunctions::EaseIn, 0.0f, 0.8f); | ||
| 193 | - mAnimation.OpacityTo(mRadialSweepView1, 1.0f, AlphaFunctions::EaseIn, 0.0f, 0.5f); | 193 | + mAnimation.AnimateTo( Property( mDialActor, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn, TimePeriod( 0.0f, 0.8f ) ); |
| 194 | + mAnimation.AnimateTo( Property( mRadialSweepView1, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn, TimePeriod( 0.0f, 0.5f ) ); | ||
| 194 | mAnimation.FinishedSignal().Connect( this, &RadialMenuExample::OnAnimationFinished ); | 195 | mAnimation.FinishedSignal().Connect( this, &RadialMenuExample::OnAnimationFinished ); |
| 195 | 196 | ||
| 196 | mAnimationState = PLAYING; | 197 | mAnimationState = PLAYING; |
| @@ -242,6 +243,7 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, | @@ -242,6 +243,7 @@ RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, | ||
| 242 | mImageActor = ImageActor::New(image); | 243 | mImageActor = ImageActor::New(image); |
| 243 | mImageActor.SetParentOrigin(ParentOrigin::CENTER); | 244 | mImageActor.SetParentOrigin(ParentOrigin::CENTER); |
| 244 | mImageActor.SetAnchorPoint(AnchorPoint::CENTER); | 245 | mImageActor.SetAnchorPoint(AnchorPoint::CENTER); |
| 246 | + mImageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); | ||
| 245 | 247 | ||
| 246 | // Create the stencil | 248 | // Create the stencil |
| 247 | Vector2 imageSize = ResourceImage::GetImageSize(imageName); | 249 | Vector2 imageSize = ResourceImage::GetImageSize(imageName); |
examples/radial-menu/radial-sweep-view-impl.cpp
| @@ -280,13 +280,13 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | @@ -280,13 +280,13 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | ||
| 280 | Actor actor = mLayer.GetChildAt(i); | 280 | Actor actor = mLayer.GetChildAt(i); |
| 281 | if( actor != mStencilActor ) | 281 | if( actor != mStencilActor ) |
| 282 | { | 282 | { |
| 283 | - anim.RotateTo( actor, mInitialActorAngle, Vector3::ZAXIS ); | 283 | + anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( mInitialActorAngle ) ), Vector3::ZAXIS ) ); |
| 284 | } | 284 | } |
| 285 | } | 285 | } |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | - anim.AnimateTo( Property( mStencilActor, mRotationAngleIndex ), static_cast<float>(mFinalSector), mEasingFunction, TimePeriod( offsetTime, duration) ); | ||
| 289 | - anim.RotateTo( mStencilActor, mFinalAngle, Vector3::ZAXIS, mEasingFunction, offsetTime, duration ); | 288 | + anim.AnimateTo( Property( mStencilActor, mRotationAngleIndex ), static_cast<float>(mFinalSector), mEasingFunction, TimePeriod( offsetTime, duration ) ); |
| 289 | + anim.AnimateTo( Property( mStencilActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( mFinalAngle ) ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); | ||
| 290 | 290 | ||
| 291 | if( mRotateActorsWithStencil ) | 291 | if( mRotateActorsWithStencil ) |
| 292 | { | 292 | { |
| @@ -295,7 +295,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | @@ -295,7 +295,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | ||
| 295 | Actor actor = mLayer.GetChildAt(i); | 295 | Actor actor = mLayer.GetChildAt(i); |
| 296 | if( actor != mStencilActor ) | 296 | if( actor != mStencilActor ) |
| 297 | { | 297 | { |
| 298 | - anim.RotateTo( actor, Degree(mFinalAngle - mInitialAngle), Vector3::ZAXIS, mEasingFunction, offsetTime, duration ); | 298 | + anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( mFinalAngle - mInitialAngle ) ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); |
| 299 | } | 299 | } |
| 300 | } | 300 | } |
| 301 | } | 301 | } |
| @@ -306,7 +306,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | @@ -306,7 +306,7 @@ void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float dura | ||
| 306 | Actor actor = mLayer.GetChildAt(i); | 306 | Actor actor = mLayer.GetChildAt(i); |
| 307 | if( actor != mStencilActor ) | 307 | if( actor != mStencilActor ) |
| 308 | { | 308 | { |
| 309 | - anim.RotateTo( actor, mFinalActorAngle, Vector3::ZAXIS, mEasingFunction, offsetTime, duration ); | 309 | + anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( mFinalActorAngle ) ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); |
| 310 | } | 310 | } |
| 311 | } | 311 | } |
| 312 | } | 312 | } |
examples/scripting/launcher.cpp
0 โ 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +// CLASS HEADER | ||
| 19 | +#include "launcher.h" | ||
| 20 | + | ||
| 21 | +// EXTERNAL INCLUDES | ||
| 22 | +#include <fstream> | ||
| 23 | +#include <sys/stat.h> | ||
| 24 | +#include <dali/integration-api/debug.h> | ||
| 25 | + | ||
| 26 | + | ||
| 27 | + | ||
| 28 | +using namespace Dali; | ||
| 29 | + | ||
| 30 | +#define TOKEN_STRING(x) #x | ||
| 31 | + | ||
| 32 | +namespace | ||
| 33 | +{ | ||
| 34 | +std::string GetFileContents(const std::string& filename) | ||
| 35 | +{ | ||
| 36 | + std::ifstream t(filename.c_str()); | ||
| 37 | + return std::string((std::istreambuf_iterator<char>(t)), | ||
| 38 | + std::istreambuf_iterator<char>()); | ||
| 39 | +}; | ||
| 40 | + | ||
| 41 | +} // unnamed namespace | ||
| 42 | + | ||
| 43 | +Launcher::Launcher( Dali::Application application, std::string layoutFileName, std::string scriptFileName ) | ||
| 44 | +: mApplication( application ), | ||
| 45 | + mJSONFileName(layoutFileName ), | ||
| 46 | + mJavaScriptFileName( scriptFileName ) | ||
| 47 | +{ | ||
| 48 | + | ||
| 49 | + mApplication.InitSignal().Connect( this, &Launcher::Create ); | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +Launcher::~Launcher() | ||
| 53 | +{ | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +void Launcher::Create( Dali::Application& application ) | ||
| 57 | +{ | ||
| 58 | + TextActor textActor = TextActor::New( "JSON & JavaScript Launcher..." ); | ||
| 59 | + | ||
| 60 | + // Reposition the actor | ||
| 61 | + textActor.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 62 | + textActor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 63 | + textActor.SetPosition( 20, 0 ); | ||
| 64 | + | ||
| 65 | + // Get a handle to the stage | ||
| 66 | + Stage stage = Stage::GetCurrent(); | ||
| 67 | + | ||
| 68 | + // Display the actor on the stage | ||
| 69 | + stage.Add( textActor ); | ||
| 70 | + | ||
| 71 | + // change the background color to purple | ||
| 72 | + Stage::GetCurrent().SetBackgroundColor( Vector4(0.2,0.2,0.4,1.0) ); | ||
| 73 | + | ||
| 74 | + // Try loading a JSON file | ||
| 75 | + if( !mJSONFileName.empty() ) | ||
| 76 | + { | ||
| 77 | + mBuilder = Toolkit::Builder::New(); | ||
| 78 | + | ||
| 79 | + Property::Map defaultDirs; | ||
| 80 | + defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR; | ||
| 81 | + defaultDirs[ TOKEN_STRING(DALI_MODEL_DIR) ] = DALI_MODEL_DIR; | ||
| 82 | + defaultDirs[ TOKEN_STRING(DALI_SCRIPT_DIR) ] = DALI_SCRIPT_DIR; | ||
| 83 | + mBuilder.AddConstants( defaultDirs ); | ||
| 84 | + | ||
| 85 | + std::string json_data(GetFileContents( mJSONFileName )); | ||
| 86 | + mBuilder.LoadFromString(json_data); | ||
| 87 | + mBuilder.AddActors( stage.GetRootLayer() ); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + // Try load a JavaScript file | ||
| 91 | + if( !mJavaScriptFileName.empty() ) | ||
| 92 | + { | ||
| 93 | + // execute the script | ||
| 94 | + mScript = Toolkit::Script::New(); | ||
| 95 | + | ||
| 96 | + mScript.ExecuteFile( mJavaScriptFileName); | ||
| 97 | + } | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +void Launcher::MainLoop() | ||
| 101 | +{ | ||
| 102 | + mApplication.MainLoop(); | ||
| 103 | +} |
examples/scripting/launcher.h
0 โ 100644
| 1 | +#ifndef DALI_APP_H | ||
| 2 | +#define DALI_APP_H | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
| 6 | + * | ||
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 8 | + * you may not use this file except in compliance with the License. | ||
| 9 | + * You may obtain a copy of the License at | ||
| 10 | + * | ||
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 12 | + * | ||
| 13 | + * Unless required by applicable law or agreed to in writing, software | ||
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 16 | + * See the License for the specific language governing permissions and | ||
| 17 | + * limitations under the License. | ||
| 18 | + * | ||
| 19 | + */ | ||
| 20 | + | ||
| 21 | +// EXTERNAL INCLUDES | ||
| 22 | +#include <dali/dali.h> | ||
| 23 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * Example app that can load both JSON and JavaScript files from command line | ||
| 27 | + * E.g. scripting.example my-first.js my-first.json | ||
| 28 | + * See dali-demo/resources/scripts for example JSON and JavaScript files | ||
| 29 | + */ | ||
| 30 | +class Launcher: public Dali::ConnectionTracker | ||
| 31 | +{ | ||
| 32 | +public: | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * @brief Construcctor | ||
| 36 | + * @param application application | ||
| 37 | + * @param layoutFileName JSON file to run | ||
| 38 | + * @param scriptFileName JavaScript file to run | ||
| 39 | + */ | ||
| 40 | + Launcher( Dali::Application application, std::string layoutFileName, std::string scriptFileName ); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * @brief destructor | ||
| 44 | + */ | ||
| 45 | + ~Launcher(); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * @brief create app | ||
| 49 | + */ | ||
| 50 | + void Create( Dali::Application& application ); | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * @brief run application MainLoop | ||
| 54 | + */ | ||
| 55 | + void MainLoop(); | ||
| 56 | + | ||
| 57 | +private: | ||
| 58 | + | ||
| 59 | + Dali::Toolkit::Script mScript; ///< Used to load and execute JavaScript | ||
| 60 | + Dali::Toolkit::Builder mBuilder; ///< Used to parse JSON | ||
| 61 | + Dali::Application mApplication; ///< application | ||
| 62 | + std::string mJSONFileName; ///< JSON filename | ||
| 63 | + std::string mJavaScriptFileName; ///< JavaScript filename | ||
| 64 | +}; | ||
| 65 | + | ||
| 66 | +#endif // header |
examples/scripting/scripting-example.cpp
0 โ 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +// EXTERNAL INCLUDES | ||
| 19 | +#include <string> | ||
| 20 | +#include <stdio.h> | ||
| 21 | +#include <sys/stat.h> | ||
| 22 | +#include <dali/integration-api/debug.h> | ||
| 23 | + | ||
| 24 | +// INTERNAL INCLUDES | ||
| 25 | +#include "launcher.h" | ||
| 26 | + | ||
| 27 | +namespace | ||
| 28 | +{ | ||
| 29 | +bool CheckIfFileExists( const std::string& filename ) | ||
| 30 | +{ | ||
| 31 | + struct stat buf; | ||
| 32 | + // fstat returns -1 on error | ||
| 33 | + if (stat( filename.c_str(), &buf) != -1) | ||
| 34 | + { | ||
| 35 | + return true; | ||
| 36 | + } | ||
| 37 | + return false; | ||
| 38 | +} | ||
| 39 | + | ||
| 40 | +} | ||
| 41 | +int main( int argc, char* argv[] ) | ||
| 42 | +{ | ||
| 43 | + // pull out the JSON file and JavaScript file from the command line arguments | ||
| 44 | + std::string javaScriptFileName; | ||
| 45 | + std::string jSONFileName; | ||
| 46 | + | ||
| 47 | + for( int i = 1 ; i < argc ; ++i ) | ||
| 48 | + { | ||
| 49 | + std::string arg( argv[i] ); | ||
| 50 | + | ||
| 51 | + size_t idx = std::string::npos; | ||
| 52 | + | ||
| 53 | + idx = arg.find( ".json" ); | ||
| 54 | + if( idx != std::string::npos ) | ||
| 55 | + { | ||
| 56 | + jSONFileName = arg; | ||
| 57 | + } | ||
| 58 | + else | ||
| 59 | + { | ||
| 60 | + idx = arg.find( ".js" ); | ||
| 61 | + if( idx != std::string::npos ) | ||
| 62 | + { | ||
| 63 | + javaScriptFileName = arg; | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + if( !jSONFileName.empty() ) | ||
| 69 | + { | ||
| 70 | + bool exists = CheckIfFileExists( jSONFileName ); | ||
| 71 | + if( !exists ) | ||
| 72 | + { | ||
| 73 | + DALI_ASSERT_ALWAYS( 0 && "JSON file not found ") | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + if( !javaScriptFileName.empty() ) | ||
| 77 | + { | ||
| 78 | + bool exists = CheckIfFileExists( javaScriptFileName ); | ||
| 79 | + if( !exists ) | ||
| 80 | + { | ||
| 81 | + DALI_ASSERT_ALWAYS( 0 && "JavaScript file not found ") | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + if( jSONFileName.empty() && javaScriptFileName.empty() ) | ||
| 85 | + { | ||
| 86 | + printf("Please specify a JSON and/or JavaScript file to load, e.g. scripting.example mylayout.json my-test.js\n"); | ||
| 87 | + return -1; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + | ||
| 91 | + Launcher daliApplication( Dali::Application::New( &argc, &argv ), jSONFileName, javaScriptFileName ); | ||
| 92 | + | ||
| 93 | + daliApplication.MainLoop(); | ||
| 94 | + | ||
| 95 | + return 0; | ||
| 96 | +} |
examples/scroll-view/scroll-view-example.cpp
| @@ -141,7 +141,7 @@ const Vector3 ANCHOR_3DEFFECT_STYLE1(65.0f, -70.0f, -300.0f); ///< Rotation Anch | @@ -141,7 +141,7 @@ const Vector3 ANCHOR_3DEFFECT_STYLE1(65.0f, -70.0f, -300.0f); ///< Rotation Anch | ||
| 141 | const unsigned int IMAGE_THUMBNAIL_WIDTH = 256; ///< Width of Thumbnail Image in texels | 141 | const unsigned int IMAGE_THUMBNAIL_WIDTH = 256; ///< Width of Thumbnail Image in texels |
| 142 | const unsigned int IMAGE_THUMBNAIL_HEIGHT = 256; ///< Height of Thumbnail Image in texels | 142 | const unsigned int IMAGE_THUMBNAIL_HEIGHT = 256; ///< Height of Thumbnail Image in texels |
| 143 | 143 | ||
| 144 | -const float SPIN_DURATION = 5.0f; ///< Times to spin an Image by upon touching, each spin taking a second. | 144 | +const float SPIN_DURATION = 1.0f; ///< Times to spin an Image by upon touching, each spin taking a second. |
| 145 | 145 | ||
| 146 | const float EFFECT_SNAP_DURATION(0.66f); ///< Scroll Snap Duration for Effects | 146 | const float EFFECT_SNAP_DURATION(0.66f); ///< Scroll Snap Duration for Effects |
| 147 | const float EFFECT_FLICK_DURATION(0.5f); ///< Scroll Flick Duration for Effects | 147 | const float EFFECT_FLICK_DURATION(0.5f); ///< Scroll Flick Duration for Effects |
| @@ -226,6 +226,7 @@ private: | @@ -226,6 +226,7 @@ private: | ||
| 226 | Vector2 stageSize = stage.GetSize(); | 226 | Vector2 stageSize = stage.GetSize(); |
| 227 | 227 | ||
| 228 | mScrollView = ScrollView::New(); | 228 | mScrollView = ScrollView::New(); |
| 229 | + mScrollView.SetRelayoutEnabled( false ); | ||
| 229 | mScrollView.SetAnchorPoint(AnchorPoint::CENTER); | 230 | mScrollView.SetAnchorPoint(AnchorPoint::CENTER); |
| 230 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); | 231 | mScrollView.SetParentOrigin(ParentOrigin::CENTER); |
| 231 | mContentLayer.Add( mScrollView ); | 232 | mContentLayer.Add( mScrollView ); |
| @@ -298,7 +299,8 @@ private: | @@ -298,7 +299,8 @@ private: | ||
| 298 | Actor CreatePage() | 299 | Actor CreatePage() |
| 299 | { | 300 | { |
| 300 | Actor page = Actor::New(); | 301 | Actor page = Actor::New(); |
| 301 | - page.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 302 | + page.SetRelayoutEnabled( true ); |
| 303 | + page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 302 | page.SetParentOrigin( ParentOrigin::CENTER ); | 304 | page.SetParentOrigin( ParentOrigin::CENTER ); |
| 303 | page.SetAnchorPoint( AnchorPoint::CENTER ); | 305 | page.SetAnchorPoint( AnchorPoint::CENTER ); |
| 304 | 306 | ||
| @@ -450,7 +452,8 @@ private: | @@ -450,7 +452,8 @@ private: | ||
| 450 | void ApplyEffectToPage(Actor page) | 452 | void ApplyEffectToPage(Actor page) |
| 451 | { | 453 | { |
| 452 | page.RemoveConstraints(); | 454 | page.RemoveConstraints(); |
| 453 | - page.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 455 | + page.SetRelayoutEnabled( true ); |
| 456 | + page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 454 | 457 | ||
| 455 | switch( mEffectMode ) | 458 | switch( mEffectMode ) |
| 456 | { | 459 | { |
| @@ -566,6 +569,7 @@ private: | @@ -566,6 +569,7 @@ private: | ||
| 566 | attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); | 569 | attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); |
| 567 | Image img = ResourceImage::New(filename, attributes); | 570 | Image img = ResourceImage::New(filename, attributes); |
| 568 | ImageActor actor = ImageActor::New(img); | 571 | ImageActor actor = ImageActor::New(img); |
| 572 | + actor.SetRelayoutEnabled( false ); | ||
| 569 | actor.SetName( filename ); | 573 | actor.SetName( filename ); |
| 570 | actor.SetParentOrigin(ParentOrigin::CENTER); | 574 | actor.SetParentOrigin(ParentOrigin::CENTER); |
| 571 | actor.SetAnchorPoint(AnchorPoint::CENTER); | 575 | actor.SetAnchorPoint(AnchorPoint::CENTER); |
| @@ -609,7 +613,7 @@ private: | @@ -609,7 +613,7 @@ private: | ||
| 609 | { | 613 | { |
| 610 | // Spin the Image a few times. | 614 | // Spin the Image a few times. |
| 611 | Animation animation = Animation::New(SPIN_DURATION); | 615 | Animation animation = Animation::New(SPIN_DURATION); |
| 612 | - animation.RotateBy( actor, Degree(360.0f * SPIN_DURATION), Vector3::XAXIS, AlphaFunctions::EaseOut); | 616 | + animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree(360.0f * SPIN_DURATION) ), Vector3::XAXIS ), AlphaFunctions::EaseOut ); |
| 613 | animation.Play(); | 617 | animation.Play(); |
| 614 | } | 618 | } |
| 615 | } | 619 | } |
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
| @@ -213,7 +213,8 @@ public: | @@ -213,7 +213,8 @@ public: | ||
| 213 | mShadowView.SetName("Container"); | 213 | mShadowView.SetName("Container"); |
| 214 | mShadowView.SetParentOrigin(ParentOrigin::CENTER); | 214 | mShadowView.SetParentOrigin(ParentOrigin::CENTER); |
| 215 | mShadowView.SetAnchorPoint(AnchorPoint::CENTER); | 215 | mShadowView.SetAnchorPoint(AnchorPoint::CENTER); |
| 216 | - mShadowView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); | 216 | + mShadowView.SetRelayoutEnabled( true ); |
| 217 | + mShadowView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 217 | mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f); | 218 | mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f); |
| 218 | mContents.Add(mShadowView); | 219 | mContents.Add(mShadowView); |
| 219 | 220 | ||
| @@ -271,6 +272,9 @@ public: | @@ -271,6 +272,9 @@ public: | ||
| 271 | mImageActor2 = ImageActor::New( ResourceImage::New(SCENE_IMAGE_2) ); | 272 | mImageActor2 = ImageActor::New( ResourceImage::New(SCENE_IMAGE_2) ); |
| 272 | mImageActor3 = ImageActor::New( ResourceImage::New(SCENE_IMAGE_3) ); | 273 | mImageActor3 = ImageActor::New( ResourceImage::New(SCENE_IMAGE_3) ); |
| 273 | 274 | ||
| 275 | + mImageActor1.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); | ||
| 276 | + mImageActor2.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); | ||
| 277 | + mImageActor3.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); | ||
| 274 | 278 | ||
| 275 | mImageActor2.SetParentOrigin(ParentOrigin::CENTER); | 279 | mImageActor2.SetParentOrigin(ParentOrigin::CENTER); |
| 276 | 280 |
examples/size-negotiation/size-negotiation-example.cpp
0 โ 100644
| 1 | +/* | ||
| 2 | + * Copyright (c) 2014 Samsung Electronics Co., Ltd. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +#include "shared/view.h" | ||
| 19 | +#include <dali/dali.h> | ||
| 20 | +#include <dali-toolkit/dali-toolkit.h> | ||
| 21 | + | ||
| 22 | +using namespace Dali; | ||
| 23 | + | ||
| 24 | +// Define this so that it is interchangeable | ||
| 25 | +// "DP" stands for Device independent Pixels | ||
| 26 | +#define DP(x) DemoHelper::ScalePointSize(x) | ||
| 27 | + | ||
| 28 | +struct ButtonItem | ||
| 29 | +{ | ||
| 30 | + const char* name; | ||
| 31 | + const char* text; | ||
| 32 | +}; | ||
| 33 | + | ||
| 34 | + | ||
| 35 | +namespace | ||
| 36 | +{ | ||
| 37 | + | ||
| 38 | +const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "background-gradient.jpg"; | ||
| 39 | +const char* const TOOLBAR_IMAGE = DALI_IMAGE_DIR "top-bar.png"; | ||
| 40 | + | ||
| 41 | +const char* const TOOLBAR_TITLE = "Size Negotiation"; | ||
| 42 | +const int TOOLBAR_HEIGHT = 62; | ||
| 43 | + | ||
| 44 | +const char* MENU_ICON_IMAGE = DALI_IMAGE_DIR "icon-cluster-none.png"; | ||
| 45 | + | ||
| 46 | +const char* const PUSHBUTTON_BUTTON_IMAGE = DALI_IMAGE_DIR "button-up.9.png"; | ||
| 47 | +const char* const PUSHBUTTON_PRESS_IMAGE = DALI_IMAGE_DIR "button-down.9.png"; | ||
| 48 | + | ||
| 49 | +const char* const POPUPS_MENU_ID = "POPUPS_MENU"; | ||
| 50 | +const char* const TABLEVIEW_MENU_ID = "TABLEVIEW_MENU"; | ||
| 51 | + | ||
| 52 | +const char* const POPUP_BUTTON_EMPTY_ID = "POPUP_BUTTON_EMPTY"; | ||
| 53 | +const char* const POPUP_BUTTON_TITLE_ID = "POPUP_BUTTON_TITLE"; | ||
| 54 | +const char* const POPUP_BUTTON_BUTTONS_1_ID = "POPUP_BUTTON_BUTTONS_1"; | ||
| 55 | +const char* const POPUP_BUTTON_BUTTONS_2_ID = "POPUP_BUTTON_BUTTONS_2"; | ||
| 56 | +const char* const POPUP_BUTTON_TITLE_BUTTONS_ID = "POPUP_BUTTON_TITLE_BUTTONS"; | ||
| 57 | +const char* const POPUP_BUTTON_CONTENT_TEXT_ID = "POPUP_BUTTON_CONTENT_TEXT"; | ||
| 58 | +const char* const POPUP_BUTTON_CONTENT_IMAGE_ID = "POPUP_BUTTON_CONTENT_IMAGE"; | ||
| 59 | +const char* const POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID = "POPUP_BUTTON_CONTENT_IMAGE_SCALE"; | ||
| 60 | +const char* const POPUP_BUTTON_CONTENT_IMAGE_FIT_ID = "POPUP_BUTTON_CONTENT_IMAGE_FIT"; | ||
| 61 | +const char* const POPUP_BUTTON_CONTENT_IMAGE_FILL_ID = "POPUP_BUTTON_CONTENT_IMAGE_FILL"; | ||
| 62 | +const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_ID = "POPUP_BUTTON_TITLE_CONTENT_TEXT"; | ||
| 63 | +const char* const POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID = "POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS"; | ||
| 64 | +const char* const POPUP_BUTTON_COMPLEX_ID = "POPUP_BUTTON_COMPLEX"; | ||
| 65 | + | ||
| 66 | +const char* const TABLEVIEW_BUTTON_EMPTY_ID = "TABLEVIEW_BUTTON_EMPTY"; | ||
| 67 | +const char* const TABLEVIEW_BUTTON_1CELL_ID = "TABLEVIEW_BUTTON_1CELL"; | ||
| 68 | +const char* const TABLEVIEW_BUTTON_3CELL_ID = "TABLEVIEW_BUTTON_3CELL"; | ||
| 69 | +const char* const TABLEVIEW_BUTTON_3X3CELL_ID = "TABLEVIEW_BUTTON_3X3CELL"; | ||
| 70 | +const char* const TABLEVIEW_BUTTON_FIXED1_ID = "TABLEVIEW_BUTTON_FIXED1"; | ||
| 71 | +const char* const TABLEVIEW_BUTTON_FIXED2_ID = "TABLEVIEW_BUTTON_FIXED2"; | ||
| 72 | +const char* const TABLEVIEW_BUTTON_FIT1_ID = "TABLEVIEW_BUTTON_FIT1"; | ||
| 73 | +const char* const TABLEVIEW_BUTTON_FIT2_ID = "TABLEVIEW_BUTTON_FIT2"; | ||
| 74 | +const char* const TABLEVIEW_BUTTON_NATURAL1_ID = "TABLEVIEW_BUTTON_NATURAL1"; | ||
| 75 | +const char* const TABLEVIEW_BUTTON_NATURAL2_ID = "TABLEVIEW_BUTTON_NATURAL2"; | ||
| 76 | +const char* const TABLEVIEW_BUTTON_NATURAL3_ID = "TABLEVIEW_BUTTON_NATURAL3"; | ||
| 77 | + | ||
| 78 | +const char* const OKAY_BUTTON_ID = "OKAY_BUTTON"; | ||
| 79 | +const char* const CANCEL_BUTTON_ID = "CANCEL_BUTTON"; | ||
| 80 | + | ||
| 81 | +const char* const CONTENT_TEXT = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; | ||
| 82 | +const char* const IMAGE1 = DALI_IMAGE_DIR "gallery-medium-5.jpg"; | ||
| 83 | +const char* const IMAGE2 = DALI_IMAGE_DIR "background-magnifier.jpg"; | ||
| 84 | +const char* const CHECKBOX_UNCHECKED_IMAGE = DALI_IMAGE_DIR "checkbox-unselected.png"; | ||
| 85 | +const char* const CHECKBOX_CHECKED_IMAGE = DALI_IMAGE_DIR "checkbox-selected.png"; | ||
| 86 | + | ||
| 87 | +const ButtonItem MENU_ITEMS[] = { | ||
| 88 | + { POPUPS_MENU_ID, "Popups" }, | ||
| 89 | + { TABLEVIEW_MENU_ID, "TableView" } | ||
| 90 | +}; | ||
| 91 | + | ||
| 92 | +const unsigned int MENU_ITEMS_COUNT = sizeof( MENU_ITEMS ) / sizeof( MENU_ITEMS[0] ); | ||
| 93 | + | ||
| 94 | +const ButtonItem POPUP_BUTTON_ITEMS[] = { | ||
| 95 | + { POPUP_BUTTON_COMPLEX_ID, "Complex" }, | ||
| 96 | + { POPUP_BUTTON_EMPTY_ID, "Empty" }, | ||
| 97 | + { POPUP_BUTTON_TITLE_ID, "Title" }, | ||
| 98 | + { POPUP_BUTTON_BUTTONS_1_ID, "1 Button" }, | ||
| 99 | + { POPUP_BUTTON_BUTTONS_2_ID, "2 Buttons" }, | ||
| 100 | + { POPUP_BUTTON_TITLE_BUTTONS_ID, "Title & Buttons" }, | ||
| 101 | + { POPUP_BUTTON_CONTENT_TEXT_ID, "Text" }, | ||
| 102 | + { POPUP_BUTTON_CONTENT_IMAGE_ID, "Image" }, | ||
| 103 | + { POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID, "Image Scale" }, | ||
| 104 | + { POPUP_BUTTON_CONTENT_IMAGE_FIT_ID, "Image Fit" }, | ||
| 105 | + { POPUP_BUTTON_CONTENT_IMAGE_FILL_ID, "Image Fill" }, | ||
| 106 | + { POPUP_BUTTON_TITLE_CONTENT_TEXT_ID, "Title Text" }, | ||
| 107 | + { POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID, "Title, text, buttons" } | ||
| 108 | + | ||
| 109 | +}; | ||
| 110 | + | ||
| 111 | +const int POPUP_BUTTON_ITEMS_COUNT = sizeof( POPUP_BUTTON_ITEMS ) / sizeof( POPUP_BUTTON_ITEMS[0] ); | ||
| 112 | + | ||
| 113 | +const ButtonItem TABLEVIEW_BUTTON_ITEMS[] = { | ||
| 114 | + { TABLEVIEW_BUTTON_EMPTY_ID, "Empty" }, | ||
| 115 | + { TABLEVIEW_BUTTON_1CELL_ID, "1 Cell" }, | ||
| 116 | + { TABLEVIEW_BUTTON_3CELL_ID, "3 Cell" }, | ||
| 117 | + { TABLEVIEW_BUTTON_3X3CELL_ID, "3x3 Cells" }, | ||
| 118 | + { TABLEVIEW_BUTTON_FIXED1_ID, "Fixed 1" }, | ||
| 119 | + { TABLEVIEW_BUTTON_FIXED2_ID, "Fixed 2" }, | ||
| 120 | + { TABLEVIEW_BUTTON_FIT1_ID, "Fit Top Bottom" }, | ||
| 121 | + { TABLEVIEW_BUTTON_FIT2_ID, "Fit Middle" }, | ||
| 122 | + { TABLEVIEW_BUTTON_NATURAL1_ID, "Natural 1" }, | ||
| 123 | + { TABLEVIEW_BUTTON_NATURAL2_ID, "Natural 2" }, | ||
| 124 | + { TABLEVIEW_BUTTON_NATURAL3_ID, "Natural 3" }, | ||
| 125 | +}; | ||
| 126 | + | ||
| 127 | +const unsigned int TABLEVIEW_BUTTON_ITEMS_COUNT = sizeof( TABLEVIEW_BUTTON_ITEMS ) / sizeof( TABLEVIEW_BUTTON_ITEMS[0] ); | ||
| 128 | + | ||
| 129 | +} // namespace | ||
| 130 | + | ||
| 131 | + | ||
| 132 | + | ||
| 133 | +/** | ||
| 134 | + * This example shows the usage of size negotiation. | ||
| 135 | + */ | ||
| 136 | +class SizeNegotiationController: public ConnectionTracker, public Toolkit::ItemFactory | ||
| 137 | +{ | ||
| 138 | +public: | ||
| 139 | + | ||
| 140 | + SizeNegotiationController( Application& application ) | ||
| 141 | + : mApplication( application ), | ||
| 142 | + mMenuShown( false ), | ||
| 143 | + mDemoState( POPUP ) | ||
| 144 | + { | ||
| 145 | + // Connect to the Application's Init signal | ||
| 146 | + mApplication.InitSignal().Connect( this, &SizeNegotiationController::Create ); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + ~SizeNegotiationController() | ||
| 150 | + { | ||
| 151 | + // Nothing to do here | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + void Create( Application& application ) | ||
| 155 | + { | ||
| 156 | + // The Init signal is received once (only) during the Application lifetime | ||
| 157 | + | ||
| 158 | + Stage stage = Stage::GetCurrent(); | ||
| 159 | + | ||
| 160 | + // Respond to key events | ||
| 161 | + stage.KeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent); | ||
| 162 | + | ||
| 163 | + // Creates a default view with a default tool bar. | ||
| 164 | + // The view is added to the stage. | ||
| 165 | + mContentLayer = DemoHelper::CreateView( application, | ||
| 166 | + mView, | ||
| 167 | + mToolBar, | ||
| 168 | + BACKGROUND_IMAGE, | ||
| 169 | + TOOLBAR_IMAGE, | ||
| 170 | + std::string("") ); | ||
| 171 | + | ||
| 172 | + mTitleActor = Dali::Toolkit::TextView::New(); | ||
| 173 | + mTitleActor.SetName( "CUSTOM_TOOLBAR_TITLE" ); | ||
| 174 | + | ||
| 175 | + SetTitle(); | ||
| 176 | + | ||
| 177 | + // Create menu button | ||
| 178 | + Toolkit::PushButton viewButton = Toolkit::PushButton::New(); | ||
| 179 | + viewButton.SetBackgroundImage( ResourceImage::New( MENU_ICON_IMAGE ) ); | ||
| 180 | + viewButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenu ); | ||
| 181 | + mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ||
| 182 | + | ||
| 183 | + // Add title to the tool bar. | ||
| 184 | + const float padding( DemoHelper::DEFAULT_VIEW_STYLE.mToolBarPadding ); | ||
| 185 | + mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::Padding( padding, padding, padding, padding ) ); | ||
| 186 | + | ||
| 187 | + mItemView = Toolkit::ItemView::New( *this ); | ||
| 188 | + mItemView.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 189 | + mItemView.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 190 | + mItemView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 191 | + | ||
| 192 | + // Use a grid layout for tests | ||
| 193 | + Toolkit::GridLayoutPtr gridLayout = Toolkit::GridLayout::New(); | ||
| 194 | + gridLayout->SetNumberOfColumns( 2 ); | ||
| 195 | + gridLayout->SetTopMargin( DP(TOOLBAR_HEIGHT) + DP(20.0f) ); | ||
| 196 | + gridLayout->SetBottomMargin( DP(100.0f) ); | ||
| 197 | + gridLayout->SetRowSpacing( DP(20.0f) ); | ||
| 198 | + mItemView.AddLayout( *gridLayout ); | ||
| 199 | + | ||
| 200 | + Vector2 stageSize = stage.GetSize(); | ||
| 201 | + float layoutWidth = Toolkit::IsHorizontal( gridLayout->GetOrientation() ) ? stageSize.height : stageSize.width; | ||
| 202 | + float gridItemSize = ( layoutWidth / gridLayout->GetNumberOfColumns() ) * 0.5f; | ||
| 203 | + gridLayout->SetScrollSpeedFactor( gridLayout->GetNumberOfColumns() / gridItemSize * 0.5f ); | ||
| 204 | + | ||
| 205 | + mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f ); | ||
| 206 | + | ||
| 207 | + mContentLayer.Add( mItemView ); | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + void SetTitle() | ||
| 211 | + { | ||
| 212 | + std::string subTitle = ""; | ||
| 213 | + | ||
| 214 | + switch( mDemoState ) | ||
| 215 | + { | ||
| 216 | + case POPUP: | ||
| 217 | + { | ||
| 218 | + subTitle = "Popups"; | ||
| 219 | + break; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + case TABLEVIEW: | ||
| 223 | + { | ||
| 224 | + subTitle = "TableView"; | ||
| 225 | + break; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + default: | ||
| 229 | + { | ||
| 230 | + break; | ||
| 231 | + } | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + mTitleActor.SetText( std::string( TOOLBAR_TITLE ) + ": " + subTitle ); | ||
| 235 | + mTitleActor.SetStyleToCurrentText( DemoHelper::GetDefaultTextStyle() ); | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + bool OnMenu( Toolkit::Button button ) | ||
| 239 | + { | ||
| 240 | + ShowMenu(); | ||
| 241 | + return true; | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + void ShowMenu() | ||
| 245 | + { | ||
| 246 | + Stage stage = Stage::GetCurrent(); | ||
| 247 | + const float popupWidth = stage.GetSize().x * 0.5f; | ||
| 248 | + | ||
| 249 | + mMenu = Toolkit::Popup::New(); | ||
| 250 | + mMenu.SetParentOrigin( ParentOrigin::TOP_LEFT ); | ||
| 251 | + mMenu.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | ||
| 252 | + mMenu.HideTail(); | ||
| 253 | + mMenu.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::HideMenu ); | ||
| 254 | + mMenu.SetSize( popupWidth, 0.0f ); | ||
| 255 | + mMenu.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); | ||
| 256 | + | ||
| 257 | + Toolkit::TableView tableView = Toolkit::TableView::New( 0, 0 ); | ||
| 258 | + tableView.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 259 | + tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); | ||
| 260 | + mMenu.Add( tableView ); | ||
| 261 | + | ||
| 262 | + for( unsigned int i = 0; i < MENU_ITEMS_COUNT; ++i ) | ||
| 263 | + { | ||
| 264 | + Toolkit::PushButton menuButton = Toolkit::PushButton::New(); | ||
| 265 | + menuButton.SetName( MENU_ITEMS[ i ].name ); | ||
| 266 | + menuButton.SetLabel( MENU_ITEMS[ i ].text ); | ||
| 267 | + menuButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenuSelect ); | ||
| 268 | + | ||
| 269 | + tableView.Add( menuButton ); | ||
| 270 | + tableView.SetFitHeight( i ); | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + // Show the menu | ||
| 274 | + mMenu.Show(); | ||
| 275 | + mMenuShown = true; | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + void HideMenu() | ||
| 279 | + { | ||
| 280 | + if( mMenu ) | ||
| 281 | + { | ||
| 282 | + mMenu.Hide(); | ||
| 283 | + mMenu.Reset(); | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + mMenuShown = false; | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + bool OnMenuSelect( Toolkit::Button button ) | ||
| 290 | + { | ||
| 291 | + bool refresh = false; | ||
| 292 | + | ||
| 293 | + if( button.GetName() == POPUPS_MENU_ID ) | ||
| 294 | + { | ||
| 295 | + if( mDemoState != POPUP ) | ||
| 296 | + { | ||
| 297 | + refresh = true; | ||
| 298 | + mDemoState = POPUP; | ||
| 299 | + } | ||
| 300 | + } | ||
| 301 | + else if( button.GetName() == TABLEVIEW_MENU_ID ) | ||
| 302 | + { | ||
| 303 | + if( mDemoState != TABLEVIEW ) | ||
| 304 | + { | ||
| 305 | + refresh = true; | ||
| 306 | + mDemoState = TABLEVIEW; | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + if( refresh ) | ||
| 311 | + { | ||
| 312 | + SetTitle(); | ||
| 313 | + | ||
| 314 | + mItemView.Refresh(); | ||
| 315 | + } | ||
| 316 | + | ||
| 317 | + HideMenu(); | ||
| 318 | + return true; | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + Toolkit::Popup CreatePopup() | ||
| 322 | + { | ||
| 323 | + Stage stage = Stage::GetCurrent(); | ||
| 324 | + const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f; | ||
| 325 | + | ||
| 326 | + Toolkit::Popup popup = Toolkit::Popup::New(); | ||
| 327 | + popup.SetName( "POPUP" ); | ||
| 328 | + popup.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 329 | + popup.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 330 | + popup.SetSize( POPUP_WIDTH_DP, 0.0f ); | ||
| 331 | + popup.HideTail(); | ||
| 332 | + | ||
| 333 | + popup.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::OnPopupOutsideTouched ); | ||
| 334 | + | ||
| 335 | + return popup; | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + bool OnButtonClicked( Toolkit::Button button ) | ||
| 339 | + { | ||
| 340 | + if( button.GetName() == POPUP_BUTTON_EMPTY_ID ) | ||
| 341 | + { | ||
| 342 | + mPopup = CreatePopup(); | ||
| 343 | + | ||
| 344 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 345 | + mPopup.MarkDirtyForRelayout(); | ||
| 346 | + | ||
| 347 | + mPopup.Show(); | ||
| 348 | + } | ||
| 349 | + else if( button.GetName() == POPUP_BUTTON_TITLE_ID ) | ||
| 350 | + { | ||
| 351 | + mPopup = CreatePopup(); | ||
| 352 | + mPopup.SetTitle( "Popup!" ); | ||
| 353 | + | ||
| 354 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 355 | + mPopup.MarkDirtyForRelayout(); | ||
| 356 | + | ||
| 357 | + mPopup.Show(); | ||
| 358 | + } | ||
| 359 | + else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID ) | ||
| 360 | + { | ||
| 361 | + mPopup = CreatePopup(); | ||
| 362 | + | ||
| 363 | + Toolkit::PushButton okayButton = Toolkit::PushButton::New(); | ||
| 364 | + okayButton.SetName( OKAY_BUTTON_ID ); | ||
| 365 | + okayButton.SetLabel( "OK!" ); | ||
| 366 | + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 367 | + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 368 | + | ||
| 369 | + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 370 | + | ||
| 371 | + mPopup.AddButton( okayButton ); | ||
| 372 | + | ||
| 373 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 374 | + mPopup.MarkDirtyForRelayout(); | ||
| 375 | + | ||
| 376 | + mPopup.Show(); | ||
| 377 | + } | ||
| 378 | + else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID ) | ||
| 379 | + { | ||
| 380 | + mPopup = CreatePopup(); | ||
| 381 | + | ||
| 382 | + Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); | ||
| 383 | + cancelButton.SetName( CANCEL_BUTTON_ID ); | ||
| 384 | + cancelButton.SetLabel( "Cancel" ); | ||
| 385 | + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 386 | + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 387 | + | ||
| 388 | + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 389 | + | ||
| 390 | + mPopup.AddButton( cancelButton ); | ||
| 391 | + | ||
| 392 | + Toolkit::PushButton okayButton = Toolkit::PushButton::New(); | ||
| 393 | + okayButton.SetName( OKAY_BUTTON_ID ); | ||
| 394 | + okayButton.SetLabel( "OK!" ); | ||
| 395 | + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 396 | + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 397 | + | ||
| 398 | + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 399 | + | ||
| 400 | + mPopup.AddButton( okayButton ); | ||
| 401 | + | ||
| 402 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 403 | + mPopup.MarkDirtyForRelayout(); | ||
| 404 | + | ||
| 405 | + mPopup.Show(); | ||
| 406 | + } | ||
| 407 | + else if( button.GetName() == POPUP_BUTTON_TITLE_BUTTONS_ID ) | ||
| 408 | + { | ||
| 409 | + mPopup = CreatePopup(); | ||
| 410 | + mPopup.SetTitle( "Popup!" ); | ||
| 411 | + | ||
| 412 | + Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); | ||
| 413 | + cancelButton.SetName( CANCEL_BUTTON_ID ); | ||
| 414 | + cancelButton.SetLabel( "Cancel" ); | ||
| 415 | + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 416 | + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 417 | + | ||
| 418 | + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 419 | + | ||
| 420 | + mPopup.AddButton( cancelButton ); | ||
| 421 | + | ||
| 422 | + Toolkit::PushButton okayButton = Toolkit::PushButton::New(); | ||
| 423 | + okayButton.SetName( OKAY_BUTTON_ID ); | ||
| 424 | + okayButton.SetLabel( "OK!" ); | ||
| 425 | + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 426 | + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 427 | + | ||
| 428 | + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 429 | + | ||
| 430 | + mPopup.AddButton( okayButton ); | ||
| 431 | + | ||
| 432 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 433 | + mPopup.MarkDirtyForRelayout(); | ||
| 434 | + | ||
| 435 | + mPopup.Show(); | ||
| 436 | + } | ||
| 437 | + else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID ) | ||
| 438 | + { | ||
| 439 | + mPopup = CreatePopup(); | ||
| 440 | + | ||
| 441 | + Toolkit::TextView text = Toolkit::TextView::New(); | ||
| 442 | + text.SetName( "POPUP_CONTENT_TEXT" ); | ||
| 443 | + text.SetText( CONTENT_TEXT ); | ||
| 444 | + text.SetMultilinePolicy( Toolkit::TextView::SplitByWord ); | ||
| 445 | + text.SetWidthExceedPolicy( Toolkit::TextView::Split ); | ||
| 446 | + text.SetLineJustification( Toolkit::TextView::Center ); | ||
| 447 | + text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 448 | + text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); | ||
| 449 | + text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) ); | ||
| 450 | + | ||
| 451 | + mPopup.Add( text ); | ||
| 452 | + | ||
| 453 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 454 | + mPopup.MarkDirtyForRelayout(); | ||
| 455 | + | ||
| 456 | + mPopup.Show(); | ||
| 457 | + } | ||
| 458 | + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID ) | ||
| 459 | + { | ||
| 460 | + mPopup = CreatePopup(); | ||
| 461 | + | ||
| 462 | + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) ); | ||
| 463 | + image.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 464 | + image.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); | ||
| 465 | + image.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) ); | ||
| 466 | + | ||
| 467 | + mPopup.Add( image ); | ||
| 468 | + | ||
| 469 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 470 | + mPopup.MarkDirtyForRelayout(); | ||
| 471 | + | ||
| 472 | + mPopup.Show(); | ||
| 473 | + } | ||
| 474 | + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID ) | ||
| 475 | + { | ||
| 476 | + mPopup = CreatePopup(); | ||
| 477 | + | ||
| 478 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 479 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 480 | + | ||
| 481 | + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) ); | ||
| 482 | + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 483 | + | ||
| 484 | + mPopup.Add( image ); | ||
| 485 | + | ||
| 486 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 487 | + mPopup.MarkDirtyForRelayout(); | ||
| 488 | + | ||
| 489 | + mPopup.Show(); | ||
| 490 | + } | ||
| 491 | + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID ) | ||
| 492 | + { | ||
| 493 | + mPopup = CreatePopup(); | ||
| 494 | + | ||
| 495 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 496 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 497 | + | ||
| 498 | + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) ); | ||
| 499 | + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 500 | + image.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO ); | ||
| 501 | + | ||
| 502 | + mPopup.Add( image ); | ||
| 503 | + | ||
| 504 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 505 | + mPopup.MarkDirtyForRelayout(); | ||
| 506 | + | ||
| 507 | + mPopup.Show(); | ||
| 508 | + } | ||
| 509 | + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID ) | ||
| 510 | + { | ||
| 511 | + mPopup = CreatePopup(); | ||
| 512 | + | ||
| 513 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 514 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 515 | + | ||
| 516 | + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) ); | ||
| 517 | + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 518 | + image.SetSizeScalePolicy( FILL_WITH_ASPECT_RATIO ); | ||
| 519 | + | ||
| 520 | + mPopup.Add( image ); | ||
| 521 | + | ||
| 522 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 523 | + mPopup.MarkDirtyForRelayout(); | ||
| 524 | + | ||
| 525 | + mPopup.Show(); | ||
| 526 | + } | ||
| 527 | + else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID ) | ||
| 528 | + { | ||
| 529 | + mPopup = CreatePopup(); | ||
| 530 | + mPopup.SetTitle( "Popup!" ); | ||
| 531 | + | ||
| 532 | + Toolkit::TextView text = Toolkit::TextView::New(); | ||
| 533 | + text.SetName( "POPUP_CONTENT_TEXT" ); | ||
| 534 | + text.SetText( CONTENT_TEXT ); | ||
| 535 | + text.SetMultilinePolicy( Toolkit::TextView::SplitByWord ); | ||
| 536 | + text.SetWidthExceedPolicy( Toolkit::TextView::Split ); | ||
| 537 | + text.SetLineJustification( Toolkit::TextView::Center ); | ||
| 538 | + text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 539 | + text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); | ||
| 540 | + text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) ); | ||
| 541 | + | ||
| 542 | + mPopup.Add( text ); | ||
| 543 | + | ||
| 544 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 545 | + mPopup.MarkDirtyForRelayout(); | ||
| 546 | + | ||
| 547 | + mPopup.Show(); | ||
| 548 | + } | ||
| 549 | + else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID ) | ||
| 550 | + { | ||
| 551 | + mPopup = CreatePopup(); | ||
| 552 | + mPopup.SetTitle( "Popup!" ); | ||
| 553 | + | ||
| 554 | + Toolkit::TextView text = Toolkit::TextView::New(); | ||
| 555 | + text.SetName( "POPUP_CONTENT_TEXT" ); | ||
| 556 | + text.SetText( CONTENT_TEXT ); | ||
| 557 | + text.SetMultilinePolicy( Toolkit::TextView::SplitByWord ); | ||
| 558 | + text.SetWidthExceedPolicy( Toolkit::TextView::Split ); | ||
| 559 | + text.SetLineJustification( Toolkit::TextView::Left ); | ||
| 560 | + text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 561 | + text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); | ||
| 562 | + text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) ); | ||
| 563 | + | ||
| 564 | + mPopup.Add( text ); | ||
| 565 | + | ||
| 566 | + Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); | ||
| 567 | + cancelButton.SetName( CANCEL_BUTTON_ID ); | ||
| 568 | + cancelButton.SetLabel( "Cancel" ); | ||
| 569 | + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 570 | + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 571 | + | ||
| 572 | + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 573 | + | ||
| 574 | + mPopup.AddButton( cancelButton ); | ||
| 575 | + | ||
| 576 | + Toolkit::PushButton okayButton = Toolkit::PushButton::New(); | ||
| 577 | + okayButton.SetName( OKAY_BUTTON_ID ); | ||
| 578 | + okayButton.SetLabel( "OK!" ); | ||
| 579 | + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 580 | + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 581 | + | ||
| 582 | + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 583 | + | ||
| 584 | + mPopup.AddButton( okayButton ); | ||
| 585 | + | ||
| 586 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 587 | + mPopup.MarkDirtyForRelayout(); | ||
| 588 | + | ||
| 589 | + mPopup.Show(); | ||
| 590 | + } | ||
| 591 | + else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID ) | ||
| 592 | + { | ||
| 593 | + mPopup = CreatePopup(); | ||
| 594 | + mPopup.SetTitle( "Warning" ); | ||
| 595 | + | ||
| 596 | + // Content | ||
| 597 | + Toolkit::TableView content = Toolkit::TableView::New( 2, 2 ); | ||
| 598 | + content.SetName( "COMPLEX_TABLEVIEW" ); | ||
| 599 | + content.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 600 | + content.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); | ||
| 601 | + content.SetFitHeight( 0 ); | ||
| 602 | + content.SetFitHeight( 1 ); | ||
| 603 | + content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) ); | ||
| 604 | + | ||
| 605 | + // Text | ||
| 606 | + { | ||
| 607 | + Toolkit::TextView text = Toolkit::TextView::New(); | ||
| 608 | + text.SetText( "Do you really want to quit?" ); | ||
| 609 | + text.SetMultilinePolicy( Toolkit::TextView::SplitByWord ); | ||
| 610 | + text.SetWidthExceedPolicy( Toolkit::TextView::Split ); | ||
| 611 | + text.SetLineJustification( Toolkit::TextView::Left ); | ||
| 612 | + text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 613 | + text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); | ||
| 614 | + | ||
| 615 | + content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) ); | ||
| 616 | + } | ||
| 617 | + | ||
| 618 | + // Image | ||
| 619 | + { | ||
| 620 | + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE1 ) ); | ||
| 621 | + image.SetName( "COMPLEX_IMAGE" ); | ||
| 622 | + image.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 623 | + image.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); | ||
| 624 | + image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) ); | ||
| 625 | + content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); | ||
| 626 | + } | ||
| 627 | + | ||
| 628 | + // Text 2 | ||
| 629 | + { | ||
| 630 | + Toolkit::TableView root = Toolkit::TableView::New( 1, 2 ); | ||
| 631 | + root.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 632 | + root.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); | ||
| 633 | + root.SetFitHeight( 0 ); | ||
| 634 | + root.SetFitWidth( 0 ); | ||
| 635 | + root.SetPadding( Padding( 0.0f, 0.0f, 0.0f, 20.0f ) ); | ||
| 636 | + | ||
| 637 | + Dali::Image unchecked = Dali::ResourceImage::New( CHECKBOX_UNCHECKED_IMAGE ); | ||
| 638 | + Dali::Image checked = Dali::ResourceImage::New( CHECKBOX_CHECKED_IMAGE ); | ||
| 639 | + Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New(); | ||
| 640 | + checkBox.SetBackgroundImage( unchecked ); | ||
| 641 | + checkBox.SetSelectedImage( checked ); | ||
| 642 | + checkBox.SetSize( 48, 48 ); | ||
| 643 | + | ||
| 644 | + root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) ); | ||
| 645 | + | ||
| 646 | + Toolkit::TextView text = Toolkit::TextView::New(); | ||
| 647 | + text.SetText( "Don't show again" ); | ||
| 648 | + text.SetLineJustification( Toolkit::TextView::Left ); | ||
| 649 | + Actor textActor = text; | ||
| 650 | + textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) ); | ||
| 651 | + | ||
| 652 | + root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) ); | ||
| 653 | + | ||
| 654 | + content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0, 0, 2 ) ); // Column span 2 | ||
| 655 | + } | ||
| 656 | + | ||
| 657 | + mPopup.Add( content ); | ||
| 658 | + | ||
| 659 | + // Buttons | ||
| 660 | + Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); | ||
| 661 | + cancelButton.SetName( CANCEL_BUTTON_ID ); | ||
| 662 | + cancelButton.SetLabel( "Cancel" ); | ||
| 663 | + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 664 | + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 665 | + | ||
| 666 | + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 667 | + | ||
| 668 | + mPopup.AddButton( cancelButton ); | ||
| 669 | + | ||
| 670 | + Toolkit::PushButton okayButton = Toolkit::PushButton::New(); | ||
| 671 | + okayButton.SetName( OKAY_BUTTON_ID ); | ||
| 672 | + okayButton.SetLabel( "OK!" ); | ||
| 673 | + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 674 | + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 675 | + | ||
| 676 | + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 677 | + | ||
| 678 | + mPopup.AddButton( okayButton ); | ||
| 679 | + | ||
| 680 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 681 | + mPopup.MarkDirtyForRelayout(); | ||
| 682 | + | ||
| 683 | + mPopup.Show(); | ||
| 684 | + } | ||
| 685 | + else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID ) | ||
| 686 | + { | ||
| 687 | + mPopup = CreatePopup(); | ||
| 688 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 689 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 690 | + | ||
| 691 | + | ||
| 692 | + Toolkit::TableView table = Toolkit::TableView::New( 0, 0 ); | ||
| 693 | + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 694 | + | ||
| 695 | + mPopup.Add( table ); | ||
| 696 | + | ||
| 697 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 698 | + mPopup.MarkDirtyForRelayout(); | ||
| 699 | + | ||
| 700 | + mPopup.Show(); | ||
| 701 | + } | ||
| 702 | + else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID ) | ||
| 703 | + { | ||
| 704 | + mPopup = CreatePopup(); | ||
| 705 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 706 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 707 | + | ||
| 708 | + | ||
| 709 | + Toolkit::TableView table = Toolkit::TableView::New( 0, 0 ); | ||
| 710 | + table.SetName( "TABLEVIEW_BUTTON_1CELL_ID" ); | ||
| 711 | + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 712 | + | ||
| 713 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 714 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 715 | + table.Add( backing ); | ||
| 716 | + | ||
| 717 | + mPopup.Add( table ); | ||
| 718 | + | ||
| 719 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 720 | + mPopup.MarkDirtyForRelayout(); | ||
| 721 | + | ||
| 722 | + mPopup.Show(); | ||
| 723 | + } | ||
| 724 | + else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID ) | ||
| 725 | + { | ||
| 726 | + mPopup = CreatePopup(); | ||
| 727 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 728 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 729 | + | ||
| 730 | + | ||
| 731 | + Toolkit::TableView table = Toolkit::TableView::New( 0, 0 ); | ||
| 732 | + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 733 | + | ||
| 734 | + { | ||
| 735 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 736 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 737 | + table.Add( backing ); | ||
| 738 | + } | ||
| 739 | + { | ||
| 740 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 741 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 742 | + table.Add( backing ); | ||
| 743 | + } | ||
| 744 | + { | ||
| 745 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 746 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 747 | + table.Add( backing ); | ||
| 748 | + } | ||
| 749 | + | ||
| 750 | + mPopup.Add( table ); | ||
| 751 | + | ||
| 752 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 753 | + mPopup.MarkDirtyForRelayout(); | ||
| 754 | + | ||
| 755 | + mPopup.Show(); | ||
| 756 | + } | ||
| 757 | + else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID ) | ||
| 758 | + { | ||
| 759 | + mPopup = CreatePopup(); | ||
| 760 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 761 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 762 | + | ||
| 763 | + | ||
| 764 | + Toolkit::TableView table = Toolkit::TableView::New( 3, 3 ); | ||
| 765 | + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 766 | + | ||
| 767 | + // Column 0 | ||
| 768 | + { | ||
| 769 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 770 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 771 | + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) ); | ||
| 772 | + } | ||
| 773 | + { | ||
| 774 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 775 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 776 | + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) ); | ||
| 777 | + } | ||
| 778 | + { | ||
| 779 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 780 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 781 | + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) ); | ||
| 782 | + } | ||
| 783 | + | ||
| 784 | + // Column 1 | ||
| 785 | + { | ||
| 786 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) ); | ||
| 787 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 788 | + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 1 ) ); | ||
| 789 | + } | ||
| 790 | + { | ||
| 791 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); | ||
| 792 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 793 | + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 1 ) ); | ||
| 794 | + } | ||
| 795 | + { | ||
| 796 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 1.0f, 1.0f ) ); | ||
| 797 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 798 | + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 1 ) ); | ||
| 799 | + } | ||
| 800 | + | ||
| 801 | + // Column 2 | ||
| 802 | + { | ||
| 803 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 804 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 805 | + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 2 ) ); | ||
| 806 | + } | ||
| 807 | + { | ||
| 808 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.5f, 0.5f, 0.5f, 1.0f ) ); | ||
| 809 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 810 | + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 2 ) ); | ||
| 811 | + } | ||
| 812 | + { | ||
| 813 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.5f, 0.0f, 1.0f ) ); | ||
| 814 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 815 | + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 2 ) ); | ||
| 816 | + } | ||
| 817 | + | ||
| 818 | + mPopup.Add( table ); | ||
| 819 | + | ||
| 820 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 821 | + mPopup.MarkDirtyForRelayout(); | ||
| 822 | + | ||
| 823 | + mPopup.Show(); | ||
| 824 | + } | ||
| 825 | + else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID ) | ||
| 826 | + { | ||
| 827 | + mPopup = CreatePopup(); | ||
| 828 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 829 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 830 | + | ||
| 831 | + | ||
| 832 | + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); | ||
| 833 | + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 834 | + table.SetFixedHeight( 0, 50.0f ); | ||
| 835 | + | ||
| 836 | + { | ||
| 837 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 838 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 839 | + TextActor text = TextActor::New( "Fixed" ); | ||
| 840 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 841 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 842 | + backing.Add( text ); | ||
| 843 | + table.Add( backing ); | ||
| 844 | + } | ||
| 845 | + { | ||
| 846 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 847 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 848 | + TextActor text = TextActor::New( "Fill" ); | ||
| 849 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 850 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 851 | + backing.Add( text ); | ||
| 852 | + table.Add( backing ); | ||
| 853 | + } | ||
| 854 | + { | ||
| 855 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 856 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 857 | + TextActor text = TextActor::New( "Fill" ); | ||
| 858 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 859 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 860 | + backing.Add( text ); | ||
| 861 | + table.Add( backing ); | ||
| 862 | + } | ||
| 863 | + | ||
| 864 | + mPopup.Add( table ); | ||
| 865 | + | ||
| 866 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 867 | + mPopup.MarkDirtyForRelayout(); | ||
| 868 | + | ||
| 869 | + mPopup.Show(); | ||
| 870 | + } | ||
| 871 | + else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID ) | ||
| 872 | + { | ||
| 873 | + mPopup = CreatePopup(); | ||
| 874 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 875 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 876 | + | ||
| 877 | + | ||
| 878 | + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); | ||
| 879 | + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 880 | + table.SetFixedHeight( 0, 50.0f ); | ||
| 881 | + table.SetFixedHeight( 2, 50.0f ); | ||
| 882 | + | ||
| 883 | + { | ||
| 884 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 885 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 886 | + TextActor text = TextActor::New( "Fixed" ); | ||
| 887 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 888 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 889 | + backing.Add( text ); | ||
| 890 | + table.Add( backing ); | ||
| 891 | + } | ||
| 892 | + { | ||
| 893 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 894 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 895 | + TextActor text = TextActor::New( "Fill" ); | ||
| 896 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 897 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 898 | + backing.Add( text ); | ||
| 899 | + table.Add( backing ); | ||
| 900 | + } | ||
| 901 | + { | ||
| 902 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 903 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 904 | + TextActor text = TextActor::New( "Fixed" ); | ||
| 905 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 906 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 907 | + backing.Add( text ); | ||
| 908 | + table.Add( backing ); | ||
| 909 | + } | ||
| 910 | + | ||
| 911 | + mPopup.Add( table ); | ||
| 912 | + | ||
| 913 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 914 | + mPopup.MarkDirtyForRelayout(); | ||
| 915 | + | ||
| 916 | + mPopup.Show(); | ||
| 917 | + } | ||
| 918 | + else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID ) | ||
| 919 | + { | ||
| 920 | + mPopup = CreatePopup(); | ||
| 921 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 922 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 923 | + | ||
| 924 | + | ||
| 925 | + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); | ||
| 926 | + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 927 | + table.SetFitHeight( 0 ); | ||
| 928 | + table.SetFitHeight( 2 ); | ||
| 929 | + | ||
| 930 | + { | ||
| 931 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 932 | + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 933 | + backing.SetSize( 0.0f, 100.0f ); | ||
| 934 | + | ||
| 935 | + TextActor text = TextActor::New( "Fit" ); | ||
| 936 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 937 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 938 | + backing.Add( text ); | ||
| 939 | + | ||
| 940 | + table.Add( backing ); | ||
| 941 | + } | ||
| 942 | + { | ||
| 943 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 944 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 945 | + | ||
| 946 | + TextActor text = TextActor::New( "Fill" ); | ||
| 947 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 948 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 949 | + backing.Add( text ); | ||
| 950 | + | ||
| 951 | + table.Add( backing ); | ||
| 952 | + } | ||
| 953 | + { | ||
| 954 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 955 | + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 956 | + backing.SetSize( 0.0f, 100.0f ); | ||
| 957 | + | ||
| 958 | + TextActor text = TextActor::New( "Fit" ); | ||
| 959 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 960 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 961 | + backing.Add( text ); | ||
| 962 | + | ||
| 963 | + table.Add( backing ); | ||
| 964 | + } | ||
| 965 | + | ||
| 966 | + mPopup.Add( table ); | ||
| 967 | + | ||
| 968 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 969 | + mPopup.MarkDirtyForRelayout(); | ||
| 970 | + | ||
| 971 | + mPopup.Show(); | ||
| 972 | + } | ||
| 973 | + else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID ) | ||
| 974 | + { | ||
| 975 | + mPopup = CreatePopup(); | ||
| 976 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); | ||
| 977 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) ); | ||
| 978 | + | ||
| 979 | + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); | ||
| 980 | + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 981 | + table.SetFitHeight( 1 ); | ||
| 982 | + | ||
| 983 | + { | ||
| 984 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 985 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 986 | + | ||
| 987 | + TextActor text = TextActor::New( "Fill" ); | ||
| 988 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 989 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 990 | + backing.Add( text ); | ||
| 991 | + | ||
| 992 | + table.Add( backing ); | ||
| 993 | + } | ||
| 994 | + { | ||
| 995 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 996 | + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 997 | + backing.SetSize( 0.0f, 200.0f ); | ||
| 998 | + | ||
| 999 | + TextActor text = TextActor::New( "Fit" ); | ||
| 1000 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 1001 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1002 | + backing.Add( text ); | ||
| 1003 | + | ||
| 1004 | + table.Add( backing ); | ||
| 1005 | + } | ||
| 1006 | + { | ||
| 1007 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 1008 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 1009 | + | ||
| 1010 | + TextActor text = TextActor::New( "Fill" ); | ||
| 1011 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 1012 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1013 | + backing.Add( text ); | ||
| 1014 | + | ||
| 1015 | + table.Add( backing ); | ||
| 1016 | + } | ||
| 1017 | + | ||
| 1018 | + mPopup.Add( table ); | ||
| 1019 | + | ||
| 1020 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 1021 | + mPopup.MarkDirtyForRelayout(); | ||
| 1022 | + | ||
| 1023 | + mPopup.Show(); | ||
| 1024 | + } | ||
| 1025 | + else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID ) | ||
| 1026 | + { | ||
| 1027 | + mPopup = CreatePopup(); | ||
| 1028 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, WIDTH ); | ||
| 1029 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) ); | ||
| 1030 | + mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); | ||
| 1031 | + | ||
| 1032 | + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); | ||
| 1033 | + table.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1034 | + table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); | ||
| 1035 | + table.SetFitHeight( 0 ); | ||
| 1036 | + table.SetFitHeight( 1 ); | ||
| 1037 | + table.SetFitHeight( 2 ); | ||
| 1038 | + | ||
| 1039 | + { | ||
| 1040 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 1041 | + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1042 | + backing.SetSize( 0.0f, 100.0f ); | ||
| 1043 | + | ||
| 1044 | + TextActor text = TextActor::New( "Fit" ); | ||
| 1045 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 1046 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1047 | + backing.Add( text ); | ||
| 1048 | + | ||
| 1049 | + table.Add( backing ); | ||
| 1050 | + } | ||
| 1051 | + { | ||
| 1052 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 1053 | + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1054 | + backing.SetSize( 0.0f, 200.0f ); | ||
| 1055 | + | ||
| 1056 | + TextActor text = TextActor::New( "Fit" ); | ||
| 1057 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 1058 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1059 | + backing.Add( text ); | ||
| 1060 | + | ||
| 1061 | + table.Add( backing ); | ||
| 1062 | + } | ||
| 1063 | + { | ||
| 1064 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 1065 | + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1066 | + backing.SetSize( 0.0f, 300.0f ); | ||
| 1067 | + | ||
| 1068 | + TextActor text = TextActor::New( "Fit" ); | ||
| 1069 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 1070 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1071 | + backing.Add( text ); | ||
| 1072 | + | ||
| 1073 | + table.Add( backing ); | ||
| 1074 | + } | ||
| 1075 | + | ||
| 1076 | + mPopup.Add( table ); | ||
| 1077 | + | ||
| 1078 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 1079 | + mPopup.MarkDirtyForRelayout(); | ||
| 1080 | + | ||
| 1081 | + mPopup.Show(); | ||
| 1082 | + } | ||
| 1083 | + else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID ) | ||
| 1084 | + { | ||
| 1085 | + mPopup = CreatePopup(); | ||
| 1086 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, WIDTH ); | ||
| 1087 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) ); | ||
| 1088 | + mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); | ||
| 1089 | + | ||
| 1090 | + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); | ||
| 1091 | + table.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1092 | + table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); | ||
| 1093 | + table.SetFitHeight( 0 ); | ||
| 1094 | + table.SetFitHeight( 1 ); | ||
| 1095 | + | ||
| 1096 | + { | ||
| 1097 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 1098 | + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1099 | + backing.SetResizePolicy( FIXED, HEIGHT ); | ||
| 1100 | + backing.SetSize( 0.0f, 100.0f ); | ||
| 1101 | + | ||
| 1102 | + TextActor text = TextActor::New( "Fit" ); | ||
| 1103 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 1104 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1105 | + backing.Add( text ); | ||
| 1106 | + | ||
| 1107 | + table.Add( backing ); | ||
| 1108 | + } | ||
| 1109 | + { | ||
| 1110 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 1111 | + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1112 | + backing.SetSize( 0.0f, 200.0f ); | ||
| 1113 | + | ||
| 1114 | + TextActor text = TextActor::New( "Fit" ); | ||
| 1115 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 1116 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1117 | + backing.Add( text ); | ||
| 1118 | + | ||
| 1119 | + table.Add( backing ); | ||
| 1120 | + } | ||
| 1121 | + | ||
| 1122 | + mPopup.Add( table ); | ||
| 1123 | + | ||
| 1124 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 1125 | + mPopup.MarkDirtyForRelayout(); | ||
| 1126 | + | ||
| 1127 | + mPopup.Show(); | ||
| 1128 | + } | ||
| 1129 | + else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID ) | ||
| 1130 | + { | ||
| 1131 | + mPopup = CreatePopup(); | ||
| 1132 | + mPopup.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, WIDTH ); | ||
| 1133 | + mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) ); | ||
| 1134 | + mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT ); | ||
| 1135 | + | ||
| 1136 | + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 ); | ||
| 1137 | + table.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1138 | + table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT ); | ||
| 1139 | + table.SetFixedHeight( 0, 20.0f ); | ||
| 1140 | + table.SetFitHeight( 1 ); | ||
| 1141 | + | ||
| 1142 | + { | ||
| 1143 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) ); | ||
| 1144 | + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 1145 | + | ||
| 1146 | + TextActor text = TextActor::New( "Fixed" ); | ||
| 1147 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 1148 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1149 | + backing.Add( text ); | ||
| 1150 | + | ||
| 1151 | + table.Add( backing ); | ||
| 1152 | + } | ||
| 1153 | + { | ||
| 1154 | + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) ); | ||
| 1155 | + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH ); | ||
| 1156 | + backing.SetSize( 0.0f, 200.0f ); | ||
| 1157 | + | ||
| 1158 | + TextActor text = TextActor::New( "Fit" ); | ||
| 1159 | + text.SetAnchorPoint( AnchorPoint::CENTER ); | ||
| 1160 | + text.SetParentOrigin( ParentOrigin::CENTER ); | ||
| 1161 | + backing.Add( text ); | ||
| 1162 | + | ||
| 1163 | + table.Add( backing ); | ||
| 1164 | + } | ||
| 1165 | + | ||
| 1166 | + mPopup.Add( table ); | ||
| 1167 | + | ||
| 1168 | + // The popup is not yet on the stage so needs to be flaged as dirty | ||
| 1169 | + mPopup.MarkDirtyForRelayout(); | ||
| 1170 | + | ||
| 1171 | + mPopup.Show(); | ||
| 1172 | + } | ||
| 1173 | + else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID ) | ||
| 1174 | + { | ||
| 1175 | + if( mPopup ) | ||
| 1176 | + { | ||
| 1177 | + mPopup.Hide(); | ||
| 1178 | + } | ||
| 1179 | + } | ||
| 1180 | + | ||
| 1181 | + return true; | ||
| 1182 | + } | ||
| 1183 | + | ||
| 1184 | + void OnPopupOutsideTouched() | ||
| 1185 | + { | ||
| 1186 | + if( mPopup ) | ||
| 1187 | + { | ||
| 1188 | + mPopup.Hide(); | ||
| 1189 | + } | ||
| 1190 | + } | ||
| 1191 | + | ||
| 1192 | + void OnKeyEvent( const KeyEvent& event ) | ||
| 1193 | + { | ||
| 1194 | + if( event.state == KeyEvent::Down ) | ||
| 1195 | + { | ||
| 1196 | + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) | ||
| 1197 | + { | ||
| 1198 | + // Exit application when click back or escape. | ||
| 1199 | + mApplication.Quit(); | ||
| 1200 | + } | ||
| 1201 | + } | ||
| 1202 | + } | ||
| 1203 | + | ||
| 1204 | +public: // From ItemFactory | ||
| 1205 | + | ||
| 1206 | + /** | ||
| 1207 | + * @brief Return the number of items to display in the item view | ||
| 1208 | + * | ||
| 1209 | + * @return Return the number of items to display | ||
| 1210 | + */ | ||
| 1211 | + virtual unsigned int GetNumberOfItems() | ||
| 1212 | + { | ||
| 1213 | + switch( mDemoState ) | ||
| 1214 | + { | ||
| 1215 | + case POPUP: | ||
| 1216 | + { | ||
| 1217 | + return POPUP_BUTTON_ITEMS_COUNT; | ||
| 1218 | + } | ||
| 1219 | + | ||
| 1220 | + case TABLEVIEW: | ||
| 1221 | + { | ||
| 1222 | + return TABLEVIEW_BUTTON_ITEMS_COUNT; | ||
| 1223 | + } | ||
| 1224 | + | ||
| 1225 | + default: | ||
| 1226 | + { | ||
| 1227 | + break; | ||
| 1228 | + } | ||
| 1229 | + } | ||
| 1230 | + | ||
| 1231 | + return 0; | ||
| 1232 | + } | ||
| 1233 | + | ||
| 1234 | + /** | ||
| 1235 | + * @brief Create a new item to populate the item view with | ||
| 1236 | + * | ||
| 1237 | + * @param[in] itemId The index of the item to create | ||
| 1238 | + * @return Return the created actor for the given ID | ||
| 1239 | + */ | ||
| 1240 | + virtual Actor NewItem(unsigned int itemId) | ||
| 1241 | + { | ||
| 1242 | + const ButtonItem* buttonDataArray = NULL; | ||
| 1243 | + switch( mDemoState ) | ||
| 1244 | + { | ||
| 1245 | + case POPUP: | ||
| 1246 | + { | ||
| 1247 | + buttonDataArray = POPUP_BUTTON_ITEMS; | ||
| 1248 | + break; | ||
| 1249 | + } | ||
| 1250 | + | ||
| 1251 | + case TABLEVIEW: | ||
| 1252 | + { | ||
| 1253 | + buttonDataArray = TABLEVIEW_BUTTON_ITEMS; | ||
| 1254 | + break; | ||
| 1255 | + } | ||
| 1256 | + | ||
| 1257 | + default: | ||
| 1258 | + { | ||
| 1259 | + break; | ||
| 1260 | + } | ||
| 1261 | + } | ||
| 1262 | + | ||
| 1263 | + if( buttonDataArray ) | ||
| 1264 | + { | ||
| 1265 | + Toolkit::PushButton popupButton = Toolkit::PushButton::New(); | ||
| 1266 | + popupButton.SetName( buttonDataArray[ itemId ].name ); | ||
| 1267 | + popupButton.SetLabel( buttonDataArray[ itemId ].text ); | ||
| 1268 | + popupButton.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); | ||
| 1269 | + | ||
| 1270 | + popupButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); | ||
| 1271 | + popupButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) ); | ||
| 1272 | + | ||
| 1273 | + popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ||
| 1274 | + | ||
| 1275 | + return popupButton; | ||
| 1276 | + } | ||
| 1277 | + | ||
| 1278 | + return Actor(); | ||
| 1279 | + } | ||
| 1280 | + | ||
| 1281 | +private: | ||
| 1282 | + | ||
| 1283 | + enum DemoState | ||
| 1284 | + { | ||
| 1285 | + POPUP, | ||
| 1286 | + TABLEVIEW | ||
| 1287 | + }; | ||
| 1288 | + | ||
| 1289 | + Application& mApplication; | ||
| 1290 | + Toolkit::View mView; ///< The View instance. | ||
| 1291 | + Toolkit::ToolBar mToolBar; ///< The View's Toolbar. | ||
| 1292 | + Layer mContentLayer; ///< Content layer | ||
| 1293 | + | ||
| 1294 | + Toolkit::TextView mTitleActor; ///< Title text | ||
| 1295 | + | ||
| 1296 | + Toolkit::Popup mMenu; ///< The navigation menu | ||
| 1297 | + bool mMenuShown; ///< If the navigation menu is currently being displayed or not | ||
| 1298 | + | ||
| 1299 | + Toolkit::Popup mPopup; | ||
| 1300 | + | ||
| 1301 | + Toolkit::ItemView mItemView; ///< ItemView to hold test images | ||
| 1302 | + | ||
| 1303 | + DemoState mDemoState; | ||
| 1304 | +}; | ||
| 1305 | + | ||
| 1306 | +void RunTest( Application& application ) | ||
| 1307 | +{ | ||
| 1308 | + SizeNegotiationController test( application ); | ||
| 1309 | + | ||
| 1310 | + application.MainLoop(); | ||
| 1311 | +} | ||
| 1312 | + | ||
| 1313 | +// Entry point for Linux & SLP applications | ||
| 1314 | +// | ||
| 1315 | +int main( int argc, char **argv ) | ||
| 1316 | +{ | ||
| 1317 | + Application application = Application::New( &argc, &argv ); | ||
| 1318 | + | ||
| 1319 | + RunTest( application ); | ||
| 1320 | + | ||
| 1321 | + return 0; | ||
| 1322 | +} |
examples/text-view/text-view-example.cpp
| @@ -75,14 +75,14 @@ const TableString TABLE_STRINGS[] = { { "HelveticaNue", "Regular", 8.0f, | @@ -75,14 +75,14 @@ const TableString TABLE_STRINGS[] = { { "HelveticaNue", "Regular", 8.0f, | ||
| 75 | { "HelveticaNue", "Regular", 12.0f, Dali::TextStyle::REGULAR, Vector4( 0.5f, 1.0f, 1.0f, 1.0f ), "Hola", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 90.0f, { 2, 0, 4, 2 } }, | 75 | { "HelveticaNue", "Regular", 12.0f, Dali::TextStyle::REGULAR, Vector4( 0.5f, 1.0f, 1.0f, 1.0f ), "Hola", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 90.0f, { 2, 0, 4, 2 } }, |
| 76 | { "HelveticaNue", "Regular", 18.0f, Dali::TextStyle::BOLD, Vector4( 0.5f, 1.0f, 0.5f, 1.0f ), "Bonjour", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 2, 2, 2, 4 } }, | 76 | { "HelveticaNue", "Regular", 18.0f, Dali::TextStyle::BOLD, Vector4( 0.5f, 1.0f, 0.5f, 1.0f ), "Bonjour", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 2, 2, 2, 4 } }, |
| 77 | { "HelveticaNue", "Regular", 12.0f, Dali::TextStyle::REGULAR, Vector4( 1.0f, 1.0f, 0.5f, 1.0f ), "Ciao", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 2, 7, 2, 3 } }, | 77 | { "HelveticaNue", "Regular", 12.0f, Dali::TextStyle::REGULAR, Vector4( 1.0f, 1.0f, 0.5f, 1.0f ), "Ciao", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 2, 7, 2, 3 } }, |
| 78 | - { "HelveticaNue", "Regular", 26.0f, Dali::TextStyle::EXTRABLACK, Vector4( 0.5f, 0.0f, 0.0f, 1.0f ), "Hello", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 4, 2, 1, 6 } }, | 78 | + { "HelveticaNue", "Regular", 23.0f, Dali::TextStyle::EXTRABLACK, Vector4( 0.5f, 0.0f, 0.0f, 1.0f ), "์๋ ํ์ธ์", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 20.0f, 0.0f, { 4, 3, 1, 6 } }, |
| 79 | { "HelveticaNue", "Regular", 8.0f, Dali::TextStyle::DEMIBOLD, Vector4( 0.0f, 0.5f, 0.0f, 1.0f ), "Top of the morning to you", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 90.0f, { 4, 10, 8, 2 } }, | 79 | { "HelveticaNue", "Regular", 8.0f, Dali::TextStyle::DEMIBOLD, Vector4( 0.0f, 0.5f, 0.0f, 1.0f ), "Top of the morning to you", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 90.0f, { 4, 10, 8, 2 } }, |
| 80 | - { "HelveticaNue", "Regular", 13.0f, Dali::TextStyle::DEMIBOLD, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), "เคนเฅเคฒเฅ", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 6, 1, 1, 3 } }, | 80 | + { "HelveticaNue", "Regular", 13.0f, Dali::TextStyle::DEMIBOLD, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), "เคนเฅเคฒเฅ", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 6, 1, 1, 3 } }, |
| 81 | { "HelveticaNue", "Regular", 8.0f, Dali::TextStyle::DEMIBOLD, Vector4( 1.0f, 1.0f, 0.0f, 1.0f ), "เธชเธงเธฑเธชเธเธต", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 90.0f, { 6, 5, 2, 1 } }, | 81 | { "HelveticaNue", "Regular", 8.0f, Dali::TextStyle::DEMIBOLD, Vector4( 1.0f, 1.0f, 0.0f, 1.0f ), "เธชเธงเธฑเธชเธเธต", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 90.0f, { 6, 5, 2, 1 } }, |
| 82 | { "HelveticaNue", "Regular", 18.0f, Dali::TextStyle::REGULAR, Vector4( 0.0f, 1.0f, 1.0f, 1.0f ), "ไฝ ๅฅฝ", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalBottom, 10.0f, 0.0f, { 6, 6, 1, 3 } }, | 82 | { "HelveticaNue", "Regular", 18.0f, Dali::TextStyle::REGULAR, Vector4( 0.0f, 1.0f, 1.0f, 1.0f ), "ไฝ ๅฅฝ", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalBottom, 10.0f, 0.0f, { 6, 6, 1, 3 } }, |
| 83 | { "HelveticaNue", "Regular", 34.0f, Dali::TextStyle::REGULAR, Vector4( 0.0f, 0.0f, 1.0f, 1.0f ), "G'day", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 7, 0, 2, 10 } }, | 83 | { "HelveticaNue", "Regular", 34.0f, Dali::TextStyle::REGULAR, Vector4( 0.0f, 0.0f, 1.0f, 1.0f ), "G'day", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 7, 0, 2, 10 } }, |
| 84 | { "HelveticaNue", "Regular", 16.0f, Dali::TextStyle::EXTRABLACK, Vector4( 0.0f, 0.5f, 1.0f, 1.0f ), "ู ุฑุญุจุง", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 9, 1, 2, 4 } }, | 84 | { "HelveticaNue", "Regular", 16.0f, Dali::TextStyle::EXTRABLACK, Vector4( 0.0f, 0.5f, 1.0f, 1.0f ), "ู ุฑุญุจุง", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 9, 1, 2, 4 } }, |
| 85 | - { "HelveticaNue", "Regular", 10.0f, Dali::TextStyle::EXTRABLACK, Vector4( 1.0f, 0.0f, 0.0f, 1.0f ), "ใใใซใกใฏ", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 10, 0, 2, 6 } }, | 85 | + { "HelveticaNue", "Regular", 10.0f, Dali::TextStyle::EXTRABLACK, Vector4( 1.0f, 0.0f, 0.0f, 1.0f ), "ใใใซใกใฏ", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalCenter, 10.0f, 0.0f, { 10, 0, 2, 6 } }, |
| 86 | { "HelveticaNue", "Regular", 14.0f, Dali::TextStyle::REGULAR, Vector4( 0.0f, 1.0f, 0.0f, 1.0f ), "aloha", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 10, 6, 2, 4 } } | 86 | { "HelveticaNue", "Regular", 14.0f, Dali::TextStyle::REGULAR, Vector4( 0.0f, 1.0f, 0.0f, 1.0f ), "aloha", Toolkit::Alignment::HorizontalCenter, Toolkit::Alignment::VerticalTop, 10.0f, 0.0f, { 10, 6, 2, 4 } } |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| @@ -151,10 +151,12 @@ public: | @@ -151,10 +151,12 @@ public: | ||
| 151 | Toolkit::TextView textView = Toolkit::TextView::New( tableString.text ); | 151 | Toolkit::TextView textView = Toolkit::TextView::New( tableString.text ); |
| 152 | textView.SetStyleToCurrentText( textStyle ); | 152 | textView.SetStyleToCurrentText( textStyle ); |
| 153 | textView.SetOrientation( Dali::Degree( tableString.orientation ), Vector3( 0.0f, 0.0f, 1.0f ) ); | 153 | textView.SetOrientation( Dali::Degree( tableString.orientation ), Vector3( 0.0f, 0.0f, 1.0f ) ); |
| 154 | + textView.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); | ||
| 154 | 155 | ||
| 155 | Toolkit::Alignment alignmentContainer = Toolkit::Alignment::New( tableString.horizontalAlignment, tableString.verticalAlignment ); | 156 | Toolkit::Alignment alignmentContainer = Toolkit::Alignment::New( tableString.horizontalAlignment, tableString.verticalAlignment ); |
| 156 | - alignmentContainer.SetPadding( Toolkit::Alignment::Padding( tableString.padding, tableString.padding, tableString.padding, tableString.padding ) ); | ||
| 157 | - alignmentContainer.SetScaling( Toolkit::Alignment::ScaleToFill ); | 157 | + Actor alignmentContainerActor = alignmentContainer; |
| 158 | + alignmentContainerActor.SetPadding( Padding( tableString.padding, tableString.padding, tableString.padding, tableString.padding ) ); | ||
| 159 | + alignmentContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); | ||
| 158 | alignmentContainer.Add( textView ); | 160 | alignmentContainer.Add( textView ); |
| 159 | 161 | ||
| 160 | textContainer.AddChild( alignmentContainer, Toolkit::TableView::CellPosition( tableString.cellPosition.row, tableString.cellPosition.column, tableString.cellPosition.rowSpan, tableString.cellPosition.columnSpan ) ); | 162 | textContainer.AddChild( alignmentContainer, Toolkit::TableView::CellPosition( tableString.cellPosition.row, tableString.cellPosition.column, tableString.cellPosition.rowSpan, tableString.cellPosition.columnSpan ) ); |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.0.35 | 5 | +Version: 1.0.36 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |
resources/scripts/animated-buttons.json
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | { | 3 | { |
| 4 | "type": "ImageActor", | 4 | "type": "ImageActor", |
| 5 | "name": "On", | 5 | "name": "On", |
| 6 | + "relayout-enabled": false, | ||
| 6 | "position": [ | 7 | "position": [ |
| 7 | 374, | 8 | 374, |
| 8 | 215, | 9 | 215, |
| @@ -11,7 +12,7 @@ | @@ -11,7 +12,7 @@ | ||
| 11 | "size": [ | 12 | "size": [ |
| 12 | 144, | 13 | 144, |
| 13 | 144, | 14 | 144, |
| 14 | - 1 | 15 | + 1 |
| 15 | ], | 16 | ], |
| 16 | "sizeAspectRatio": false, | 17 | "sizeAspectRatio": false, |
| 17 | "color": [ | 18 | "color": [ |
| @@ -33,6 +34,7 @@ | @@ -33,6 +34,7 @@ | ||
| 33 | { | 34 | { |
| 34 | "type": "ImageActor", | 35 | "type": "ImageActor", |
| 35 | "name": "Off", | 36 | "name": "Off", |
| 37 | + "relayout-enabled": false, | ||
| 36 | "position": [ | 38 | "position": [ |
| 37 | 129, | 39 | 129, |
| 38 | 215, | 40 | 215, |
| @@ -41,7 +43,7 @@ | @@ -41,7 +43,7 @@ | ||
| 41 | "size": [ | 43 | "size": [ |
| 42 | 144, | 44 | 144, |
| 43 | 144, | 45 | 144, |
| 44 | - 1 | 46 | + 1 |
| 45 | ], | 47 | ], |
| 46 | "sizeAspectRatio": false, | 48 | "sizeAspectRatio": false, |
| 47 | "color": [ | 49 | "color": [ |
| @@ -63,6 +65,7 @@ | @@ -63,6 +65,7 @@ | ||
| 63 | { | 65 | { |
| 64 | "type": "ImageActor", | 66 | "type": "ImageActor", |
| 65 | "name": "Right", | 67 | "name": "Right", |
| 68 | + "relayout-enabled": false, | ||
| 66 | "position": [ | 69 | "position": [ |
| 67 | 418.5, | 70 | 418.5, |
| 68 | 214.5, | 71 | 214.5, |
| @@ -71,7 +74,7 @@ | @@ -71,7 +74,7 @@ | ||
| 71 | "size": [ | 74 | "size": [ |
| 72 | 85, | 75 | 85, |
| 73 | 161, | 76 | 161, |
| 74 | - 1 | 77 | + 1 |
| 75 | ], | 78 | ], |
| 76 | "sizeAspectRatio": false, | 79 | "sizeAspectRatio": false, |
| 77 | "visible": true, | 80 | "visible": true, |
| @@ -94,6 +97,7 @@ | @@ -94,6 +97,7 @@ | ||
| 94 | { | 97 | { |
| 95 | "type": "ImageActor", | 98 | "type": "ImageActor", |
| 96 | "name": "Left", | 99 | "name": "Left", |
| 100 | + "relayout-enabled": false, | ||
| 97 | "position": [ | 101 | "position": [ |
| 98 | 331, | 102 | 331, |
| 99 | 214.5, | 103 | 214.5, |
| @@ -102,7 +106,7 @@ | @@ -102,7 +106,7 @@ | ||
| 102 | "size": [ | 106 | "size": [ |
| 103 | 88, | 107 | 88, |
| 104 | 161, | 108 | 161, |
| 105 | - 1 | 109 | + 1 |
| 106 | ], | 110 | ], |
| 107 | "sizeAspectRatio": false, | 111 | "sizeAspectRatio": false, |
| 108 | "visible": true, | 112 | "visible": true, |
| @@ -125,6 +129,7 @@ | @@ -125,6 +129,7 @@ | ||
| 125 | { | 129 | { |
| 126 | "type": "ImageActor", | 130 | "type": "ImageActor", |
| 127 | "name": "Middle", | 131 | "name": "Middle", |
| 132 | + "relayout-enabled": false, | ||
| 128 | "position": [ | 133 | "position": [ |
| 129 | 375.5, | 134 | 375.5, |
| 130 | 214.5, | 135 | 214.5, |
| @@ -138,7 +143,7 @@ | @@ -138,7 +143,7 @@ | ||
| 138 | "size": [ | 143 | "size": [ |
| 139 | 1, | 144 | 1, |
| 140 | 161, | 145 | 161, |
| 141 | - 1 | 146 | + 1 |
| 142 | ], | 147 | ], |
| 143 | "sizeAspectRatio": false, | 148 | "sizeAspectRatio": false, |
| 144 | "color": [ | 149 | "color": [ |
| @@ -160,6 +165,7 @@ | @@ -160,6 +165,7 @@ | ||
| 160 | { | 165 | { |
| 161 | "type": "ImageActor", | 166 | "type": "ImageActor", |
| 162 | "name": "Jelly", | 167 | "name": "Jelly", |
| 168 | + "relayout-enabled": false, | ||
| 163 | "position": [ | 169 | "position": [ |
| 164 | 374, | 170 | 374, |
| 165 | 215, | 171 | 215, |
| @@ -168,7 +174,7 @@ | @@ -168,7 +174,7 @@ | ||
| 168 | "size": [ | 174 | "size": [ |
| 169 | 144, | 175 | 144, |
| 170 | 144, | 176 | 144, |
| 171 | - 1 | 177 | + 1 |
| 172 | ], | 178 | ], |
| 173 | "sizeAspectRatio": false, | 179 | "sizeAspectRatio": false, |
| 174 | "color": [ | 180 | "color": [ |
| @@ -190,6 +196,7 @@ | @@ -190,6 +196,7 @@ | ||
| 190 | { | 196 | { |
| 191 | "type": "Control", | 197 | "type": "Control", |
| 192 | "name": "Left Black", | 198 | "name": "Left Black", |
| 199 | + "relayout-enabled": false, | ||
| 193 | "position": [ | 200 | "position": [ |
| 194 | 144.5, | 201 | 144.5, |
| 195 | 218.5, | 202 | 218.5, |
| @@ -198,7 +205,7 @@ | @@ -198,7 +205,7 @@ | ||
| 198 | "size": [ | 205 | "size": [ |
| 199 | 275, | 206 | 275, |
| 200 | 243, | 207 | 243, |
| 201 | - 1 | 208 | + 1 |
| 202 | ], | 209 | ], |
| 203 | "sizeAspectRatio": false, | 210 | "sizeAspectRatio": false, |
| 204 | "background-color": [ | 211 | "background-color": [ |
| @@ -218,6 +225,7 @@ | @@ -218,6 +225,7 @@ | ||
| 218 | { | 225 | { |
| 219 | "type": "Control", | 226 | "type": "Control", |
| 220 | "name": "Right Black", | 227 | "name": "Right Black", |
| 228 | + "relayout-enabled": false, | ||
| 221 | "position": [ | 229 | "position": [ |
| 222 | 629.5, | 230 | 629.5, |
| 223 | 218.5, | 231 | 218.5, |
| @@ -226,7 +234,7 @@ | @@ -226,7 +234,7 @@ | ||
| 226 | "size": [ | 234 | "size": [ |
| 227 | 335, | 235 | 335, |
| 228 | 243, | 236 | 243, |
| 229 | - 1 | 237 | + 1 |
| 230 | ], | 238 | ], |
| 231 | "sizeAspectRatio": false, | 239 | "sizeAspectRatio": false, |
| 232 | "background-color": [ | 240 | "background-color": [ |
| @@ -246,6 +254,7 @@ | @@ -246,6 +254,7 @@ | ||
| 246 | { | 254 | { |
| 247 | "type": "ImageActor", | 255 | "type": "ImageActor", |
| 248 | "name": "JellyOff", | 256 | "name": "JellyOff", |
| 257 | + "relayout-enabled": false, | ||
| 249 | "position": [ | 258 | "position": [ |
| 250 | 121, | 259 | 121, |
| 251 | -117, | 260 | -117, |
| @@ -254,7 +263,7 @@ | @@ -254,7 +263,7 @@ | ||
| 254 | "size": [ | 263 | "size": [ |
| 255 | 144, | 264 | 144, |
| 256 | 144, | 265 | 144, |
| 257 | - 1 | 266 | + 1 |
| 258 | ], | 267 | ], |
| 259 | "sizeAspectRatio": false, | 268 | "sizeAspectRatio": false, |
| 260 | "color": [ | 269 | "color": [ |
| @@ -276,6 +285,7 @@ | @@ -276,6 +285,7 @@ | ||
| 276 | { | 285 | { |
| 277 | "type": "Control", | 286 | "type": "Control", |
| 278 | "name": "Control On", | 287 | "name": "Control On", |
| 288 | + "relayout-enabled": false, | ||
| 279 | "position": [ | 289 | "position": [ |
| 280 | 371.26116838487997, | 290 | 371.26116838487997, |
| 281 | 217.33333333333331, | 291 | 217.33333333333331, |
| @@ -284,7 +294,7 @@ | @@ -284,7 +294,7 @@ | ||
| 284 | "size": [ | 294 | "size": [ |
| 285 | 196, | 295 | 196, |
| 286 | 184, | 296 | 184, |
| 287 | - 1 | 297 | + 1 |
| 288 | ], | 298 | ], |
| 289 | "sizeAspectRatio": false, | 299 | "sizeAspectRatio": false, |
| 290 | "scale": [ | 300 | "scale": [ |
| @@ -310,6 +320,7 @@ | @@ -310,6 +320,7 @@ | ||
| 310 | { | 320 | { |
| 311 | "type": "Control", | 321 | "type": "Control", |
| 312 | "name": "Control Off", | 322 | "name": "Control Off", |
| 323 | + "relayout-enabled": false, | ||
| 313 | "position": [ | 324 | "position": [ |
| 314 | 123.5, | 325 | 123.5, |
| 315 | -117, | 326 | -117, |
| @@ -318,7 +329,7 @@ | @@ -318,7 +329,7 @@ | ||
| 318 | "size": [ | 329 | "size": [ |
| 319 | 193, | 330 | 193, |
| 320 | 182, | 331 | 182, |
| 321 | - 1 | 332 | + 1 |
| 322 | ], | 333 | ], |
| 323 | "sizeAspectRatio": false, | 334 | "sizeAspectRatio": false, |
| 324 | "color": [ | 335 | "color": [ |
resources/scripts/animated-colors.json
| @@ -18,9 +18,11 @@ | @@ -18,9 +18,11 @@ | ||
| 18 | "stage": [ | 18 | "stage": [ |
| 19 | { | 19 | { |
| 20 | "type": "Control", | 20 | "type": "Control", |
| 21 | + "relayout-enabled": false, | ||
| 21 | "actors": [ | 22 | "actors": [ |
| 22 | { | 23 | { |
| 23 | "type": "Control", | 24 | "type": "Control", |
| 25 | + "relayout-enabled": true, | ||
| 24 | "actors": [], | 26 | "actors": [], |
| 25 | "name": "Control 8", | 27 | "name": "Control 8", |
| 26 | "position": [ | 28 | "position": [ |
| @@ -60,9 +62,11 @@ | @@ -60,9 +62,11 @@ | ||
| 60 | }, | 62 | }, |
| 61 | { | 63 | { |
| 62 | "type": "Control", | 64 | "type": "Control", |
| 65 | + "relayout-enabled": false, | ||
| 63 | "actors": [ | 66 | "actors": [ |
| 64 | { | 67 | { |
| 65 | "type": "Control", | 68 | "type": "Control", |
| 69 | + "relayout-enabled": false, | ||
| 66 | "actors": [], | 70 | "actors": [], |
| 67 | "name": "Container 2", | 71 | "name": "Container 2", |
| 68 | "position": [ | 72 | "position": [ |
| @@ -102,9 +106,11 @@ | @@ -102,9 +106,11 @@ | ||
| 102 | }, | 106 | }, |
| 103 | { | 107 | { |
| 104 | "type": "Control", | 108 | "type": "Control", |
| 109 | + "relayout-enabled": false, | ||
| 105 | "actors": [ | 110 | "actors": [ |
| 106 | { | 111 | { |
| 107 | "type": "Control", | 112 | "type": "Control", |
| 113 | + "relayout-enabled": false, | ||
| 108 | "actors": [], | 114 | "actors": [], |
| 109 | "name": "Container 4", | 115 | "name": "Container 4", |
| 110 | "position": [ | 116 | "position": [ |
| @@ -181,9 +187,11 @@ | @@ -181,9 +187,11 @@ | ||
| 181 | }, | 187 | }, |
| 182 | { | 188 | { |
| 183 | "type": "Control", | 189 | "type": "Control", |
| 190 | + "relayout-enabled": false, | ||
| 184 | "actors": [ | 191 | "actors": [ |
| 185 | { | 192 | { |
| 186 | "type": "Control", | 193 | "type": "Control", |
| 194 | + "relayout-enabled": false, | ||
| 187 | "actors": [], | 195 | "actors": [], |
| 188 | "name": "Container 5", | 196 | "name": "Container 5", |
| 189 | "position": [ | 197 | "position": [ |
| @@ -223,9 +231,11 @@ | @@ -223,9 +231,11 @@ | ||
| 223 | }, | 231 | }, |
| 224 | { | 232 | { |
| 225 | "type": "Control", | 233 | "type": "Control", |
| 234 | + "relayout-enabled": false, | ||
| 226 | "actors": [ | 235 | "actors": [ |
| 227 | { | 236 | { |
| 228 | "type": "Control", | 237 | "type": "Control", |
| 238 | + "relayout-enabled": false, | ||
| 229 | "actors": [], | 239 | "actors": [], |
| 230 | "name": "Container 7", | 240 | "name": "Container 7", |
| 231 | "position": [ | 241 | "position": [ |
| @@ -302,9 +312,11 @@ | @@ -302,9 +312,11 @@ | ||
| 302 | }, | 312 | }, |
| 303 | { | 313 | { |
| 304 | "type": "Control", | 314 | "type": "Control", |
| 315 | + "relayout-enabled": false, | ||
| 305 | "actors": [ | 316 | "actors": [ |
| 306 | { | 317 | { |
| 307 | "type": "Control", | 318 | "type": "Control", |
| 319 | + "relayout-enabled": false, | ||
| 308 | "actors": [], | 320 | "actors": [], |
| 309 | "name": "Container 8", | 321 | "name": "Container 8", |
| 310 | "position": [ | 322 | "position": [ |
| @@ -344,9 +356,11 @@ | @@ -344,9 +356,11 @@ | ||
| 344 | }, | 356 | }, |
| 345 | { | 357 | { |
| 346 | "type": "Control", | 358 | "type": "Control", |
| 359 | + "relayout-enabled": false, | ||
| 347 | "actors": [ | 360 | "actors": [ |
| 348 | { | 361 | { |
| 349 | "type": "Control", | 362 | "type": "Control", |
| 363 | + "relayout-enabled": false, | ||
| 350 | "actors": [], | 364 | "actors": [], |
| 351 | "name": "Container 10", | 365 | "name": "Container 10", |
| 352 | "position": [ | 366 | "position": [ |
| @@ -534,9 +548,11 @@ | @@ -534,9 +548,11 @@ | ||
| 534 | }, | 548 | }, |
| 535 | { | 549 | { |
| 536 | "type": "Control", | 550 | "type": "Control", |
| 551 | + "relayout-enabled": false, | ||
| 537 | "actors": [ | 552 | "actors": [ |
| 538 | { | 553 | { |
| 539 | "type": "Control", | 554 | "type": "Control", |
| 555 | + "relayout-enabled": false, | ||
| 540 | "actors": [], | 556 | "actors": [], |
| 541 | "name": "Control 4", | 557 | "name": "Control 4", |
| 542 | "position": [ | 558 | "position": [ |
| @@ -613,9 +629,11 @@ | @@ -613,9 +629,11 @@ | ||
| 613 | }, | 629 | }, |
| 614 | { | 630 | { |
| 615 | "type": "Control", | 631 | "type": "Control", |
| 632 | + "relayout-enabled": false, | ||
| 616 | "actors": [ | 633 | "actors": [ |
| 617 | { | 634 | { |
| 618 | "type": "Control", | 635 | "type": "Control", |
| 636 | + "relayout-enabled": false, | ||
| 619 | "actors": [ | 637 | "actors": [ |
| 620 | { | 638 | { |
| 621 | "type": "Control", | 639 | "type": "Control", |
| @@ -695,6 +713,7 @@ | @@ -695,6 +713,7 @@ | ||
| 695 | }, | 713 | }, |
| 696 | { | 714 | { |
| 697 | "type": "Control", | 715 | "type": "Control", |
| 716 | + "relayout-enabled": false, | ||
| 698 | "actors": [], | 717 | "actors": [], |
| 699 | "name": "Container 11", | 718 | "name": "Container 11", |
| 700 | "position": [ | 719 | "position": [ |
| @@ -734,12 +753,15 @@ | @@ -734,12 +753,15 @@ | ||
| 734 | }, | 753 | }, |
| 735 | { | 754 | { |
| 736 | "type": "Control", | 755 | "type": "Control", |
| 756 | + "relayout-enabled": false, | ||
| 737 | "actors": [ | 757 | "actors": [ |
| 738 | { | 758 | { |
| 739 | "type": "Control", | 759 | "type": "Control", |
| 760 | + "relayout-enabled": false, | ||
| 740 | "actors": [ | 761 | "actors": [ |
| 741 | { | 762 | { |
| 742 | "type": "Control", | 763 | "type": "Control", |
| 764 | + "relayout-enabled": false, | ||
| 743 | "actors": [], | 765 | "actors": [], |
| 744 | "name": "Container 15", | 766 | "name": "Container 15", |
| 745 | "position": [ | 767 | "position": [ |
| @@ -816,6 +838,7 @@ | @@ -816,6 +838,7 @@ | ||
| 816 | }, | 838 | }, |
| 817 | { | 839 | { |
| 818 | "type": "Control", | 840 | "type": "Control", |
| 841 | + "relayout-enabled": false, | ||
| 819 | "actors": [], | 842 | "actors": [], |
| 820 | "name": "Container 16", | 843 | "name": "Container 16", |
| 821 | "position": [ | 844 | "position": [ |
resources/scripts/animation.json
| @@ -122,6 +122,7 @@ | @@ -122,6 +122,7 @@ | ||
| 122 | "image": { | 122 | "image": { |
| 123 | "filename": "{DALI_IMAGE_DIR}gallery-large-21.jpg" | 123 | "filename": "{DALI_IMAGE_DIR}gallery-large-21.jpg" |
| 124 | }, | 124 | }, |
| 125 | + "relayout-enabled": false, | ||
| 125 | "position": [0, 200, 0], | 126 | "position": [0, 200, 0], |
| 126 | "size": [200, 200, 1], | 127 | "size": [200, 200, 1], |
| 127 | "signals": [{ | 128 | "signals": [{ |
resources/scripts/background-color.json
| @@ -29,6 +29,7 @@ | @@ -29,6 +29,7 @@ | ||
| 29 | // A container with a yellow background | 29 | // A container with a yellow background |
| 30 | { | 30 | { |
| 31 | "type": "Control", | 31 | "type": "Control", |
| 32 | + "relayout-enabled": false, | ||
| 32 | "parent-origin": "CENTER", | 33 | "parent-origin": "CENTER", |
| 33 | "anchor-point": "BOTTOM_CENTER", | 34 | "anchor-point": "BOTTOM_CENTER", |
| 34 | "background-color": [1, 1, 0, 1], | 35 | "background-color": [1, 1, 0, 1], |
| @@ -38,10 +39,11 @@ | @@ -38,10 +39,11 @@ | ||
| 38 | // A container with an image | 39 | // A container with an image |
| 39 | { | 40 | { |
| 40 | "type": "Control", | 41 | "type": "Control", |
| 42 | + "relayout-enabled": false, | ||
| 41 | "parent-origin": "CENTER", | 43 | "parent-origin": "CENTER", |
| 42 | "anchor-point": "TOP_CENTER", | 44 | "anchor-point": "TOP_CENTER", |
| 43 | "size": [400, 150, 1], | 45 | "size": [400, 150, 1], |
| 44 | - "background": { | 46 | + "background-image": { |
| 45 | "image": { | 47 | "image": { |
| 46 | "filename": "{DALI_IMAGE_DIR}button-background.png" | 48 | "filename": "{DALI_IMAGE_DIR}button-background.png" |
| 47 | } | 49 | } |
| @@ -51,11 +53,12 @@ | @@ -51,11 +53,12 @@ | ||
| 51 | // A container with the same image blended in with a blue background | 53 | // A container with the same image blended in with a blue background |
| 52 | { | 54 | { |
| 53 | "type": "Control", | 55 | "type": "Control", |
| 56 | + "relayout-enabled": false, | ||
| 54 | "parent-origin": "BOTTOM_CENTER", | 57 | "parent-origin": "BOTTOM_CENTER", |
| 55 | "anchor-point": "BOTTOM_CENTER", | 58 | "anchor-point": "BOTTOM_CENTER", |
| 56 | "size": [400, 150, 1], | 59 | "size": [400, 150, 1], |
| 57 | "background-color": [0, 0, 1, 1], | 60 | "background-color": [0, 0, 1, 1], |
| 58 | - "background": { | 61 | + "background-image": { |
| 59 | "image": { | 62 | "image": { |
| 60 | "filename": "{DALI_IMAGE_DIR}button-background.png" | 63 | "filename": "{DALI_IMAGE_DIR}button-background.png" |
| 61 | } | 64 | } |
resources/scripts/simple-image-wall.js
0 โ 100644
| 1 | +// Image Wall example | ||
| 2 | +// | ||
| 3 | +// Example usage of Dali API | ||
| 4 | +// | ||
| 5 | +// | ||
| 6 | +// | ||
| 7 | +// get the dali-demo image directory path | ||
| 8 | +// hard code for the device to /usr/apps/com.samsung.dali-demo/images/ | ||
| 9 | +var imageDir = dali.DALI_DATA_DIRECTORY; | ||
| 10 | + | ||
| 11 | +if (imageDir != "/usr/share/dali//") { | ||
| 12 | + imageDir = imageDir.substring(0, imageDir.lastIndexOf("dali/")); | ||
| 13 | + imageDir += "com.samsung.dali-demo/images/"; | ||
| 14 | +} else // on device | ||
| 15 | +{ | ||
| 16 | + imageDir = "/usr/apps/com.samsung.dali-demo/images/"; | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | + | ||
| 20 | +var NUMBER_OF_IMAGES = 40; // for now use 16 ( demo files go up to 30) | ||
| 21 | +var DEMO_IMAGES = []; // array to store Dali Images | ||
| 22 | +var VIDEO_WALL_ACTORS = []; // array to store Image actors | ||
| 23 | +var VIDEO_WALL_ROWS = 7; // use 3 rows for the video wall | ||
| 24 | +var VIDEO_WALL_COLUMNS = 12; // use 12 columns for the video wall | ||
| 25 | +var VIDEO_WALL_TOTAL_ITEMS = VIDEO_WALL_COLUMNS * VIDEO_WALL_ROWS; // total items | ||
| 26 | +var VIDEO_WALL_ITEM_SIZE = 128; // width / height of a item in the video wall | ||
| 27 | +var BORDER_SIZE = 5; | ||
| 28 | +var VIDEO_WALL_ITEM_SIZE_NO_BORDER = VIDEO_WALL_ITEM_SIZE - BORDER_SIZE; | ||
| 29 | +var VIDEO_WALL_WIDTH = VIDEO_WALL_COLUMNS * VIDEO_WALL_ITEM_SIZE; | ||
| 30 | +var VIDEO_WALL_HEIGHT = VIDEO_WALL_ROWS * VIDEO_WALL_ITEM_SIZE; | ||
| 31 | + | ||
| 32 | +var daliApp = {}; | ||
| 33 | + | ||
| 34 | +var wallRootActor; // the root actor of the video wall | ||
| 35 | + | ||
| 36 | +// we want demo images of format gallery-small-1.jpg | ||
| 37 | +daliApp.getFileName = function(index) { | ||
| 38 | + fileName = "gallery-small-" + (index+1) + ".jpg"; | ||
| 39 | + return fileName; | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +// load the images | ||
| 43 | +daliApp.loadImages = function() { | ||
| 44 | + for (index = 0; index < NUMBER_OF_IMAGES; ++index) { | ||
| 45 | + fileName = imageDir + daliApp.getFileName(index); | ||
| 46 | + DEMO_IMAGES[index] = new dali.ResourceImage( { url:fileName } ); | ||
| 47 | + } | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +daliApp.createRootActor = function() { | ||
| 51 | + wallRootActor = new dali.Actor(); | ||
| 52 | + wallRootActor.parentOrigin = dali.CENTER; | ||
| 53 | + wallRootActor.anchorPoint = dali.CENTER; | ||
| 54 | + dali.stage.add(wallRootActor); | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + | ||
| 59 | +daliApp.getWallActorIndex = function(x, y) { | ||
| 60 | + return x + y * VIDEO_WALL_COLUMNS; | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | +daliApp.createActors = function() { | ||
| 64 | + daliApp.createRootActor(); | ||
| 65 | + | ||
| 66 | + for (y = 0; y < VIDEO_WALL_ROWS; ++y) { | ||
| 67 | + for (x = 0; x < VIDEO_WALL_COLUMNS; ++x) { | ||
| 68 | + | ||
| 69 | + var actorIndex = daliApp.getWallActorIndex(x, y); | ||
| 70 | + var imageActor = new dali.ImageActor(); | ||
| 71 | + | ||
| 72 | + // wrap image index between 0 and NUMBER_OF_IMAGES | ||
| 73 | + var imageIndex = actorIndex % NUMBER_OF_IMAGES; | ||
| 74 | + | ||
| 75 | + imageActor.setImage(DEMO_IMAGES[imageIndex]); | ||
| 76 | + | ||
| 77 | + imageActor.parentOrigin = dali.CENTER; | ||
| 78 | + imageActor.anchorPoint = dali.CENTER; | ||
| 79 | + imageActor.size = [VIDEO_WALL_ITEM_SIZE_NO_BORDER, VIDEO_WALL_ITEM_SIZE_NO_BORDER, 1.0]; // start with zero size so it zooms up | ||
| 80 | + | ||
| 81 | + var xPosition = x * VIDEO_WALL_ITEM_SIZE; | ||
| 82 | + // as the middle the wall is at zero (relative to wallRootActor), we need to subtract half the wall width. | ||
| 83 | + // + add half item size because the item anchor point is the center of the wallRootActor. | ||
| 84 | + xPosition = xPosition - (VIDEO_WALL_WIDTH / 2) + (VIDEO_WALL_ITEM_SIZE / 2); | ||
| 85 | + | ||
| 86 | + var yPosition = y * VIDEO_WALL_ITEM_SIZE; | ||
| 87 | + yPosition = yPosition - (VIDEO_WALL_HEIGHT / 2) + (VIDEO_WALL_ITEM_SIZE / 2); | ||
| 88 | + | ||
| 89 | + imageActor.position = [xPosition, yPosition, 0.0]; | ||
| 90 | + // store the actor | ||
| 91 | + VIDEO_WALL_ACTORS[actorIndex] = imageActor; | ||
| 92 | + | ||
| 93 | + // Add to the video wall root actor. | ||
| 94 | + wallRootActor.add(imageActor); | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +function Initialise() { | ||
| 100 | + | ||
| 101 | + daliApp.loadImages(); | ||
| 102 | + | ||
| 103 | + daliApp.createActors(); | ||
| 104 | + | ||
| 105 | + | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +Initialise(); |
shared/view.h
| @@ -84,10 +84,11 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | @@ -84,10 +84,11 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | ||
| 84 | const Dali::TextStyle& textStyle ) | 84 | const Dali::TextStyle& textStyle ) |
| 85 | { | 85 | { |
| 86 | Dali::Layer toolBarLayer = Dali::Layer::New(); | 86 | Dali::Layer toolBarLayer = Dali::Layer::New(); |
| 87 | + toolBarLayer.SetName( "TOOLBAR_LAYER" ); | ||
| 87 | toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); | 88 | toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); |
| 88 | toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); | 89 | toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); |
| 89 | - toolBarLayer.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::SourceWidthFixedHeight( style.mToolBarHeight ) ) ); | ||
| 90 | toolBarLayer.SetSize( 0.0f, style.mToolBarHeight ); | 90 | toolBarLayer.SetSize( 0.0f, style.mToolBarHeight ); |
| 91 | + toolBarLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::WIDTH ); | ||
| 91 | 92 | ||
| 92 | // Raise tool bar layer to the top. | 93 | // Raise tool bar layer to the top. |
| 93 | toolBarLayer.RaiseToTop(); | 94 | toolBarLayer.RaiseToTop(); |
| @@ -95,12 +96,14 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | @@ -95,12 +96,14 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | ||
| 95 | // Tool bar | 96 | // Tool bar |
| 96 | Dali::Image image = Dali::ResourceImage::New( toolbarImagePath ); | 97 | Dali::Image image = Dali::ResourceImage::New( toolbarImagePath ); |
| 97 | Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image ); | 98 | Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image ); |
| 99 | + toolBarBackground.SetName( "TOOLBAR_BACKGROUND" ); | ||
| 100 | + toolBarBackground.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS ); | ||
| 98 | toolBar = Dali::Toolkit::ToolBar::New(); | 101 | toolBar = Dali::Toolkit::ToolBar::New(); |
| 102 | + toolBar.SetName( "TOOLBAR" ); | ||
| 99 | toolBar.SetBackground( toolBarBackground ); | 103 | toolBar.SetBackground( toolBarBackground ); |
| 100 | toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); | 104 | toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); |
| 101 | toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); | 105 | toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); |
| 102 | - toolBar.SetSize( 0.0f, style.mToolBarHeight ); | ||
| 103 | - toolBar.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT ); | 106 | + toolBar.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS ); |
| 104 | toolBarBackground.SetSortModifier(1.0f); | 107 | toolBarBackground.SetSortModifier(1.0f); |
| 105 | 108 | ||
| 106 | // Add the tool bar to the too bar layer. | 109 | // Add the tool bar to the too bar layer. |
| @@ -112,7 +115,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | @@ -112,7 +115,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, | ||
| 112 | if( !title.empty() ) | 115 | if( !title.empty() ) |
| 113 | { | 116 | { |
| 114 | Dali::Toolkit::TextView titleActor = Dali::Toolkit::TextView::New(); | 117 | Dali::Toolkit::TextView titleActor = Dali::Toolkit::TextView::New(); |
| 115 | - titleActor.SetName( "ToolbarTitle" ); | 118 | + titleActor.SetName( "TOOLBAR_TITLE" ); |
| 116 | titleActor.SetText( title ); | 119 | titleActor.SetText( title ); |
| 117 | titleActor.SetSize( font.MeasureText( title ) ); | 120 | titleActor.SetSize( font.MeasureText( title ) ); |
| 118 | titleActor.SetStyleToCurrentText(textStyle); | 121 | titleActor.SetStyleToCurrentText(textStyle); |
| @@ -138,6 +141,7 @@ Dali::Layer CreateView( Dali::Application& application, | @@ -138,6 +141,7 @@ Dali::Layer CreateView( Dali::Application& application, | ||
| 138 | 141 | ||
| 139 | // Create default View. | 142 | // Create default View. |
| 140 | view = Dali::Toolkit::View::New(); | 143 | view = Dali::Toolkit::View::New(); |
| 144 | + view.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS ); | ||
| 141 | 145 | ||
| 142 | // Add the view to the stage before setting the background. | 146 | // Add the view to the stage before setting the background. |
| 143 | stage.Add( view ); | 147 | stage.Add( view ); |
| @@ -164,13 +168,11 @@ Dali::Layer CreateView( Dali::Application& application, | @@ -164,13 +168,11 @@ Dali::Layer CreateView( Dali::Application& application, | ||
| 164 | // Add tool bar layer to the view. | 168 | // Add tool bar layer to the view. |
| 165 | view.AddContentLayer( toolBarLayer ); | 169 | view.AddContentLayer( toolBarLayer ); |
| 166 | 170 | ||
| 167 | - | ||
| 168 | - | ||
| 169 | // Create a content layer. | 171 | // Create a content layer. |
| 170 | Dali::Layer contentLayer = Dali::Layer::New(); | 172 | Dali::Layer contentLayer = Dali::Layer::New(); |
| 171 | contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER ); | 173 | contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER ); |
| 172 | contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER ); | 174 | contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER ); |
| 173 | - contentLayer.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT ); | 175 | + contentLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS ); |
| 174 | view.AddContentLayer( contentLayer ); | 176 | view.AddContentLayer( contentLayer ); |
| 175 | contentLayer.LowerBelow( toolBarLayer ); | 177 | contentLayer.LowerBelow( toolBarLayer ); |
| 176 | 178 |