Commit 7ee9a52abd39ff1560a615964523a07bebe12914

Authored by David Steele
2 parents 1a1d0dc7 1d5b074a

Merge branch 'tizen' into devel/new_mesh

Change-Id: I12978fe6e331f545fbdf7d9ba045a183d0ae1376
@@ -39,7 +39,7 @@ T.O.C. @@ -39,7 +39,7 @@ T.O.C.
39 39
40 To build the repository enter the 'build/tizen' folder: 40 To build the repository enter the 'build/tizen' folder:
41 41
42 - cd dali-toolkit/build/tizen 42 + cd dali-demo/build/tizen
43 43
44 Then run the following commands: 44 Then run the following commands:
45 45
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>
@@ -82,4 +85,10 @@ @@ -82,4 +85,10 @@
82 <ui-application appid="path-animation.example" exec="/usr/apps/com.samsung.dali-demo/bin/path-animation.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 85 <ui-application appid="path-animation.example" exec="/usr/apps/com.samsung.dali-demo/bin/path-animation.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
83 <label>Path Animation</label> 86 <label>Path Animation</label>
84 </ui-application> 87 </ui-application>
  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">
  89 + <label>Atlas</label>
  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>
85 </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; ///&lt; Maximum pag @@ -55,10 +55,10 @@ const int MAX_PAGES = 256; ///&lt; 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 }
@@ -181,11 +181,35 @@ bool CompareByTitle( const Example&amp; lhs, const Example&amp; rhs ) @@ -181,11 +181,35 @@ bool CompareByTitle( const Example&amp; lhs, const Example&amp; rhs )
181 } // namespace 181 } // namespace
182 182
183 DaliTableView::DaliTableView( Application& application ) 183 DaliTableView::DaliTableView( Application& application )
184 - : mApplication( application ),  
185 - mScrolling( false ),  
186 - mBackgroundImagePath( DEFAULT_BACKGROUND_IMAGE_PATH ),  
187 - mSortAlphabetically( false ),  
188 - mBackgroundAnimsPlaying( false ) 184 +: mApplication( application ),
  185 + mBackgroundLayer(),
  186 + mRootActor(),
  187 + mRotateAnimation(),
  188 + mBackground(),
  189 + mPressedAnimation(),
  190 + mScrollViewLayer(),
  191 + mScrollView(),
  192 + mScrollViewEffect(),
  193 + mScrollRulerX(),
  194 + mScrollRulerY(),
  195 + mButtons(),
  196 + mPressedActor(),
  197 + mAnimationTimer(),
  198 + mLogoTapDetector(),
  199 + mVersionPopup(),
  200 + mButtonsPageRelativeSize(),
  201 + mPages(),
  202 + mTableViewImages(),
  203 + mBackgroundActors(),
  204 + mBackgroundAnimations(),
  205 + mExampleList(),
  206 + mExampleMap(),
  207 + mBackgroundImagePath( DEFAULT_BACKGROUND_IMAGE_PATH ),
  208 + mTotalPages(),
  209 + mScrolling( false ),
  210 + mSortAlphabetically( false ),
  211 + mBackgroundAnimsPlaying( false ),
  212 + mVersionPopupShown( false )
189 { 213 {
190 application.InitSignal().Connect( this, &DaliTableView::Initialize ); 214 application.InitSignal().Connect( this, &DaliTableView::Initialize );
191 } 215 }
@@ -217,15 +241,14 @@ void DaliTableView::Initialize( Application&amp; application ) @@ -217,15 +241,14 @@ void DaliTableView::Initialize( Application&amp; application )
217 const Vector2 stageSize = Stage::GetCurrent().GetSize(); 241 const Vector2 stageSize = Stage::GetCurrent().GetSize();
218 242
219 // Background 243 // Background
220 - mBackground = CreateBackground( mBackgroundImagePath );  
221 - // set same size as parent actor  
222 - mBackground.SetSize( stageSize );  
223 - Stage::GetCurrent().Add( mBackground ); 244 + Actor background = CreateBackground( mBackgroundImagePath );
  245 + Stage::GetCurrent().Add( background );
224 246
225 // 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.
226 mRootActor = TableView::New( 4, 1 ); 248 mRootActor = TableView::New( 4, 1 );
227 mRootActor.SetAnchorPoint( AnchorPoint::CENTER ); 249 mRootActor.SetAnchorPoint( AnchorPoint::CENTER );
228 mRootActor.SetParentOrigin( ParentOrigin::CENTER ); 250 mRootActor.SetParentOrigin( ParentOrigin::CENTER );
  251 + mRootActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
229 Stage::GetCurrent().Add( mRootActor ); 252 Stage::GetCurrent().Add( mRootActor );
230 253
231 // Toolbar at top 254 // Toolbar at top
@@ -237,32 +260,42 @@ void DaliTableView::Initialize( Application&amp; application ) @@ -237,32 +260,42 @@ void DaliTableView::Initialize( Application&amp; application )
237 DemoHelper::GetDefaultTextStyle()); 260 DemoHelper::GetDefaultTextStyle());
238 261
239 mRootActor.AddChild( toolBarLayer, TableView::CellPosition( 0, 0 ) ); 262 mRootActor.AddChild( toolBarLayer, TableView::CellPosition( 0, 0 ) );
240 - const float toolbarHeight = DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight;  
241 - mRootActor.SetFixedHeight( 0, toolbarHeight ); 263 + mRootActor.SetFitHeight( 0 );
242 264
243 // Add logo 265 // Add logo
244 - mLogo = CreateLogo( LOGO_PATH ); 266 + Dali::ImageActor logo = CreateLogo( LOGO_PATH );
  267 + logo.SetName( "LOGO_IMAGE" );
  268 + logo.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
245 const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y ); 269 const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y );
246 const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO; 270 const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO;
247 - const float logoHeight = mLogo.GetImage().GetHeight() + logoMargin;  
248 - mRootActor.SetFixedHeight( 1, logoHeight ); 271 +
  272 + // Show version in a popup when log is tapped
  273 + mLogoTapDetector = TapGestureDetector::New();
  274 + mLogoTapDetector.Attach( logo );
  275 + mLogoTapDetector.DetectedSignal().Connect( this, &DaliTableView::OnLogoTapped );
249 276
250 const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO; 277 const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO;
251 - mButtonsPageRelativeSize = Vector3( TABLE_RELATIVE_SIZE.x, 1.f - ( toolbarHeight + logoHeight + bottomMargin) / stageSize.height, TABLE_RELATIVE_SIZE.z );  
252 - mRootActor.SetFixedHeight( 2, mButtonsPageRelativeSize.y * stageSize.height );  
253 278
254 Alignment alignment = Alignment::New(); 279 Alignment alignment = Alignment::New();
255 - 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 ));
256 mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) ); 286 mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) );
  287 + mRootActor.SetFitHeight( 1 );
257 288
258 // scrollview occupying the majority of the screen 289 // scrollview occupying the majority of the screen
259 mScrollView = ScrollView::New(); 290 mScrollView = ScrollView::New();
  291 + mScrollView.SetRelayoutEnabled( true );
260 292
261 mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); 293 mScrollView.SetAnchorPoint( AnchorPoint::CENTER );
262 mScrollView.SetParentOrigin( ParentOrigin::CENTER ); 294 mScrollView.SetParentOrigin( ParentOrigin::CENTER );
263 - // Note: Currently, changing mScrollView to use SizeMode RELATIVE_TO_PARENT  
264 - // will cause scroll ends to appear in the wrong position.  
265 - 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 +
266 mScrollView.SetAxisAutoLock( true ); 299 mScrollView.SetAxisAutoLock( true );
267 mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete ); 300 mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete );
268 mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart ); 301 mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart );
@@ -272,12 +305,37 @@ void DaliTableView::Initialize( Application&amp; application ) @@ -272,12 +305,37 @@ void DaliTableView::Initialize( Application&amp; application )
272 mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER ); 305 mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER );
273 mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER ); 306 mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER );
274 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( FILL_TO_PARENT, ALL_DIMENSIONS );
  315 + backgroundColourActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  316 + backgroundColourActor.SetSizeModeFactor( Vector3( 1.0f, 1.5f, 1.0f ) );
  317 + backgroundColourActor.SetZ( BACKGROUND_Z );
  318 + mScrollViewLayer.Add( backgroundColourActor );
275 319
276 // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show 320 // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show
277 - SetupBackground( mScrollView, mScrollViewLayer, stageSize ); 321 + Actor bubbleContainer = Actor::New();
  322 + bubbleContainer.SetRelayoutEnabled( true );
  323 + bubbleContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  324 + bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER );
  325 + bubbleContainer.SetParentOrigin( ParentOrigin::CENTER );
  326 + mScrollViewLayer.Add( bubbleContainer );
  327 +
  328 + SetupBackground( bubbleContainer );
  329 +
  330 + Alignment buttonsAlignment = Alignment::New();
  331 + buttonsAlignment.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  332 + buttonsAlignment.Add( mScrollViewLayer );
278 333
279 mScrollViewLayer.Add( mScrollView ); 334 mScrollViewLayer.Add( mScrollView );
280 - mRootActor.AddChild( mScrollViewLayer, TableView::CellPosition( 2, 0 ) ); 335 +
  336 + mRootActor.AddChild( buttonsAlignment, TableView::CellPosition( 2, 0 ) );
  337 +
  338 + mRootActor.SetFixedHeight( 3, bottomMargin );
281 339
282 // Add scroll view effect and setup constraints on pages 340 // Add scroll view effect and setup constraints on pages
283 ApplyScrollViewEffect(); 341 ApplyScrollViewEffect();
@@ -303,7 +361,7 @@ void DaliTableView::Initialize( Application&amp; application ) @@ -303,7 +361,7 @@ void DaliTableView::Initialize( Application&amp; application )
303 361
304 winHandle.ShowIndicator( Dali::Window::INVISIBLE ); 362 winHandle.ShowIndicator( Dali::Window::INVISIBLE );
305 363
306 - // 364 + // Background animation
307 mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION ); 365 mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION );
308 mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation ); 366 mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation );
309 mAnimationTimer.Start(); 367 mAnimationTimer.Start();
@@ -319,12 +377,10 @@ void DaliTableView::ApplyCubeEffectToActors() @@ -319,12 +377,10 @@ void DaliTableView::ApplyCubeEffectToActors()
319 { 377 {
320 Actor page = *pageIter; 378 Actor page = *pageIter;
321 379
322 - unsigned int numChildren = page.GetChildCount();  
323 - Actor pageActor = page;  
324 - for( unsigned int i=0; i<numChildren; ++i) 380 + for( unsigned int i = 0, numChildren = page.GetChildCount(); i < numChildren; ++i)
325 { 381 {
326 // Remove old effect's manual constraints. 382 // Remove old effect's manual constraints.
327 - Actor child = pageActor.GetChildAt(i); 383 + Actor child = page.GetChildAt(i);
328 if( child ) 384 if( child )
329 { 385 {
330 ApplyCubeEffectToActor( child ); 386 ApplyCubeEffectToActor( child );
@@ -332,6 +388,12 @@ void DaliTableView::ApplyCubeEffectToActors() @@ -332,6 +388,12 @@ void DaliTableView::ApplyCubeEffectToActors()
332 } 388 }
333 } 389 }
334 } 390 }
  391 +
  392 +void DaliTableView::OnButtonsPageRelayout( const Dali::Actor& actor )
  393 +{
  394 +
  395 +}
  396 +
335 void DaliTableView::Populate() 397 void DaliTableView::Populate()
336 { 398 {
337 const Vector2 stageSize = Stage::GetCurrent().GetSize(); 399 const Vector2 stageSize = Stage::GetCurrent().GetSize();
@@ -352,20 +414,15 @@ void DaliTableView::Populate() @@ -352,20 +414,15 @@ void DaliTableView::Populate()
352 for( int t = 0; t < mTotalPages; t++ ) 414 for( int t = 0; t < mTotalPages; t++ )
353 { 415 {
354 // Create Table. (contains up to 9 Examples) 416 // Create Table. (contains up to 9 Examples)
355 - Actor page = Actor::New();  
356 -  
357 - // Add tableView to container.  
358 - mScrollView.Add( page );  
359 - 417 + TableView page = TableView::New( 3, 3 );
360 page.SetAnchorPoint( AnchorPoint::CENTER ); 418 page.SetAnchorPoint( AnchorPoint::CENTER );
361 page.SetParentOrigin( ParentOrigin::CENTER ); 419 page.SetParentOrigin( ParentOrigin::CENTER );
362 - page.SetSizeMode( SIZE_EQUAL_TO_PARENT );  
363 -  
364 - // add cells to table  
365 - const float margin = 4.0f; 420 + page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  421 + mScrollView.Add( page );
366 422
367 // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi. 423 // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi.
368 - const Size tileSize((stageSize.x * mButtonsPageRelativeSize.x / EXAMPLES_PER_ROW) - margin, (stageSize.y * mButtonsPageRelativeSize.y / ROWS_PER_PAGE) - margin ); 424 + const float margin = 2.0f;
  425 + const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW;
369 426
370 for(int row = 0; row < ROWS_PER_PAGE; row++) 427 for(int row = 0; row < ROWS_PER_PAGE; row++)
371 { 428 {
@@ -373,7 +430,7 @@ void DaliTableView::Populate() @@ -373,7 +430,7 @@ void DaliTableView::Populate()
373 { 430 {
374 const Example& example = ( *iter ); 431 const Example& example = ( *iter );
375 432
376 - Actor tile = CreateTile( example.name, example.title, tileSize, true ); 433 + Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), true );
377 FocusManager focusManager = FocusManager::Get(); 434 FocusManager focusManager = FocusManager::Get();
378 focusManager.SetFocusOrder( tile, ++exampleCount ); 435 focusManager.SetFocusOrder( tile, ++exampleCount );
379 focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL, 436 focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL,
@@ -382,12 +439,9 @@ void DaliTableView::Populate() @@ -382,12 +439,9 @@ void DaliTableView::Populate()
382 focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT, 439 focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT,
383 "You can run this example" ); 440 "You can run this example" );
384 441
385 - Vector3 position( margin * 0.5f + (tileSize.x + margin) * column - stageSize.width * mButtonsPageRelativeSize.x * 0.5f,  
386 - margin * 0.5f + (tileSize.y + margin) * row - stageSize.height * mButtonsPageRelativeSize.y * 0.5f,  
387 - 0.0f);  
388 - tile.SetPosition( position + Vector3( tileSize.x, tileSize.y, 0.0f ) * 0.5f );  
389 - tile.SetSize( tileSize );  
390 - page.Add( tile ); 442 + tile.SetPadding( Padding( margin, margin, margin, margin ) );
  443 +
  444 + page.AddChild( tile, TableView::CellPosition( row, column ) );
391 445
392 iter++; 446 iter++;
393 447
@@ -404,7 +458,7 @@ void DaliTableView::Populate() @@ -404,7 +458,7 @@ void DaliTableView::Populate()
404 } 458 }
405 459
406 // Set tableview position 460 // Set tableview position
407 - Vector3 pagePos( stageSize.x * mButtonsPageRelativeSize.x * t, 0.0f, 0.0f ); 461 + Vector3 pagePos( stageSize.width * TABLE_RELATIVE_SIZE.x * t, 0.0f, 0.0f );
408 page.SetPosition( pagePos ); 462 page.SetPosition( pagePos );
409 463
410 mPages.push_back( page ); 464 mPages.push_back( page );
@@ -417,9 +471,9 @@ void DaliTableView::Populate() @@ -417,9 +471,9 @@ void DaliTableView::Populate()
417 } 471 }
418 472
419 // Update Ruler info. 473 // Update Ruler info.
420 - mScrollRulerX = new FixedRuler( stageSize.width * mButtonsPageRelativeSize.x ); 474 + mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x );
421 mScrollRulerY = new DefaultRuler(); 475 mScrollRulerY = new DefaultRuler();
422 - mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * mButtonsPageRelativeSize.x, true ) ); 476 + mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * TABLE_RELATIVE_SIZE.x, true ) );
423 mScrollRulerY->Disable(); 477 mScrollRulerY->Disable();
424 mScrollView.SetRulerX( mScrollRulerX ); 478 mScrollView.SetRulerX( mScrollRulerX );
425 mScrollView.SetRulerY( mScrollRulerY ); 479 mScrollView.SetRulerY( mScrollRulerY );
@@ -453,12 +507,16 @@ void DaliTableView::Rotate( unsigned int degrees ) @@ -453,12 +507,16 @@ void DaliTableView::Rotate( unsigned int degrees )
453 mRotateAnimation.Play(); 507 mRotateAnimation.Play();
454 } 508 }
455 509
456 -Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Size& parentSize, bool addBackground ) 510 +Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground )
457 { 511 {
458 - Actor tile = Actor::New();  
459 - tile.SetName( name );  
460 - tile.SetAnchorPoint( AnchorPoint::CENTER );  
461 - tile.SetParentOrigin( ParentOrigin::CENTER ); 512 + Actor content = Actor::New();
  513 + content.SetName( name );
  514 + content.SetAnchorPoint( AnchorPoint::CENTER );
  515 + content.SetParentOrigin( ParentOrigin::CENTER );
  516 + content.SetRelayoutEnabled( true );
  517 + content.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  518 + content.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  519 + content.SetSizeModeFactor( sizeMultiplier );
462 520
463 // create background image 521 // create background image
464 if( addBackground ) 522 if( addBackground )
@@ -468,16 +526,17 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit @@ -468,16 +526,17 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit
468 image.SetAnchorPoint( AnchorPoint::CENTER ); 526 image.SetAnchorPoint( AnchorPoint::CENTER );
469 image.SetParentOrigin( ParentOrigin::CENTER ); 527 image.SetParentOrigin( ParentOrigin::CENTER );
470 // make the image 100% of tile 528 // make the image 100% of tile
471 - image.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 529 + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  530 +
472 // move image back to get text appear in front 531 // move image back to get text appear in front
473 image.SetZ( -1 ); 532 image.SetZ( -1 );
474 image.SetStyle( ImageActor::STYLE_NINE_PATCH ); 533 image.SetStyle( ImageActor::STYLE_NINE_PATCH );
475 image.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) ); 534 image.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) );
476 - tile.Add( image ); 535 + content.Add( image );
477 536
478 // Add stencil 537 // Add stencil
479 ImageActor stencil = NewStencilImage(); 538 ImageActor stencil = NewStencilImage();
480 - stencil.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 539 + stencil.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
481 image.Add( stencil ); 540 image.Add( stencil );
482 } 541 }
483 542
@@ -488,22 +547,23 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit @@ -488,22 +547,23 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit
488 text.SetMultilinePolicy( Toolkit::TextView::SplitByWord ); 547 text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
489 text.SetLineJustification( Toolkit::TextView::Center ); 548 text.SetLineJustification( Toolkit::TextView::Center );
490 text.SetTextAlignment( Toolkit::Alignment::Type( Alignment::HorizontalCenter | Alignment::VerticalCenter ) ); 549 text.SetTextAlignment( Toolkit::Alignment::Type( Alignment::HorizontalCenter | Alignment::VerticalCenter ) );
491 - text.SetColor( Color::WHITE );  
492 text.SetZ( 1 ); 550 text.SetZ( 1 );
493 // make the text 90% of tile 551 // make the text 90% of tile
494 - text.SetSize( 0.9f * parentSize.width, 0.9f * parentSize.height ); 552 + text.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  553 + text.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  554 + text.SetSizeModeFactor( Vector3( 0.9f, 0.9f, 0.0f ) );
495 text.SetStyleToCurrentText( GetTableTextStyle() ); 555 text.SetStyleToCurrentText( GetTableTextStyle() );
496 text.SetSnapshotModeEnabled( false ); 556 text.SetSnapshotModeEnabled( false );
497 - tile.Add( text ); 557 + content.Add( text );
498 558
499 // Set the tile to be keyboard focusable 559 // Set the tile to be keyboard focusable
500 - tile.SetKeyboardFocusable(true); 560 + content.SetKeyboardFocusable(true);
501 561
502 // connect to the touch events 562 // connect to the touch events
503 - tile.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed );  
504 - tile.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered ); 563 + content.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed );
  564 + content.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered );
