[dali_1.0.37] Merge branch 'tizen'
[platform/core/uifw/dali-demo.git] / examples / item-view / item-view-example.cpp
index f6f1198..448735c 100644 (file)
 #include <string>
 #include <algorithm>
 #include <cstdlib> // rand
-#include "../shared/view.h"
+#include "shared/view.h"
 
 #include <dali/dali.h>
 #include <dali-toolkit/dali-toolkit.h>
 
-using namespace std;
 using namespace Dali;
 using namespace Dali::Toolkit;
 
@@ -100,6 +99,10 @@ const char* IMAGE_PATHS[] = {
 
 const unsigned int NUM_IMAGES = sizeof(IMAGE_PATHS) / sizeof(char*);
 
+const unsigned int IMAGE_WIDTH = 256;
+const unsigned int IMAGE_HEIGHT = 256;
+const unsigned int NUM_IMAGE_PER_ROW_IN_ATLAS = 8;
+
 AlphaFunction ALPHA_FUNCTIONS[] = { AlphaFunctions::Linear,
                                     AlphaFunctions::EaseIn,
                                     AlphaFunctions::EaseOut };
@@ -157,23 +160,8 @@ const float BUTTON_BORDER = -10.0f;
 const float MENU_OPTION_HEIGHT(140.0f);
 const float LABEL_TEXT_SIZE_Y = 20.0f;
 
-const char*             DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNue");
-const char*             DEFAULT_TEXT_STYLE_FONT_STYLE("Regular");
-const PointSize         DEFAULT_TEXT_STYLE_POINT_SIZE( 5.0f );
-const TextStyle::Weight DEFAULT_TEXT_STYLE_WEIGHT(Dali::TextStyle::MEDIUM);
-const Vector4           DEFAULT_TEXT_STYLE_COLOR(1.0f, 1.0f, 1.0f, 1.0f);
-
 const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f );
 
-struct BorderSizeConstraintFunction
-{
-  Vector3 operator()(const Vector3&       current,
-                     const PropertyInput& parentSize)
-  {
-    return parentSize.GetVector3() + ITEM_BORDER_MARGIN_SIZE;
-  }
-};
-
 static Vector3 DepthLayoutItemSizeFunctionPortrait(unsigned int numberOfColumns, float layoutWidth)
 {
   float width = (layoutWidth / static_cast<float>(numberOfColumns + 1)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT;
@@ -246,13 +234,15 @@ public:
    */
   void OnInit(Application& app)
   {
-    Stage::GetCurrent().KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent);
+    DemoHelper::RequestThemeChange();
 
     Stage stage = Dali::Stage::GetCurrent();
+    stage.KeyEventSignal().Connect(this, &ItemViewExample::OnKeyEvent);
+
     Vector2 stageSize = Stage::GetCurrent().GetSize();
 
     // Create a border image shared by all the item actors
-    mBorderImage = Image::New(ITEM_BORDER_IMAGE_PATH);
+    mBorderImage = ResourceImage::New(ITEM_BORDER_IMAGE_PATH);
 
     // Creates a default view with a default tool bar.
     // The view is added to the stage.
@@ -265,23 +255,19 @@ public:
 
     mView.OrientationAnimationStartedSignal().Connect( this, &ItemViewExample::OnOrientationChanged );
 
-    // Set the title to the current layout
-    SetLayoutTitle();
-
     // Create an edit mode button. (left of toolbar)
     Toolkit::PushButton editButton = Toolkit::PushButton::New();
-    editButton.SetBackgroundImage( Image::New( EDIT_IMAGE ) );
+    editButton.SetBackgroundImage( ResourceImage::New( EDIT_IMAGE ) );
     editButton.ClickedSignal().Connect( this, &ItemViewExample::OnModeButtonClicked);
     editButton.SetLeaveRequired( true );
     mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );
 
     // Create a layout toggle button. (right of toolbar)
     mLayoutButton = Toolkit::PushButton::New();
-    mLayoutButton.SetBackgroundImage( Image::New( SPIRAL_LAYOUT_IMAGE ) );
+    mLayoutButton.SetBackgroundImage( ResourceImage::New( SPIRAL_LAYOUT_IMAGE ) );
     mLayoutButton.ClickedSignal().Connect( this, &ItemViewExample::OnLayoutButtonClicked);
     mLayoutButton.SetLeaveRequired( true );
     mToolBar.AddControl( mLayoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );
-    SetLayoutImage();
 
     // Create a delete button (bottom right of screen)
     mDeleteButton = Toolkit::PushButton::New();
@@ -289,9 +275,9 @@ public:
     mDeleteButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
     mDeleteButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER );
     mDeleteButton.SetDrawMode( DrawMode::OVERLAY );
