Commit ae3d255070ab65633817672687dda381c4192092

Authored by Adeel Kazmi
1 parent bb5db46e

Updates after ItemLayout changes

- ItemView Demo:
  - Fade in/out animation between layouts
  - Removed menu
  - No animations when adding/deleting/replacing items
  - Items in spiral layout are a lot closer together

- Builder Examples Demo
  - No visible changes

- Size Negotiation Demo
  - One button per line rather than two

Change-Id: I2d50a49e49fb2271f41715daec74469ea2aa112b
examples/builder/examples.cpp
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 // 20 //
21 //------------------------------------------------------------------------------ 21 //------------------------------------------------------------------------------
22 22
23 -#include "dali.h" 23 +#include <dali/dali.h>
24 #include <dali-toolkit/dali-toolkit.h> 24 #include <dali-toolkit/dali-toolkit.h>
25 #include <dali-toolkit/public-api/builder/builder.h> 25 #include <dali-toolkit/public-api/builder/builder.h>
26 #include <dali-toolkit/public-api/builder/tree-node.h> 26 #include <dali-toolkit/public-api/builder/tree-node.h>
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 36
37 #include "sys/stat.h" 37 #include "sys/stat.h"
38 #include <ctime> 38 #include <ctime>
  39 +#include <cstring>
39 40
40 #include <dali/integration-api/debug.h> 41 #include <dali/integration-api/debug.h>
41 #include "shared/view.h" 42 #include "shared/view.h"
@@ -141,11 +142,6 @@ const std::string ShortName( const std::string&amp; name ) @@ -141,11 +142,6 @@ const std::string ShortName( const std::string&amp; name )
141 } 142 }
142 } 143 }
143 144
144 -static Vector3 SetItemSize(unsigned int numberOfColumns, float layoutWidth, float sideMargin, float columnSpacing)  
145 -{  
146 - return Vector3(layoutWidth, 50, 1);  
147 -}  
148 -  
149 //------------------------------------------------------------------------------ 145 //------------------------------------------------------------------------------
150 // 146 //
151 // 147 //
@@ -291,14 +287,11 @@ public: @@ -291,14 +287,11 @@ public:
291 stage.Add( mItemView ); 287 stage.Add( mItemView );
292 mItemView.SetParentOrigin(ParentOrigin::CENTER); 288 mItemView.SetParentOrigin(ParentOrigin::CENTER);
293 mItemView.SetAnchorPoint(AnchorPoint::CENTER); 289 mItemView.SetAnchorPoint(AnchorPoint::CENTER);
294 - mGridLayout = GridLayout::New();  
295 - mGridLayout->SetNumberOfColumns(1);  
296 -  
297 - mGridLayout->SetItemSizeFunction(SetItemSize); 290 + mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST );
298 291
299 - mGridLayout->SetTopMargin(DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight); 292 + mLayout->SetItemSize( Vector3( stage.GetSize().width, 50, 1 ) );
300 293
301 - mItemView.AddLayout(*mGridLayout); 294 + mItemView.AddLayout( *mLayout );
302 295
303 Vector3 size(stage.GetSize()); 296 Vector3 size(stage.GetSize());
304 mItemView.ActivateLayout(0, size, 0.0f/*immediate*/); 297 mItemView.ActivateLayout(0, size, 0.0f/*immediate*/);
@@ -585,7 +578,7 @@ public: @@ -585,7 +578,7 @@ public:
585 private: 578 private:
586 Application& mApp; 579 Application& mApp;
587 580
588 - GridLayoutPtr mGridLayout; 581 + ItemLayoutPtr mLayout;
589 ItemView mItemView; 582 ItemView mItemView;
590 583
591 Toolkit::Control mView; 584 Toolkit::Control mView;
examples/image-scaling-irregular-grid/grid-flags.h
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 * 17 *
18 */ 18 */
19 #include <algorithm> 19 #include <algorithm>
  20 +#include <cassert>
