Commit 6ebeb6405d0302f5aba076aa63d650b91c2b8fd9

Authored by Paul Wisbey
2 parents 328d390c 1d5b074a

Merge remote-tracking branch 'origin/tizen' into new_text

Conflicts:
	demo/dali-demo.cpp
	demo/dali-table-view.cpp
	examples/builder/examples.cpp
	examples/buttons/buttons-example.cpp
	examples/item-view/item-view-example.cpp
	examples/path-animation/path-animation.cpp
	examples/text-view/text-view-example.cpp
	shared/view.h

Change-Id: I152b06854b349f0430172227f1d79ee16855fbc0
Showing 49 changed files with 2073 additions and 1688 deletions
com.samsung.dali-demo.xml
@@ -52,6 +52,9 @@ @@ -52,6 +52,9 @@
52 <ui-application appid="refraction-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/refraction-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 52 <ui-application appid="refraction-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/refraction-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
53 <label>Refraction effect</label> 53 <label>Refraction effect</label>
54 </ui-application> 54 </ui-application>
  55 + <ui-application appid="scripting.example" exec="/usr/apps/com.samsung.dali-demo/bin/scripting.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
  56 + <label>Scroll View</label>
  57 + </ui-application>
55 <ui-application appid="scroll-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/scroll-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 58 <ui-application appid="scroll-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/scroll-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
56 <label>Scroll View</label> 59 <label>Scroll View</label>
57 </ui-application> 60 </ui-application>
@@ -68,7 +71,7 @@ @@ -68,7 +71,7 @@
68 <label>Image Scaling Modes</label> 71 <label>Image Scaling Modes</label>
69 </ui-application> 72 </ui-application>
70 <ui-application appid="buttons.example" exec="/usr/apps/com.samsung.dali-demo/bin/buttons.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 73 <ui-application appid="buttons.example" exec="/usr/apps/com.samsung.dali-demo/bin/buttons.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
71 - <label>Radio Buttons</label> 74 + <label>Buttons</label>
72 </ui-application> 75 </ui-application>
73 <ui-application appid="text-label.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-label.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 76 <ui-application appid="text-label.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-label.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
74 <label>Text Label</label> 77 <label>Text Label</label>
@@ -94,4 +97,7 @@ @@ -94,4 +97,7 @@
94 <ui-application appid="atlas.example" exec="/usr/apps/com.samsung.dali-demo/bin/atlas.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> 97 <ui-application appid="atlas.example" exec="/usr/apps/com.samsung.dali-demo/bin/atlas.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
95 <label>Atlas</label> 98 <label>Atlas</label>
96 </ui-application> 99 </ui-application>
  100 + <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">
  101 + <label>Size Negotiation</label>
  102 + </ui-application>
97 </manifest> 103 </manifest>
demo/dali-demo.cpp
@@ -50,13 +50,16 @@ int main(int argc, char **argv) @@ -50,13 +50,16 @@ int main(int argc, char **argv)
50 demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION)); 50 demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION));
51 demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); 51 demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW));
52 demo.AddExample(Example("shadow-bone-lighting.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS)); 52 demo.AddExample(Example("shadow-bone-lighting.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS));
53 - demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI)); 53 +// demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI));
54 demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING)); 54 demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING));
55 demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL)); 55 demo.AddExample(Example("text-label.example", DALI_DEMO_STR_TITLE_TEXT_LABEL));
56 demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE)); 56 demo.AddExample(Example("text-label-multi-language.example", DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE));
57 demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT)); 57 demo.AddExample(Example("text-label-emojis.example", DALI_DEMO_STR_TITLE_EMOJI_TEXT));
58 demo.AddExample(Example("animated-shapes.example", DALI_DEMO_STR_TITLE_ANIMATED_SHAPES)); 58 demo.AddExample(Example("animated-shapes.example", DALI_DEMO_STR_TITLE_ANIMATED_SHAPES));
59 demo.AddExample(Example("path-animation.example", DALI_DEMO_STR_TITLE_PATH_ANIMATION)); 59 demo.AddExample(Example("path-animation.example", DALI_DEMO_STR_TITLE_PATH_ANIMATION));
  60 + demo.AddExample(Example("size-negotiation.example", "Size Negotiation"));
  61 +
  62 + demo.SortAlphabetically( true );
60 63
61 // Start the event loop 64 // Start the event loop
62 app.MainLoop(); 65 app.MainLoop();
demo/dali-table-view.cpp
@@ -56,10 +56,10 @@ const int MAX_PAGES = 256; ///&lt; Maximum pag @@ -56,10 +56,10 @@ const int MAX_PAGES = 256; ///&lt; Maximum pag
56 const int EXAMPLES_PER_ROW = 3; 56 const int EXAMPLES_PER_ROW = 3;
57 const int ROWS_PER_PAGE = 3; 57 const int ROWS_PER_PAGE = 3;
58 const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE; 58 const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE;
59 -const float LOGO_MARGIN_RATIO = 0.5f / 0.9f; 59 +const float LOGO_MARGIN_RATIO = 0.1f / 0.3f;
60 const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f; 60 const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f;
61 const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< ScrollView's relative size to its parent 61 const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f ); ///< ScrollView's relative size to its parent
62 -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. 62 +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.
63 const float STENCIL_RELATIVE_SIZE = 1.0f; 63 const float STENCIL_RELATIVE_SIZE = 1.0f;
64 64
65 const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects 65 const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects
@@ -76,7 +76,6 @@ const float SCALE_SPEED_SIN = 0.1f; @@ -76,7 +76,6 @@ const float SCALE_SPEED_SIN = 0.1f;
76 const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs 76 const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs
77 77
78 const float BACKGROUND_Z = -1.0f; 78 const float BACKGROUND_Z = -1.0f;
79 -const float BACKGROUND_SIZE_SCALE = 1.0f;  
80 const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f ); 79 const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f );
81 80
82 const float BUBBLE_MIN_Z = -1.0; 81 const float BUBBLE_MIN_Z = -1.0;
@@ -104,10 +103,11 @@ ImageActor CreateBackground( std::string imagePath ) @@ -104,10 +103,11 @@ ImageActor CreateBackground( std::string imagePath )
104 { 103 {
105 Image image = ResourceImage::New( imagePath ); 104 Image image = ResourceImage::New( imagePath );
106 ImageActor background = ImageActor::New( image ); 105 ImageActor background = ImageActor::New( image );
107 - 106 + background.SetName( "BACKGROUND" );
108 background.SetAnchorPoint( AnchorPoint::CENTER ); 107 background.SetAnchorPoint( AnchorPoint::CENTER );
109 background.SetParentOrigin( ParentOrigin::CENTER ); 108 background.SetParentOrigin( ParentOrigin::CENTER );
110 background.SetZ( -1.0f ); 109 background.SetZ( -1.0f );
  110 + background.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
111 111
112 return background; 112 return background;
113 } 113 }
@@ -119,7 +119,7 @@ const float IMAGE_BORDER_TOP = IMAGE_BORDER_LEFT; @@ -119,7 +119,7 @@ const float IMAGE_BORDER_TOP = IMAGE_BORDER_LEFT;
119 const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT; 119 const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT;
120 120
121 /** 121 /**
122 - * Constraint to return a position for a bubble based on the scroll value and vertical wrapping. 122 + * Constraint to return a position for a bubble based on the scroll value and vertical wrapping
123 */ 123 */
124 struct AnimateBubbleConstraint 124 struct AnimateBubbleConstraint
125 { 125 {
@@ -134,15 +134,15 @@ public: @@ -134,15 +134,15 @@ public:
134 Vector3 operator()( const Vector3& current, const PropertyInput& scrollProperty, const PropertyInput& parentSize ) 134 Vector3 operator()( const Vector3& current, const PropertyInput& scrollProperty, const PropertyInput& parentSize )
135 { 135 {
136 Vector3 pos( current ); 136 Vector3 pos( current );
  137 + const float parentHeight = parentSize.GetVector3().height;
137 138
138 - // Wrap bubbles verically.  
139 - if( pos.y + mShapeSize * 0.5f < -parentSize.GetVector3().y * 0.5f ) 139 + // Wrap bubbles vertically
  140 + if( pos.y + mShapeSize * 0.5f < -parentHeight * 0.5f )
140 { 141 {
141 - pos.y += parentSize.GetVector3().y + mShapeSize; 142 + pos.y = parentHeight * 0.5f + mShapeSize * 0.5f;
142 } 143 }
143 144
144 - // Bubbles X position moves parallax to horizontal  
145 - // panning by a scale factor unique to each bubble. 145 + // Bubbles X position moves parallax to horizontal panning by a scale factor unique to each bubble
146 pos.x = mInitialX + ( scrollProperty.GetVector3().x * mScale ); 146 pos.x = mInitialX + ( scrollProperty.GetVector3().x * mScale );
147 return pos; 147 return pos;
148 } 148 }
@@ -166,7 +166,6 @@ DaliTableView::DaliTableView( Application&amp; application ) @@ -166,7 +166,6 @@ DaliTableView::DaliTableView( Application&amp; application )
166 mRootActor(), 166 mRootActor(),
167 mRotateAnimation(), 167 mRotateAnimation(),
168 mBackground(), 168 mBackground(),
169 - mLogo(),  
170 mPressedAnimation(), 169 mPressedAnimation(),
171 mScrollViewLayer(), 170 mScrollViewLayer(),
172 mScrollView(), 171 mScrollView(),
@@ -226,15 +225,14 @@ void DaliTableView::Initialize( Application&amp; application ) @@ -226,15 +225,14 @@ void DaliTableView::Initialize( Application&amp; application )
226 const Vector2 stageSize = Stage::GetCurrent().GetSize(); 225 const Vector2 stageSize = Stage::GetCurrent().GetSize();
227 226
228 // Background 227 // Background
229 - mBackground = CreateBackground( mBackgroundImagePath );  
230 - // set same size as parent actor  
231 - mBackground.SetSize( stageSize );  
232 - Stage::GetCurrent().Add( mBackground ); 228 + Actor background = CreateBackground( mBackgroundImagePath );
  229 + Stage::GetCurrent().Add( background );
233 230
234 // Render entire content as overlays, as is all on same 2D plane. 231 // Render entire content as overlays, as is all on same 2D plane.
235 mRootActor = TableView::New( 4, 1 ); 232 mRootActor = TableView::New( 4, 1 );
236 mRootActor.SetAnchorPoint( AnchorPoint::CENTER ); 233 mRootActor.SetAnchorPoint( AnchorPoint::CENTER );
237 mRootActor.SetParentOrigin( ParentOrigin::CENTER ); 234 mRootActor.SetParentOrigin( ParentOrigin::CENTER );
  235 + mRootActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
238 Stage::GetCurrent().Add( mRootActor ); 236 Stage::GetCurrent().Add( mRootActor );
239 237
240 // Toolbar at top 238 // Toolbar at top
@@ -245,37 +243,42 @@ void DaliTableView::Initialize( Application&amp; application ) @@ -245,37 +243,42 @@ void DaliTableView::Initialize( Application&amp; application )
245 DemoHelper::DEFAULT_VIEW_STYLE); 243 DemoHelper::DEFAULT_VIEW_STYLE);
246 244
247 mRootActor.AddChild( toolBarLayer, TableView::CellPosition( 0, 0 ) ); 245 mRootActor.AddChild( toolBarLayer, TableView::CellPosition( 0, 0 ) );
248 - const float toolbarHeight = DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight;  
249 - mRootActor.SetFixedHeight( 0, toolbarHeight ); 246 + mRootActor.SetFitHeight( 0 );
250 247
251 // Add logo 248 // Add logo
252 - mLogo = CreateLogo( LOGO_PATH ); 249 + Dali::ImageActor logo = CreateLogo( LOGO_PATH );
  250 + logo.SetName( "LOGO_IMAGE" );
  251 + logo.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
253 const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y ); 252 const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y );
254 const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO; 253 const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO;
255 - const float logoHeight = mLogo.GetImage().GetHeight() + logoMargin;  
256 - mRootActor.SetFixedHeight( 1, logoHeight );  
257 254
258 // Show version in a popup when log is tapped 255 // Show version in a popup when log is tapped
259 mLogoTapDetector = TapGestureDetector::New(); 256 mLogoTapDetector = TapGestureDetector::New();
260 - mLogoTapDetector.Attach( mLogo ); 257 + mLogoTapDetector.Attach( logo );
261 mLogoTapDetector.DetectedSignal().Connect( this, &DaliTableView::OnLogoTapped ); 258 mLogoTapDetector.DetectedSignal().Connect( this, &DaliTableView::OnLogoTapped );
262 259
263 const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO; 260 const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO;
264 - mButtonsPageRelativeSize = Vector3( TABLE_RELATIVE_SIZE.x, 1.f - ( toolbarHeight + logoHeight + bottomMargin) / stageSize.height, TABLE_RELATIVE_SIZE.z );  
265 - mRootActor.SetFixedHeight( 2, mButtonsPageRelativeSize.y * stageSize.height );  
266 261
267 Alignment alignment = Alignment::New(); 262 Alignment alignment = Alignment::New();
268 - alignment.Add(mLogo); 263 + alignment.SetName( "LOGO_ALIGNMENT" );
  264 + alignment.Add( logo );
  265 + alignment.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  266 + alignment.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  267 + Actor alignmentActor = alignment;
  268 + alignmentActor.SetPadding( Padding( 0.0f, 0.0f, logoMargin, logoMargin ));
269 mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) ); 269 mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) );
  270 + mRootActor.SetFitHeight( 1 );
270 271
271 // scrollview occupying the majority of the screen 272 // scrollview occupying the majority of the screen
272 mScrollView = ScrollView::New(); 273 mScrollView = ScrollView::New();
  274 + mScrollView.SetRelayoutEnabled( true );
273 275
274 mScrollView.SetAnchorPoint( AnchorPoint::CENTER ); 276 mScrollView.SetAnchorPoint( AnchorPoint::CENTER );
275 mScrollView.SetParentOrigin( ParentOrigin::CENTER ); 277 mScrollView.SetParentOrigin( ParentOrigin::CENTER );
276 - // Note: Currently, changing mScrollView to use SizeMode RELATIVE_TO_PARENT  
277 - // will cause scroll ends to appear in the wrong position.  
278 - mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) ); 278 + mScrollView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  279 + const float buttonsPageMargin = ( 1.0f - TABLE_RELATIVE_SIZE.x ) * 0.5f * stageSize.width;
  280 + mScrollView.SetPadding( Padding( buttonsPageMargin, buttonsPageMargin, 0.0f, 0.0f ) );
  281 +
279 mScrollView.SetAxisAutoLock( true ); 282 mScrollView.SetAxisAutoLock( true );
280 mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete ); 283 mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete );
281 mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart ); 284 mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart );
@@ -285,12 +288,37 @@ void DaliTableView::Initialize( Application&amp; application ) @@ -285,12 +288,37 @@ void DaliTableView::Initialize( Application&amp; application )
285 mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER ); 288 mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER );
286 mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER ); 289 mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER );
287 mScrollViewLayer.SetDrawMode( DrawMode::OVERLAY ); 290 mScrollViewLayer.SetDrawMode( DrawMode::OVERLAY );
  291 + mScrollViewLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  292 +
  293 + // Create solid background colour.
  294 + ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR );
  295 + backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER );
  296 + backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER );
  297 + backgroundColourActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  298 + backgroundColourActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  299 + backgroundColourActor.SetSizeModeFactor( Vector3( 1.0f, 1.5f, 1.0f ) );
  300 + backgroundColourActor.SetZ( BACKGROUND_Z );
  301 + mScrollViewLayer.Add( backgroundColourActor );
288 302
289 // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show 303 // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show
290 - SetupBackground( mScrollView, mScrollViewLayer, stageSize ); 304 + Actor bubbleContainer = Actor::New();
  305 + bubbleContainer.SetRelayoutEnabled( true );
  306 + bubbleContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  307 + bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER );
  308 + bubbleContainer.SetParentOrigin( ParentOrigin::CENTER );
  309 + mScrollViewLayer.Add( bubbleContainer );
  310 +
  311 + SetupBackground( bubbleContainer );
  312 +
  313 + Alignment buttonsAlignment = Alignment::New();
  314 + buttonsAlignment.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  315 + buttonsAlignment.Add( mScrollViewLayer );
291 316
292 mScrollViewLayer.Add( mScrollView ); 317 mScrollViewLayer.Add( mScrollView );
293 - mRootActor.AddChild( mScrollViewLayer, TableView::CellPosition( 2, 0 ) ); 318 +
  319 + mRootActor.AddChild( buttonsAlignment, TableView::CellPosition( 2, 0 ) );
  320 +
  321 + mRootActor.SetFixedHeight( 3, bottomMargin );
294 322
295 // Add scroll view effect and setup constraints on pages 323 // Add scroll view effect and setup constraints on pages
296 ApplyScrollViewEffect(); 324 ApplyScrollViewEffect();
@@ -316,7 +344,7 @@ void DaliTableView::Initialize( Application&amp; application ) @@ -316,7 +344,7 @@ void DaliTableView::Initialize( Application&amp; application )
316 344
317 winHandle.ShowIndicator( Dali::Window::INVISIBLE ); 345 winHandle.ShowIndicator( Dali::Window::INVISIBLE );
318 346
319 - // 347 + // Background animation
320 mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION ); 348 mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION );
321 mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation ); 349 mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation );
322 mAnimationTimer.Start(); 350 mAnimationTimer.Start();
@@ -332,12 +360,10 @@ void DaliTableView::ApplyCubeEffectToActors() @@ -332,12 +360,10 @@ void DaliTableView::ApplyCubeEffectToActors()
332 { 360 {
333 Actor page = *pageIter; 361 Actor page = *pageIter;
334 362
335 - unsigned int numChildren = page.GetChildCount();  
336 - Actor pageActor = page;  
337 - for( unsigned int i=0; i<numChildren; ++i) 363 + for( unsigned int i = 0, numChildren = page.GetChildCount(); i < numChildren; ++i)
338 { 364 {
339 // Remove old effect's manual constraints. 365 // Remove old effect's manual constraints.
340 - Actor child = pageActor.GetChildAt(i); 366 + Actor child = page.GetChildAt(i);
341 if( child ) 367 if( child )
342 { 368 {
343 ApplyCubeEffectToActor( child ); 369 ApplyCubeEffectToActor( child );
@@ -345,6 +371,12 @@ void DaliTableView::ApplyCubeEffectToActors() @@ -345,6 +371,12 @@ void DaliTableView::ApplyCubeEffectToActors()
345 } 371 }
346 } 372 }
347 } 373 }
  374 +
  375 +void DaliTableView::OnButtonsPageRelayout( const Dali::Actor& actor )
  376 +{
  377 +
  378 +}
  379 +