505 565
506 - return tile; 566 + return content;
507 } 567 }
508 568
509 ImageActor DaliTableView::NewStencilImage() 569 ImageActor DaliTableView::NewStencilImage()
@@ -624,8 +684,6 @@ void DaliTableView::OnScrollComplete( const Dali::Vector3&amp; position ) @@ -624,8 +684,6 @@ void DaliTableView::OnScrollComplete( const Dali::Vector3&amp; position )
624 // move focus to 1st item of new page 684 // move focus to 1st item of new page
625 FocusManager focusManager = FocusManager::Get(); 685 FocusManager focusManager = FocusManager::Get();
626 focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) ); 686 focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) );
627 -  
628 - ApplyCubeEffectToActors();  
629 } 687 }
630 688
631 bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event ) 689 bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event )
@@ -679,42 +737,77 @@ void DaliTableView::OnKeyEvent( const KeyEvent&amp; event ) @@ -679,42 +737,77 @@ void DaliTableView::OnKeyEvent( const KeyEvent&amp; event )
679 { 737 {
680 if ( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) 738 if ( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
681 { 739 {
682 - mApplication.Quit(); 740 + if ( mVersionPopup && mVersionPopupShown )
  741 + {
  742 + HideVersionPopup();
  743 + }
  744 + else
  745 + {
  746 + mApplication.Quit();
  747 + }
683 } 748 }
684 } 749 }
685 } 750 }
686 751
687 -void DaliTableView::SetupBackground( Actor bubbleContainer, Actor backgroundLayer, const Vector2& size ) 752 +void DaliTableView::SetupBackground( Actor bubbleContainer )
688 { 753 {
689 // Create distance field shape. 754 // Create distance field shape.
690 BufferImage distanceField; 755 BufferImage distanceField;
691 Size imageSize( 512, 512 ); 756 Size imageSize( 512, 512 );
692 CreateShapeImage( CIRCLE, imageSize, distanceField ); 757 CreateShapeImage( CIRCLE, imageSize, distanceField );
693 758
694 - // Create solid background colour.  
695 - ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR );  
696 - backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER );  
697 - backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER );  
698 - backgroundColourActor.SetSize( size * BACKGROUND_SIZE_SCALE );  
699 - backgroundColourActor.SetZ( BACKGROUND_Z );  
700 - backgroundColourActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );  
701 - backgroundLayer.Add( backgroundColourActor );  
702 -  
703 // Add bubbles to the bubbleContainer. 759 // Add bubbles to the bubbleContainer.
704 // Note: The bubbleContainer is parented externally to this function. 760 // Note: The bubbleContainer is parented externally to this function.
705 - AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField, size ); 761 + AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField );
  762 +}
  763 +
  764 +void DaliTableView::InitialiseBackgroundActors( Actor actor )
  765 +{
  766 + // Delete current animations
  767 + mBackgroundAnimations.clear();
  768 +
  769 + // Create new animations
  770 + const Vector3 size = actor.GetTargetSize();
  771 +
  772 + for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i )
  773 + {
  774 + Actor child = actor.GetChildAt( i );
  775 +
  776 + const Vector3 childSize = child.GetTargetSize();
  777 +
  778 + // Calculate a random position
  779 + Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ),
  780 + Random::Range( -size.y * 0.5f - childSize.height, size.y * 0.5f + childSize.height ),
  781 + Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) );
  782 +
  783 + child.SetPosition( childPos );
  784 +
  785 + // Define bubble horizontal parallax and vertical wrapping
  786 + Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::POSITION,
  787 + Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),
  788 + Dali::ParentSource( Dali::Actor::Property::SIZE ),
  789 + AnimateBubbleConstraint( childPos, Random::Range( -0.85f, 0.25f ), childSize.height ) );
  790 + child.ApplyConstraint( animConstraint );
  791 +
  792 + // Kickoff animation
  793 + Animation animation = Animation::New( Random::Range( 40.0f, 80.0f ) );
  794 + animation.MoveBy( child, Vector3( 0.0f, -1.0f, 0.0f ), AlphaFunctions::Linear );
  795 + animation.SetLooping( true );
  796 + animation.Play();
  797 + mBackgroundAnimations.push_back( animation );
  798 + }
706 } 799 }
707 800
708 -void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField, const Dali::Vector2& size ) 801 +void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField )
709 { 802 {
710 for( int i = 0; i < count; ++i ) 803 for( int i = 0; i < count; ++i )
711 { 804 {
712 float randSize = Random::Range( 10.0f, 400.0f ); 805 float randSize = Random::Range( 10.0f, 400.0f );
713 float hue = Random::Range( 0.3f, 1.0f ); 806 float hue = Random::Range( 0.3f, 1.0f );
714 - Vector4 randColour( hue, hue*0.5, 0.0f, Random::Range( 0.3f, 0.6f )); 807 + Vector4 randColour( hue, hue * 0.5, 0.0f, Random::Range( 0.3f, 0.6f ));
715 808
716 ImageActor dfActor = ImageActor::New( distanceField ); 809 ImageActor dfActor = ImageActor::New( distanceField );
717 - mBackgroundActors.push_back( dfActor ); 810 + dfActor.SetRelayoutEnabled( false );
718 dfActor.SetSize( Vector2( randSize, randSize ) ); 811 dfActor.SetSize( Vector2( randSize, randSize ) );
719 dfActor.SetParentOrigin( ParentOrigin::CENTER ); 812 dfActor.SetParentOrigin( ParentOrigin::CENTER );
720 813
@@ -724,33 +817,10 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis @@ -724,33 +817,10 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis
724 effect.SetOutlineParams( Vector2( 0.55f, 0.00f ) ); 817 effect.SetOutlineParams( Vector2( 0.55f, 0.00f ) );
725 effect.SetSmoothingEdge( 0.5f ); 818 effect.SetSmoothingEdge( 0.5f );
726 layer.Add( dfActor ); 819 layer.Add( dfActor );
727 -  
728 - // Setup animation  
729 - Vector3 actorPos(  
730 - Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ),  
731 - Random::Range( -size.y * 0.5f - randSize, size.y * 0.5f + randSize ),  
732 - Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) );  
733 - dfActor.SetPosition( actorPos );  
734 -  
735 - // Define bubble horizontal parallax and vertical wrapping  
736 - Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::Position,  
737 - Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),  
738 - Dali::ParentSource( Dali::Actor::Property::Size ),  
739 - AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.25f ), randSize ) );  
740 - dfActor.ApplyConstraint( animConstraint );  
741 -  
742 - // Kickoff animation  
743 - Animation animation = Animation::New( Random::Range( 40.0f, 200.0f ) );  
744 - KeyFrames keyframes = KeyFrames::New();  
745 - keyframes.Add( 0.0f, actorPos );  
746 - Vector3 toPos( actorPos );  
747 - toPos.y -= ( size.y + randSize );  
748 - keyframes.Add( 1.0f, toPos );  
749 - animation.AnimateBetween( Property( dfActor, Actor::Property::Position ), keyframes );  
750 - animation.SetLooping( true );  
751 - animation.Play();  
752 - mBackgroundAnimations.push_back( animation );  
753 } 820 }
  821 +
  822 + // Positioning will occur when the layer is relaid out
  823 + layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors );
754 } 824 }
755 825
756 void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut ) 826 void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut )
@@ -823,7 +893,7 @@ ImageActor DaliTableView::CreateLogo( std::string imagePath ) @@ -823,7 +893,7 @@ ImageActor DaliTableView::CreateLogo( std::string imagePath )
823 ImageActor logo = ImageActor::New( image ); 893 ImageActor logo = ImageActor::New( image );
824 894
825 logo.SetAnchorPoint( AnchorPoint::CENTER ); 895 logo.SetAnchorPoint( AnchorPoint::CENTER );
826 - logo.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); 896 + logo.SetParentOrigin( ParentOrigin::CENTER );
827 897
828 return logo; 898 return logo;
829 } 899 }
@@ -945,4 +1015,49 @@ bool DaliTableView::OnTileHovered( Actor actor, const HoverEvent&amp; event ) @@ -945,4 +1015,49 @@ bool DaliTableView::OnTileHovered( Actor actor, const HoverEvent&amp; event )
945 return true; 1015 return true;
946 } 1016 }
947 1017
  1018 +void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap )
  1019 +{
  1020 + if ( !mVersionPopupShown )
  1021 + {
  1022 + if ( !mVersionPopup )
  1023 + {
  1024 + std::ostringstream stream;
  1025 + stream << "DALi Core: " << CORE_MAJOR_VERSION << "." << CORE_MINOR_VERSION << "." << CORE_MICRO_VERSION << std::endl << "(" << CORE_BUILD_DATE << ")" << std::endl << std::endl;
  1026 + stream << "DALi Adaptor: " << ADAPTOR_MAJOR_VERSION << "." << ADAPTOR_MINOR_VERSION << "." << ADAPTOR_MICRO_VERSION << std::endl << "(" << ADAPTOR_BUILD_DATE << ")" << std::endl << std::endl;
  1027 + stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")";
  1028 +
  1029 + mVersionPopup = Dali::Toolkit::Popup::New();
  1030 + mVersionPopup.SetParentOrigin( ParentOrigin::CENTER );
  1031 + mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER );
  1032 + mVersionPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1033 + mVersionPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  1034 + mVersionPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
  1035 + mVersionPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  1036 + mVersionPopup.SetTitle( stream.str() );
  1037 + mVersionPopup.HideTail();
  1038 + mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup );
  1039 + mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden );
  1040 +
  1041 + mVersionPopup.MarkDirtyForRelayout();
  1042 + }
  1043 +
  1044 + mVersionPopup.Show();
  1045 + mVersionPopupShown = true;
  1046 + }
  1047 +}
  1048 +
  1049 +void DaliTableView::HideVersionPopup()
  1050 +{
  1051 + if ( mVersionPopup )
  1052 + {
  1053 + mVersionPopup.Hide();
  1054 + }
  1055 +}
948 1056
  1057 +void DaliTableView::PopupHidden()
  1058 +{
  1059 + if ( mVersionPopup )
  1060 + {
  1061 + mVersionPopupShown = false;
  1062 + }
  1063 +}
demo/dali-table-view.h
@@ -165,7 +165,7 @@ private: // Application callbacks &amp; implementation @@ -165,7 +165,7 @@ private: // Application callbacks &amp; 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 &amp; implementation @@ -276,9 +276,8 @@ private: // Application callbacks &amp; 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 &amp; implementation @@ -286,9 +285,8 @@ private: // Application callbacks &amp; 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
@@ -360,38 +358,73 @@ private: // Application callbacks &amp; implementation @@ -360,38 +358,73 @@ private: // Application callbacks &amp; implementation
360 */ 358 */
361 void OnFocusedActorActivated( Dali::Actor activatedActor ); 359 void OnFocusedActorActivated( Dali::Actor activatedActor );
362 360
  361 + /**
  362 + * Called when the logo is tapped
  363 + *
  364 + * @param[in] actor The tapped actor
  365 + * @param[in] tap The tap information.
  366 + */
  367 + void OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap );
  368 +
  369 + /**
  370 + * Hides the popup
  371 + */
  372 + void HideVersionPopup();
  373 +
  374 + /**
  375 + * Called when the popup is completely hidden
  376 + */
  377 + void PopupHidden();
  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 +
363 private: 393 private:
364 394
365 - Dali::Application& mApplication; ///< Application instance.  
366 - Dali::Layer mBackgroundLayer; ///< Background resides on a separate layer.  
367 - Dali::Toolkit::TableView mRootActor; ///< All content (excluding background is anchored to this Actor)  
368 - Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor.  
369 - Dali::ImageActor mBackground; ///< Background's static image.  
370 - Dali::ImageActor mLogo; ///< Logo's static image.  
371 - Dali::Animation mPressedAnimation; ///< Button press scaling animation.  
372 - Dali::Layer mScrollViewLayer; ///< ScrollView resides on a separate layer.  
373 - Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples)  
374 - Dali::Toolkit::ScrollViewEffect mScrollViewEffect; ///< Effect to be applied to the scroll view  
375 - bool mScrolling; ///< Flag indicating whether view is currently being scrolled  
376 - Dali::Toolkit::RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler  
377 - Dali::Toolkit::RulerPtr mScrollRulerY; ///< ScrollView Y (vertical) ruler  
378 - Dali::Toolkit::TableView mButtons; ///< Navigation buttons  
379 - ExampleList mExampleList; ///< List of examples.  
380 - ExampleMap mExampleMap; ///< Map LUT for examples.  
381 - Dali::ActorContainer mPages; ///< List of pages.  
382 - Dali::Actor mPressedActor; ///< The currently pressed actor.  
383 - int mTotalPages; ///< Total pages within scrollview.  
384 - std::string mBackgroundImagePath; ///< The path to the background image.  
385 - bool mSortAlphabetically; ///< Sort examples alphabetically.  
386 -  
387 - Dali::ActorContainer mTableViewImages; ///< Offscreen render of tableview  
388 - Dali::ActorContainer mBackgroundActors; ///< List of background actors used in the effect  
389 -  
390 - AnimationList mBackgroundAnimations;///< List of background bubble animations  
391 - Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period  
392 - bool mBackgroundAnimsPlaying; ///< Are background animations playing  
393 -  
394 - Dali::Vector3 mButtonsPageRelativeSize; ///< Size of a buttons page relative to the stage size 395 + Dali::Application& mApplication; ///< Application instance.
  396 + Dali::Layer mBackgroundLayer; ///< Background resides on a separate layer.
  397 + Dali::Toolkit::TableView mRootActor; ///< All content (excluding background is anchored to this Actor)
  398 + Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor.
  399 + Dali::ImageActor mBackground; ///< Background's static image.
  400 + Dali::Animation mPressedAnimation; ///< Button press scaling animation.
  401 + Dali::Layer mScrollViewLayer; ///< ScrollView resides on a separate layer.
  402 + Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples)
  403 + Dali::Toolkit::ScrollViewEffect mScrollViewEffect; ///< Effect to be applied to the scroll view
  404 + Dali::Toolkit::RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler
  405 + Dali::Toolkit::RulerPtr mScrollRulerY; ///< ScrollView Y (vertical) ruler
  406 + Dali::Toolkit::TableView mButtons; ///< Navigation buttons
  407 + Dali::Actor mPressedActor; ///< The currently pressed actor.
  408 + Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period
  409 + Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo
  410 + Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information
  411 + Dali::Vector3 mButtonsPageRelativeSize; ///< Size of a buttons page relative to the stage size
  412 +
  413 + Dali::ActorContainer mPages; ///< List of pages.
  414 + Dali::ActorContainer mTableViewImages; ///< Offscreen render of tableview
  415 + Dali::ActorContainer mBackgroundActors; ///< List of background actors used in the effect
  416 + AnimationList mBackgroundAnimations; ///< List of background bubble animations
  417 + ExampleList mExampleList; ///< List of examples.
  418 + ExampleMap mExampleMap; ///< Map LUT for examples.
  419 +
  420 + std::string mBackgroundImagePath; ///< The path to the background image.
  421 + int mTotalPages; ///< Total pages within scrollview.
  422 +
  423 + bool mScrolling:1; ///< Flag indicating whether view is currently being scrolled
  424 + bool mSortAlphabetically:1; ///< Sort examples alphabetically.
  425 + bool mBackgroundAnimsPlaying:1; ///< Are background animations playing
  426 + bool mVersionPopupShown:1; ///< Whehter the version popup is shown or not
  427 +