-    mDeleteButton.SetBackgroundImage( Image::New( TOOLBAR_IMAGE ) );
-    mDeleteButton.SetButtonImage( Image::New( DELETE_IMAGE ) );
-    mDeleteButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
+    mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) );
+    mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
+    mDeleteButton.SetSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) );
     mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked);
     mDeleteButton.SetLeaveRequired( true );
     mDeleteButton.SetVisible( false );
@@ -303,8 +289,8 @@ public:
     mInsertButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
     mInsertButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER );
     mInsertButton.SetDrawMode( DrawMode::OVERLAY );
-    mInsertButton.SetBackgroundImage( Image::New( TOOLBAR_IMAGE ) );
-    mInsertButton.SetButtonImage( Image::New( INSERT_IMAGE ) );
+    mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) );
+    mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
     mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
     mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked);
     mInsertButton.SetLeaveRequired( true );
@@ -317,8 +303,8 @@ public:
     mReplaceButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT);
     mReplaceButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER );
     mReplaceButton.SetDrawMode( DrawMode::OVERLAY );
-    mReplaceButton.SetBackgroundImage( Image::New( TOOLBAR_IMAGE ) );
-    mReplaceButton.SetButtonImage( Image::New( REPLACE_IMAGE ) );
+    mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) );
+    mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) );
     mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f );
     mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked);
     mReplaceButton.SetLeaveRequired( true );
@@ -326,7 +312,9 @@ public:
     stage.Add( mReplaceButton );
 
     // Create the item view actor
+    mImageAtlas = CreateImageAtlas();
     mItemView = ItemView::New(*this);
+    mItemView.SetRelayoutEnabled( false );
     mItemView.SetParentOrigin(ParentOrigin::CENTER);
     mItemView.SetAnchorPoint(AnchorPoint::CENTER);
 
@@ -347,10 +335,16 @@ public:
     mItemView.SetMinimumSwipeSpeed(MIN_SWIPE_SPEED);
 
     // Activate the spiral layout
-    Vector3 size(stage.GetSize());
-    mItemView.ActivateLayout(mCurrentLayout, size, 0.0f/*immediate*/);
+    UseLayout(mCurrentLayout, 0.0f);
     mItemView.SetKeyboardFocusable( true );
     KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &ItemViewExample::OnKeyboardPreFocusChange );
+
+    // Set the title and icon to the current layout
+    SetLayoutTitle();
+    SetLayoutImage();
+
+    // Store one 1x1 white image for multiple items to share for backgrounds:
+    mWhiteImage = BufferImage::WHITE();
   }
 
   Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocusNavigationDirection direction )
@@ -366,7 +360,7 @@ public:
   /**
    * Switch to a different item view layout
    */