348 void DaliTableView::Populate() 380 void DaliTableView::Populate()
349 { 381 {
350 const Vector2 stageSize = Stage::GetCurrent().GetSize(); 382 const Vector2 stageSize = Stage::GetCurrent().GetSize();
@@ -365,20 +397,15 @@ void DaliTableView::Populate() @@ -365,20 +397,15 @@ void DaliTableView::Populate()
365 for( int t = 0; t < mTotalPages; t++ ) 397 for( int t = 0; t < mTotalPages; t++ )
366 { 398 {
367 // Create Table. (contains up to 9 Examples) 399 // Create Table. (contains up to 9 Examples)
368 - Actor page = Actor::New();  
369 -  
370 - // Add tableView to container.  
371 - mScrollView.Add( page );  
372 - 400 + TableView page = TableView::New( 3, 3 );
373 page.SetAnchorPoint( AnchorPoint::CENTER ); 401 page.SetAnchorPoint( AnchorPoint::CENTER );
374 page.SetParentOrigin( ParentOrigin::CENTER ); 402 page.SetParentOrigin( ParentOrigin::CENTER );
375 - page.SetSizeMode( SIZE_EQUAL_TO_PARENT );  
376 -  
377 - // add cells to table  
378 - const float margin = 4.0f; 403 + page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  404 + mScrollView.Add( page );
379 405
380 // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi. 406 // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi.
381 - const Size tileSize((stageSize.x * mButtonsPageRelativeSize.x / EXAMPLES_PER_ROW) - margin, (stageSize.y * mButtonsPageRelativeSize.y / ROWS_PER_PAGE) - margin ); 407 + const float margin = 2.0f;
  408 + const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW;
382 409
383 for(int row = 0; row < ROWS_PER_PAGE; row++) 410 for(int row = 0; row < ROWS_PER_PAGE; row++)
384 { 411 {
@@ -386,7 +413,7 @@ void DaliTableView::Populate() @@ -386,7 +413,7 @@ void DaliTableView::Populate()
386 { 413 {
387 const Example& example = ( *iter ); 414 const Example& example = ( *iter );
388 415
389 - Actor tile = CreateTile( example.name, example.title, tileSize, true ); 416 + Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), true );
390 FocusManager focusManager = FocusManager::Get(); 417 FocusManager focusManager = FocusManager::Get();
391 focusManager.SetFocusOrder( tile, ++exampleCount ); 418 focusManager.SetFocusOrder( tile, ++exampleCount );
392 focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL, 419 focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL,
@@ -395,12 +422,9 @@ void DaliTableView::Populate() @@ -395,12 +422,9 @@ void DaliTableView::Populate()
395 focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT, 422 focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT,
396 "You can run this example" ); 423 "You can run this example" );
397 424
398 - Vector3 position( margin * 0.5f + (tileSize.x + margin) * column - stageSize.width * mButtonsPageRelativeSize.x * 0.5f,  
399 - margin * 0.5f + (tileSize.y + margin) * row - stageSize.height * mButtonsPageRelativeSize.y * 0.5f,  
400 - 0.0f);  
401 - tile.SetPosition( position + Vector3( tileSize.x, tileSize.y, 0.0f ) * 0.5f );  
402 - tile.SetSize( tileSize );  
403 - page.Add( tile ); 425 + tile.SetPadding( Padding( margin, margin, margin, margin ) );
  426 +
  427 + page.AddChild( tile, TableView::CellPosition( row, column ) );
404 428
405 iter++; 429 iter++;
406 430
@@ -417,7 +441,7 @@ void DaliTableView::Populate() @@ -417,7 +441,7 @@ void DaliTableView::Populate()
417 } 441 }
418 442
419 // Set tableview position 443 // Set tableview position
420 - Vector3 pagePos( stageSize.x * mButtonsPageRelativeSize.x * t, 0.0f, 0.0f ); 444 + Vector3 pagePos( stageSize.width * TABLE_RELATIVE_SIZE.x * t, 0.0f, 0.0f );
421 page.SetPosition( pagePos ); 445 page.SetPosition( pagePos );
422 446
423 mPages.push_back( page ); 447 mPages.push_back( page );
@@ -430,9 +454,9 @@ void DaliTableView::Populate() @@ -430,9 +454,9 @@ void DaliTableView::Populate()
430 } 454 }
431 455
432 // Update Ruler info. 456 // Update Ruler info.
433 - mScrollRulerX = new FixedRuler( stageSize.width * mButtonsPageRelativeSize.x ); 457 + mScrollRulerX = new FixedRuler( stageSize.width * TABLE_RELATIVE_SIZE.x );
434 mScrollRulerY = new DefaultRuler(); 458 mScrollRulerY = new DefaultRuler();
435 - mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * mButtonsPageRelativeSize.x, true ) ); 459 + mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * TABLE_RELATIVE_SIZE.x, true ) );
436 mScrollRulerY->Disable(); 460 mScrollRulerY->Disable();
437 mScrollView.SetRulerX( mScrollRulerX ); 461 mScrollView.SetRulerX( mScrollRulerX );
438 mScrollView.SetRulerY( mScrollRulerY ); 462 mScrollView.SetRulerY( mScrollRulerY );
@@ -466,12 +490,16 @@ void DaliTableView::Rotate( unsigned int degrees ) @@ -466,12 +490,16 @@ void DaliTableView::Rotate( unsigned int degrees )
466 mRotateAnimation.Play(); 490 mRotateAnimation.Play();
467 } 491 }
468 492
469 -Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Size& parentSize, bool addBackground ) 493 +Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, bool addBackground )
470 { 494 {
471 - Actor tile = Actor::New();  
472 - tile.SetName( name );  
473 - tile.SetAnchorPoint( AnchorPoint::CENTER );  
474 - tile.SetParentOrigin( ParentOrigin::CENTER ); 495 + Actor content = Actor::New();
  496 + content.SetName( name );
  497 + content.SetAnchorPoint( AnchorPoint::CENTER );
  498 + content.SetParentOrigin( ParentOrigin::CENTER );
  499 + content.SetRelayoutEnabled( true );
  500 + content.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  501 + content.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  502 + content.SetSizeModeFactor( sizeMultiplier );
475 503
476 // create background image 504 // create background image
477 if( addBackground ) 505 if( addBackground )
@@ -481,38 +509,38 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit @@ -481,38 +509,38 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit
481 image.SetAnchorPoint( AnchorPoint::CENTER ); 509 image.SetAnchorPoint( AnchorPoint::CENTER );
482 image.SetParentOrigin( ParentOrigin::CENTER ); 510 image.SetParentOrigin( ParentOrigin::CENTER );
483 // make the image 100% of tile 511 // make the image 100% of tile
484 - image.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 512 + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  513 +
485 // move image back to get text appear in front 514 // move image back to get text appear in front
486 image.SetZ( -1 ); 515 image.SetZ( -1 );
487 image.SetStyle( ImageActor::STYLE_NINE_PATCH ); 516 image.SetStyle( ImageActor::STYLE_NINE_PATCH );
488 image.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) ); 517 image.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) );
489 - tile.Add( image ); 518 + content.Add( image );
490 519
491 // Add stencil 520 // Add stencil
492 ImageActor stencil = NewStencilImage(); 521 ImageActor stencil = NewStencilImage();
493 - stencil.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 522 + stencil.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
494 image.Add( stencil ); 523 image.Add( stencil );
495 } 524 }
496 525
497 TextLabel label = TextLabel::New(); 526 TextLabel label = TextLabel::New();
498 label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 527 label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
499 - label.SetSize( parentSize );  
500 label.SetProperty( Control::Property::STYLE_NAME, "launcherlabel" ); 528 label.SetProperty( Control::Property::STYLE_NAME, "launcherlabel" );
501 label.SetProperty( TextLabel::Property::MULTI_LINE, true ); 529 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
502 label.SetProperty( TextLabel::Property::TEXT, title ); 530 label.SetProperty( TextLabel::Property::TEXT, title );
503 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); 531 label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
504 label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); 532 label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
505 label.SetColor( TABLE_TEXT_STYLE_COLOR ); 533 label.SetColor( TABLE_TEXT_STYLE_COLOR );
506 - tile.Add( label ); 534 + content.Add( label );
507 535
508 // Set the tile to be keyboard focusable 536 // Set the tile to be keyboard focusable
509 - tile.SetKeyboardFocusable(true); 537 + content.SetKeyboardFocusable(true);
510 538
511 // connect to the touch events 539 // connect to the touch events
512 - tile.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed );  
513 - tile.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered ); 540 + content.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed );
  541 + content.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered );
514 542
515 - return tile; 543 + return content;
516 } 544 }
517 545
518 ImageActor DaliTableView::NewStencilImage() 546 ImageActor DaliTableView::NewStencilImage()
@@ -633,8 +661,6 @@ void DaliTableView::OnScrollComplete( const Dali::Vector3&amp; position ) @@ -633,8 +661,6 @@ void DaliTableView::OnScrollComplete( const Dali::Vector3&amp; position )
633 // move focus to 1st item of new page 661 // move focus to 1st item of new page
634 FocusManager focusManager = FocusManager::Get(); 662 FocusManager focusManager = FocusManager::Get();
635 focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) ); 663 focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) );
636 -  
637 - ApplyCubeEffectToActors();  
638 } 664 }
639 665
640 bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event ) 666 bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event )
@@ -700,37 +726,65 @@ void DaliTableView::OnKeyEvent( const KeyEvent&amp; event ) @@ -700,37 +726,65 @@ void DaliTableView::OnKeyEvent( const KeyEvent&amp; event )
700 } 726 }
701 } 727 }
702 728
703 -void DaliTableView::SetupBackground( Actor bubbleContainer, Actor backgroundLayer, const Vector2& size ) 729 +void DaliTableView::SetupBackground( Actor bubbleContainer )
704 { 730 {
705 // Create distance field shape. 731 // Create distance field shape.
706 BufferImage distanceField; 732 BufferImage distanceField;
707 Size imageSize( 512, 512 ); 733 Size imageSize( 512, 512 );
708 CreateShapeImage( CIRCLE, imageSize, distanceField ); 734 CreateShapeImage( CIRCLE, imageSize, distanceField );
709 735
710 - // Create solid background colour.  
711 - ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR );  
712 - backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER );  
713 - backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER );  
714 - backgroundColourActor.SetSize( size * BACKGROUND_SIZE_SCALE );  
715 - backgroundColourActor.SetZ( BACKGROUND_Z );  
716 - backgroundColourActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );  
717 - backgroundLayer.Add( backgroundColourActor );  
718 -  
719 // Add bubbles to the bubbleContainer. 736 // Add bubbles to the bubbleContainer.
720 // Note: The bubbleContainer is parented externally to this function. 737 // Note: The bubbleContainer is parented externally to this function.
721 - AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField, size ); 738 + AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField );
  739 +}
  740 +
  741 +void DaliTableView::InitialiseBackgroundActors( Actor actor )
  742 +{
  743 + // Delete current animations
  744 + mBackgroundAnimations.clear();
  745 +
  746 + // Create new animations
  747 + const Vector3 size = actor.GetTargetSize();
  748 +
  749 + for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i )
  750 + {
  751 + Actor child = actor.GetChildAt( i );
  752 +
  753 + const Vector3 childSize = child.GetTargetSize();
  754 +
  755 + // Calculate a random position
  756 + Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ),
  757 + Random::Range( -size.y * 0.5f - childSize.height, size.y * 0.5f + childSize.height ),
  758 + Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) );
  759 +
  760 + child.SetPosition( childPos );
  761 +
  762 + // Define bubble horizontal parallax and vertical wrapping
  763 + Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::POSITION,
  764 + Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),
  765 + Dali::ParentSource( Dali::Actor::Property::SIZE ),
  766 + AnimateBubbleConstraint( childPos, Random::Range( -0.85f, 0.25f ), childSize.height ) );
  767 + child.ApplyConstraint( animConstraint );
  768 +
  769 + // Kickoff animation
  770 + Animation animation = Animation::New( Random::Range( 40.0f, 80.0f ) );
  771 + animation.MoveBy( child, Vector3( 0.0f, -1.0f, 0.0f ), AlphaFunctions::Linear );
  772 + animation.SetLooping( true );
  773 + animation.Play();
  774 + mBackgroundAnimations.push_back( animation );
  775 + }
722 } 776 }
723 777
724 -void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField, const Dali::Vector2& size ) 778 +void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField )
725 { 779 {
726 for( int i = 0; i < count; ++i ) 780 for( int i = 0; i < count; ++i )
727 { 781 {
728 float randSize = Random::Range( 10.0f, 400.0f ); 782 float randSize = Random::Range( 10.0f, 400.0f );
729 float hue = Random::Range( 0.3f, 1.0f ); 783 float hue = Random::Range( 0.3f, 1.0f );
730 - Vector4 randColour( hue, hue*0.5, 0.0f, Random::Range( 0.3f, 0.6f )); 784 + Vector4 randColour( hue, hue * 0.5, 0.0f, Random::Range( 0.3f, 0.6f ));
731 785
732 ImageActor dfActor = ImageActor::New( distanceField ); 786 ImageActor dfActor = ImageActor::New( distanceField );
733 - mBackgroundActors.push_back( dfActor ); 787 + dfActor.SetRelayoutEnabled( false );
734 dfActor.SetSize( Vector2( randSize, randSize ) ); 788 dfActor.SetSize( Vector2( randSize, randSize ) );
735 dfActor.SetParentOrigin( ParentOrigin::CENTER ); 789 dfActor.SetParentOrigin( ParentOrigin::CENTER );
736 790
@@ -740,33 +794,10 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis @@ -740,33 +794,10 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis
740 effect.SetOutlineParams( Vector2( 0.55f, 0.00f ) ); 794 effect.SetOutlineParams( Vector2( 0.55f, 0.00f ) );
741 effect.SetSmoothingEdge( 0.5f ); 795 effect.SetSmoothingEdge( 0.5f );
742 layer.Add( dfActor ); 796 layer.Add( dfActor );
743 -  
744 - // Setup animation  
745 - Vector3 actorPos(  
746 - Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ),  
747 - Random::Range( -size.y * 0.5f - randSize, size.y * 0.5f + randSize ),  
748 - Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) );  
749 - dfActor.SetPosition( actorPos );  
750 -  
751 - // Define bubble horizontal parallax and vertical wrapping  
752 - Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::POSITION,  
753 - Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),  
754 - Dali::ParentSource( Dali::Actor::Property::SIZE ),  
755 - AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.25f ), randSize ) );  
756 - dfActor.ApplyConstraint( animConstraint );  
757 -  
758 - // Kickoff animation  
759 - Animation animation = Animation::New( Random::Range( 40.0f, 200.0f ) );  
760 - KeyFrames keyframes = KeyFrames::New();  
761 - keyframes.Add( 0.0f, actorPos );  
762 - Vector3 toPos( actorPos );  
763 - toPos.y -= ( size.y + randSize );  
764 - keyframes.Add( 1.0f, toPos );  
765 - animation.AnimateBetween( Property( dfActor, Actor::Property::POSITION ), keyframes );  
766 - animation.SetLooping( true );  
767 - animation.Play();  
768 - mBackgroundAnimations.push_back( animation );  
769 } 797 }
  798 +
  799 + // Positioning will occur when the layer is relaid out
  800 + layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors );
770 } 801 }
771 802
772 void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut ) 803 void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut )
@@ -839,7 +870,7 @@ ImageActor DaliTableView::CreateLogo( std::string imagePath ) @@ -839,7 +870,7 @@ ImageActor DaliTableView::CreateLogo( std::string imagePath )
839 ImageActor logo = ImageActor::New( image ); 870 ImageActor logo = ImageActor::New( image );
840 871
841 logo.SetAnchorPoint( AnchorPoint::CENTER ); 872 logo.SetAnchorPoint( AnchorPoint::CENTER );
842 - logo.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); 873 + logo.SetParentOrigin( ParentOrigin::CENTER );
843 874
844 return logo; 875 return logo;
845 } 876 }
@@ -973,14 +1004,18 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture&amp; tap @@ -973,14 +1004,18 @@ void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture&amp; tap
973 stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")"; 1004 stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")";
974 1005
975 mVersionPopup = Dali::Toolkit::Popup::New(); 1006 mVersionPopup = Dali::Toolkit::Popup::New();
976 - mVersionPopup.SetTitle( stream.str() );  
977 mVersionPopup.SetParentOrigin( ParentOrigin::CENTER ); 1007 mVersionPopup.SetParentOrigin( ParentOrigin::CENTER );
978 mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER ); 1008 mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER );
  1009 + mVersionPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1010 + mVersionPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  1011 + mVersionPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
  1012 + mVersionPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  1013 + mVersionPopup.SetTitle( stream.str() );
979 mVersionPopup.HideTail(); 1014 mVersionPopup.HideTail();
980 mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup ); 1015 mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup );
981 mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden ); 1016 mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden );
982 1017
983 - Dali::Stage::GetCurrent().Add( mVersionPopup ); 1018 + mVersionPopup.MarkDirtyForRelayout();
984 } 1019 }
985 1020
986 mVersionPopup.Show(); 1021 mVersionPopup.Show();
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
@@ -378,6 +376,20 @@ private: // Application callbacks &amp; implementation @@ -378,6 +376,20 @@ private: // Application callbacks &amp; implementation
378 */ 376 */
379 void PopupHidden(); 377 void PopupHidden();
380 378
  379 + /*
  380 + * @brief Callback called when the buttons page actor is relaid out
  381 + *
  382 + * @param[in] actor The page actor
  383 + */
  384 + void OnButtonsPageRelayout( const Dali::Actor& actor );
  385 +
  386 + /**
  387 + * @brief Callback called to set up background actors
  388 + *
  389 + * @param[in] actor The actor raising the callback
  390 + */
  391 + void InitialiseBackgroundActors( Dali::Actor actor );
  392 +
381 private: 393 private:
382 394
383 Dali::Application& mApplication; ///< Application instance. 395 Dali::Application& mApplication; ///< Application instance.
@@ -385,7 +397,6 @@ private: @@ -385,7 +397,6 @@ private:
385 Dali::Toolkit::TableView mRootActor; ///< All content (excluding background is anchored to this Actor) 397 Dali::Toolkit::TableView mRootActor; ///< All content (excluding background is anchored to this Actor)
386 Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor. 398 Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor.
387 Dali::ImageActor mBackground; ///< Background's static image. 399 Dali::ImageActor mBackground; ///< Background's static image.
388 - Dali::ImageActor mLogo; ///< Logo's static image.  
389 Dali::Animation mPressedAnimation; ///< Button press scaling animation. 400 Dali::Animation mPressedAnimation; ///< Button press scaling animation.
390 Dali::Layer mScrollViewLayer; ///< ScrollView resides on a separate layer. 401 Dali::Layer mScrollViewLayer; ///< ScrollView resides on a separate layer.
391 Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples) 402 Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples)
@@ -413,6 +424,7 @@ private: @@ -413,6 +424,7 @@ private:
413 bool mSortAlphabetically:1; ///< Sort examples alphabetically. 424 bool mSortAlphabetically:1; ///< Sort examples alphabetically.
414 bool mBackgroundAnimsPlaying:1; ///< Are background animations playing 425 bool mBackgroundAnimsPlaying:1; ///< Are background animations playing
415 bool mVersionPopupShown:1; ///< Whehter the version popup is shown or not 426 bool mVersionPopupShown:1; ///< Whehter the version popup is shown or not
  427 +
416 }; 428 };
417 429
418 #endif // __DALI_DEMO_H__ 430 #endif // __DALI_DEMO_H__
examples/animated-shapes/animated-shapes-example.cpp
@@ -52,6 +52,7 @@ public: @@ -52,6 +52,7 @@ public:
52 52
53 //Create a view 53 //Create a view
54 mView = Dali::Toolkit::View::New(); 54 mView = Dali::Toolkit::View::New();
  55 + mView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
55 stage.Add( mView ); 56 stage.Add( mView );
56 57
57 //Set background image for the view 58 //Set background image for the view
examples/blocks/blocks-example.cpp
@@ -421,7 +421,8 @@ private: @@ -421,7 +421,8 @@ private:
421 mLevelContainer = Actor::New(); 421 mLevelContainer = Actor::New();
422 mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER ); 422 mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER );
423 mLevelContainer.SetParentOrigin( ParentOrigin::CENTER ); 423 mLevelContainer.SetParentOrigin( ParentOrigin::CENTER );
424 - mLevelContainer.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 424 + mLevelContainer.SetRelayoutEnabled( true );
  425 + mLevelContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
425 mContentLayer.Add( mLevelContainer ); 426 mContentLayer.Add( mLevelContainer );
426 427
427 mBrickCount = 0; 428 mBrickCount = 0;
@@ -593,6 +594,7 @@ private: @@ -593,6 +594,7 @@ private:
593 ImageActor brick = ImageActor::New(img); 594 ImageActor brick = ImageActor::New(img);
594 brick.SetParentOrigin(ParentOrigin::TOP_LEFT); 595 brick.SetParentOrigin(ParentOrigin::TOP_LEFT);
595 brick.SetAnchorPoint(AnchorPoint::CENTER); 596 brick.SetAnchorPoint(AnchorPoint::CENTER);
  597 + brick.SetRelayoutEnabled( false );