20 #include <dali/dali.h> 21 #include <dali/dali.h>
21 22
22 /** Controls the output of application logging. */ 23 /** Controls the output of application logging. */
examples/item-view/item-view-example.cpp
@@ -103,16 +103,6 @@ const unsigned int IMAGE_WIDTH = 256; @@ -103,16 +103,6 @@ const unsigned int IMAGE_WIDTH = 256;
103 const unsigned int IMAGE_HEIGHT = 256; 103 const unsigned int IMAGE_HEIGHT = 256;
104 const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8; 104 const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8;
105 105
106 -AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunction(AlphaFunction::LINEAR),  
107 - AlphaFunction(AlphaFunction::EASE_IN),  
108 - AlphaFunction(AlphaFunction::EASE_OUT) };  
109 -  
110 -const unsigned int NUM_ALPHA_FUNCTIONS = sizeof(ALPHA_FUNCTIONS) / sizeof(AlphaFunction);  
111 -  
112 -const char* ALPHA_FUNCTIONS_TEXT[] = { "Linear",  
113 - "EaseIn",  
114 - "EaseOut" };  
115 -  
116 const char* BACKGROUND_IMAGE( "" ); 106 const char* BACKGROUND_IMAGE( "" );
117 const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" ); 107 const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
118 const char* EDIT_IMAGE( DALI_IMAGE_DIR "icon-edit.png" ); 108 const char* EDIT_IMAGE( DALI_IMAGE_DIR "icon-edit.png" );
@@ -138,20 +128,10 @@ const float ITEM_IMAGE_BORDER_RIGHT = 13.0f; @@ -138,20 +128,10 @@ const float ITEM_IMAGE_BORDER_RIGHT = 13.0f;
138 const float ITEM_IMAGE_BORDER_TOP = 13.0f; 128 const float ITEM_IMAGE_BORDER_TOP = 13.0f;
139 const float ITEM_IMAGE_BORDER_BOTTOM = 13.0f; 129 const float ITEM_IMAGE_BORDER_BOTTOM = 13.0f;
140 130
141 -const unsigned int DEPTH_LAYOUT_ROWS_PORTRAIT = 26;  
142 -const unsigned int DEPTH_LAYOUT_ROWS_LANDSCAPE = 16;  
143 -const float DEPTH_LAYOUT_TILT_ANGLE_PORTRAIT = 25.0f;  
144 -const float DEPTH_LAYOUT_TILT_ANGLE_LANDSCAPE = 21.0f;  
145 -const float DEPTH_LAYOUT_ROW_SPACING_FACTOR = 0.1f;  
146 const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT = 1.0f; 131 const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT = 1.0f;
147 const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE = 0.8f; 132 const float DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE = 0.8f;
148 -const float DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_PORTRAIT = 0.2f;  
149 -const float DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_LANDSCAPE = 0.1f; 133 +const float DEPTH_LAYOUT_COLUMNS = 3.0f;
150 134
151 -const float SPIRAL_LAYOUT_REVOLUTION_NUMBER_PORTRAIT = 4.5f;  
152 -const float SPIRAL_LAYOUT_REVOLUTION_NUMBER_LANDSCAPE = 2.5f;  
153 -  
154 -const float DEPTH_LAYOUT_HEIGHT_SCALE = 20.0f;  
155 const float MIN_SWIPE_DISTANCE = 15.0f; 135 const float MIN_SWIPE_DISTANCE = 15.0f;
156 const float MIN_SWIPE_SPEED = 5.0f; 136 const float MIN_SWIPE_SPEED = 5.0f;
157 137
@@ -162,33 +142,23 @@ const float LABEL_TEXT_SIZE_Y = 20.0f; @@ -162,33 +142,23 @@ const float LABEL_TEXT_SIZE_Y = 20.0f;
162 142
163 const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f ); 143 const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f );
164 144
165 -static Vector3 DepthLayoutItemSizeFunctionPortrait(unsigned int numberOfColumns, float layoutWidth) 145 +static Vector3 DepthLayoutItemSizeFunctionPortrait( float layoutWidth )
166 { 146 {
167 - float width = (layoutWidth / static_cast<float>(numberOfColumns + 1)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT; 147 + float width = ( layoutWidth / ( DEPTH_LAYOUT_COLUMNS + 1.0f ) ) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT;
168 148
169 // 1x1 aspect ratio 149 // 1x1 aspect ratio
170 return Vector3(width, width, width); 150 return Vector3(width, width, width);
171 } 151 }
172 152
173 -static Vector3 DepthLayoutItemSizeFunctionLandscape(unsigned int numberOfColumns, float layoutWidth) 153 +static Vector3 DepthLayoutItemSizeFunctionLandscape( float layoutWidth )
174 { 154 {
175 - float width = (layoutWidth / static_cast<float>(numberOfColumns + 1)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE; 155 + float width = ( layoutWidth / ( DEPTH_LAYOUT_COLUMNS + 1.0f ) ) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_LANDSCAPE;
176 156
177 // 1x1 aspect ratio 157 // 1x1 aspect ratio
178 return Vector3(width, width, width); 158 return Vector3(width, width, width);
179 } 159 }
180 160
181 -static float DepthLayoutBottomMarginFunctionPortrait(float layoutHeight)  
182 -{  
183 - return layoutHeight * DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_PORTRAIT;  
184 -}  
185 -  
186 -static float DepthLayoutBottomMarginFunctionLandscape(float layoutHeight)  
187 -{  
188 - return layoutHeight * DEPTH_LAYOUT_BOTTOM_MARGIN_FACTOR_LANDSCAPE;  
189 -}  
190 -  
191 -} 161 +} // unnamed namespace
192 162
193 /** 163 /**
194 * This example shows how to use ItemView UI control. 164 * This example shows how to use ItemView UI control.
@@ -219,11 +189,9 @@ public: @@ -219,11 +189,9 @@ public:
219 ItemViewExample( Application& application ) 189 ItemViewExample( Application& application )
220 : mApplication( application ), 190 : mApplication( application ),
221 mMode( MODE_NORMAL ), 191 mMode( MODE_NORMAL ),
222 - mMenuShown( false ),  
223 mOrientation( 0 ), 192 mOrientation( 0 ),
224 mCurrentLayout( SPIRAL_LAYOUT ), 193 mCurrentLayout( SPIRAL_LAYOUT ),
225 - mDurationSeconds( 1.0f ),  
226 - mAlphaFuncIndex( 0u ) 194 + mDurationSeconds( 0.25f )
227 { 195 {
228 // Connect to the Application's Init signal 196 // Connect to the Application's Init signal
229 mApplication.InitSignal().Connect(this, &ItemViewExample::OnInit); 197 mApplication.InitSignal().Connect(this, &ItemViewExample::OnInit);
@@ -321,9 +289,9 @@ public: @@ -321,9 +289,9 @@ public:
321 stage.Add( mItemView ); 289 stage.Add( mItemView );
322 290
323 // Create the layouts 291 // Create the layouts
324 - mSpiralLayout = SpiralLayout::New();  
325 - mDepthLayout = DepthLayout::New();  
326 - mGridLayout = GridLayout::New(); 292 + mSpiralLayout = DefaultItemLayout::New( DefaultItemLayout::SPIRAL );
  293 + mDepthLayout = DefaultItemLayout::New( DefaultItemLayout::DEPTH );
  294 + mGridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
327 295
328 // Add the layouts to item view 296 // Add the layouts to item view
329 mItemView.AddLayout(*mSpiralLayout); 297 mItemView.AddLayout(*mSpiralLayout);
@@ -334,7 +302,7 @@ public: @@ -334,7 +302,7 @@ public:
334 mItemView.SetMinimumSwipeSpeed(MIN_SWIPE_SPEED); 302 mItemView.SetMinimumSwipeSpeed(MIN_SWIPE_SPEED);
335 303
336 // Activate the spiral layout 304 // Activate the spiral layout
337 - UseLayout(mCurrentLayout, 0.0f); 305 + SetLayout( mCurrentLayout );
338 mItemView.SetKeyboardFocusable( true ); 306 mItemView.SetKeyboardFocusable( true );
339 KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &ItemViewExample::OnKeyboardPreFocusChange ); 307 KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &ItemViewExample::OnKeyboardPreFocusChange );
340 308
@@ -357,49 +325,45 @@ public: @@ -357,49 +325,45 @@ public:
357 } 325 }
358 326
359 /** 327 /**
  328 + * Animate to a different layout
  329 + */
  330 + void ChangeLayout()
  331 + {
  332 + Animation animation = Animation::New( mDurationSeconds );
  333 + animation.FinishedSignal().Connect( this, &ItemViewExample::AnimationFinished );
  334 + animation.AnimateTo( Property( mItemView, Actor::Property::COLOR_ALPHA ), 0.0f );
  335 + animation.Play();
  336 + }
  337 +
  338 + void AnimationFinished( Animation& )
  339 + {
  340 + SetLayout( mCurrentLayout );
  341 +
  342 + Animation animation = Animation::New( mDurationSeconds );
  343 + animation.AnimateTo( Property( mItemView, Actor::Property::COLOR_ALPHA ), 1.0f );
  344 + animation.Play();
  345 + }
  346 +
  347 + /**
360 * Switch to a different item view layout 348 * Switch to a different item view layout
361 */ 349 */
362 - void UseLayout(int layoutId, float duration) 350 + void SetLayout( int layoutId )
363 { 351 {
364 // Set the new orientation to the layout 352 // Set the new orientation to the layout
365 mItemView.GetLayout(layoutId)->SetOrientation(static_cast<ControlOrientation::Type>(mOrientation / 90)); 353 mItemView.GetLayout(layoutId)->SetOrientation(static_cast<ControlOrientation::Type>(mOrientation / 90));
366 354
367 Vector2 stageSize = Stage::GetCurrent().GetSize(); 355 Vector2 stageSize = Stage::GetCurrent().GetSize();
368 356
369 - if(layoutId == SPIRAL_LAYOUT)  
370 - {  
371 - mSpiralLayout->SetRevolutionDistance(stageSize.height / Stage::GetCurrent().GetDpi().y * 45.0f);  
372 - }  
373 -  
374 - if(layoutId == GRID_LAYOUT)  
375 - {  
376 - // Set up the grid layout according to the new orientation  
377 - float layoutWidth = Toolkit::IsHorizontal(mGridLayout->GetOrientation()) ? stageSize.height : stageSize.width;  
378 - float gridItemSize = (layoutWidth / mGridLayout->GetNumberOfColumns()) * 0.5f;  
379 - mGridLayout->SetScrollSpeedFactor(mGridLayout->GetNumberOfColumns() / gridItemSize);  
380 -  
381 - float toolbarHeight = mToolBar.GetCurrentSize().y;  
382 - mGridLayout->SetTopMargin(toolbarHeight + mGridLayout->GetRowSpacing());  
383 - }  
384 -  
385 if(layoutId == DEPTH_LAYOUT) 357 if(layoutId == DEPTH_LAYOUT)
386 { 358 {
387 // Set up the depth layout according to the new orientation 359 // Set up the depth layout according to the new orientation
388 if(Toolkit::IsVertical(mDepthLayout->GetOrientation())) 360 if(Toolkit::IsVertical(mDepthLayout->GetOrientation()))
389 { 361 {
390 - mDepthLayout->SetRowSpacing(stageSize.height * DEPTH_LAYOUT_ROW_SPACING_FACTOR);  
391 - mDepthLayout->SetNumberOfRows(DEPTH_LAYOUT_ROWS_PORTRAIT);  
392 - mDepthLayout->SetTiltAngle( Degree( DEPTH_LAYOUT_TILT_ANGLE_PORTRAIT - mDepthLayout->GetNumberOfColumns() ) );  
393 - mDepthLayout->SetItemSizeFunction(DepthLayoutItemSizeFunctionPortrait);  
394 - mDepthLayout->SetBottomMarginFunction(DepthLayoutBottomMarginFunctionPortrait); 362 + mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionPortrait( stageSize.width ) );
395 } 363 }
396 else 364 else
397 { 365 {
398 - mDepthLayout->SetRowSpacing(stageSize.width * DEPTH_LAYOUT_ROW_SPACING_FACTOR);  
399 - mDepthLayout->SetNumberOfRows(DEPTH_LAYOUT_ROWS_LANDSCAPE);  
400 - mDepthLayout->SetTiltAngle( Degree( DEPTH_LAYOUT_TILT_ANGLE_LANDSCAPE - mDepthLayout->GetNumberOfColumns() ) );  
401 - mDepthLayout->SetItemSizeFunction(DepthLayoutItemSizeFunctionLandscape);  
402 - mDepthLayout->SetBottomMarginFunction(DepthLayoutBottomMarginFunctionLandscape); 366 + mDepthLayout->SetItemSize( DepthLayoutItemSizeFunctionLandscape( stageSize.height ) );
403 } 367 }
404 } 368 }
405 369
@@ -407,7 +371,7 @@ public: @@ -407,7 +371,7 @@ public:
407 mItemView.SetAnchoring(layoutId == DEPTH_LAYOUT); 371 mItemView.SetAnchoring(layoutId == DEPTH_LAYOUT);
408 372
409 // Activate the layout 373 // Activate the layout
410 - mItemView.ActivateLayout(layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), duration); 374 + mItemView.ActivateLayout( layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
411 } 375 }
412 376
413 /** 377 /**
@@ -424,7 +388,7 @@ public: @@ -424,7 +388,7 @@ public:
424 // Remember orientation 388 // Remember orientation
425 mOrientation = angle; 389 mOrientation = angle;
426 390
427 - UseLayout(mCurrentLayout, mDurationSeconds); 391 + SetLayout( mCurrentLayout );
428 } 392 }
429 } 393 }
430 394
@@ -433,7 +397,7 @@ public: @@ -433,7 +397,7 @@ public:
433 // Switch to the next layout 397 // Switch to the next layout
434 mCurrentLayout = (mCurrentLayout + 1) % mItemView.GetLayoutCount(); 398 mCurrentLayout = (mCurrentLayout + 1) % mItemView.GetLayoutCount();
435 399
436 - UseLayout(mCurrentLayout, mDurationSeconds); 400 + ChangeLayout();
437 401
438 SetLayoutTitle(); 402 SetLayoutTitle();
439 SetLayoutImage(); 403 SetLayoutImage();
@@ -973,100 +937,6 @@ private: @@ -973,100 +937,6 @@ private:
973 mTitleActor.SetProperty( TextLabel::Property::TEXT, title ); 937 mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
974 } 938 }
975 939
976 - void ShowMenu()  
977 - {  
978 - Stage stage = Stage::GetCurrent();  
979 - const float popupWidth = stage.GetSize().x * 0.75f;  
980 -  
981 - mMenu = Toolkit::Popup::New();  
982 - mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );  
983 - mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );  
984 - mMenu.SetSize( popupWidth, MENU_OPTION_HEIGHT * 2 );  
985 - mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu );  
986 -  
987 - TableView tableView = TableView::New( 0, 0 );  
988 - tableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );  
989 - mMenu.Add( tableView );  
990 -  
991 - Slider slider = Slider::New();  
992 - slider.SetProperty( Slider::Property::LOWER_BOUND, 0.0f );  
993 - slider.SetProperty( Slider::Property::UPPER_BOUND, 3.0f );  
994 - slider.SetProperty( Slider::Property::VALUE, mDurationSeconds );  
995 - slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 );  
996 - slider.SetProperty( Slider::Property::SHOW_POPUP, true );  
997 - slider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );  
998 - slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange );  
999 - tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) );  
1000 -  
1001 - TextLabel text = TextLabel::New( "Duration" );  
1002 - text.SetAnchorPoint( ParentOrigin::TOP_LEFT );  
1003 - text.SetParentOrigin( ParentOrigin::TOP_LEFT );  
1004 - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );  
1005 - text.SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );  
1006 - text.SetSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );  
1007 - slider.Add( text );  
1008 -  
1009 - Actor textContainer = Actor::New();  
1010 - textContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );  
1011 - mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] );  
1012 - mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER );  
1013 - mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER );  
1014 - textContainer.Add( mAlphaFunctionText );  
1015 - tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) );  
1016 -  
1017 - mTapDetector = TapGestureDetector::New();  
1018 - mTapDetector.Attach(mAlphaFunctionText);  
1019 - mTapDetector.DetectedSignal().Connect( this, &ItemViewExample::ChangeAlphaFunctionOnTap );  
1020 -  
1021 - text = TextLabel::New( "Alpha Function" );  
1022 - text.SetAnchorPoint( ParentOrigin::TOP_LEFT );  
1023 - text.SetParentOrigin( ParentOrigin::TOP_LEFT );  
1024 - text.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );  
1025 - text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y );  
1026 - textContainer.Add( text );  
1027 -  
1028 - mMenu.Show();  
1029 - mMenuShown = true;  
1030 - }  
1031 -  
1032 - bool SliderValueChange( Toolkit::Slider slider, float value )  
1033 - {  
1034 - mDurationSeconds = value;  
1035 -  
1036 - return true;  
1037 - }  
1038 -  
1039 - void ChangeAlphaFunctionOnTap( Actor actor, const TapGesture& tap )  
1040 - {  
1041 - if( NUM_ALPHA_FUNCTIONS <= ++mAlphaFuncIndex )  
1042 - {  
1043 - mAlphaFuncIndex = 0;  
1044 - }  
1045 -  
1046 - if( mAlphaFunctionText )  
1047 - {  
1048 - mAlphaFunctionText.SetProperty( TextLabel::Property::TEXT, std::string(ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex]) );  
1049 - }  
1050 -  
1051 - if( mItemView )  
1052 - {  
1053 - mItemView.GetActiveLayout()->SetAlphaFunction( ALPHA_FUNCTIONS[mAlphaFuncIndex] );  
1054 - }  
1055 - }  
1056 -  
1057 - void HideMenu()  
1058 - {  
1059 - mTapDetector.Reset();  
1060 -  
1061 - if( mMenu )  
1062 - {  
1063 - mMenu.Hide();  
1064 - mMenu.Reset();  
1065 - }  
1066 -  
1067 - mMenuShown = false;  
1068 - }  
1069 -  
1070 /** 940 /**
1071 * Main key event handler 941 * Main key event handler
1072 */ 942 */
@@ -1074,27 +944,9 @@ private: @@ -1074,27 +944,9 @@ private:
1074 { 944 {
1075 if(event.state == KeyEvent::Down) 945 if(event.state == KeyEvent::Down)
1076 { 946 {
1077 - if( IsKey( event, DALI_KEY_MENU ) )  
1078 - {  
1079 - if( mMenuShown )  
1080 - {  
1081 - HideMenu();  
1082 - }  
1083 - else  
1084 - {  
1085 - ShowMenu();  
1086 - }  
1087 - }  
1088 - else if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) 947 + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
1089 { 948 {
1090 - if( mMenuShown )  
1091 - {  
1092 - HideMenu();  
1093 - }  
1094 - else  
1095 - {  
1096 - mApplication.Quit();  
1097 - } 949 + mApplication.Quit();
1098 } 950 }
1099 } 951 }
1100 } 952 }
@@ -1103,7 +955,6 @@ private: @@ -1103,7 +955,6 @@ private:
1103 955
1104 Application& mApplication; 956 Application& mApplication;
1105 Mode mMode; 957 Mode mMode;
1106 - bool mMenuShown;  
1107 958
1108 Toolkit::Control mView; 959 Toolkit::Control mView;
1109 unsigned int mOrientation; 960 unsigned int mOrientation;
@@ -1117,11 +968,9 @@ private: @@ -1117,11 +968,9 @@ private:
1117 unsigned int mCurrentLayout; 968 unsigned int mCurrentLayout;
1118 float mDurationSeconds; 969 float mDurationSeconds;
1119 970
1120 - SpiralLayoutPtr mSpiralLayout;  
1121 - DepthLayoutPtr mDepthLayout;  
1122 - GridLayoutPtr mGridLayout;  
1123 -  
1124 - Toolkit::Popup mMenu; 971 + ItemLayoutPtr mSpiralLayout;
  972 + ItemLayoutPtr mDepthLayout;
  973 + ItemLayoutPtr mGridLayout;