-  void UseLayout(int layoutId)
+  void UseLayout(int layoutId, float duration)
   {
     // Set the new orientation to the layout
     mItemView.GetLayout(layoutId)->SetOrientation(static_cast<ControlOrientation::Type>(mOrientation / 90));
@@ -375,15 +369,7 @@ public:
 
     if(layoutId == SPIRAL_LAYOUT)
     {
-      // Set up the spiral layout according to the new orientation
-      if(Toolkit::IsVertical(mSpiralLayout->GetOrientation()))
-      {
-        mSpiralLayout->SetRevolutionDistance(stageSize.y / SPIRAL_LAYOUT_REVOLUTION_NUMBER_PORTRAIT);
-      }
-      else
-      {
-        mSpiralLayout->SetRevolutionDistance(stageSize.x / SPIRAL_LAYOUT_REVOLUTION_NUMBER_LANDSCAPE);
-      }
+      mSpiralLayout->SetRevolutionDistance(stageSize.height / Stage::GetCurrent().GetDpi().y * 45.0f);
     }
 
     if(layoutId == GRID_LAYOUT)
@@ -422,7 +408,7 @@ public:
     mItemView.SetAnchoring(layoutId == DEPTH_LAYOUT);
 
     // Activate the layout
-    mItemView.ActivateLayout(layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), mDurationSeconds);
+    mItemView.ActivateLayout(layoutId, Vector3(stageSize.x, stageSize.y, stageSize.x), duration);
   }
 
   /**
@@ -439,7 +425,7 @@ public:
       // Remember orientation
       mOrientation = angle;
 
-      UseLayout(mCurrentLayout);
+      UseLayout(mCurrentLayout, mDurationSeconds);
     }
   }
 
@@ -448,7 +434,7 @@ public:
     // Switch to the next layout
     mCurrentLayout = (mCurrentLayout + 1) % mItemView.GetLayoutCount();
 
-    UseLayout(mCurrentLayout);
+    UseLayout(mCurrentLayout, mDurationSeconds);
 
     SetLayoutTitle();
     SetLayoutImage();
@@ -544,7 +530,7 @@ public:
     mTapDetector.Reset();
   }
 
-  void RemoveOnTap( Actor actor, TapGesture tap )
+  void RemoveOnTap( Actor actor, const TapGesture& tap )
   {
     mItemView.RemoveItem( mItemView.GetItemId(actor), 0.5f );
   }
@@ -596,7 +582,7 @@ public:
     mDeleteButton.SetVisible( false );
   }
 
-  void SelectOnTap( Actor actor, TapGesture tap )
+  void SelectOnTap( Actor actor, const TapGesture& tap )
   {
     Actor tick = actor.FindChildByName( "Tick" );
     if( tick )
@@ -647,7 +633,7 @@ public:
     mTapDetector.Reset();
   }
 
-  void InsertOnTap( Actor actor, TapGesture tap )
+  void InsertOnTap( Actor actor, const TapGesture& tap )
   {
     ItemId id = mItemView.GetItemId( actor );
 
@@ -740,7 +726,7 @@ public:
     mTapDetector.DetectedSignal().Connect( this, &ItemViewExample::ReplaceOnTap );
   }
 
-  void ReplaceOnTap( Actor actor, TapGesture tap )
+  void ReplaceOnTap( Actor actor, const TapGesture& tap )
   {
     mItemView.ReplaceItem( Item( mItemView.GetItemId(actor), NewItem(rand()) ), 0.5f );
   }
@@ -851,19 +837,19 @@ public:
       {
         case SPIRAL_LAYOUT:
         {
-          mLayoutButton.SetBackgroundImage( Image::New( SPIRAL_LAYOUT_IMAGE ) );
+          mLayoutButton.SetBackgroundImage( ResourceImage::New( SPIRAL_LAYOUT_IMAGE ) );
           break;
         }
 
         case GRID_LAYOUT:
         {
-          mLayoutButton.SetBackgroundImage( Image::New( GRID_LAYOUT_IMAGE ) );
+          mLayoutButton.SetBackgroundImage( ResourceImage::New( GRID_LAYOUT_IMAGE ) );
           break;
         }
 
         case DEPTH_LAYOUT:
         {
-          mLayoutButton.SetBackgroundImage( Image::New( DEPTH_LAYOUT_IMAGE ) );
+          mLayoutButton.SetBackgroundImage( ResourceImage::New( DEPTH_LAYOUT_IMAGE ) );
           break;
         }
 
@@ -892,8 +878,12 @@ public: // From ItemFactory
   virtual Actor NewItem(unsigned int itemId)
   {
     // Create an image actor for this item
-    Image image = Image::New( IMAGE_PATHS[itemId % NUM_IMAGES] );
-    Actor actor = ImageActor::New(image);
+    unsigned int imageId = itemId % NUM_IMAGES;
+    ImageActor::PixelArea pixelArea( (imageId%NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_WIDTH,
+                                     (imageId/NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_HEIGHT,
+                                      IMAGE_WIDTH,
+                                      IMAGE_HEIGHT );
+    Actor actor = ImageActor::New(mImageAtlas, pixelArea);
     actor.SetPosition( INITIAL_OFFSCREEN_POSITION );
 
     // Add a border image child actor
@@ -904,9 +894,8 @@ public: // From ItemFactory
     borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
     borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) );
     borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor
-
-    Constraint constraint = Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), BorderSizeConstraintFunction() );
-    borderActor.ApplyConstraint(constraint);
+    borderActor.SetResizePolicy( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS );
+    borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE );
     actor.Add(borderActor);
     actor.SetKeyboardFocusable( true );
 
@@ -915,7 +904,8 @@ public: // From ItemFactory
 
     // Add a checkbox child actor; invisible until edit-mode is enabled
 
-    ImageActor checkbox = ImageActor::New( BitmapImage::WHITE() );
+    ImageActor checkbox = ImageActor::New( mWhiteImage );
+    checkbox.SetRelayoutEnabled( false );
     checkbox.SetName( "CheckBox" );
     checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) );
     checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT );
@@ -931,7 +921,8 @@ public: // From ItemFactory
     }
     actor.Add( checkbox );
 
-    ImageActor tick = ImageActor::New( Image::New(SELECTED_IMAGE) );
+    ImageActor tick = ImageActor::New( ResourceImage::New(SELECTED_IMAGE) );
+    tick.SetRelayoutEnabled( false );
     tick.SetColorMode( USE_OWN_COLOR );
     tick.SetName( "Tick" );
     tick.SetParentOrigin( ParentOrigin::TOP_RIGHT );
@@ -953,6 +944,23 @@ public: // From ItemFactory
 private:
 
   /**
+   * Create an Atlas to tile the images inside.
+   */
+  Atlas CreateImageAtlas()
+  {
+    const unsigned int atlas_width = IMAGE_WIDTH*NUM_IMAGE_PER_ROW_IN_ATLAS;
+    const unsigned int atlas_height = IMAGE_HEIGHT*ceil( static_cast<float>(NUM_IMAGES)/ static_cast<float>(NUM_IMAGE_PER_ROW_IN_ATLAS));
+    Atlas atlas = Atlas::New(atlas_width, atlas_height, Pixel::RGB888);
+
+    for( unsigned int i = 0; i < NUM_IMAGES; i++ )
+    {
+      atlas.Upload( IMAGE_PATHS[i], (i%NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_WIDTH, (i/NUM_IMAGE_PER_ROW_IN_ATLAS)*IMAGE_HEIGHT );
+    }
+
+    return atlas;
+  }
+
+  /**
    * Sets/Updates the title of the View
    * @param[in] title The new title for the view.
    */
@@ -960,15 +968,12 @@ private:
   {
     if(!mTitleActor)
     {
-      mTitleActor = TextView::New();
+      mTitleActor = DemoHelper::CreateToolBarLabel( "" );
       // Add title to the tool bar.
       mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
     }
 
-    Font font = Font::New();
-    mTitleActor.SetText( title );
-    mTitleActor.SetSize( font.MeasureText( title ) );
-    mTitleActor.SetStyleToCurrentText(DemoHelper::GetDefaultTextStyle());
+    mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
   }
 
   void ShowMenu()
@@ -979,63 +984,52 @@ private:
     mMenu = Toolkit::Popup::New();
     mMenu.SetParentOrigin( ParentOrigin::BOTTOM_LEFT );
     mMenu.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT );
+    mMenu.SetSize( popupWidth, MENU_OPTION_HEIGHT * 2 );
     mMenu.OutsideTouchedSignal().Connect( this, &ItemViewExample::HideMenu );
-    stage.Add( mMenu );
 
     TableView tableView = TableView::New( 0, 0 );
-    Vector2 tableSize = Vector2( popupWidth, MENU_OPTION_HEIGHT * 2 );
-    tableView.SetSize( tableSize );
+    tableView.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
     mMenu.Add( tableView );
 
     Slider slider = Slider::New();
-    slider.SetProperty( Slider::LOWER_BOUND_PROPERTY, 0.0f );
-    slider.SetProperty( Slider::UPPER_BOUND_PROPERTY, 3.0f );
-    slider.SetProperty( Slider::VALUE_PROPERTY, mDurationSeconds );
-    slider.SetProperty( Slider::VALUE_PRECISION_PROPERTY, 2 );
-    slider.SetProperty( Slider::SHOW_POPUP_PROPERTY, true );
+    slider.SetProperty( Slider::Property::LOWER_BOUND, 0.0f );
+    slider.SetProperty( Slider::Property::UPPER_BOUND, 3.0f );
+    slider.SetProperty( Slider::Property::VALUE, mDurationSeconds );
+    slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 );
+    slider.SetProperty( Slider::Property::SHOW_POPUP, true );
+    slider.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
     slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange );
     tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) );
-    tableView.SetRelativeHeight( 0, 0.5f );
 