596 brick.SetSize( brickSize ); 598 brick.SetSize( brickSize );
597 brick.SetPosition( Vector3( position ) ); 599 brick.SetPosition( Vector3( position ) );
598 600
@@ -625,6 +627,7 @@ private: @@ -625,6 +627,7 @@ private:
625 ImageActor actor = ImageActor::New(img); 627 ImageActor actor = ImageActor::New(img);
626 actor.SetParentOrigin(ParentOrigin::TOP_LEFT); 628 actor.SetParentOrigin(ParentOrigin::TOP_LEFT);
627 actor.SetAnchorPoint(AnchorPoint::CENTER); 629 actor.SetAnchorPoint(AnchorPoint::CENTER);
  630 + actor.SetRelayoutEnabled( false );
628 return actor; 631 return actor;
629 } 632 }
630 633
examples/builder/examples.cpp
@@ -280,6 +280,7 @@ public: @@ -280,6 +280,7 @@ public:
280 mFiles.clear(); 280 mFiles.clear();
281 281
282 mItemView = ItemView::New(*this); 282 mItemView = ItemView::New(*this);
  283 + mItemView.SetRelayoutEnabled( false );
283 stage.Add( mItemView ); 284 stage.Add( mItemView );
284 mItemView.SetParentOrigin(ParentOrigin::CENTER); 285 mItemView.SetParentOrigin(ParentOrigin::CENTER);
285 mItemView.SetAnchorPoint(AnchorPoint::CENTER); 286 mItemView.SetAnchorPoint(AnchorPoint::CENTER);
@@ -455,6 +456,8 @@ public: @@ -455,6 +456,8 @@ public:
455 456
456 builder.AddActors( layer ); 457 builder.AddActors( layer );
457 458
  459 + // Force relayout on layer
  460 + layer.RelayoutRequestTree();
458 } 461 }
459 462
460 463
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,12 +235,14 @@ class ButtonsController: public ConnectionTracker @@ -232,12 +235,14 @@ 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 ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) ); 241 ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) );
238 - imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); 242 + imageActor.SetPreferredSize( Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) );
  243 + imageActor.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  244 + imageActor.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) );
239 tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) ); 245 tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) );
240 - tableView.SetFixedWidth( 1, DP(RADIO_LABEL_THUMBNAIL_SIZE) );  
241 246
242 Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( tableView ); 247 Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( tableView );
243 radioButton.SetName( "radio-select-enable" ); 248 radioButton.SetName( "radio-select-enable" );
@@ -271,7 +276,8 @@ class ButtonsController: public ConnectionTracker @@ -271,7 +276,8 @@ class ButtonsController: public ConnectionTracker
271 checkBoxBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 276 checkBoxBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT );
272 checkBoxBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); 277 checkBoxBackground.SetParentOrigin( ParentOrigin::TOP_LEFT );
273 checkBoxBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); 278 checkBoxBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
274 - checkBoxBackground.SetSize( DP(430), DP(GROUP3_HEIGHT) ); 279 + checkBoxBackground.SetRelayoutEnabled( true );
  280 + checkBoxBackground.SetPreferredSize( Vector2( DP(430), DP(GROUP3_HEIGHT) ) );
275 mContentLayer.Add( checkBoxBackground ); 281 mContentLayer.Add( checkBoxBackground );
276 282
277 Dali::Image unselected = Dali::ResourceImage::New( CHECKBOX_UNSELECTED_IMAGE ); 283 Dali::Image unselected = Dali::ResourceImage::New( CHECKBOX_UNSELECTED_IMAGE );
@@ -331,7 +337,8 @@ class ButtonsController: public ConnectionTracker @@ -331,7 +337,8 @@ class ButtonsController: public ConnectionTracker
331 toggleBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 337 toggleBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT );
332 toggleBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); 338 toggleBackground.SetParentOrigin( ParentOrigin::TOP_LEFT );
333 toggleBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) ); 339 toggleBackground.SetPosition( DP(MARGIN_SIZE), DP(yPos) );
334 - toggleBackground.SetSize( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) ); 340 + toggleBackground.SetRelayoutEnabled( true );
  341 + toggleBackground.SetPreferredSize( Vector2( DP(150 + MARGIN_SIZE * 2), DP(GROUP4_HEIGHT) ) );
335 mContentLayer.Add( toggleBackground ); 342 mContentLayer.Add( toggleBackground );
336 343
337 Toolkit::PushButton toggleButton = Toolkit::PushButton::New(); 344 Toolkit::PushButton toggleButton = Toolkit::PushButton::New();
@@ -340,7 +347,7 @@ class ButtonsController: public ConnectionTracker @@ -340,7 +347,7 @@ class ButtonsController: public ConnectionTracker
340 toggleButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 347 toggleButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
341 toggleButton.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) ); 348 toggleButton.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
342 toggleButton.SetLabel( "Unselected" ); 349 toggleButton.SetLabel( "Unselected" );
343 - toggleButton.SetSize( DP(150), DP(BUTTON_HEIGHT) ); 350 + toggleButton.SetPreferredSize( Vector2( DP(150), DP(BUTTON_HEIGHT) ) );
344 351
345 toggleButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) ); 352 toggleButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
346 toggleButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) ); 353 toggleButton.SetDisabledImage( Dali::ResourceImage::New( PUSHBUTTON_DISABLED_IMAGE ) );
examples/cluster/cluster-example.cpp
@@ -477,6 +477,7 @@ public: @@ -477,6 +477,7 @@ public:
477 477
478 // create and setup the scroll view... 478 // create and setup the scroll view...
479 mScrollView = ScrollView::New(); 479 mScrollView = ScrollView::New();
  480 + mScrollView.SetRelayoutEnabled( false );
480 mScrollView.SetSize(stageSize); 481 mScrollView.SetSize(stageSize);
481 482
482 // attach Wobble Effect to ScrollView 483 // attach Wobble Effect to ScrollView
@@ -488,7 +489,8 @@ public: @@ -488,7 +489,8 @@ public:
488 mScrollView.SetParentOrigin(ParentOrigin::CENTER); 489 mScrollView.SetParentOrigin(ParentOrigin::CENTER);
489 490
490 // Scale ScrollView to fit parent (mContentLayer) 491 // Scale ScrollView to fit parent (mContentLayer)
491 - mScrollView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 492 + mScrollView.SetRelayoutEnabled( true );
  493 + mScrollView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
492 494
493 // Add the scroll view to the content layer 495 // Add the scroll view to the content layer
494 mContentLayer.Add(mScrollView); 496 mContentLayer.Add(mScrollView);
@@ -515,6 +517,7 @@ public: @@ -515,6 +517,7 @@ public:
515 Cluster clusterActor = Cluster::New(style); 517 Cluster clusterActor = Cluster::New(style);
516 clusterActor.SetParentOrigin(ParentOrigin::CENTER); 518 clusterActor.SetParentOrigin(ParentOrigin::CENTER);
517 clusterActor.SetAnchorPoint(AnchorPoint::CENTER); 519 clusterActor.SetAnchorPoint(AnchorPoint::CENTER);
  520 + clusterActor.SetRelayoutEnabled( false );
518 521
519 Vector2 stageSize = Dali::Stage::GetCurrent().GetSize(); 522 Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
520 float minStageDimension = std::min(stageSize.x, stageSize.y); 523 float minStageDimension = std::min(stageSize.x, stageSize.y);
@@ -533,6 +536,7 @@ public: @@ -533,6 +536,7 @@ public:
533 backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ShrinkToFit ); 536 backgroundAttributes.SetScalingMode( Dali::ImageAttributes::ShrinkToFit );
534 Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH ); 537 Image bg = ResourceImage::New( CLUSTER_BACKGROUND_IMAGE_PATH );
535 ImageActor image = ImageActor::New(bg); 538 ImageActor image = ImageActor::New(bg);
  539 + image.SetRelayoutEnabled( false );
536 clusterActor.SetBackgroundImage(image); 540 clusterActor.SetBackgroundImage(image);
537 541
538 // Add actors (pictures) as the children of the cluster 542 // Add actors (pictures) as the children of the cluster
@@ -576,6 +580,7 @@ public: @@ -576,6 +580,7 @@ public:
576 shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f)); 580 shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f));
577 581
578 // Apply size-relative mode to auto-size the image shadow 582 // Apply size-relative mode to auto-size the image shadow
  583 + shadowActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
579 shadowActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); 584 shadowActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
580 shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE ); 585 shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE );
581 actor.Add( shadowActor ); 586 actor.Add( shadowActor );
@@ -585,7 +590,7 @@ public: @@ -585,7 +590,7 @@ public:
585 ImageActor imageActor = ImageActor::New( image ); 590 ImageActor imageActor = ImageActor::New( image );
586 imageActor.SetParentOrigin( ParentOrigin::CENTER ); 591 imageActor.SetParentOrigin( ParentOrigin::CENTER );
587 imageActor.SetAnchorPoint( AnchorPoint::CENTER ); 592 imageActor.SetAnchorPoint( AnchorPoint::CENTER );
588 - imageActor.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 593 + imageActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
589 actor.Add( imageActor ); 594 actor.Add( imageActor );
590 595
591 // 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).
@@ -595,6 +600,7 @@ public: @@ -595,6 +600,7 @@ public:
595 borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); 600 borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
596 borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE ); 601 borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE );
597 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 );
598 borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT ); 604 borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
599 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 );
600 actor.Add( borderActor ); 606 actor.Add( borderActor );
@@ -625,7 +631,8 @@ public: @@ -625,7 +631,8 @@ public:
625 mScrollView.Add(pageView); 631 mScrollView.Add(pageView);
626 pageView.SetParentOrigin(ParentOrigin::CENTER); 632 pageView.SetParentOrigin(ParentOrigin::CENTER);
627 pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f)); 633 pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f));
628 - pageView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 634 + pageView.SetRelayoutEnabled( true );
  635 + pageView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
629 636
630 // 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.
631 Cluster cluster = CreateClusterActor(clusterType, style); 638 Cluster cluster = CreateClusterActor(clusterType, style);
examples/cube-transition-effect/cube-transition-effect-example.cpp
@@ -283,6 +283,7 @@ void CubeTransitionApp::OnInit( Application&amp; application ) @@ -283,6 +283,7 @@ void CubeTransitionApp::OnInit( Application&amp; application )
283 mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); 283 mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) );
284 mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); 284 mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION );
285 mCurrentImage.ApplyConstraint( mImageConstraint ); 285 mCurrentImage.ApplyConstraint( mImageConstraint );
  286 + mCurrentImage.SetRelayoutEnabled( false );
286 mParent.Add( mCurrentImage ); 287 mParent.Add( mCurrentImage );
287 288
288 mCurrentEffect = mCubeWaveEffect; 289 mCurrentEffect = mCubeWaveEffect;
@@ -322,6 +323,7 @@ void CubeTransitionApp::GoToNextImage() @@ -322,6 +323,7 @@ void CubeTransitionApp::GoToNextImage()
322 323
323 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION); 324 mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION);
324 mNextImage.ApplyConstraint( mImageConstraint ); 325 mNextImage.ApplyConstraint( mImageConstraint );
  326 + mNextImage.SetRelayoutEnabled( false );
325 mCurrentEffect.SetTargetImage(mNextImage); 327 mCurrentEffect.SetTargetImage(mNextImage);
326 if( image.GetLoadingState() == ResourceLoadingSucceeded ) 328 if( image.GetLoadingState() == ResourceLoadingSucceeded )
327 { 329 {
examples/hello-world/hello-world-example.cpp
@@ -44,9 +44,9 @@ public: @@ -44,9 +44,9 @@ public:
44 // Get a handle to the stage 44 // Get a handle to the stage
45 Stage stage = Stage::GetCurrent(); 45 Stage stage = Stage::GetCurrent();
46 46
47 - TextLabel textLabel = TextLabel::New(); 47 + TextLabel textLabel = TextLabel::New( "Hello World" );
48 textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 48 textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
49 - textLabel.SetProperty( TextLabel::Property::TEXT, "Hello World" ); 49 + textLabel.SetName( "hello-world-label" );
50 stage.Add( textLabel ); 50 stage.Add( textLabel );
51 51
52 // Respond to a click anywhere on the stage 52 // Respond to a click anywhere on the stage
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
@@ -421,7 +421,8 @@ public: @@ -421,7 +421,8 @@ public:
421 // coordinates in a frame defined by a parent actor: 421 // coordinates in a frame defined by a parent actor:
422 422
423 Actor gridActor = Actor::New(); 423 Actor gridActor = Actor::New();
424 - gridActor.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 424 + gridActor.SetRelayoutEnabled( true );
  425 + gridActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
425 gridActor.SetParentOrigin( ParentOrigin::CENTER ); 426 gridActor.SetParentOrigin( ParentOrigin::CENTER );
426 gridActor.SetAnchorPoint( AnchorPoint::CENTER ); 427 gridActor.SetAnchorPoint( AnchorPoint::CENTER );
427 428
examples/item-view/item-view-example.cpp
@@ -279,7 +279,8 @@ public: @@ -279,7 +279,8 @@ public:
279 mDeleteButton.SetDrawMode( DrawMode::OVERLAY ); 279 mDeleteButton.SetDrawMode( DrawMode::OVERLAY );
280 mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); 280 mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
281 mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) ); 281 mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) );
282 - mDeleteButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); 282 + mDeleteButton.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  283 + mDeleteButton.SetPreferredSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
283 mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked); 284 mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked);
284 mDeleteButton.SetLeaveRequired( true ); 285 mDeleteButton.SetLeaveRequired( true );
285 mDeleteButton.SetVisible( false ); 286 mDeleteButton.SetVisible( false );
@@ -293,7 +294,8 @@ public: @@ -293,7 +294,8 @@ public:
293 mInsertButton.SetDrawMode( DrawMode::OVERLAY ); 294 mInsertButton.SetDrawMode( DrawMode::OVERLAY );
294 mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); 295 mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
295 mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) ); 296 mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) );
296 - mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); 297 + mInsertButton.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  298 + mInsertButton.SetPreferredSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
297 mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked); 299 mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked);
298 mInsertButton.SetLeaveRequired( true ); 300 mInsertButton.SetLeaveRequired( true );
299 mInsertButton.SetVisible( false ); 301 mInsertButton.SetVisible( false );
@@ -307,7 +309,8 @@ public: @@ -307,7 +309,8 @@ public:
307 mReplaceButton.SetDrawMode( DrawMode::OVERLAY ); 309 mReplaceButton.SetDrawMode( DrawMode::OVERLAY );
308 mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); 310 mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
309 mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) ); 311 mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) );
310 - mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); 312 + mReplaceButton.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  313 + mReplaceButton.SetPreferredSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
311 mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked); 314 mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked);
312 mReplaceButton.SetLeaveRequired( true ); 315 mReplaceButton.SetLeaveRequired( true );
313 mReplaceButton.SetVisible( false ); 316 mReplaceButton.SetVisible( false );
@@ -316,6 +319,7 @@ public: @@ -316,6 +319,7 @@ public:
316 // Create the item view actor 319 // Create the item view actor
317 mImageAtlas = CreateImageAtlas(); 320 mImageAtlas = CreateImageAtlas();
318 mItemView = ItemView::New(*this); 321 mItemView = ItemView::New(*this);
  322 + mItemView.SetRelayoutEnabled( false );
319 mItemView.SetParentOrigin(ParentOrigin::CENTER); 323 mItemView.SetParentOrigin(ParentOrigin::CENTER);
320 mItemView.SetAnchorPoint(AnchorPoint::CENTER); 324 mItemView.SetAnchorPoint(AnchorPoint::CENTER);
321 325
@@ -895,6 +899,7 @@ public: // From ItemFactory @@ -895,6 +899,7 @@ public: // From ItemFactory
895 borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH ); 899 borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
896 borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) ); 900 borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) );
897 borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor 901 borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor
  902 + borderActor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
898 borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT ); 903 borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
899 borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE ); 904 borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE );
900 actor.Add(borderActor); 905 actor.Add(borderActor);
@@ -906,6 +911,7 @@ public: // From ItemFactory @@ -906,6 +911,7 @@ public: // From ItemFactory
906 // Add a checkbox child actor; invisible until edit-mode is enabled 911 // Add a checkbox child actor; invisible until edit-mode is enabled
907 912
908 ImageActor checkbox = ImageActor::New( mWhiteImage ); 913 ImageActor checkbox = ImageActor::New( mWhiteImage );
  914 + checkbox.SetRelayoutEnabled( false );
909 checkbox.SetName( "CheckBox" ); 915 checkbox.SetName( "CheckBox" );
910 checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) ); 916 checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) );
911 checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT ); 917 checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT );
@@ -922,6 +928,7 @@ public: // From ItemFactory @@ -922,6 +928,7 @@ public: // From ItemFactory
922 actor.Add( checkbox ); 928 actor.Add( checkbox );
923 929
924 ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) ); 930 ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) );
  931 + tick.SetRelayoutEnabled( false );
925 tick.SetColorMode( USE_OWN_COLOR ); 932 tick.SetColorMode( USE_OWN_COLOR );
926 tick.SetName( "Tick" ); 933 tick.SetName( "Tick" );
927 tick.SetParentOrigin( ParentOrigin::TOP_RIGHT ); 934 tick.SetParentOrigin( ParentOrigin::TOP_RIGHT );
@@ -976,12 +983,12 @@ private: @@ -976,12 +983,12 @@ private:
976 mMenu = Toolkit::Popup::New(); 983 mMenu = Toolkit::Popup::New();
977 mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); 984 mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
978 mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); 985 mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
  986 + mMenu.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  987 + mMenu.SetPreferredSize( Vector2( popupWidth, MENU_OPTION_HEIGHT * 2 ) );
979 mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu ); 988 mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu );
980 - stage.Add( mMenu );  
981 989
982 TableView tableView = TableView::New( 0, 0 ); 990 TableView tableView = TableView::New( 0, 0 );
983 - Vector2 tableSize = Vector2( popupWidth, MENU_OPTION_HEIGHT * 2 );  
984 - tableView.SetSize( tableSize ); 991 + tableView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
985 mMenu.Add( tableView ); 992 mMenu.Add( tableView );
986 993
987 Slider slider = Slider::New(); 994 Slider slider = Slider::New();
@@ -990,9 +997,9 @@ private: @@ -990,9 +997,9 @@ private:
990 slider.SetProperty( Slider::Property::VALUE, mDurationSeconds ); 997 slider.SetProperty( Slider::Property::VALUE, mDurationSeconds );
991 slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 ); 998 slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 );
992 slider.SetProperty( Slider::Property::SHOW_POPUP, true ); 999 slider.SetProperty( Slider::Property::SHOW_POPUP, true );
  1000 + slider.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