395 }; 428 };
396 429
397 #endif // __DALI_DEMO_H__ 430 #endif // __DALI_DEMO_H__
examples/atlas/atlas-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 +#include <dali/dali.h>
  19 +#include "shared/view.h"
  20 +#include <iostream>
  21 +#include <cstdio>
  22 +
  23 +using namespace Dali;
  24 +
  25 +class AtlasController;
  26 +
  27 +namespace
  28 +{
  29 +const char * const BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-gradient.jpg" );
  30 +const char * const TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
  31 +const char * const LOSE_CONTEXT_IMAGE( DALI_IMAGE_DIR "icon-cluster-wobble.png" );
  32 +
  33 +Application gApplication;
  34 +AtlasController* gAtlasController(NULL);
  35 +}
  36 +
  37 +class AtlasController : public ConnectionTracker
  38 +{
  39 +public:
  40 +
  41 + AtlasController( Application& application )
  42 + : mApplication( application )
  43 + {
  44 + // Connect to the Application's Init signal
  45 + mApplication.InitSignal().Connect( this, &AtlasController::Create );
  46 + }
  47 +
  48 + ~AtlasController()
  49 + {
  50 + // Nothing to do here;
  51 + }
  52 +
  53 + void Create( Application& application )
  54 + {
  55 + // Get a handle to the stage
  56 + Stage stage = Stage::GetCurrent();
  57 + stage.SetBackgroundColor(Color::YELLOW);
  58 +
  59 + // Respond to a click anywhere on the stage
  60 + stage.KeyEventSignal().Connect(this, &AtlasController::OnKeyEvent);
  61 +
  62 + mApplication.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
  63 +
  64 + mContentLayer = DemoHelper::CreateView( mApplication,
  65 + mView,
  66 + mToolBar,
  67 + BACKGROUND_IMAGE,
  68 + TOOLBAR_IMAGE,
  69 + "Atlas" );
  70 +
  71 + mLoseContextButton = Toolkit::PushButton::New();
  72 + mLoseContextButton.SetBackgroundImage( ResourceImage::New( LOSE_CONTEXT_IMAGE ) );
  73 + mLoseContextButton.ClickedSignal().Connect( this, &AtlasController::OnLoseContextButtonClicked );
  74 + mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
  75 +
  76 + mAtlas = Atlas::New( 400,300, Pixel::RGBA8888);
  77 + mAtlas.Clear(Vector4(0.f,0.5f,0.5f,0.5f));
  78 + mAtlas.Upload( DALI_IMAGE_DIR "icon-change.png", 50, 30 );
  79 + mAtlas.Upload( DALI_IMAGE_DIR "icon-cluster-carousel.png", 100, 30 );
  80 + mAtlas.Upload( DALI_IMAGE_DIR "icon-effects-on.png", 150, 30 );
  81 + mAtlas.Upload( DALI_IMAGE_DIR "icon-effect-cross.png", 100, 80 );
  82 + mAtlas.Upload( DALI_IMAGE_DIR "icon-effect-fold.png", 150, 80 );
  83 + mAtlas.Upload( DALI_IMAGE_DIR "icon-effect-wave.png", 200, 80 );
  84 + mAtlas.Upload( DALI_IMAGE_DIR "icon-item-view-layout-depth.png", 150, 130 );
  85 + mAtlas.Upload( DALI_IMAGE_DIR "icon-item-view-layout-grid.png", 200, 130 );
  86 + mAtlas.Upload( DALI_IMAGE_DIR "icon-item-view-layout-spiral.png", 250, 130 );
  87 + UploadBufferImages();
  88 +
  89 + ImageActor imageActor1 = ImageActor::New( mAtlas );
  90 + imageActor1.SetY(-170.f);
  91 + imageActor1.SetParentOrigin(ParentOrigin::CENTER);
  92 + mContentLayer.Add( imageActor1 );
  93 +
  94 + Atlas atlas2 = Atlas::New( 400,400, Pixel::RGB888);
  95 + atlas2.Clear( Color::RED );
  96 + atlas2.Upload( DALI_IMAGE_DIR "gallery-small-1.jpg", 4, 4 );
  97 + atlas2.Clear( Color::BLUE );
  98 + atlas2.Upload( DALI_IMAGE_DIR "gallery-small-2.jpg", 136, 4 );
  99 + atlas2.Upload( DALI_IMAGE_DIR "gallery-small-3.jpg", 268, 4 );
  100 + atlas2.Upload( DALI_IMAGE_DIR "gallery-small-4.jpg", 4, 136 );
  101 + atlas2.Upload( DALI_IMAGE_DIR "gallery-small-5.jpg", 136, 136 );
  102 + atlas2.Upload( DALI_IMAGE_DIR "gallery-small-6.jpg", 268, 135 );
  103 + atlas2.Upload( DALI_IMAGE_DIR "gallery-small-7.jpg", 4, 268 );
  104 + atlas2.Upload( DALI_IMAGE_DIR "gallery-small-7.jpg", 136, 268 );
  105 + atlas2.Upload( DALI_IMAGE_DIR "gallery-small-7.jpg", 268, 268 );
  106 +
  107 +
  108 + ImageActor imageActor2 = ImageActor::New( atlas2 );
  109 + imageActor2.SetY(200.f);
  110 + imageActor2.SetZ(-1.f);
  111 + imageActor2.SetParentOrigin(ParentOrigin::CENTER);
  112 + mContentLayer.Add( imageActor2 );
  113 +
  114 + mPanGestureDetector = PanGestureDetector::New();
  115 + mPanGestureDetector.DetectedSignal().Connect(this, &AtlasController::OnPanGesture);
  116 + mPanGestureDetector.Attach(imageActor1);
  117 + mPanGestureDetector.Attach(imageActor2);
  118 +
  119 + stage.ContextLostSignal().Connect(this, &AtlasController::OnContextLost);
  120 + stage.ContextRegainedSignal().Connect(this, &AtlasController::OnContextRegained);
  121 + }
  122 +
  123 + void UploadBufferImages()
  124 + {
  125 + mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 1.f, 0.5f ), 80, 90 ), 0, 210 );
  126 + mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 0.75f, 0.5f ), 80, 80 ), 40, 210 );
  127 + mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 0.5f, 0.5f ), 80, 70 ), 80, 210 );
  128 + mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 0.25f, 0.5f ), 80, 60 ), 120, 210 );
  129 + mAtlas.Upload( CreateBufferImage( Vector4(1.f, 1.f, 0.f, 0.5f ), 80, 50 ), 160, 210 );
  130 + mAtlas.Upload( CreateBufferImage( Vector4(0.75f, 0.75f, 0.f, 0.5f ), 80, 40 ), 200, 210 );
  131 + mAtlas.Upload( CreateBufferImage( Vector4(0.5f, 0.5f, 0.f, 0.5f ), 80, 30 ), 240, 210 );
  132 + mAtlas.Upload( CreateBufferImage( Vector4(0.25f, 0.25f, 0.f, 0.5f ), 80, 20 ), 280, 210 );
  133 + mAtlas.Upload( CreateBufferImage( Vector4(0.1f, 0.1f, 0.f, 0.5f ), 80, 10 ), 320, 210 );
  134 + BufferImage redBlock = CreateBufferImage( Color::RED, 40, 40 );
  135 + mAtlas.Upload(redBlock, 320, 30);
  136 + mAtlas.Upload(redBlock, 320, 80);
  137 + mAtlas.Upload(redBlock, 320, 130);
  138 + }
  139 +
  140 + static void NewWindow(void)
  141 + {
  142 + PositionSize posSize(0, 0, 720, 1280);
  143 + gApplication.ReplaceWindow(posSize, "NewWindow"); // Generates a new window
  144 + }
  145 +
  146 + bool OnLoseContextButtonClicked( Toolkit::Button button )
  147 + {
  148 + // Add as an idle callback to avoid ProcessEvents being recursively called.
  149 + mApplication.AddIdle(MakeCallback( AtlasController::NewWindow ));
  150 + return true;
  151 + }
  152 +
  153 + void OnKeyEvent( const KeyEvent& event )
  154 + {
  155 + if(event.state == KeyEvent::Down)
  156 + {
  157 + if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
  158 + {
  159 + mApplication.Quit();
  160 + }
  161 + }
  162 + }
  163 +
  164 + void OnPanGesture( Actor actor, const PanGesture& gesture )
  165 + {
  166 + if( gesture.state == Gesture::Continuing )
  167 + {
  168 + actor.TranslateBy( Vector3( gesture.displacement ) );
  169 + }
  170 + }
  171 +
  172 + void OnContextLost()
  173 + {
  174 + printf("Stage reporting context loss\n");
  175 + }
  176 +
  177 + void OnContextRegained()
  178 + {
  179 + printf("Stage reporting context regain\n");
  180 + UploadBufferImages();
  181 + }
  182 +
  183 +private:
  184 +
  185 + BufferImage CreateBufferImage( const Vector4& color, const unsigned int width, const unsigned int height )
  186 + {
  187 + BufferImage imageData = BufferImage::New( width, height, Pixel::RGBA8888 );
  188 +
  189 + // Create the image
  190 + PixelBuffer* pixbuf = imageData.GetBuffer();
  191 + const unsigned int bitmapSize = width * height;
  192 + for( size_t i = 0; i < bitmapSize; ++i )
  193 + {
  194 + pixbuf[i*4+0] = 0xFF * color.r;
  195 + pixbuf[i*4+1] = 0xFF * color.g;
  196 + pixbuf[i*4+2] = 0xFF * color.b;
  197 + pixbuf[i*4+3] = 0xFF * color.a;
  198 + }
  199 +
  200 + imageData.Update();
  201 +
  202 + return imageData;
  203 + }
  204 +
  205 +
  206 +private:
  207 + Application& mApplication;
  208 + PanGestureDetector mPanGestureDetector;
  209 +
  210 + Toolkit::View mView; ///< The View instance.
  211 + Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  212 + Toolkit::TextView mTitleActor; ///< The Toolbar's Title.
  213 + Layer mContentLayer; ///< Content layer (scrolling cluster content)
  214 + Toolkit::PushButton mLoseContextButton;
  215 + Atlas mAtlas;
  216 +};
  217 +
  218 +void RunTest( Application& application )
  219 +{
  220 + gAtlasController = new AtlasController(application);
  221 + application.MainLoop(Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS);
  222 +}
  223 +
  224 +// Entry point for Linux & Tizen applications
  225 +//
  226 +int main( int argc, char **argv )
  227 +{
  228 + gApplication = Application::New( &argc, &argv );
  229 +
  230 + RunTest( gApplication );
  231 +
  232 + return 0;
  233 +}
examples/blocks/blocks-example.cpp
@@ -346,7 +346,7 @@ private: @@ -346,7 +346,7 @@ private:
346 mPaddleImage.SetSize( mPaddleFullSize ); 346 mPaddleImage.SetSize( mPaddleFullSize );
347 347
348 mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f); 348 mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f);
349 - Constraint wobbleConstraint = Constraint::New<Quaternion>( Actor::Property::Rotation, 349 + Constraint wobbleConstraint = Constraint::New<Quaternion>( Actor::Property::ORIENTATION,
350 LocalSource(mWobbleProperty), 350 LocalSource(mWobbleProperty),
351 WobbleConstraint(10.0f)); 351 WobbleConstraint(10.0f));
352 mPaddle.ApplyConstraint(wobbleConstraint); 352 mPaddle.ApplyConstraint(wobbleConstraint);
@@ -359,16 +359,16 @@ private: @@ -359,16 +359,16 @@ private:
359 const float margin(BALL_SIZE.width * stageSize.width * 0.5f); 359 const float margin(BALL_SIZE.width * stageSize.width * 0.5f);
360 360
361 // Set up notifications for ball's collisions against walls. 361 // Set up notifications for ball's collisions against walls.
362 - PropertyNotification leftNotification = mBall.AddPropertyNotification( Actor::Property::PositionX, LessThanCondition(margin) ); 362 + PropertyNotification leftNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_X, LessThanCondition(margin) );
363 leftNotification.NotifySignal().Connect( this, &ExampleController::OnHitLeftWall ); 363 leftNotification.NotifySignal().Connect( this, &ExampleController::OnHitLeftWall );
364 364
365 - PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::Property::PositionX, GreaterThanCondition(stageSize.width - margin) ); 365 + PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(stageSize.width - margin) );
366 rightNotification.NotifySignal().Connect( this, &ExampleController::OnHitRightWall ); 366 rightNotification.NotifySignal().Connect( this, &ExampleController::OnHitRightWall );
367 367
368 - PropertyNotification topNotification = mBall.AddPropertyNotification( Actor::Property::PositionY, LessThanCondition(margin) ); 368 + PropertyNotification topNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_Y, LessThanCondition(margin) );
369 topNotification.NotifySignal().Connect( this, &ExampleController::OnHitTopWall ); 369 topNotification.NotifySignal().Connect( this, &ExampleController::OnHitTopWall );
370 370
371 - PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::Property::PositionY, GreaterThanCondition(stageSize.height + margin) ); 371 + PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_Y, GreaterThanCondition(stageSize.height + margin) );
372 bottomNotification.NotifySignal().Connect( this, &ExampleController::OnHitBottomWall ); 372 bottomNotification.NotifySignal().Connect( this, &ExampleController::OnHitBottomWall );
373 373
374 // Set up notification for ball colliding against paddle. 374 // Set up notification for ball colliding against paddle.
@@ -376,10 +376,10 @@ private: @@ -376,10 +376,10 @@ private:
376 stage.Add(delegate); 376 stage.Add(delegate);
377 Property::Index property = delegate.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO); 377 Property::Index property = delegate.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO);
378 Constraint constraint = Constraint::New<Vector3>( property, 378 Constraint constraint = Constraint::New<Vector3>( property,
379 - Source(mBall, Actor::Property::Position),  
380 - Source(mPaddle, Actor::Property::Position),  
381 - Source(mBall, Actor::Property::Size),  
382 - Source(mPaddle, Actor::Property::Size), 379 + Source(mBall, Actor::Property::POSITION),
  380 + Source(mPaddle, Actor::Property::POSITION),
  381 + Source(mBall, Actor::Property::SIZE),
  382 + Source(mPaddle, Actor::Property::SIZE),
383 CollisionCircleRectangleConstraint( -Vector3(0.0f, mPaddleHitMargin.height * 0.575f, 0.0f),-Vector3(mPaddleHitMargin) )); 383 CollisionCircleRectangleConstraint( -Vector3(0.0f, mPaddleHitMargin.height * 0.575f, 0.0f),-Vector3(mPaddleHitMargin) ));
384 delegate.ApplyConstraint(constraint); 384 delegate.ApplyConstraint(constraint);
385 385
@@ -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,16 +594,17 @@ private: @@ -593,16 +594,17 @@ 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
599 // Add a constraint on the brick between it and the ball generating a collision-property 601 // Add a constraint on the brick between it and the ball generating a collision-property
600 Property::Index property = brick.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO); 602 Property::Index property = brick.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO);
601 Constraint constraint = Constraint::New<Vector3>( property, 603 Constraint constraint = Constraint::New<Vector3>( property,
602 - Source(mBall, Actor::Property::Position),  
603 - Source(brick, Actor::Property::Position),  
604 - Source(mBall, Actor::Property::Size),  
605 - Source(brick, Actor::Property::Size), 604 + Source(mBall, Actor::Property::POSITION),
  605 + Source(brick, Actor::Property::POSITION),
  606 + Source(mBall, Actor::Property::SIZE),
  607 + Source(brick, Actor::Property::SIZE),
606 CollisionCircleRectangleConstraint(BRICK_COLLISION_MARGIN)); 608 CollisionCircleRectangleConstraint(BRICK_COLLISION_MARGIN));
607 brick.ApplyConstraint(constraint); 609 brick.ApplyConstraint(constraint);
608 610
@@ -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
@@ -639,7 +642,7 @@ private: @@ -639,7 +642,7 @@ private:
639 } 642 }
640 643
641 mBallAnimation = Animation::New(MAX_ANIMATION_DURATION); 644 mBallAnimation = Animation::New(MAX_ANIMATION_DURATION);
642 - mBallAnimation.AnimateBy( Property( mBall, Actor::Property::Position ), mBallVelocity * MAX_ANIMATION_DURATION); 645 + mBallAnimation.AnimateBy( Property( mBall, Actor::Property::POSITION ), mBallVelocity * MAX_ANIMATION_DURATION);
643 mBallAnimation.Play(); 646 mBallAnimation.Play();
644 } 647 }
645 648
@@ -661,8 +664,8 @@ private: @@ -661,8 +664,8 @@ private:
661 664
662 mDragActor = actor; 665 mDragActor = actor;
663 mDragAnimation = Animation::New(0.25f); 666 mDragAnimation = Animation::New(0.25f);
664 - mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::Scale), Vector3(1.1f, 1.1f, 1.0f), AlphaFunctions::EaseOut);  
665 - mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunctions::EaseOut); 667 + mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.1f, 1.1f, 1.0f), AlphaFunctions::EaseOut);
  668 + mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunctions::EaseOut);
666 mDragAnimation.Play(); 669 mDragAnimation.Play();
667 } 670 }
668 } 671 }
@@ -687,8 +690,8 @@ private: @@ -687,8 +690,8 @@ private:
687 if(point.state==TouchPoint::Up) // Stop dragging 690 if(point.state==TouchPoint::Up) // Stop dragging
688 { 691 {
689 mDragAnimation = Animation::New(0.25f); 692 mDragAnimation = Animation::New(0.25f);
690 - mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::Scale), Vector3(1.0f, 1.0f, 1.0f), AlphaFunctions::EaseIn);  
691 - mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunctions::EaseOut); 693 + mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.0f, 1.0f, 1.0f), AlphaFunctions::EaseIn);
  694 + mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunctions::EaseOut);
692 mDragAnimation.Play(); 695 mDragAnimation.Play();
693 mDragActor.Reset(); 696 mDragActor.Reset();
694 } 697 }
@@ -745,8 +748,8 @@ private: @@ -745,8 +748,8 @@ private:
745 mBallVelocity = Vector3::ZERO; 748 mBallVelocity = Vector3::ZERO;
746 749
747 Animation shrink = Animation::New(0.5f); 750 Animation shrink = Animation::New(0.5f);
748 - shrink.AnimateTo( Property(mPaddle, Actor::Property::SizeWidth), mPaddleFullSize.x * f + mPaddleHitMargin.x);  
749 - shrink.AnimateTo( Property(mPaddleImage, Actor::Property::SizeWidth), mPaddleFullSize.x * f ); 751 + shrink.AnimateTo( Property(mPaddle, Actor::Property::SIZE_WIDTH), mPaddleFullSize.x * f + mPaddleHitMargin.x);
  752 + shrink.AnimateTo( Property(mPaddleImage, Actor::Property::SIZE_WIDTH), mPaddleFullSize.x * f );
750 753
751 shrink.FinishedSignal().Connect( this, &ExampleController::OnPaddleShrunk ); 754 shrink.FinishedSignal().Connect( this, &ExampleController::OnPaddleShrunk );
752 shrink.Play(); 755 shrink.Play();
@@ -763,7 +766,7 @@ private: @@ -763,7 +766,7 @@ private:
763 mBall.SetPosition( mBallStartPosition ); 766 mBall.SetPosition( mBallStartPosition );
764 mBall.SetColor( Vector4(1.0f, 1.0f, 1.0f, 0.1f) ); 767 mBall.SetColor( Vector4(1.0f, 1.0f, 1.0f, 0.1f) );
765 Animation appear = Animation::New(0.5f); 768 Animation appear = Animation::New(0.5f);
766 - appear.AnimateTo( Property(mBall, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 1.0f) ); 769 + appear.AnimateTo( Property(mBall, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f) );
767 appear.Play(); 770 appear.Play();
768 771
769 if(!mLives) 772 if(!mLives)
@@ -830,7 +833,7 @@ private: @@ -830,7 +833,7 @@ private:
830 833
831 // fade brick (destroy) 834 // fade brick (destroy)
832 Animation destroyAnimation = Animation::New(0.5f); 835 Animation destroyAnimation = Animation::New(0.5f);
833 - destroyAnimation.AnimateTo( Property( brick, Actor::Property::ColorAlpha ), 0.0f, AlphaFunctions::EaseIn ); 836 + destroyAnimation.AnimateTo( Property( brick, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn );
834 destroyAnimation.Play(); 837 destroyAnimation.Play();
835 destroyAnimation.FinishedSignal().Connect( this, &ExampleController::OnBrickDestroyed ); 838 destroyAnimation.FinishedSignal().Connect( this, &ExampleController::OnBrickDestroyed );
836 mDestroyAnimationMap[destroyAnimation] = brick; 839 mDestroyAnimationMap[destroyAnimation] = brick;
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,14 +127,16 @@ class ButtonsController: public ConnectionTracker @@ -127,14 +127,16 @@ 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.SetSize( DP(348), DP(GROUP2_HEIGHT) ); 130 + radioGroup2Background.SetRelayoutEnabled( true );
  131 + radioGroup2Background.SetPreferredSize( Vector2( DP(348), DP(GROUP2_HEIGHT) ) );
131 mContentLayer.Add( radioGroup2Background ); 132 mContentLayer.Add( radioGroup2Background );
132 133
133 Actor radioButtonsGroup2 = Actor::New(); 134 Actor radioButtonsGroup2 = Actor::New();
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) );
137 - radioButtonsGroup2.SetSize( DP(100), DP(160) ); 138 + radioButtonsGroup2.SetRelayoutEnabled( true );
  139 + radioButtonsGroup2.SetPreferredSize( Vector2( DP(100), DP(160) ) );
138 140
139 radioGroup2Background.Add( radioButtonsGroup2 ); 141 radioGroup2Background.Add( radioButtonsGroup2 );
140 142
@@ -143,7 +145,7 @@ class ButtonsController: public ConnectionTracker @@ -143,7 +145,7 @@ class ButtonsController: public ConnectionTracker
143 // Radio 1 145 // Radio 1
144 { 146 {
145 ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_1 ) ); 147 ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_1 ) );
146 - imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); 148 + imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
147 mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( imageActor ); 149 mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( imageActor );
148 mRadioButtonImage1.SetParentOrigin( ParentOrigin::TOP_LEFT ); 150 mRadioButtonImage1.SetParentOrigin( ParentOrigin::TOP_LEFT );
149 mRadioButtonImage1.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 151 mRadioButtonImage1.SetAnchorPoint( AnchorPoint::TOP_LEFT );
@@ -158,7 +160,7 @@ class ButtonsController: public ConnectionTracker @@ -158,7 +160,7 @@ class ButtonsController: public ConnectionTracker
158 radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; 160 radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
159 161
160 ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_2 ) ); 162 ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_2 ) );
161 - imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); 163 + imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
162 164
163 mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( imageActor ); 165 mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( imageActor );
164 mRadioButtonImage2.SetParentOrigin( ParentOrigin::TOP_LEFT ); 166 mRadioButtonImage2.SetParentOrigin( ParentOrigin::TOP_LEFT );
@@ -173,7 +175,7 @@ class ButtonsController: public ConnectionTracker @@ -173,7 +175,7 @@ class ButtonsController: public ConnectionTracker
173 radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; 175 radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
174 176
175 ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_3 ) ); 177 ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_3 ) );
176 - imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); 178 + imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
177 179
178 mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( imageActor ); 180 mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( imageActor );
179 mRadioButtonImage3.SetParentOrigin( ParentOrigin::TOP_LEFT ); 181 mRadioButtonImage3.SetParentOrigin( ParentOrigin::TOP_LEFT );
@@ -188,8 +190,8 @@ class ButtonsController: public ConnectionTracker @@ -188,8 +190,8 @@ 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");  
192 - mUpdateButton.SetSize( DP(100), DP(BUTTON_HEIGHT) ); 193 + mUpdateButton.SetLabel( "Select" );
  194 + mUpdateButton.SetPreferredSize( Vector2( 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 ) );