1125 974
1126 TapGestureDetector mTapDetector; 975 TapGestureDetector mTapDetector;
1127 Toolkit::PushButton mLayoutButton; 976 Toolkit::PushButton mLayoutButton;
@@ -1129,8 +978,6 @@ private: @@ -1129,8 +978,6 @@ private:
1129 Toolkit::PushButton mInsertButton; 978 Toolkit::PushButton mInsertButton;
1130 Toolkit::PushButton mReplaceButton; 979 Toolkit::PushButton mReplaceButton;
1131 980
1132 - unsigned int mAlphaFuncIndex;  
1133 - TextLabel mAlphaFunctionText;  
1134 BufferImage mWhiteImage; 981 BufferImage mWhiteImage;
1135 }; 982 };
1136 983
examples/refraction-effect/refraction-effect-example.cpp
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
21 21
22 #include <fstream> 22 #include <fstream>
23 #include <sstream> 23 #include <sstream>
  24 +#include <limits>
24 25
25 using namespace Dali; 26 using namespace Dali;
26 27
examples/size-negotiation/size-negotiation-example.cpp
@@ -193,17 +193,13 @@ public: @@ -193,17 +193,13 @@ public:
193 mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); 193 mItemView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
194 194
195 // Use a grid layout for tests 195 // Use a grid layout for tests
196 - Toolkit::GridLayoutPtr gridLayout = Toolkit::GridLayout::New();  
197 - gridLayout->SetNumberOfColumns( 2 );  
198 - gridLayout->SetTopMargin( DP(TOOLBAR_HEIGHT) + DP(20.0f) );  
199 - gridLayout->SetBottomMargin( DP(100.0f) );  
200 - gridLayout->SetRowSpacing( DP(20.0f) );  
201 - mItemView.AddLayout( *gridLayout );  
202 -  
203 Vector2 stageSize = stage.GetSize(); 196 Vector2 stageSize = stage.GetSize();
204 - float layoutWidth = Toolkit::IsHorizontal( gridLayout->GetOrientation() ) ? stageSize.height : stageSize.width;  
205 - float gridItemSize = ( layoutWidth / gridLayout->GetNumberOfColumns() ) * 0.5f;  
206 - gridLayout->SetScrollSpeedFactor( gridLayout->GetNumberOfColumns() / gridItemSize * 0.5f ); 197 + Toolkit::ItemLayoutPtr gridLayout = Toolkit::DefaultItemLayout::New( Toolkit::DefaultItemLayout::LIST );
  198 + Vector3 itemSize;
  199 + gridLayout->GetItemSize( 0, Vector3( stageSize ), itemSize );
  200 + itemSize.height = stageSize.y / 10;
  201 + gridLayout->SetItemSize( itemSize );
  202 + mItemView.AddLayout( *gridLayout );
207 203
208 mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f ); 204 mItemView.ActivateLayout( 0, Vector3(stageSize.x, stageSize.y, stageSize.x), 0.0f );
209 205