993 slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange ); 1001 slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange );
994 tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) ); 1002 tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) );
995 - tableView.SetRelativeHeight( 0, 0.5f );  
996 1003
997 mMenu.Show(); 1004 mMenu.Show();
998 mMenuShown = true; 1005 mMenuShown = true;
examples/logging/logging-example.cpp
@@ -265,7 +265,7 @@ class LoggingController: public ConnectionTracker @@ -265,7 +265,7 @@ class LoggingController: public ConnectionTracker
265 mContentLayer.Add( createGroupBackground ); 265 mContentLayer.Add( createGroupBackground );
266 266
267 int buttonXDP = DP(MARGIN_SIZE); 267 int buttonXDP = DP(MARGIN_SIZE);
268 - int buttonWidthDP = (createGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2; 268 + int buttonWidthDP = (createGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2;
269 269
270 { 270 {
271 Toolkit::PushButton button = Toolkit::PushButton::New(); 271 Toolkit::PushButton button = Toolkit::PushButton::New();
@@ -316,7 +316,7 @@ class LoggingController: public ConnectionTracker @@ -316,7 +316,7 @@ class LoggingController: public ConnectionTracker
316 mContentLayer.Add( timingGroupBackground ); 316 mContentLayer.Add( timingGroupBackground );
317 317
318 buttonXDP = DP(MARGIN_SIZE); 318 buttonXDP = DP(MARGIN_SIZE);
319 - buttonWidthDP = (timingGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2; 319 + buttonWidthDP = (timingGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2;
320 320
321 { 321 {
322 Toolkit::PushButton button = Toolkit::PushButton::New(); 322 Toolkit::PushButton button = Toolkit::PushButton::New();
@@ -367,7 +367,7 @@ class LoggingController: public ConnectionTracker @@ -367,7 +367,7 @@ class LoggingController: public ConnectionTracker
367 mContentLayer.Add( enableGroupBackground ); 367 mContentLayer.Add( enableGroupBackground );
368 368
369 buttonXDP = DP(MARGIN_SIZE); 369 buttonXDP = DP(MARGIN_SIZE);
370 - buttonWidthDP = (enableGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 3) / 2; 370 + buttonWidthDP = (enableGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 3) / 2;
371 371
372 { 372 {
373 Toolkit::PushButton button = Toolkit::PushButton::New(); 373 Toolkit::PushButton button = Toolkit::PushButton::New();
@@ -489,7 +489,7 @@ class LoggingController: public ConnectionTracker @@ -489,7 +489,7 @@ class LoggingController: public ConnectionTracker
489 mContentLayer.Add( vsyncGroupBackground ); 489 mContentLayer.Add( vsyncGroupBackground );
490 490
491 buttonXDP = DP(MARGIN_SIZE); 491 buttonXDP = DP(MARGIN_SIZE);
492 - buttonWidthDP = vsyncGroupBackground.GetSize().width - DP(MARGIN_SIZE) * 2; 492 + buttonWidthDP = vsyncGroupBackground.GetTargetSize().width - DP(MARGIN_SIZE) * 2;
493 493
494 { 494 {
495 Toolkit::PushButton button = Toolkit::PushButton::New(); 495 Toolkit::PushButton button = Toolkit::PushButton::New();
examples/magnifier/magnifier-example.cpp
@@ -227,12 +227,14 @@ public: @@ -227,12 +227,14 @@ public:
227 227
228 // Create magnifier (controlled by human touch) 228 // Create magnifier (controlled by human touch)
229 Layer overlay = Layer::New(); 229 Layer overlay = Layer::New();
  230 + overlay.SetRelayoutEnabled( false );
230 overlay.SetSensitive(false); 231 overlay.SetSensitive(false);
231 overlay.SetParentOrigin( ParentOrigin::CENTER ); 232 overlay.SetParentOrigin( ParentOrigin::CENTER );
232 overlay.SetSize(mStageSize); 233 overlay.SetSize(mStageSize);
233 Stage::GetCurrent().Add(overlay); 234 Stage::GetCurrent().Add(overlay);
234 235
235 mMagnifier = Toolkit::Magnifier::New(); 236 mMagnifier = Toolkit::Magnifier::New();
  237 + mMagnifier.SetRelayoutEnabled( false );
236 mMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); 238 mMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
237 mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width 239 mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
238 mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); 240 mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
@@ -251,6 +253,7 @@ public: @@ -251,6 +253,7 @@ public:
251 253
252 // Create bouncing magnifier automatically bounces around screen. 254 // Create bouncing magnifier automatically bounces around screen.
253 mBouncingMagnifier = Toolkit::Magnifier::New(); 255 mBouncingMagnifier = Toolkit::Magnifier::New();
  256 + mBouncingMagnifier.SetRelayoutEnabled( false );
254 mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() ); 257 mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
255 mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width 258 mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
256 mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR ); 259 mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
examples/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/path-animation/path-animation.cpp
@@ -63,7 +63,7 @@ public: @@ -63,7 +63,7 @@ public:
63 */ 63 */
64 Actor CreateVectorComponentControl( const std::string& label, const Vector3& size, bool(PathController::*callback)(Slider,float) ) 64 Actor CreateVectorComponentControl( const std::string& label, const Vector3& size, bool(PathController::*callback)(Slider,float) )
65 { 65 {
66 - return Actor(); // TODO 66 + return Actor();
67 } 67 }
68 68
69 /** 69 /**
@@ -75,6 +75,7 @@ public: @@ -75,6 +75,7 @@ public:
75 75
76 //TextInput 76 //TextInput
77 Dali::Layer controlsLayer = Dali::Layer::New(); 77 Dali::Layer controlsLayer = Dali::Layer::New();
  78 + controlsLayer.SetRelayoutEnabled( false );
78 controlsLayer.SetSize( stage.GetSize().x, stage.GetSize().y*0.3f, 0.0 ); 79 controlsLayer.SetSize( stage.GetSize().x, stage.GetSize().y*0.3f, 0.0 );
79 controlsLayer.SetPosition( 0.0f, stage.GetSize().y*0.8f, 0.0f ); 80 controlsLayer.SetPosition( 0.0f, stage.GetSize().y*0.8f, 0.0f );
80 controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT); 81 controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT);
@@ -174,6 +175,7 @@ public: @@ -174,6 +175,7 @@ public:
174 if( !mControlPoint[index] ) 175 if( !mControlPoint[index] )
175 { 176 {
176 mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); 177 mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f));
  178 + mControlPoint[index].SetRelayoutEnabled( false );
177 mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); 179 mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT);
178 mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); 180 mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER );
179 mControlPoint[index].SetSize( 20.0f, 20.0f ); 181 mControlPoint[index].SetSize( 20.0f, 20.0f );
@@ -195,6 +197,7 @@ public: @@ -195,6 +197,7 @@ public:
195 if( !mControlPoint[index]) 197 if( !mControlPoint[index])
196 { 198 {
197 mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); 199 mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f));
  200 + mControlPoint[index].SetRelayoutEnabled( false );
198 mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); 201 mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT);
199 mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); 202 mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER );
200 mControlPoint[index].SetSize( 20.0f, 20.0f ); 203 mControlPoint[index].SetSize( 20.0f, 20.0f );
@@ -430,6 +433,7 @@ public: @@ -430,6 +433,7 @@ public:
430 ImageAttributes attributes; 433 ImageAttributes attributes;
431 Image img = ResourceImage::New(ACTOR_IMAGE, attributes ); 434 Image img = ResourceImage::New(ACTOR_IMAGE, attributes );
432 mActor = ImageActor::New( img ); 435 mActor = ImageActor::New( img );
  436 + mActor.SetRelayoutEnabled( false );
433 mActor.SetAnchorPoint( AnchorPoint::CENTER ); 437 mActor.SetAnchorPoint( AnchorPoint::CENTER );
434 mActor.SetSize( 100, 50, 1 ); 438 mActor.SetSize( 100, 50, 1 );
435 stage.Add( mActor ); 439 stage.Add( mActor );
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 + // Get a handle to the stage
  59 + Stage stage = Stage::GetCurrent();
  60 +
  61 + // change the background color to purple
  62 + Stage::GetCurrent().SetBackgroundColor( Vector4(0.2,0.2,0.4,1.0) );
  63 +
  64 + // Try loading a JSON file
  65 + if( !mJSONFileName.empty() )
  66 + {
  67 + mBuilder = Toolkit::Builder::New();
  68 +
  69 + Property::Map defaultDirs;
  70 + defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR;
  71 + defaultDirs[ TOKEN_STRING(DALI_MODEL_DIR) ] = DALI_MODEL_DIR;
  72 + defaultDirs[ TOKEN_STRING(DALI_SCRIPT_DIR) ] = DALI_SCRIPT_DIR;
  73 + mBuilder.AddConstants( defaultDirs );
  74 +
  75 + std::string json_data(GetFileContents( mJSONFileName ));
  76 + mBuilder.LoadFromString(json_data);
  77 + mBuilder.AddActors( stage.GetRootLayer() );
  78 + }
  79 +
  80 + // Try load a JavaScript file
  81 + if( !mJavaScriptFileName.empty() )
  82 + {
  83 + // execute the script
  84 + mScript = Toolkit::Script::New();
  85 +
  86 + mScript.ExecuteFile( mJavaScriptFileName);
  87 + }
  88 +}
  89 +
  90 +void Launcher::MainLoop()
  91 +{
  92 + mApplication.MainLoop();
  93 +}
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/text-field/edit-layout.cpp renamed to examples/scripting/scripting-example.cpp
@@ -15,74 +15,82 @@ @@ -15,74 +15,82 @@
15 * 15 *
16 */ 16 */
17 17
18 -// CLASS HEADER  
19 -#include "edit-layout.h" 18 +// EXTERNAL INCLUDES
  19 +#include <string>
  20 +#include <stdio.h>
  21 +#include <sys/stat.h>
  22 +#include <dali/integration-api/debug.h>
20 23
21 // INTERNAL INCLUDES 24 // INTERNAL INCLUDES
22 -#include "edit-layout-impl.h" 25 +#include "launcher.h"
23 26
24 -namespace Dali 27 +namespace
25 { 28 {
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -EditLayout EditLayout::New()  
31 -{  
32 - return Internal::EditLayout::New();  
33 -}  
34 -  
35 -void EditLayout::SetTopPanel( Control panel ) 29 +bool CheckIfFileExists( const std::string& filename )
36 { 30 {
37 - GetImpl( *this ).SetTopPanel( panel ); 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 } 38 }
39 39
40 -EditLayout::EditLayout()  
41 -{  
42 } 40 }
43 -  
44 -EditLayout::EditLayout( const EditLayout& handle )  
45 -: Control( handle ) 41 +int main( int argc, char* argv[] )
46 { 42 {
47 -} 43 + // pull out the JSON file and JavaScript file from the command line arguments
  44 + std::string javaScriptFileName;
  45 + std::string jSONFileName;
48 46
49 -EditLayout& EditLayout::operator=( const EditLayout& handle )  
50 -{  
51 - if( &handle != this ) 47 + for( int i = 1 ; i < argc ; ++i )
52 { 48 {
53 - Control::operator=( handle ); 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 + }
54 } 66 }
55 - return *this;  
56 -}  
57 -  
58 -EditLayout EditLayout::DownCast( BaseHandle handle )  
59 -{  
60 - return Control::DownCast<EditLayout, Internal::EditLayout>( handle );  
61 -}  
62 67
63 -EditLayout::~EditLayout()  
64 -{  
65 -}  
66 -  
67 -EditLayout::EditLayout( Internal::EditLayout& internal )  
68 -: Control( internal )  
69 -{  
70 -} 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 + }
71 89
72 -EditLayout::EditLayout( Dali::Internal::CustomActor* internal )  
73 -: Control( internal )  
74 -{  
75 -}  
76 90
77 -Internal::EditLayout& EditLayout::GetImpl( EditLayout& verticalLayout )  
78 -{  
79 - DALI_ASSERT_ALWAYS( verticalLayout ); 91 + Launcher daliApplication( Dali::Application::New( &argc, &argv ), jSONFileName, javaScriptFileName );
80 92
81 - Dali::RefObject& handle = verticalLayout.GetImplementation(); 93 + daliApplication.MainLoop();
82 94
83 - return static_cast<Internal::EditLayout&>(handle); 95 + return 0;
84 } 96 }
85 -  
86 -} // namespace Toolkit  
87 -  
88 -} // namespace Dali  
examples/scroll-view/scroll-view-example.cpp
@@ -226,6 +226,7 @@ private: @@ -226,6 +226,7 @@ private:
226 Vector2 stageSize = stage.GetSize(); 226 Vector2 stageSize = stage.GetSize();
227 227
228 mScrollView = ScrollView::New(); 228 mScrollView = ScrollView::New();
  229 + mScrollView.SetRelayoutEnabled( false );
229 mScrollView.SetAnchorPoint(AnchorPoint::CENTER); 230 mScrollView.SetAnchorPoint(AnchorPoint::CENTER);
230 mScrollView.SetParentOrigin(ParentOrigin::CENTER); 231 mScrollView.SetParentOrigin(ParentOrigin::CENTER);
231 mContentLayer.Add( mScrollView ); 232 mContentLayer.Add( mScrollView );
@@ -298,7 +299,8 @@ private: @@ -298,7 +299,8 @@ private:
298 Actor CreatePage() 299 Actor CreatePage()
299 { 300 {
300 Actor page = Actor::New(); 301 Actor page = Actor::New();
301 - page.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 302 + page.SetRelayoutEnabled( true );
  303 + page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
302 page.SetParentOrigin( ParentOrigin::CENTER ); 304 page.SetParentOrigin( ParentOrigin::CENTER );
303 page.SetAnchorPoint( AnchorPoint::CENTER ); 305 page.SetAnchorPoint( AnchorPoint::CENTER );
304 306
@@ -450,7 +452,8 @@ private: @@ -450,7 +452,8 @@ private:
450 void ApplyEffectToPage(Actor page) 452 void ApplyEffectToPage(Actor page)
451 { 453 {
452 page.RemoveConstraints(); 454 page.RemoveConstraints();
453 - page.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 455 + page.SetRelayoutEnabled( true );
  456 + page.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
454 457
455 switch( mEffectMode ) 458 switch( mEffectMode )
456 { 459 {
@@ -566,6 +569,7 @@ private: @@ -566,6 +569,7 @@ private:
566 attributes.SetFilterMode( ImageAttributes::BoxThenLinear ); 569 attributes.SetFilterMode( ImageAttributes::BoxThenLinear );
567 Image img = ResourceImage::New(filename, attributes); 570 Image img = ResourceImage::New(filename, attributes);
568 ImageActor actor = ImageActor::New(img); 571 ImageActor actor = ImageActor::New(img);
  572 + actor.SetRelayoutEnabled( false );
569 actor.SetName( filename ); 573 actor.SetName( filename );
570 actor.SetParentOrigin(ParentOrigin::CENTER); 574 actor.SetParentOrigin(ParentOrigin::CENTER);
571 actor.SetAnchorPoint(AnchorPoint::CENTER); 575 actor.SetAnchorPoint(AnchorPoint::CENTER);
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
@@ -207,7 +207,8 @@ public: @@ -207,7 +207,8 @@ public:
207 mShadowView.SetName("Container"); 207 mShadowView.SetName("Container");
208 mShadowView.SetParentOrigin(ParentOrigin::CENTER); 208 mShadowView.SetParentOrigin(ParentOrigin::CENTER);
209 mShadowView.SetAnchorPoint(AnchorPoint::CENTER); 209 mShadowView.SetAnchorPoint(AnchorPoint::CENTER);
210 - mShadowView.SetSizeMode( SIZE_EQUAL_TO_PARENT ); 210 + mShadowView.SetRelayoutEnabled( true );
  211 + mShadowView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
211 mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f); 212 mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f);
212 mContents.Add(mShadowView); 213 mContents.Add(mShadowView);
213 214
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::TextLabel::New(); // FIXME
  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.SetProperty( Toolkit::TextLabel::Property::TEXT, std::string( std::string( TOOLBAR_TITLE ) + ": " + subTitle ) );
  235 + }
  236 +
  237 + bool OnMenu( Toolkit::Button button )
  238 + {
  239 + ShowMenu();
  240 + return true;
  241 + }
  242 +
  243 + void ShowMenu()
  244 + {
  245 + Stage stage = Stage::GetCurrent();
  246 + const float popupWidth = stage.GetSize().x * 0.5f;
  247 +
  248 + mMenu = Toolkit::Popup::New();
  249 + mMenu.SetParentOrigin( ParentOrigin::TOP_LEFT );
  250 + mMenu.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  251 + mMenu.HideTail();
  252 + mMenu.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::HideMenu );
  253 + mMenu.SetPreferredSize( Vector2( popupWidth, 0.0f ) );
  254 + mMenu.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  255 +
  256 + Toolkit::TableView tableView = Toolkit::TableView::New( 0, 0 );
  257 + tableView.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  258 + tableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  259 + mMenu.Add( tableView );
  260 +
  261 + for( unsigned int i = 0; i < MENU_ITEMS_COUNT; ++i )
  262 + {
  263 + Toolkit::PushButton menuButton = Toolkit::PushButton::New();
  264 + menuButton.SetName( MENU_ITEMS[ i ].name );
  265 + menuButton.SetLabel( MENU_ITEMS[ i ].text );
  266 + menuButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenuSelect );
  267 +
  268 + tableView.Add( menuButton );
  269 + tableView.SetFitHeight( i );
  270 + }
  271 +
  272 + // Show the menu
  273 + mMenu.Show();
  274 + mMenuShown = true;
  275 + }
  276 +
  277 + void HideMenu()
  278 + {
  279 + if( mMenu )
  280 + {
  281 + mMenu.Hide();
  282 + mMenu.Reset();
  283 + }
  284 +
  285 + mMenuShown = false;
  286 + }
  287 +
  288 + bool OnMenuSelect( Toolkit::Button button )
  289 + {
  290 + bool refresh = false;
  291 +
  292 + if( button.GetName() == POPUPS_MENU_ID )
  293 + {
  294 + if( mDemoState != POPUP )
  295 + {
  296 + refresh = true;
  297 + mDemoState = POPUP;
  298 + }
  299 + }
  300 + else if( button.GetName() == TABLEVIEW_MENU_ID )
  301 + {
  302 + if( mDemoState != TABLEVIEW )
  303 + {
  304 + refresh = true;
  305 + mDemoState = TABLEVIEW;
  306 + }
  307 + }
  308 +
  309 + if( refresh )
  310 + {
  311 + SetTitle();
  312 +
  313 + mItemView.Refresh();
  314 + }
  315 +
  316 + HideMenu();
  317 + return true;
  318 + }
  319 +
  320 + Toolkit::Popup CreatePopup()
  321 + {
  322 + Stage stage = Stage::GetCurrent();
  323 + const float POPUP_WIDTH_DP = stage.GetSize().width * 0.75f;
  324 +
  325 + Toolkit::Popup popup = Toolkit::Popup::New();
  326 + popup.SetName( "POPUP" );
  327 + popup.SetParentOrigin( ParentOrigin::CENTER );
  328 + popup.SetAnchorPoint( AnchorPoint::CENTER );
  329 + popup.SetPreferredSize( Vector2( POPUP_WIDTH_DP, 0.0f ) );
  330 + popup.HideTail();
  331 +
  332 + popup.OutsideTouchedSignal().Connect( this, &SizeNegotiationController::OnPopupOutsideTouched );
  333 +
  334 + return popup;
  335 + }
  336 +
  337 + bool OnButtonClicked( Toolkit::Button button )
  338 + {
  339 + if( button.GetName() == POPUP_BUTTON_EMPTY_ID )
  340 + {
  341 + mPopup = CreatePopup();
  342 +
  343 + // The popup is not yet on the stage so needs to be flaged as dirty
  344 + mPopup.MarkDirtyForRelayout();
  345 +
  346 + mPopup.Show();
  347 + }
  348 + else if( button.GetName() == POPUP_BUTTON_TITLE_ID )
  349 + {
  350 + mPopup = CreatePopup();
  351 + mPopup.SetTitle( "Popup!" );
  352 +
  353 + // The popup is not yet on the stage so needs to be flaged as dirty
  354 + mPopup.MarkDirtyForRelayout();
  355 +
  356 + mPopup.Show();
  357 + }
  358 + else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID )
  359 + {
  360 + mPopup = CreatePopup();
  361 +
  362 + Toolkit::PushButton okayButton = Toolkit::PushButton::New();
  363 + okayButton.SetName( OKAY_BUTTON_ID );
  364 + okayButton.SetLabel( "OK!" );
  365 + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  366 + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  367 +
  368 + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  369 +
  370 + mPopup.AddButton( okayButton );
  371 +
  372 + // The popup is not yet on the stage so needs to be flaged as dirty
  373 + mPopup.MarkDirtyForRelayout();
  374 +
  375 + mPopup.Show();
  376 + }
  377 + else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID )
  378 + {
  379 + mPopup = CreatePopup();
  380 +
  381 + Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
  382 + cancelButton.SetName( CANCEL_BUTTON_ID );
  383 + cancelButton.SetLabel( "Cancel" );
  384 + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  385 + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  386 +
  387 + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  388 +
  389 + mPopup.AddButton( cancelButton );
  390 +
  391 + Toolkit::PushButton okayButton = Toolkit::PushButton::New();
  392 + okayButton.SetName( OKAY_BUTTON_ID );
  393 + okayButton.SetLabel( "OK!" );
  394 + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  395 + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  396 +
  397 + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  398 +
  399 + mPopup.AddButton( okayButton );
  400 +
  401 + // The popup is not yet on the stage so needs to be flaged as dirty
  402 + mPopup.MarkDirtyForRelayout();
  403 +
  404 + mPopup.Show();
  405 + }
  406 + else if( button.GetName() == POPUP_BUTTON_TITLE_BUTTONS_ID )
  407 + {
  408 + mPopup = CreatePopup();
  409 + mPopup.SetTitle( "Popup!" );
  410 +
  411 + Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
  412 + cancelButton.SetName( CANCEL_BUTTON_ID );
  413 + cancelButton.SetLabel( "Cancel" );
  414 + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  415 + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  416 +
  417 + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  418 +
  419 + mPopup.AddButton( cancelButton );
  420 +
  421 + Toolkit::PushButton okayButton = Toolkit::PushButton::New();
  422 + okayButton.SetName( OKAY_BUTTON_ID );
  423 + okayButton.SetLabel( "OK!" );
  424 + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  425 + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  426 +
  427 + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  428 +
  429 + mPopup.AddButton( okayButton );
  430 +
  431 + // The popup is not yet on the stage so needs to be flaged as dirty
  432 + mPopup.MarkDirtyForRelayout();
  433 +
  434 + mPopup.Show();
  435 + }
  436 + else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID )
  437 + {
  438 + mPopup = CreatePopup();
  439 +
  440 + // FIXME - Add text
  441 +
  442 + // The popup is not yet on the stage so needs to be flaged as dirty
  443 + mPopup.MarkDirtyForRelayout();
  444 +
  445 + mPopup.Show();
  446 + }
  447 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID )
  448 + {
  449 + mPopup = CreatePopup();
  450 +
  451 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
  452 + image.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  453 + image.SetDimensionDependency( HEIGHT, WIDTH );
  454 + image.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 20.0f ) );
  455 +
  456 + mPopup.Add( image );
  457 +
  458 + // The popup is not yet on the stage so needs to be flaged as dirty
  459 + mPopup.MarkDirtyForRelayout();
  460 +
  461 + mPopup.Show();
  462 + }
  463 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
  464 + {
  465 + mPopup = CreatePopup();
  466 +
  467 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  468 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  469 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  470 +
  471 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
  472 + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  473 +
  474 + mPopup.Add( image );
  475 +
  476 + // The popup is not yet on the stage so needs to be flaged as dirty
  477 + mPopup.MarkDirtyForRelayout();
  478 +
  479 + mPopup.Show();
  480 + }
  481 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
  482 + {
  483 + mPopup = CreatePopup();
  484 +
  485 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  486 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  487 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  488 +
  489 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
  490 + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  491 + image.SetSizeScalePolicy( FIT_WITH_ASPECT_RATIO );
  492 +
  493 + mPopup.Add( image );
  494 +
  495 + // The popup is not yet on the stage so needs to be flaged as dirty
  496 + mPopup.MarkDirtyForRelayout();
  497 +
  498 + mPopup.Show();
  499 + }
  500 + else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
  501 + {
  502 + mPopup = CreatePopup();
  503 +
  504 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  505 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  506 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  507 +
  508 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE2 ) );
  509 + image.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  510 + image.SetSizeScalePolicy( FILL_WITH_ASPECT_RATIO );
  511 +
  512 + mPopup.Add( image );
  513 +
  514 + // The popup is not yet on the stage so needs to be flaged as dirty
  515 + mPopup.MarkDirtyForRelayout();
  516 +
  517 + mPopup.Show();
  518 + }
  519 + else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
  520 + {
  521 + mPopup = CreatePopup();
  522 + mPopup.SetTitle( "Popup!" );
  523 +
  524 + // FIXME - Add text
  525 +
  526 + // The popup is not yet on the stage so needs to be flaged as dirty
  527 + mPopup.MarkDirtyForRelayout();
  528 +
  529 + mPopup.Show();
  530 + }
  531 + else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID )
  532 + {
  533 + mPopup = CreatePopup();
  534 + mPopup.SetTitle( "Popup!" );
  535 +
  536 + // FIXME - Add text
  537 +
  538 + Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
  539 + cancelButton.SetName( CANCEL_BUTTON_ID );
  540 + cancelButton.SetLabel( "Cancel" );
  541 + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  542 + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  543 +
  544 + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  545 +
  546 + mPopup.AddButton( cancelButton );
  547 +
  548 + Toolkit::PushButton okayButton = Toolkit::PushButton::New();
  549 + okayButton.SetName( OKAY_BUTTON_ID );
  550 + okayButton.SetLabel( "OK!" );
  551 + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  552 + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  553 +
  554 + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  555 +
  556 + mPopup.AddButton( okayButton );
  557 +
  558 + // The popup is not yet on the stage so needs to be flaged as dirty
  559 + mPopup.MarkDirtyForRelayout();
  560 +
  561 + mPopup.Show();
  562 + }
  563 + else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID )
  564 + {
  565 + mPopup = CreatePopup();
  566 + mPopup.SetTitle( "Warning" );
  567 +
  568 + // Content
  569 + Toolkit::TableView content = Toolkit::TableView::New( 2, 2 );
  570 + content.SetName( "COMPLEX_TABLEVIEW" );
  571 + content.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  572 + content.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  573 + content.SetFitHeight( 0 );
  574 + content.SetFitHeight( 1 );
  575 + content.SetPadding( Padding( 20.0f, 20.0f, 20.0f, 0.0f ) );
  576 +
  577 + // Text
  578 + {
  579 + Toolkit::TextLabel text = Toolkit::TextLabel::New();
  580 + // FIXME
  581 +
  582 + content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) );
  583 + }
  584 +
  585 + // Image
  586 + {
  587 + ImageActor image = ImageActor::New( ResourceImage::New( IMAGE1 ) );
  588 + image.SetName( "COMPLEX_IMAGE" );
  589 + image.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  590 + image.SetDimensionDependency( HEIGHT, WIDTH );
  591 + image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) );
  592 + content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) );
  593 + }
  594 +
  595 + // Text 2
  596 + {
  597 + Toolkit::TableView root = Toolkit::TableView::New( 1, 2 );
  598 + root.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  599 + root.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  600 + root.SetFitHeight( 0 );
  601 + root.SetFitWidth( 0 );
  602 + root.SetPadding( Padding( 0.0f, 0.0f, 0.0f, 20.0f ) );
  603 +
  604 + Dali::Image unchecked = Dali::ResourceImage::New( CHECKBOX_UNCHECKED_IMAGE );
  605 + Dali::Image checked = Dali::ResourceImage::New( CHECKBOX_CHECKED_IMAGE );
  606 + Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New();
  607 + checkBox.SetBackgroundImage( unchecked );
  608 + checkBox.SetSelectedImage( checked );
  609 + checkBox.SetPreferredSize( Vector2( 48, 48 ) );
  610 + checkBox.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  611 +
  612 + root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) );
  613 +
  614 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Don't show again" );
  615 + // FIXME
  616 + Actor textActor = text;
  617 + textActor.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 10.0f ) );
  618 +
  619 + root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) );
  620 +
  621 + content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0, 0, 2 ) ); // Column span 2
  622 + }
  623 +
  624 + mPopup.Add( content );
  625 +
  626 + // Buttons
  627 + Toolkit::PushButton cancelButton = Toolkit::PushButton::New();
  628 + cancelButton.SetName( CANCEL_BUTTON_ID );
  629 + cancelButton.SetLabel( "Cancel" );
  630 + cancelButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  631 + cancelButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  632 +
  633 + cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  634 +
  635 + mPopup.AddButton( cancelButton );
  636 +
  637 + Toolkit::PushButton okayButton = Toolkit::PushButton::New();
  638 + okayButton.SetName( OKAY_BUTTON_ID );
  639 + okayButton.SetLabel( "OK!" );
  640 + okayButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  641 + okayButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  642 +
  643 + okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  644 +
  645 + mPopup.AddButton( okayButton );
  646 +
  647 + // The popup is not yet on the stage so needs to be flaged as dirty
  648 + mPopup.MarkDirtyForRelayout();
  649 +
  650 + mPopup.Show();
  651 + }
  652 + else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID )
  653 + {
  654 + mPopup = CreatePopup();
  655 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  656 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  657 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  658 +
  659 +
  660 + Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
  661 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  662 +
  663 + mPopup.Add( table );
  664 +
  665 + // The popup is not yet on the stage so needs to be flaged as dirty
  666 + mPopup.MarkDirtyForRelayout();
  667 +
  668 + mPopup.Show();
  669 + }
  670 + else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID )
  671 + {
  672 + mPopup = CreatePopup();
  673 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  674 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  675 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  676 +
  677 +
  678 + Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
  679 + table.SetName( "TABLEVIEW_BUTTON_1CELL_ID" );
  680 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  681 +
  682 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  683 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  684 + table.Add( backing );
  685 +
  686 + mPopup.Add( table );
  687 +
  688 + // The popup is not yet on the stage so needs to be flaged as dirty
  689 + mPopup.MarkDirtyForRelayout();
  690 +
  691 + mPopup.Show();
  692 + }
  693 + else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID )
  694 + {
  695 + mPopup = CreatePopup();
  696 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  697 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  698 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  699 +
  700 +
  701 + Toolkit::TableView table = Toolkit::TableView::New( 0, 0 );
  702 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  703 +
  704 + {
  705 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  706 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  707 + table.Add( backing );
  708 + }
  709 + {
  710 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  711 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  712 + table.Add( backing );
  713 + }
  714 + {
  715 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  716 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  717 + table.Add( backing );
  718 + }
  719 +
  720 + mPopup.Add( table );
  721 +
  722 + // The popup is not yet on the stage so needs to be flaged as dirty
  723 + mPopup.MarkDirtyForRelayout();
  724 +
  725 + mPopup.Show();
  726 + }
  727 + else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID )
  728 + {
  729 + mPopup = CreatePopup();
  730 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  731 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  732 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  733 +
  734 +
  735 + Toolkit::TableView table = Toolkit::TableView::New( 3, 3 );
  736 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  737 +
  738 + // Column 0
  739 + {
  740 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  741 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  742 + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 0 ) );
  743 + }
  744 + {
  745 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  746 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  747 + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 0 ) );
  748 + }
  749 + {
  750 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  751 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  752 + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 0 ) );
  753 + }
  754 +
  755 + // Column 1
  756 + {
  757 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
  758 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  759 + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 1 ) );
  760 + }
  761 + {
  762 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
  763 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  764 + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 1 ) );
  765 + }
  766 + {
  767 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 1.0f, 1.0f ) );
  768 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  769 + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 1 ) );
  770 + }
  771 +
  772 + // Column 2
  773 + {
  774 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) );
  775 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  776 + table.AddChild( backing, Toolkit::TableView::CellPosition( 0, 2 ) );
  777 + }
  778 + {
  779 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.5f, 0.5f, 0.5f, 1.0f ) );
  780 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  781 + table.AddChild( backing, Toolkit::TableView::CellPosition( 1, 2 ) );
  782 + }
  783 + {
  784 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.5f, 0.0f, 1.0f ) );
  785 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  786 + table.AddChild( backing, Toolkit::TableView::CellPosition( 2, 2 ) );
  787 + }
  788 +
  789 + mPopup.Add( table );
  790 +
  791 + // The popup is not yet on the stage so needs to be flaged as dirty
  792 + mPopup.MarkDirtyForRelayout();
  793 +
  794 + mPopup.Show();
  795 + }
  796 + else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID )
  797 + {
  798 + mPopup = CreatePopup();
  799 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  800 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  801 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  802 +
  803 +
  804 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  805 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  806 + table.SetFixedHeight( 0, 50.0f );
  807 +
  808 + {
  809 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  810 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  811 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
  812 + text.SetAnchorPoint( AnchorPoint::CENTER );
  813 + text.SetParentOrigin( ParentOrigin::CENTER );
  814 + backing.Add( text );
  815 + table.Add( backing );
  816 + }
  817 + {
  818 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  819 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  820 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  821 + text.SetAnchorPoint( AnchorPoint::CENTER );
  822 + text.SetParentOrigin( ParentOrigin::CENTER );
  823 + backing.Add( text );
  824 + table.Add( backing );
  825 + }
  826 + {
  827 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  828 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  829 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  830 + text.SetAnchorPoint( AnchorPoint::CENTER );
  831 + text.SetParentOrigin( ParentOrigin::CENTER );
  832 + backing.Add( text );
  833 + table.Add( backing );
  834 + }
  835 +
  836 + mPopup.Add( table );
  837 +
  838 + // The popup is not yet on the stage so needs to be flaged as dirty
  839 + mPopup.MarkDirtyForRelayout();
  840 +
  841 + mPopup.Show();
  842 + }
  843 + else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID )
  844 + {
  845 + mPopup = CreatePopup();
  846 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  847 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  848 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  849 +
  850 +
  851 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  852 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  853 + table.SetFixedHeight( 0, 50.0f );
  854 + table.SetFixedHeight( 2, 50.0f );
  855 +
  856 + {
  857 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  858 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  859 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
  860 + text.SetAnchorPoint( AnchorPoint::CENTER );
  861 + text.SetParentOrigin( ParentOrigin::CENTER );
  862 + backing.Add( text );
  863 + table.Add( backing );
  864 + }
  865 + {
  866 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  867 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  868 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  869 + text.SetAnchorPoint( AnchorPoint::CENTER );
  870 + text.SetParentOrigin( ParentOrigin::CENTER );
  871 + backing.Add( text );
  872 + table.Add( backing );
  873 + }
  874 + {
  875 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  876 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  877 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
  878 + text.SetAnchorPoint( AnchorPoint::CENTER );
  879 + text.SetParentOrigin( ParentOrigin::CENTER );
  880 + backing.Add( text );
  881 + table.Add( backing );
  882 + }
  883 +
  884 + mPopup.Add( table );
  885 +
  886 + // The popup is not yet on the stage so needs to be flaged as dirty
  887 + mPopup.MarkDirtyForRelayout();
  888 +
  889 + mPopup.Show();
  890 + }
  891 + else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID )
  892 + {
  893 + mPopup = CreatePopup();
  894 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  895 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  896 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  897 +
  898 +
  899 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  900 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  901 + table.SetFitHeight( 0 );
  902 + table.SetFitHeight( 2 );
  903 +
  904 + {
  905 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  906 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  907 + backing.SetResizePolicy( FIXED, HEIGHT );
  908 + backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
  909 +
  910 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  911 + text.SetAnchorPoint( AnchorPoint::CENTER );
  912 + text.SetParentOrigin( ParentOrigin::CENTER );
  913 + backing.Add( text );
  914 +
  915 + table.Add( backing );
  916 + }
  917 + {
  918 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  919 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  920 +
  921 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  922 + text.SetAnchorPoint( AnchorPoint::CENTER );
  923 + text.SetParentOrigin( ParentOrigin::CENTER );
  924 + backing.Add( text );
  925 +
  926 + table.Add( backing );
  927 + }
  928 + {
  929 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  930 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  931 + backing.SetResizePolicy( FIXED, HEIGHT );
  932 + backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
  933 +
  934 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  935 + text.SetAnchorPoint( AnchorPoint::CENTER );
  936 + text.SetParentOrigin( ParentOrigin::CENTER );
  937 + backing.Add( text );
  938 +
  939 + table.Add( backing );
  940 + }
  941 +
  942 + mPopup.Add( table );
  943 +
  944 + // The popup is not yet on the stage so needs to be flaged as dirty
  945 + mPopup.MarkDirtyForRelayout();
  946 +
  947 + mPopup.Show();
  948 + }
  949 + else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID )
  950 + {
  951 + mPopup = CreatePopup();
  952 + mPopup.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  953 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  954 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 0.5f, 1.0f ) );
  955 +
  956 +
  957 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  958 + table.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  959 + table.SetFitHeight( 1 );
  960 +
  961 + {
  962 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  963 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  964 +
  965 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  966 + text.SetAnchorPoint( AnchorPoint::CENTER );
  967 + text.SetParentOrigin( ParentOrigin::CENTER );
  968 + backing.Add( text );
  969 +
  970 + table.Add( backing );
  971 + }
  972 + {
  973 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  974 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  975 + backing.SetResizePolicy( FIXED, HEIGHT );
  976 + backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
  977 +
  978 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  979 + text.SetAnchorPoint( AnchorPoint::CENTER );
  980 + text.SetParentOrigin( ParentOrigin::CENTER );
  981 + backing.Add( text );
  982 +
  983 + table.Add( backing );
  984 + }
  985 + {
  986 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  987 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  988 +
  989 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fill" );
  990 + text.SetAnchorPoint( AnchorPoint::CENTER );
  991 + text.SetParentOrigin( ParentOrigin::CENTER );
  992 + backing.Add( text );
  993 +
  994 + table.Add( backing );
  995 + }
  996 +
  997 + mPopup.Add( table );
  998 +
  999 + // The popup is not yet on the stage so needs to be flaged as dirty
  1000 + mPopup.MarkDirtyForRelayout();
  1001 +
  1002 + mPopup.Show();
  1003 + }
  1004 + else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID )
  1005 + {
  1006 + mPopup = CreatePopup();
  1007 + mPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1008 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  1009 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
  1010 + mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  1011 +
  1012 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  1013 + table.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1014 + table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  1015 + table.SetFitHeight( 0 );
  1016 + table.SetFitHeight( 1 );
  1017 + table.SetFitHeight( 2 );
  1018 +
  1019 + {
  1020 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  1021 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1022 + backing.SetResizePolicy( FIXED, HEIGHT );
  1023 + backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
  1024 +
  1025 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  1026 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1027 + text.SetParentOrigin( ParentOrigin::CENTER );
  1028 + backing.Add( text );
  1029 +
  1030 + table.Add( backing );
  1031 + }
  1032 + {
  1033 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
  1034 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1035 + backing.SetResizePolicy( FIXED, HEIGHT );
  1036 + backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
  1037 +
  1038 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  1039 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1040 + text.SetParentOrigin( ParentOrigin::CENTER );
  1041 + backing.Add( text );
  1042 +
  1043 + table.Add( backing );
  1044 + }
  1045 + {
  1046 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  1047 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1048 + backing.SetResizePolicy( FIXED, HEIGHT );
  1049 + backing.SetPreferredSize( Vector2( 0.0f, 300.0f ) );
  1050 +
  1051 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  1052 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1053 + text.SetParentOrigin( ParentOrigin::CENTER );
  1054 + backing.Add( text );
  1055 +
  1056 + table.Add( backing );
  1057 + }
  1058 +
  1059 + mPopup.Add( table );
  1060 +
  1061 + // The popup is not yet on the stage so needs to be flaged as dirty
  1062 + mPopup.MarkDirtyForRelayout();
  1063 +
  1064 + mPopup.Show();
  1065 + }
  1066 + else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID )
  1067 + {
  1068 + mPopup = CreatePopup();
  1069 + mPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1070 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  1071 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
  1072 + mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  1073 +
  1074 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  1075 + table.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1076 + table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  1077 + table.SetFitHeight( 0 );
  1078 + table.SetFitHeight( 1 );
  1079 +
  1080 + {
  1081 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  1082 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1083 + backing.SetResizePolicy( FIXED, HEIGHT );
  1084 + backing.SetPreferredSize( Vector2( 0.0f, 100.0f ) );
  1085 +
  1086 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  1087 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1088 + text.SetParentOrigin( ParentOrigin::CENTER );
  1089 + backing.Add( text );
  1090 +
  1091 + table.Add( backing );
  1092 + }
  1093 + {
  1094 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  1095 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1096 + backing.SetResizePolicy( FIXED, HEIGHT );
  1097 + backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
  1098 +
  1099 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  1100 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1101 + text.SetParentOrigin( ParentOrigin::CENTER );
  1102 + backing.Add( text );
  1103 +
  1104 + table.Add( backing );
  1105 + }
  1106 +
  1107 + mPopup.Add( table );
  1108 +
  1109 + // The popup is not yet on the stage so needs to be flaged as dirty
  1110 + mPopup.MarkDirtyForRelayout();
  1111 +
  1112 + mPopup.Show();
  1113 + }
  1114 + else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID )
  1115 + {
  1116 + mPopup = CreatePopup();
  1117 + mPopup.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1118 + mPopup.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  1119 + mPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
  1120 + mPopup.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  1121 +
  1122 + Toolkit::TableView table = Toolkit::TableView::New( 3, 1 );
  1123 + table.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1124 + table.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  1125 + table.SetFixedHeight( 0, 20.0f );
  1126 + table.SetFitHeight( 1 );
  1127 +
  1128 + {
  1129 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 0.0f, 0.0f, 1.0f ) );
  1130 + backing.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  1131 +
  1132 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fixed" );
  1133 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1134 + text.SetParentOrigin( ParentOrigin::CENTER );
  1135 + backing.Add( text );
  1136 +
  1137 + table.Add( backing );
  1138 + }
  1139 + {
  1140 + Actor backing = Toolkit::CreateSolidColorActor( Vector4( 0.0f, 1.0f, 0.0f, 1.0f ) );
  1141 + backing.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  1142 + backing.SetResizePolicy( FIXED, HEIGHT );
  1143 + backing.SetPreferredSize( Vector2( 0.0f, 200.0f ) );
  1144 +
  1145 + Toolkit::TextLabel text = Toolkit::TextLabel::New( "Fit" );
  1146 + text.SetAnchorPoint( AnchorPoint::CENTER );
  1147 + text.SetParentOrigin( ParentOrigin::CENTER );
  1148 + backing.Add( text );
  1149 +
  1150 + table.Add( backing );
  1151 + }
  1152 +
  1153 + mPopup.Add( table );
  1154 +
  1155 + // The popup is not yet on the stage so needs to be flaged as dirty
  1156 + mPopup.MarkDirtyForRelayout();
  1157 +
  1158 + mPopup.Show();
  1159 + }
  1160 + else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID )
  1161 + {
  1162 + if( mPopup )
  1163 + {
  1164 + mPopup.Hide();
  1165 + }
  1166 + }
  1167 +
  1168 + return true;
  1169 + }
  1170 +
  1171 + void OnPopupOutsideTouched()
  1172 + {
  1173 + if( mPopup )
  1174 + {
  1175 + mPopup.Hide();
  1176 + }
  1177 + }
  1178 +
  1179 + void OnKeyEvent( const KeyEvent& event )
  1180 + {
  1181 + if( event.state == KeyEvent::Down )
  1182 + {
  1183 + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
  1184 + {
  1185 + // Exit application when click back or escape.
  1186 + mApplication.Quit();
  1187 + }
  1188 + }
  1189 + }
  1190 +
  1191 +public: // From ItemFactory
  1192 +
  1193 + /**
  1194 + * @brief Return the number of items to display in the item view
  1195 + *
  1196 + * @return Return the number of items to display
  1197 + */
  1198 + virtual unsigned int GetNumberOfItems()
  1199 + {
  1200 + switch( mDemoState )
  1201 + {
  1202 + case POPUP:
  1203 + {
  1204 + return POPUP_BUTTON_ITEMS_COUNT;
  1205 + }
  1206 +
  1207 + case TABLEVIEW:
  1208 + {
  1209 + return TABLEVIEW_BUTTON_ITEMS_COUNT;
  1210 + }
  1211 +
  1212 + default:
  1213 + {
  1214 + break;
  1215 + }
  1216 + }
  1217 +
  1218 + return 0;
  1219 + }
  1220 +
  1221 + /**
  1222 + * @brief Create a new item to populate the item view with
  1223 + *
  1224 + * @param[in] itemId The index of the item to create
  1225 + * @return Return the created actor for the given ID
  1226 + */
  1227 + virtual Actor NewItem(unsigned int itemId)
  1228 + {
  1229 + const ButtonItem* buttonDataArray = NULL;
  1230 + switch( mDemoState )
  1231 + {
  1232 + case POPUP:
  1233 + {
  1234 + buttonDataArray = POPUP_BUTTON_ITEMS;
  1235 + break;
  1236 + }
  1237 +
  1238 + case TABLEVIEW:
  1239 + {
  1240 + buttonDataArray = TABLEVIEW_BUTTON_ITEMS;
  1241 + break;
  1242 + }
  1243 +
  1244 + default:
  1245 + {
  1246 + break;
  1247 + }
  1248 + }
  1249 +
  1250 + if( buttonDataArray )
  1251 + {
  1252 + Toolkit::PushButton popupButton = Toolkit::PushButton::New();
  1253 + popupButton.SetName( buttonDataArray[ itemId ].name );
  1254 + popupButton.SetLabel( buttonDataArray[ itemId ].text );
  1255 + popupButton.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
  1256 +
  1257 + popupButton.SetSelectedImage( Dali::ResourceImage::New( PUSHBUTTON_PRESS_IMAGE ) );
  1258 + popupButton.SetButtonImage( Dali::ResourceImage::New( PUSHBUTTON_BUTTON_IMAGE ) );
  1259 +
  1260 + popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked );
  1261 +
  1262 + return popupButton;
  1263 + }
  1264 +
  1265 + return Actor();
  1266 + }
  1267 +
  1268 +private:
  1269 +
  1270 + enum DemoState
  1271 + {
  1272 + POPUP,
  1273 + TABLEVIEW
  1274 + };
  1275 +
  1276 + Application& mApplication;
  1277 + Toolkit::View mView; ///< The View instance.
  1278 + Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  1279 + Layer mContentLayer; ///< Content layer
  1280 +
  1281 + Toolkit::TextLabel mTitleActor; ///< Title text
  1282 +
  1283 + Toolkit::Popup mMenu; ///< The navigation menu
  1284 + bool mMenuShown; ///< If the navigation menu is currently being displayed or not
  1285 +
  1286 + Toolkit::Popup mPopup;
  1287 +
  1288 + Toolkit::ItemView mItemView; ///< ItemView to hold test images
  1289 +
  1290 + DemoState mDemoState;
  1291 +};
  1292 +
  1293 +void RunTest( Application& application )
  1294 +{
  1295 + SizeNegotiationController test( application );
  1296 +
  1297 + application.MainLoop();
  1298 +}
  1299 +
  1300 +// Entry point for Linux & SLP applications
  1301 +//
  1302 +int main( int argc, char **argv )
  1303 +{
  1304 + Application application = Application::New( &argc, &argv );
  1305 +
  1306 + RunTest( application );
  1307 +
  1308 + return 0;
  1309 +}