195 mUpdateButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); 197 mUpdateButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) );
@@ -208,7 +210,7 @@ class ButtonsController: public ConnectionTracker @@ -208,7 +210,7 @@ class ButtonsController: public ConnectionTracker
208 mImage.SetParentOrigin( ParentOrigin::TOP_RIGHT ); 210 mImage.SetParentOrigin( ParentOrigin::TOP_RIGHT );
209 mImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 211 mImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
210 mImage.SetPosition( DP(MARGIN_SIZE), 0 ); 212 mImage.SetPosition( DP(MARGIN_SIZE), 0 );
211 - mImage.SetSize( DP(218), DP(218) ); 213 + mImage.SetPreferredSize( Vector2( DP(218), DP(218) ) );
212 radioButtonsGroup2.Add( mImage ); 214 radioButtonsGroup2.Add( mImage );
213 215
214 // The enable/disable radio group 216 // The enable/disable radio group
@@ -218,7 +220,8 @@ class ButtonsController: public ConnectionTracker @@ -218,7 +220,8 @@ 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) );
221 - radioGroup1Background.SetSize( DP(348), DP(GROUP1_HEIGHT) ); 223 + radioGroup1Background.SetRelayoutEnabled( true );
  224 + radioGroup1Background.SetPreferredSize( Vector2( DP(348), DP(GROUP1_HEIGHT) ) );
222 mContentLayer.Add( radioGroup1Background ); 225 mContentLayer.Add( radioGroup1Background );
223 226
224 // Radio group 227 // Radio group
@@ -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.SetPreferredSize( Vector2( 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.SetPreferredSize( Vector2( 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,7 +279,8 @@ class ButtonsController: public ConnectionTracker @@ -276,7 +279,8 @@ 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) );
279 - checkBoxBackground.SetSize( DP(430), DP(GROUP3_HEIGHT) ); 282 + checkBoxBackground.SetRelayoutEnabled( true );
  283 + checkBoxBackground.SetPreferredSize( Vector2( DP(430), DP(GROUP3_HEIGHT) ) );
280 mContentLayer.Add( checkBoxBackground ); 284 mContentLayer.Add( checkBoxBackground );
281 285
282 Dali::Image unselected = Dali::ResourceImage::New( CHECKBOX_UNSELECTED_IMAGE ); 286 Dali::Image unselected = Dali::ResourceImage::New( CHECKBOX_UNSELECTED_IMAGE );
@@ -336,7 +340,8 @@ class ButtonsController: public ConnectionTracker @@ -336,7 +340,8 @@ 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) );
339 - toggleBackground.SetSize( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) ); 343 + toggleBackground.SetRelayoutEnabled( true );
  344 + toggleBackground.SetPreferredSize( Vector2( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) ) );
340 mContentLayer.Add( toggleBackground ); 345 mContentLayer.Add( toggleBackground );
341 346
342 Toolkit::PushButton toggleButton = Toolkit::PushButton::New(); 347 Toolkit::PushButton toggleButton = Toolkit::PushButton::New();
@@ -345,7 +350,7 @@ class ButtonsController: public ConnectionTracker @@ -345,7 +350,7 @@ class ButtonsController: public ConnectionTracker
345 toggleButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 350 toggleButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
346 toggleButton.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); 351 toggleButton.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
347 toggleButton.SetLabel( "Unselected" ); 352 toggleButton.SetLabel( "Unselected" );
348 - toggleButton.SetSize( DP(150), DP(BUTTON_HEIGHT) ); 353 + toggleButton.SetPreferredSize( Vector2( DP(150), DP(BUTTON_HEIGHT) ) );
349 354
350 toggleButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); 355 toggleButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
351 toggleButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); 356 toggleButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) );
@@ -484,7 +489,7 @@ void RunTest( Application&amp; application ) @@ -484,7 +489,7 @@ void RunTest( Application&amp; application )
484 application.MainLoop(); 489 application.MainLoop();
485 } 490 }
486 491
487 -// Entry point for Linux & SLP applications 492 +// Entry point for Linux & Tizen applications
488 // 493 //
489 int main( int argc, char **argv ) 494 int main( int argc, char **argv )
490 { 495 {
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);
@@ -524,9 +527,16 @@ public: @@ -524,9 +527,16 @@ public:
524 const char **paths = IMAGE_GROUPS[clusterType]; 527 const char **paths = IMAGE_GROUPS[clusterType];
525 DALI_ASSERT_ALWAYS(paths); 528 DALI_ASSERT_ALWAYS(paths);
526 529
527 - // Add a background image to the cluster 530 + // Add a background image to the cluster, limiting the loaded size by
  531 + // fitting it inside a quarter of the stage area with the conservative Box
  532 + // filter mode:
  533 + Dali::ImageAttributes backgroundAttributes;
  534 + backgroundAttributes.SetSize( Stage::GetCurrent().GetSize() * 0.5f );
  535 + backgroundAttributes.SetFilterMode( Dali::ImageAttributes::Box );
  536 + backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ShrinkToFit );
528 Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); 537 Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH );
529 ImageActor image = ImageActor::New(bg); 538 ImageActor image = ImageActor::New(bg);
  539 + image.SetRelayoutEnabled( false );
530 clusterActor.SetBackgroundImage(image); 540 clusterActor.SetBackgroundImage(image);
531 541
532 // Add actors (pictures) as the children of the cluster 542 // Add actors (pictures) as the children of the cluster
@@ -552,10 +562,12 @@ public: @@ -552,10 +562,12 @@ public:
552 actor.SetParentOrigin( ParentOrigin::CENTER ); 562 actor.SetParentOrigin( ParentOrigin::CENTER );
553 actor.SetAnchorPoint( AnchorPoint::CENTER ); 563 actor.SetAnchorPoint( AnchorPoint::CENTER );
554 564
555 - // Load the thumbnail 565 + // Load the thumbnail at quarter of screen width or standard size if that is smaller:
556 ImageAttributes attribs = ImageAttributes::New(); 566 ImageAttributes attribs = ImageAttributes::New();
557 - attribs.SetSize(CLUSTER_IMAGE_THUMBNAIL_WIDTH, CLUSTER_IMAGE_THUMBNAIL_HEIGHT);  
558 - attribs.SetScalingMode(Dali::ImageAttributes::ShrinkToFit); 567 + Size stageQuarter = Stage::GetCurrent().GetSize() * 0.25f;
  568 + attribs.SetSize( std::min( stageQuarter.x, CLUSTER_IMAGE_THUMBNAIL_WIDTH), std::min( stageQuarter.y, CLUSTER_IMAGE_THUMBNAIL_HEIGHT ) );
  569 + attribs.SetFilterMode( Dali::ImageAttributes::BoxThenLinear );
  570 + attribs.SetScalingMode(Dali::ImageAttributes::ShrinkToFit );
559 571
560 // Add a shadow image child actor 572 // Add a shadow image child actor
561 Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, attribs ); 573 Image shadowImage = ResourceImage::New( CLUSTER_SHADOW_IMAGE_PATH, attribs );
@@ -568,6 +580,7 @@ public: @@ -568,6 +580,7 @@ public:
568 shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f)); 580 shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f));
569 581
570 // Apply size-relative mode to auto-size the image shadow 582 // Apply size-relative mode to auto-size the image shadow
  583 + shadowActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
571 shadowActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); 584 shadowActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
572 shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE ); 585 shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE );
573 actor.Add( shadowActor ); 586 actor.Add( shadowActor );
@@ -577,7 +590,7 @@ public: @@ -577,7 +590,7 @@ public:
577 ImageActor imageActor = ImageActor::New( image ); 590 ImageActor imageActor = ImageActor::New( image );
578 imageActor.SetParentOrigin( ParentOrigin::CENTER ); 591 imageActor.SetParentOrigin( ParentOrigin::CENTER );
579 imageActor.SetAnchorPoint( AnchorPoint::CENTER ); 592 imageActor.SetAnchorPoint( AnchorPoint::CENTER );
580 - imageActor.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 593 + imageActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
581 actor.Add( imageActor ); 594 actor.Add( imageActor );
582 595
583 // Add a border image child actor (with a fixed size offset from parent). 596 // Add a border image child actor (with a fixed size offset from parent).
@@ -587,6 +600,7 @@ public: @@ -587,6 +600,7 @@ public:
587 borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); 600 borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
588 borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE ); 601 borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE );
589 borderActor.SetPosition( Vector3( 0.0f, 0.0f, 1.0f ) ); 602 borderActor.SetPosition( Vector3( 0.0f, 0.0f, 1.0f ) );
  603 + borderActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
590 borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT ); 604 borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
591 borderActor.SetSizeModeFactor( Vector3( CLUSTER_IMAGE_BORDER_INDENT - 1.0f, CLUSTER_IMAGE_BORDER_INDENT - 1.0f, 0.0f ) * 2.0f ); 605 borderActor.SetSizeModeFactor( Vector3( CLUSTER_IMAGE_BORDER_INDENT - 1.0f, CLUSTER_IMAGE_BORDER_INDENT - 1.0f, 0.0f ) * 2.0f );
592 actor.Add( borderActor ); 606 actor.Add( borderActor );
@@ -617,7 +631,8 @@ public: @@ -617,7 +631,8 @@ public:
617 mScrollView.Add(pageView); 631 mScrollView.Add(pageView);
618 pageView.SetParentOrigin(ParentOrigin::CENTER); 632 pageView.SetParentOrigin(ParentOrigin::CENTER);
619 pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); 633 pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f));
620 - pageView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 634 + pageView.SetRelayoutEnabled( true );
  635 + pageView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
621 636
622 // Create cluster actors, add them to scroll view, and set the shear effect with the given center point. 637 // Create cluster actors, add them to scroll view, and set the shear effect with the given center point.
623 Cluster cluster = CreateClusterActor(clusterType, style); 638 Cluster cluster = CreateClusterActor(clusterType, style);
@@ -707,7 +722,7 @@ public: @@ -707,7 +722,7 @@ public:
707 Vector2 shearCenter( Vector2(position.x + size.width * shearAnchor.x, position.y + size.height * shearAnchor.y) ); 722 Vector2 shearCenter( Vector2(position.x + size.width * shearAnchor.x, position.y + size.height * shearAnchor.y) );
708 Property::Index centerProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetCenterPropertyName()); 723 Property::Index centerProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetCenterPropertyName());
709 Constraint constraint = Constraint::New<Vector2>( centerProperty, 724 Constraint constraint = Constraint::New<Vector2>( centerProperty,
710 - Source(mView, Actor::Property::Size), 725 + Source(mView, Actor::Property::SIZE),
711 ShearEffectCenterConstraint(stageSize, shearCenter) ); 726 ShearEffectCenterConstraint(stageSize, shearCenter) );
712 shaderEffect.ApplyConstraint(constraint); 727 shaderEffect.ApplyConstraint(constraint);
713 728
@@ -720,12 +735,12 @@ public: @@ -720,12 +735,12 @@ public:
720 735
721 constraint = Constraint::New<float>( angleXAxisProperty, 736 constraint = Constraint::New<float>( angleXAxisProperty,
722 Source(mScrollView, scrollOvershootProperty), 737 Source(mScrollView, scrollOvershootProperty),
723 - Source(mView, Actor::Property::Rotation), 738 + Source(mView, Actor::Property::ORIENTATION),
724 ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) ); 739 ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) );
725 shaderEffect.ApplyConstraint(constraint); 740 shaderEffect.ApplyConstraint(constraint);
726 constraint = Constraint::New<float>( angleYAxisProperty, 741 constraint = Constraint::New<float>( angleYAxisProperty,
727 Source(mScrollView, scrollOvershootProperty), 742 Source(mScrollView, scrollOvershootProperty),
728 - Source(mView, Actor::Property::Rotation), 743 + Source(mView, Actor::Property::ORIENTATION),
729 ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS) ); 744 ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS) );
730 shaderEffect.ApplyConstraint(constraint); 745 shaderEffect.ApplyConstraint(constraint);
731 746
@@ -752,7 +767,7 @@ public: @@ -752,7 +767,7 @@ public:
752 767
753 Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( shaderEffect.GetAnglePerUnitPropertyName() ); 768 Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( shaderEffect.GetAnglePerUnitPropertyName() );
754 shaderEffect.ApplyConstraint( Constraint::New<Vector2>( anglePerUnit, 769 shaderEffect.ApplyConstraint( Constraint::New<Vector2>( anglePerUnit,
755 - Source(mView, Actor::Property::Rotation), 770 + Source(mView, Actor::Property::ORIENTATION),
756 CarouselEffectOrientationConstraint( angleSweep ) ) ); 771 CarouselEffectOrientationConstraint( angleSweep ) ) );
757 772
758 break; 773 break;
@@ -779,7 +794,7 @@ public: @@ -779,7 +794,7 @@ public:
779 // dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc 794 // dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc
780 for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) 795 for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i )
781 { 796 {
782 - Constraint constraint = Constraint::New<float>(Actor::Property::PositionZ, SphereEffectOffsetConstraint(SPHERE_EFFECT_POSITION_Z)); 797 + Constraint constraint = Constraint::New<float>(Actor::Property::POSITION_Z, SphereEffectOffsetConstraint(SPHERE_EFFECT_POSITION_Z));
783 constraint.SetRemoveAction(Constraint::Discard); 798 constraint.SetRemoveAction(Constraint::Discard);
784 Cluster cluster = i->mCluster; 799 Cluster cluster = i->mCluster;
785 SetShaderEffectRecursively( cluster, shaderEffect ); 800 SetShaderEffectRecursively( cluster, shaderEffect );
@@ -865,7 +880,7 @@ void RunTest(Application&amp; app) @@ -865,7 +880,7 @@ void RunTest(Application&amp; app)
865 app.MainLoop(); 880 app.MainLoop();
866 } 881 }
867 882
868 -// Entry point for Linux & SLP applications 883 +// Entry point for Linux & Tizen applications
869 // 884 //
870 int main(int argc, char **argv) 885 int main(int argc, char **argv)
871 { 886 {
examples/cube-transition-effect/cube-transition-effect-example.cpp
@@ -85,6 +85,25 @@ const float CUBE_DISPLACEMENT_CROSS(30.f); @@ -85,6 +85,25 @@ const float CUBE_DISPLACEMENT_CROSS(30.f);
85 85
86 // The duration of the current image staying on screen when slideshow is on 86 // The duration of the current image staying on screen when slideshow is on
87 const int VIEWINGTIME = 2000; // 2 seconds 87 const int VIEWINGTIME = 2000; // 2 seconds
  88 +
  89 +/**
  90 + * @brief Load an image, scaled-down to no more than the stage dimensions.
  91 + *
  92 + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at
  93 + * load time to cover the entire stage with pixels with no borders,
  94 + * and filter mode ImageAttributes::BoxThenLinear to sample the image with
  95 + * maximum quality.
  96 + */
  97 +ResourceImage LoadStageFillingImage( const char * const imagePath )
  98 +{
  99 + Size stageSize = Stage::GetCurrent().GetSize();
  100 + ImageAttributes attributes;
  101 + attributes.SetSize( stageSize.x, stageSize.y );
  102 + attributes.SetFilterMode( ImageAttributes::BoxThenLinear );
  103 + attributes.SetScalingMode( ImageAttributes::ScaleToFill );
  104 + return ResourceImage::New( imagePath, attributes );
  105 +}
  106 +
88 } // namespace 107 } // namespace
89 108
90 class CubeTransitionApp : public ConnectionTracker 109 class CubeTransitionApp : public ConnectionTracker
@@ -264,11 +283,12 @@ void CubeTransitionApp::OnInit( Application&amp; application ) @@ -264,11 +283,12 @@ void CubeTransitionApp::OnInit( Application&amp; application )
264 mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick ); 283 mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick );
265 284
266 // show the first image 285 // show the first image
267 - mImageConstraint = Constraint::New<Vector3>( Actor::Property::Scale, LocalSource( Actor::Property::Size ), ParentSource( Actor::Property::Size ), ScaleToFitKeepAspectRatioConstraint() ); 286 + mImageConstraint = Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() );
268 287
269 - mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); 288 + mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) );
270 mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); 289 mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION );
271 mCurrentImage.ApplyConstraint( mImageConstraint ); 290 mCurrentImage.ApplyConstraint( mImageConstraint );
  291 + mCurrentImage.SetRelayoutEnabled( false );
272 mParent.Add( mCurrentImage ); 292 mParent.Add( mCurrentImage );
273 293
274 mCurrentEffect = mCubeWaveEffect; 294 mCurrentEffect = mCubeWaveEffect;
@@ -308,10 +328,12 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture ) @@ -308,10 +328,12 @@ void CubeTransitionApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture )
308 328
309 void CubeTransitionApp::GoToNextImage() 329 void CubeTransitionApp::GoToNextImage()
310 { 330 {
311 - ResourceImage image = ResourceImage::New( IMAGES[ mIndex ] ); 331 + ResourceImage image = LoadStageFillingImage( IMAGES[ mIndex ] );
312 mNextImage = ImageActor::New( image ); 332 mNextImage = ImageActor::New( image );
  333 +
313 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); 334 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION);
314 mNextImage.ApplyConstraint( mImageConstraint ); 335 mNextImage.ApplyConstraint( mImageConstraint );
  336 + mNextImage.SetRelayoutEnabled( false );