-    TextStyle defaultTextStyle;
-    defaultTextStyle.SetFontName(DEFAULT_TEXT_STYLE_FONT_FAMILY);
-    defaultTextStyle.SetFontStyle(DEFAULT_TEXT_STYLE_FONT_STYLE);
-    defaultTextStyle.SetFontPointSize(DEFAULT_TEXT_STYLE_POINT_SIZE);
-    defaultTextStyle.SetWeight(DEFAULT_TEXT_STYLE_WEIGHT);
-    defaultTextStyle.SetTextColor(DEFAULT_TEXT_STYLE_COLOR);
-
-    TextView text = TextView::New( "Duration" );
+    TextLabel text = TextLabel::New( "Duration" );
     text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
     text.SetParentOrigin( ParentOrigin::TOP_LEFT );
-    text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft );
-    text.SetStyleToCurrentText( defaultTextStyle );
-    text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y );
-    text.ApplyConstraint( Dali::Constraint::New<float>( Dali::Actor::SIZE_WIDTH, Dali::ParentSource( Dali::Actor::SIZE_WIDTH ), Dali::EqualToConstraint() ) );
-    text.SetZ( -0.9f );
+    text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+    text.SetResizePolicy( FIXED, HEIGHT );
+    text.SetSize( Vector2( 0.0f, LABEL_TEXT_SIZE_Y ) );
     slider.Add( text );
 
     Actor textContainer = Actor::New();
-    mAlphaFunctionText = TextView::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] );
+    textContainer.SetRelayoutEnabled( true );
+    textContainer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+    mAlphaFunctionText = TextLabel::New( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] );
     mAlphaFunctionText.SetAnchorPoint( ParentOrigin::CENTER );
     mAlphaFunctionText.SetParentOrigin( ParentOrigin::CENTER );
-    mAlphaFunctionText.SetTextAlignment( Toolkit::Alignment::VerticalCenter );
     textContainer.Add( mAlphaFunctionText );
     tableView.AddChild( textContainer, TableView::CellPosition( 1, 0 ) );
-    tableView.SetRelativeHeight( 0, 0.5f );
 
     mTapDetector = TapGestureDetector::New();
     mTapDetector.Attach(mAlphaFunctionText);
     mTapDetector.DetectedSignal().Connect( this, &ItemViewExample::ChangeAlphaFunctionOnTap );
 
-    text = TextView::New( "Alpha Function" );
+    text = TextLabel::New( "Alpha Function" );
     text.SetAnchorPoint( ParentOrigin::TOP_LEFT );
     text.SetParentOrigin( ParentOrigin::TOP_LEFT );
-    text.SetTextAlignment( Dali::Toolkit::Alignment::HorizontalLeft );
-    text.SetStyleToCurrentText( defaultTextStyle );
+    text.SetResizePolicy( FILL_TO_PARENT, WIDTH );
     text.SetSize( 0.0f, LABEL_TEXT_SIZE_Y );
-    text.ApplyConstraint( Dali::Constraint::New<float>( Dali::Actor::SIZE_WIDTH, Dali::ParentSource( Dali::Actor::SIZE_WIDTH ), Dali::EqualToConstraint() ) );
     textContainer.Add( text );
 
+    mMenu.MarkDirtyForRelayout();
     mMenu.Show();
     mMenuShown = true;
   }
@@ -1047,7 +1041,7 @@ private:
     return true;
   }
 
-  void ChangeAlphaFunctionOnTap( Actor actor, TapGesture tap )
+  void ChangeAlphaFunctionOnTap( Actor actor, const TapGesture& tap )
   {
     if( NUM_ALPHA_FUNCTIONS <= ++mAlphaFuncIndex )
     {
@@ -1056,7 +1050,7 @@ private:
 
     if( mAlphaFunctionText )
     {
-      mAlphaFunctionText.SetText( ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex] );
+      mAlphaFunctionText.SetProperty( TextLabel::Property::TEXT, std::string(ALPHA_FUNCTIONS_TEXT[mAlphaFuncIndex]) );
     }
 
     if( mItemView )
@@ -1120,10 +1114,11 @@ private:
   unsigned int mOrientation;
 
   Toolkit::ToolBar mToolBar;
-  TextView mTitleActor;             ///< The Toolbar's Title.
+  TextLabel mTitleActor;             ///< The Toolbar's Title.
 
   ItemView mItemView;
   Image mBorderImage;
+  Atlas mImageAtlas;
   unsigned int mCurrentLayout;
   float mDurationSeconds;
 
@@ -1140,7 +1135,8 @@ private:
   Toolkit::PushButton mReplaceButton;
 
   unsigned int mAlphaFuncIndex;
-  TextView mAlphaFunctionText;
+  TextLabel mAlphaFunctionText;
+  BufferImage mWhiteImage;
 };
 
 void RunTest(Application& app)