examples/text-field/edit-layout-impl.cpp deleted
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 "edit-layout-impl.h"  
20 -  
21 -// INTERNAL INCLUDES  
22 -#include "edit-layout.h"  
23 -  
24 -namespace  
25 -{  
26 -  
27 -const float INNER_BORDER_TOP = 4.0f;  
28 -const float INNER_BORDER_LEFT = 20.0f;  
29 -const float INNER_BORDER_RIGHT = 20.0f;  
30 -  
31 -}  
32 -  
33 -namespace Dali  
34 -{  
35 -  
36 -namespace Toolkit  
37 -{  
38 -  
39 -namespace Internal  
40 -{  
41 -  
42 -Toolkit::EditLayout EditLayout::New()  
43 -{  
44 - // Create the implementation, temporarily owned by this handle on stack  
45 - IntrusivePtr< EditLayout > impl = new EditLayout();  
46 -  
47 - // Pass ownership to CustomActor handle  
48 - Toolkit::EditLayout handle( *impl );  
49 -  
50 - // Second-phase init of the implementation  
51 - // This can only be done after the CustomActor connection has been made...  
52 - impl->Initialize();  
53 -  
54 - return handle;  
55 -}  
56 -  
57 -void EditLayout::SetTopPanel( Dali::Toolkit::Control panel )  
58 -{  
59 - mTopPanel = panel;  
60 - mTopPanel.SetParentOrigin( ParentOrigin::TOP_CENTER );  
61 - mTopPanel.SetAnchorPoint( AnchorPoint::TOP_CENTER );  
62 - mTopPanel.SetY( INNER_BORDER_TOP );  
63 -  
64 - Self().Add( panel );  
65 -}  
66 -  
67 -EditLayout::EditLayout()  
68 -: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) )  
69 -{  
70 -}  
71 -  
72 -EditLayout::~EditLayout()  
73 -{  
74 -}  
75 -  
76 -void EditLayout::OnInitialize()  
77 -{  
78 - CustomActor self = Self();  
79 -  
80 - // Move background behind text label  
81 - Dali::Toolkit::Control::DownCast( self ).SetBackgroundColor( Color::BLUE );  
82 - self.GetChildAt(0).SetZ(-1.0f);  
83 -}  
84 -  
85 -void EditLayout::OnRelayout( const Vector2& size, ActorSizeContainer& container )  
86 -{  
87 - CustomActor self = Self();  
88 -  
89 - if( self.GetChildCount() > 0 )  
90 - {  
91 - if( mTopPanel )  
92 - {  
93 - float panelWidth = size.width - INNER_BORDER_LEFT - INNER_BORDER_RIGHT;  
94 -  
95 - float height = mTopPanel.GetHeightForWidth( panelWidth );  
96 -  
97 - mTopPanel.SetSize( Vector2(panelWidth, height) );  
98 -  
99 - container.push_back( ActorSizePair( mTopPanel, Vector2(panelWidth, height) ) );  
100 - }  
101 - }  
102 -}  
103 -  
104 -} // namespace Internal  
105 -  
106 -} // namespace Toolkit  
107 -  
108 -} // namespace Dali  
examples/text-field/edit-layout-impl.h deleted
1 -#ifndef __DALI_DEMO_EDIT_LAYOUT_IMPL_H__  
2 -#define __DALI_DEMO_EDIT_LAYOUT_IMPL_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 -// INTERNAL INCLUDES  
22 -#include "edit-layout.h"  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -  
33 -class EditLayout : public Control  
34 -{  
35 -public:  
36 - /**  
37 - * @copydoc Dali::Toollkit::TextLabel::New()  
38 - */  
39 - static Toolkit::EditLayout New();  
40 -  
41 - /**  
42 - * @copydoc Dali::Toolkit::EditLayout::SetTopPanel()  
43 - */  
44 - void SetTopPanel( Dali::Toolkit::Control panel );  
45 -  
46 - EditLayout();  
47 -  
48 - virtual ~EditLayout();  
49 -  
50 - /**  
51 - * @copydoc Control::OnInitialize()  
52 - */  
53 - virtual void OnInitialize();  
54 -  
55 - // Size negotiation methods inherited from Internal::Control  
56 -  
57 - /**  
58 - * @copydoc Control::OnRelayout()  
59 - */  
60 - virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );  
61 -  
62 -private:  
63 -  
64 - // Undefined copy constructor and assignment operators  
65 - EditLayout(const EditLayout&);  
66 - EditLayout& operator=(const EditLayout& rhs);  
67 -  
68 -private:  
69 -  
70 - Dali::Toolkit::Control mTopPanel;  
71 -};  
72 -  
73 -} // namespace Internal  
74 -  
75 -} // namespace Toolkit  
76 -  
77 -} // namespace Dali  
78 -  
79 -#endif // __DALI_DEMO_EDIT_LAYOUT_IMPL_H__  
examples/text-field/edit-layout.h deleted
1 -#ifndef __DALI_DEMO_EDIT_LAYOUT_H__  
2 -#define __DALI_DEMO_EDIT_LAYOUT_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-toolkit/dali-toolkit.h>  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -class EditLayout;  
33 -} // namespace Internal  
34 -  
35 -class EditLayout : public Toolkit::Control  
36 -{  
37 -public:  
38 - static EditLayout New();  
39 -  
40 - void SetTopPanel( Control panel );  
41 -  
42 - EditLayout();  
43 -  
44 - EditLayout( const EditLayout& handle );  
45 -  
46 - EditLayout& operator=( const EditLayout& handle );  
47 -  
48 - ~EditLayout();  
49 -  
50 - EditLayout( Internal::EditLayout& internal );  
51 -  
52 - explicit EditLayout( Dali::Internal::CustomActor* internal );  
53 -  
54 - EditLayout DownCast( BaseHandle handle );  
55 -  
56 - Internal::EditLayout& GetImpl( EditLayout& verticalLayout );  
57 -  
58 -private:  
59 -};  
60 -  
61 -} // namespace Toolkit  
62 -  
63 -} // namespace Dali  
64 -  
65 -#endif // __DALI_DEMO_EDIT_LAYOUT_H__  
examples/text-field/text-field-example.cpp
@@ -24,15 +24,14 @@ @@ -24,15 +24,14 @@
24 #include <dali-toolkit/dali-toolkit.h> 24 #include <dali-toolkit/dali-toolkit.h>
25 #include <dali/public-api/text-abstraction/text-abstraction.h> 25 #include <dali/public-api/text-abstraction/text-abstraction.h>
26 26
27 -// INTERNAL INCLUDES  
28 -#include "edit-layout.h"  
29 -  
30 using namespace Dali; 27 using namespace Dali;
31 using namespace Dali::Toolkit; 28 using namespace Dali::Toolkit;
32 29
33 namespace 30 namespace
34 { 31 {
35 32
  33 +const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
  34 +
36 const float BORDER_WIDTH = 4.0f; 35 const float BORDER_WIDTH = 4.0f;
37 36
38 } // unnamed namespace 37 } // unnamed namespace
@@ -67,16 +66,17 @@ public: @@ -67,16 +66,17 @@ public:
67 66
68 Vector2 stageSize = stage.GetSize(); 67 Vector2 stageSize = stage.GetSize();
69 68
70 - EditLayout layout = EditLayout::New();  
71 - layout.SetParentOrigin( ParentOrigin::CENTER );  
72 - layout.SetAnchorPoint( AnchorPoint::CENTER );  
73 - layout.SetSize( stageSize.width - BORDER_WIDTH*2.0f, stageSize.height*0.2f );  
74 - stage.Add( layout ); 69 + mContainer = Control::New();
  70 + mContainer.SetName( "Container" );
  71 + mContainer.SetParentOrigin( ParentOrigin::CENTER );
  72 + mContainer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  73 + mContainer.SetPreferredSize( Vector2(stageSize.width*0.6f, stageSize.width*0.6f) );
  74 + mContainer.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) );
  75 + mContainer.GetChildAt(0).SetZ(-1.0f);
  76 + stage.Add( mContainer );