315 mCurrentEffect.SetTargetImage(mNextImage); 337 mCurrentEffect.SetTargetImage(mNextImage);
316 if( image.GetLoadingState() == ResourceLoadingSucceeded ) 338 if( image.GetLoadingState() == ResourceLoadingSucceeded )
317 { 339 {
@@ -417,7 +439,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent&amp; event) @@ -417,7 +439,7 @@ void CubeTransitionApp::OnKeyEvent(const KeyEvent&amp; event)
417 } 439 }
418 } 440 }
419 441
420 -// Entry point for Linux & SLP applications 442 +// Entry point for Linux & Tizen applications
421 int main( int argc, char **argv ) 443 int main( int argc, char **argv )
422 { 444 {
423 Application application = Application::New( &argc, &argv ); 445 Application application = Application::New( &argc, &argv );
examples/dissolve-effect/dissolve-effect-example.cpp
@@ -71,6 +71,25 @@ const int VIEWINGTIME = 2000; // 2 seconds @@ -71,6 +71,25 @@ const int VIEWINGTIME = 2000; // 2 seconds
71 const float TRANSITION_DURATION = 2.5f; //2.5 second 71 const float TRANSITION_DURATION = 2.5f; //2.5 second
72 72
73 const float INITIAL_DEPTH = -10.0f; 73 const float INITIAL_DEPTH = -10.0f;
  74 +
  75 +/**
  76 + * @brief Load an image, scaled-down to no more than the stage dimensions.
  77 + *
  78 + * Uses image scaling mode ImageAttributes::ScaleToFill to resize the image at
  79 + * load time to cover the entire stage with pixels with no borders,
  80 + * and filter mode ImageAttributes::BoxThenLinear to sample the image with
  81 + * maximum quality.
  82 + */
  83 +ResourceImage LoadStageFillingImage( const char * const imagePath )
  84 +{
  85 + Size stageSize = Stage::GetCurrent().GetSize();
  86 + ImageAttributes attributes;
  87 + attributes.SetSize( stageSize.x, stageSize.y );
  88 + attributes.SetFilterMode( ImageAttributes::BoxThenLinear );
  89 + attributes.SetScalingMode( ImageAttributes::ScaleToFill );
  90 + return ResourceImage::New( imagePath, attributes );
  91 +}
  92 +
74 } // namespace 93 } // namespace
75 94
76 class DissolveEffectApp : public ConnectionTracker 95 class DissolveEffectApp : public ConnectionTracker
@@ -232,10 +251,10 @@ void DissolveEffectApp::OnInit( Application&amp; application ) @@ -232,10 +251,10 @@ void DissolveEffectApp::OnInit( Application&amp; application )
232 mParent.SetPositionInheritanceMode( USE_PARENT_POSITION ); 251 mParent.SetPositionInheritanceMode( USE_PARENT_POSITION );
233 mContent.Add( mParent ); 252 mContent.Add( mParent );
234 253
235 - mSizeConstraint= Constraint::New<Vector3>( Actor::Property::Scale, LocalSource( Actor::Property::Size ), ParentSource( Actor::Property::Size ), ScaleToFitKeepAspectRatioConstraint() ); 254 + mSizeConstraint= Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() );
236 255
237 // show the first image 256 // show the first image
238 - mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); 257 + mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) );
239 mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); 258 mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION);
240 mCurrentImage.ApplyConstraint( mSizeConstraint ); 259 mCurrentImage.ApplyConstraint( mSizeConstraint );
241 mParent.Add( mCurrentImage ); 260 mParent.Add( mCurrentImage );
@@ -263,7 +282,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture ) @@ -263,7 +282,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture&amp; gesture )
263 mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES; 282 mIndex = (mIndex + NUM_IMAGES -1)%NUM_IMAGES;
264 } 283 }
265 284
266 - Image image = ResourceImage::New( IMAGES[ mIndex ] ); 285 + Image image = LoadStageFillingImage( IMAGES[ mIndex ] );
267 mNextImage = ImageActor::New( image ); 286 mNextImage = ImageActor::New( image );
268 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); 287 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION);
269 mNextImage.ApplyConstraint( mSizeConstraint ); 288 mNextImage.ApplyConstraint( mSizeConstraint );
@@ -375,7 +394,7 @@ bool DissolveEffectApp::OnTimerTick() @@ -375,7 +394,7 @@ bool DissolveEffectApp::OnTimerTick()
375 if(mSlideshow) 394 if(mSlideshow)
376 { 395 {
377 mIndex = (mIndex + 1)%NUM_IMAGES; 396 mIndex = (mIndex + 1)%NUM_IMAGES;
378 - Image image = ResourceImage::New( IMAGES[ mIndex ] ); 397 + Image image = LoadStageFillingImage( IMAGES[ mIndex ] );
379 mNextImage = ImageActor::New( image ); 398 mNextImage = ImageActor::New( image );
380 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); 399 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION);
381 mNextImage.ApplyConstraint( mSizeConstraint ); 400 mNextImage.ApplyConstraint( mSizeConstraint );
@@ -410,7 +429,7 @@ bool DissolveEffectApp::OnTimerTick() @@ -410,7 +429,7 @@ bool DissolveEffectApp::OnTimerTick()
410 return false; //return false to stop the timer 429 return false; //return false to stop the timer
411 } 430 }
412 431
413 -// Entry point for Linux & SLP applications 432 +// Entry point for Linux & Tizen applications
414 int main( int argc, char **argv ) 433 int main( int argc, char **argv )
415 { 434 {
416 Application application = Application::New( &argc, &argv ); 435 Application application = Application::New( &argc, &argv );
examples/hello-world/hello-world-example.cpp
@@ -79,7 +79,7 @@ void RunTest( Application&amp; application ) @@ -79,7 +79,7 @@ void RunTest( Application&amp; application )
79 application.MainLoop(); 79 application.MainLoop();
80 } 80 }
81 81
82 -// Entry point for Linux & SLP applications 82 +// Entry point for Linux & Tizen applications
83 // 83 //
84 int main( int argc, char **argv ) 84 int main( int argc, char **argv )
85 { 85 {
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
@@ -183,6 +183,7 @@ Image CreateImage(const std::string&amp; filename, unsigned int width, unsigned int @@ -183,6 +183,7 @@ Image CreateImage(const std::string&amp; filename, unsigned int width, unsigned int
183 183
184 attributes.SetSize( width, height ); 184 attributes.SetSize( width, height );
185 attributes.SetScalingMode( scalingMode ); 185 attributes.SetScalingMode( scalingMode );
  186 + attributes.SetFilterMode( ImageAttributes::BoxThenLinear );
186 Image image = ResourceImage::New( filename, attributes ); 187 Image image = ResourceImage::New( filename, attributes );
187 return image; 188 return image;
188 } 189 }
@@ -359,6 +360,9 @@ public: @@ -359,6 +360,9 @@ public:
359 mContentLayer.Add( mScrollView ); 360 mContentLayer.Add( mScrollView );
360 mScrollView.Add( imageField ); 361 mScrollView.Add( imageField );
361 mGridActor = imageField; 362 mGridActor = imageField;
  363 +
  364 + // Scroll to top of grid so first images loaded are on-screen:
  365 + mScrollView.ScrollTo( Vector3( 0, -1000000, 0 ) );
362 } 366 }
363 367
364 /** 368 /**
@@ -417,7 +421,8 @@ public: @@ -417,7 +421,8 @@ public:
417 // coordinates in a frame defined by a parent actor: 421 // coordinates in a frame defined by a parent actor:
418 422
419 Actor gridActor = Actor::New(); 423 Actor gridActor = Actor::New();
420 - gridActor.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 424 + gridActor.SetRelayoutEnabled( true );
  425 + gridActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
421 gridActor.SetParentOrigin( ParentOrigin::CENTER ); 426 gridActor.SetParentOrigin( ParentOrigin::CENTER );
422 gridActor.SetAnchorPoint( AnchorPoint::CENTER ); 427 gridActor.SetAnchorPoint( AnchorPoint::CENTER );
423 428
examples/item-view/item-view-example.cpp
@@ -99,6 +99,10 @@ const char* IMAGE_PATHS[] = { @@ -99,6 +99,10 @@ const char* IMAGE_PATHS[] = {
99 99
100 const unsigned int NUM_IMAGES = sizeof(IMAGE_PATHS) / sizeof(char*); 100 const unsigned int NUM_IMAGES = sizeof(IMAGE_PATHS) / sizeof(char*);
101 101
  102 +const unsigned int IMAGE_WIDTH = 256;
  103 +const unsigned int IMAGE_HEIGHT = 256;
  104 +const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8;
  105 +
102 AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear, 106 AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear,
103 AlphaFunctions::EaseIn, 107 AlphaFunctions::EaseIn,
104 AlphaFunctions::EaseOut }; 108 AlphaFunctions::EaseOut };
@@ -277,7 +281,8 @@ public: @@ -277,7 +281,8 @@ public:
277 mDeleteButton.SetDrawMode( DrawMode::OVERLAY ); 281 mDeleteButton.SetDrawMode( DrawMode::OVERLAY );
278 mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); 282 mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
279 mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) ); 283 mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) );
280 - mDeleteButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); 284 + mDeleteButton.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  285 + mDeleteButton.SetPreferredSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
281 mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked); 286 mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked);
282 mDeleteButton.SetLeaveRequired( true ); 287 mDeleteButton.SetLeaveRequired( true );
283 mDeleteButton.SetVisible( false ); 288 mDeleteButton.SetVisible( false );
@@ -291,7 +296,8 @@ public: @@ -291,7 +296,8 @@ public:
291 mInsertButton.SetDrawMode( DrawMode::OVERLAY ); 296 mInsertButton.SetDrawMode( DrawMode::OVERLAY );
292 mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); 297 mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
293 mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) ); 298 mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) );
294 - mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); 299 + mInsertButton.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  300 + mInsertButton.SetPreferredSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
295 mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked); 301 mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked);
296 mInsertButton.SetLeaveRequired( true ); 302 mInsertButton.SetLeaveRequired( true );
297 mInsertButton.SetVisible( false ); 303 mInsertButton.SetVisible( false );
@@ -305,14 +311,17 @@ public: @@ -305,14 +311,17 @@ public:
305 mReplaceButton.SetDrawMode( DrawMode::OVERLAY ); 311 mReplaceButton.SetDrawMode( DrawMode::OVERLAY );
306 mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); 312 mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
307 mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) ); 313 mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) );
308 - mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); 314 + mReplaceButton.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  315 + mReplaceButton.SetPreferredSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
309 mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked); 316 mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked);
310 mReplaceButton.SetLeaveRequired( true ); 317 mReplaceButton.SetLeaveRequired( true );
311 mReplaceButton.SetVisible( false ); 318 mReplaceButton.SetVisible( false );
312 stage.Add( mReplaceButton ); 319 stage.Add( mReplaceButton );
313 320
314 // Create the item view actor 321 // Create the item view actor
  322 + mImageAtlas = CreateImageAtlas();
315 mItemView = ItemView::New(*this); 323 mItemView = ItemView::New(*this);
  324 + mItemView.SetRelayoutEnabled( false );
316 mItemView.SetParentOrigin(ParentOrigin::CENTER); 325 mItemView.SetParentOrigin(ParentOrigin::CENTER);
317 mItemView.SetAnchorPoint(AnchorPoint::CENTER); 326 mItemView.SetAnchorPoint(AnchorPoint::CENTER);
318 327
@@ -876,8 +885,12 @@ public: // From ItemFactory @@ -876,8 +885,12 @@ public: // From ItemFactory
876 virtual Actor NewItem(unsigned int itemId) 885 virtual Actor NewItem(unsigned int itemId)
877 { 886 {
878 // Create an image actor for this item 887 // Create an image actor for this item
879 - Image image = ResourceImage::New( IMAGE_PATHS[itemId % NUM_IMAGES] );  
880 - Actor actor = ImageActor::New(image); 888 + unsigned int imageId = itemId % NUM_IMAGES;
  889 + ImageActor::PixelArea pixelArea( (imageId%NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_WIDTH,
  890 + (imageId/NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_HEIGHT,
  891 + IMAGE_WIDTH,
  892 + IMAGE_HEIGHT );
  893 + Actor actor = ImageActor::New(mImageAtlas, pixelArea);
881 actor.SetPosition( INITIAL_OFFSCREEN_POSITION ); 894 actor.SetPosition( INITIAL_OFFSCREEN_POSITION );
882 895
883 // Add a border image child actor 896 // Add a border image child actor
@@ -888,6 +901,7 @@ public: // From ItemFactory @@ -888,6 +901,7 @@ public: // From ItemFactory
888 borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); 901 borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
889 borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) ); 902 borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) );
890 borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor 903 borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor
  904 + borderActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
891 borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT ); 905 borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
892 borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE ); 906 borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE );
893 actor.Add(borderActor); 907 actor.Add(borderActor);
@@ -899,6 +913,7 @@ public: // From ItemFactory @@ -899,6 +913,7 @@ public: // From ItemFactory
899 // Add a checkbox child actor; invisible until edit-mode is enabled 913 // Add a checkbox child actor; invisible until edit-mode is enabled
900 914
901 ImageActor checkbox = ImageActor::New( mWhiteImage ); 915 ImageActor checkbox = ImageActor::New( mWhiteImage );
  916 + checkbox.SetRelayoutEnabled( false );
902 checkbox.SetName( "CheckBox" ); 917 checkbox.SetName( "CheckBox" );
903 checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) ); 918 checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) );
904 checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT ); 919 checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT );
@@ -915,6 +930,7 @@ public: // From ItemFactory @@ -915,6 +930,7 @@ public: // From ItemFactory
915 actor.Add( checkbox ); 930 actor.Add( checkbox );
916 931
917 ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) ); 932 ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) );
  933 + tick.SetRelayoutEnabled( false );
918 tick.SetColorMode( USE_OWN_COLOR ); 934 tick.SetColorMode( USE_OWN_COLOR );
919 tick.SetName( "Tick" ); 935 tick.SetName( "Tick" );
920 tick.SetParentOrigin( ParentOrigin::TOP_RIGHT ); 936 tick.SetParentOrigin( ParentOrigin::TOP_RIGHT );
@@ -936,6 +952,23 @@ public: // From ItemFactory @@ -936,6 +952,23 @@ public: // From ItemFactory
936 private: 952 private:
937 953
938 /** 954 /**
  955 + * Create an Atlas to tile the images inside.
  956 + */
  957 + Atlas CreateImageAtlas()
  958 + {
  959 + const unsigned int atlas_width = IMAGE_WIDTH*NUM_IMAGE_PER_ROW_IN_ATLAS;
  960 + const unsigned int atlas_height = IMAGE_HEIGHT*ceil( static_cast<float>(NUM_IMAGES)/ static_cast<float>(NUM_IMAGE_PER_ROW_IN_ATLAS));
  961 + Atlas atlas = Atlas::New(atlas_width, atlas_height, Pixel::RGB888);
  962 +
  963 + for( unsigned int i = 0; i < NUM_IMAGES; i++ )
  964 + {
  965 + atlas.Upload( IMAGE_PATHS[i], (i%NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_WIDTH, (i/NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_HEIGHT );
  966 + }
  967 +
  968 + return atlas;
  969 + }
  970 +
  971 + /**
939 * Sets/Updates the title of the View 972 * Sets/Updates the title of the View
940 * @param[in] title The new title for the view. 973 * @param[in] title The new title for the view.
941 */ 974 */
@@ -962,23 +995,23 @@ private: @@ -962,23 +995,23 @@ private:
962 mMenu = Toolkit::Popup::New(); 995 mMenu = Toolkit::Popup::New();
963 mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); 996 mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
964 mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); 997 mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
  998 + mMenu.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  999 + mMenu.SetPreferredSize( Vector2( popupWidth, MENU_OPTION_HEIGHT * 2 ) );
965 mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu ); 1000 mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu );
966 - stage.Add( mMenu );  
967 1001
968 TableView tableView = TableView::New( 0, 0 ); 1002 TableView tableView = TableView::New( 0, 0 );
969 - Vector2 tableSize = Vector2( popupWidth, MENU_OPTION_HEIGHT * 2 );  
970 - tableView.SetSize( tableSize ); 1003 + tableView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
971 mMenu.Add( tableView ); 1004 mMenu.Add( tableView );
972 1005
973 Slider slider = Slider::New(); 1006 Slider slider = Slider::New();
974 - slider.SetProperty( Slider::LOWER_BOUND_PROPERTY, 0.0f );  
975 - slider.SetProperty( Slider::UPPER_BOUND_PROPERTY, 3.0f );  
976 - slider.SetProperty( Slider::VALUE_PROPERTY, mDurationSeconds );  
977 - slider.SetProperty( Slider::VALUE_PRECISION_PROPERTY, 2 );  
978 - slider.SetProperty( Slider::SHOW_POPUP_PROPERTY, true ); 1007 + slider.SetProperty( Slider::Property::LOWER_BOUND, 0.0f );
  1008 + slider.SetProperty( Slider::Property::UPPER_BOUND, 3.0f );
  1009 + slider.SetProperty( Slider::Property::VALUE, mDurationSeconds );
  1010 + slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 );
  1011 + slider.SetProperty( Slider::Property::SHOW_POPUP, true );
  1012 + slider.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
979 slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange ); 1013 slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange );
980 tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) ); 1014 tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) );
981 - tableView.SetRelativeHeight( 0, 0.5f );  
982 1015
983 TextStyle defaultTextStyle; 1016 TextStyle defaultTextStyle;
984 defaultTextStyle.SetFontName(DEFAULT_TEXT_STYLE_FONT_FAMILY); 1017 defaultTextStyle.SetFontName(DEFAULT_TEXT_STYLE_FONT_FAMILY);
@@ -992,19 +1025,21 @@ private: @@ -992,19 +1025,21 @@ private:
992 text.SetParentOrigin( ParentOrigin::TOP_LEFT ); 1025 text.SetParentOrigin( ParentOrigin::TOP_LEFT );
993 text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft ); 1026 text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft );
994 text.SetStyleToCurrentText( defaultTextStyle ); 1027 text.SetStyleToCurrentText( defaultTextStyle );
995 - text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y );  
996 - text.ApplyConstraint( Dali::Constraint::New<float>( Dali::Actor::Property::SizeWidth, Dali::ParentSource( Dali::Actor::Property::SizeWidth ), Dali::EqualToConstraint() ) ); 1028 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1029 + text.SetResizePolicy( FIXED, HEIGHT );
  1030 + text.SetPreferredSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
997 text.SetZ( -0.9f ); 1031 text.SetZ( -0.9f );
998 slider.Add( text ); 1032 slider.Add( text );
999 1033
1000 Actor textContainer = Actor::New(); 1034 Actor textContainer = Actor::New();
  1035 + textContainer.SetRelayoutEnabled( true );
  1036 + textContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
1001 mAlphaFunctionText = TextView::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] ); 1037 mAlphaFunctionText = TextView::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] );
1002 mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER ); 1038 mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER );
1003 mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER ); 1039 mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER );
1004 mAlphaFunctionText.SetTextAlignment( Toolkit::Alignment::VerticalCenter ); 1040 mAlphaFunctionText.SetTextAlignment( Toolkit::Alignment::VerticalCenter );
1005 textContainer.Add( mAlphaFunctionText ); 1041 textContainer.Add( mAlphaFunctionText );
1006 tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) ); 1042 tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) );
1007 - tableView.SetRelativeHeight( 0, 0.5f );  
1008 1043
1009 mTapDetector = TapGestureDetector::New(); 1044 mTapDetector = TapGestureDetector::New();
1010 mTapDetector.Attach(mAlphaFunctionText); 1045 mTapDetector.Attach(mAlphaFunctionText);
@@ -1015,10 +1050,12 @@ private: @@ -1015,10 +1050,12 @@ private:
1015 text.SetParentOrigin( ParentOrigin::TOP_LEFT ); 1050 text.SetParentOrigin( ParentOrigin::TOP_LEFT );
1016 text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft ); 1051 text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft );
1017 text.SetStyleToCurrentText( defaultTextStyle ); 1052 text.SetStyleToCurrentText( defaultTextStyle );
1018 - text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y );  
1019 - text.ApplyConstraint( Dali::Constraint::New<float>( Dali::Actor::Property::SizeWidth, Dali::ParentSource( Dali::Actor::Property::SizeWidth ), Dali::EqualToConstraint() ) ); 1053 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1054 + text.SetResizePolicy( FIXED, HEIGHT );
  1055 + text.SetPreferredSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
1020 textContainer.Add( text ); 1056 textContainer.Add( text );
1021 1057
  1058 + mMenu.MarkDirtyForRelayout();
1022 mMenu.Show(); 1059 mMenu.Show();
1023 mMenuShown = true; 1060 mMenuShown = true;
1024 } 1061 }
@@ -1107,6 +1144,7 @@ private: @@ -1107,6 +1144,7 @@ private:
1107 1144
1108 ItemView mItemView; 1145 ItemView mItemView;
1109 Image mBorderImage; 1146 Image mBorderImage;
  1147 + Atlas mImageAtlas;