75 77
76 TextField field = TextField::New(); 78 TextField field = TextField::New();
77 - field.SetParentOrigin( ParentOrigin::CENTER );  
78 - field.SetBackgroundColor( Color::BLACK );  
79 - layout.SetTopPanel( field ); 79 + mContainer.Add( field );
80 80
81 field.SetProperty( TextField::Property::TEXT, "Hello" ); 81 field.SetProperty( TextField::Property::TEXT, "Hello" );
82 82
@@ -101,6 +101,8 @@ public: @@ -101,6 +101,8 @@ public:
101 private: 101 private:
102 102
103 Application& mApplication; 103 Application& mApplication;
  104 +
  105 + Control mContainer;
104 }; 106 };
105 107
106 void RunTest( Application& application ) 108 void RunTest( Application& application )
examples/text-label-emojis/text-label-emojis.cpp
@@ -15,16 +15,14 @@ @@ -15,16 +15,14 @@
15 * 15 *
16 */ 16 */
17 17
18 -// INTERNAL INCLUDES  
19 -  
20 -#include "vertical-layout.h"  
21 -#include "emoji-strings.h"  
22 -  
23 // EXTERNAL INCLUDES 18 // EXTERNAL INCLUDES
24 #include <dali-toolkit/dali-toolkit.h> 19 #include <dali-toolkit/dali-toolkit.h>
25 #include <dali/public-api/text-abstraction/text-abstraction.h> 20 #include <dali/public-api/text-abstraction/text-abstraction.h>
26 #include <iostream> 21 #include <iostream>
27 22
  23 +// INTERNAL INCLUDES
  24 +#include "emoji-strings.h"
  25 +
28 using namespace Dali; 26 using namespace Dali;
29 using namespace Dali::Toolkit; 27 using namespace Dali::Toolkit;
30 using namespace EmojiStrings; 28 using namespace EmojiStrings;
@@ -57,32 +55,30 @@ public: @@ -57,32 +55,30 @@ public:
57 // The Init signal is received once (only) during the Application lifetime 55 // The Init signal is received once (only) during the Application lifetime
58 void Create( Application& application ) 56 void Create( Application& application )
59 { 57 {
60 -  
61 - mLayout = VerticalLayout::New();  
62 - mLayout.SetParentOrigin( ParentOrigin::TOP_LEFT );  
63 - mLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT );  
64 Stage stage = Stage::GetCurrent(); 58 Stage stage = Stage::GetCurrent();
65 - stage.Add( mLayout );  
66 stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent); 59 stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent);
67 60
  61 + mTableView = Toolkit::TableView::New( NUMBER_OF_EMOJIS, 1 );
  62 + mTableView.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  63 + mTableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  64 + mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT );
  65 + mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  66 + mTableView.TouchedSignal().Connect( this, &EmojiExample::OnTouchEvent );
  67 + stage.Add( mTableView );
  68 +
68 for( unsigned int index = 0u; index < NUMBER_OF_EMOJIS; ++index ) 69 for( unsigned int index = 0u; index < NUMBER_OF_EMOJIS; ++index )
69 { 70 {
70 const Emoji& emoji = EMOJIS[index]; 71 const Emoji& emoji = EMOJIS[index];
71 const std::string text = emoji.mUTF8 + " " + emoji.mDescription; 72 const std::string text = emoji.mUTF8 + " " + emoji.mDescription;
72 - TextLabel label = TextLabel::New(); 73 +
  74 + TextLabel label = TextLabel::New( text );
73 label.SetParentOrigin( ParentOrigin::TOP_CENTER ); 75 label.SetParentOrigin( ParentOrigin::TOP_CENTER );
74 label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); 76 label.SetAnchorPoint( AnchorPoint::TOP_CENTER );
75 label.SetProperty( TextLabel::Property::MULTI_LINE, true ); 77 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
76 - label.SetProperty( TextLabel::Property::TEXT, text );  
77 - mLayout.AddLabel( label );  
78 - mLayout.TouchedSignal().Connect( this, &EmojiExample::OnTouchEvent );  
79 - }  
80 -  
81 - const Vector2& size = stage.GetSize();  
82 - const float height = mLayout.GetHeightForWidth( size.width );  
83 - mLayout.SetSize( Size( size.width, height ) );  
84 - mLayout.TouchedSignal().Connect( this, &EmojiExample::OnTouchEvent );  
85 78
  79 + mTableView.SetFitHeight( index );
  80 + mTableView.AddChild( label, Toolkit::TableView::CellPosition( index, 0 ) );
  81 + }
86 } 82 }
87 83
88 bool OnTouchEvent( Actor actor, const TouchEvent& event ) 84 bool OnTouchEvent( Actor actor, const TouchEvent& event )
@@ -103,7 +99,7 @@ public: @@ -103,7 +99,7 @@ public:
103 { 99 {
104 if( mAnimation ) 100 if( mAnimation )
105 { 101 {
106 - mAnimation.MoveBy( mLayout, Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear ); 102 + mAnimation.MoveBy( mTableView, Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear );
107 mAnimation.Play(); 103 mAnimation.Play();
108 mLastPoint = localPoint; 104 mLastPoint = localPoint;
109 } 105 }
@@ -130,7 +126,7 @@ public: @@ -130,7 +126,7 @@ public:
130 126
131 private: 127 private:
132 Application& mApplication; 128 Application& mApplication;
133 - VerticalLayout mLayout; 129 + TableView mTableView;
134 Animation mAnimation; 130 Animation mAnimation;
135 float mLastPoint; 131 float mLastPoint;
136 }; 132 };
examples/text-label-emojis/vertical-layout-impl.cpp deleted
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 "vertical-layout-impl.h"  
20 -  
21 -// INTERNAL INCLUDES  
22 -#include "vertical-layout.h"  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -  
33 -Toolkit::VerticalLayout VerticalLayout::New()  
34 -{  
35 - // Create the implementation, temporarily owned by this handle on stack  
36 - IntrusivePtr< VerticalLayout > impl = new VerticalLayout();  
37 -  
38 - // Pass ownership to CustomActor handle  
39 - Toolkit::VerticalLayout handle( *impl );  
40 -  
41 - // Second-phase init of the implementation  
42 - // This can only be done after the CustomActor connection has been made...  
43 - impl->Initialize();  
44 -  
45 - return handle;  
46 -}  
47 -  
48 -VerticalLayout::VerticalLayout()  
49 -: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) )  
50 -{  
51 -}  
52 -  
53 -VerticalLayout::~VerticalLayout()  
54 -{  
55 -}  
56 -  
57 -void VerticalLayout::OnInitialize()  
58 -{  
59 -}  
60 -  
61 -Vector3 VerticalLayout::GetNaturalSize()  
62 -{  
63 - Vector3 size = Vector3::ZERO;  
64 -  
65 - CustomActor self = Self();  
66 - for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index )  
67 - {  
68 - Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) );  
69 -  
70 - if( label )  
71 - {  
72 - Vector3 labelSize = label.GetNaturalSize();  
73 -  
74 - size.width = ( labelSize.width > size.width ) ? labelSize.width : size.width;  
75 - size.height += labelSize.height;  
76 - }  
77 - }  
78 -  
79 - return size;  
80 -}  
81 -  
82 -float VerticalLayout::GetHeightForWidth( float width )  
83 -{  
84 - float height = 0.f;  
85 -  
86 - CustomActor self = Self();  
87 - for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index )  
88 - {  
89 - Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) );  
90 -  
91 - if( label )  
92 - {  
93 - height += label.GetHeightForWidth( width );  
94 - }  
95 - }  
96 -  
97 - return height;  
98 -}  
99 -  
100 -float VerticalLayout::GetWidthForHeight( float height )  
101 -{  
102 - return 0.f;  
103 -}  
104 -  
105 -void VerticalLayout::OnFontChange( bool defaultFontChange, bool defaultFontSizeChange )  
106 -{  
107 -}  
108 -  
109 -void VerticalLayout::OnRelayout( const Vector2& size, ActorSizeContainer& container )  
110 -{  
111 - CustomActor self = Self();  
112 -  
113 - Vector3 position;  
114 - for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index )  
115 - {  
116 - Size childSize = size;  
117 - Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) );  
118 -  
119 - if( label )  
120 - {  
121 - label.SetPosition( position );  
122 -  
123 - childSize.height = label.GetHeightForWidth( size.width );  
124 - position.height += childSize.height;  
125 -  
126 - label.SetSize( childSize );  
127 - }  
128 -  
129 - container.push_back( ActorSizePair( label, childSize ) );  
130 - }  
131 -}  
132 -  
133 -void VerticalLayout::AddLabel( Toolkit::TextLabel label )  
134 -{  
135 - Self().Add( label );  
136 -  
137 - RelayoutRequest();  
138 -}  
139 -  
140 -} // namespace Internal  
141 -  
142 -} // namespace Toolkit  
143 -  
144 -} // namespace Dali  
examples/text-label-emojis/vertical-layout-impl.h deleted
1 -#ifndef __DALI_DEMO_VERTICAL_LAYOUT_IMPL_H__  
2 -#define __DALI_DEMO_VERTICAL_LAYOUT_IMPL_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 -// INTERNAL INCLUDES  
22 -#include "vertical-layout.h"  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -  
33 -class VerticalLayout : public Control  
34 -{  
35 -public:  
36 - /**  
37 - * @copydoc Dali::Toollkit::TextLabel::New()  
38 - */  
39 - static Toolkit::VerticalLayout New();  
40 -  
41 - VerticalLayout();  
42 -  
43 - virtual ~VerticalLayout();  
44 -  
45 - /**  
46 - * @copydoc Control::OnInitialize()  
47 - */  
48 - virtual void OnInitialize();  
49 -  
50 - // Size negotiation methods inherited from Internal::Control  
51 -  
52 - /**  
53 - * @copydoc Control::GetNaturalSize()  
54 - */  
55 - virtual Vector3 GetNaturalSize();  
56 -  
57 - /**  
58 - * @copydoc Control::GetHeightForWidth()  
59 - */  
60 - virtual float GetHeightForWidth( float width );  
61 -  
62 - /**  
63 - * @copydoc Control::GetWidthForHeight()  
64 - */  
65 - virtual float GetWidthForHeight( float height );  
66 -  
67 - /**  
68 - * @copydoc Control::OnFontChange()  
69 - */  
70 - virtual void OnFontChange( bool defaultFontChange, bool defaultFontSizeChange );  
71 -  
72 - /**  
73 - * @copydoc Control::OnRelayout()  
74 - */  
75 - virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );  
76 -  
77 - void AddLabel( Toolkit::TextLabel label );  
78 -  
79 -private:  
80 - // Undefined copy constructor and assignment operators  
81 - VerticalLayout(const VerticalLayout&);  
82 - VerticalLayout& operator=(const VerticalLayout& rhs);  
83 -};  
84 -  
85 -} // namespace Internal  
86 -  
87 -} // namespace Toolkit  
88 -  
89 -} // namespace Dali  
90 -  
91 -#endif // __DALI_DEMO_VERTICAL_LAYOUT_IMPL_H__  
examples/text-label-emojis/vertical-layout.cpp deleted
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 "vertical-layout.h"  
20 -  
21 -// INTERNAL INCLUDES  
22 -#include "vertical-layout-impl.h"  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -VerticalLayout VerticalLayout::New()  
31 -{  
32 - return Internal::VerticalLayout::New();  
33 -}  
34 -  
35 -VerticalLayout::VerticalLayout()  
36 -{  
37 -}  
38 -  
39 -VerticalLayout::VerticalLayout( const VerticalLayout& handle )  
40 -: Control( handle )  
41 -{  
42 -}  
43 -  
44 -VerticalLayout& VerticalLayout::operator=( const VerticalLayout& handle )  
45 -{  
46 - if( &handle != this )  
47 - {  
48 - Control::operator=( handle );  
49 - }  
50 - return *this;  
51 -}  
52 -  
53 -VerticalLayout VerticalLayout::DownCast( BaseHandle handle )  
54 -{  
55 - return Control::DownCast<VerticalLayout, Internal::VerticalLayout>( handle );  
56 -}  
57 -  
58 -VerticalLayout::~VerticalLayout()  
59 -{  
60 -}  
61 -  
62 -VerticalLayout::VerticalLayout( Internal::VerticalLayout& internal )  
63 -: Control( internal )  
64 -{  
65 -}  
66 -  
67 -VerticalLayout::VerticalLayout( Dali::Internal::CustomActor* internal )  
68 -: Control( internal )  
69 -{  
70 -}  
71 -  
72 -void VerticalLayout::AddLabel( TextLabel label )  
73 -{  
74 - GetImpl( *this ).AddLabel( label );  
75 -}  
76 -  
77 -Internal::VerticalLayout& VerticalLayout::GetImpl( VerticalLayout& verticalLayout )  
78 -{  
79 - DALI_ASSERT_ALWAYS( verticalLayout );  
80 -  
81 - Dali::RefObject& handle = verticalLayout.GetImplementation();  
82 -  
83 - return static_cast<Internal::VerticalLayout&>(handle);  
84 -}  
85 -  
86 -} // namespace Toolkit  
87 -  
88 -} // namespace Dali  
examples/text-label-emojis/vertical-layout.h deleted
1 -#ifndef __DALI_DEMO_VERTICAL_LAYOUT_H__  
2 -#define __DALI_DEMO_VERTICAL_LAYOUT_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-toolkit/dali-toolkit.h>  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -class VerticalLayout;  
33 -} // namespace Internal  
34 -  
35 -class VerticalLayout : public Toolkit::Control  
36 -{  
37 -public:  
38 - static VerticalLayout New();  
39 -  
40 - VerticalLayout();  
41 -  
42 - VerticalLayout( const VerticalLayout& handle );  
43 -  
44 - VerticalLayout& operator=( const VerticalLayout& handle );  
45 -  
46 - ~VerticalLayout();  
47 -  
48 - VerticalLayout( Internal::VerticalLayout& internal );  
49 -  
50 - explicit VerticalLayout( Dali::Internal::CustomActor* internal );  
51 -  
52 - VerticalLayout DownCast( BaseHandle handle );  
53 -  
54 - void AddLabel( TextLabel label );  
55 -  
56 - Internal::VerticalLayout& GetImpl( VerticalLayout& verticalLayout );  
57 -  
58 -private:  
59 -};  
60 -  
61 -} // namespace Toolkit  
62 -  
63 -} // namespace Dali  
64 -  
65 -#endif // __DALI_DEMO_VERTICAL_LAYOUT_H__  
examples/text-label-multi-language/text-label-multi-language-example.cpp
@@ -21,7 +21,6 @@ @@ -21,7 +21,6 @@
21 */ 21 */
22 22
23 // INTERNAL INCLUDES 23 // INTERNAL INCLUDES
24 -#include "vertical-layout.h"  
25 #include "shared/multi-language-strings.h" 24 #include "shared/multi-language-strings.h"
26 25
27 // EXTERNAL INCLUDES 26 // EXTERNAL INCLUDES
@@ -61,33 +60,27 @@ public: @@ -61,33 +60,27 @@ public:
61 60
62 stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent); 61 stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent);
63 62
64 - mLayout = VerticalLayout::New();  
65 - mLayout.SetParentOrigin( ParentOrigin::TOP_LEFT );  
66 - mLayout.SetAnchorPoint( AnchorPoint::TOP_LEFT );  
67 -  
68 - stage.Add( mLayout ); 63 + mTableView = Toolkit::TableView::New( NUMBER_OF_LANGUAGES, 1 );
  64 + mTableView.SetResizePolicy( FILL_TO_PARENT, WIDTH );
  65 + mTableView.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
  66 + mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT );
  67 + mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  68 + mTableView.TouchedSignal().Connect( this, &TextLabelMultiLanguageExample::OnTouchEvent );
  69 + stage.Add( mTableView );