1110 unsigned int mCurrentLayout; 1148 unsigned int mCurrentLayout;
1111 float mDurationSeconds; 1149 float mDurationSeconds;
1112 1150
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();
@@ -763,7 +763,7 @@ void RunTest( Application&amp; application ) @@ -763,7 +763,7 @@ void RunTest( Application&amp; application )
763 application.MainLoop(); 763 application.MainLoop();
764 } 764 }
765 765
766 -// Entry point for Linux & SLP applications 766 +// Entry point for Linux & Tizen applications
767 // 767 //
768 int main( int argc, char **argv ) 768 int main( int argc, char **argv )
769 { 769 {
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 );
@@ -240,17 +242,18 @@ public: @@ -240,17 +242,18 @@ public:
240 overlay.Add( mMagnifier ); 242 overlay.Add( mMagnifier );
241 243
242 // Apply constraint to animate the position of the magnifier. 244 // Apply constraint to animate the position of the magnifier.
243 - Constraint constraint = Constraint::New<Vector3>(Actor::Property::Position,  
244 - LocalSource(Actor::Property::Size),  
245 - LocalSource(Actor::Property::ParentOrigin),  
246 - LocalSource(Actor::Property::AnchorPoint),  
247 - ParentSource(Actor::Property::Size), 245 + Constraint constraint = Constraint::New<Vector3>(Actor::Property::POSITION,
  246 + LocalSource(Actor::Property::SIZE),
  247 + LocalSource(Actor::Property::PARENT_ORIGIN),
  248 + LocalSource(Actor::Property::ANCHOR_POINT),
  249 + ParentSource(Actor::Property::SIZE),
248 ConfinementConstraint(ParentOrigin::CENTER, Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT)); 250 ConfinementConstraint(ParentOrigin::CENTER, Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT));
249 constraint.SetRemoveAction(Constraint::Discard); 251 constraint.SetRemoveAction(Constraint::Discard);
250 mMagnifier.ApplyConstraint( constraint ); 252 mMagnifier.ApplyConstraint( constraint );
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 );
@@ -260,15 +263,15 @@ public: @@ -260,15 +263,15 @@ public:
260 ContinueAnimation(); 263 ContinueAnimation();
261 264
262 // Apply constraint to animate the position of the magnifier. 265 // Apply constraint to animate the position of the magnifier.
263 - constraint = Constraint::New<Vector3>(Actor::Property::Position,  
264 - LocalSource(Actor::Property::Size), 266 + constraint = Constraint::New<Vector3>(Actor::Property::POSITION,
  267 + LocalSource(Actor::Property::SIZE),
265 LocalSource(mAnimationTimeProperty), 268 LocalSource(mAnimationTimeProperty),
266 MagnifierPathConstraint(mStageSize, mStageSize * 0.5f)); 269 MagnifierPathConstraint(mStageSize, mStageSize * 0.5f));
267 mBouncingMagnifier.ApplyConstraint( constraint ); 270 mBouncingMagnifier.ApplyConstraint( constraint );
268 271
269 // Apply constraint to animate the source of the magnifier. 272 // Apply constraint to animate the source of the magnifier.
270 constraint = Constraint::New<Vector3>(mBouncingMagnifier.GetPropertyIndex( Toolkit::Magnifier::SOURCE_POSITION_PROPERTY_NAME ), 273 constraint = Constraint::New<Vector3>(mBouncingMagnifier.GetPropertyIndex( Toolkit::Magnifier::SOURCE_POSITION_PROPERTY_NAME ),
271 - LocalSource(Actor::Property::Size), 274 + LocalSource(Actor::Property::SIZE),
272 LocalSource(mAnimationTimeProperty), 275 LocalSource(mAnimationTimeProperty),
273 MagnifierPathConstraint(mStageSize)); 276 MagnifierPathConstraint(mStageSize));
274 mBouncingMagnifier.ApplyConstraint( constraint ); 277 mBouncingMagnifier.ApplyConstraint( constraint );
@@ -355,7 +358,7 @@ public: @@ -355,7 +358,7 @@ public:
355 if(!mMagnifierShown) 358 if(!mMagnifierShown)
356 { 359 {
357 Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION); 360 Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
358 - animation.AnimateTo(Property(mMagnifier, Actor::Property::Scale), Vector3::ONE, AlphaFunctions::EaseIn); 361 + animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ONE, AlphaFunctions::EaseIn);
359 animation.Play(); 362 animation.Play();
360 mMagnifierShown = true; 363 mMagnifierShown = true;
361 } 364 }
@@ -369,7 +372,7 @@ public: @@ -369,7 +372,7 @@ public:
369 if(mMagnifierShown) 372 if(mMagnifierShown)
370 { 373 {
371 Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION); 374 Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
372 - animation.AnimateTo(Property(mMagnifier, Actor::Property::Scale), Vector3::ZERO, AlphaFunctions::EaseOut); 375 + animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut);
373 animation.Play(); 376 animation.Play();
374 mMagnifierShown = false; 377 mMagnifierShown = false;
375 } 378 }
@@ -422,7 +425,7 @@ void RunTest( Application&amp; application ) @@ -422,7 +425,7 @@ void RunTest( Application&amp; application )
422 application.MainLoop(); 425 application.MainLoop();
423 } 426 }
424 427
425 -// Entry point for Linux & SLP applications 428 +// Entry point for Linux & Tizen applications
426 // 429 //
427 int main( int argc, char **argv ) 430 int main( int argc, char **argv )
428 { 431 {
examples/motion-blur/motion-blur-example.cpp
@@ -88,9 +88,25 @@ const Vector3 BUTTON_TITLE_LABEL_INSTRUCTIONS_POPUP_SIZE_CONSTRAINT( 1.0f, 1.0f, @@ -88,9 +88,25 @@ const Vector3 BUTTON_TITLE_LABEL_INSTRUCTIONS_POPUP_SIZE_CONSTRAINT( 1.0f, 1.0f,
88 const float BUTTON_TITLE_LABEL_Y_OFFSET = 0.05f; 88 const float BUTTON_TITLE_LABEL_Y_OFFSET = 0.05f;
89 89
90 const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to new orientation. 90 const float ORIENTATION_DURATION = 0.5f; ///< Time to rotate to new orientation.
91 -} // unnamed namespace  
92 91
  92 +/**
  93 + * @brief Load an image, scaled-down to no more than the dimensions passed in.
  94 + *
  95 + * Uses ImageAttributes::ShrinkToFit which ensures the resulting image is
  96 + * smaller than or equal to the specified dimensions while preserving its
  97 + * original aspect ratio.
  98 + */
  99 +ResourceImage LoadImageFittedInBox( const char * const imagePath, uint32_t maxWidth, uint32_t maxHeight )
  100 +{
  101 + // Load the image nicely scaled-down to fit within the specified max width and height:
  102 + ImageAttributes attributes;
  103 + attributes.SetSize( maxWidth, maxHeight);
  104 + attributes.SetFilterMode( ImageAttributes::BoxThenLinear );
  105 + attributes.SetScalingMode( ImageAttributes::ShrinkToFit );
  106 + return ResourceImage::New( imagePath, attributes );
  107 +}
93 108
  109 +} // unnamed namespace
94 110
95 111
96 // 112 //
@@ -187,10 +203,15 @@ public: @@ -187,10 +203,15 @@ public:
187 // Motion blurred actor 203 // Motion blurred actor
188 // 204 //
189 205
190 - Image image = ResourceImage::New( MOTION_BLUR_ACTOR_IMAGE1 ); 206 + // Scale down actor to fit on very low resolution screens with space to interact:
  207 + Size stageSize = Stage::GetCurrent().GetSize();
  208 + mMotionBlurActorSize = Size( std::min( stageSize.x * 0.3f, MOTION_BLUR_ACTOR_WIDTH ), std::min( stageSize.y * 0.3f, MOTION_BLUR_ACTOR_HEIGHT ) );
  209 + mMotionBlurActorSize = Size( std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ), std::min( mMotionBlurActorSize.x, mMotionBlurActorSize.y ) );
  210 +
  211 + Image image = LoadImageFittedInBox( MOTION_BLUR_ACTOR_IMAGE1, mMotionBlurActorSize.x, mMotionBlurActorSize.y );
191 mMotionBlurImageActor = ImageActor::New(image); 212 mMotionBlurImageActor = ImageActor::New(image);
192 mMotionBlurImageActor.SetParentOrigin( ParentOrigin::CENTER ); 213 mMotionBlurImageActor.SetParentOrigin( ParentOrigin::CENTER );
193 - mMotionBlurImageActor.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT); 214 + mMotionBlurImageActor.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y);
194 215
195 mContentLayer.Add( mMotionBlurImageActor ); 216 mContentLayer.Add( mMotionBlurImageActor );
196 217
@@ -207,8 +228,8 @@ public: @@ -207,8 +228,8 @@ public:
207 228
208 mMotionBlurImageActor2 = ImageActor::New(image); 229 mMotionBlurImageActor2 = ImageActor::New(image);
209 mMotionBlurImageActor2.SetParentOrigin( ParentOrigin::CENTER ); 230 mMotionBlurImageActor2.SetParentOrigin( ParentOrigin::CENTER );
210 - mMotionBlurImageActor2.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT);  
211 - mMotionBlurImageActor2.SetPosition(MOTION_BLUR_ACTOR_WIDTH * 1.1f, 0.0f); 231 + mMotionBlurImageActor2.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y);
  232 + mMotionBlurImageActor2.SetPosition(mMotionBlurActorSize.x * 1.1f, 0.0f);
212 mMotionBlurImageActor.Add( mMotionBlurImageActor2 ); 233 mMotionBlurImageActor.Add( mMotionBlurImageActor2 );
213 234
214 // Create shader used for doing motion blur 235 // Create shader used for doing motion blur
@@ -225,8 +246,8 @@ public: @@ -225,8 +246,8 @@ public:
225 246
226 mMotionBlurImageActor3 = ImageActor::New(image); 247 mMotionBlurImageActor3 = ImageActor::New(image);
227 mMotionBlurImageActor3.SetParentOrigin( ParentOrigin::CENTER ); 248 mMotionBlurImageActor3.SetParentOrigin( ParentOrigin::CENTER );
228 - mMotionBlurImageActor3.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT);  
229 - mMotionBlurImageActor3.SetPosition(-MOTION_BLUR_ACTOR_WIDTH * 1.1f, 0.0f); 249 + mMotionBlurImageActor3.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y);
  250 + mMotionBlurImageActor3.SetPosition(-mMotionBlurActorSize.x * 1.1f, 0.0f);
230 mMotionBlurImageActor.Add( mMotionBlurImageActor3 ); 251 mMotionBlurImageActor.Add( mMotionBlurImageActor3 );
231 252
232 // Create shader used for doing motion blur 253 // Create shader used for doing motion blur
@@ -243,8 +264,8 @@ public: @@ -243,8 +264,8 @@ public:
243 264
244 mMotionBlurImageActor4 = ImageActor::New(image); 265 mMotionBlurImageActor4 = ImageActor::New(image);
245 mMotionBlurImageActor4.SetParentOrigin( ParentOrigin::CENTER ); 266 mMotionBlurImageActor4.SetParentOrigin( ParentOrigin::CENTER );
246 - mMotionBlurImageActor4.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT);  
247 - mMotionBlurImageActor4.SetPosition(0.0f, MOTION_BLUR_ACTOR_HEIGHT * 1.1f); 267 + mMotionBlurImageActor4.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y);
  268 + mMotionBlurImageActor4.SetPosition(0.0f, mMotionBlurActorSize.y * 1.1f);
248 mMotionBlurImageActor.Add( mMotionBlurImageActor4 ); 269 mMotionBlurImageActor.Add( mMotionBlurImageActor4 );
249 270
250 // Create shader used for doing motion blur 271 // Create shader used for doing motion blur
@@ -261,8 +282,8 @@ public: @@ -261,8 +282,8 @@ public:
261 282
262 mMotionBlurImageActor5 = ImageActor::New(image); 283 mMotionBlurImageActor5 = ImageActor::New(image);
263 mMotionBlurImageActor5.SetParentOrigin( ParentOrigin::CENTER ); 284 mMotionBlurImageActor5.SetParentOrigin( ParentOrigin::CENTER );
264 - mMotionBlurImageActor5.SetSize(MOTION_BLUR_ACTOR_WIDTH, MOTION_BLUR_ACTOR_HEIGHT);  
265 - mMotionBlurImageActor5.SetPosition(0.0f, -MOTION_BLUR_ACTOR_HEIGHT * 1.1f); 285 + mMotionBlurImageActor5.SetSize(mMotionBlurActorSize.x, mMotionBlurActorSize.y);
  286 + mMotionBlurImageActor5.SetPosition(0.0f, -mMotionBlurActorSize.y * 1.1f);
266 mMotionBlurImageActor.Add( mMotionBlurImageActor5 ); 287 mMotionBlurImageActor.Add( mMotionBlurImageActor5 );
267 288
268 // Create shader used for doing motion blur 289 // Create shader used for doing motion blur
@@ -312,7 +333,7 @@ public: @@ -312,7 +333,7 @@ public:
312 else 333 else
313 { 334 {
314 // set the rotation to match the orientation 335 // set the rotation to match the orientation
315 - mView.SetRotation( Degree( -orientation ), Vector3::ZAXIS ); 336 + mView.SetOrientation( Degree( -orientation ), Vector3::ZAXIS );
316 mView.SetSize( targetSize ); 337 mView.SetSize( targetSize );
317 } 338 }
318 } 339 }
@@ -349,7 +370,7 @@ public: @@ -349,7 +370,7 @@ public:
349 mActorTapMovementAnimation = Animation::New( animDuration ); 370 mActorTapMovementAnimation = Animation::New( animDuration );
350 if ( mMotionBlurImageActor ) 371 if ( mMotionBlurImageActor )
351 { 372 {
352 - mActorTapMovementAnimation.AnimateTo( Property(mMotionBlurImageActor, Actor::Property::Position), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) ); 373 + mActorTapMovementAnimation.AnimateTo( Property(mMotionBlurImageActor, Actor::Property::POSITION), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) );
353 } 374 }
354 mActorTapMovementAnimation.SetEndAction( Animation::Bake ); 375 mActorTapMovementAnimation.SetEndAction( Animation::Bake );
355 mActorTapMovementAnimation.Play(); 376 mActorTapMovementAnimation.Play();
@@ -478,7 +499,7 @@ public: @@ -478,7 +499,7 @@ public:
478 mCurrentImage = 0; 499 mCurrentImage = 0;
479 } 500 }
480 501
481 - Image blurImage = ResourceImage::New( MOTION_BLUR_ACTOR_IMAGES[mCurrentImage] ); 502 + Image blurImage = LoadImageFittedInBox( MOTION_BLUR_ACTOR_IMAGES[mCurrentImage], mMotionBlurActorSize.x, mMotionBlurActorSize.y );
482 mMotionBlurImageActor.SetImage(blurImage); 503 mMotionBlurImageActor.SetImage(blurImage);
483 } 504 }
484 505
@@ -498,6 +519,7 @@ private: @@ -498,6 +519,7 @@ private:
498 // Motion blur 519 // Motion blur
499 MotionBlurEffect mMotionBlurEffect; 520 MotionBlurEffect mMotionBlurEffect;
500 ImageActor mMotionBlurImageActor; 521 ImageActor mMotionBlurImageActor;
  522 + Size mMotionBlurActorSize;