69 70
70 for( unsigned int index = 0u; index < NUMBER_OF_LANGUAGES; ++index ) 71 for( unsigned int index = 0u; index < NUMBER_OF_LANGUAGES; ++index )
71 { 72 {
72 const Language& language = LANGUAGES[index]; 73 const Language& language = LANGUAGES[index];
73 74
74 TextLabel label = TextLabel::New(); 75 TextLabel label = TextLabel::New();
75 - label.SetParentOrigin( ParentOrigin::TOP_CENTER );  
76 - label.SetAnchorPoint( AnchorPoint::TOP_CENTER );  
77 -  
78 label.SetProperty( TextLabel::Property::MULTI_LINE, true ); 76 label.SetProperty( TextLabel::Property::MULTI_LINE, true );
79 77
80 const std::string text = language.languageName + " " + language.languageRomanName + " " + language.text; 78 const std::string text = language.languageName + " " + language.languageRomanName + " " + language.text;
81 -  
82 label.SetProperty( TextLabel::Property::TEXT, text ); 79 label.SetProperty( TextLabel::Property::TEXT, text );
83 - mLayout.AddLabel( label );  
84 80
85 - mLayout.TouchedSignal().Connect( this, &TextLabelMultiLanguageExample::OnTouchEvent ); 81 + mTableView.SetFitHeight( index );
  82 + mTableView.AddChild( label, Toolkit::TableView::CellPosition( index, 0 ) );
86 } 83 }
87 -  
88 - const Vector2& size = Stage::GetCurrent().GetSize();  
89 - const float height = mLayout.GetHeightForWidth( size.width );  
90 - mLayout.SetSize( Size( size.width, height ) );  
91 } 84 }
92 85
93 bool OnTouchEvent( Actor actor, const TouchEvent& event ) 86 bool OnTouchEvent( Actor actor, const TouchEvent& event )
@@ -108,7 +101,7 @@ public: @@ -108,7 +101,7 @@ public:
108 { 101 {
109 if( mAnimation ) 102 if( mAnimation )
110 { 103 {
111 - mAnimation.MoveBy( mLayout, Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear ); 104 + mAnimation.MoveBy( mTableView, Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunctions::Linear );
112 mAnimation.Play(); 105 mAnimation.Play();
113 mLastPoint = localPoint; 106 mLastPoint = localPoint;
114 } 107 }
@@ -135,7 +128,7 @@ public: @@ -135,7 +128,7 @@ public:
135 private: 128 private:
136 129
137 Application& mApplication; 130 Application& mApplication;
138 - VerticalLayout mLayout; 131 + TableView mTableView;
139 Animation mAnimation; 132 Animation mAnimation;
140 float mLastPoint; 133 float mLastPoint;
141 }; 134 };
examples/text-label-multi-language/vertical-layout-impl.cpp deleted
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 "vertical-layout-impl.h"  
20 -  
21 -// INTERNAL INCLUDES  
22 -#include "vertical-layout.h"  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -  
33 -Toolkit::VerticalLayout VerticalLayout::New()  
34 -{  
35 - // Create the implementation, temporarily owned by this handle on stack  
36 - IntrusivePtr< VerticalLayout > impl = new VerticalLayout();  
37 -  
38 - // Pass ownership to CustomActor handle  
39 - Toolkit::VerticalLayout handle( *impl );  
40 -  
41 - // Second-phase init of the implementation  
42 - // This can only be done after the CustomActor connection has been made...  
43 - impl->Initialize();  
44 -  
45 - return handle;  
46 -}  
47 -  
48 -VerticalLayout::VerticalLayout()  
49 -: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) )  
50 -{  
51 -}  
52 -  
53 -VerticalLayout::~VerticalLayout()  
54 -{  
55 -}  
56 -  
57 -void VerticalLayout::OnInitialize()  
58 -{  
59 -}  
60 -  
61 -Vector3 VerticalLayout::GetNaturalSize()  
62 -{  
63 - Vector3 size = Vector3::ZERO;  
64 -  
65 - CustomActor self = Self();  
66 - for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index )  
67 - {  
68 - Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) );  
69 -  
70 - if( label )  
71 - {  
72 - Vector3 labelSize = label.GetNaturalSize();  
73 -  
74 - size.width = ( labelSize.width > size.width ) ? labelSize.width : size.width;  
75 - size.height += labelSize.height;  
76 - }  
77 - }  
78 -  
79 - return size;  
80 -}  
81 -  
82 -float VerticalLayout::GetHeightForWidth( float width )  
83 -{  
84 - float height = 0.f;  
85 -  
86 - CustomActor self = Self();  
87 - for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index )  
88 - {  
89 - Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) );  
90 -  
91 - if( label )  
92 - {  
93 - height += label.GetHeightForWidth( width );  
94 - }  
95 - }  
96 -  
97 - return height;  
98 -}  
99 -  
100 -float VerticalLayout::GetWidthForHeight( float height )  
101 -{  
102 - return 0.f;  
103 -}  
104 -  
105 -void VerticalLayout::OnFontChange( bool defaultFontChange, bool defaultFontSizeChange )  
106 -{  
107 -}  
108 -  
109 -void VerticalLayout::OnRelayout( const Vector2& size, ActorSizeContainer& container )  
110 -{  
111 - CustomActor self = Self();  
112 -  
113 - Vector3 position;  
114 - for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index )  
115 - {  
116 - Size childSize = size;  
117 - Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) );  
118 -  
119 - if( label )  
120 - {  
121 - label.SetPosition( position );  
122 -  
123 - childSize.height = label.GetHeightForWidth( size.width );  
124 - position.height += childSize.height;  
125 -  
126 - label.SetSize( childSize );  
127 - }  
128 -  
129 - container.push_back( ActorSizePair( label, childSize ) );  
130 - }  
131 -}  
132 -  
133 -void VerticalLayout::AddLabel( Toolkit::TextLabel label )  
134 -{  
135 - Self().Add( label );  
136 -  
137 - RelayoutRequest();  
138 -}  
139 -  
140 -} // namespace Internal  
141 -  
142 -} // namespace Toolkit  
143 -  
144 -} // namespace Dali  
examples/text-label-multi-language/vertical-layout-impl.h deleted
1 -#ifndef __DALI_DEMO_VERTICAL_LAYOUT_IMPL_H__  
2 -#define __DALI_DEMO_VERTICAL_LAYOUT_IMPL_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 -// INTERNAL INCLUDES  
22 -#include "vertical-layout.h"  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -  
33 -class VerticalLayout : public Control  
34 -{  
35 -public:  
36 - /**  
37 - * @copydoc Dali::Toollkit::TextLabel::New()  
38 - */  
39 - static Toolkit::VerticalLayout New();  
40 -  
41 - VerticalLayout();  
42 -  
43 - virtual ~VerticalLayout();  
44 -  
45 - /**  
46 - * @copydoc Control::OnInitialize()  
47 - */  
48 - virtual void OnInitialize();  
49 -  
50 - // Size negotiation methods inherited from Internal::Control  
51 -  
52 - /**  
53 - * @copydoc Control::GetNaturalSize()  
54 - */  
55 - virtual Vector3 GetNaturalSize();  
56 -  
57 - /**  
58 - * @copydoc Control::GetHeightForWidth()  
59 - */  
60 - virtual float GetHeightForWidth( float width );  
61 -  
62 - /**  
63 - * @copydoc Control::GetWidthForHeight()  
64 - */  
65 - virtual float GetWidthForHeight( float height );  
66 -  
67 - /**  
68 - * @copydoc Control::OnFontChange()  
69 - */  
70 - virtual void OnFontChange( bool defaultFontChange, bool defaultFontSizeChange );  
71 -  
72 - /**  
73 - * @copydoc Control::OnRelayout()  
74 - */  
75 - virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );  
76 -  
77 - void AddLabel( Toolkit::TextLabel label );  
78 -  
79 -private:  
80 - // Undefined copy constructor and assignment operators  
81 - VerticalLayout(const VerticalLayout&);  
82 - VerticalLayout& operator=(const VerticalLayout& rhs);  
83 -};  
84 -  
85 -} // namespace Internal  
86 -  
87 -} // namespace Toolkit  
88 -  
89 -} // namespace Dali  
90 -  
91 -#endif // __DALI_DEMO_VERTICAL_LAYOUT_IMPL_H__  
examples/text-label-multi-language/vertical-layout.cpp deleted
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 "vertical-layout.h"  
20 -  
21 -// INTERNAL INCLUDES  
22 -#include "vertical-layout-impl.h"  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -VerticalLayout VerticalLayout::New()  
31 -{  
32 - return Internal::VerticalLayout::New();  
33 -}  
34 -  
35 -VerticalLayout::VerticalLayout()  
36 -{  
37 -}  
38 -  
39 -VerticalLayout::VerticalLayout( const VerticalLayout& handle )  
40 -: Control( handle )  
41 -{  
42 -}  
43 -  
44 -VerticalLayout& VerticalLayout::operator=( const VerticalLayout& handle )  
45 -{  
46 - if( &handle != this )  
47 - {  
48 - Control::operator=( handle );  
49 - }  
50 - return *this;  
51 -}  
52 -  
53 -VerticalLayout VerticalLayout::DownCast( BaseHandle handle )  
54 -{  
55 - return Control::DownCast<VerticalLayout, Internal::VerticalLayout>( handle );  
56 -}  
57 -  
58 -VerticalLayout::~VerticalLayout()  
59 -{  
60 -}  
61 -  
62 -VerticalLayout::VerticalLayout( Internal::VerticalLayout& internal )  
63 -: Control( internal )  
64 -{  
65 -}  
66 -  
67 -VerticalLayout::VerticalLayout( Dali::Internal::CustomActor* internal )  
68 -: Control( internal )  
69 -{  
70 -}  
71 -  
72 -void VerticalLayout::AddLabel( TextLabel label )  
73 -{  
74 - GetImpl( *this ).AddLabel( label );  
75 -}  
76 -  
77 -Internal::VerticalLayout& VerticalLayout::GetImpl( VerticalLayout& verticalLayout )  
78 -{  
79 - DALI_ASSERT_ALWAYS( verticalLayout );  
80 -  
81 - Dali::RefObject& handle = verticalLayout.GetImplementation();  
82 -  
83 - return static_cast<Internal::VerticalLayout&>(handle);  
84 -}  
85 -  
86 -} // namespace Toolkit  
87 -  
88 -} // namespace Dali  
examples/text-label-multi-language/vertical-layout.h deleted
1 -#ifndef __DALI_DEMO_VERTICAL_LAYOUT_H__  
2 -#define __DALI_DEMO_VERTICAL_LAYOUT_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-toolkit/dali-toolkit.h>  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -class VerticalLayout;  
33 -} // namespace Internal  
34 -  
35 -class VerticalLayout : public Toolkit::Control  
36 -{  
37 -public:  
38 - static VerticalLayout New();  
39 -  
40 - VerticalLayout();  
41 -  
42 - VerticalLayout( const VerticalLayout& handle );  
43 -  
44 - VerticalLayout& operator=( const VerticalLayout& handle );  
45 -  
46 - ~VerticalLayout();  
47 -  
48 - VerticalLayout( Internal::VerticalLayout& internal );  
49 -  
50 - explicit VerticalLayout( Dali::Internal::CustomActor* internal );  
51 -  
52 - VerticalLayout DownCast( BaseHandle handle );  
53 -  
54 - void AddLabel( TextLabel label );  
55 -  
56 - Internal::VerticalLayout& GetImpl( VerticalLayout& verticalLayout );  
57 -  
58 -private:  
59 -};  
60 -  
61 -} // namespace Toolkit  
62 -  
63 -} // namespace Dali  
64 -  
65 -#endif // __DALI_DEMO_VERTICAL_LAYOUT_H__  
examples/text-label/center-layout-impl.cpp deleted
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 "center-layout-impl.h"  
20 -  
21 -// INTERNAL INCLUDES  
22 -#include "center-layout.h"  
23 -  
24 -namespace  
25 -{  
26 - int ConvertToEven(int value)  
27 - {  
28 - return (value % 2 == 0) ? value : (value + 1);  
29 - }  
30 -}  
31 -  
32 -namespace Dali  
33 -{  
34 -  
35 -namespace Toolkit  
36 -{  
37 -  
38 -namespace Internal  
39 -{  
40 -  
41 -Toolkit::CenterLayout CenterLayout::New()  
42 -{  
43 - // Create the implementation, temporarily owned by this handle on stack  
44 - IntrusivePtr< CenterLayout > impl = new CenterLayout();  
45 -  
46 - // Pass ownership to CustomActor handle  
47 - Toolkit::CenterLayout handle( *impl );  
48 -  
49 - // Second-phase init of the implementation  
50 - // This can only be done after the CustomActor connection has been made...  
51 - impl->Initialize();  
52 -  
53 - return handle;  
54 -}  
55 -  
56 -CenterLayout::CenterLayout()  
57 -: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) )  
58 -{  
59 -}  
60 -  
61 -CenterLayout::~CenterLayout()  
62 -{  
63 -}  
64 -  
65 -void CenterLayout::OnInitialize()  
66 -{  
67 - CustomActor self = Self();  
68 -  
69 - // Move background behind text label  
70 - Dali::Toolkit::Control::DownCast( self ).SetBackgroundColor( Vector4(0.1f,0.1f,0.1f,1.0f) );  
71 - self.GetChildAt(0).SetZ(-1.0f);  
72 -  
73 - Stage stage = Stage::GetCurrent();  
74 - Vector2 stageSize = stage.GetSize();  
75 -  
76 - // Resize the center layout when the corner is grabbed  
77 - mGrabCorner = CreateSolidColorActor( Color::GREEN );  
78 - mGrabCorner.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );  
79 - mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );  
80 - mGrabCorner.SetSize( stageSize.width*0.1f, stageSize.width*0.1f );  
81 - mGrabCorner.SetZ(1.0f);  
82 - self.Add( mGrabCorner );  
83 -  
84 - mPanGestureDetector = PanGestureDetector::New();  
85 - mPanGestureDetector.Attach( mGrabCorner );  
86 - mPanGestureDetector.DetectedSignal().Connect( this, &CenterLayout::OnPan );  
87 -}  
88 -  
89 -void CenterLayout::OnRelayout( const Vector2& size, ActorSizeContainer& container )  
90 -{  
91 - CustomActor self = Self();  
92 -  
93 - if( mLayoutSize.x <= 0.0f )  
94 - {  
95 - mLayoutSize = size;  
96 - }  
97 -  
98 - for( unsigned int i=0; i<self.GetChildCount(); ++i )  
99 - {  
100 - Dali::Toolkit::Control child = Dali::Toolkit::Control::DownCast( self.GetChildAt(i) );  
101 -  
102 - if( child )  
103 - {  
104 - child.SetParentOrigin( ParentOrigin::TOP_CENTER );  
105 - child.SetAnchorPoint( AnchorPoint::TOP_CENTER );  
106 -  
107 - const Size childSize( size );  
108 - child.SetSize( size );  
109 -  
110 - container.push_back( ActorSizePair( child, childSize ) );  
111 - }  
112 - }  
113 -}  
114 -  
115 -void CenterLayout::OnPan( Actor actor, const PanGesture& gesture )  
116 -{  
117 - mLayoutSize.x += gesture.displacement.x * 2.0f;  
118 - mLayoutSize.y += gesture.displacement.y * 2.0f;  
119 -  
120 - if( mLayoutSize.x >= 2.0f &&  
121 - mLayoutSize.y >= 2.0f )  
122 - {  
123 - // Avoid pixel mis-alignment issue  
124 - Vector2 clampedSize = Vector2( ConvertToEven(static_cast<int>(mLayoutSize.x)),  
125 - ConvertToEven(static_cast<int>(mLayoutSize.y)) );  
126 -  
127 - Self().SetSize( clampedSize );  
128 -  
129 - RelayoutRequest();  
130 - }  
131 -}  
132 -  
133 -} // namespace Internal  
134 -  
135 -} // namespace Toolkit  
136 -  
137 -} // namespace Dali  
examples/text-label/center-layout-impl.h deleted
1 -#ifndef __DALI_DEMO_CENTER_LAYOUT_IMPL_H__  
2 -#define __DALI_DEMO_CENTER_LAYOUT_IMPL_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 -// INTERNAL INCLUDES  
22 -#include "center-layout.h"  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -  
33 -class CenterLayout : public Control  
34 -{  
35 -public:  
36 - /**  
37 - * @copydoc Dali::Toollkit::TextLabel::New()  
38 - */  
39 - static Toolkit::CenterLayout New();  
40 -  
41 - CenterLayout();  
42 -  
43 - virtual ~CenterLayout();  
44 -  
45 - /**  
46 - * @copydoc Control::OnInitialize()  
47 - */  
48 - virtual void OnInitialize();  
49 -  
50 - // Size negotiation methods inherited from Internal::Control  
51 -  
52 - /**  
53 - * @copydoc Control::OnRelayout()  
54 - */  
55 - virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );  
56 -  
57 -private:  
58 -  
59 - void OnPan( Actor actor, const PanGesture& gesture );  
60 -  
61 - // Undefined copy constructor and assignment operators  
62 - CenterLayout(const CenterLayout&);  
63 - CenterLayout& operator=(const CenterLayout& rhs);  
64 -  
65 -private:  
66 -  
67 - Vector3 mLayoutSize;  
68 -  
69 - Actor mGrabCorner;  
70 -  
71 - PanGestureDetector mPanGestureDetector;  
72 -};  
73 -  
74 -} // namespace Internal  
75 -  
76 -} // namespace Toolkit  
77 -  
78 -} // namespace Dali  
79 -  
80 -#endif // __DALI_DEMO_CENTER_LAYOUT_IMPL_H__  
examples/text-label/center-layout.cpp deleted
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 "center-layout.h"  
20 -  
21 -// INTERNAL INCLUDES  
22 -#include "center-layout-impl.h"  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -CenterLayout CenterLayout::New()  
31 -{  
32 - return Internal::CenterLayout::New();  
33 -}  
34 -  
35 -CenterLayout::CenterLayout()  
36 -{  
37 -}  
38 -  
39 -CenterLayout::CenterLayout( const CenterLayout& handle )  
40 -: Control( handle )  
41 -{  
42 -}  
43 -  
44 -CenterLayout& CenterLayout::operator=( const CenterLayout& handle )  
45 -{  
46 - if( &handle != this )  
47 - {  
48 - Control::operator=( handle );  
49 - }  
50 - return *this;  
51 -}  
52 -  
53 -CenterLayout CenterLayout::DownCast( BaseHandle handle )  
54 -{  
55 - return Control::DownCast<CenterLayout, Internal::CenterLayout>( handle );  
56 -}  
57 -  
58 -CenterLayout::~CenterLayout()  
59 -{  
60 -}  
61 -  
62 -CenterLayout::CenterLayout( Internal::CenterLayout& internal )  
63 -: Control( internal )  
64 -{  
65 -}  
66 -  
67 -CenterLayout::CenterLayout( Dali::Internal::CustomActor* internal )  
68 -: Control( internal )  
69 -{  
70 -}  
71 -  
72 -Internal::CenterLayout& CenterLayout::GetImpl( CenterLayout& verticalLayout )  
73 -{  
74 - DALI_ASSERT_ALWAYS( verticalLayout );  
75 -  
76 - Dali::RefObject& handle = verticalLayout.GetImplementation();  
77 -  
78 - return static_cast<Internal::CenterLayout&>(handle);  
79 -}  
80 -  
81 -} // namespace Toolkit  
82 -  
83 -} // namespace Dali  
examples/text-label/center-layout.h deleted
1 -#ifndef __DALI_DEMO_CENTER_LAYOUT_H__  
2 -#define __DALI_DEMO_CENTER_LAYOUT_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-toolkit/dali-toolkit.h>  
23 -  
24 -namespace Dali  
25 -{  
26 -  
27 -namespace Toolkit  
28 -{  
29 -  
30 -namespace Internal  
31 -{  
32 -class CenterLayout;  
33 -} // namespace Internal  
34 -  
35 -class CenterLayout : public Toolkit::Control  
36 -{  
37 -public:  
38 - static CenterLayout New();  
39 -  
40 - CenterLayout();  
41 -  
42 - CenterLayout( const CenterLayout& handle );  
43 -  
44 - CenterLayout& operator=( const CenterLayout& handle );  
45 -  
46 - ~CenterLayout();  
47 -  
48 - CenterLayout( Internal::CenterLayout& internal );  
49 -  
50 - explicit CenterLayout( Dali::Internal::CustomActor* internal );  
51 -  
52 - CenterLayout DownCast( BaseHandle handle );  
53 -  
54 - Internal::CenterLayout& GetImpl( CenterLayout& verticalLayout );  
55 -  
56 -private:  
57 -};  
58 -  
59 -} // namespace Toolkit  
60 -  
61 -} // namespace Dali  
62 -  
63 -#endif // __DALI_DEMO_CENTER_LAYOUT_H__  
examples/text-label/text-label-example.cpp
@@ -25,7 +25,6 @@ @@ -25,7 +25,6 @@
25 #include <dali/public-api/text-abstraction/text-abstraction.h> 25 #include <dali/public-api/text-abstraction/text-abstraction.h>
26 26
27 // INTERNAL INCLUDES 27 // INTERNAL INCLUDES
28 -#include "center-layout.h"  
29 #include "shared/multi-language-strings.h" 28 #include "shared/multi-language-strings.h"
30 29
31 using namespace Dali; 30 using namespace Dali;
@@ -34,6 +33,8 @@ using namespace MultiLanguageStrings; @@ -34,6 +33,8 @@ using namespace MultiLanguageStrings;
34 33
35 namespace 34 namespace
36 { 35 {
  36 + const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "button-up.9.png";
  37 +
37 const unsigned int KEY_ZERO = 10; 38 const unsigned int KEY_ZERO = 10;
38 const unsigned int KEY_ONE = 11; 39 const unsigned int KEY_ONE = 11;
39 const unsigned int KEY_H = 43; 40 const unsigned int KEY_H = 43;
@@ -61,6 +62,11 @@ namespace @@ -61,6 +62,11 @@ namespace
61 }; 62 };
62 63
63 const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] ); 64 const unsigned int V_ALIGNMENT_STRING_COUNT = sizeof( V_ALIGNMENT_STRING_TABLE ) / sizeof( V_ALIGNMENT_STRING_TABLE[0u] );
  65 +
  66 + int ConvertToEven(int value)
  67 + {
  68 + return (value % 2 == 0) ? value : (value + 1);
  69 + }
64 } 70 }
65 71
66 /** 72 /**
@@ -91,28 +97,63 @@ public: @@ -91,28 +97,63 @@ public:
91 { 97 {
92 Stage stage = Stage::GetCurrent(); 98 Stage stage = Stage::GetCurrent();
93 99
94 - stage.SetBackgroundColor( Color::BLACK );  
95 stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent); 100 stage.KeyEventSignal().Connect(this, &TextLabelExample::OnKeyEvent);
96 Vector2 stageSize = stage.GetSize(); 101 Vector2 stageSize = stage.GetSize();
97 102
98 - CenterLayout centerLayout = CenterLayout::New();  
99 - centerLayout.SetParentOrigin( ParentOrigin::CENTER );  
100 - centerLayout.SetSize( stageSize.width*0.6f, stageSize.width*0.6f );  
101 - stage.Add( centerLayout );  
102 -  
103 - mLabel = TextLabel::New();  
104 - mLabel.SetBackgroundColor( Vector4(0.3f,0.3f,0.6f,1.0f) );  
105 - centerLayout.Add( mLabel );  
106 - 103 + mContainer = Control::New();
  104 + mContainer.SetName( "Container" );
  105 + mContainer.SetParentOrigin( ParentOrigin::CENTER );
  106 + mContainer.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  107 + mLayoutSize = Vector2(stageSize.width*0.6f, stageSize.width*0.6f);
  108 + mContainer.SetPreferredSize( mLayoutSize );
  109 + mContainer.SetBackgroundImage( ResourceImage::New( BACKGROUND_IMAGE ) );
  110 + mContainer.GetChildAt(0).SetZ(-1.0f);
  111 + stage.Add( mContainer );
  112 +
  113 + // Resize the center layout when the corner is grabbed
  114 + mGrabCorner = Control::New();
  115 + mGrabCorner.SetName( "GrabCorner" );
  116 + mGrabCorner.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT );
  117 + mGrabCorner.SetParentOrigin( ParentOrigin::BOTTOM_RIGHT );
  118 + mGrabCorner.SetResizePolicy( FIXED, ALL_DIMENSIONS );
  119 + mGrabCorner.SetPreferredSize( Vector2(stageSize.width*0.1f, stageSize.width*0.1f) );
  120 + mGrabCorner.SetZ(1.0f);
  121 + mContainer.Add( mGrabCorner );
  122 +
  123 + mPanGestureDetector = PanGestureDetector::New();
  124 + mPanGestureDetector.Attach( mGrabCorner );
  125 + mPanGestureDetector.DetectedSignal().Connect( this, &TextLabelExample::OnPan );
  126 +
  127 + mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" );
  128 + mLabel.SetName( "TextLabel" );
  129 + mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  130 + mLabel.SetResizePolicy( FILL_TO_PARENT, HEIGHT );
107 mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); 131 mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true );
108 - mLabel.SetProperty( TextLabel::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );  
109 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) ); 132 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
110 mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); 133 mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
  134 + mContainer.Add( mLabel );
111 135
112 Property::Value labelText = mLabel.GetProperty( TextLabel::Property::TEXT ); 136 Property::Value labelText = mLabel.GetProperty( TextLabel::Property::TEXT );
113 std::cout << "Displaying text: \"" << labelText.Get< std::string >() << "\"" << std::endl; 137 std::cout << "Displaying text: \"" << labelText.Get< std::string >() << "\"" << std::endl;
114 } 138 }
115 139
  140 + // Resize the text-label with pan gesture
  141 + void OnPan( Actor actor, const PanGesture& gesture )
  142 + {
  143 + mLayoutSize.x += gesture.displacement.x * 2.0f;
  144 + mLayoutSize.y += gesture.displacement.y * 2.0f;
  145 +
  146 + if( mLayoutSize.x >= 2.0f &&
  147 + mLayoutSize.y >= 2.0f )
  148 + {
  149 + // Avoid pixel mis-alignment issue
  150 + Vector2 clampedSize = Vector2( ConvertToEven(static_cast<int>(mLayoutSize.x)),
  151 + ConvertToEven(static_cast<int>(mLayoutSize.y)) );
  152 +
  153 + mContainer.SetPreferredSize( clampedSize );
  154 + }
  155 + }
  156 +
116 /** 157 /**
117 * Main key event handler 158 * Main key event handler
118 */ 159 */
@@ -206,6 +247,13 @@ private: @@ -206,6 +247,13 @@ private:
206 247
207 TextLabel mLabel; 248 TextLabel mLabel;
208 249
  250 + Control mContainer;
  251 + Actor mGrabCorner;
  252 +
  253 + PanGestureDetector mPanGestureDetector;
  254 +
  255 + Vector2 mLayoutSize;
  256 +
209 unsigned int mLanguageId; 257 unsigned int mLanguageId;
210 unsigned int mAlignment; 258 unsigned int mAlignment;
211 }; 259 };
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.34 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
@@ -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
@@ -66,10 +66,12 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar, @@ -66,10 +66,12 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar,
66 Dali::Stage stage = Dali::Stage::GetCurrent(); 66 Dali::Stage stage = Dali::Stage::GetCurrent();
67 67
68 Dali::Layer toolBarLayer = Dali::Layer::New(); 68 Dali::Layer toolBarLayer = Dali::Layer::New();
  69 + toolBarLayer.SetName( "TOOLBAR_LAYER" );
69 toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); 70 toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
70 toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); 71 toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
71 - toolBarLayer.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::SourceWidthFixedHeight( style.mToolBarHeight ) ) );  
72 - toolBarLayer.SetSize( 0.0f, style.mToolBarHeight ); 72 + toolBarLayer.SetPreferredSize( Dali::Vector2( 0.0f, style.mToolBarHeight ) );
  73 + toolBarLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::WIDTH );
  74 + toolBarLayer.SetResizePolicy( Dali::FIXED, Dali::HEIGHT );
73 75
74 // Raise tool bar layer to the top. 76 // Raise tool bar layer to the top.
75 toolBarLayer.RaiseToTop(); 77 toolBarLayer.RaiseToTop();
@@ -77,12 +79,14 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar, @@ -77,12 +79,14 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar&amp; toolBar,
77 // Tool bar 79 // Tool bar
78 Dali::Image image = Dali::ResourceImage::New( toolbarImagePath ); 80 Dali::Image image = Dali::ResourceImage::New( toolbarImagePath );
79 Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image ); 81 Dali::ImageActor toolBarBackground = Dali::ImageActor::New( image );
  82 + toolBarBackground.SetName( "TOOLBAR_BACKGROUND" );
  83 + toolBarBackground.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
80 toolBar = Dali::Toolkit::ToolBar::New(); 84 toolBar = Dali::Toolkit::ToolBar::New();
  85 + toolBar.SetName( "TOOLBAR" );
81 toolBar.SetBackground( toolBarBackground ); 86 toolBar.SetBackground( toolBarBackground );
82 toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); 87 toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
83 toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); 88 toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
84 - toolBar.SetSize( 0.0f, style.mToolBarHeight );  
85 - toolBar.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT ); 89 + toolBar.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
86 toolBarBackground.SetSortModifier(1.0f); 90 toolBarBackground.SetSortModifier(1.0f);
87 91
88 // Add the tool bar to the too bar layer. 92 // Add the tool bar to the too bar layer.
@@ -118,6 +122,7 @@ Dali::Layer CreateView( Dali::Application&amp; application, @@ -118,6 +122,7 @@ Dali::Layer CreateView( Dali::Application&amp; application,
118 122
119 // Create default View. 123 // Create default View.
120 view = Dali::Toolkit::View::New(); 124 view = Dali::Toolkit::View::New();
  125 + view.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
121 126
122 // Add the view to the stage before setting the background. 127 // Add the view to the stage before setting the background.
123 stage.Add( view ); 128 stage.Add( view );
@@ -144,13 +149,11 @@ Dali::Layer CreateView( Dali::Application&amp; application, @@ -144,13 +149,11 @@ Dali::Layer CreateView( Dali::Application&amp; application,
144 // Add tool bar layer to the view. 149 // Add tool bar layer to the view.
145 view.AddContentLayer( toolBarLayer ); 150 view.AddContentLayer( toolBarLayer );
146 151
147 -  
148 -  
149 // Create a content layer. 152 // Create a content layer.
150 Dali::Layer contentLayer = Dali::Layer::New(); 153 Dali::Layer contentLayer = Dali::Layer::New();
151 contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER ); 154 contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER );
152 contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER ); 155 contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER );
153 - contentLayer.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT ); 156 + contentLayer.SetResizePolicy( Dali::FILL_TO_PARENT, Dali::ALL_DIMENSIONS );
154 view.AddContentLayer( contentLayer ); 157 view.AddContentLayer( contentLayer );
155 contentLayer.LowerBelow( toolBarLayer ); 158 contentLayer.LowerBelow( toolBarLayer );
156 159