501 523
502 #ifdef MULTIPLE_MOTION_BLURRED_ACTORS 524 #ifdef MULTIPLE_MOTION_BLURRED_ACTORS
503 MotionBlurEffect mMotionBlurEffect2; 525 MotionBlurEffect mMotionBlurEffect2;
@@ -537,7 +559,7 @@ void RunTest(Application&amp; app) @@ -537,7 +559,7 @@ void RunTest(Application&amp; app)
537 app.MainLoop(); 559 app.MainLoop();
538 } 560 }
539 561
540 -// Entry point for Linux & SLP applications 562 +// Entry point for Linux & Tizen applications
541 // 563 //
542 int main(int argc, char **argv) 564 int main(int argc, char **argv)
543 { 565 {
examples/motion-stretch/motion-stretch-example.cpp
@@ -225,7 +225,7 @@ public: @@ -225,7 +225,7 @@ public:
225 else 225 else
226 { 226 {
227 // set the rotation to match the orientation 227 // set the rotation to match the orientation
228 - mView.SetRotation( Degree( -orientation ), Vector3::ZAXIS ); 228 + mView.SetOrientation( Degree( -orientation ), Vector3::ZAXIS );
229 mView.SetSize( targetSize ); 229 mView.SetSize( targetSize );
230 } 230 }
231 } 231 }
@@ -261,7 +261,7 @@ public: @@ -261,7 +261,7 @@ public:
261 mActorTapMovementAnimation = Animation::New( animDuration ); 261 mActorTapMovementAnimation = Animation::New( animDuration );
262 if ( mMotionStretchImageActor ) 262 if ( mMotionStretchImageActor )
263 { 263 {
264 - mActorTapMovementAnimation.AnimateTo( Property(mMotionStretchImageActor, Actor::Property::Position), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) ); 264 + mActorTapMovementAnimation.AnimateTo( Property(mMotionStretchImageActor, Actor::Property::POSITION), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) );
265 } 265 }
266 mActorTapMovementAnimation.SetEndAction( Animation::Bake ); 266 mActorTapMovementAnimation.SetEndAction( Animation::Bake );
267 mActorTapMovementAnimation.Play(); 267 mActorTapMovementAnimation.Play();
@@ -435,7 +435,7 @@ void RunTest(Application&amp; app) @@ -435,7 +435,7 @@ void RunTest(Application&amp; app)
435 app.MainLoop(); 435 app.MainLoop();
436 } 436 }
437 437
438 -// Entry point for Linux & SLP applications 438 +// Entry point for Linux & Tizen applications
439 // 439 //
440 int main(int argc, char **argv) 440 int main(int argc, char **argv)
441 { 441 {
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&amp; app ) @@ -223,6 +233,7 @@ void PageTurnController::OnInit( Application&amp; 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&amp; app ) @@ -236,6 +247,7 @@ void PageTurnController::OnInit( Application&amp; 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&amp; app ) @@ -244,6 +256,7 @@ void PageTurnController::OnInit( Application&amp; 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/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
@@ -210,7 +210,7 @@ public: @@ -210,7 +210,7 @@ public:
210 210
211 // Hack to force screen refresh. 211 // Hack to force screen refresh.
212 Animation animation = Animation::New(1.0f); 212 Animation animation = Animation::New(1.0f);
213 - animation.AnimateTo(Property(mContentLayer, Actor::Property::Position), Vector3::ZERO ); 213 + animation.AnimateTo(Property(mContentLayer, Actor::Property::POSITION), Vector3::ZERO );
214 animation.Play(); 214 animation.Play();
215 } 215 }
216 216
@@ -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
@@ -315,7 +317,7 @@ private: @@ -315,7 +317,7 @@ private:
315 { 317 {
316 for(int column = 0;column<imageColumns;column++) 318 for(int column = 0;column<imageColumns;column++)
317 { 319 {
318 - ImageActor image = CreateImage( GetNextImagePath() ); 320 + ImageActor image = CreateImage( GetNextImagePath(), imageSize.x, imageSize.y );
319 321
320 image.SetParentOrigin( ParentOrigin::CENTER ); 322 image.SetParentOrigin( ParentOrigin::CENTER );
321 image.SetAnchorPoint( AnchorPoint::CENTER ); 323 image.SetAnchorPoint( AnchorPoint::CENTER );
@@ -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 {
@@ -562,9 +565,11 @@ private: @@ -562,9 +565,11 @@ private:
562 ImageAttributes attributes; 565 ImageAttributes attributes;
563 566
564 attributes.SetSize(width, height); 567 attributes.SetSize(width, height);
565 - attributes.SetScalingMode(ImageAttributes::ShrinkToFit); 568 + attributes.SetScalingMode(ImageAttributes::ScaleToFill);
  569 + attributes.SetFilterMode( ImageAttributes::BoxThenLinear );
566 Image img = ResourceImage::New(filename, attributes); 570 Image img = ResourceImage::New(filename, attributes);
567 ImageActor actor = ImageActor::New(img); 571 ImageActor actor = ImageActor::New(img);
  572 + actor.SetRelayoutEnabled( false );
568 actor.SetName( filename ); 573 actor.SetName( filename );
569 actor.SetParentOrigin(ParentOrigin::CENTER); 574 actor.SetParentOrigin(ParentOrigin::CENTER);
570 actor.SetAnchorPoint(AnchorPoint::CENTER); 575 actor.SetAnchorPoint(AnchorPoint::CENTER);
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
@@ -189,7 +189,7 @@ public: @@ -189,7 +189,7 @@ public:
189 mView.SetPosition(Vector3(0.0f, 0.0f, -50)); 189 mView.SetPosition(Vector3(0.0f, 0.0f, -50));
190 190
191 mContents.SetPosition(mTranslation); 191 mContents.SetPosition(mTranslation);
192 - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); 192 + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt)));
193 mContents.SetScale(mPinchScale, mPinchScale, mPinchScale); 193 mContents.SetScale(mPinchScale, mPinchScale, mPinchScale);
194 194
195 mPanGestureDetector = PanGestureDetector::New(); 195 mPanGestureDetector = PanGestureDetector::New();
@@ -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
@@ -232,7 +233,7 @@ public: @@ -232,7 +233,7 @@ public:
232 mLightAnchor = Actor::New(); 233 mLightAnchor = Actor::New();
233 mLightAnchor.SetParentOrigin(ParentOrigin::CENTER); 234 mLightAnchor.SetParentOrigin(ParentOrigin::CENTER);
234 mLightAnchor.SetAnchorPoint(AnchorPoint::CENTER); 235 mLightAnchor.SetAnchorPoint(AnchorPoint::CENTER);
235 - mLightAnchor.SetRotation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); 236 + mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt)));
236 237
237 // Work out a scaling factor as the initial light position was calculated for desktop 238 // Work out a scaling factor as the initial light position was calculated for desktop
238 // Need to scale light position as scene actor size is based on stage size (i.e. much bigger on device) 239 // Need to scale light position as scene actor size is based on stage size (i.e. much bigger on device)
@@ -286,9 +287,9 @@ public: @@ -286,9 +287,9 @@ public:
286 287
287 Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value(30.0f)); 288 Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value(30.0f));
288 Source angleSrc( mImageActor2, angleIndex ); 289 Source angleSrc( mImageActor2, angleIndex );
289 - mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::Rotation, angleSrc, 290 + mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ORIENTATION, angleSrc,
290 RotationConstraint(-1.0f))); 291 RotationConstraint(-1.0f)));
291 - mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::Rotation, angleSrc, 292 + mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ORIENTATION, angleSrc,
292 RotationConstraint(+1.0f))); 293 RotationConstraint(+1.0f)));
293 294
294 mSceneAnimation = Animation::New(2.5f); 295 mSceneAnimation = Animation::New(2.5f);
@@ -343,7 +344,7 @@ public: @@ -343,7 +344,7 @@ public:
343 mLightLongitudinal += gesture.displacement.x/4.0f; 344 mLightLongitudinal += gesture.displacement.x/4.0f;
344 mLightAxisTilt -= gesture.displacement.y/6.0f; 345 mLightAxisTilt -= gesture.displacement.y/6.0f;
345 mLightAxisTilt = Clamp<float>(mLightAxisTilt, -90.0f, 90.0f); 346 mLightAxisTilt = Clamp<float>(mLightAxisTilt, -90.0f, 90.0f);
346 - mLightAnchor.SetRotation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt))); 347 + mLightAnchor.SetOrientation(CalculateWorldRotation(Radian(mLightLongitudinal), Radian(mLightAxisTilt)));
347 break; 348 break;
348 } 349 }
349 350
@@ -359,7 +360,7 @@ public: @@ -359,7 +360,7 @@ public:
359 mLongitudinal += gesture.displacement.x/4.0f; 360 mLongitudinal += gesture.displacement.x/4.0f;
360 mAxisTilt -= gesture.displacement.y/6.0f; 361 mAxisTilt -= gesture.displacement.y/6.0f;
361 mAxisTilt = Clamp<float>(mAxisTilt, -90.0f, 90.0f); 362 mAxisTilt = Clamp<float>(mAxisTilt, -90.0f, 90.0f);
362 - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); 363 + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt)));
363 break; 364 break;
364 } 365 }
365 366
@@ -368,7 +369,7 @@ public: @@ -368,7 +369,7 @@ public:
368 mObjectLongitudinal += gesture.displacement.x/4.0f; 369 mObjectLongitudinal += gesture.displacement.x/4.0f;
369 mObjectAxisTilt -= gesture.displacement.y/6.0f; 370 mObjectAxisTilt -= gesture.displacement.y/6.0f;
370 mObjectAxisTilt = Clamp<float>(mObjectAxisTilt, -90.0f, 90.0f); 371 mObjectAxisTilt = Clamp<float>(mObjectAxisTilt, -90.0f, 90.0f);
371 - mSceneActor.SetRotation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt))); 372 + mSceneActor.SetOrientation(CalculateWorldRotation(Radian(mObjectLongitudinal), Radian(mObjectAxisTilt)));
372 break; 373 break;
373 } 374 }
374 } 375 }
@@ -460,7 +461,7 @@ public: @@ -460,7 +461,7 @@ public:
460 // Align scene so that light anchor orientation is Z Axis 461 // Align scene so that light anchor orientation is Z Axis
461 mAxisTilt = -mLightAxisTilt; 462 mAxisTilt = -mLightAxisTilt;
462 mLongitudinal = -mLightLongitudinal; 463 mLongitudinal = -mLightLongitudinal;
463 - mContents.SetRotation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt))); 464 + mContents.SetOrientation(CalculateWorldRotation(Radian(mLongitudinal), Radian(mAxisTilt)));
464 465
465 return true; 466 return true;
466 } 467 }
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.SetPreferredSize( Vector2( 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.SetPreferredSize( Vector2( 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.SetDimensionDependency( HEIGHT, WIDTH );
  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.SetDimensionDependency( HEIGHT, WIDTH );
  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( FILL_TO_PARENT, ALL_DIMENSIONS );
  479 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  480 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  481 +
  482 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
  483 + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  484 +
  485 + mPopup.Add( image );
  486 +
  487 + // The popup is not yet on the stage so needs to be flaged as dirty
  488 + mPopup.MarkDirtyForRelayout();
  489 +
  490 + mPopup.Show();
  491 + }
  492 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
  493 + {
  494 + mPopup = CreatePopup();
  495 +
  496 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  497 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  498 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  499 +
  500 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
  501 + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  502 + image.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
  503 +
  504 + mPopup.Add( image );
  505 +
  506 + // The popup is not yet on the stage so needs to be flaged as dirty
  507 + mPopup.MarkDirtyForRelayout();
  508 +
  509 + mPopup.Show();
  510 + }
  511 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
  512 + {
  513 + mPopup = CreatePopup();
  514 +
  515 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  516 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  517 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  518 +
  519 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
  520 + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  521 + image.SetSizeScalePolicy( FILL_WITH_ASPECT_RATIO );
  522 +
  523 + mPopup.Add( image );
  524 +
  525 + // The popup is not yet on the stage so needs to be flaged as dirty
  526 + mPopup.MarkDirtyForRelayout();
  527 +
  528 + mPopup.Show();
  529 + }
  530 + else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
  531 + {
  532 + mPopup = CreatePopup();
  533 + mPopup.SetTitle( "Popup!" );
  534 +
  535 + Toolkit::TextView text = Toolkit::TextView::New();
  536 + text.SetName( "POPUP_CONTENT_TEXT" );
  537 + text.SetText( CONTENT_TEXT );
  538 + text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
  539 + text.SetWidthExceedPolicy( Toolkit::TextView::Split );
  540 + text.SetLineJustification( Toolkit::TextView::Center );
  541 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  542 + text.SetDimensionDependency( HEIGHT, WIDTH );
  543 + text.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
  544 +
  545 + mPopup.Add( text );
  546 +
  547 + // The popup is not yet on the stage so needs to be flaged as dirty
  548 + mPopup.MarkDirtyForRelayout();
  549 +
  550 + mPopup.Show();
  551 + }
  552 + else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID )
  553 + {
  554 + mPopup = CreatePopup();
  555 + mPopup.SetTitle( "Popup!" );
  556 +
  557 + Toolkit::TextView text = Toolkit::TextView::New();
  558 + text.SetName( "POPUP_CONTENT_TEXT" );
  559 + text.SetText( CONTENT_TEXT );
  560 + text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
  561 + text.SetWidthExceedPolicy( Toolkit::TextView::Split );
  562 + text.SetLineJustification( Toolkit::TextView::Left );
  563 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  564 + text.SetDimensionDependency( HEIGHT, WIDTH );
  565 + text.SetPadding( Padding( 10.0f, 10.0f, 20.0f, 0.0f ) );
  566 +
  567 + mPopup.Add( text );
  568 +
  569 + Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
  570 + cancelButton.SetName( CANCEL_BUTTON_ID );
  571 + cancelButton.SetLabel( "Cancel" );
  572 + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  573 + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  574 +
  575 + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  576 +
  577 + mPopup.AddButton( cancelButton );
  578 +
  579 + Toolkit::PushButton okayButton = Toolkit::PushButton::New();
  580 + okayButton.SetName( OKAY_BUTTON_ID );
  581 + okayButton.SetLabel( "OK!" );
  582 + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  583 + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  584 +
  585 + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  586 +
  587 + mPopup.AddButton( okayButton );
  588 +
  589 + // The popup is not yet on the stage so needs to be flaged as dirty
  590 + mPopup.MarkDirtyForRelayout();
  591 +
  592 + mPopup.Show();
  593 + }
  594 + else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID )
  595 + {
  596 + mPopup = CreatePopup();
  597 + mPopup.SetTitle( "Warning" );
  598 +
  599 + // Content
  600 + Toolkit::TableView content = Toolkit::TableView::New( 2, 2 );
  601 + content.SetName( "COMPLEX_TABLEVIEW" );
  602 + content.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  603 + content.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  604 + content.SetFitHeight( 0 );
  605 + content.SetFitHeight( 1 );
  606 + content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) );
  607 +
  608 + // Text
  609 + {
  610 + Toolkit::TextView text = Toolkit::TextView::New();
  611 + text.SetText( "Do you really want to quit?" );
  612 + text.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
  613 + text.SetWidthExceedPolicy( Toolkit::TextView::Split );
  614 + text.SetLineJustification( Toolkit::TextView::Left );
  615 + text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  616 + text.SetDimensionDependency( HEIGHT, WIDTH );
  617 +
  618 + content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) );
  619 + }
  620 +
  621 + // Image
  622 + {
  623 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE1 ) );
  624 + image.SetName( "COMPLEX_IMAGE" );
  625 + image.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  626 + image.SetDimensionDependency( HEIGHT, WIDTH );
  627 + image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) );
  628 + content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
  629 + }
  630 +
  631 + // Text 2
  632 + {
  633 + Toolkit::TableView root = Toolkit::TableView::New( 1, 2 );
  634 + root.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  635 + root.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  636 + root.SetFitHeight( 0 );
  637 + root.SetFitWidth( 0 );
  638 + root.SetPadding( Padding( 0.0f, 0.0f, 0.0f, 20.0f ) );
  639 +
  640 + Dali::Image unchecked = Dali::ResourceImage::New( CHECKBOX_UNCHECKED_IMAGE );
  641 + Dali::Image checked = Dali::ResourceImage::New( CHECKBOX_CHECKED_IMAGE );
  642 + Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
  643 + checkBox.SetBackgroundImage( unchecked );
  644 + checkBox.SetSelectedImage( checked );
  645 + checkBox.SetPreferredSize( Vector2( 48, 48 ) );
  646 + checkBox.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  647 +
  648 + root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) );
  649 +
  650 + Toolkit::TextView text = Toolkit::TextView::New();
  651 + text.SetText( "Don't show again" );
  652 + text.SetLineJustification( Toolkit::TextView::Left );
  653 + Actor textActor = text;
  654 + textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
  655 +
  656 + root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) );
  657 +
  658 + content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0, 0, 2 ) ); // Column span 2
  659 + }
  660 +
  661 + mPopup.Add( content );
  662 +
  663 + // Buttons
  664 + Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
  665 + cancelButton.SetName( CANCEL_BUTTON_ID );
  666 + cancelButton.SetLabel( "Cancel" );
  667 + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  668 + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  669 +
  670 + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  671 +
  672 + mPopup.AddButton( cancelButton );
  673 +
  674 + Toolkit::PushButton okayButton = Toolkit::PushButton::New();
  675 + okayButton.SetName( OKAY_BUTTON_ID );
  676 + okayButton.SetLabel( "OK!" );
  677 + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  678 + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  679 +
  680 + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  681 +
  682 + mPopup.AddButton( okayButton );
  683 +
  684 + // The popup is not yet on the stage so needs to be flaged as dirty
  685 + mPopup.MarkDirtyForRelayout();
  686 +
  687 + mPopup.Show();
  688 + }
  689 + else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID )
  690 + {
  691 + mPopup = CreatePopup();
  692 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  693 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  694 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  695 +
  696 +
  697 + Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
  698 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  699 +
  700 + mPopup.Add( table );
  701 +
  702 + // The popup is not yet on the stage so needs to be flaged as dirty
  703 + mPopup.MarkDirtyForRelayout();
  704 +
  705 + mPopup.Show();
  706 + }
  707 + else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID )
  708 + {
  709 + mPopup = CreatePopup();
  710 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  711 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  712 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  713 +
  714 +
  715 + Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
  716 + table.SetName( "TABLEVIEW_BUTTON_1CELL_ID" );
  717 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  718 +
  719 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  720 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  721 + table.Add( backing );
  722 +
  723 + mPopup.Add( table );
  724 +
  725 + // The popup is not yet on the stage so needs to be flaged as dirty
  726 + mPopup.MarkDirtyForRelayout();
  727 +
  728 + mPopup.Show();
  729 + }
  730 + else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID )
  731 + {
  732 + mPopup = CreatePopup();
  733 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  734 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  735 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  736 +
  737 +
  738 + Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
  739 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  740 +
  741 + {
  742 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  743 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  744 + table.Add( backing );
  745 + }
  746 + {
  747 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  748 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  749 + table.Add( backing );
  750 + }
  751 + {
  752 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  753 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  754 + table.Add( backing );
  755 + }
  756 +
  757 + mPopup.Add( table );
  758 +
  759 + // The popup is not yet on the stage so needs to be flaged as dirty
  760 + mPopup.MarkDirtyForRelayout();
  761 +
  762 + mPopup.Show();
  763 + }
  764 + else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID )
  765 + {
  766 + mPopup = CreatePopup();
  767 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  768 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  769 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  770 +
  771 +
  772 + Toolkit::TableView table = Toolkit::TableView::New( 3, 3 );
  773 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  774 +
  775 + // Column 0
  776 + {
  777 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  778 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  779 + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) );
  780 + }
  781 + {
  782 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  783 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  784 + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) );
  785 + }
  786 + {
  787 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  788 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  789 + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) );
  790 + }
  791 +
  792 + // Column 1
  793 + {
  794 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
  795 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  796 + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 1 ) );
  797 + }
  798 + {
  799 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
  800 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  801 + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 1 ) );
  802 + }
  803 + {
  804 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 1.0f, 1.0f ) );
  805 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  806 + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 1 ) );
  807 + }
  808 +
  809 + // Column 2
  810 + {
  811 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) );
  812 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  813 + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 2 ) );
  814 + }
  815 + {
  816 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.5f, 0.5f, 0.5f, 1.0f ) );
  817 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  818 + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 2 ) );
  819 + }
  820 + {
  821 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.5f, 0.0f, 1.0f ) );
  822 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  823 + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 2 ) );
  824 + }
  825 +
  826 + mPopup.Add( table );
  827 +
  828 + // The popup is not yet on the stage so needs to be flaged as dirty
  829 + mPopup.MarkDirtyForRelayout();
  830 +
  831 + mPopup.Show();
  832 + }
  833 + else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID )
  834 + {
  835 + mPopup = CreatePopup();
  836 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  837 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  838 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  839 +
  840 +
  841 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  842 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  843 + table.SetFixedHeight( 0, 50.0f );
  844 +
  845 + {
  846 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  847 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  848 + TextActor text = TextActor::New( "Fixed" );
  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( 1.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 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  865 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  866 + TextActor text = TextActor::New( "Fill" );
  867 + text.SetAnchorPoint( AnchorPoint::CENTER );
  868 + text.SetParentOrigin( ParentOrigin::CENTER );
  869 + backing.Add( text );
  870 + table.Add( backing );
  871 + }
  872 +
  873 + mPopup.Add( table );
  874 +
  875 + // The popup is not yet on the stage so needs to be flaged as dirty
  876 + mPopup.MarkDirtyForRelayout();
  877 +
  878 + mPopup.Show();
  879 + }
  880 + else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID )
  881 + {
  882 + mPopup = CreatePopup();
  883 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  884 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  885 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  886 +
  887 +
  888 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  889 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  890 + table.SetFixedHeight( 0, 50.0f );
  891 + table.SetFixedHeight( 2, 50.0f );
  892 +
  893 + {
  894 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  895 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  896 + TextActor text = TextActor::New( "Fixed" );
  897 + text.SetAnchorPoint( AnchorPoint::CENTER );
  898 + text.SetParentOrigin( ParentOrigin::CENTER );
  899 + backing.Add( text );
  900 + table.Add( backing );
  901 + }
  902 + {
  903 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  904 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  905 + TextActor text = TextActor::New( "Fill" );
  906 + text.SetAnchorPoint( AnchorPoint::CENTER );
  907 + text.SetParentOrigin( ParentOrigin::CENTER );
  908 + backing.Add( text );
  909 + table.Add( backing );
  910 + }
  911 + {
  912 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  913 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  914 + TextActor text = TextActor::New( "Fixed" );
  915 + text.SetAnchorPoint( AnchorPoint::CENTER );
  916 + text.SetParentOrigin( ParentOrigin::CENTER );
  917 + backing.Add( text );
  918 + table.Add( backing );
  919 + }
  920 +
  921 + mPopup.Add( table );
  922 +
  923 + // The popup is not yet on the stage so needs to be flaged as dirty
  924 + mPopup.MarkDirtyForRelayout();
  925 +
  926 + mPopup.Show();
  927 + }
  928 + else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID )
  929 + {
  930 + mPopup = CreatePopup();
  931 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  932 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  933 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  934 +
  935 +
  936 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  937 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  938 + table.SetFitHeight( 0 );
  939 + table.SetFitHeight( 2 );
  940 +
  941 + {
  942 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  943 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  944 + backing.SetResizePolicy( FIXED, HEIGHT );
  945 + backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
  946 +
  947 + TextActor text = TextActor::New( "Fit" );
  948 + text.SetAnchorPoint( AnchorPoint::CENTER );
  949 + text.SetParentOrigin( ParentOrigin::CENTER );
  950 + backing.Add( text );
  951 +
  952 + table.Add( backing );
  953 + }
  954 + {
  955 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  956 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  957 +
  958 + TextActor text = TextActor::New( "Fill" );
  959 + text.SetAnchorPoint( AnchorPoint::CENTER );
  960 + text.SetParentOrigin( ParentOrigin::CENTER );
  961 + backing.Add( text );
  962 +
  963 + table.Add( backing );
  964 + }
  965 + {
  966 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  967 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  968 + backing.SetResizePolicy( FIXED, HEIGHT );
  969 + backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
  970 +
  971 + TextActor text = TextActor::New( "Fit" );
  972 + text.SetAnchorPoint( AnchorPoint::CENTER );
  973 + text.SetParentOrigin( ParentOrigin::CENTER );
  974 + backing.Add( text );
  975 +
  976 + table.Add( backing );
  977 + }
  978 +
  979 + mPopup.Add( table );
  980 +
  981 + // The popup is not yet on the stage so needs to be flaged as dirty
  982 + mPopup.MarkDirtyForRelayout();
  983 +
  984 + mPopup.Show();
  985 + }
  986 + else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID )
  987 + {
  988 + mPopup = CreatePopup();
  989 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  990 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  991 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  992 +
  993 +
  994 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  995 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  996 + table.SetFitHeight( 1 );
  997 +
  998 + {
  999 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  1000 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  1001 +
  1002 + TextActor text = TextActor::New( "Fill" );
  1003 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1004 + text.SetParentOrigin( ParentOrigin::CENTER );
  1005 + backing.Add( text );
  1006 +
  1007 + table.Add( backing );
  1008 + }
  1009 + {
  1010 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  1011 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1012 + backing.SetResizePolicy( FIXED, HEIGHT );
  1013 + backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
  1014 +
  1015 + TextActor text = TextActor::New( "Fit" );
  1016 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1017 + text.SetParentOrigin( ParentOrigin::CENTER );
  1018 + backing.Add( text );
  1019 +
  1020 + table.Add( backing );
  1021 + }
  1022 + {
  1023 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  1024 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  1025 +
  1026 + TextActor text = TextActor::New( "Fill" );
  1027 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1028 + text.SetParentOrigin( ParentOrigin::CENTER );
  1029 + backing.Add( text );
  1030 +
  1031 + table.Add( backing );
  1032 + }
  1033 +
  1034 + mPopup.Add( table );
  1035 +
  1036 + // The popup is not yet on the stage so needs to be flaged as dirty
  1037 + mPopup.MarkDirtyForRelayout();
  1038 +
  1039 + mPopup.Show();
  1040 + }
  1041 + else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID )
  1042 + {
  1043 + mPopup = CreatePopup();
  1044 + mPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1045 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  1046 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
  1047 + mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  1048 +
  1049 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  1050 + table.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1051 + table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  1052 + table.SetFitHeight( 0 );
  1053 + table.SetFitHeight( 1 );
  1054 + table.SetFitHeight( 2 );
  1055 +
  1056 + {
  1057 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  1058 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1059 + backing.SetResizePolicy( FIXED, HEIGHT );
  1060 + backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
  1061 +
  1062 + TextActor text = TextActor::New( "Fit" );
  1063 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1064 + text.SetParentOrigin( ParentOrigin::CENTER );
  1065 + backing.Add( text );
  1066 +
  1067 + table.Add( backing );
  1068 + }
  1069 + {
  1070 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  1071 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1072 + backing.SetResizePolicy( FIXED, HEIGHT );
  1073 + backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
  1074 +
  1075 + TextActor text = TextActor::New( "Fit" );
  1076 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1077 + text.SetParentOrigin( ParentOrigin::CENTER );
  1078 + backing.Add( text );
  1079 +
  1080 + table.Add( backing );
  1081 + }
  1082 + {
  1083 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  1084 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1085 + backing.SetResizePolicy( FIXED, HEIGHT );
  1086 + backing.SetPreferredSize( Vector2( 0.0f, 300.0f ) );
  1087 +
  1088 + TextActor text = TextActor::New( "Fit" );
  1089 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1090 + text.SetParentOrigin( ParentOrigin::CENTER );
  1091 + backing.Add( text );
  1092 +
  1093 + table.Add( backing );
  1094 + }
  1095 +
  1096 + mPopup.Add( table );
  1097 +
  1098 + // The popup is not yet on the stage so needs to be flaged as dirty
  1099 + mPopup.MarkDirtyForRelayout();
  1100 +
  1101 + mPopup.Show();
  1102 + }
  1103 + else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID )
  1104 + {
  1105 + mPopup = CreatePopup();
  1106 + mPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1107 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  1108 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
  1109 + mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  1110 +
  1111 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  1112 + table.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1113 + table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  1114 + table.SetFitHeight( 0 );
  1115 + table.SetFitHeight( 1 );
  1116 +
  1117 + {
  1118 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  1119 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1120 + backing.SetResizePolicy( FIXED, HEIGHT );
  1121 + backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
  1122 +
  1123 + TextActor text = TextActor::New( "Fit" );
  1124 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1125 + text.SetParentOrigin( ParentOrigin::CENTER );
  1126 + backing.Add( text );
  1127 +
  1128 + table.Add( backing );
  1129 + }
  1130 + {
  1131 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  1132 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1133 + backing.SetResizePolicy( FIXED, HEIGHT );
  1134 + backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
  1135 +
  1136 + TextActor text = TextActor::New( "Fit" );
  1137 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1138 + text.SetParentOrigin( ParentOrigin::CENTER );
  1139 + backing.Add( text );
  1140 +
  1141 + table.Add( backing );
  1142 + }
  1143 +
  1144 + mPopup.Add( table );
  1145 +
  1146 + // The popup is not yet on the stage so needs to be flaged as dirty
  1147 + mPopup.MarkDirtyForRelayout();
  1148 +
  1149 + mPopup.Show();
  1150 + }
  1151 + else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID )
  1152 + {
  1153 + mPopup = CreatePopup();
  1154 + mPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1155 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  1156 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
  1157 + mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  1158 +
  1159 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  1160 + table.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1161 + table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  1162 + table.SetFixedHeight( 0, 20.0f );
  1163 + table.SetFitHeight( 1 );
  1164 +
  1165 + {
  1166 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  1167 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  1168 +
  1169 + TextActor text = TextActor::New( "Fixed" );
  1170 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1171 + text.SetParentOrigin( ParentOrigin::CENTER );
  1172 + backing.Add( text );
  1173 +
  1174 + table.Add( backing );
  1175 + }
  1176 + {
  1177 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  1178 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1179 + backing.SetResizePolicy( FIXED, HEIGHT );
  1180 + backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
  1181 +
  1182 + TextActor text = TextActor::New( "Fit" );
  1183 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1184 + text.SetParentOrigin( ParentOrigin::CENTER );
  1185 + backing.Add( text );
  1186 +
  1187 + table.Add( backing );
  1188 + }
  1189 +
  1190 + mPopup.Add( table );
  1191 +
  1192 + // The popup is not yet on the stage so needs to be flaged as dirty
  1193 + mPopup.MarkDirtyForRelayout();
  1194 +
  1195 + mPopup.Show();
  1196 + }
  1197 + else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID )
  1198 + {
  1199 + if( mPopup )
  1200 + {
  1201 + mPopup.Hide();
  1202 + }
  1203 + }
  1204 +
  1205 + return true;
  1206 + }
  1207 +
  1208 + void OnPopupOutsideTouched()
  1209 + {
  1210 + if( mPopup )
  1211 + {
  1212 + mPopup.Hide();
  1213 + }
  1214 + }
  1215 +
  1216 + void OnKeyEvent( const KeyEvent& event )
  1217 + {
  1218 + if( event.state == KeyEvent::Down )
  1219 + {
  1220 + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
  1221 + {
  1222 + // Exit application when click back or escape.
  1223 + mApplication.Quit();
  1224 + }
  1225 + }
  1226 + }
  1227 +
  1228 +public: // From ItemFactory
  1229 +
  1230 + /**
  1231 + * @brief Return the number of items to display in the item view
  1232 + *
  1233 + * @return Return the number of items to display
  1234 + */
  1235 + virtual unsigned int GetNumberOfItems()
  1236 + {
  1237 + switch( mDemoState )
  1238 + {
  1239 + case POPUP:
  1240 + {
  1241 + return POPUP_BUTTON_ITEMS_COUNT;
  1242 + }
  1243 +
  1244 + case TABLEVIEW:
  1245 + {
  1246 + return TABLEVIEW_BUTTON_ITEMS_COUNT;
  1247 + }
  1248 +
  1249 + default:
  1250 + {
  1251 + break;
  1252 + }
  1253 + }
  1254 +
  1255 + return 0;
  1256 + }
  1257 +
  1258 + /**
  1259 + * @brief Create a new item to populate the item view with
  1260 + *
  1261 + * @param[in] itemId The index of the item to create
  1262 + * @return Return the created actor for the given ID
  1263 + */
  1264 + virtual Actor NewItem(unsigned int itemId)
  1265 + {
  1266 + const ButtonItem* buttonDataArray = NULL;
  1267 + switch( mDemoState )
  1268 + {
  1269 + case POPUP:
  1270 + {
  1271 + buttonDataArray = POPUP_BUTTON_ITEMS;
  1272 + break;
  1273 + }
  1274 +
  1275 + case TABLEVIEW:
  1276 + {
  1277 + buttonDataArray = TABLEVIEW_BUTTON_ITEMS;
  1278 + break;
  1279 + }
  1280 +
  1281 + default:
  1282 + {
  1283 + break;
  1284 + }
  1285 + }
  1286 +
  1287 + if( buttonDataArray )
  1288 + {
  1289 + Toolkit::PushButton popupButton = Toolkit::PushButton::New();
  1290 + popupButton.SetName( buttonDataArray[ itemId ].name );
  1291 + popupButton.SetLabel( buttonDataArray[ itemId ].text );
  1292 + popupButton.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
  1293 +
  1294 + popupButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  1295 + popupButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  1296 +
  1297 + popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  1298 +
  1299 + return popupButton;
  1300 + }
  1301 +
  1302 + return Actor();
  1303 + }
  1304 +
  1305 +private:
  1306 +
  1307 + enum DemoState
  1308 + {
  1309 + POPUP,
  1310 + TABLEVIEW
  1311 + };
  1312 +
  1313 + Application& mApplication;
  1314 + Toolkit::View mView; ///< The View instance.
  1315 + Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  1316 + Layer mContentLayer; ///< Content layer
  1317 +
  1318 + Toolkit::TextView mTitleActor; ///< Title text
  1319 +
  1320 + Toolkit::Popup mMenu; ///< The navigation menu
  1321 + bool mMenuShown; ///< If the navigation menu is currently being displayed or not
  1322 +
  1323 + Toolkit::Popup mPopup;
  1324 +
  1325 + Toolkit::ItemView mItemView; ///< ItemView to hold test images
  1326 +
  1327 + DemoState mDemoState;
  1328 +};
  1329 +
  1330 +void RunTest( Application& application )
  1331 +{
  1332 + SizeNegotiationController test( application );
  1333 +
  1334 + application.MainLoop();
  1335 +}
  1336 +
  1337 +// Entry point for Linux & SLP applications
  1338 +//
  1339 +int main( int argc, char **argv )
  1340 +{
  1341 + Application application = Application::New( &argc, &argv );
  1342 +
  1343 + RunTest( application );
  1344 +
  1345 + return 0;
  1346 +}
examples/text-view/text-view-example.cpp
@@ -75,14 +75,14 @@ const TableString TABLE_STRINGS[] = { { &quot;HelveticaNue&quot;, &quot;Regular&quot;, 8.0f, @@ -75,14 +75,14 @@ const TableString TABLE_STRINGS[] = { { &quot;HelveticaNue&quot;, &quot;Regular&quot;, 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
@@ -132,7 +132,7 @@ public: @@ -132,7 +132,7 @@ public:
132 textContainer.SetParentOrigin( ParentOrigin::TOP_LEFT ); 132 textContainer.SetParentOrigin( ParentOrigin::TOP_LEFT );
133 textContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 133 textContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
134 textContainer.SetPosition( 0, TOOLBAR_HEIGHT ); 134 textContainer.SetPosition( 0, TOOLBAR_HEIGHT );
135 - textContainer.SetSize( stage.GetSize().width, stage.GetSize().height - TOOLBAR_HEIGHT ); 135 + textContainer.SetPreferredSize( Vector2( stage.GetSize().width, stage.GetSize().height - TOOLBAR_HEIGHT ) );
136 136
137 mContentLayer.Add( textContainer ); 137 mContentLayer.Add( textContainer );
138 138
@@ -150,11 +150,13 @@ public: @@ -150,11 +150,13 @@ public:
150 150
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.SetRotation( 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 ) );
@@ -189,7 +191,7 @@ void RunTest( Application&amp; application ) @@ -189,7 +191,7 @@ void RunTest( Application&amp; application )
189 application.MainLoop(); 191 application.MainLoop();
190 } 192 }
191 193
192 -// Entry point for Linux & SLP applications 194 +// Entry point for Linux & Tizen applications
193 // 195 //
194 int main( int argc, char **argv ) 196 int main( int argc, char **argv )
195 { 197 {
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.32 5 +Version: 1.0.35
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
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 "duration": 10.0, 59 "duration": 10.0,
60 "properties": [{ 60 "properties": [{
61 "actor": "image", // referenced actors must exist on stage 61 "actor": "image", // referenced actors must exist on stage
62 - "property": "rotation", 62 + "property": "orientation",
63 "value": [0, 0, -45], 63 "value": [0, 0, -45],
64 "alpha-function": "EASE_IN_OUT", 64 "alpha-function": "EASE_IN_OUT",
65 "time-period": { 65 "time-period": {
@@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
90 "styles": ["basic-text"], 90 "styles": ["basic-text"],
91 "position": [0, -120, 0], 91 "position": [0, -120, 0],
92 "size": [200, 200, 1], 92 "size": [200, 200, 1],
93 - "rotation": [0, 0, 30], 93 + "orientation": [0, 0, 30],
94 "signals": [{ 94 "signals": [{
95 "name": "touched", 95 "name": "touched",
96 "action": "play", 96 "action": "play",
@@ -102,7 +102,7 @@ @@ -102,7 +102,7 @@
102 "parent-origin": "CENTER", 102 "parent-origin": "CENTER",
103 "anchor-point": "CENTER", 103 "anchor-point": "CENTER",
104 "size": [200, 200, 1], 104 "size": [200, 200, 1],
105 - "rotation": [0, 0, 39], 105 + "orientation": [0, 0, 39],
106 "position": [-150, -50, 0], 106 "position": [-150, -50, 0],
107 "text": "or me", 107 "text": "or me",
108 "signals": [{ 108 "signals": [{
@@ -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,12 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar, @@ -84,10 +84,12 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; 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.SetPreferredSize( Dali::Vector2( 0.0f, style.mToolBarHeight ) );
  91 + toolBarLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::WIDTH );
  92 + toolBarLayer.SetResizePolicy( Dali::FIXED, Dali::HEIGHT );
91 93
92 // Raise tool bar layer to the top. 94 // Raise tool bar layer to the top.
93 toolBarLayer.RaiseToTop(); 95 toolBarLayer.RaiseToTop();
@@ -95,12 +97,14 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar, @@ -95,12 +97,14 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar,
95 // Tool bar 97 // Tool bar
96 Dali::Image image = Dali::ResourceImage::New( toolbarImagePath ); 98 Dali::Image image = Dali::ResourceImage::New( toolbarImagePath );
97 Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image ); 99 Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image );
  100 + toolBarBackground.SetName( "TOOLBAR_BACKGROUND" );
  101 + toolBarBackground.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
98 toolBar = Dali::Toolkit::ToolBar::New(); 102 toolBar = Dali::Toolkit::ToolBar::New();
  103 + toolBar.SetName( "TOOLBAR" );
99 toolBar.SetBackground( toolBarBackground ); 104 toolBar.SetBackground( toolBarBackground );
100 toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); 105 toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
101 toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); 106 toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
102 - toolBar.SetSize( 0.0f, style.mToolBarHeight );  
103 - toolBar.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT ); 107 + toolBar.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
104 toolBarBackground.SetSortModifier(1.0f); 108 toolBarBackground.SetSortModifier(1.0f);
105 109
106 // Add the tool bar to the too bar layer. 110 // Add the tool bar to the too bar layer.
@@ -112,7 +116,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar, @@ -112,7 +116,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar,
112 if( !title.empty() ) 116 if( !title.empty() )
113 { 117 {
114 Dali::Toolkit::TextView titleActor = Dali::Toolkit::TextView::New(); 118 Dali::Toolkit::TextView titleActor = Dali::Toolkit::TextView::New();
115 - titleActor.SetName( "ToolbarTitle" ); 119 + titleActor.SetName( "TOOLBAR_TITLE" );
116 titleActor.SetText( title ); 120 titleActor.SetText( title );
117 titleActor.SetSize( font.MeasureText( title ) ); 121 titleActor.SetSize( font.MeasureText( title ) );
118 titleActor.SetStyleToCurrentText(textStyle); 122 titleActor.SetStyleToCurrentText(textStyle);
@@ -138,14 +142,19 @@ Dali::Layer CreateView( Dali::Application&amp; application, @@ -138,14 +142,19 @@ Dali::Layer CreateView( Dali::Application&amp; application,
138 142
139 // Create default View. 143 // Create default View.
140 view = Dali::Toolkit::View::New(); 144 view = Dali::Toolkit::View::New();
  145 + view.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
141 146
142 // Add the view to the stage before setting the background. 147 // Add the view to the stage before setting the background.
143 stage.Add( view ); 148 stage.Add( view );
144 149
145 - // Set background image.  
146 - if ( ! backgroundImagePath.empty() ) 150 + // Set background image, loading it at screen resolution:
  151 + if ( !backgroundImagePath.empty() )
147 { 152 {
148 - Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath ); 153 + Dali::ImageAttributes backgroundAttributes;
  154 + backgroundAttributes.SetSize( stage.GetSize() );
  155 + backgroundAttributes.SetFilterMode( Dali::ImageAttributes::BoxThenLinear );
  156 + backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ScaleToFill );
  157 + Dali::Image backgroundImage = Dali::ResourceImage::New( backgroundImagePath, backgroundAttributes );
149 Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage ); 158 Dali::ImageActor backgroundImageActor = Dali::ImageActor::New( backgroundImage );
150 view.SetBackground( backgroundImageActor ); 159 view.SetBackground( backgroundImageActor );
151 } 160 }
@@ -160,13 +169,11 @@ Dali::Layer CreateView( Dali::Application&amp; application, @@ -160,13 +169,11 @@ Dali::Layer CreateView( Dali::Application&amp; application,
160 // Add tool bar layer to the view. 169 // Add tool bar layer to the view.
161 view.AddContentLayer( toolBarLayer ); 170 view.AddContentLayer( toolBarLayer );
162 171
163 -  
164 -  
165 // Create a content layer. 172 // Create a content layer.
166 Dali::Layer contentLayer = Dali::Layer::New(); 173 Dali::Layer contentLayer = Dali::Layer::New();
167 contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER ); 174 contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER );
168 contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER ); 175 contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER );
169 - contentLayer.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT ); 176 + contentLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
170 view.AddContentLayer( contentLayer ); 177 view.AddContentLayer( contentLayer );
171 contentLayer.LowerBelow( toolBarLayer ); 178 contentLayer.LowerBelow( toolBarLayer );
172 179