Merge remote-tracking branch 'origin/tizen' into new_text 36/37536/6
authorPaul Wisbey <p.wisbey@samsung.com>
Mon, 30 Mar 2015 15:03:35 +0000 (16:03 +0100)
committerPaul Wisbey <p.wisbey@samsung.com>
Tue, 31 Mar 2015 13:27:01 +0000 (14:27 +0100)
Conflicts:
automated-tests/src/dali-toolkit/utc-Dali-TextView.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/popup/popup-impl.cpp
dali-toolkit/internal/controls/relayout-controller-impl.cpp
dali-toolkit/internal/controls/relayout-controller.cpp
dali-toolkit/internal/controls/relayout-helper.cpp
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-impl.h
dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp
dali-toolkit/internal/controls/text-view/relayout-utilities.cpp
dali-toolkit/internal/controls/text-view/text-view-impl.cpp
dali-toolkit/internal/controls/text-view/text-view-impl.h
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control.h
docs/content/main-page.h
plugins/dali-script-v8/src/actors/actor-wrapper.h

Change-Id: Ia0aff01756e6d803616d9c4eae82f405c6cb2c0f

31 files changed:
1  2 
automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp
dali-toolkit/internal/controls/buttons/push-button-impl.cpp
dali-toolkit/internal/controls/buttons/radio-button-impl.h
dali-toolkit/internal/controls/popup/popup-impl.cpp
dali-toolkit/internal/controls/popup/popup-impl.h
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.h
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h
dali-toolkit/internal/file.list
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/controls/control-impl.h
dali-toolkit/public-api/controls/control.cpp
dali-toolkit/public-api/controls/control.h
dali-toolkit/public-api/controls/popup/popup.cpp
dali-toolkit/public-api/controls/popup/popup.h
dali-toolkit/public-api/controls/text-controls/text-label.cpp
dali-toolkit/public-api/controls/text-controls/text-label.h
docs/content/main-page.h
packaging/dali-toolkit.spec
plugins/dali-script-v8/file.list
plugins/dali-script-v8/src/actors/actor-api.cpp
plugins/dali-script-v8/src/actors/actor-api.h
plugins/dali-script-v8/src/actors/actor-wrapper.cpp
plugins/dali-script-v8/src/actors/actor-wrapper.h
plugins/dali-script-v8/src/dali-wrapper.cpp
plugins/dali-script-v8/src/shader-effects/shader-effect-api.cpp

@@@ -168,7 -168,7 +168,7 @@@ int UtcDaliPopoupSetProperty(void
    //Test properties
    std::string testString = "Hello World";
    popup.SetProperty(popup.GetPropertyIndex("title"), testString);
 -  DALI_TEST_EQUALS( testString, popup.GetTitle().GetText(), TEST_LOCATION );
 +  DALI_TEST_EQUALS( testString, popup.GetTitle(), TEST_LOCATION );
    END_TEST;
  }
  
@@@ -191,7 -191,63 +191,7 @@@ int UtcDaliPopupSetBackgroundImage(void
  
  int UtcDaliPopupSetTitle(void)
  {
 -  ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
 -  tet_infoline(" UtcDaliPopupSetTitle");
 -
 -  // Create the Popup actor
 -  Popup popup = Popup::New();
 -  Stage::GetCurrent().Add( popup );
 -  // Put in show state so it's layer is connected to popup (for ancestor check).
 -  popup.SetState(Popup::POPUP_SHOW, 0.0f);
 -
 -  TextView titleActor = TextView::New();
 -  titleActor.SetText("title");
 -
 -  DALI_TEST_CHECK( !popup.GetTitle() );
 -  popup.SetTitle(titleActor);
 -  DALI_TEST_CHECK( popup.GetTitle() == titleActor );
 -  DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "title") );
 -  // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
 -  DALI_TEST_CHECK( HasAncestor(titleActor, popup) );
 -
 -  TextView titleActor2 = TextView::New();
 -  titleActor2.SetText("anothertitle");
 -  popup.SetTitle(titleActor2);
 -  DALI_TEST_CHECK( popup.GetTitle() != titleActor );
 -  DALI_TEST_CHECK( popup.GetTitle() == titleActor2 );
 -  DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "anothertitle") );
 -  // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
 -  DALI_TEST_CHECK( HasAncestor(titleActor2, popup) );
 -  END_TEST;
 -}
 -
 -int UtcDaliPopupSetTitleText(void)
 -{
 -  ToolkitTestApplication application;  // Exceptions require ToolkitTestApplication
 -  tet_infoline(" UtcDaliPopupSetTitleText");
 -
 -  // Create the Popup actor
 -  Popup popup = Popup::New();
 -  Stage::GetCurrent().Add( popup );
 -  // Put in show state so it's layer is connected to popup (for ancestor check).
 -  popup.SetState(Popup::POPUP_SHOW, 0.0f);
 -
 -  TextView titleActor = TextView::New();
 -  titleActor.SetText("title");
 -
 -  DALI_TEST_CHECK( !popup.GetTitle() );
 -  popup.SetTitle(titleActor);
 -  DALI_TEST_CHECK( popup.GetTitle() == titleActor );
 -  DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "title") );
 -  // verify titleActor is actually inside popup, and not elsewhere on stage, or off even.
 -  DALI_TEST_CHECK( HasAncestor(titleActor, popup) );
 -
 -  // this text should replace titleImage actor.
 -  popup.SetTitle("newtext");
 -  DALI_TEST_CHECK( popup.GetTitle() != titleActor );
 -  DALI_TEST_CHECK( (popup.GetTitle()) && (popup.GetTitle().GetText() == "newtext") );
 -  // verify titleActor is no longer inside popup. (been displaced by newtext actor)
 -  DALI_TEST_CHECK( !HasAncestor(titleActor, popup) );
 +  // TODO
    END_TEST;
  }
  
@@@ -223,7 -279,6 +223,6 @@@ int UtcDaliPopupSetState(void
  
    // Create the Popup actor
    Popup popup = Popup::New();
-   Stage::GetCurrent().Add( popup );
  
    ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
    popup.SetBackgroundImage(backgroundImage);
@@@ -247,7 -302,6 +246,6 @@@ int UtcDaliPopupSetStateSlow(void
  
    // Create the Popup actor
    Popup popup = Popup::New();
-   Stage::GetCurrent().Add( popup );
  
    ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
    popup.SetBackgroundImage(backgroundImage);
@@@ -281,7 -335,6 +279,6 @@@ int UtcDaliPopupShowHide(void
  
    // Create the Popup actor
    Popup popup = Popup::New();
-   Stage::GetCurrent().Add( popup );
    popup.HiddenSignal().Connect( &OnPopupHidden );
  
    ImageActor backgroundImage = CreateSolidColorActor( Color::RED );
  
    PushButton button1 = PushButton::New();
    PushButton button2 = PushButton::New();
-   button1.SetSize(DEFAULT_BUTTON_SIZE);
+   button1.SetPreferredSize(DEFAULT_BUTTON_SIZE.GetVectorXY());
    popup.AddButton(button1);
-   button2.SetSize(DEFAULT_BUTTON_SIZE);
+   button2.SetPreferredSize(DEFAULT_BUTTON_SIZE.GetVectorXY());
    popup.AddButton(button2);
  
    // Showing/Hiding popup, results in all child Actors being
@@@ -23,7 -23,7 +23,6 @@@
  #include <dali/public-api/object/type-registry.h>
  
  // INTERNAL INCLUDES
- #include <dali-toolkit/internal/controls/relayout-helper.h>
 -#include <dali-toolkit/public-api/controls/text-view/text-view.h>
  
  namespace Dali
  {
@@@ -123,7 -123,7 +122,7 @@@ void PushButton::SetButtonImage( Actor 
  
          buttonImage = image;
  
-         FadeInImage( buttonImage );
+         FadeInImage( buttonImage, 0.0f, 0 );
  
          StartFadeOutAnimation();
          StartFadeInAnimation();
        else
        {
          buttonImage = image;
-         Self().Add( buttonImage );
+         Self().Insert( 0, buttonImage );
        }
        break;
      }
        // Replaces the button image.
        buttonImage = image;
  
-       Self().Add( buttonImage );
+       Self().Insert( 0, buttonImage );
        FadeOutImage( Foreground, buttonImage, opacity );
  
        StartFadeOutAnimation();
  
        buttonImage = image;
  
-       FadeInImage( buttonImage );
+       FadeInImage( buttonImage, 0.0f, 0 );
        StartFadeInAnimation();
        break;
      }
    buttonImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    buttonImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
    buttonImage.SetPosition( 0.f, 0.f, FOREGROUND_DEPTH );
-   buttonImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+   buttonImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+   buttonImage.SetName( "BUTTON_IMAGE" );
  }
  
  void PushButton::SetSelectedImage( Actor image )
  
          selectedImage = image;
  
-         FadeInImage( selectedImage );
+         FadeInImage( selectedImage, 0.0f, 0 );
  
          StartFadeOutAnimation();
          StartFadeInAnimation();
        else
        {
          selectedImage = image;
-         Self().Add( selectedImage );
+         Self().Insert( 0, selectedImage );
        }
        break;
      }
        // Replaces the button image.
        selectedImage = image;
  
-       Self().Add( selectedImage );
+       Self().Insert( 0, selectedImage );
        FadeOutImage( Foreground, selectedImage, opacity );
  
        StartFadeOutAnimation();
  
        selectedImage = image;
  
-       FadeInImage( selectedImage );
+       FadeInImage( selectedImage, 0.0f, 0 );
        StartFadeInAnimation();
        break;
      }
    selectedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    selectedImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
    selectedImage.SetPosition( 0.f, 0.f, FOREGROUND_DEPTH );
-   selectedImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+   selectedImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  }
  
  void PushButton::SetBackgroundImage( Actor image )
  
          backgroundImage = image;
  
-         FadeInImage( backgroundImage );
+         FadeInImage( backgroundImage, 0.0f, 0 );
  
          StartFadeOutAnimation();
          StartFadeInAnimation();
        else
        {
          backgroundImage = image;
-         Self().Add( backgroundImage );
+         Self().Insert( 0, backgroundImage );
        }
        break;
      }
        // Replaces the button image.
        backgroundImage = image;
  
-       Self().Add( backgroundImage );
+       Self().Insert( 0, backgroundImage );
        FadeOutImage( Background, backgroundImage, opacity );
  
        StartFadeOutAnimation();
  
        backgroundImage = image;
  
-       FadeInImage( backgroundImage );
+       FadeInImage( backgroundImage, 0.0f, 0 );
        StartFadeInAnimation();
        break;
      }
    backgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    backgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
    backgroundImage.SetPosition( 0.f, 0.f, BACKGROUND_DEPTH );
-   backgroundImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+   backgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  }
  
  void PushButton::SetDisabledImage( Actor image )
  
          disabledImage = image;
  
-         FadeInImage( disabledImage );
+         FadeInImage( disabledImage, 0.0f, 0 );
  
          StartFadeOutAnimation();
          StartFadeInAnimation();
  
        disabledImage = image;
  
-       FadeInImage( disabledImage );
+       FadeInImage( disabledImage, 0.0f, 0 );
        StartFadeInAnimation();
        break;
      }
    disabledImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    disabledImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
    disabledImage.SetPosition( 0.f, 0.f, FOREGROUND_DEPTH );
-   disabledImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+   disabledImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  }
  
  void PushButton::SetDisabledBackgroundImage( Actor image )
  
          disabledBackgroundImage = image;
  
-         FadeInImage( disabledBackgroundImage );
+         FadeInImage( disabledBackgroundImage, 0.0f, 0 );
  
          StartFadeOutAnimation();
          StartFadeInAnimation();
  
        disabledBackgroundImage = image;
  
-       FadeInImage( disabledBackgroundImage );
+       FadeInImage( disabledBackgroundImage, 0.0f, 0 );
        StartFadeInAnimation();
        break;
      }
    disabledBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    disabledBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
    disabledBackgroundImage.SetPosition( 0.f, 0.f, BACKGROUND_DEPTH );
-   disabledBackgroundImage.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+   disabledBackgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  }
  
  void PushButton::OnButtonInitialize()
    // Push button requires the Leave event.
    Actor root = Self();
    root.SetLeaveRequired( true );
+   // Set resize policy to natural size so that buttons will resize to background images
+   root.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS );
  }
  
  void PushButton::OnLabelSet()
@@@ -496,7 -500,7 +499,7 @@@ void PushButton::OnSelected( bool selec
      {
        StopFadeOutAnimation();
        FadeOutImage( Foreground, buttonImage );
-       FadeInImage( selectedImage );
+       FadeInImage( selectedImage, 0.0f, 0 );
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
      {
        StopFadeOutAnimation();
        FadeOutImage( Foreground, selectedImage );
-       FadeInImage( buttonImage );
+       FadeInImage( buttonImage, 0.0f, 0 );
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        StopFadeInAnimation();
  
        FadeOutImage( Foreground, selectedImage, 1.f - opacity );
-       FadeInImage( buttonImage, opacity );
+       FadeInImage( buttonImage, opacity, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
        StopFadeInAnimation();
  
        FadeOutImage( Foreground, buttonImage, 1.f - opacity );
-       FadeInImage( selectedImage, opacity );
+       FadeInImage( selectedImage, opacity, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
@@@ -605,8 -609,8 +608,8 @@@ void PushButton::OnDisabled( bool disab
        StopFadeOutAnimation();
        FadeOutImage( Background, backgroundImage );
        FadeOutImage( Foreground, buttonImage );
-       FadeInImage( disabledBackgroundImage );
-       FadeInImage( disabledImage );
+       FadeInImage( disabledBackgroundImage, 0.0f, 0 );
+       FadeInImage( disabledImage, 0.0f, 0 );
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        StopFadeOutAnimation();
        FadeOutImage( Background, backgroundImage );
        FadeOutImage( Foreground, selectedImage );
-       FadeInImage( disabledBackgroundImage );
-       FadeInImage( disabledImage );
+       FadeInImage( disabledBackgroundImage, 0.0f, 0 );
+       FadeInImage( disabledImage, 0.0f, 0 );
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        StopFadeOutAnimation();
        FadeOutImage( Background, disabledBackgroundImage );
        FadeOutImage( Foreground, disabledImage );
-       FadeInImage( backgroundImage );
-       FadeInImage( buttonImage );
+       FadeInImage( backgroundImage, 0.0f, 0 );
+       FadeInImage( buttonImage, 0.0f, 0 );
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        StopFadeOutAnimation();
        FadeOutImage( Background, disabledBackgroundImage );
        FadeOutImage( Foreground, disabledImage );
-       FadeInImage( backgroundImage );
-       FadeInImage( selectedImage );
+       FadeInImage( backgroundImage, 0.0f, 0 );
+       FadeInImage( selectedImage, 0.0f, 0 );
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        FadeOutImage( Foreground, selectedImage, 1.f - opacity );
        FadeOutImage( Background, backgroundImage );
  
-       FadeInImage( disabledImage );
-       FadeInImage( disabledBackgroundImage );
+       FadeInImage( disabledImage, 0.0f, 0 );
+       FadeInImage( disabledBackgroundImage, 0.0f, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
        FadeOutImage( Foreground, buttonImage, 1.f - opacity );
        FadeOutImage( Background, backgroundImage );
  
-       FadeInImage( disabledImage );
-       FadeInImage( disabledBackgroundImage );
+       FadeInImage( disabledImage, 0.0f, 0);
+       FadeInImage( disabledBackgroundImage, 0.0f, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        FadeOutImage( Foreground, disabledImage, 1.f - opacity );
        FadeOutImage( Background, disabledBackgroundImage, 1.f - opacity );
-       FadeInImage( buttonImage, opacity );
-       FadeInImage( backgroundImage, opacity );
+       FadeInImage( buttonImage, opacity, 0 );
+       FadeInImage( backgroundImage, opacity, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        FadeOutImage( Foreground, buttonImage, 1.f - opacity );
        FadeOutImage( Background, backgroundImage, 1.f - opacity );
-       FadeInImage( disabledImage, opacity );
-       FadeInImage( disabledBackgroundImage, opacity );
+       FadeInImage( disabledImage, opacity, 0 );
+       FadeInImage( disabledBackgroundImage, opacity, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        FadeOutImage( Foreground, disabledImage, 1.f - opacity );
        FadeOutImage( Background, disabledBackgroundImage, 1.f - opacity );
-       FadeInImage( selectedImage, opacity );
-       FadeInImage( backgroundImage, opacity );
+       FadeInImage( selectedImage, opacity, 0 );
+       FadeInImage( backgroundImage, opacity, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        FadeOutImage( Foreground, selectedImage, 1.f - opacity );
        FadeOutImage( Background, backgroundImage, 1.f - opacity );
-       FadeInImage( disabledImage, opacity );
-       FadeInImage( disabledBackgroundImage, opacity );
+       FadeInImage( disabledImage, opacity, 0 );
+       FadeInImage( disabledBackgroundImage, opacity, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
@@@ -895,7 -899,7 +898,7 @@@ void PushButton::OnPressed(
      {
        StopFadeOutAnimation();
        FadeOutImage( Foreground, buttonImage );
-       FadeInImage( selectedImage );
+       FadeInImage( selectedImage, 0.0f, 0 );
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        StopFadeInAnimation();
  
        FadeOutImage( Foreground, buttonImage, 1.f - opacity );
-       FadeInImage( selectedImage, opacity );
+       FadeInImage( selectedImage, opacity, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
@@@ -960,7 -964,7 +963,7 @@@ void PushButton::OnReleased(
      {
        StopFadeOutAnimation();
        FadeOutImage( Foreground, selectedImage );
-       FadeInImage( buttonImage );
+       FadeInImage( buttonImage, 0.0f, 0 );
        StartFadeOutAnimation();
        StartFadeInAnimation();
  
        StopFadeInAnimation();
  
        FadeOutImage( Foreground, selectedImage, 1.f - opacity );
-       FadeInImage( buttonImage, opacity );
+       FadeInImage( buttonImage, opacity, 0 );
  
        StartFadeOutAnimation();
        StartFadeInAnimation();
@@@ -1040,7 -1044,7 +1043,7 @@@ Vector3 PushButton::GetNaturalSize(
      ImageActor imageActor = FindImageActor( GetButtonImage() );
      if( imageActor && imageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH )
      {
-       Vector3 imageSize = RelayoutHelper::GetNaturalSize( imageActor );
+       Vector3 imageSize = imageActor.GetNaturalSize();
  
        if( widthIsZero )
        {
      ImageActor backgroundImageActor = FindImageActor( GetBackgroundImage() );
      if( backgroundImageActor && backgroundImageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH )
      {
-       Vector3 imageSize = RelayoutHelper::GetNaturalSize( backgroundImageActor );
+       Vector3 imageSize = backgroundImageActor.GetNaturalSize();
  
        if( widthIsZero )
        {
          size.height = std::max( size.height, imageSize.height );
        }
      }
 -
 -    // If label, test against it's size
 -    Toolkit::TextView textView = Toolkit::TextView::DownCast( GetLabel() );
 -    if( textView )
 -    {
 -      Vector3 textViewSize = textView.GetNaturalSize();
 -
 -      if( widthIsZero )
 -      {
 -        size.width = std::max( size.width, textViewSize.width + TEXT_PADDING * 2.0f );
 -      }
 -
 -      if( heightIsZero )
 -      {
 -        size.height = std::max( size.height, textViewSize.height + TEXT_PADDING * 2.0f );
 -      }
 -    }
    }
  
    return size;
@@@ -1158,14 -1179,21 +1161,21 @@@ void PushButton::StopFadeOutAnimation( 
    }
  }
  
- void PushButton::FadeInImage( Actor& image, float opacity )
+ void PushButton::FadeInImage( Actor& image, float opacity, int priority )
  {
    if( image )
    {
      image.SetOpacity( opacity );
      if( !image.GetParent() )
      {
-       Self().Add( image );
+       if( priority > -1 )
+       {
+         Self().Insert( priority, image );
+       }
+       else
+       {
+         Self().Add( image );
+       }
      }
  
      AddToFadeInAnimation( image );
@@@ -23,7 -23,9 +23,8 @@@
  #include <dali/public-api/common/dali-vector.h>
  
  // INTERNAL INCLUDES
 -#include <dali-toolkit/public-api/controls/text-view/text-view.h>
  #include <dali-toolkit/public-api/controls/buttons/radio-button.h>
+ #include <dali-toolkit/public-api/controls/table-view/table-view.h>
  #include "button-impl.h"
  
  namespace Dali
@@@ -103,12 -105,14 +104,14 @@@ private: // From Butto
     */
    virtual void OnLabelSet();
  
- private: // From Control
+ private:
  
    /**
-    * @copydoc Dali::Toolkit::Control::OnRelayout()
+    * @brief Set the image to display
+    *
+    * @param[in] image The image to set
     */
-   virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
+   void SetImage( Actor image );
  
  private:
  
  
    // Undefined
    RadioButton& operator=( const RadioButton& origin );
+ private:
+   Toolkit::TableView mLayoutContainer;      ///< Container to position button images and labels
  };
  
  } // namespace Internal
@@@ -28,6 -28,7 +28,7 @@@
  #include <dali/public-api/images/resource-image.h>
  #include <dali/public-api/object/type-registry.h>
  #include <dali/public-api/object/type-registry-helper.h>
+ #include <dali/public-api/size-negotiation/relayout-container.h>
  #include <dali/integration-api/debug.h>
  
  // INTERNAL INCLUDES
@@@ -35,7 -36,6 +36,6 @@@
  #include <dali-toolkit/public-api/controls/control-impl.h>
  #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
  #include <dali-toolkit/public-api/focus-manager/focus-manager.h>
- #include <dali-toolkit/internal/controls/relayout-helper.h>
  #include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
  
  using namespace Dali;
@@@ -69,9 -69,7 +69,7 @@@ DALI_TYPE_REGISTRATION_END(
  const char* const PROPERTY_TITLE = "title";
  const char* const PROPERTY_STATE = "state";
  
- const float CONTENT_DEPTH = 1.0f;                                 ///< 3D Effect of buttons/title etc. appearing off the popup.
- const float POPUP_ANIMATION_DURATION = 0.5f;                      ///< Duration of hide/show animations
- const float BACKING_DEPTH = -1.0f;                                ///< Depth of backing (positioned just behind dialog, so dialog catches hit events first)
+ const float POPUP_ANIMATION_DURATION = 0.45f;                      ///< Duration of hide/show animations
  
  const float POPUP_WIDTH = 720.0f;                             ///< Width of Popup
  const float POPUP_OUT_MARGIN_WIDTH = 16.f;                    ///< Space between the screen edge and the popup edge in the horizontal dimension.
@@@ -81,40 -79,6 +79,6 @@@ const float POPUP_BUTTON_BG_HEIGHT = 96
  const Vector3 DEFAULT_DIALOG_SIZE = Vector3(POPUP_TITLE_WIDTH/POPUP_WIDTH, 0.5f, 0.0f);
  const Vector3 DEFAULT_BOTTOM_SIZE = Vector3(1.0f, 0.2f, 0.0f);
  
- /**
-  * The background size should be at least as big as the Dialog.
-  * In some cases a background may have graphics which are visible
-  * outside of the Dialog, e.g. A Shadow. For this we need to alter
-  * the size of Background.
-  *
-  * @param[in] outerBorder The border to extend beyond parent's Size.
-  * @param[in] parentSize  The parent's size
-  */
- Vector3 BackgroundSize(const Vector4& outerBoarder, const Vector3& parentSize)
- {
-   Vector3 size( parentSize );
-   size.width += outerBoarder.x + outerBoarder.y;
-   size.height += outerBoarder.z + outerBoarder.w;
-   return size;
- }
-   /**
-    * sets button area size to parent's size plus a border.
-    *
-    * @param[in] outerBorder The border to extend beyond parent's Size.
-    * @param[in] parentSize  The parent's size
-    */
- Vector3 ButtonAreaSize( const Vector4& outBoarder, const Vector3& parentSize )
- {
-   Vector3 size( parentSize );
-   size.width += outBoarder.x + outBoarder.y;
-   size.width -= (POPUP_OUT_MARGIN_WIDTH + POPUP_OUT_MARGIN_WIDTH);
-   size.height = POPUP_BUTTON_BG_HEIGHT;
-   return size;
- }
  } // unnamed namespace
  
  ///////////////////////////////////////////////////////////////////////////////////////////////////
@@@ -152,33 -116,49 +116,49 @@@ Popup::Popup(PopupStyle& style
  
  void Popup::OnInitialize()
  {
+   Dali::Stage stage = Dali::Stage::GetCurrent();
    Actor self = Self();
    self.SetSensitive(false);
+   // Reisize to fit the height of children
+   self.SetResizePolicy( FIT_TO_CHILDREN, HEIGHT );
  
    // Create Layer
    mLayer = Layer::New();
+   mLayer.SetName( "POPUP_LAYER" );
    mLayer.SetParentOrigin(ParentOrigin::CENTER);
    mLayer.SetAnchorPoint(AnchorPoint::CENTER);
-   mLayer.RaiseToTop();
-   self.Add(mLayer);
-   mPopupBg = Actor::New();
-   mPopupBg.SetParentOrigin(ParentOrigin::CENTER);
-   mPopupBg.SetAnchorPoint(AnchorPoint::CENTER);
-   mLayer.Add(mPopupBg);
+   mLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+   mLayer.SetDrawMode( DrawMode::OVERLAY );
  
    // Any content after this point which is added to Self() will be reparented to
    // mContent.
    mAlterAddedChild = true;
    // Add Backing (Dim effect)
    CreateBacking();
+   mAlterAddedChild = false;
  
    // Add Dialog ( background image, title, content container, button container and tail )
    CreateDialog();
  
+   mLayer.Add( self );
+   mPopupLayout = Toolkit::TableView::New( 3, 1 );
+   mPopupLayout.SetName( "POPUP_LAYOUT_TABLE" );
+   mPopupLayout.SetParentOrigin(ParentOrigin::CENTER);
+   mPopupLayout.SetAnchorPoint(AnchorPoint::CENTER);
+   mPopupLayout.SetResizePolicy( FILL_TO_PARENT, WIDTH );
+   mPopupLayout.SetResizePolicy( USE_NATURAL_SIZE, HEIGHT );
+   mPopupLayout.SetFitHeight( 0 );   // Set row to fit
+   mPopupLayout.SetFitHeight( 1 );   // Set row to fit
+   self.Add( mPopupLayout );
+   // Any content after this point which is added to Self() will be reparented to
+   // mContent.
+   mAlterAddedChild = true;
    // Default content.
-   ShowTail(ParentOrigin::BOTTOM_CENTER);
//  ShowTail(ParentOrigin::BOTTOM_CENTER);
  
    // Hide content by default.
    SetState( Toolkit::Popup::POPUP_HIDE, 0.0f );
    SetAsKeyboardFocusGroup(true);
  }
  
+ void Popup::MarkDirtyForRelayout()
+ {
+   // Flag all the popup controls for relayout as it is about to be hidden and miss the main flagging pass
+   mLayer.RelayoutRequestTree();
+ }
  void Popup::OnPropertySet( Property::Index index, Property::Value propertyValue )
  {
    if( index == mPropertyTitle )
  
  Popup::~Popup()
  {
+   mLayer.Unparent();
  }
  
  size_t Popup::GetButtonCount() const
  void Popup::SetBackgroundImage( Actor image )
  {
    // Removes any previous background.
-   if( mBackgroundImage && mPopupBg )
+   if( mBackgroundImage && mPopupLayout )
    {
-     mPopupBg.Remove( mBackgroundImage );
+     mPopupLayout.Remove( mBackgroundImage );
    }
  
    // Adds new background to the dialog.
    mBackgroundImage = image;
  
+   mBackgroundImage.SetName( "POPUP_BACKGROUND_IMAGE" );
    // OnDialogTouched only consume the event. It prevents the touch event to be caught by the backing.
    mBackgroundImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched );
  
-   mPopupBg.Add( mBackgroundImage );
+   mBackgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+   mBackgroundImage.SetAnchorPoint( AnchorPoint::CENTER );
+   mBackgroundImage.SetParentOrigin( ParentOrigin::CENTER );
+   mBackgroundImage.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
+   Vector3 border( mPopupStyle->backgroundOuterBorder.x, mPopupStyle->backgroundOuterBorder.z, 0.0f );
+   mBackgroundImage.SetSizeModeFactor( border );
+   const bool prevAlter = mAlterAddedChild;
+   mAlterAddedChild = false;
+   Self().Add( mBackgroundImage );
+   mAlterAddedChild = prevAlter;
  }
  
  void Popup::SetButtonAreaImage( Actor image )
  {
    // Removes any previous area image.
-   if( mButtonAreaImage && mPopupBg )
+   if( mButtonAreaImage && mPopupLayout )
    {
-     mPopupBg.Remove( mButtonAreaImage );
+     mPopupLayout.Remove( mButtonAreaImage );
    }
  
    // Adds new area image to the dialog.
    // OnDialogTouched only consume the event. It prevents the touch event to be caught by the backing.
    mButtonAreaImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched );
  
-   mPopupBg.Add( mButtonAreaImage );
+   mButtonAreaImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+   mButtonAreaImage.SetAnchorPoint( AnchorPoint::CENTER );
+   mButtonAreaImage.SetParentOrigin( ParentOrigin::CENTER );
+   if( GetButtonCount() > 0 )
+   {
+     mBottomBg.Add( mButtonAreaImage );
+   }
  }
  
  void Popup::SetTitle( const std::string& text )
  {
 -  Toolkit::TextView titleActor = Toolkit::TextView::New();
 -  titleActor.SetName( "POPUP_TITLE" );
 -  titleActor.SetText( text );
 -  titleActor.SetColor( Color::BLACK );
 -  titleActor.SetMultilinePolicy( Toolkit::TextView::SplitByWord );
 -  titleActor.SetWidthExceedPolicy( Toolkit::TextView::Split );
 -  titleActor.SetLineJustification( Toolkit::TextView::Center );
 -
 -  SetTitle( titleActor );
 -}
 -
 -void Popup::SetTitle( Toolkit::TextView titleActor )
 -{
 -  // Replaces the current title actor.
 -  if( mPopupLayout )
 -  {
 -    mPopupLayout.RemoveChildAt( Toolkit::TableView::CellPosition( 0, 0 ) );
 -  }
 -
 -  mTitle = titleActor;
 -
 -  if( mPopupLayout )
 -  {
 -    mTitle.SetPadding( Padding( 0.0f, 0.0f, mPopupStyle->margin, mPopupStyle->margin ) );
 -    mTitle.SetResizePolicy( FILL_TO_PARENT, WIDTH );
 -    mTitle.SetDimensionDependency( HEIGHT, WIDTH ); // HeightForWidth
 -    mPopupLayout.AddChild( mTitle, Toolkit::TableView::CellPosition( 0, 0 ) );
 -  }
 -
 -  RelayoutRequest();
++// TODO
  }
  
 -Toolkit::TextView Popup::GetTitle() const
 +const std::string& Popup::GetTitle() const
  {
 -  return mTitle;
 +  static std::string temp("");
 +  return temp;
  }
  
+ void Popup::CreateFooter()
+ {
+   if( !mBottomBg )
+   {
+     // Adds bottom background
+     mBottomBg = Actor::New();
+     mBottomBg.SetName( "POPUP_BOTTOM_BG" );
+     mBottomBg.SetRelayoutEnabled( true );
+     mBottomBg.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
+     mPopupLayout.SetFixedHeight( 2, mPopupStyle->bottomSize.height );   // Buttons
+     mPopupLayout.AddChild( mBottomBg, Toolkit::TableView::CellPosition( 2, 0 ) );
+   }
+ }
  void Popup::AddButton( Toolkit::Button button )
  {
    mButtons.push_back( button );
+   button.SetResizePolicy( USE_ASSIGNED_SIZE, ALL_DIMENSIONS );    // Size will be assigned to it
+   // If this is the first button added
+   if( mButtons.size() == 1 )
+   {
+     CreateFooter();
+     if( mButtonAreaImage )
+     {
+       mBottomBg.Add( mButtonAreaImage );
+     }
+   }
    mBottomBg.Add( button );
  
    RelayoutRequest();
@@@ -326,6 -390,8 +362,8 @@@ void Popup::ShowTail(const Vector3& pos
      mTailImage.SetParentOrigin(position);
      mTailImage.SetAnchorPoint(anchorPoint);
  
+     CreateFooter();
      mBottomBg.Add(mTailImage);
    }
  }
@@@ -348,30 -414,25 +386,25 @@@ PopupStylePtr Popup::GetStyle() cons
  
  void Popup::SetDefaultBackgroundImage()
  {
-   Image bg = ResourceImage::New( mPopupStyle->backgroundImage );
-   ImageActor bgImage = ImageActor::New( bg );
-   bgImage.SetStyle( ImageActor::STYLE_NINE_PATCH );
-   bgImage.SetNinePatchBorder( mPopupStyle->backgroundScale9Border );
    Image buttonBg = ResourceImage::New( mPopupStyle->buttonAreaImage );
    ImageActor buttonBgImage = ImageActor::New( buttonBg );
    buttonBgImage.SetStyle( ImageActor::STYLE_NINE_PATCH );
    buttonBgImage.SetNinePatchBorder( mPopupStyle->buttonArea9PatchBorder );
  
-   SetBackgroundImage( bgImage );
+   SetBackgroundImage( ImageActor::New( ResourceImage::New( mPopupStyle->backgroundImage ) ) );
    SetButtonAreaImage( buttonBgImage );
  }
  
  void Popup::CreateBacking()
  {
    mBacking = Dali::Toolkit::CreateSolidColorActor( mPopupStyle->backingColor );
+   mBacking.SetName( "POPUP_BACKING" );
  
-   mBacking.SetPositionInheritanceMode(DONT_INHERIT_POSITION);
+   mBacking.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
    mBacking.SetSensitive(true);
  
-   mLayer.Add(mBacking);
+   mLayer.Add( mBacking );
    mBacking.SetOpacity(0.0f);
-   mBacking.SetPosition(0.0f, 0.0f, BACKING_DEPTH);
    mBacking.TouchedSignal().Connect( this, &Popup::OnBackingTouched );
    mBacking.MouseWheelEventSignal().Connect(this, &Popup::OnBackingMouseWheelEvent);
  }
@@@ -380,19 -441,12 +413,12 @@@ void Popup::CreateDialog(
  {
    // Adds default background image.
    SetDefaultBackgroundImage();
-   // Adds bottom background
-   mBottomBg = Actor::New();
-   mPopupBg.Add( mBottomBg );
  }
  
  void Popup::HandleStateChange( Toolkit::Popup::PopupState state, float duration )
  {
-   const Vector2& stageSize( Stage::GetCurrent().GetSize() );
    Vector3 targetSize;
    float targetBackingAlpha;
-   Vector3 targetBackingSize;
  
    if(mState == state)
    {
      {
        targetSize = Vector3(0.0f, 0.0f, 1.0f);
        targetBackingAlpha = 0.0f;
-       targetBackingSize = Vector3(0.0f, 0.0f, 1.0f);
        mShowing = false;
        ClearKeyInputFocus();
  
      {
        targetSize = Vector3(1.0f, 1.0f, 1.0f);
        targetBackingAlpha = 1.0f;
-       float length = (stageSize.width > stageSize.height) ? stageSize.width : stageSize.height;
-       targetBackingSize = Vector3( length, length, 1.0f );
        mShowing = true;
  
        // Add contents to stage for showing.
        if( !mLayer.GetParent() )
        {
-         mAlterAddedChild = false;
-         Self().Add(mLayer);
-         mAlterAddedChild = true;
+         Dali::Stage stage = Dali::Stage::GetCurrent();
+         stage.Add( mLayer );
+         mLayer.RaiseToTop();
        }
        Self().SetSensitive(true);
        SetKeyInputFocus();
  
      }
    }
  
-   mBacking.SetSize( targetBackingSize );
+   Actor self = Self();
    if(duration > Math::MACHINE_EPSILON_1)
    {
      if ( mAnimation )
      if(mShowing)
      {
        mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) );
-       mAnimation.AnimateTo( Property(mPopupBg, Actor::Property::SCALE), targetSize, AlphaFunctions::EaseInOut, TimePeriod(duration * 0.5f, duration * 0.5f) );
+       mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunctions::EaseInOut, TimePeriod(duration * 0.5f, duration * 0.5f) );
      }
      else
      {
        mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) );
-       mAnimation.AnimateTo( Property(mPopupBg, Actor::Property::SCALE), targetSize, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) );
+       mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) );
      }
      mAnimation.Play();
      mAnimation.FinishedSignal().Connect(this, &Popup::OnStateAnimationFinished);
    else
    {
      mBacking.SetOpacity( targetBackingAlpha );
-     mPopupBg.SetScale( targetSize );
+     self.SetScale( targetSize );
  
      HandleStateChangeComplete();
    }
  void Popup::HandleStateChangeComplete()
  {
    // Remove contents from stage if completely hidden.
-   if( (mState == Toolkit::Popup::POPUP_HIDE) && (mLayer.GetParent()) )
+   if( ( mState == Toolkit::Popup::POPUP_HIDE ) && mLayer.GetParent() )
    {
-     Self().Remove(mLayer);
+     mLayer.Unparent();
      Self().SetSensitive( false );
  
      // Guard against destruction during signal emission
@@@ -591,152 -642,78 +614,78 @@@ void Popup::OnControlChildAdd( Actor& c
      // Removes previously added content.
      if( mContent )
      {
-       mPopupBg.Remove( mContent );
+       mPopupLayout.RemoveChildAt( Toolkit::TableView::CellPosition( 1, 0 ) );
      }
  
-     // Reparent new content.
-     Self().Remove( child );
      // keep a handle to the new content.
      mContent = child;
  
-     mPopupBg.Add( mContent );
+     mPopupLayout.AddChild( mContent, Toolkit::TableView::CellPosition( 1, 0 ) );
    }
  }
  
- void Popup::OnControlSizeSet( const Vector3& targetSize )
+ void Popup::OnRelayout( const Vector2& size, RelayoutContainer& container )
  {
-   mLayer.SetSize( targetSize );
-   mPopupBg.SetSize( targetSize );
-   const Vector4 outerBorder = mPopupStyle->backgroundOuterBorder;
-   if( mBackgroundImage )
-   {
-     mBackgroundImage.SetSize( BackgroundSize( outerBorder,targetSize ) );
-   }
-   if( mButtonAreaImage )
-   {
-     mButtonAreaImage.SetSize( ButtonAreaSize( outerBorder, targetSize ) );
-   }
- }
- void Popup::OnRelayout( const Vector2& size, ActorSizeContainer& container )
- {
-   // Set the popup size
-   Vector2 popupSize;
-   popupSize.width  = size.width - 2.f * ( POPUP_OUT_MARGIN_WIDTH + mPopupStyle->margin );
-   popupSize.height = size.height - 2.f * ( POPUP_OUT_MARGIN_WIDTH + mPopupStyle->margin );
-   // Update sizes of all popup's components.
-   // Relayout background image.
-   // Adjust background position and size relative to parent to cater to outer Border.
-   // Some backgrounds are intended to over-spill. That is some content
-   // should appear outside the Dialog on all sides i.e. Shadows, glow effects.
-   const Vector4 outerBorder = mPopupStyle->backgroundOuterBorder;
-   if( mBackgroundImage )
-   {
-     mBackgroundImage.SetSize(BackgroundSize(outerBorder, Vector3(size)));
-     mBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
-     mBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
-     mBackgroundImage.SetPosition( -outerBorder.x, -outerBorder.y, 0.0f );
-   }
-   if( mPopupBg && mButtonAreaImage )
-   {
-     // If there are no buttons, button background is also removed.
-     if ( mButtons.size() == 0 )
-     {
-       mPopupBg.Remove( mButtonAreaImage );
-     }
-     else
-     {
-       mButtonAreaImage.SetSize( ButtonAreaSize(outerBorder, Vector3(size)) );
-       mButtonAreaImage.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
-       mButtonAreaImage.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
-       mButtonAreaImage.SetY( -outerBorder.z - POPUP_OUT_MARGIN_HEIGHT );
-       mPopupBg.Add( mButtonAreaImage );
-     }
-   }
-   // Relayout title
-   Vector3 positionOffset( 0.0f, mPopupStyle->margin + POPUP_OUT_MARGIN_WIDTH, CONTENT_DEPTH );
-   // TODO
-   // Relayout content
-   if( mContent )
-   {
-     // If the content width is greater than popup width then scale it down/wrap text as needed
-     Vector2 contentSize( RelayoutHelper::GetNaturalSize( mContent ) );
-     if( contentSize.width > popupSize.width )
-     {
-       contentSize.width = popupSize.width;
-       contentSize.height = RelayoutHelper::GetHeightForWidth( mContent, contentSize.width );
-     }
-     mContent.SetSize( contentSize );
-     Relayout( mContent, contentSize, container );
-     mContent.SetParentOrigin(ParentOrigin::TOP_CENTER);
-     mContent.SetAnchorPoint(AnchorPoint::TOP_CENTER);
-     mContent.SetPosition( positionOffset );
-     positionOffset.y += contentSize.height + mPopupStyle->margin;
-   }
-   // Relayout Button Area
-   if( mBottomBg )
-   {
-     mBottomBg.SetSize( popupSize.width, mPopupStyle->bottomSize.height );
-     mBottomBg.SetParentOrigin(ParentOrigin::TOP_CENTER);
-     mBottomBg.SetAnchorPoint(AnchorPoint::TOP_CENTER);
-     mBottomBg.SetPosition( positionOffset );
-   }
+   // Hide the background image
+   mBackgroundImage.SetVisible( !( mButtons.empty() && mPopupLayout.GetChildCount() == 0 ) );
  
    // Relayout All buttons
    if ( !mButtons.empty() )
    {
      // All buttons should be the same size and fill the button area. The button spacing needs to be accounted for as well.
-     Vector2 buttonSize( ( ( popupSize.width - mPopupStyle->buttonSpacing * ( mButtons.size() - 1 ) ) / mButtons.size() ),
+     Vector2 buttonSize( ( ( size.width - mPopupStyle->buttonSpacing * ( mButtons.size() + 1 ) ) / mButtons.size() ),
                          mPopupStyle->bottomSize.height - mPopupStyle->margin );
  
-     Vector3 buttonPosition;
+     Vector3 buttonPosition( mPopupStyle->buttonSpacing, 0.0f, 0.0f );
  
      for ( ActorIter iter = mButtons.begin(), endIter = mButtons.end();
            iter != endIter;
            ++iter, buttonPosition.x += mPopupStyle->buttonSpacing + buttonSize.width )
      {
-       iter->SetPosition( buttonPosition );
+       Actor button = *iter;
  
        // If there is only one button, it needs to be laid out on center.
        if ( mButtons.size() == 1 )
        {
-         iter->SetAnchorPoint( AnchorPoint::CENTER );
-         iter->SetParentOrigin( ParentOrigin::CENTER );
+         buttonPosition.x = 0.0f;
+         button.SetAnchorPoint( AnchorPoint::CENTER );
+         button.SetParentOrigin( ParentOrigin::CENTER );
        }
        else
        {
-         iter->SetAnchorPoint( AnchorPoint::CENTER_LEFT );
-         iter->SetParentOrigin( ParentOrigin::CENTER_LEFT );
+         button.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
+         button.SetParentOrigin( ParentOrigin::CENTER_LEFT );
        }
  
-       Relayout( *iter, buttonSize, container );
+       button.SetPosition( buttonPosition );
+       button.PropagateRelayoutFlags();    // Reset relayout flags for relayout
+       container.Add( button, buttonSize );
      }
    }
+ }
  
-   if( mShowing && mBacking )
+ void Popup::OnSetResizePolicy( ResizePolicy policy, Dimension dimension )
+ {
+   if( mPopupLayout )
    {
-     Vector2 stageSize = Stage::GetCurrent().GetSize();
-     float length = (stageSize.width > stageSize.height) ? stageSize.width : stageSize.height;
-     Vector3 targetBackingSize = Vector3( length, length, 1.0f );
-     mBacking.SetSize( targetBackingSize );
+     if( policy == FIT_TO_CHILDREN )
+     {
+       mPopupLayout.SetResizePolicy( USE_NATURAL_SIZE, dimension );
+       if( dimension & HEIGHT )
+       {
+         mPopupLayout.SetFitHeight( 1 );
+       }
+     }
+     else
+     {
+       mPopupLayout.SetResizePolicy( FILL_TO_PARENT, dimension );
+       // Make the content cell fill the whole of the available space
+       if( dimension & HEIGHT )
+       {
+         mPopupLayout.SetRelativeHeight( 1, 1.0f );
+       }
+     }
    }
  }
  
@@@ -763,15 -740,38 +712,15 @@@ Vector3 Popup::GetNaturalSize(
  
    Vector3 naturalSize( 0.0f, 0.0f, 0.0f );
  
 -  if ( mTitle )
 -  {
 -    Vector3 titleNaturalSize = mTitle.GetImplementation().GetNaturalSize();
 -    // Buffer to avoid errors. The width of the popup could potentially be the width of the title text.
 -    // It was observed in this case that text wrapping was then inconsistent when seen on device
 -    const float titleBuffer = 0.5f;
 -    titleNaturalSize.width += titleBuffer;
 -
 -    // As TextView GetNaturalSize does not take wrapping into account, limit the width
 -    // to that of the stage
 -    if( titleNaturalSize.width >= maxWidth)
 -    {
 -      naturalSize.width = maxWidth;
 -      naturalSize.height = mTitle.GetImplementation().GetHeightForWidth( naturalSize.width );
 -    }
 -    else
 -    {
 -      naturalSize += titleNaturalSize;
 -    }
 -
 -    naturalSize.height += mPopupStyle->margin;
 -  }
 -
    if( mContent )
    {
-     Vector3 contentSize = RelayoutHelper::GetNaturalSize( mContent );
+     Vector3 contentSize = mContent.GetNaturalSize();
      // Choose the biggest width
      naturalSize.width = std::max( naturalSize.width, contentSize.width );
      if( naturalSize.width > maxWidth )
      {
        naturalSize.width = maxWidth;
-       contentSize.height = RelayoutHelper::GetHeightForWidth( mContent, maxWidth );
+       contentSize.height = mContent.GetHeightForWidth( maxWidth );
      }
      naturalSize.height += contentSize.height + mPopupStyle->margin;
    }
@@@ -793,9 -793,15 +742,9 @@@ float Popup::GetHeightForWidth( float w
    float height( 0.0f );
    float popupWidth( width - 2.f * ( POPUP_OUT_MARGIN_WIDTH + mPopupStyle->margin ) );
  
 -  if ( mTitle )
 -  {
 -    height += mTitle.GetImplementation().GetHeightForWidth( popupWidth );
 -    height += mPopupStyle->margin;
 -  }
 -
    if( mContent )
    {
-     height += RelayoutHelper::GetHeightForWidth( mContent, popupWidth ) + mPopupStyle->margin;
+     height += mContent.GetHeightForWidth( popupWidth ) + mPopupStyle->margin;
    }
  
    if( !mButtons.empty() )
@@@ -27,6 -27,7 +27,7 @@@
  #include <dali-toolkit/public-api/controls/control-impl.h>
  #include <dali-toolkit/public-api/controls/popup/popup.h>
  #include <dali-toolkit/internal/controls/popup/popup-style-impl.h>
+ #include <dali-toolkit/public-api/controls/table-view/table-view.h>
  
  namespace Dali
  {
@@@ -83,9 -84,14 +84,9 @@@ public
    void SetTitle( const std::string& text );
  
    /**
 -   * @copydoc Toolkit::Popup::SetTitle( TextView titleActor )
 -   */
 -  void SetTitle( Toolkit::TextView titleActor );
 -
 -  /**
     * @copydoc Toolkit::Popup::GetTitle
     */
 -  Toolkit::TextView GetTitle() const;
 +  const std::string& GetTitle() const;
  
    /**
     * @copydoc Toolkit::Popup::AddButton
     */
    void HideTail();
  
    /**
     * Sets the style of the popup
     * @param[in] style The style of the popup
     */
    PopupStylePtr GetStyle() const;
  
+   /**
+    * @copydoc Toolkit::Popup::MarkDirtyForRelayout
+    */
+   void MarkDirtyForRelayout();
  protected:
  
    /**
@@@ -246,14 -256,14 +251,14 @@@ private
    virtual void OnControlChildAdd( Actor& child );
  
    /**
-    * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& size )
+    * @copydoc Control::OnRelayOut()
     */
-   virtual void OnControlSizeSet( const Vector3& size );
+   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
  
    /**
-    * @copydoc Control::OnRelayOut()
+    * @copydoc Control::OnSetResizePolicy()
     */
-   virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
+   virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension );
  
    /**
     * @copydoc Control::OnKeyEvent()
     */
    Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled);
  
+   /**
+    * Create the root actor for the footer
+    */
+   void CreateFooter();
  private:
  
    // Undefined
@@@ -303,13 -318,14 +313,13 @@@ private
    bool mShowing;                          ///< Popup is showing or not
  
    Layer mLayer;                           ///< Popup Layer (i.e. Dim backing and PopupBg reside in this)
-   Actor mPopupBg;                         ///< Popup Background (i.e. dialog reside in this)
+   Toolkit::TableView mPopupLayout;        ///< Popup layout (i.e. dialog reside in this)
    ImageActor mBacking;                    ///< Backing actor (dim effect)
  
    Actor mPreviousFocusedActor;            ///< Store the previous focused actor to restore the focus when popup hide
  
    Actor mBackgroundImage;                 ///< Stores the background image.
    Actor mButtonAreaImage;                 ///< Stores the button background image.
 -  Toolkit::TextView mTitle;               ///< Stores the text title.
    Actor mContent;                         ///< Stores popup's content.
    Actor mBottomBg;                        ///< bottom button bar background. ImageActor is replaced with Actor due to hidden image.
    Actor mTailImage;                       ///< Stores the tail image
@@@ -347,6 -347,15 +347,8 @@@ void Slider::DisplayValue( float value
        mMarkSignal.Emit( self, markIndex );
      }
    }
 -  if( mHandleValueTextView )
 -  {
 -    std::stringstream ss;
 -    ss.precision( GetValuePrecision() );
 -    ss << std::fixed << clampledValue;
 -
 -    mHandleValueTextView.SetText( ss.str() );
 -  }
++  // TODO
  }
  
  void Slider::SetMarks( const MarkList& marks )
@@@ -389,6 -398,7 +391,7 @@@ Actor Slider::CreateHitRegion(
  ImageActor Slider::CreateBacking()
  {
    ImageActor backing = ImageActor::New();
+   backing.SetRelayoutEnabled( false );
    backing.SetParentOrigin( ParentOrigin::CENTER );
    backing.SetAnchorPoint( AnchorPoint::CENTER );
    backing.SetZ( BACKING_Z );
@@@ -418,6 -428,7 +421,7 @@@ std::string Slider::GetBackingImageName
  ImageActor Slider::CreateProgress()
  {
    ImageActor progress = ImageActor::New();
+   progress.SetRelayoutEnabled( false );
    progress.SetParentOrigin( ParentOrigin::CENTER_LEFT );
    progress.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
    progress.SetZ( PROGRESS_Z );
@@@ -493,6 -504,7 +497,7 @@@ void Slider::ResizeProgressRegion( cons
  ImageActor Slider::CreateHandle()
  {
    ImageActor handle = ImageActor::New();
+   handle.SetRelayoutEnabled( false );
    handle.SetParentOrigin( ParentOrigin::CENTER_LEFT );
    handle.SetAnchorPoint( AnchorPoint::CENTER );
    handle.SetZ( HANDLE_Z );
  ImageActor Slider::CreatePopupArrow()
  {
    ImageActor arrow = ImageActor::New();
+   arrow.SetRelayoutEnabled( false );
    arrow.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
    arrow.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
    arrow.SetZ( HANDLE_Z );
    return arrow;
  }
  
 -Toolkit::TextView Slider::CreatePopupText()
 -{
 -  Toolkit::TextView textView = Toolkit::TextView::New();
 -  textView.SetParentOrigin( ParentOrigin::CENTER );
 -  textView.SetAnchorPoint( AnchorPoint::CENTER );
 -  textView.SetZ( VALUE_DISPLAY_TEXT_Z );
 -  return textView;
 -}
 +//Toolkit::TextView Slider::CreatePopupText()
 +//{
 +//}
  
  ImageActor Slider::CreatePopup()
  {
    ImageActor popup = ImageActor::New();
+   popup.SetRelayoutEnabled( false );
    popup.SetParentOrigin( ParentOrigin::TOP_CENTER );
    popup.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  
 -  mValueTextView = CreatePopupText();
 -  popup.Add( mValueTextView );
 -
    return popup;
  }
  
@@@ -552,10 -574,24 +559,10 @@@ void Slider::ResizeHandleRegion( const 
  
  void Slider::CreateHandleValueDisplay()
  {
 -  if( mHandle && !mHandleValueTextView )
 -  {
 -    mHandleValueTextView = Toolkit::TextView::New();
 -    mHandleValueTextView.SetParentOrigin( ParentOrigin::CENTER );
 -    mHandleValueTextView.SetAnchorPoint( AnchorPoint::CENTER );
 -    mHandleValueTextView.SetSize( GetHandleRegion() );
 -    mHandleValueTextView.SetZ( HANDLE_VALUE_DISPLAY_TEXT_Z );
 -    mHandle.Add( mHandleValueTextView );
 -  }
  }
  
  void Slider::DestroyHandleValueDisplay()
  {
 -  if(mHandleValueTextView)
 -  {
 -    mHandleValueTextView.Unparent();
 -    mHandleValueTextView.Reset();
 -  }
  }
  
  void Slider::SetPopupTextColor( const Vector4& color )
@@@ -981,6 -1017,32 +988,6 @@@ bool Slider::DoConnectSignal( BaseObjec
  
  void Slider::DisplayPopup( float value )
  {
 -  // Value displayDoConnectSignal
 -  if( mValueTextView )
 -  {
 -    std::stringstream ss;
 -    ss.precision( GetValuePrecision() );
 -    ss << std::fixed << value;
 -    mValueTextView.SetText( ss.str() );
 -    TextStyle style;
 -    style.SetTextColor( GetPopupTextColor() );
 -    mValueTextView.SetStyleToCurrentText( style, TextStyle::COLOR);
 -
 -    if( mValueDisplay )
 -    {
 -      Font font = Font::New();
 -      float popupWidth = font.MeasureText( ss.str() ).x + VALUE_POPUP_MARGIN * 2.0f;
 -      if( popupWidth < VALUE_POPUP_MIN_WIDTH )
 -      {
 -        popupWidth = VALUE_POPUP_MIN_WIDTH;
 -      }
 -
 -      mPopup.SetSize( popupWidth, VALUE_POPUP_HEIGHT );
 -      mValueDisplay.SetVisible( true );
 -
 -      mValueTimer.SetInterval( VALUE_VIEW_SHOW_DURATION );
 -    }
 -  }
  }
  
  void Slider::SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
index 390cb89,0000000..38d2732
mode 100644,000000..100644
--- /dev/null
@@@ -1,640 -1,0 +1,640 @@@
- void TextField::OnRelayout( const Vector2& size, ActorSizeContainer& container )
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// CLASS HEADER
 +#include <dali-toolkit/internal/controls/text-controls/text-field-impl.h>
 +
 +// EXTERNAL INCLUDES
 +#include <string>
 +#include <dali/public-api/adaptor-framework/key.h>
 +#include <dali/public-api/common/stage.h>
 +#include <dali/public-api/images/resource-image.h>
 +#include <dali/public-api/object/type-registry.h>
 +#include <dali/public-api/object/type-registry-helper.h>
 +#include <dali/public-api/scripting/scripting.h>
 +#include <dali/integration-api/debug.h>
 +#include <dali/public-api/adaptor-framework/virtual-keyboard.h>
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/text/rendering-backend.h>
 +#include <dali-toolkit/internal/text/layouts/layout-engine.h>
 +#include <dali-toolkit/internal/text/rendering/text-backend.h>
 +#include <dali-toolkit/internal/styling/style-manager-impl.h>
 +
 +using namespace Dali::Toolkit::Text;
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal
 +{
 +
 +namespace
 +{
 +  const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
 +}
 +
 +namespace
 +{
 +
 +const Scripting::StringEnum< Toolkit::Text::LayoutEngine::HorizontalAlignment > HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
 +{
 +  { "BEGIN",  Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_BEGIN  },
 +  { "CENTER", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_CENTER },
 +  { "END",    Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_END    },
 +};
 +const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
 +
 +const Scripting::StringEnum< Toolkit::Text::LayoutEngine::VerticalAlignment > VERTICAL_ALIGNMENT_STRING_TABLE[] =
 +{
 +  { "TOP",    Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_TOP    },
 +  { "CENTER", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_CENTER },
 +  { "BOTTOM", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_BOTTOM },
 +};
 +const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
 +
 +// Type registration
 +BaseHandle Create()
 +{
 +  return Toolkit::TextField::New();
 +}
 +
 +// Setup properties, signals and actions using the type-registry.
 +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextField, Toolkit::Control, Create );
 +
 +DALI_PROPERTY_REGISTRATION( TextField, "rendering-backend",       INTEGER,   RENDERING_BACKEND       )
 +DALI_PROPERTY_REGISTRATION( TextField, "placeholder-text",        STRING,    PLACEHOLDER_TEXT        )
 +DALI_PROPERTY_REGISTRATION( TextField, "text",                    STRING,    TEXT                    )
 +DALI_PROPERTY_REGISTRATION( TextField, "font-family",             STRING,    FONT_FAMILY             )
 +DALI_PROPERTY_REGISTRATION( TextField, "font-style",              STRING,    FONT_STYLE              )
 +DALI_PROPERTY_REGISTRATION( TextField, "point-size",              FLOAT,     POINT_SIZE              )
 +DALI_PROPERTY_REGISTRATION( TextField, "exceed-policy",           INTEGER,   EXCEED_POLICY           )
 +DALI_PROPERTY_REGISTRATION( TextField, "primary-cursor-color",    VECTOR4,   PRIMARY_CURSOR_COLOR    )
 +DALI_PROPERTY_REGISTRATION( TextField, "secondary-cursor-color",  VECTOR4,   SECONDARY_CURSOR_COLOR  )
 +DALI_PROPERTY_REGISTRATION( TextField, "enable-cursor-blink",     BOOLEAN,   ENABLE_CURSOR_BLINK     )
 +DALI_PROPERTY_REGISTRATION( TextField, "cursor-blink-interval",   FLOAT,     CURSOR_BLINK_INTERVAL   )
 +DALI_PROPERTY_REGISTRATION( TextField, "cursor-blink-duration",   FLOAT,     CURSOR_BLINK_DURATION   )
 +DALI_PROPERTY_REGISTRATION( TextField, "grab-handle-image",       STRING,    GRAB_HANDLE_IMAGE       )
 +DALI_PROPERTY_REGISTRATION( TextField, "decoration-bounding-box", RECTANGLE, DECORATION_BOUNDING_BOX )
 +DALI_PROPERTY_REGISTRATION( TextField, "horizontal-alignment",    STRING,    HORIZONTAL_ALIGNMENT    )
 +DALI_PROPERTY_REGISTRATION( TextField, "vertical-alignment",      STRING,    VERTICAL_ALIGNMENT      )
 +DALI_TYPE_REGISTRATION_END()
 +
 +} // namespace
 +
 +Toolkit::TextField TextField::New()
 +{
 +  // Create the implementation, temporarily owned by this handle on stack
 +  IntrusivePtr< TextField > impl = new TextField();
 +
 +  // Pass ownership to CustomActor handle
 +  Toolkit::TextField handle( *impl );
 +
 +  // Second-phase init of the implementation
 +  // This can only be done after the CustomActor connection has been made...
 +  impl->Initialize();
 +
 +  return handle;
 +}
 +
 +void TextField::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
 +{
 +  Toolkit::TextField textField = Toolkit::TextField::DownCast( Dali::BaseHandle( object ) );
 +
 +  if( textField )
 +  {
 +    TextField& impl( GetImpl( textField ) );
 +
 +    switch( index )
 +    {
 +      case Toolkit::TextField::Property::RENDERING_BACKEND:
 +      {
 +        int backend = value.Get< int >();
 +
 +        if( impl.mRenderingBackend != backend )
 +        {
 +          impl.mRenderingBackend = backend;
 +          impl.mRenderer.Reset();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::PLACEHOLDER_TEXT:
 +      {
 +        if( impl.mController )
 +        {
 +          //impl.mController->SetPlaceholderText( value.Get< std::string >() ); TODO
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::TEXT:
 +      {
 +        if( impl.mController )
 +        {
 +          impl.mController->SetText( value.Get< std::string >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::FONT_FAMILY:
 +      {
 +        if( impl.mController )
 +        {
 +          std::string fontFamily = value.Get< std::string >();
 +
 +          if( impl.mController->GetDefaultFontFamily() != fontFamily )
 +          {
 +            impl.mController->SetDefaultFontFamily( fontFamily );
 +            impl.RequestTextRelayout();
 +          }
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::FONT_STYLE:
 +      {
 +        if( impl.mController )
 +        {
 +          std::string fontStyle = value.Get< std::string >();
 +
 +          if( impl.mController->GetDefaultFontStyle() != fontStyle )
 +          {
 +            impl.mController->SetDefaultFontStyle( fontStyle );
 +            impl.RequestTextRelayout();
 +          }
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::POINT_SIZE:
 +      {
 +        if( impl.mController )
 +        {
 +          float pointSize = value.Get< float >();
 +
 +          if( impl.mController->GetDefaultPointSize() != pointSize /*TODO - epsilon*/ )
 +          {
 +            impl.mController->SetDefaultPointSize( pointSize );
 +            impl.RequestTextRelayout();
 +          }
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::EXCEED_POLICY:
 +      {
 +        impl.mExceedPolicy = value.Get< int >();
 +        break;
 +      }
 +      case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetColor( PRIMARY_CURSOR, value.Get< Vector4 >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetColor( SECONDARY_CURSOR, value.Get< Vector4 >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK:
 +      {
 +        if( impl.mController )
 +        {
 +          impl.mController->SetEnableCursorBlink( value.Get< bool >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetCursorBlinkInterval( value.Get< float >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::CURSOR_BLINK_DURATION:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetCursorBlinkDuration( value.Get< float >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::New( value.Get< std::string >() );
 +
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetGrabHandleImage( image );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          impl.mDecorator->SetBoundingBox( value.Get< Rect<int> >() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT:
 +      {
 +        LayoutEngine& engine = impl.mController->GetLayoutEngine();
 +        const LayoutEngine::HorizontalAlignment alignment = Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::HorizontalAlignment >( value.Get< std::string >().c_str(),
 +                                                                                                                                           HORIZONTAL_ALIGNMENT_STRING_TABLE,
 +                                                                                                                                           HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
 +
 +        if( engine.GetHorizontalAlignment() != alignment )
 +        {
 +          engine.SetHorizontalAlignment( alignment );
 +          impl.RequestTextRelayout();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
 +      {
 +        LayoutEngine& engine = impl.mController->GetLayoutEngine();
 +        const LayoutEngine::VerticalAlignment alignment = Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::VerticalAlignment >( value.Get< std::string >().c_str(),
 +                                                                                                                                       VERTICAL_ALIGNMENT_STRING_TABLE,
 +                                                                                                                                       VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
 +
 +        if( engine.GetVerticalAlignment() != alignment )
 +        {
 +          engine.SetVerticalAlignment( alignment );
 +          impl.RequestTextRelayout();
 +        }
 +        break;
 +      }
 +    } // switch
 +  } // textfield
 +}
 +
 +Property::Value TextField::GetProperty( BaseObject* object, Property::Index index )
 +{
 +  Property::Value value;
 +
 +  Toolkit::TextField textField = Toolkit::TextField::DownCast( Dali::BaseHandle( object ) );
 +
 +  if( textField )
 +  {
 +    TextField& impl( GetImpl( textField ) );
 +
 +    switch( index )
 +    {
 +      case Toolkit::TextField::Property::RENDERING_BACKEND:
 +      {
 +        value = impl.mRenderingBackend;
 +        break;
 +      }
 +      case Toolkit::TextField::Property::PLACEHOLDER_TEXT:
 +      {
 +        if( impl.mController )
 +        {
 +          std::string text;
 +          impl.mController->GetPlaceholderText( text );
 +          value = text;
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::TEXT:
 +      {
 +        if( impl.mController )
 +        {
 +          std::string text;
 +          impl.mController->GetText( text );
 +          value = text;
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::EXCEED_POLICY:
 +      {
 +        value = impl.mExceedPolicy;
 +        break;
 +      }
 +      case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          value = impl.mDecorator->GetColor( PRIMARY_CURSOR );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          value = impl.mDecorator->GetColor( SECONDARY_CURSOR );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK:
 +      {
 +        value = impl.mController->GetEnableCursorBlink();
 +        break;
 +      }
 +      case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          value = impl.mDecorator->GetCursorBlinkInterval();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::CURSOR_BLINK_DURATION:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          value = impl.mDecorator->GetCursorBlinkDuration();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX:
 +      {
 +        if( impl.mDecorator )
 +        {
 +          value = impl.mDecorator->GetBoundingBox();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT:
 +      {
 +        if( impl.mController )
 +        {
 +          value = std::string( Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::HorizontalAlignment >( impl.mController->GetLayoutEngine().GetHorizontalAlignment(),
 +                                                                                                                  HORIZONTAL_ALIGNMENT_STRING_TABLE,
 +                                                                                                                  HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT ) );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
 +      {
 +        if( impl.mController )
 +        {
 +          value = std::string( Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::VerticalAlignment >( impl.mController->GetLayoutEngine().GetVerticalAlignment(),
 +                                                                                                                  VERTICAL_ALIGNMENT_STRING_TABLE,
 +                                                                                                                  VERTICAL_ALIGNMENT_STRING_TABLE_COUNT ) );
 +        }
 +        break;
 +      }
 +    } //switch
 +  }
 +
 +  return value;
 +}
 +
 +void TextField::OnInitialize()
 +{
 +  mController = Text::Controller::New( *this );
 +
 +  mDecorator = Text::Decorator::New( *this, *mController );
 +
 +  mController->GetLayoutEngine().SetLayout( LayoutEngine::SINGLE_LINE_BOX );
 +
 +  mController->EnableTextInput( mDecorator );
 +
 +  // Forward input events to controller
 +  EnableGestureDetection(Gesture::Tap);
 +  GetTapGestureDetector().SetMaximumTapsRequired( 2 );
 +  EnableGestureDetection(Gesture::Pan);
 +
 +  // Set BoundingBox to stage size if not already set.
 +  if ( mDecorator->GetBoundingBox().IsEmpty() )
 +  {
 +    Vector2 stageSize = Dali::Stage::GetCurrent().GetSize();
 +    mDecorator->SetBoundingBox( Rect<int>( 0.0f, 0.0f, stageSize.width, stageSize.height ) );
 +  }
 +}
 +
 +void TextField::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
 +{
 +  GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
 +}
 +
 +Vector3 TextField::GetNaturalSize()
 +{
 +  return mController->GetNaturalSize();
 +}
 +
 +float TextField::GetHeightForWidth( float width )
 +{
 +  return mController->GetHeightForWidth( width );
 +}
 +
++void TextField::OnRelayout( const Vector2& size, RelayoutContainer& container )
 +{
 +  if( mController->Relayout( size ) ||
 +      !mRenderer )
 +  {
 +    const Vector2& scrollPosition = mController->GetScrollPosition();
 +    const Vector2& alignmentOffset = mController->GetAlignmentOffset();
 +
 +    Vector2 offset = scrollPosition + alignmentOffset;
 +
 +    if( mDecorator )
 +    {
 +      mDecorator->Relayout( size, offset );
 +    }
 +
 +    if( !mRenderer )
 +    {
 +      mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
 +    }
 +
 +    RenderableActor renderableActor;
 +    if( mRenderer )
 +    {
 +      renderableActor = mRenderer->Render( mController->GetView() );
 +    }
 +
 +    EnableClipping( (Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == mExceedPolicy), size );
 +
 +    if( renderableActor != mRenderableActor )
 +    {
 +      UnparentAndReset( mRenderableActor );
 +      mRenderableActor = renderableActor;
 +    }
 +
 +    if( mRenderableActor )
 +    {
 +      mRenderableActor.SetPosition( offset.x, offset.y );
 +
 +      // Make sure the actor is parented correctly with/without clipping
 +      if( mClipper )
 +      {
 +        mClipper->GetRootActor().Add( mRenderableActor );
 +      }
 +      else
 +      {
 +        Self().Add( mRenderableActor );
 +      }
 +    }
 +  }
 +}
 +
 +void TextField::OnKeyInputFocusGained()
 +{
 +  VirtualKeyboard::StatusChangedSignal().Connect( this, &TextField::KeyboardStatusChanged );
 +
 +  ImfManager imfManager = ImfManager::Get();
 +
 +  if ( imfManager )
 +  {
 +    imfManager.EventReceivedSignal().Connect( this, &TextField::OnImfEvent );
 +
 +    // Notify that the text editing start.
 +    imfManager.Activate();
 +
 +    // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
 +    imfManager.SetRestoreAfterFocusLost( true );
 +  }
 +
 +  mController->KeyboardFocusGainEvent();
 +}
 +
 +void TextField::OnKeyInputFocusLost()
 +{
 +  VirtualKeyboard::StatusChangedSignal().Disconnect( this, &TextField::KeyboardStatusChanged );
 +
 +  ImfManager imfManager = ImfManager::Get();
 +  if ( imfManager )
 +  {
 +    // The text editing is finished. Therefore the imf manager don't have restore activation.
 +    imfManager.SetRestoreAfterFocusLost( false );
 +
 +    // Notify that the text editing finish.
 +    imfManager.Deactivate();
 +
 +    imfManager.EventReceivedSignal().Disconnect( this, &TextField::OnImfEvent );
 +  }
 +
 +  mController->KeyboardFocusLostEvent();
 +}
 +
 +void TextField::OnTap( const TapGesture& gesture )
 +{
 +  // Show the keyboard if it was hidden.
 +  if (!VirtualKeyboard::IsVisible())
 +  {
 +    VirtualKeyboard::Show();
 +  }
 +
 +  SetKeyInputFocus();
 +
 +  mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x, gesture.localPoint.y );
 +}
 +
 +void TextField::OnPan( const PanGesture& gesture )
 +{
 +  mController->PanEvent( gesture.state, gesture.displacement );
 +}
 +
 +bool TextField::OnKeyEvent( const KeyEvent& event )
 +{
 +  if( Dali::DALI_KEY_ESCAPE == event.keyCode )
 +  {
 +    ClearKeyInputFocus();
 +  }
 +
 +  return mController->KeyEvent( event );
 +}
 +
 +ImfManager::ImfCallbackData TextField::OnImfEvent( Dali::ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
 +{
 +  switch ( imfEvent.eventName )
 +  {
 +    case ImfManager::COMMIT:
 +    {
 +      KeyEvent event( "", imfEvent.predictiveString, 0, 0, 0, KeyEvent::Down );
 +      mController->KeyEvent( event );
 +      break;
 +    }
 +    case ImfManager::PREEDIT: // fall through
 +    case ImfManager::DELETESURROUNDING:
 +    case ImfManager::GETSURROUNDING:
 +    case ImfManager::VOID:
 +    {
 +      // do nothing
 +    }
 +  } // end switch
 +
 +  return ImfManager::ImfCallbackData();
 +}
 +
 +void TextField::RequestTextRelayout()
 +{
 +  RelayoutRequest();
 +}
 +
 +void TextField::EnableClipping( bool clipping, const Vector2& size )
 +{
 +  if( clipping )
 +  {
 +    // Not worth to created clip actor if width or height is equal to zero.
 +    if( size.width > Math::MACHINE_EPSILON_1000 && size.height > Math::MACHINE_EPSILON_1000 )
 +    {
 +      if( !mClipper )
 +      {
 +        Actor self = Self();
 +
 +        mClipper = Clipper::New( size );
 +        self.Add( mClipper->GetRootActor() );
 +        self.Add( mClipper->GetImageActor() );
 +      }
 +      else if ( mClipper )
 +      {
 +        mClipper->Refresh( size );
 +      }
 +    }
 +  }
 +  else
 +  {
 +    // Note - this will automatically remove the root & image actors
 +    mClipper.Reset();
 +  }
 +}
 +
 +void TextField::KeyboardStatusChanged(bool keyboardShown)
 +{
 +  // Just hide the grab handle when keyboard is hidden.
 +  if (!keyboardShown )
 +  {
 +    mController->KeyboardFocusLostEvent();
 +  }
 +}
 +
 +TextField::TextField()
 +: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
 +  mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
 +  mExceedPolicy( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP )
 +{
 +}
 +
 +TextField::~TextField()
 +{
 +  mClipper.Reset();
 +}
 +
 +} // namespace Internal
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
index a4f4831,0000000..5428275
mode 100644,000000..100644
--- /dev/null
@@@ -1,212 -1,0 +1,212 @@@
-   virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
 +#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
 +#define __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
 +
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// EXTERNAL INCLUDES
 +#include <dali/public-api/adaptor-framework/imf-manager.h>
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/controls/control-impl.h>
 +#include <dali-toolkit/public-api/controls/text-controls/text-field.h>
 +#include <dali-toolkit/internal/text/clipping/text-clipper.h>
 +#include <dali-toolkit/internal/text/decorator/text-decorator.h>
 +#include <dali-toolkit/internal/text/text-control-interface.h>
 +#include <dali-toolkit/internal/text/text-controller.h>
 +#include <dali-toolkit/internal/text/rendering/text-renderer.h>
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal
 +{
 +
 +/**
 + * @brief A control which renders a short text string.
 + */
 +class TextField : public Control, public Text::ControlInterface
 +{
 +public:
 +
 +  /**
 +   * @copydoc Dali::Toollkit::TextField::New()
 +   */
 +  static Toolkit::TextField New();
 +
 +  // Properties
 +
 +  /**
 +   * @brief Called when a property of an object of this type is set.
 +   *
 +   * @param[in] object The object whose property is set.
 +   * @param[in] index The property index.
 +   * @param[in] value The new property value.
 +   */
 +  static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
 +
 +  /**
 +   * @brief Called to retrieve a property of an object of this type.
 +   *
 +   * @param[in] object The object whose property is to be retrieved.
 +   * @param[in] index The property index.
 +   * @return The current value of the property.
 +   */
 +  static Property::Value GetProperty( BaseObject* object, Property::Index index );
 +
 +private: // From Control
 +
 +  /**
 +   * @copydoc Control::OnInitialize()
 +   */
 +  virtual void OnInitialize();
 +
 +  /**
 +   * @copydoc Control::OnStyleChange()
 +   */
 +  virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
 +
 +  /**
 +   * @copydoc Control::GetNaturalSize()
 +   */
 +  virtual Vector3 GetNaturalSize();
 +
 +  /**
 +   * @copydoc Control::GetHeightForWidth()
 +   */
 +  virtual float GetHeightForWidth( float width );
 +
 +  /**
 +   * @copydoc Control::OnInitialize()
 +   */
++  virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
 +
 +  /**
 +   * @copydoc Control::OnKeyInputFocusGained()
 +   */
 +  virtual void OnKeyInputFocusGained();
 +
 +  /**
 +   * @copydoc Control::OnKeyInputFocusLost()
 +   */
 +  virtual void OnKeyInputFocusLost();
 +
 +  /**
 +   * @copydoc Control::OnTap()
 +   */
 +  virtual void OnTap( const TapGesture& tap );
 +
 +  /**
 +   * @copydoc Control::OnPan()
 +   */
 +  virtual void OnPan( const PanGesture& gesture );
 +
 +  /**
 +   * @copydoc Dali::CustomActorImpl::OnKeyEvent(const KeyEvent&)
 +   */
 +  virtual bool OnKeyEvent(const KeyEvent& event);
 +
 +  /**
 +   * @brief Event received from IMF manager
 +   *
 +   * @param[in] imfManager The IMF manager.
 +   * @param[in] imfEvent The event received.
 +   * @return A data struture indicating if update is needed, cursor position and current text.
 +   */
 +  ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
 +
 +  /**
 +   * @copydoc Text::ControlInterface::RequestTextRelayout()
 +   */
 +  virtual void RequestTextRelayout();
 +
 +private: // Implementation
 +
 +  /**
 +   * @brief Enable or disable clipping.
 +   *
 +   * @param[in] clipping True if clipping should be enabled.
 +   * @param[in] size The area to clip within.
 +   */
 +  void EnableClipping( bool clipping, const Vector2& size );
 +
 +  /**
 +   * @brief Callback when keyboard is shown/hidden.
 +   *
 +   * @param[in] keyboardShown True if keyboard is shown.
 +   */
 +  void KeyboardStatusChanged( bool keyboardShown );
 +
 +  /**
 +   * Construct a new TextField.
 +   */
 +  TextField();
 +
 +  /**
 +   * A reference counted object may only be deleted by calling Unreference()
 +   */
 +  virtual ~TextField();
 +
 +private:
 +
 +  // Undefined copy constructor and assignment operators
 +  TextField(const TextField&);
 +  TextField& operator=(const TextField& rhs);
 +
 +private: // Data
 +
 +  Text::ControllerPtr mController;
 +  Text::RendererPtr mRenderer;
 +  Text::DecoratorPtr mDecorator;
 +  Text::ClipperPtr mClipper; ///< For EXCEED_POLICY_CLIP
 +
 +  RenderableActor mRenderableActor;
 +
 +  int mRenderingBackend;
 +  int mExceedPolicy;
 +};
 +
 +} // namespace Internal
 +
 +// Helpers for public-api forwarding methods
 +
 +inline Toolkit::Internal::TextField& GetImpl( Toolkit::TextField& textField )
 +{
 +  DALI_ASSERT_ALWAYS(textField);
 +
 +  Dali::RefObject& handle = textField.GetImplementation();
 +
 +  return static_cast<Toolkit::Internal::TextField&>(handle);
 +}
 +
 +inline const Toolkit::Internal::TextField& GetImpl( const Toolkit::TextField& textField )
 +{
 +  DALI_ASSERT_ALWAYS(textField);
 +
 +  const Dali::RefObject& handle = textField.GetImplementation();
 +
 +  return static_cast<const Toolkit::Internal::TextField&>(handle);
 +}
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
 +
 +#endif // __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
index 69bb5dc,0000000..4ff2035
mode 100644,000000..100644
--- /dev/null
@@@ -1,401 -1,0 +1,407 @@@
- void TextLabel::OnRelayout( const Vector2& size, ActorSizeContainer& container )
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// CLASS HEADER
 +#include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
 +
 +// EXTERNAL INCLUDES
 +#include <dali/public-api/object/type-registry.h>
 +#include <dali/public-api/object/type-registry-helper.h>
 +#include <dali/public-api/scripting/scripting.h>
 +#include <dali/integration-api/debug.h>
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/text/rendering-backend.h>
 +#include <dali-toolkit/internal/text/layouts/layout-engine.h>
 +#include <dali-toolkit/internal/text/rendering/text-backend.h>
 +#include <dali-toolkit/internal/styling/style-manager-impl.h>
 +
 +using Dali::Toolkit::Text::LayoutEngine;
 +using Dali::Toolkit::Text::Backend;
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal
 +{
 +
 +namespace
 +{
 +  const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
 +}
 +
 +namespace
 +{
 +
 +const Scripting::StringEnum< Toolkit::Text::LayoutEngine::HorizontalAlignment > HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
 +{
 +  { "BEGIN",  Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_BEGIN  },
 +  { "CENTER", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_CENTER },
 +  { "END",    Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_END    },
 +};
 +const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
 +
 +const Scripting::StringEnum< Toolkit::Text::LayoutEngine::VerticalAlignment > VERTICAL_ALIGNMENT_STRING_TABLE[] =
 +{
 +  { "TOP",    Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_TOP    },
 +  { "CENTER", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_CENTER },
 +  { "BOTTOM", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_BOTTOM },
 +};
 +const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
 +
 +// Type registration
 +BaseHandle Create()
 +{
 +  return Toolkit::TextLabel::New();
 +}
 +
 +// Setup properties, signals and actions using the type-registry.
 +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextLabel, Toolkit::Control, Create );
 +
 +DALI_PROPERTY_REGISTRATION( TextLabel, "rendering-backend",    INTEGER, RENDERING_BACKEND    )
 +DALI_PROPERTY_REGISTRATION( TextLabel, "text",                 STRING,  TEXT                 )
 +DALI_PROPERTY_REGISTRATION( TextLabel, "font-family",          STRING,  FONT_FAMILY          )
 +DALI_PROPERTY_REGISTRATION( TextLabel, "font-style",           STRING,  FONT_STYLE           )
 +DALI_PROPERTY_REGISTRATION( TextLabel, "point-size",           FLOAT,   POINT_SIZE           )
 +DALI_PROPERTY_REGISTRATION( TextLabel, "multi-line",           BOOLEAN, MULTI_LINE           )
 +DALI_PROPERTY_REGISTRATION( TextLabel, "horizontal-alignment", STRING,  HORIZONTAL_ALIGNMENT )
 +DALI_PROPERTY_REGISTRATION( TextLabel, "vertical-alignment",   STRING,  VERTICAL_ALIGNMENT   )
 +DALI_PROPERTY_REGISTRATION( TextLabel, "shadow-offset",     VECTOR2, SHADOW_OFFSET     )
 +DALI_PROPERTY_REGISTRATION( TextLabel, "shadow-color",      VECTOR4, SHADOW_COLOR      )
 +
 +DALI_TYPE_REGISTRATION_END()
 +
 +} // namespace
 +
 +Toolkit::TextLabel TextLabel::New()
 +{
 +  // Create the implementation, temporarily owned by this handle on stack
 +  IntrusivePtr< TextLabel > impl = new TextLabel();
 +
 +  // Pass ownership to CustomActor handle
 +  Toolkit::TextLabel handle( *impl );
 +
 +  // Second-phase init of the implementation
 +  // This can only be done after the CustomActor connection has been made...
 +  impl->Initialize();
 +
 +  return handle;
 +}
 +
 +void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
 +{
 +  Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( Dali::BaseHandle( object ) );
 +
 +  if( label )
 +  {
 +    TextLabel& impl( GetImpl( label ) );
 +    switch( index )
 +    {
 +      case Toolkit::TextLabel::Property::RENDERING_BACKEND:
 +      {
 +        int backend = value.Get< int >();
 +
 +        if( impl.mRenderingBackend != backend )
 +        {
 +          impl.mRenderingBackend = backend;
 +          impl.mRenderer.Reset();
 +          impl.RequestTextRelayout();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::TEXT:
 +      {
 +        if( impl.mController )
 +        {
 +          impl.mController->SetText( value.Get< std::string >() );
 +          impl.RequestTextRelayout();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::FONT_FAMILY:
 +      {
 +        if( impl.mController )
 +        {
 +          std::string fontFamily = value.Get< std::string >();
 +
 +          if( impl.mController->GetDefaultFontFamily() != fontFamily )
 +          {
 +            impl.mController->SetDefaultFontFamily( fontFamily );
 +            impl.RequestTextRelayout();
 +          }
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::FONT_STYLE:
 +      {
 +        if( impl.mController )
 +        {
 +          std::string fontStyle = value.Get< std::string >();
 +
 +          if( impl.mController->GetDefaultFontStyle() != fontStyle )
 +          {
 +            impl.mController->SetDefaultFontStyle( fontStyle );
 +            impl.RequestTextRelayout();
 +          }
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::POINT_SIZE:
 +      {
 +        if( impl.mController )
 +        {
 +          float pointSize = value.Get< float >();
 +
 +          if( impl.mController->GetDefaultPointSize() != pointSize /*TODO - epsilon*/ )
 +          {
 +            impl.mController->SetDefaultPointSize( pointSize );
 +            impl.RequestTextRelayout();
 +          }
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::MULTI_LINE:
 +      {
 +        if( impl.mController )
 +        {
 +          LayoutEngine& engine = impl.mController->GetLayoutEngine();
 +          LayoutEngine::Layout layout = value.Get< bool >() ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX;
 +
 +          if( engine.GetLayout() != layout )
 +          {
 +            engine.SetLayout( layout );
 +            impl.RequestTextRelayout();
 +          }
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT:
 +      {
 +        LayoutEngine& engine = impl.mController->GetLayoutEngine();
 +        const LayoutEngine::HorizontalAlignment alignment = Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::HorizontalAlignment >( value.Get< std::string >().c_str(),
 +                                                                                                                                           HORIZONTAL_ALIGNMENT_STRING_TABLE,
 +                                                                                                                                           HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
 +
 +        if( engine.GetHorizontalAlignment() != alignment )
 +        {
 +          engine.SetHorizontalAlignment( alignment );
 +          impl.RequestTextRelayout();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT:
 +      {
 +        LayoutEngine& engine = impl.mController->GetLayoutEngine();
 +        const LayoutEngine::VerticalAlignment alignment = Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::VerticalAlignment >( value.Get< std::string >().c_str(),
 +                                                                                                                                       VERTICAL_ALIGNMENT_STRING_TABLE,
 +                                                                                                                                       VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
 +
 +        if( engine.GetVerticalAlignment() != alignment )
 +        {
 +          engine.SetVerticalAlignment( alignment );
 +          impl.RequestTextRelayout();
 +        }
 +        break;
 +      }
 +     case Toolkit::TextLabel::Property::SHADOW_OFFSET:
 +      {
 +        if( impl.mController )
 +        {
 +          Vector2 shadowOffset = value.Get< Vector2 >();
 +          if ( impl.mController->GetShadowOffset() != shadowOffset )
 +          {
 +            impl.mController->SetShadowOffset( shadowOffset );
 +            impl.RequestTextRelayout();
 +          }
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::SHADOW_COLOR:
 +      {
 +        if( impl.mController )
 +        {
 +          Vector4 shadowColor = value.Get< Vector4 >();
 +          if ( impl.mController->GetShadowColor() != shadowColor )
 +          {
 +            impl.mController->SetShadowColor( shadowColor );
 +            impl.RequestTextRelayout();
 +          }
 +        }
 +        break;
 +      }
 +    }
 +  }
 +}
 +
 +Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index index )
 +{
 +  Property::Value value;
 +
 +  Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( Dali::BaseHandle( object ) );
 +
 +  if( label )
 +  {
 +    TextLabel& impl( GetImpl( label ) );
 +    switch( index )
 +    {
 +      case Toolkit::TextLabel::Property::RENDERING_BACKEND:
 +      {
 +        value = impl.mRenderingBackend;
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::TEXT:
 +      {
 +        if( impl.mController )
 +        {
 +          std::string text;
 +          impl.mController->GetText( text );
 +          value = text;
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::MULTI_LINE:
 +      {
 +        if( impl.mController )
 +        {
 +          value = static_cast<bool>( LayoutEngine::MULTI_LINE_BOX == impl.mController->GetLayoutEngine().GetLayout() );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT:
 +      {
 +        if( impl.mController )
 +        {
 +          value = std::string( Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::HorizontalAlignment >( impl.mController->GetLayoutEngine().GetHorizontalAlignment(),
 +                                                                                                                  HORIZONTAL_ALIGNMENT_STRING_TABLE,
 +                                                                                                                  HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT ) );
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT:
 +      {
 +        if( impl.mController )
 +        {
 +          value = std::string( Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::VerticalAlignment >( impl.mController->GetLayoutEngine().GetVerticalAlignment(),
 +                                                                                                                VERTICAL_ALIGNMENT_STRING_TABLE,
 +                                                                                                                VERTICAL_ALIGNMENT_STRING_TABLE_COUNT ) );
 +        }
 +        break;
 +      }
 +     case Toolkit::TextLabel::Property::SHADOW_OFFSET:
 +      {
 +        if ( impl.mController )
 +        {
 +          value = impl.mController->GetShadowOffset();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextLabel::Property::SHADOW_COLOR:
 +      {
 +        if ( impl.mController )
 +        {
 +          value = impl.mController->GetShadowColor();
 +        }
 +        break;
 +      }
 +    }
 +  }
 +
 +  return value;
 +}
 +
 +void TextLabel::OnInitialize()
 +{
++  Actor self = Self();
++
 +  mController = Text::Controller::New( *this );
++
++  // Use height-for-width negotiation by default
++  self.SetResizePolicy( FILL_TO_PARENT, WIDTH );
++  self.SetDimensionDependency( HEIGHT, WIDTH );
 +}
 +
 +void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
 +{
 +  GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
 +}
 +
 +Vector3 TextLabel::GetNaturalSize()
 +{
 +  return mController->GetNaturalSize();
 +}
 +
 +float TextLabel::GetHeightForWidth( float width )
 +{
 +  return mController->GetHeightForWidth( width );
 +}
 +
++void TextLabel::OnRelayout( const Vector2& size, RelayoutContainer& container )
 +{
 +  if( mController->Relayout( size ) ||
 +      !mRenderer )
 +  {
 +    if( !mRenderer )
 +    {
 +      mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
 +    }
 +
 +    RenderableActor renderableActor;
 +    if( mRenderer )
 +    {
 +      renderableActor = mRenderer->Render( mController->GetView() );
 +    }
 +
 +    if( renderableActor != mRenderableActor )
 +    {
 +      UnparentAndReset( mRenderableActor );
 +
 +      if( renderableActor )
 +      {
 +        const Vector2& alignmentOffset = mController->GetAlignmentOffset();
 +        renderableActor.SetPosition( alignmentOffset.x, alignmentOffset.y );
 +
 +        Self().Add( renderableActor );
 +      }
 +
 +      mRenderableActor = renderableActor;
 +    }
 +  }
 +}
 +
 +void TextLabel::RequestTextRelayout()
 +{
 +  RelayoutRequest();
 +}
 +
 +TextLabel::TextLabel()
 +: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
 +  mRenderingBackend( DEFAULT_RENDERING_BACKEND )
 +{
 +}
 +
 +TextLabel::~TextLabel()
 +{
 +}
 +
 +} // namespace Internal
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
index 6356651,0000000..c69bd7c
mode 100644,000000..100644
--- /dev/null
@@@ -1,153 -1,0 +1,153 @@@
-   virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
 +#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
 +#define __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
 +
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/controls/control-impl.h>
 +#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 +#include <dali-toolkit/internal/text/text-controller.h>
 +#include <dali-toolkit/internal/text/rendering/text-renderer.h>
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal
 +{
 +
 +/**
 + * @brief A control which renders a short text string.
 + */
 +class TextLabel : public Control, public Text::ControlInterface
 +{
 +public:
 +
 +  /**
 +   * @copydoc Dali::Toollkit::TextLabel::New()
 +   */
 +  static Toolkit::TextLabel New();
 +
 +  // Properties
 +
 +  /**
 +   * @brief Called when a property of an object of this type is set.
 +   *
 +   * @param[in] object The object whose property is set.
 +   * @param[in] index The property index.
 +   * @param[in] value The new property value.
 +   */
 +  static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
 +
 +  /**
 +   * @brief Called to retrieve a property of an object of this type.
 +   *
 +   * @param[in] object The object whose property is to be retrieved.
 +   * @param[in] index The property index.
 +   * @return The current value of the property.
 +   */
 +  static Property::Value GetProperty( BaseObject* object, Property::Index index );
 +
 +private: // From Control
 +
 +  /**
 +   * @copydoc Control::OnInitialize()
 +   */
 +  virtual void OnInitialize();
 +
 +  /**
 +   * @copydoc Control::OnStyleChange()
 +   */
 +  virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
 +
 +  /**
 +   * @copydoc Control::OnRelayout()
 +   */
++  virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
 +
 +  /**
 +   * @copydoc Control::GetNaturalSize()
 +   */
 +  virtual Vector3 GetNaturalSize();
 +
 +  /**
 +   * @copydoc Control::GetHeightForWidth()
 +   */
 +  virtual float GetHeightForWidth( float width );
 +
 +  /**
 +   * @copydoc Text::ControlInterface::RequestTextRelayout()
 +   */
 +  virtual void RequestTextRelayout();
 +
 +private: // Implementation
 +
 +  /**
 +   * Construct a new TextLabel.
 +   */
 +  TextLabel();
 +
 +  /**
 +   * A reference counted object may only be deleted by calling Unreference()
 +   */
 +  virtual ~TextLabel();
 +
 +private:
 +
 +  // Undefined copy constructor and assignment operators
 +  TextLabel(const TextLabel&);
 +  TextLabel& operator=(const TextLabel& rhs);
 +
 +private: // Data
 +
 +  Text::ControllerPtr mController;
 +  Text::RendererPtr mRenderer;
 +  RenderableActor mRenderableActor;
 +
 +  int mRenderingBackend;
 +};
 +
 +} // namespace Internal
 +
 +// Helpers for public-api forwarding methods
 +
 +inline Toolkit::Internal::TextLabel& GetImpl( Toolkit::TextLabel& textLabel )
 +{
 +  DALI_ASSERT_ALWAYS(textLabel);
 +
 +  Dali::RefObject& handle = textLabel.GetImplementation();
 +
 +  return static_cast<Toolkit::Internal::TextLabel&>(handle);
 +}
 +
 +inline const Toolkit::Internal::TextLabel& GetImpl( const Toolkit::TextLabel& textLabel )
 +{
 +  DALI_ASSERT_ALWAYS(textLabel);
 +
 +  const Dali::RefObject& handle = textLabel.GetImplementation();
 +
 +  return static_cast<const Toolkit::Internal::TextLabel&>(handle);
 +}
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
 +
 +#endif // __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
index e117e22,0000000..133fa09
mode 100644,000000..100644
--- /dev/null
@@@ -1,667 -1,0 +1,667 @@@
- void TextSelectionPopup::OnRelayout( const Vector2& size, ActorSizeContainer& container )
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// CLASS HEADER
 +#include <dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h>
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/controls/buttons/push-button.h>
 +#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 +#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 +
 +// EXTERNAL INCLUDES
 +#include <dali/public-api/images/nine-patch-image.h>
 +#include <dali/public-api/images/resource-image.h>
 +#include <dali/public-api/math/vector2.h>
 +#include <dali/public-api/math/vector4.h>
 +#include <libintl.h>
 +
 +// todo Move this to adaptor??
 +#define GET_LOCALE_TEXT(string) dgettext("elementary", string)
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal
 +{
 +
 +namespace
 +{
 +const Dali::Vector4 DEFAULT_POPUP_BACKGROUND( Dali::Vector4( .20f, 0.29f, 0.44f, 1.0f ) );
 +const Dali::Vector4 DEFAULT_POPUP_BACKGROUND_PRESSED( Dali::Vector4( 0.07f, 0.10f, 0.17f, 1.0f ) );
 +const Dali::Vector4 DEFAULT_POPUP_LINE_COLOR( Dali::Vector4( 0.36f, 0.45f, 0.59f, 1.0f ) );
 +const Dali::Vector4 DEFAULT_OPTION_ICON( Dali::Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
 +const Dali::Vector4 DEFAULT_OPTION_ICON_PRESSED( Dali::Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
 +const Dali::Vector4 DEFAULT_OPTION_TEXT( Dali::Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
 +const Dali::Vector4 DEFAULT_OPTION_TEXT_PRESSED( Dali::Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) );
 +
 +const std::string DEFAULT_POPUP_BACKGROUND_IMAGE( DALI_IMAGE_DIR "popup_bubble_bg.#.png" );
 +const std::string OPTION_ICON_CLIPBOARD( DALI_IMAGE_DIR "copy_paste_icon_clipboard.png" );
 +const std::string OPTION_ICON_COPY( DALI_IMAGE_DIR "copy_paste_icon_copy.png" );
 +const std::string OPTION_ICON_CUT( DALI_IMAGE_DIR "copy_paste_icon_cut.png" );
 +const std::string OPTION_ICON_PASTE( DALI_IMAGE_DIR "copy_paste_icon_paste.png" );
 +const std::string OPTION_ICON_SELECT( DALI_IMAGE_DIR "copy_paste_icon_select.png" );
 +const std::string OPTION_ICON_SELECT_ALL( DALI_IMAGE_DIR "copy_paste_icon_select_all.png" );
 +
 +const Dali::Vector2 DEFAULT_POPUP_MAX_SIZE( 470.0f, 120.0f ); ///< The maximum size of the popup.
 +
 +const float OPTION_TEXT_LINE_HEIGHT( 32.0f );     ///< The line height of the text.
 +const Dali::Vector2 OPTION_ICON_SIZE( 0.f, 0.f );       ///< The size of the icon.
 +const float OPTION_GAP_ICON_TEXT( 6.f );          ///< The gap between the icon and the text
 +const float OPTION_MARGIN_WIDTH( 10.f );          ///< The margin between the right or lefts edge and the text or icon.
 +const float OPTION_MAX_WIDTH( DEFAULT_POPUP_MAX_SIZE.width / 6 ); ///< The maximum width of the option (currently set to the max)
 +const float OPTION_MIN_WIDTH( 86.0f );           ///< The minimum width of the option.
 +
 +const float POPUP_DIVIDER_WIDTH( 1.f );        ///< The size of the divider.
 +
 +const Dali::Vector2 POPUP_TAIL_SIZE( 20.0f, 16.0f ); ///< The size of the tail.
 +const float POPUP_TAIL_Y_OFFSET( 5.f );        ///< The y offset of the tail (when its position is on the bottom).
 +const float POPUP_TAIL_TOP_Y_OFFSET( 3.f );    ///< The y offset of the tail (when its position is on the top).
 +
 +const float HIDE_POPUP_ANIMATION_DURATION( 0.2f ); ///< Duration of popup hide animation in seconds.
 +const float SHOW_POPUP_ANIMATION_DURATION( 0.2f ); ///< Duration of popup show animation in seconds.
 +
 +const char* const OPTION_SELECT_WORD = "option-select_word";                       // "Select Word" popup option.
 +const char* const OPTION_SELECT_ALL("option-select_all");                          // "Select All" popup option.
 +const char* const OPTION_CUT("option-cut");                                        // "Cut" popup option.
 +const char* const OPTION_COPY("option-copy");                                      // "Copy" popup option.
 +const char* const OPTION_PASTE("option-paste");                                    // "Paste" popup option.
 +const char* const OPTION_CLIPBOARD("option-clipboard");                            // "Clipboard" popup option.
 +
 +} // namespace
 +
 +//// Comparison function for ButtonRequirement Priority
 +//bool TextSelectionPopup::PriorityCompare( ButtonRequirement const& a, ButtonRequirement const& b )
 +//{
 +//  return a.priority < b.priority;
 +//}
 +
 +
 +Dali::Toolkit::TextSelectionPopup TextSelectionPopup::New()
 +{
 +  // Create the implementation, temporarily owned by this handle on stack
 +  IntrusivePtr< TextSelectionPopup > impl = new TextSelectionPopup();
 +
 +  // Pass ownership to CustomActor handle
 +  Dali::Toolkit::TextSelectionPopup handle( *impl );
 +
 +  // Second-phase init of the implementation
 +  // This can only be done after the CustomActor connection has been made...
 +  impl->Initialize();
 +
 +  return handle;
 +}
 +
 +void TextSelectionPopup::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
 +{
 +  Toolkit::TextSelectionPopup selectionPopup = Toolkit::TextSelectionPopup::DownCast( Dali::BaseHandle( object ) );
 +
 +  if( selectionPopup )
 +  {
 +    TextSelectionPopup& impl( GetImpl( selectionPopup ) );
 +
 +    switch( index )
 +    {
 +      case Toolkit::TextSelectionPopup::Property::POPUP_MAX_SIZE:
 +      {
 +       impl.SetPopupMaxSize( value.Get< Vector2 >() );
 +       break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_BACKGROUND_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::New( value.Get< std::string >() );
 +        impl.SetPopupImage( POPUP_BACKGROUND, image );
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::New( value.Get< std::string >() );
 +        impl.SetPopupImage( POPUP_CLIPBOARD_BUTTON, image );
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::New( value.Get< std::string >() );
 +        impl.SetPopupImage( POPUP_CUT_BUTTON_ICON, image );
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::New( value.Get< std::string >() );
 +        impl.SetPopupImage( POPUP_COPY_BUTTON_ICON, image );
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::New( value.Get< std::string >() );
 +        impl.SetPopupImage( POPUP_PASTE_BUTTON_ICON, image );
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::New( value.Get< std::string >() );
 +        impl.SetPopupImage( POPUP_SELECT_BUTTON_ICON, image );
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::New( value.Get< std::string >() );
 +        impl.SetPopupImage( POPUP_SELECT_ALL_BUTTON_ICON, image );
 +        break;
 +      }
 +    } // switch
 +  } // TextSelectionPopup
 +}
 +
 +Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::Index index )
 +{
 +  Property::Value value;
 +
 +  Toolkit::TextSelectionPopup selectionPopup = Toolkit::TextSelectionPopup::DownCast( Dali::BaseHandle( object ) );
 +
 +  if( selectionPopup )
 +  {
 +    TextSelectionPopup& impl( GetImpl( selectionPopup ) );
 +
 +    switch( index )
 +    {
 +      case Toolkit::TextSelectionPopup::Property::POPUP_MAX_SIZE:
 +      {
 +        value = impl.GetPopupMaxSize();
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_BACKGROUND_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::DownCast( impl.GetPopupImage( POPUP_BACKGROUND ) );
 +        if( image )
 +        {
 +          value = image.GetUrl();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::DownCast( impl.GetPopupImage( POPUP_CLIPBOARD_BUTTON ) );
 +        if( image )
 +        {
 +          value = image.GetUrl();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::DownCast( impl.GetPopupImage( POPUP_CUT_BUTTON_ICON ) );
 +        if( image )
 +        {
 +          value = image.GetUrl();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::DownCast( impl.GetPopupImage( POPUP_COPY_BUTTON_ICON ) );
 +        if( image )
 +        {
 +          value = image.GetUrl();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::DownCast( impl.GetPopupImage( POPUP_PASTE_BUTTON_ICON ) );
 +        if( image )
 +        {
 +          value = image.GetUrl();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::DownCast( impl.GetPopupImage( POPUP_SELECT_BUTTON_ICON ) );
 +        if( image )
 +        {
 +          value = image.GetUrl();
 +        }
 +        break;
 +      }
 +      case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE:
 +      {
 +        ResourceImage image = ResourceImage::DownCast( impl.GetPopupImage( POPUP_SELECT_ALL_BUTTON_ICON ) );
 +        if( image )
 +        {
 +          value = image.GetUrl();
 +        }
 +        break;
 +      }
 +    } // switch
 +  }
 +  return value;
 +}
 +
 +void TextSelectionPopup::OnInitialize()
 +{
 +  CreatePopup();
 +}
 +
-    SetBackground ( mBackgroundImage );
-    SetBackgroundColor ( mBackgroundColor );
++void TextSelectionPopup::OnRelayout( const Vector2& size, RelayoutContainer& container )
 +{
 +
 +}
 +
 +void TextSelectionPopup::SetPopupMaxSize( const Size& maxSize )
 +{
 +  mMaxSize = maxSize;
 +}
 +
 +const Dali::Vector2& TextSelectionPopup::GetPopupMaxSize() const
 +{
 +  return mMaxSize;
 +}
 +
 +void TextSelectionPopup::SetPopupImage( PopupParts part, Dali::Image image )
 +{
 +   switch ( part )
 +   {
 +   case POPUP_BACKGROUND :
 +   {
 +     mBackgroundImage = image;
 +   }
 +   break;
 +   case POPUP_CLIPBOARD_BUTTON :
 +   {
 +     mClipboardIconImage  = image;
 +   }
 +   break;
 +   case POPUP_CUT_BUTTON_ICON :
 +   {
 +     mCutIconImage = image;
 +   }
 +   break;
 +   case POPUP_COPY_BUTTON_ICON :
 +   {
 +     mCopyIconImage = image;
 +   }
 +   break;
 +   case POPUP_PASTE_BUTTON_ICON :
 +   {
 +     mPasteIconImage = image;
 +   }
 +   break;
 +   case POPUP_SELECT_BUTTON_ICON :
 +   {
 +     mSelectIconImage = image;
 +   }
 +   break;
 +   case POPUP_SELECT_ALL_BUTTON_ICON :
 +   {
 +     mSelectAllIconImage = image;
 +   }
 +   break;
 +
 +   } // switch
 +}
 +
 +Dali::Image TextSelectionPopup::GetPopupImage( PopupParts part )
 +{
 +  switch ( part )
 +  {
 +  case POPUP_BACKGROUND :
 +  {
 +    return mBackgroundImage;
 +  }
 +  break;
 +  case POPUP_CLIPBOARD_BUTTON :
 +  {
 +    return mClipboardIconImage;
 +  }
 +  break;
 +  case POPUP_CUT_BUTTON_ICON :
 +  {
 +    return mCutIconImage;
 +  }
 +  break;
 +  case POPUP_COPY_BUTTON_ICON :
 +  {
 +    return mCopyIconImage;
 +  }
 +  break;
 +  case POPUP_PASTE_BUTTON_ICON :
 +  {
 +    return mPasteIconImage;
 +  }
 +  break;
 +  case POPUP_SELECT_BUTTON_ICON :
 +  {
 +    return mSelectIconImage;
 +  }
 +  break;
 +  case POPUP_SELECT_ALL_BUTTON_ICON :
 +  {
 +    return mSelectAllIconImage;
 +  }
 +  break;
 +  default :
 +  {
 +    DALI_ASSERT_DEBUG( "Unknown Popup Part" );
 +  }
 +  } // switch
 +
 +  return Dali::Image();
 +}
 +
 + void TextSelectionPopup::CreateOrderedListOfPopupOptions()
 + {
 +   mOrderListOfButtons.clear();
 +
 +   // Create button for each possible option using Option priority
 +   if ( !mCutIconImage )
 +   {
 +     mCutIconImage = ResourceImage::New( OPTION_ICON_CUT );
 +   }
 +   mOrderListOfButtons.push_back( ButtonRequirement( ButtonsCut, mCutOptionPriority, OPTION_CUT, GET_LOCALE_TEXT("IDS_COM_BODY_CUT"), mCutIconImage, true ) );
 +
 +   if ( !mCopyIconImage )
 +   {
 +     mCopyIconImage = ResourceImage::New( OPTION_ICON_COPY );
 +   }
 +   mOrderListOfButtons.push_back( ButtonRequirement( ButtonsCopy, mCopyOptionPriority, OPTION_COPY, GET_LOCALE_TEXT("IDS_COM_BODY_COPY"), mCopyIconImage, true ) );
 +
 +   if ( !mPasteIconImage )
 +   {
 +     mPasteIconImage = ResourceImage::New( OPTION_ICON_PASTE );
 +   }
 +   mOrderListOfButtons.push_back( ButtonRequirement( ButtonsPaste, mPasteOptionPriority, OPTION_PASTE, GET_LOCALE_TEXT("IDS_COM_BODY_PASTE"), mPasteIconImage, true ) );
 +
 +   if ( !mSelectIconImage )
 +   mSelectIconImage = ResourceImage::New( OPTION_ICON_SELECT );
 +   mOrderListOfButtons.push_back( ButtonRequirement( ButtonsSelect, mSelectOptionPriority, OPTION_SELECT_WORD, GET_LOCALE_TEXT("IDS_COM_SK_SELECT"), mSelectIconImage, true ) );
 +
 +   if ( !mSelectAllIconImage )
 +   {
 +    mSelectAllIconImage = ResourceImage::New( OPTION_ICON_SELECT_ALL );
 +   }
 +   mOrderListOfButtons.push_back( ButtonRequirement( ButtonsSelectAll, mSelectAllOptionPriority, OPTION_SELECT_ALL, GET_LOCALE_TEXT("IDS_COM_BODY_SELECT_ALL"), mSelectAllIconImage, true ) );
 +
 +   if ( !mClipboardIconImage )
 +   {
 +     mClipboardIconImage = ResourceImage::New( OPTION_ICON_CLIPBOARD );
 +   }
 +   mOrderListOfButtons.push_back( ButtonRequirement( ButtonsClipboard, mClipboardOptionPriority, OPTION_CLIPBOARD, GET_LOCALE_TEXT("IDS_COM_BODY_CLIPBOARD"), mClipboardIconImage, true ) );
 +
 +   // Sort the buttons according their priorities.
 +   std::sort( mOrderListOfButtons.begin(), mOrderListOfButtons.end(), TextSelectionPopup::ButtonPriorityCompare() );
 + }
 +
 + void TextSelectionPopup::CreateBackground()
 + {
 +   if ( !mBackgroundImage )
 +   {
 +     mBackgroundImage = ResourceImage::New( DEFAULT_POPUP_BACKGROUND_IMAGE );
 +   }
 +
 +   NinePatchImage backgroundImageNinePatch = NinePatchImage::DownCast( mBackgroundImage );
 +   if( backgroundImageNinePatch )
 +   {
 +     const Size ninePatchImageSize = Size( static_cast<float>( mBackgroundImage.GetWidth() ), static_cast<float>( mBackgroundImage.GetHeight() ) );
 +     Rect<int> childRect = backgroundImageNinePatch.GetChildRectangle();
 +
 +     // -1u because of the cropping.
 +     mNinePatchMargins.x = childRect.x - 1u;
 +     mNinePatchMargins.y = ninePatchImageSize.width - ( childRect.x + childRect.width ) - 1u;
 +     mNinePatchMargins.z = childRect.y - 1u;
 +     mNinePatchMargins.w = ninePatchImageSize.height - ( childRect.y + childRect.height ) - 1u;
 +   }
 +
-    option.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed );
++   SetBackgroundImage( mBackgroundImage );
++   SetBackgroundColor( mBackgroundColor );
 + }
 +
 + void TextSelectionPopup::AddOption( Actor& parent, const std::string& name, const std::string& caption, const Image iconImage, bool finalOption, bool showIcons )
 + {
 +   // 1. Create the backgrounds for the popup option both normal and pressed.
 +   // Both containers will be added to a button.
 +   Actor optionContainer = Actor::New();
 +   optionContainer.SetDrawMode( DrawMode::OVERLAY );
 +   //optionContainer.SetParentOrigin( ParentOrigin::CENTER );
 +   optionContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
 +
 +   ImageActor optionPressedContainer = Toolkit::CreateSolidColorActor( mBackgroundPressedColor );
 +   optionPressedContainer.SetDrawMode( DrawMode::OVERLAY );
 +   //optionPressedContainer.SetParentOrigin( ParentOrigin::CENTER );
 +   optionPressedContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
 +
 +   // 2. Add text.
 +   Toolkit::TextLabel captionTextLabel = Toolkit::TextLabel::New();
 +   captionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
 +   optionContainer.Add( captionTextLabel );
 +
 +   Toolkit::TextLabel pressedCaptionTextLabel = Toolkit::TextLabel::New();
 +   pressedCaptionTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, caption );
 +   optionPressedContainer.Add( pressedCaptionTextLabel );
 +
 +   // Calculates the icon/text position.
 +   float iconTextOffsetY = 0.0f;
 +
 +   if ( showIcons )
 +   {
 +     // 3. Create the icons
 +     ImageActor pressedIcon = ImageActor::New(  iconImage );
 +     ImageActor icon = ImageActor::New(  iconImage );
 +
 +     optionContainer.Add( icon );
 +     optionPressedContainer.Add( pressedIcon );
 +
 +     iconTextOffsetY = 0.5f * ( ( DEFAULT_POPUP_MAX_SIZE.height - mNinePatchMargins.z - mNinePatchMargins.w ) - ( OPTION_ICON_SIZE.height + OPTION_GAP_ICON_TEXT + OPTION_TEXT_LINE_HEIGHT ) );
 +
 +     icon.SetParentOrigin( ParentOrigin::TOP_CENTER );
 +     icon.SetAnchorPoint( AnchorPoint::TOP_CENTER );
 +     icon.SetY( iconTextOffsetY );
 +
 +     pressedIcon.SetParentOrigin( ParentOrigin::TOP_CENTER );
 +     pressedIcon.SetAnchorPoint( AnchorPoint::TOP_CENTER );
 +     pressedIcon.SetY( iconTextOffsetY );
 +
 +     // Layout icon + gap + text
 +     captionTextLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
 +     pressedCaptionTextLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
 +     pressedCaptionTextLabel.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
 +     captionTextLabel.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
 +     pressedCaptionTextLabel.SetY( -iconTextOffsetY );
 +     captionTextLabel.SetY( -iconTextOffsetY );
 +   }
 +   else
 +   {
 +     // Centre option text
 +     captionTextLabel.SetAnchorPoint( AnchorPoint::CENTER );
 +     captionTextLabel.SetParentOrigin( ParentOrigin::CENTER );
 +     pressedCaptionTextLabel.SetAnchorPoint( AnchorPoint::CENTER );
 +     pressedCaptionTextLabel.SetParentOrigin( ParentOrigin::CENTER );
 +   }
 +
 +   // Calculate the size of the text.
 +   Vector3 textSize = captionTextLabel.GetNaturalSize();
 +   textSize.width = std::min( textSize.width, OPTION_MAX_WIDTH - 2.f * OPTION_MARGIN_WIDTH );
 +
 +   // Set the size to the text. Text will be ellipsized if exceeds the max width.
 +   captionTextLabel.SetSize( textSize );
 +   pressedCaptionTextLabel.SetSize( textSize );
 +
 +   // 4. Calculate the size of option.
 +
 +   // The width is the max size of the text or the icon plus the margins clamped between the option min and max size.
 +   // The height is the whole popup height minus the ninepatch margins.
 +   const Vector2 optionSize( std::min( OPTION_MAX_WIDTH, std::max( OPTION_MIN_WIDTH, std::max( textSize.width, OPTION_ICON_SIZE.width ) + 2.f * OPTION_MARGIN_WIDTH ) ),
 +                             DEFAULT_POPUP_MAX_SIZE.height - mNinePatchMargins.z - mNinePatchMargins.w );
 +
 +   optionContainer.SetSize( optionSize );
 +   optionPressedContainer.SetSize( optionSize );
 +
 +   // 5. Create a option.
 +   Toolkit::PushButton option = Toolkit::PushButton::New();
++   //option.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed ); FIXME
 +   option.SetSize( optionSize );
 +   option.SetAnchorPoint( AnchorPoint::TOP_LEFT );
 +   option.SetX( mContentSize.width );
 +   option.SetName( name );
 +   option.SetAnimationTime( 0.0f );
 +   //option.ClickedSignal().Connect( this, &TextInputPopup::OnButtonPressed );
 +
 +   parent.Add( option );
 +
 +   // 6. Set the normal option image.
 +   option.SetButtonImage( optionContainer );
 +
 +   // 7. Set the pressed option image
 +   option.SetSelectedImage( optionPressedContainer );
 +
 +   // 8. Update the content size.
 +   mContentSize.width += optionSize.width;
 +   mContentSize.height = std::max ( optionSize.height, mContentSize.height );
 +
 +   // 9. Add the divider
 +   if( !finalOption )
 +   {
 +     const Size size( POPUP_DIVIDER_WIDTH, mContentSize.height );
 +
 +     ImageActor divider =  Toolkit::CreateSolidColorActor( Color::WHITE );
 +     divider.SetSize (size);
 +     divider.SetParentOrigin( ParentOrigin::TOP_LEFT );
 +     divider.SetAnchorPoint( AnchorPoint::TOP_LEFT );
 +     divider.SetPosition( mContentSize.width - POPUP_DIVIDER_WIDTH, 0.0f );
 +     parent.Add( divider );
 +   }
 + }
 +
 + void TextSelectionPopup::SetUpPopup( Size& size )
 + {
 +   Actor self = Self();
 +
 +   // Create Layer and Stencil.
 +   mStencilLayer = Layer::New();
 +   ImageActor stencil = CreateSolidColorActor( Color::RED );
 +   stencil.SetDrawMode( DrawMode::STENCIL );
 +   stencil.SetVisible( true );
 +   Actor scrollview = Actor::New(); //todo make a scrollview
 +
 +   //todo Use Size negotiation
 +   //self.SetSize( size ); // control matches stencil size
 +   self.SetSize( mRequiredPopUpSize ); // control matches stencil size
 +   mStencilLayer.SetSize( size ); // matches stencil size
 +   stencil.SetSize( size );
 +   scrollview.SetSize( size );
 +   mButtons.SetSize( size );
 +
 +   mStencilLayer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
 +   scrollview.SetAnchorPoint(AnchorPoint::TOP_LEFT);
 +   mButtons.SetAnchorPoint( AnchorPoint::TOP_LEFT );
 +
 +   mStencilLayer.SetPosition( mNinePatchMargins.x,  mNinePatchMargins.y );
 +
 +   self.Add( mStencilLayer );
 +   mStencilLayer.Add( stencil );
 +   mStencilLayer.Add( scrollview );
 +   scrollview.Add( mButtons );
 + }
 +
 + void TextSelectionPopup::AddPopupOptions( bool createTail, bool showIcons )
 + {
 +   mShowIcons = showIcons;
 +
 +   mContentSize = Vector2::ZERO;
 +
 +   mButtons = Actor::New();
 +
 +   // Add the options into the buttons container.
 +
 +   // 1. Determine how many buttons are active and should be added to container.
 +   std::size_t numberOfOptions = 0u;
 +   for( std::vector<ButtonRequirement>::const_iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt ); ++it )
 +   {
 +     const ButtonRequirement& button( *it );
 +     if( button.enabled )
 +     {
 +       ++numberOfOptions;
 +     }
 +   }
 +
 +   // 2. Iterate list of buttons and add active ones.
 +   std::size_t optionsAdded = 0u;
 +   for( std::vector<ButtonRequirement>::const_iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt ); ++it )
 +   {
 +     const ButtonRequirement& button( *it );
 +     if ( button.enabled )
 +     {
 +       ++optionsAdded;
 +       AddOption( mButtons, button.name, button.caption, button.icon, optionsAdded == numberOfOptions, mShowIcons );
 +     }
 +   }
 +
 +   // Calculate the size of the whole popup which may not be all visible.
 +   mRequiredPopUpSize = Size( std::min( mMaxSize.width, mContentSize.width + mNinePatchMargins.x + mNinePatchMargins.y ), DEFAULT_POPUP_MAX_SIZE.height );
 +
 +   // Size of the contents within the popup
 +   mVisiblePopUpSize = Size( mRequiredPopUpSize.width - mNinePatchMargins.x - mNinePatchMargins.y, mRequiredPopUpSize.height - mNinePatchMargins.z - mNinePatchMargins.w );
 + }
 +
 + void TextSelectionPopup::CreatePopup()
 + {
 +   if ( !mStencilLayer )
 +   {
 +     CreateOrderedListOfPopupOptions();  //todo Currently causes all options to be shown
 +     CreateBackground();
 +     AddPopupOptions( true, true );
 +     SetUpPopup( mVisiblePopUpSize );
 +   }
 +
 +   mStencilLayer.RaiseToTop();
 + }
 +
 +TextSelectionPopup::TextSelectionPopup()
 +: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) ),
 +  mMaxSize ( DEFAULT_POPUP_MAX_SIZE ),
 +  mVisiblePopUpSize( DEFAULT_POPUP_MAX_SIZE ),
 +  mRequiredPopUpSize( DEFAULT_POPUP_MAX_SIZE ),
 +  mBackgroundColor( DEFAULT_POPUP_BACKGROUND ),
 +  mBackgroundPressedColor( DEFAULT_POPUP_BACKGROUND_PRESSED ),
 +  mLineColor( DEFAULT_POPUP_LINE_COLOR ),
 +  mIconColor( DEFAULT_OPTION_ICON ),
 +  mIconPressedColor( DEFAULT_OPTION_ICON_PRESSED ),
 +  mTextColor( DEFAULT_OPTION_TEXT ),
 +  mTextPressedColor( DEFAULT_OPTION_TEXT_PRESSED ),
 +  mSelectOptionPriority( 1 ),
 +  mSelectAllOptionPriority ( 2 ),
 +  mCutOptionPriority ( 3 ),
 +  mCopyOptionPriority ( 4 ),
 +  mPasteOptionPriority ( 5 ),
 +  mClipboardOptionPriority( 6 ),
 +  mShowIcons( true )
 +{
 +}
 +
 +TextSelectionPopup::~TextSelectionPopup()
 +{
 +}
 +
 +
 +} // namespace Internal
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
index 2650c57,0000000..ffca9dd
mode 100644,000000..100644
--- /dev/null
@@@ -1,306 -1,0 +1,306 @@@
-   virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
 +#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H__
 +#define __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H__
 +
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/controls/control-impl.h>
 +#include <dali-toolkit/public-api/controls/text-controls/text-selection-popup.h>
 +
 +// EXTERNAL INCLUDES
 +#include <dali/public-api/actors/image-actor.h>
 +#include <dali/public-api/actors/layer.h>
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal
 +{
 +
 +namespace
 +{
 +enum PopupParts
 +{
 +  POPUP_BACKGROUND,
 +  POPUP_CLIPBOARD_BUTTON,
 +  POPUP_CUT_BUTTON_ICON,
 +  POPUP_COPY_BUTTON_ICON,
 +  POPUP_PASTE_BUTTON_ICON,
 +  POPUP_SELECT_BUTTON_ICON,
 +  POPUP_SELECT_ALL_BUTTON_ICON,
 +};
 +
 +} // namespace
 +
 +class TextSelectionPopup : public Control
 +{
 +public:
 +
 +  enum Buttons
 +  {
 +    ButtonsCut,
 +    ButtonsCopy,
 +    ButtonsPaste,
 +    ButtonsSelect,
 +    ButtonsSelectAll,
 +    ButtonsClipboard,
 +    ButtonsEnumEnd
 +  };
 +
 +  struct ButtonRequirement
 +  {
 +    ButtonRequirement()
 +    : id( ButtonsEnumEnd ),
 +      priority( 0u ),
 +      name(),
 +      caption(),
 +      icon(),
 +      enabled( false )
 +    {}
 +
 +    ButtonRequirement( Buttons buttonId,
 +                       std::size_t buttonPriority,
 +                       const std::string& buttonName,
 +                       const std::string& buttonCaption,
 +                       Dali::Image& buttonIcon,
 +                       bool buttonEnabled )
 +    : id( buttonId ),
 +      priority( buttonPriority ),
 +      name( buttonName ),
 +      caption( buttonCaption ),
 +      icon( buttonIcon ),
 +      enabled( buttonEnabled )
 +    {}
 +
 +    Buttons id;
 +    std::size_t priority;
 +    std::string name;
 +    std::string caption;
 +    Dali::Image icon;
 +    bool enabled;
 +  };
 +
 +  struct ButtonPriorityCompare
 +  {
 +      bool operator()( const ButtonRequirement& lhs, const ButtonRequirement& rhs ) const {
 +        return lhs.priority < rhs.priority;
 +      }
 +  };
 +
 +//  static inline bool ButtonPriorityCompare( ButtonRequirement a, ButtonRequirement b )
 +//  {
 +//    return a.priority < b.priority ? true : false;
 +//  }
 +
 +  /**
 +   * @copydoc Dali::Toollkit::TextSelectionPopup::New()
 +   */
 +  static Toolkit::TextSelectionPopup New();
 +
 +  // Properties
 +
 +  /**
 +   * @brief Called when a property of an object of this type is set.
 +   *
 +   * @param[in] object The object whose property is set.
 +   * @param[in] index The property index.
 +   * @param[in] value The new property value.
 +   */
 +  static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
 +
 +  /**
 +   * @brief Called to retrieve a property of an object of this type.
 +   *
 +   * @param[in] object The object whose property is to be retrieved.
 +   * @param[in] index The property index.
 +   * @return The current value of the property.
 +   */
 +  static Property::Value GetProperty( BaseObject* object, Property::Index index );
 +
 +  void CreatePopup();
 +
 +  void DestroyPopup();
 +
 +private: // From Control
 +
 +  /**
 +   * @copydoc Control::OnInitialize()
 +   */
 + virtual void OnInitialize();
 +
 +//  /**
 +//   * @copydoc Control::GetNaturalSize()
 +//   */
 +//  virtual Vector3 GetNaturalSize();
 +//
 +//  /**
 +//   * @copydoc Control::GetHeightForWidth()
 +//   */
 +//  virtual float GetHeightForWidth( float width );
 +
 +  /**
 +   * @copydoc Control::OnInitialize()
 +   */
++  virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
 +//
 +//  /**
 +//   * Received for single & double taps
 +//   */
 +//  virtual void OnTap( const TapGesture& tap );
 +//
 +//  /**
 +//   * @copydoc Text::ControlInterface::RequestTextRelayout()
 +//   */
 +//  virtual void RequestTextRelayout();
 +
 +  /**
 +   * Set max size of Popup
 +   * @param[in] maxSize Size (Vector2)
 +   */
 +  void SetPopupMaxSize( const Size& maxSize );
 +
 +  /**
 +   * Get Max size of Popup
 +   * @return Vector2 the max size of the Popup
 +   */
 +  const Dali::Vector2& GetPopupMaxSize() const;
 +
 +  /**
 +   * @brief Sets the image for the given part of the Popup.
 +   *
 +   * @param[in] part  The part of the pop from the Enum PopupParts
 +   * @param[in] image The image to use.
 +   */
 + void SetPopupImage( PopupParts part, Dali::Image image );
 +
 +  /**
 +   * @brief Retrieves the image of the given part used by the popup
 +   *
 +   * @param[in] part The part of the popup
 +   * @return The image used for that part.
 +   */
 +  Dali::Image GetPopupImage( PopupParts part );
 +
 +  void CreateOrderedListOfPopupOptions();
 +
 +  void CreateBackground();
 +
 +  void AddOption( Actor& parent, const std::string& name, const std::string& caption, const Image iconImage, bool finalOption, bool showIcons );
 +
 +  void SetUpPopup( Size& size );
 +
 +  void AddPopupOptions( bool createTail, bool showIcons );
 +
 +private: // Implementation
 +
 +  /**
 +   * Construct a new TextField.
 +   */
 +  TextSelectionPopup();
 +
 +  /**
 +   * A reference counted object may only be deleted by calling Unreference()
 +   */
 +  virtual ~TextSelectionPopup();
 +
 +private:
 +
 +  // Undefined copy constructor and assignment operators
 +  TextSelectionPopup(const TextSelectionPopup&);
 +  TextSelectionPopup& operator=(const TextSelectionPopup& rhs);
 +
 +private: // Data
 +
 +  Actor mButtons;                                     // Actor which holds all the buttons, sensitivity can be set oActor buttons via this actor
 +  Layer mStencilLayer;                                // Layer to enable clipping when buttons exceed popup
 +
 +  // Images to be used by the Popup
 +  Image mBackgroundImage;
 +  Image mCutIconImage;
 +  Image mCopyIconImage;
 +  Image mPasteIconImage;
 +  Image mClipboardIconImage;
 +  Image mSelectIconImage;
 +  Image mSelectAllIconImage;
 +
 +  ImageActor mBackground;                             // The background popup panel
 +  ImageActor mTail;                                   // The tail for the popup
 +  ImageActor mTailEffect;   //todo remove                          // the tail effect
 +  ImageActor mTailLine;     //todo remove                          // The border/outline around the tail
 +
 +  Size mMaxSize;                                      // Max size of the Popup
 +  Size mVisiblePopUpSize;                             // Visible Size of popup excluding content that needs scrolling.
 +  Size mRequiredPopUpSize;                            // Total size of popup including any invisible margin
 +
 +  Vector4 mNinePatchMargins;                          // Margins between the edge of the cropped image and the nine patch rect (left, right, top, bottom).
 +
 +  Size mContentSize;                                  // Size of Content (i.e. Buttons)
 +  //Animation mAnimation;                               // Popup Hide/Show animation.
 +
 +  std::vector<ButtonRequirement> mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed.
 +
 +  Vector4 mBackgroundColor;             // Color of the background of the text input popup
 +  Vector4 mBackgroundPressedColor;      // Color of the option background.
 +  Vector4 mLineColor;                   // Color of the line around the text input popup
 +  Vector4 mIconColor;                   // Color of the popup icon.
 +  Vector4 mIconPressedColor;            // Color of the popup icon when pressed.
 +  Vector4 mTextColor;                   // Color of the popup text.
 +  Vector4 mTextPressedColor;            // Color of the popup text when pressed.
 +
 +  // Priority of Options/Buttons in the Cut and Paste pop-up, higher priority buttons are displayed first, left to right.
 +  std::size_t mSelectOptionPriority;    // Position of Select Button
 +  std::size_t mSelectAllOptionPriority; // Position of Select All button
 +  std::size_t mCutOptionPriority;       // Position of Cut button
 +  std::size_t mCopyOptionPriority;      // Position of Copy button
 +  std::size_t mPasteOptionPriority;     // Position of Paste button
 +  std::size_t mClipboardOptionPriority; // Position of Clipboard button
 +
 +  bool mShowIcons; // Flag to show icons
 +
 +};
 +
 +} // namespace Internal
 +
 +// Helpers for public-api forwarding methods
 +
 +inline Toolkit::Internal::TextSelectionPopup& GetImpl( Toolkit::TextSelectionPopup& textSelectionPopup )
 +{
 +  DALI_ASSERT_ALWAYS( textSelectionPopup );
 +
 +  Dali::RefObject& handle = textSelectionPopup.GetImplementation();
 +
 +  return static_cast<Toolkit::Internal::TextSelectionPopup&>(handle);
 +}
 +
 +inline const Toolkit::Internal::TextSelectionPopup& GetImpl( const Toolkit::TextSelectionPopup& textSelectionPopup )
 +{
 +  DALI_ASSERT_ALWAYS( textSelectionPopup );
 +
 +  const Dali::RefObject& handle = textSelectionPopup.GetImplementation();
 +
 +  return static_cast<const Toolkit::Internal::TextSelectionPopup&>(handle);
 +}
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
 +
 +#endif // __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H__
@@@ -1,8 -1,6 +1,8 @@@
  # Add local source files here
  
  toolkit_src_files = \
 +   $(toolkit_src_dir)/atlas-manager/atlas-manager.cpp \
 +   $(toolkit_src_dir)/atlas-manager/atlas-manager-impl.cpp \
     $(toolkit_src_dir)/builder/builder-actor.cpp \
     $(toolkit_src_dir)/builder/builder-animations.cpp \
     $(toolkit_src_dir)/builder/builder-impl.cpp \
@@@ -35,9 -33,6 +35,6 @@@
     $(toolkit_src_dir)/controls/page-turn-view/page-turn-portrait-view-impl.cpp \
     $(toolkit_src_dir)/controls/page-turn-view/page-turn-landscape-view-impl.cpp \
     $(toolkit_src_dir)/controls/page-turn-view/page-turn-view-impl.cpp \
-    $(toolkit_src_dir)/controls/relayout-controller-impl.cpp \
-    $(toolkit_src_dir)/controls/relayout-controller.cpp \
-    $(toolkit_src_dir)/controls/relayout-helper.cpp \
     $(toolkit_src_dir)/controls/scroll-bar/scroll-bar-impl.cpp \
     $(toolkit_src_dir)/controls/scroll-component/scroll-bar-internal-impl.cpp \
     $(toolkit_src_dir)/controls/scroll-component/scroll-bar-internal.cpp \
     $(toolkit_src_dir)/controls/slider/slider-impl.cpp \
     $(toolkit_src_dir)/controls/super-blur-view/super-blur-view-impl.cpp \
     $(toolkit_src_dir)/controls/table-view/table-view-impl.cpp \
 -   $(toolkit_src_dir)/controls/text-input/text-input-decorator-impl.cpp \
 -   $(toolkit_src_dir)/controls/text-input/text-input-handles-impl.cpp \
 -   $(toolkit_src_dir)/controls/text-input/text-input-impl.cpp \
 -   $(toolkit_src_dir)/controls/text-input/text-input-popup-impl.cpp \
 -   $(toolkit_src_dir)/controls/text-input/text-input-text-highlight-impl.cpp \
 -   $(toolkit_src_dir)/controls/text-view/relayout-utilities.cpp   \
 -   $(toolkit_src_dir)/controls/text-view/split-by-char-policies.cpp \
 -   $(toolkit_src_dir)/controls/text-view/split-by-new-line-char-policies.cpp \
 -   $(toolkit_src_dir)/controls/text-view/split-by-word-policies.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-actor-cache.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-processor-bidirectional-info.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-processor.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-view-character-processor.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-view-impl.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-view-paragraph-processor.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-view-processor-dbg.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-view-processor-helper-functions.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-view-processor.cpp \
 -   $(toolkit_src_dir)/controls/text-view/text-view-word-processor.cpp \
 +   $(toolkit_src_dir)/controls/text-controls/text-field-impl.cpp \
 +   $(toolkit_src_dir)/controls/text-controls/text-label-impl.cpp \
 +   $(toolkit_src_dir)/controls/text-controls/text-selection-popup-impl.cpp \
     $(toolkit_src_dir)/controls/tool-bar/tool-bar-impl.cpp \
     $(toolkit_src_dir)/controls/view/view-impl.cpp \
     $(toolkit_src_dir)/focus-manager/focus-manager-impl.cpp \
     $(toolkit_src_dir)/shader-effects/page-turn-effect-impl.cpp \
     $(toolkit_src_dir)/shader-effects/water-effect-impl.cpp \
     $(toolkit_src_dir)/styling/style-manager-impl.cpp \
 +   $(toolkit_src_dir)/text/bidirectional-support.cpp \
 +   $(toolkit_src_dir)/text/character-set-conversion.cpp \
 +   $(toolkit_src_dir)/text/clipping/text-clipper.cpp \
 +   $(toolkit_src_dir)/text/logical-model-impl.cpp \
 +   $(toolkit_src_dir)/text/multi-language-support.cpp \
 +   $(toolkit_src_dir)/text/segmentation.cpp \
 +   $(toolkit_src_dir)/text/shaper.cpp \
 +   $(toolkit_src_dir)/text/text-control-interface.cpp \
 +   $(toolkit_src_dir)/text/text-controller.cpp \
 +   $(toolkit_src_dir)/text/text-io.cpp \
 +   $(toolkit_src_dir)/text/text-view.cpp \
 +   $(toolkit_src_dir)/text/text-view-interface.cpp \
 +   $(toolkit_src_dir)/text/visual-model-impl.cpp \
 +   $(toolkit_src_dir)/text/decorator/text-decorator.cpp \
 +   $(toolkit_src_dir)/text/layouts/layout-engine.cpp \
 +   $(toolkit_src_dir)/text/multi-language-support-impl.cpp \
 +   $(toolkit_src_dir)/text/rendering/text-backend.cpp \
 +   $(toolkit_src_dir)/text/rendering/text-renderer.cpp \
 +   $(toolkit_src_dir)/text/rendering/atlas/text-atlas-renderer.cpp \
 +   $(toolkit_src_dir)/text/rendering/atlas/atlas-glyph-manager.cpp \
 +   $(toolkit_src_dir)/text/rendering/atlas/atlas-glyph-manager-impl.cpp \
 +   $(toolkit_src_dir)/text/rendering/basic/text-basic-renderer.cpp \
 +   $(toolkit_src_dir)/text/rendering/shaders/text-basic-shader.cpp \
 +   $(toolkit_src_dir)/text/rendering/shaders/text-basic-shadow-shader.cpp \
 +   $(toolkit_src_dir)/text/rendering/shaders/text-bgra-shader.cpp \
 +   $(toolkit_src_dir)/text/rendering/text-backend-impl.cpp \
     $(toolkit_src_dir)/transition-effects/cube-transition-effect-impl.cpp \
     $(toolkit_src_dir)/transition-effects/cube-transition-cross-effect-impl.cpp \
     $(toolkit_src_dir)/transition-effects/cube-transition-fold-effect-impl.cpp \
index 92b475c,0000000..88f22e5
mode 100644,000000..100644
--- /dev/null
@@@ -1,877 -1,0 +1,877 @@@
-       mActiveLayer.SetSizeMode( SIZE_EQUAL_TO_PARENT );
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// CLASS HEADER
 +#include <dali-toolkit/internal/text/decorator/text-decorator.h>
 +
 +// EXTERNAL INCLUDES
 +#include <dali/public-api/actors/actor.h>
 +#include <dali/public-api/adaptor-framework/timer.h>
 +#include <dali/public-api/actors/image-actor.h>
 +#include <dali/public-api/actors/layer.h>
 +#include <dali/public-api/actors/mesh-actor.h>
 +#include <dali/public-api/common/constants.h>
 +#include <dali/public-api/events/tap-gesture.h>
 +#include <dali/public-api/events/tap-gesture-detector.h>
 +#include <dali/public-api/events/pan-gesture.h>
 +#include <dali/public-api/events/pan-gesture-detector.h>
 +#include <dali/public-api/geometry/mesh.h>
 +#include <dali/public-api/geometry/mesh-data.h>
 +#include <dali/public-api/images/resource-image.h>
 +#include <dali/public-api/math/vector2.h>
 +#include <dali/public-api/math/vector4.h>
 +//#include <dali/public-api/images/nine-patch-image.h>
 +#include <dali/public-api/signals/connection-tracker.h>
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/controls/control.h>
 +#include <dali-toolkit/public-api/controls/control-impl.h>
 +#include <dali-toolkit/public-api/controls/buttons/push-button.h>
 +#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
 +#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 +#include <dali-toolkit/public-api/controls/text-controls/text-selection-popup.h>
 +
 +#ifdef DEBUG_ENABLED
 +#define DECORATOR_DEBUG
 +#endif
 +
 +// Local Data
 +namespace
 +{
 +
 +const char* DEFAULT_GRAB_HANDLE_IMAGE( DALI_IMAGE_DIR "insertpoint-icon.png" );
 +const char* DEFAULT_SELECTION_HANDLE_ONE( DALI_IMAGE_DIR "text-input-selection-handle-left.png" );
 +const char* DEFAULT_SELECTION_HANDLE_TWO( DALI_IMAGE_DIR "text-input-selection-handle-right.png" );
 +//const char* DEFAULT_SELECTION_HANDLE_ONE_PRESSED( DALI_IMAGE_DIR "text-input-selection-handle-left-press.png" );
 +//const char* DEFAULT_SELECTION_HANDLE_TWO_PRESSED( DALI_IMAGE_DIR "text-input-selection-handle-right-press.png" );
 +
 +const Dali::Vector3 DEFAULT_GRAB_HANDLE_RELATIVE_SIZE( 1.5f, 2.0f, 1.0f );
 +const Dali::Vector3 DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE( 1.5f, 1.5f, 1.0f );
 +
 +const std::size_t CURSOR_BLINK_INTERVAL = 500; // Cursor blink interval
 +const std::size_t MILLISECONDS = 1000;
 +
 +const float DISPLAYED_HIGHLIGHT_Z_OFFSET( -0.05f );
 +
 +/**
 + * structure to hold coordinates of each quad, which will make up the mesh.
 + */
 +struct QuadCoordinates
 +{
 +  /**
 +   * Default constructor
 +   */
 +  QuadCoordinates()
 +  {
 +  }
 +
 +  /**
 +   * Constructor
 +   * @param[in] x1 left co-ordinate
 +   * @param[in] y1 top co-ordinate
 +   * @param[in] x2 right co-ordinate
 +   * @param[in] y2 bottom co-ordinate
 +   */
 +  QuadCoordinates(float x1, float y1, float x2, float y2)
 +  : min(x1, y1),
 +    max(x2, y2)
 +  {
 +  }
 +
 +  Dali::Vector2 min;                          ///< top-left (minimum) position of quad
 +  Dali::Vector2 max;                          ///< bottom-right (maximum) position of quad
 +};
 +
 +typedef std::vector<QuadCoordinates> QuadContainer;
 +
 +} // end of namespace
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Text
 +{
 +
 +struct Decorator::Impl : public ConnectionTracker
 +{
 +  struct CursorImpl
 +  {
 +    CursorImpl()
 +    : x(0.0f),
 +      y(0.0f),
 +      height(0.0f),
 +      color(Dali::Color::WHITE)
 +    {
 +    }
 +
 +    float x;
 +    float y;
 +    float height;
 +
 +    Vector4 color;
 +  };
 +
 +  struct SelectionHandleImpl
 +  {
 +    SelectionHandleImpl()
 +    : x(0.0f),
 +      y(0.0f),
 +      cursorHeight(0.0f),
 +      flipped(false)
 +    {
 +    }
 +
 +    float x;
 +    float y;
 +    float cursorHeight; ///< Not the handle height
 +    bool flipped;
 +
 +    ImageActor actor;
 +    Actor grabArea;
 +
 +    Image pressedImage;
 +    Image releasedImage;
 +  };
 +
 +  Impl( Dali::Toolkit::Internal::Control& parent, Observer& observer )
 +  : mTextControlParent(parent),
 +    mObserver(observer),
 +    mActiveCursor(ACTIVE_CURSOR_NONE),
 +    mActiveGrabHandle(false),
 +    mActiveSelection( false ),
 +    mActiveCopyPastePopup( false ),
 +    mCursorBlinkInterval( CURSOR_BLINK_INTERVAL ),
 +    mCursorBlinkDuration( 0.0f ),
 +    mCursorBlinkStatus( true ),
 +    mGrabDisplacementX( 0.0f ),
 +    mGrabDisplacementY( 0.0f ),
 +    mHighlightColor( 0.07f, 0.41f, 0.59f, 1.0f ), // light blue
 +    mBoundingBox( Rect<int>() )
 +  {
 +  }
 +
 +  /**
 +   * Relayout of the decorations owned by the decorator.
 +   * @param[in] size The Size of the UI control the decorater is adding it's decorations to.
 +   */
 +  void Relayout( const Vector2& size, const Vector2& scrollPosition )
 +  {
 +    // TODO - Remove this if nothing is active
 +    CreateActiveLayer();
 +
 +    // Show or hide the cursors
 +    CreateCursors();
 +    if( mPrimaryCursor )
 +    {
 +      mPrimaryCursor.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x,
 +                                  mCursor[PRIMARY_CURSOR].y + scrollPosition.y );
 +      mPrimaryCursor.SetSize( 1.0f, mCursor[PRIMARY_CURSOR].height );
 +    }
 +    if( mSecondaryCursor )
 +    {
 +      mSecondaryCursor.SetPosition( mCursor[SECONDARY_CURSOR].x + scrollPosition.x,
 +                                    mCursor[SECONDARY_CURSOR].y + scrollPosition.y );
 +      mSecondaryCursor.SetSize( 1.0f, mCursor[SECONDARY_CURSOR].height );
 +    }
 +
 +    // Show or hide the grab handle
 +    if( mActiveGrabHandle )
 +    {
 +      SetupTouchEvents();
 +
 +      CreateGrabHandle();
 +
 +      mGrabHandle.SetPosition( mCursor[PRIMARY_CURSOR].x + scrollPosition.x,
 +                               mCursor[PRIMARY_CURSOR].y + scrollPosition.y + mCursor[PRIMARY_CURSOR].height );
 +    }
 +    else if( mGrabHandle )
 +    {
 +      UnparentAndReset( mGrabHandle );
 +    }
 +
 +    // Show or hide the selection handles/highlight
 +    if( mActiveSelection )
 +    {
 +      SetupTouchEvents();
 +
 +      CreateSelectionHandles();
 +
 +      SelectionHandleImpl& primary = mSelectionHandle[ PRIMARY_SELECTION_HANDLE ];
 +      primary.actor.SetPosition( primary.x + scrollPosition.x,
 +                                 primary.y + scrollPosition.y + primary.cursorHeight );
 +
 +      SelectionHandleImpl& secondary = mSelectionHandle[ SECONDARY_SELECTION_HANDLE ];
 +      secondary.actor.SetPosition( secondary.x + scrollPosition.x,
 +                                   secondary.y + scrollPosition.y + secondary.cursorHeight );
 +
 +      CreateHighlight();
 +      UpdateHighlight();
 +    }
 +    else
 +    {
 +      UnparentAndReset( mSelectionHandle[ PRIMARY_SELECTION_HANDLE ].actor );
 +      UnparentAndReset( mSelectionHandle[ SECONDARY_SELECTION_HANDLE ].actor );
 +      UnparentAndReset( mHighlightMeshActor );
 +    }
 +
 +    if ( mActiveCopyPastePopup )
 +    {
 +      if ( !mCopyPastePopup )
 +      {
 +        mCopyPastePopup = TextSelectionPopup::New();
 +        mActiveLayer.Add ( mCopyPastePopup );
 +      }
 +      mCopyPastePopup.SetPosition( Vector3( 200.0f, -100.0f, 0.0f ) ); //todo grabhandle or selection handle positions to be used
 +    }
 +    else
 +    {
 +     if ( mCopyPastePopup )
 +     {
 +       UnparentAndReset( mCopyPastePopup );
 +     }
 +    }
 +  }
 +
 +  void CreateCursor( ImageActor& cursor )
 +  {
 +    cursor = CreateSolidColorActor( Color::WHITE );
 +    cursor.SetParentOrigin( ParentOrigin::TOP_LEFT );
 +    cursor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
 +  }
 +
 +  // Add or Remove cursor(s) from parent
 +  void CreateCursors()
 +  {
 +    if( mActiveCursor == ACTIVE_CURSOR_NONE )
 +    {
 +      UnparentAndReset( mPrimaryCursor );
 +      UnparentAndReset( mSecondaryCursor );
 +    }
 +    else
 +    {
 +      /* Create Primary and or Secondary Cursor(s) if active and add to parent */
 +      if ( mActiveCursor == ACTIVE_CURSOR_PRIMARY ||
 +           mActiveCursor == ACTIVE_CURSOR_BOTH )
 +      {
 +        if ( !mPrimaryCursor )
 +        {
 +          CreateCursor( mPrimaryCursor );
 +#ifdef DECORATOR_DEBUG
 +          mPrimaryCursor.SetName( "PrimaryCursorActor" );
 +#endif
 +          mActiveLayer.Add( mPrimaryCursor);
 +        }
 +      }
 +
 +      if ( mActiveCursor == ACTIVE_CURSOR_BOTH )
 +      {
 +        if ( !mSecondaryCursor )
 +        {
 +          CreateCursor( mSecondaryCursor );
 +#ifdef DECORATOR_DEBUG
 +          mSecondaryCursor.SetName( "SecondaryCursorActor" );
 +#endif
 +          mActiveLayer.Add( mSecondaryCursor);
 +        }
 +      }
 +    }
 +  }
 +
 +  bool OnCursorBlinkTimerTick()
 +  {
 +    // Cursor blinking
 +    if ( mPrimaryCursor )
 +    {
 +      mPrimaryCursor.SetVisible( mCursorBlinkStatus );
 +    }
 +    if ( mSecondaryCursor )
 +    {
 +      mSecondaryCursor.SetVisible( mCursorBlinkStatus );
 +    }
 +
 +    mCursorBlinkStatus = !mCursorBlinkStatus;
 +
 +    return true;
 +  }
 +
 +  void SetupTouchEvents()
 +  {
 +    if ( !mTapDetector )
 +    {
 +      mTapDetector = TapGestureDetector::New();
 +      mTapDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnTap );
 +    }
 +
 +    if ( !mPanGestureDetector )
 +    {
 +      mPanGestureDetector = PanGestureDetector::New();
 +      mPanGestureDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnPan );
 +    }
 +  }
 +
 +  void CreateActiveLayer()
 +  {
 +    if( !mActiveLayer )
 +    {
 +      Actor parent = mTextControlParent.Self();
 +
 +      mActiveLayer = Layer::New();
 +#ifdef DECORATOR_DEBUG
 +      mActiveLayer.SetName ( "ActiveLayerActor" );
 +#endif
 +
 +      mActiveLayer.SetAnchorPoint( AnchorPoint::CENTER);
 +      mActiveLayer.SetParentOrigin( ParentOrigin::CENTER);
++      //mActiveLayer.SetSizeMode( SIZE_EQUAL_TO_PARENT ); FIXME
 +      mActiveLayer.SetPositionInheritanceMode( USE_PARENT_POSITION );
 +
 +      parent.Add( mActiveLayer );
 +    }
 +
 +    mActiveLayer.RaiseToTop();
 +  }
 +
 +  void CreateGrabHandle()
 +  {
 +    if( !mGrabHandle )
 +    {
 +      if ( !mGrabHandleImage )
 +      {
 +        mGrabHandleImage = ResourceImage::New( DEFAULT_GRAB_HANDLE_IMAGE );
 +      }
 +
 +      mGrabHandle = ImageActor::New( mGrabHandleImage );
 +#ifdef DECORATOR_DEBUG
 +      mGrabHandle.SetName( "GrabHandleActor" );
 +#endif
 +      mGrabHandle.SetParentOrigin( ParentOrigin::TOP_LEFT );
 +      mGrabHandle.SetAnchorPoint( AnchorPoint::TOP_CENTER );
 +      mGrabHandle.SetDrawMode( DrawMode::OVERLAY );
 +
 +      // Area that Grab handle responds to, larger than actual handle so easier to move
 +#ifdef DECORATOR_DEBUG
 +      mGrabArea = Toolkit::CreateSolidColorActor( Vector4(1.0f, 0.0f, 0.0f, 0.5f) );
 +      mGrabArea.SetName( "GrabArea" );
 +#else
 +      mGrabArea = Actor::New();
 +#endif
 +      mGrabArea.SetParentOrigin( ParentOrigin::TOP_CENTER );
 +      mGrabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
 +      mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
 +      mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE );
 +      mGrabHandle.Add(mGrabArea);
 +
 +      mTapDetector.Attach( mGrabArea );
 +      mPanGestureDetector.Attach( mGrabArea );
 +
 +      mActiveLayer.Add(mGrabHandle);
 +    }
 +  }
 +
 +  void CreateSelectionHandles()
 +  {
 +    SelectionHandleImpl& primary = mSelectionHandle[ PRIMARY_SELECTION_HANDLE ];
 +    if ( !primary.actor )
 +    {
 +      if ( !primary.releasedImage )
 +      {
 +        primary.releasedImage = ResourceImage::New( DEFAULT_SELECTION_HANDLE_ONE );
 +      }
 +
 +      primary.actor = ImageActor::New( primary.releasedImage );
 +#ifdef DECORATOR_DEBUG
 +      primary.actor.SetName("SelectionHandleOne");
 +#endif
 +      primary.actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
 +      primary.actor.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); // Change to BOTTOM_RIGHT if Look'n'Feel requires handle above text.
 +      primary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
 +      primary.flipped = false;
 +
 +      primary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
 +#ifdef DECORATOR_DEBUG
 +      primary.grabArea.SetName("SelectionHandleOneGrabArea");
 +#endif
 +      primary.grabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
 +      primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
 +      primary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
 +
 +      mTapDetector.Attach( primary.grabArea );
 +      mPanGestureDetector.Attach( primary.grabArea );
 +      primary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
 +
 +      primary.actor.Add( primary.grabArea );
 +      mActiveLayer.Add( primary.actor );
 +    }
 +
 +    SelectionHandleImpl& secondary = mSelectionHandle[ SECONDARY_SELECTION_HANDLE ];
 +    if ( !secondary.actor )
 +    {
 +      if ( !secondary.releasedImage )
 +      {
 +        secondary.releasedImage = ResourceImage::New( DEFAULT_SELECTION_HANDLE_TWO );
 +      }
 +
 +      secondary.actor = ImageActor::New( secondary.releasedImage );
 +#ifdef DECORATOR_DEBUG
 +      secondary.actor.SetName("SelectionHandleTwo");
 +#endif
 +      secondary.actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
 +      secondary.actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // Change to BOTTOM_LEFT if Look'n'Feel requires handle above text.
 +      secondary.actor.SetDrawMode( DrawMode::OVERLAY ); // ensure grab handle above text
 +      secondary.flipped = false;
 +
 +      secondary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
 +#ifdef DECORATOR_DEBUG
 +      secondary.grabArea.SetName("SelectionHandleTwoGrabArea");
 +#endif
 +      secondary.grabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
 +      secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE );
 +      secondary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
 +
 +      mTapDetector.Attach( secondary.grabArea );
 +      mPanGestureDetector.Attach( secondary.grabArea );
 +      secondary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
 +
 +      secondary.actor.Add( secondary.grabArea );
 +      mActiveLayer.Add( secondary.actor );
 +    }
 +
 +    //SetUpHandlePropertyNotifications(); TODO
 +  }
 +
 +  void CreateHighlight()
 +  {
 +    if ( !mHighlightMeshActor )
 +    {
 +      mHighlightMaterial = Material::New( "HighlightMaterial" );
 +      mHighlightMaterial.SetDiffuseColor( mHighlightColor );
 +
 +      mHighlightMeshData.SetMaterial( mHighlightMaterial );
 +      mHighlightMeshData.SetHasNormals( true );
 +
 +      mHighlightMesh = Mesh::New( mHighlightMeshData );
 +
 +      mHighlightMeshActor = MeshActor::New( mHighlightMesh );
 +#ifdef DECORATOR_DEBUG
 +      mHighlightMeshActor.SetName( "HighlightMeshActor" );
 +#endif
 +      mHighlightMeshActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
 +      mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
 +      mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
 +
 +      Actor parent = mTextControlParent.Self();
 +      parent.Add( mHighlightMeshActor );
 +    }
 +  }
 +
 +  void UpdateHighlight()
 +  {
 +    //  Construct a Mesh with a texture to be used as the highlight 'box' for selected text
 +    //
 +    //  Example scenarios where mesh is made from 3, 1, 2, 2 ,3 or 3 quads.
 +    //
 +    //   [ TOP   ]  [ TOP ]      [TOP ]  [ TOP    ]      [ TOP  ]      [ TOP  ]
 +    //  [ MIDDLE ]             [BOTTOM]  [BOTTOM]      [ MIDDLE ]   [ MIDDLE  ]
 +    //  [ BOTTOM]                                      [ MIDDLE ]   [ MIDDLE  ]
 +    //                                                 [BOTTOM]     [ MIDDLE  ]
 +    //                                                              [BOTTOM]
 +    //
 +    //  Each quad is created as 2 triangles.
 +    //  Middle is just 1 quad regardless of its size.
 +    //
 +    //  (0,0)         (0,0)
 +    //     0*    *2     0*       *2
 +    //     TOP          TOP
 +    //     3*    *1     3*       *1
 +    //  4*       *1     4*     *6
 +    //     MIDDLE         BOTTOM
 +    //  6*       *5     7*     *5
 +    //  6*    *8
 +    //   BOTTOM
 +    //  9*    *7
 +    //
 +
 +    if ( mHighlightMesh && mHighlightMaterial && !mHighlightQuadList.empty() )
 +    {
 +      MeshData::VertexContainer vertices;
 +      Dali::MeshData::FaceIndices faceIndices;
 +
 +      std::vector<QuadCoordinates>::iterator iter = mHighlightQuadList.begin();
 +      std::vector<QuadCoordinates>::iterator endIter = mHighlightQuadList.end();
 +
 +      // vertex position defaults to (0 0 0)
 +      MeshData::Vertex vertex;
 +      // set normal for all vertices as (0 0 1) pointing outward from TextInput Actor.
 +      vertex.nZ = 1.0f;
 +
 +      for(std::size_t v = 0; iter != endIter; ++iter,v+=4 )
 +      {
 +        // Add each quad geometry (a sub-selection) to the mesh data.
 +
 +        // 0-----1
 +        // |\    |
 +        // | \ A |
 +        // |  \  |
 +        // | B \ |
 +        // |    \|
 +        // 2-----3
 +
 +        QuadCoordinates& quad = *iter;
 +        // top-left (v+0)
 +        vertex.x = quad.min.x;
 +        vertex.y = quad.min.y;
 +        vertices.push_back( vertex );
 +
 +        // top-right (v+1)
 +        vertex.x = quad.max.x;
 +        vertex.y = quad.min.y;
 +        vertices.push_back( vertex );
 +
 +        // bottom-left (v+2)
 +        vertex.x = quad.min.x;
 +        vertex.y = quad.max.y;
 +        vertices.push_back( vertex );
 +
 +        // bottom-right (v+3)
 +        vertex.x = quad.max.x;
 +        vertex.y = quad.max.y;
 +        vertices.push_back( vertex );
 +
 +        // triangle A (3, 1, 0)
 +        faceIndices.push_back( v + 3 );
 +        faceIndices.push_back( v + 1 );
 +        faceIndices.push_back( v );
 +
 +        // triangle B (0, 2, 3)
 +        faceIndices.push_back( v );
 +        faceIndices.push_back( v + 2 );
 +        faceIndices.push_back( v + 3 );
 +
 +        mHighlightMeshData.SetFaceIndices( faceIndices );
 +      }
 +
 +      BoneContainer bones(0); // passed empty as bones not required
 +      mHighlightMeshData.SetData( vertices, faceIndices, bones, mHighlightMaterial );
 +      mHighlightMesh.UpdateMeshData( mHighlightMeshData );
 +    }
 +  }
 +
 +  void OnTap( Actor actor, const TapGesture& tap )
 +  {
 +    if( actor == mGrabHandle )
 +    {
 +      // TODO
 +    }
 +  }
 +
 +  void OnPan( Actor actor, const PanGesture& gesture )
 +  {
 +    if( actor == mGrabArea )
 +    {
 +      if( Gesture::Started == gesture.state )
 +      {
 +        mGrabDisplacementX = mGrabDisplacementY = 0;
 +      }
 +
 +      mGrabDisplacementX += gesture.displacement.x;
 +      mGrabDisplacementY += gesture.displacement.y;
 +
 +      float x = mCursor[PRIMARY_CURSOR].x + mGrabDisplacementX;
 +      float y = mCursor[PRIMARY_CURSOR].y + mCursor[PRIMARY_CURSOR].height*0.5f + mGrabDisplacementY;
 +
 +      if( Gesture::Started    == gesture.state ||
 +          Gesture::Continuing == gesture.state )
 +      {
 +        mObserver.GrabHandleEvent( GRAB_HANDLE_PRESSED, x, y );
 +      }
 +      else if( Gesture::Finished  == gesture.state ||
 +               Gesture::Cancelled == gesture.state )
 +      {
 +        mObserver.GrabHandleEvent( GRAB_HANDLE_RELEASED, x, y );
 +      }
 +    }
 +  }
 +
 +  bool OnHandleOneTouched( Actor actor, const TouchEvent& touch )
 +  {
 +    // TODO
 +    return false;
 +  }
 +
 +  bool OnHandleTwoTouched( Actor actor, const TouchEvent& touch )
 +  {
 +    // TODO
 +    return false;
 +  }
 +
 +
 +  Internal::Control& mTextControlParent;
 +  Observer& mObserver;
 +
 +  Layer mActiveLayer; // Layer for active handles and alike that ensures they are above all else.
 +
 +  unsigned int mActiveCursor;
 +  bool         mActiveGrabHandle;
 +  bool         mActiveSelection;
 +  bool         mActiveCopyPastePopup;
 +
 +  CursorImpl mCursor[CURSOR_COUNT];
 +
 +  Timer mCursorBlinkTimer; // Timer to signal cursor to blink
 +  unsigned int mCursorBlinkInterval;
 +  float mCursorBlinkDuration;
 +  bool mCursorBlinkStatus; // Flag to switch between blink on and blink off
 +
 +  ImageActor mPrimaryCursor;
 +  ImageActor mSecondaryCursor;
 +
 +  ImageActor mGrabHandle;
 +  Actor mGrabArea;
 +  float mGrabDisplacementX;
 +  float mGrabDisplacementY;
 +
 +  SelectionHandleImpl mSelectionHandle[SELECTION_HANDLE_COUNT];
 +
 +  MeshActor         mHighlightMeshActor;        ///< Mesh Actor to display highlight
 +  Mesh              mHighlightMesh;             ///< Mesh for highlight
 +  MeshData          mHighlightMeshData;         ///< Mesh Data for highlight
 +  Material          mHighlightMaterial;         ///< Material used for highlight
 +  Vector4           mHighlightColor;            ///< Color of the highlight
 +  QuadContainer     mHighlightQuadList;         ///< Sub-selections that combine to create the complete selection highlight
 +
 +  TextSelectionPopup mCopyPastePopup;
 +
 +  Image mCursorImage;
 +  Image mGrabHandleImage;
 +
 +  TapGestureDetector mTapDetector;
 +  PanGestureDetector mPanGestureDetector;
 +
 +  Rect<int> mBoundingBox;
 +};
 +
 +DecoratorPtr Decorator::New( Internal::Control& parent, Observer& observer )
 +{
 +  return DecoratorPtr( new Decorator(parent, observer) );
 +}
 +
 +void Decorator::SetBoundingBox( const Rect<int>& boundingBox )
 +{
 +  mImpl->mBoundingBox = boundingBox;
 +}
 +
 +const Rect<int>& Decorator::GetBoundingBox() const
 +{
 +  return mImpl->mBoundingBox;
 +}
 +
 +void Decorator::Relayout( const Vector2& size, const Vector2& scrollPosition )
 +{
 +  mImpl->Relayout( size, scrollPosition );
 +}
 +
 +/** Cursor **/
 +
 +void Decorator::SetActiveCursor( ActiveCursor activeCursor )
 +{
 +  mImpl->mActiveCursor = activeCursor;
 +}
 +
 +unsigned int Decorator::GetActiveCursor() const
 +{
 +  return mImpl->mActiveCursor;
 +}
 +
 +void Decorator::SetPosition( Cursor cursor, float x, float y, float height )
 +{
 +  // Adjust grab handle displacement
 +  mImpl->mGrabDisplacementX -= x - mImpl->mCursor[cursor].x;
 +  mImpl->mGrabDisplacementY -= y - mImpl->mCursor[cursor].y;
 +
 +  mImpl->mCursor[cursor].x = x;
 +  mImpl->mCursor[cursor].y = y;
 +  mImpl->mCursor[cursor].height = height;
 +}
 +
 +void Decorator::GetPosition( Cursor cursor, float& x, float& y, float& height ) const
 +{
 +  x = mImpl->mCursor[cursor].x;
 +  y = mImpl->mCursor[cursor].y;
 +  height = mImpl->mCursor[cursor].height;
 +}
 +
 +void Decorator::SetColor( Cursor cursor, const Dali::Vector4& color )
 +{
 +  mImpl->mCursor[cursor].color = color;
 +}
 +
 +const Dali::Vector4& Decorator::GetColor( Cursor cursor ) const
 +{
 +  return mImpl->mCursor[cursor].color;
 +}
 +
 +void Decorator::StartCursorBlink()
 +{
 +  if ( !mImpl->mCursorBlinkTimer )
 +  {
 +    mImpl->mCursorBlinkTimer = Timer::New( mImpl->mCursorBlinkInterval );
 +    mImpl->mCursorBlinkTimer.TickSignal().Connect( mImpl, &Decorator::Impl::OnCursorBlinkTimerTick );
 +  }
 +
 +  if ( !mImpl->mCursorBlinkTimer.IsRunning() )
 +  {
 +    mImpl->mCursorBlinkTimer.Start();
 +  }
 +}
 +
 +void Decorator::StopCursorBlink()
 +{
 +  if ( mImpl->mCursorBlinkTimer )
 +  {
 +    mImpl->mCursorBlinkTimer.Stop();
 +  }
 +}
 +
 +void Decorator::SetCursorBlinkInterval( float seconds )
 +{
 +  mImpl->mCursorBlinkInterval = seconds*MILLISECONDS; // Convert to milliseconds
 +}
 +
 +float Decorator::GetCursorBlinkInterval() const
 +{
 +  return mImpl->mCursorBlinkInterval;
 +}
 +
 +void Decorator::SetCursorBlinkDuration( float seconds )
 +{
 +  mImpl->mCursorBlinkDuration = seconds;
 +}
 +
 +float Decorator::GetCursorBlinkDuration() const
 +{
 +  return mImpl->mCursorBlinkDuration;
 +}
 +
 +/** GrabHandle **/
 +
 +void Decorator::SetGrabHandleActive( bool active )
 +{
 +  mImpl->mActiveGrabHandle = active;
 +}
 +
 +bool Decorator::IsGrabHandleActive() const
 +{
 +  return mImpl->mActiveGrabHandle;
 +}
 +
 +void Decorator::SetGrabHandleImage( Dali::Image image )
 +{
 +  mImpl->mGrabHandleImage = image;
 +}
 +
 +Dali::Image Decorator::GetGrabHandleImage() const
 +{
 +  return mImpl->mGrabHandleImage;
 +}
 +
 +/** Selection **/
 +
 +void Decorator::SetSelectionActive( bool active )
 +{
 +  mImpl->mActiveSelection = active;
 +}
 +
 +bool Decorator::IsSelectionActive() const
 +{
 +  return mImpl->mActiveSelection;
 +}
 +
 +void Decorator::SetPosition( SelectionHandle handle, float x, float y, float height )
 +{
 +  mImpl->mSelectionHandle[handle].x = x;
 +  mImpl->mSelectionHandle[handle].y = y;
 +  mImpl->mSelectionHandle[handle].cursorHeight = height;
 +}
 +
 +void Decorator::GetPosition( SelectionHandle handle, float& x, float& y, float& height ) const
 +{
 +  x = mImpl->mSelectionHandle[handle].x;
 +  y = mImpl->mSelectionHandle[handle].y;
 +  height = mImpl->mSelectionHandle[handle].cursorHeight;
 +}
 +
 +void Decorator::SetImage( SelectionHandle handle, SelectionHandleState state, Dali::Image image )
 +{
 +  if( SELECTION_HANDLE_PRESSED == state )
 +  {
 +    mImpl->mSelectionHandle[handle].pressedImage = image;
 +  }
 +  else
 +  {
 +    mImpl->mSelectionHandle[handle].releasedImage = image;
 +  }
 +}
 +
 +Dali::Image Decorator::GetImage( SelectionHandle handle, SelectionHandleState state ) const
 +{
 +  if( SELECTION_HANDLE_PRESSED == state )
 +  {
 +    return mImpl->mSelectionHandle[handle].pressedImage;
 +  }
 +
 +  return mImpl->mSelectionHandle[handle].releasedImage;
 +}
 +
 +void Decorator::AddHighlight( float x1, float y1, float x2, float y2 )
 +{
 +  mImpl->mHighlightQuadList.push_back( QuadCoordinates(x1, y1, x2, y2) );
 +}
 +
 +void Decorator::ClearHighlights()
 +{
 +  mImpl->mHighlightQuadList.clear();
 +}
 +
 +void Decorator::SetPopupActive( bool active )
 +{
 +  mImpl->mActiveCopyPastePopup = active;
 +}
 +
 +bool Decorator::IsPopupActive() const
 +{
 +  return mImpl->mActiveCopyPastePopup ;
 +}
 +
 +Decorator::~Decorator()
 +{
 +  delete mImpl;
 +}
 +
 +Decorator::Decorator( Dali::Toolkit::Internal::Control& parent, Observer& observer )
 +: mImpl( NULL )
 +{
 +  mImpl = new Decorator::Impl( parent, observer );
 +}
 +
 +} // namespace Text
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
  #include <dali/public-api/object/type-registry.h>
  #include <dali/public-api/object/type-registry-helper.h>
  #include <dali/public-api/scripting/scripting.h>
+ #include <dali/public-api/size-negotiation/relayout-container.h>
  #include <dali/integration-api/debug.h>
  
  // INTERNAL INCLUDES
- #include <dali-toolkit/internal/controls/relayout-controller.h>
- #include <dali-toolkit/internal/controls/relayout-helper.h>
  #include <dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h>
  #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
  #include <dali-toolkit/public-api/controls/control.h>
@@@ -49,16 -48,6 +48,6 @@@ namespace Toolki
  namespace
  {
  
- const Scripting::StringEnum< Control::SizePolicy > SIZE_POLICY_STRING_TABLE[] =
- {
-   { "FIXED",      Control::Fixed      },
-   { "MINIMUM",    Control::Minimum    },
-   { "MAXIMUM",    Control::Maximum    },
-   { "RANGE",      Control::Range      },
-   { "FLEXIBLE",   Control::Flexible   },
- };
- const unsigned int SIZE_POLICY_STRING_TABLE_COUNT = sizeof( SIZE_POLICY_STRING_TABLE ) / sizeof( SIZE_POLICY_STRING_TABLE[0] );
  #if defined(DEBUG_ENABLED)
  Integration::Log::Filter* gLogFilter  = Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_CONTROL");
  #endif
@@@ -106,70 -95,6 +95,6 @@@ struct Backgroun
  };
  
  /**
-  * Helper function to calculate a dimension given the policy of that dimension; the minimum &
-  * maximum values that dimension can be; and the allocated value for that dimension.
-  *
-  * @param[in]  policy     The size policy for that dimension.
-  * @param[in]  minimum    The minimum value that dimension can be.
-  * @param[in]  maximum    The maximum value that dimension can be.
-  * @param[in]  allocated  The value allocated for that dimension.
-  *
-  * @return The value that the dimension should be.
-  *
-  * @note This does not handle Control::Fixed policy.
-  */
- float Calculate( Control::SizePolicy policy, float minimum, float maximum, float allocated )
- {
-   float size( allocated );
-   switch( policy )
-   {
-     case Control::Fixed:
-     {
-       // Use allocated value
-       break;
-     }
-     case Control::Minimum:
-     {
-       // Size is always at least the minimum.
-       size = std::max( allocated, minimum );
-       break;
-     }
-     case Control::Maximum:
-     {
-       // Size can grow but up to a maximum value.
-       size = std::min( allocated, maximum );
-       break;
-     }
-     case Control::Range:
-     {
-       // Size is at least the minimum and can grow up to the maximum
-       size = std::max( size, minimum );
-       size = std::min( size, maximum );
-      break;
-     }
-     case Control::Flexible:
-     {
-       // Size grows or shrinks with no limits.
-       size = allocated;
-       break;
-     }
-     default:
-     {
-       DALI_ASSERT_DEBUG( false && "This function was not intended to be used by any other policy." );
-       break;
-     }
-   }
-   return size;
- }
- /**
   * Creates a white coloured Mesh.
   */
  Mesh CreateMesh()
@@@ -213,11 -138,8 +138,8 @@@ void SetupBackgroundActor( Actor actor
    actor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION );
    actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
    actor.SetZ( BACKGROUND_ACTOR_Z_POSITION );
-   Constraint constraint = Constraint::New<Vector3>( constrainingIndex,
-                                                     ParentSource( Actor::Property::SIZE ),
-                                                     EqualToConstraint() );
-   actor.ApplyConstraint( constraint );
+   actor.SetRelayoutEnabled( true );
+   actor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
  }
  
  } // unnamed namespace
@@@ -242,7 -164,6 +164,7 @@@ public
    // Construction & Destruction
    Impl(Control& controlImpl)
    : mControlImpl( controlImpl ),
 +    mStyleName(""),
      mBackground( NULL ),
      mStartingPinchScale( NULL ),
      mKeyEventSignal(),
      mLongPressGestureDetector(),
      mCurrentSize(),
      mNaturalSize(),
-     mWidthPolicy( Toolkit::Control::Fixed ),
-     mHeightPolicy( Toolkit::Control::Fixed ),
      mFlags( Control::CONTROL_BEHAVIOUR_NONE ),
-     mInsideRelayout( false ),
      mIsKeyboardNavigationSupported( false ),
      mIsKeyboardFocusGroup( false ),
      mInitialized( false )
  
        switch ( index )
        {
 +        case Toolkit::Control::Property::STYLE_NAME:
 +        {
 +          controlImpl.SetStyleName( value.Get< std::string >() );
 +          break;
 +        }
 +
          case Toolkit::Control::Property::BACKGROUND_COLOR:
          {
            controlImpl.SetBackgroundColor( value.Get< Vector4 >() );
            break;
          }
  
-         case Toolkit::Control::Property::BACKGROUND:
+         case Toolkit::Control::Property::BACKGROUND_IMAGE:
          {
            if ( value.HasKey( "image" ) )
            {
  
              if ( image )
              {
-               controlImpl.SetBackground( image );
+               controlImpl.SetBackgroundImage( image );
              }
            }
            else if ( value.Get< Property::Map >().Empty() )
            break;
          }
  
-         case Toolkit::Control::Property::WIDTH_POLICY:
-         {
-           controlImpl.mImpl->mWidthPolicy = Scripting::GetEnumeration< Toolkit::Control::SizePolicy >( value.Get< std::string >().c_str(), SIZE_POLICY_STRING_TABLE, SIZE_POLICY_STRING_TABLE_COUNT );
-           break;
-         }
-         case Toolkit::Control::Property::HEIGHT_POLICY:
-         {
-           controlImpl.mImpl->mHeightPolicy = Scripting::GetEnumeration< Toolkit::Control::SizePolicy >( value.Get< std::string >().c_str(), SIZE_POLICY_STRING_TABLE, SIZE_POLICY_STRING_TABLE_COUNT );
-           break;
-         }
-         case Toolkit::Control::Property::MINIMUM_SIZE:
-         {
-           controlImpl.SetMinimumSize( value.Get< Vector3 >() );
-           break;
-         }
-         case Toolkit::Control::Property::MAXIMUM_SIZE:
-         {
-           controlImpl.SetMaximumSize( value.Get< Vector3 >() );
-           break;
-         }
          case Toolkit::Control::Property::KEY_INPUT_FOCUS:
          {
            if ( value.Get< bool >() )
  
        switch ( index )
        {
 +        case Toolkit::Control::Property::STYLE_NAME:
 +        {
 +          value = controlImpl.GetStyleName();
 +          break;
 +        }
 +
          case Toolkit::Control::Property::BACKGROUND_COLOR:
          {
            value = controlImpl.GetBackgroundColor();
            break;
          }
  
-         case Toolkit::Control::Property::BACKGROUND:
+         case Toolkit::Control::Property::BACKGROUND_IMAGE:
          {
            Property::Map map;
  
            break;
          }
  
-         case Toolkit::Control::Property::WIDTH_POLICY:
-         {
-           value = std::string( Scripting::GetEnumerationName< Toolkit::Control::SizePolicy >( controlImpl.mImpl->mWidthPolicy, SIZE_POLICY_STRING_TABLE, SIZE_POLICY_STRING_TABLE_COUNT ) );
-           break;
-         }
-         case Toolkit::Control::Property::HEIGHT_POLICY:
-         {
-           value = std::string( Scripting::GetEnumerationName< Toolkit::Control::SizePolicy >( controlImpl.mImpl->mHeightPolicy, SIZE_POLICY_STRING_TABLE, SIZE_POLICY_STRING_TABLE_COUNT ) );
-           break;
-         }
-         case Toolkit::Control::Property::MINIMUM_SIZE:
-         {
-           value = controlImpl.mImpl->GetMinimumSize();
-           break;
-         }
-         case Toolkit::Control::Property::MAXIMUM_SIZE:
-         {
-           value = controlImpl.mImpl->GetMaximumSize();
-           break;
-         }
          case Toolkit::Control::Property::KEY_INPUT_FOCUS:
          {
            value = controlImpl.HasKeyInputFocus();
      return value;
    }
  
-   /**
-    * Helper to get minimum size
-    * @return minimum size
-    */
-   inline const Vector3& GetMinimumSize()
-   {
-     if( mMinMaxSize.Count() > MIN_SIZE_INDEX )
-     {
-       return mMinMaxSize[ MIN_SIZE_INDEX ];
-     }
-     else
-     {
-       // its not been allocated so its ZERO
-       return Vector3::ZERO;
-     }
-   }
-   /**
-    * Helper to Set minimum size
-    * @param size to set
-    */
-   inline void SetMinimumSize( const Vector3& size )
-   {
-     if( mMinMaxSize.Count() > MIN_SIZE_INDEX )
-     {
-       mMinMaxSize[ MIN_SIZE_INDEX ] = size;
-     }
-     else
-     {
-       // its not been allocated so push the new value there
-       mMinMaxSize.PushBack( size );
-     }
-   }
-   /**
-    * Helper to get maximum size
-    * @return maximum size
-    */
-   inline const Vector3& GetMaximumSize()
-   {
-     if( mMinMaxSize.Count() > MAX_SIZE_INDEX )
-     {
-       return mMinMaxSize[ MAX_SIZE_INDEX ];
-     }
-     else
-     {
-       // its not been allocated so its MAX_SIZE
-       return MAX_SIZE;
-     }
-   }
-   /**
-    * Helper to Set minimum size
-    * @param size to set
-    */
-   inline void SetMaximumSize( const Vector3& size )
-   {
-     if( mMinMaxSize.Count() > MAX_SIZE_INDEX )
-     {
-       mMinMaxSize[ MAX_SIZE_INDEX ] = size;
-     }
-     else if( mMinMaxSize.Count() > MIN_SIZE_INDEX )
-     {
-       // max has not been allocated, but min has
-       mMinMaxSize.PushBack( size );
-     }
-     else
-     {
-       // min and max both unallocated so allocate both
-       mMinMaxSize.Resize( 2u ); // this will reserve and default construct two Vector3s
-       mMinMaxSize[ MAX_SIZE_INDEX ] = size;
-     }
-   }
    // Data
  
    Control& mControlImpl;
 +  std::string mStyleName;
    Background* mBackground;           ///< Only create the background if we use it
    Vector3* mStartingPinchScale;      ///< The scale when a pinch gesture starts, TODO: consider removing this
    Toolkit::Control::KeyEventSignalType mKeyEventSignal;
    // @todo change all these to Vector2 when we have a chance to sanitize the public API as well
    Vector3 mCurrentSize; ///< Stores the current control's size, this is the negotiated size
    Vector3 mNaturalSize; ///< Stores the size set through the Actor's API. This is size the actor wants to be. Useful when reset to the initial size is needed.
-   Dali::Vector< Vector3 > mMinMaxSize; ///< Stores the minimum and maximum size if they are set
  
-   Toolkit::Control::SizePolicy mWidthPolicy :3;  ///< Stores the width policy. 3 bits covers 8 values
-   Toolkit::Control::SizePolicy mHeightPolicy :3; ///< Stores the height policy. 3 bits covers 8 values
-   ControlBehaviour mFlags :6;             ///< Flags passed in from constructor. Need to increase this size when new enums are added
-   bool mInsideRelayout:1;                 ///< Detect when were in Relayout
-   bool mIsKeyboardNavigationSupported:1;  ///< Stores whether keyboard navigation is supported by the control.
-   bool mIsKeyboardFocusGroup:1;           ///< Stores whether the control is a focus group.
-   bool mInitialized:1;
+   ControlBehaviour mFlags :6;              ///< Flags passed in from constructor. Need to increase this size when new enums are added
+   bool mIsKeyboardNavigationSupported :1;  ///< Stores whether keyboard navigation is supported by the control.
+   bool mIsKeyboardFocusGroup :1;           ///< Stores whether the control is a focus group.
+   bool mInitialized :1;
  
    // Properties - these need to be members of Internal::Control::Impl as they need to function within this class.
    static PropertyRegistration PROPERTY_1;
    static PropertyRegistration PROPERTY_2;
    static PropertyRegistration PROPERTY_3;
-   static PropertyRegistration PROPERTY_5;
-   static PropertyRegistration PROPERTY_6;
-   static PropertyRegistration PROPERTY_7;
-   static PropertyRegistration PROPERTY_8;
 +  static PropertyRegistration PROPERTY_4;
  };
  
  // Properties registered without macro to use specific member variables.
 -PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "background-color", Toolkit::Control::Property::BACKGROUND_COLOR, Property::VECTOR4, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
 -PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "background-image", Toolkit::Control::Property::BACKGROUND_IMAGE, Property::MAP,     &Control::Impl::SetProperty, &Control::Impl::GetProperty );
 -PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "key-input-focus",  Toolkit::Control::Property::KEY_INPUT_FOCUS,  Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
 +PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "style-name",       Toolkit::Control::Property::STYLE_NAME,       Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty );
 +PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "background-color", Toolkit::Control::Property::BACKGROUND_COLOR, Property::VECTOR4, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
- PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "background",       Toolkit::Control::Property::BACKGROUND,       Property::MAP,     &Control::Impl::SetProperty, &Control::Impl::GetProperty );
- PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "width-policy",     Toolkit::Control::Property::WIDTH_POLICY,     Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty );
- PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "height-policy",    Toolkit::Control::Property::HEIGHT_POLICY,    Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty );
- PropertyRegistration Control::Impl::PROPERTY_6( typeRegistration, "minimum-size",     Toolkit::Control::Property::MINIMUM_SIZE,     Property::VECTOR3, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
- PropertyRegistration Control::Impl::PROPERTY_7( typeRegistration, "maximum-size",     Toolkit::Control::Property::MAXIMUM_SIZE,     Property::VECTOR3, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
- PropertyRegistration Control::Impl::PROPERTY_8( typeRegistration, "key-input-focus",  Toolkit::Control::Property::KEY_INPUT_FOCUS,  Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
++PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "background-image", Toolkit::Control::Property::BACKGROUND_IMAGE, Property::MAP,     &Control::Impl::SetProperty, &Control::Impl::GetProperty );
++PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "key-input-focus",  Toolkit::Control::Property::KEY_INPUT_FOCUS,  Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
  
  Toolkit::Control Control::New()
  {
@@@ -622,79 -392,21 +408,21 @@@ Control::~Control(
    delete mImpl;
  }
  
- void Control::SetSizePolicy( Toolkit::Control::SizePolicy widthPolicy, Toolkit::Control::SizePolicy heightPolicy )
- {
-   bool relayoutRequest( false );
-   if ( ( mImpl->mWidthPolicy != widthPolicy ) || ( mImpl->mHeightPolicy != heightPolicy ) )
-   {
-     relayoutRequest = true;
-   }
-   mImpl->mWidthPolicy = widthPolicy;
-   mImpl->mHeightPolicy = heightPolicy;
-   // Ensure RelayoutRequest is called AFTER new policies have been set.
-   if ( relayoutRequest )
-   {
-     RelayoutRequest();
-   }
- }
- void Control::GetSizePolicy( Toolkit::Control::SizePolicy& widthPolicy, Toolkit::Control::SizePolicy& heightPolicy ) const
- {
-   widthPolicy = mImpl->mWidthPolicy;
-   heightPolicy = mImpl->mHeightPolicy;
- }
- void Control::SetMinimumSize( const Vector3& size )
- {
-   const Vector3& minSize = mImpl->GetMinimumSize();
-   if ( fabsf( minSize.width - size.width ) > Math::MACHINE_EPSILON_1000 ||
-        fabsf( minSize.height - size.height ) > Math::MACHINE_EPSILON_1000 )
-   {
-     mImpl->SetMinimumSize( size );
-     // Only relayout if our control is using the minimum or range policy.
-     if ( ( mImpl->mHeightPolicy == Toolkit::Control::Minimum ) || ( mImpl->mWidthPolicy  == Toolkit::Control::Minimum ) ||
-          ( mImpl->mHeightPolicy == Toolkit::Control::Range   ) || ( mImpl->mWidthPolicy  == Toolkit::Control::Range   ) )
-     {
-       RelayoutRequest();
-     }
-   }
- }
- const Vector3& Control::GetMinimumSize() const
+ Vector3 Control::GetNaturalSize()
  {
-   return mImpl->GetMinimumSize();
+   // could be overridden in derived classes.
+   return mImpl->mNaturalSize;
  }
  
void Control::SetMaximumSize( const Vector3& size )
float Control::CalculateChildSize( const Dali::Actor& child, Dimension dimension )
  {
-   const Vector3& maxSize = mImpl->GetMaximumSize();
-   if ( fabsf( maxSize.width - size.width ) > Math::MACHINE_EPSILON_1000 ||
-        fabsf( maxSize.height - size.height ) > Math::MACHINE_EPSILON_1000 )
-   {
-     mImpl->SetMaximumSize( size );
-     // Only relayout if our control is using the maximum or range policy.
-     if ( ( mImpl->mHeightPolicy == Toolkit::Control::Maximum ) || ( mImpl->mWidthPolicy  == Toolkit::Control::Maximum ) ||
-          ( mImpl->mHeightPolicy == Toolkit::Control::Range   ) || ( mImpl->mWidthPolicy  == Toolkit::Control::Range   ) )
-     {
-       RelayoutRequest();
-     }
-   }
+   // Could be overridden in derived classes.
+   return CalculateChildSizeBase( child, dimension );
  }
  
- const Vector3& Control::GetMaximumSize() const
+ bool Control::RelayoutDependentOnChildren( Dimension dimension )
  {
-   return mImpl->GetMaximumSize();
- }
- Vector3 Control::GetNaturalSize()
- {
-   // could be overridden in derived classes.
-   return mImpl->mNaturalSize;
+   return RelayoutDependentOnChildrenBase( dimension );
  }
  
  float Control::GetHeightForWidth( float width )
@@@ -775,23 -487,6 +503,23 @@@ LongPressGestureDetector Control::GetLo
    return mImpl->mLongPressGestureDetector;
  }
  
 +void Control::SetStyleName( const std::string& styleName )
 +{
 +  if( styleName != mImpl->mStyleName )
 +  {
 +    mImpl->mStyleName = styleName;
 +
 +    // Apply new style
 +    Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
 +    GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
 +  }
 +}
 +
 +const std::string& Control::GetStyleName() const
 +{
 +  return mImpl->mStyleName;
 +}
 +
  void Control::SetBackgroundColor( const Vector4& color )
  {
    Background& background( mImpl->GetBackground() );
@@@ -825,7 -520,7 +553,7 @@@ Vector4 Control::GetBackgroundColor() c
    return Color::TRANSPARENT;
  }
  
- void Control::SetBackground( Image image )
+ void Control::SetBackgroundImage( Image image )
  {
    Background& background( mImpl->GetBackground() );
  
@@@ -897,116 -592,6 +625,6 @@@ bool Control::OnAccessibilityValueChang
    return false; // Accessibility value change action is not handled by default
  }
  
- void Control::NegotiateSize( const Vector2& allocatedSize, ActorSizeContainer& container )
- {
-   Vector2 size;
-   if ( mImpl->mWidthPolicy == Toolkit::Control::Fixed )
-   {
-     if ( mImpl->mHeightPolicy == Toolkit::Control::Fixed )
-     {
-       // If a control says it has a fixed size, then use the size set by the application / control.
-       Vector2 setSize( mImpl->mNaturalSize );
-       if ( setSize != Vector2::ZERO )
-       {
-         size = setSize;
-         // Policy is set to Fixed, so if the application / control has not set one of the dimensions,
-         // then we should use the natural size of the control rather than the full allocation.
-         if ( EqualsZero( size.width ) )
-         {
-           size.width = GetWidthForHeight( size.height );
-         }
-         else if ( EqualsZero( size.height ) )
-         {
-           size.height = GetHeightForWidth( size.width );
-         }
-       }
-       else
-       {
-         // If that is not set then set the size to the control's natural size
-         size = Vector2( GetNaturalSize() );
-       }
-     }
-     else
-     {
-       // Width is fixed so if the application / control has set it, then use that.
-       if ( !EqualsZero( mImpl->mNaturalSize.width ) )
-       {
-         size.width = mImpl->mNaturalSize.width;
-       }
-       else
-       {
-         // Otherwise, set the width to what has been allocated.
-         size.width = allocatedSize.width;
-       }
-       // Height is flexible so ask control what the height should be for our width.
-       size.height = GetHeightForWidth( size.width );
-       // Ensure height is within our policy rules
-       size.height = Calculate( mImpl->mHeightPolicy, GetMinimumSize().height, GetMaximumSize().height, size.height );
-     }
-   }
-   else
-   {
-     if ( mImpl->mHeightPolicy == Toolkit::Control::Fixed )
-     {
-       // Height is fixed so if the application / control has set it, then use that.
-       if ( !EqualsZero( mImpl->mNaturalSize.height ) )
-       {
-         size.height = mImpl->mNaturalSize.height;
-       }
-       else
-       {
-         // Otherwise, set the height to what has been allocated.
-         size.height = allocatedSize.height;
-       }
-       // Width is flexible so ask control what the width should be for our height.
-       size.width = GetWidthForHeight( size.height );
-       // Ensure width is within our policy rules
-       size.width = Calculate( mImpl->mWidthPolicy, mImpl->GetMinimumSize().width, mImpl->GetMaximumSize().width, size.width );
-     }
-     else
-     {
-       // Width and height are BOTH flexible.
-       // Calculate the width and height using the policy rules.
-       size.width = Calculate( mImpl->mWidthPolicy, mImpl->GetMinimumSize().width, mImpl->GetMaximumSize().width, allocatedSize.width );
-       size.height = Calculate( mImpl->mHeightPolicy, mImpl->GetMinimumSize().height, mImpl->GetMaximumSize().height, allocatedSize.height );
-     }
-   }
-   // If the width has not been set, then set to the allocated width.
-   // Also if the width set is greater than the allocated, then set to allocated (no exceed support).
-   if ( EqualsZero( size.width ) || ( size.width > allocatedSize.width ) )
-   {
-     size.width = allocatedSize.width;
-   }
-   // If the height has not been set, then set to the allocated height.
-   // Also if the height set is greater than the allocated, then set to allocated (no exceed support).
-   if ( EqualsZero( size.height ) || ( size.height > allocatedSize.height ) )
-   {
-     size.height = allocatedSize.height;
-   }
-   DALI_LOG_INFO( gLogFilter, Debug::Verbose,
-                  "%p: Natural: [%.2f, %.2f] Allocated: [%.2f, %.2f] Set: [%.2f, %.2f]\n",
-                  Self().GetObjectPtr(),
-                  GetNaturalSize().x, GetNaturalSize().y,
-                  allocatedSize.x, allocatedSize.y,
-                  size.x, size.y );
-   // Avoids relayout again when OnSizeSet callback arrives as a function of us or deriving class calling SetSize()
-   mImpl->mInsideRelayout = true;
-   Self().SetSize( size );
-   // Only relayout controls which requested to be relaid out.
-   OnRelayout( size, container );
-   mImpl->mInsideRelayout = false;
- }
  void Control::SetAsKeyboardFocusGroup(bool isFocusGroup)
  {
    mImpl->mIsKeyboardFocusGroup = isFocusGroup;
@@@ -1129,12 -714,19 +747,19 @@@ void Control::Initialize(
    // Calling deriving classes
    OnInitialize();
  
+   // Test if the no size negotiation flag is not set
+   if( ( mImpl->mFlags & NO_SIZE_NEGOTIATION ) == 0 )
+   {
+     // Size negotiate disabled by default, so turn it on for this actor
+     Self().SetRelayoutEnabled( true );
+   }
    if( mImpl->mFlags & REQUIRES_STYLE_CHANGE_SIGNALS )
    {
      Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
  
      // Register for style changes
 -    styleManager.StyleChangeSignal().Connect( this, &Control::DoStyleChange );
 +    styleManager.StyleChangeSignal().Connect( this, &Control::OnStyleChange );
  
      // SetTheme
      GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
@@@ -1204,32 -796,6 +829,6 @@@ void Control::DisableGestureDetection(G
    }
  }
  
- void Control::RelayoutRequest()
- {
-   // unfortunate double negative but thats to guarantee new controls get size negotiation
-   // by default and have to "opt-out" if they dont want it
-   if( !(mImpl->mFlags & NO_SIZE_NEGOTIATION) )
-   {
-     Internal::RelayoutController::Request();
-   }
- }
- void Control::Relayout( Actor actor, const Vector2& size, ActorSizeContainer& container )
- {
-   if ( actor )
-   {
-     Toolkit::Control control( Toolkit::Control::DownCast( actor ) );
-     if( control )
-     {
-       control.GetImplementation().NegotiateSize( size, container );
-     }
-     else
-     {
-       container.push_back( ActorSizePair( actor, size ) );
-     }
-   }
- }
  void Control::OnInitialize()
  {
  }
@@@ -1238,13 -804,13 +837,13 @@@ void Control::OnActivated(
  {
  }
  
 -void Control::OnThemeChange( Toolkit::StyleManager styleManager )
 -{
 -  GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
 -}
 -
 -void Control::OnFontChange( bool defaultFontChange, bool defaultFontSizeChange )
 +void Control::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
  {
 +  // By default the control is only interested in theme (not font) changes
 +  if( change.themeChange )
 +  {
 +    GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
 +  }
  }
  
  void Control::OnPinch(const PinchGesture& pinch)
@@@ -1295,16 -861,26 +894,26 @@@ void Control::OnControlSizeSet( const V
  {
  }
  
- void Control::OnRelayout( const Vector2& size, ActorSizeContainer& container )
+ void Control::OnCalculateRelayoutSize( Dimension dimension )
  {
-   unsigned int numChildren = Self().GetChildCount();
+ }
  
-   for( unsigned int i=0; i<numChildren; ++i )
+ void Control::OnLayoutNegotiated( float size, Dimension dimension )
+ {
+ }
+ void Control::OnRelayout( const Vector2& size, RelayoutContainer& container )
+ {
+   for( unsigned int i = 0, numChildren = Self().GetChildCount(); i < numChildren; ++i )
    {
-     container.push_back( ActorSizePair( Self().GetChildAt(i), size ) );
+     container.Add( Self().GetChildAt( i ), size );
    }
  }
  
+ void Control::OnSetResizePolicy( ResizePolicy policy, Dimension dimension )
+ {
+ }
  void Control::OnKeyInputFocusGained()
  {
    // Do Nothing
@@@ -1342,8 -918,6 +951,6 @@@ bool Control::OnMouseWheelEvent(const M
  
  void Control::OnStageConnection()
  {
-   RelayoutRequest();
    // Notify derived classes.
    OnControlStageConnection();
  }
@@@ -1362,9 -936,6 +969,6 @@@ void Control::OnChildAdd(Actor& child
      return;
    }
  
-   // Request for relayout as we may need to position the new child and old ones
-   RelayoutRequest();
    // Notify derived classes.
    OnControlChildAdd( child );
  }
@@@ -1377,16 -948,13 +981,13 @@@ void Control::OnChildRemove(Actor& chil
      return;
    }
  
-   // Request for relayout as we may need to re-position the old child
-   RelayoutRequest();
    // Notify derived classes.
    OnControlChildRemove( child );
  }
  
  void Control::OnSizeSet(const Vector3& targetSize)
  {
-   if( ( !mImpl->mInsideRelayout ) && ( targetSize != mImpl->mNaturalSize ) )
+   if( targetSize != mImpl->mNaturalSize )
    {
      // Only updates size if set through Actor's API
      mImpl->mNaturalSize = targetSize;
@@@ -1412,6 -980,18 +1013,6 @@@ void Control::SignalDisconnected( SlotO
    mImpl->SignalDisconnected( slotObserver, callback );
  }
  
 -void Control::DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
 -{
 -  if( change.themeChange )
 -  {
 -    OnThemeChange( styleManager );
 -  }
 -  else if( change.defaultFontChange || change.defaultFontSizeChange )
 -  {
 -    OnFontChange( change.defaultFontChange, change.defaultFontSizeChange );
 -  }
 -}
 -
  } // namespace Internal
  
  } // namespace Toolkit
@@@ -41,13 -41,9 +41,9 @@@ class StyleManager
  
  namespace Internal DALI_INTERNAL
  {
- class RelayoutControllerImpl;
  class KeyInputFocusManager;
  }
  
- typedef std::pair< Actor, Vector2 > ActorSizePair;       ///< Pair of actor and size
- typedef std::vector< ActorSizePair > ActorSizeContainer; ///< Container of actors and their sizes
  namespace Internal
  {
  
@@@ -80,34 -76,14 +76,14 @@@ public
    // Size negotiation
  
    /**
-    * @copydoc Toolkit::Control::SetSizePolicy()
-    */
-   void SetSizePolicy( Toolkit::Control::SizePolicy widthPolicy, Toolkit::Control::SizePolicy heightPolicy );
-   /**
-    * @copydoc Toolkit::Control::GetSizePolicy()
-    */
-   void GetSizePolicy( Toolkit::Control::SizePolicy& widthPolicy, Toolkit::Control::SizePolicy& heightPolicy ) const;
-   /**
-    * @copydoc Toolkit::Control::SetMinimumSize()
-    */
-   void SetMinimumSize( const Vector3& size );
-   /**
-    * @copydoc Toolkit::Control::GetMinimumSize()
-    */
-   const Vector3& GetMinimumSize() const;
-   /**
-    * @copydoc Toolkit::Control::SetMaximumSize()
+    * @copydoc Dali::CustomActorImpl::GetHeightForWidth()
     */
-   void SetMaximumSize( const Vector3& size );
+   virtual float GetHeightForWidth( float width );
  
    /**
-    * @copydoc Toolkit::Control::GetMaximumSize()
+    * @copydoc Dali::CustomActorImpl::GetWidthForHeight()
     */
-   const Vector3& GetMaximumSize() const;
+   virtual float GetWidthForHeight( float height );
  
    /**
     * @copydoc Toolkit::Control::GetNaturalSize()
    virtual Vector3 GetNaturalSize();
  
    /**
-    * @brief This method is called during size negotiation when a height is required for a given width.
-    *
-    * Derived classes should override this if they wish to customize the height returned.
-    *
-    * @param width to use.
-    * @return the height based on the width.
-    */
-   virtual float GetHeightForWidth( float width );
-   /**
-    * @brief This method is called during size negotiation when a width is required for a given height.
-    *
-    * Derived classes should override this if they wish to customize the width returned.
-    *
-    * @param height to use.
-    * @return the width based on the width.
-    */
-   virtual float GetWidthForHeight( float height );
-   /**
     * @brief Retrieves the current Control's size.
     *
     * @return The control's size.
    // Background
  
    /**
 +   * @copydoc Dali::Toolkit::Control::SetStyleName
 +   */
 +  void SetStyleName( const std::string& styleName );
 +
 +  /**
 +   * @copydoc Dali::Toolkit::Control::GetStyleName
 +   */
 +  const std::string& GetStyleName() const;
 +
 +  /**
     * @copydoc Dali::Toolkit::Control::SetBackgroundColor
     */
    void SetBackgroundColor( const Vector4& color );
    Vector4 GetBackgroundColor() const;
  
    /**
-    * @copydoc Dali::Toolkit::Control::SetBackground
+    * @copydoc Dali::Toolkit::Control::SetBackgroundImage
     */
-   void SetBackground( Image image );
+   void SetBackgroundImage( Image image );
  
    /**
     * @copydoc Dali::Toolkit::Control::ClearBackground
     */
    virtual bool OnAccessibilityValueChange(bool isIncrease);
  
-   // Called by the RelayoutController
-   /**
-    * @brief Called by the RelayoutController to negotiate the size of a control.
-    *
-    * The size allocated by the the algorithm is passed in which the
-    * control must adhere to.  A container is passed in as well which
-    * the control should populate with actors it has not / or does not
-    * need to handle in its size negotiation.
-    *
-    * @param[in]      size       The allocated size.
-    * @param[in,out]  container  The container that holds actors that are fed back into the
-    *                            RelayoutController algorithm.
-    */
-   DALI_INTERNAL void NegotiateSize( const Vector2& size, ActorSizeContainer& container );
    // Keyboard Focus
  
    /**
@@@ -441,32 -371,10 +381,10 @@@ protected
     */
    void DisableGestureDetection(Gesture::Type type);
  
-   // Size Negotiation
-   /**
-    * @brief Request a relayout, which means performing a size negotiation on this control, its parent and children (and potentially whole scene)
-    *
-    * This method is automatically called from OnStageConnection(), OnChildAdd(),
-    * OnChildRemove(), SetSizePolicy(), SetMinimumSize() and SetMaximumSize().
-    *
-    * This method can also be called from a derived class every time it needs a different size.
-    * At the end of event processing, the relayout process starts and
-    * all controls which requested Relayout will have their sizes (re)negotiated.
-    *
-    * @note RelayoutRequest() can be called multiple times; the size negotiation is still
-    * only performed once, i.e. there is no need to keep track of this in the calling side.
-    */
-   void RelayoutRequest();
    /**
-    * @brief Helper method for controls to Relayout their children if
-    * they do not know whether that child is a control or not.
-    *
-    * @param[in]      actor      The actor to relayout.
-    * @param[in]      size       The size to allocate to the actor.
-    * @param[in,out]  container  The container that holds actors that have not been allocated a size yet.
+    * @copydoc Dali::CustomActorImpl::RelayoutDependentOnChildren()
     */
-   static void Relayout( Actor actor, const Vector2& size, ActorSizeContainer& container );
+   virtual bool RelayoutDependentOnChildren( Dimension dimension = ALL_DIMENSIONS );
  
  private:
  
    virtual void OnActivated();
  
    /**
 -   * @brief This method should be overridden by deriving classes when
 -   * they wish to be notified when the style manager changes the theme.
 +   * @brief This method should be overridden by deriving classes requiring notifications when the style changes.
     *
     * @param[in] styleManager  The StyleManager object.
 +   * @param[in] change  Information denoting what has changed.
     */
 -  virtual void OnThemeChange( Toolkit::StyleManager styleManager );
 -
 -  /**
 -   * @brief This method should be overridden by deriving classes when
 -   * they wish to be notified when the style changes the default font.
 -   *
 -   * @param[in] defaultFontChange  Information denoting whether the default font has changed.
 -   * @param[in] defaultFontSizeChange Information denoting whether the default font size has changed.
 -   */
 -  virtual void OnFontChange( bool defaultFontChange, bool defaultFontSizeChange );
 +  virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
  
    /**
     * @brief Called whenever a pinch gesture is detected on this control.
    virtual void OnControlSizeSet( const Vector3& size );
  
    /**
-    * @brief Called after the size negotiation has been finished for this control.
-    *
-    * The control is expected to assign this given size to itself/its children.
-    *
-    * Should be overridden by derived classes if they need to layout
-    * actors differently after certain operations like add or remove
-    * actors, resize or after changing specific properties.
-    *
-    * Note! As this function is called from inside the size negotiation algorithm, you cannot
-    * call RequestRelayout (the call would just be ignored)
-    *
-    * @param[in]      size       The allocated size.
-    * @param[in,out]  container  The control should add actors to this container that it is not able
-    *                            to allocate a size for.
-    */
-   virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
-   /**
     * @brief Called when the control gains key input focus.
     *
     * Should be overridden by derived classes if they need to customize what happens when focus is gained.
     */
    virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
  
+   /**
+    * @copydoc Dali::CustomActorImpl::OnCalculateRelayoutSize()
+    */
+   virtual void OnCalculateRelayoutSize( Dimension dimension );
+   /**
+    * @copydoc Dali::CustomActorImpl::OnLayoutNegotiated()
+    */
+   virtual void OnLayoutNegotiated( float size, Dimension dimension );
+   /**
+    * @copydoc Dali::CustomActorImpl::OnRelayout()
+    */
+   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+   /**
+    * @copydoc Dali::CustomActorImpl::OnSetResizePolicy()
+    */
+   virtual void OnSetResizePolicy( ResizePolicy policy, Dimension dimension );
+   /**
+    * @copydoc Dali::CustomActorImpl::CalculateChildSize()
+    */
+   virtual float CalculateChildSize( const Dali::Actor& child, Dimension dimension );
    // From CustomActorImpl, derived classes should NOT override these.
  
    /**
     */
    virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback );
  
 -  // Style
 -
 -  /**
 -   * @brief This method is the callback for the StyleChangeSignal from StyleManager
 -   *
 -   * @param[in] styleManager The StyleManager Object
 -   * @param[in] change  Information denoting what has changed.
 -   */
 -  DALI_INTERNAL void DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change );
 -
  private:
  
    // Undefined
@@@ -69,51 -69,6 +69,6 @@@ const Internal::Control& Control::GetIm
    return static_cast<const Internal::Control&>(CustomActor::GetImplementation());
  }
  
- void Control::SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy )
- {
-   GetImplementation().SetSizePolicy( widthPolicy, heightPolicy );
- }
- void Control::GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const
- {
-   GetImplementation().GetSizePolicy( widthPolicy, heightPolicy );
- }
- void Control::SetMinimumSize( const Vector3& size )
- {
-   GetImplementation().SetMinimumSize( size );
- }
- const Vector3& Control::GetMinimumSize() const
- {
-   return GetImplementation().GetMinimumSize();
- }
- void Control::SetMaximumSize( const Vector3& size )
- {
-   GetImplementation().SetMaximumSize( size );
- }
- const Vector3& Control::GetMaximumSize() const
- {
-   return GetImplementation().GetMaximumSize();
- }
- Vector3 Control::GetNaturalSize()
- {
-   return GetImplementation().GetNaturalSize();
- }
- float Control::GetHeightForWidth( float width )
- {
-   return GetImplementation().GetHeightForWidth( width );
- }
- float Control::GetWidthForHeight( float height )
- {
-   return GetImplementation().GetWidthForHeight( height );
- }
  void Control::SetKeyInputFocus()
  {
    GetImplementation().SetKeyInputFocus();
@@@ -149,16 -104,6 +104,16 @@@ LongPressGestureDetector Control::GetLo
    return GetImplementation().GetLongPressGestureDetector();
  }
  
 +void Control::SetStyleName( const std::string& styleName )
 +{
 +  GetImplementation().SetStyleName( styleName );
 +}
 +
 +const std::string& Control::GetStyleName() const
 +{
 +  return GetImplementation().GetStyleName();
 +}
 +
  void Control::SetBackgroundColor( const Vector4& color )
  {
    GetImplementation().SetBackgroundColor( color );
@@@ -169,9 -114,9 +124,9 @@@ Vector4 Control::GetBackgroundColor() c
    return GetImplementation().GetBackgroundColor();
  }
  
- void Control::SetBackground( Image image )
+ void Control::SetBackgroundImage( Image image )
  {
-   GetImplementation().SetBackground( image );
+   GetImplementation().SetBackgroundImage( image );
  }
  
  void Control::ClearBackground()
@@@ -82,40 -82,13 +82,14 @@@ public
    {
      enum
      {
 -      BACKGROUND_COLOR = PROPERTY_START_INDEX, ///< name "background-color", @see SetBackgroundColor, type Vector4
 +      STYLE_NAME = PROPERTY_START_INDEX,       ///< name "style-name",       @see SetStyleName,       type std::string
 +      BACKGROUND_COLOR,                        ///< name "background-color", @see SetBackgroundColor, type Vector4
-       BACKGROUND,                              ///< name "background",       @see SetBackground,      type Map
-       WIDTH_POLICY,                            ///< name "width-policy",     @see SetSizePolicy,      type std::string
-       HEIGHT_POLICY,                           ///< name "height-policy",    @see SetSizePolicy,      type std::string
-       MINIMUM_SIZE,                            ///< name "minimum-size",     @see SetMinimumSize,     type Vector3
-       MAXIMUM_SIZE,                            ///< name "maximum-size",     @see SetMaximumSize,     type Vector3
+       BACKGROUND_IMAGE,                        ///< name "background-image", @see SetBackgroundImage, type Map
        KEY_INPUT_FOCUS,                         ///< name "key-input-focus",  @see SetKeyInputFocus,   type bool
      };
    };
  
    /**
-    * @brief Describes how a control could be resized.
-    */
-   enum SizePolicy
-   {
-     Fixed,    ///< Size can't grow or shrink.
-     Minimum,  ///< Size can grow but shrink up to a minimum level.
-     Maximum,  ///< Size can shrink but grow up to a maximum value.
-     Range,    ///< Size can grow or shrink between a minimum and a maximum values.
-     Flexible, ///< Size can grow or shrink with no limits.
-   };
-   /**
-    * @brief Describes what a control should do when a contained actor/control exceeds the boundary of the control.
-    */
-   enum ExceedPolicy
-   {
-     Crop,   ///< Control's contents will be cropped.
-     Shrink, ///< Control's contents will be shrunk.
-     Scroll  ///< Control's contents will be added to a scroll.
-   };
-   /**
     * @brief Describes the direction to move the keyboard focus towards.
     */
    enum KeyboardFocusNavigationDirection
@@@ -201,79 -174,6 +175,6 @@@ public
     */
    const Internal::Control& GetImplementation() const;
  
-   // Size Negotiation
-   /**
-    * @brief Sets the size policies for the width and height dimensions.
-    *
-    * @param[in] widthPolicy Size policy for the width dimension.
-    * @param[in] heightPolicy Size policy for the height dimension.
-    */
-   void SetSizePolicy( SizePolicy widthPolicy, SizePolicy heightPolicy );
-   /**
-    * @brief Retrieves the size policies for the width and height dimensions.
-    *
-    * @param[out] widthPolicy Width's size policy.
-    * @param[out] heightPolicy Height's size policy.
-    */
-   void GetSizePolicy( SizePolicy& widthPolicy, SizePolicy& heightPolicy ) const;
-   /**
-    * @brief Sets the minimum size for the control.
-    *
-    * @param[in] size The minimum size.
-    */
-   void SetMinimumSize( const Vector3& size );
-   /**
-    * @brief Retrieves the minimum size.
-    *
-    * @return The minimum size.
-    */
-   const Vector3& GetMinimumSize() const;
-   /**
-    * @brief Sets the maximum size.
-    *
-    * @param[in] size The maximum size.
-    */
-   void SetMaximumSize( const Vector3& size );
-   /**
-    * @brief Retrieves the maximum size.
-    *
-    * @return The maximum size.
-    */
-   const Vector3& GetMaximumSize() const;
-   /**
-    * @brief Works out the natural size.
-    *
-    * Natural size is the control's size with any restriction.
-    *
-    * @return The natural size.
-    */
-   Vector3 GetNaturalSize();
-   /**
-    * @brief Works out the control's height for a given width.
-    *
-    * @param[in] width The control's width.
-    *
-    * @return The control's height for the given width.
-    */
-   float GetHeightForWidth( float width );
-   /**
-    * @brief Works out the control's width for a given height.
-    *
-    * @param[in] height The control's height.
-    *
-    * @return The control's width for the given height.
-    */
-   float GetWidthForHeight( float height );
    // Key Input
  
    /**
    // Background
  
    /**
 +   * @brief Sets the name of the style to be applied to the control.
 +   *
 +   * @param[in] styleName A string matching a style described in a stylesheet.
 +   */
 +  void SetStyleName( const std::string& styleName );
 +
 +  /**
 +   * @brief Retrieves the name of the style to be applied to the control (if any).
 +   *
 +   * @return A string matching a style or an empty string.
 +   */
 +  const std::string& GetStyleName() const;
 +
 +  // Background
 +
 +  /**
     * @brief Sets the background color of the control.
     *
     * @param[in] color The required background color of the control
     *
     * @param[in] image The image to set as the background.
     */
-   void SetBackground( Image image );
+   void SetBackgroundImage( Image image );
  
    /**
     * @brief Clears the background.
@@@ -87,7 -87,12 +87,7 @@@ void Popup::SetTitle( const std::string
    GetImpl(*this).SetTitle( text );
  }
  
 -void Popup::SetTitle( TextView titleActor )
 -{
 -  GetImpl(*this).SetTitle( titleActor );
 -}
 -
 -TextView Popup::GetTitle() const
 +const std::string& Popup::GetTitle() const
  {
    return GetImpl(*this).GetTitle();
  }
@@@ -132,6 -137,11 +132,11 @@@ void Popup::HideTail(
    GetImpl(*this).HideTail();
  }
  
+ void Popup::MarkDirtyForRelayout()
+ {
+   GetImpl(*this).MarkDirtyForRelayout();
+ }
  Popup::TouchedOutsideSignalType& Popup::OutsideTouchedSignal()
  {
    return GetImpl(*this).OutsideTouchedSignal();
@@@ -20,6 -20,7 +20,6 @@@
  
  // INTERNAL INCLUDES
  #include <dali-toolkit/public-api/controls/control.h>
 -#include <dali-toolkit/public-api/controls/text-view/text-view.h>
  
  namespace Dali
  {
@@@ -166,11 -167,18 +166,11 @@@ public
    void SetTitle( const std::string& text );
  
    /**
 -   * @brief Sets a title for this Popup.
 -   *
 -   * @param[in] titleActor The TextView to appear as the heading for this Popup
 -   */
 -  void SetTitle( TextView titleActor );
 -
 -  /**
     * @brief Gets the text (TextView) for this Popup.
     *
 -   * @return The TextView representing this popup is returned.
 +   * @return The text to appear as the heading for this Popup
     */
 -  TextView GetTitle() const;
 +  const std::string& GetTitle() const;
  
    /**
     * @brief Adds a button to this Popup.
     */
    void HideTail();
  
+   /**
+    * @brief Flag the popup as dirty for relayout
+    */
+   void MarkDirtyForRelayout();
  public: // Not intended for application developers
  
    /**
index 97e8485,0000000..7a61615
mode 100644,000000..100644
--- /dev/null
@@@ -1,75 -1,0 +1,83 @@@
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// CLASS HEADER
 +#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +TextLabel TextLabel::New()
 +{
 +  return Internal::TextLabel::New();
 +}
 +
++TextLabel TextLabel::New( const std::string& text )
++{
++  TextLabel label = Internal::TextLabel::New();
++  label.SetProperty( TextLabel::Property::TEXT, text );
++
++  return label;
++}
++
 +TextLabel::TextLabel()
 +{
 +}
 +
 +TextLabel::TextLabel( const TextLabel& handle )
 +: Control( handle )
 +{
 +}
 +
 +TextLabel& TextLabel::operator=( const TextLabel& handle )
 +{
 +  if( &handle != this )
 +  {
 +    Control::operator=( handle );
 +  }
 +  return *this;
 +}
 +
 +TextLabel::~TextLabel()
 +{
 +}
 +
 +TextLabel TextLabel::DownCast( BaseHandle handle )
 +{
 +  return Control::DownCast<TextLabel, Internal::TextLabel>(handle);
 +}
 +
 +TextLabel::TextLabel( Internal::TextLabel& implementation )
 +: Control(implementation)
 +{
 +}
 +
 +TextLabel::TextLabel( Dali::Internal::CustomActor* internal )
 +: Control( internal )
 +{
 +  VerifyCustomActorPointer<Internal::TextLabel>( internal );
 +}
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
index ba755da,0000000..ac64fe6
mode 100644,000000..100644
--- /dev/null
@@@ -1,138 -1,0 +1,147 @@@
-    * Create the TextLabel control.
 +#ifndef __DALI_TOOLKIT_TEXT_LABEL_H__
 +#define __DALI_TOOLKIT_TEXT_LABEL_H__
 +
 +/*
 + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
 + *
 + * Licensed under the Apache License, Version 2.0 (the "License");
 + * you may not use this file except in compliance with the License.
 + * You may obtain a copy of the License at
 + *
 + * http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + *
 + */
 +
 +// INTERNAL INCLUDES
 +#include <dali-toolkit/public-api/controls/control.h>
 +
 +namespace Dali
 +{
 +
 +namespace Toolkit
 +{
 +
 +namespace Internal DALI_INTERNAL
 +{
 +class TextLabel;
 +}
 +
 +/**
 + * @brief A control which renders a short text string.
 + *
 + * Text labels are lightweight, non-editable and do not respond to user input.
 + */
 +class DALI_IMPORT_API TextLabel : public Control
 +{
 +public:
 +
 +  /**
 +   * @brief The start and end property ranges for this control.
 +   */
 +  enum PropertyRange
 +  {
 +    PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
 +    PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices
 +  };
 +
 +  /**
 +   * @brief An enumeration of properties belonging to the TextLabel class.
 +   */
 +  struct Property
 +  {
 +    enum
 +    {
 +      RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "rendering-backend",    The type or rendering e.g. bitmap-based,      type INT
 +      TEXT,                                     ///< name "text",                 The text to display in UTF-8 format,          type STRING
 +      FONT_FAMILY,                              ///< name "font-family",          The requested font family,                    type STRING
 +      FONT_STYLE,                               ///< name "font-style",           The requested font style e.g. Regular/Italic, type STRING
 +      POINT_SIZE,                               ///< name "point-size",           The size of font in points,                   type FLOAT
 +      MULTI_LINE,                               ///< name "multi-line",           The single-line or multi-line layout option,  type BOOLEAN
 +      HORIZONTAL_ALIGNMENT,                     ///< name "horizontal-alignment", The line horizontal alignment,                type STRING,  values "BEGIN", "CENTER", "END"
 +      VERTICAL_ALIGNMENT,                        ///< name "vertical-alignment",   The line vertical alignment,                  type STRING,  values   "TOP",   "CENTER",   "BOTTOM"
 +      SHADOW_OFFSET,                            ///< name "shadow-offset",        The drop shadow offset 0 indicates no shadow, type VECTOR2
 +      SHADOW_COLOR,                             ///< name "shadow-color",         The color of a drop shadow                  , type VECTOR4
 +    };
 +  };
 +
 +  /**
++   * @brief Create the TextLabel control.
++   *
 +   * @return A handle to the TextLabel control.
 +   */
 +  static TextLabel New();
 +
 +  /**
++   * @brief Create the TextLabel control.
++   *
++   * @param[in] text The text to display.
++   * @return A handle to the TextLabel control.
++   */
++  static TextLabel New( const std::string& text );
++
++  /**
 +   * @brief Creates an empty handle.
 +   */
 +  TextLabel();
 +
 +  /**
 +   * @brief Copy constructor.
 +   *
 +   * @param[in] handle The handle to copy from.
 +   */
 +  TextLabel( const TextLabel& handle );
 +
 +  /**
 +   * @brief Assignment operator.
 +   *
 +   * @param[in] handle The handle to copy from.
 +   * @return A reference to this.
 +   */
 +  TextLabel& operator=( const TextLabel& handle );
 +
 +  /**
 +   * @brief Destructor
 +   *
 +   * This is non-virtual since derived Handle types must not contain data or virtual methods.
 +   */
 +  ~TextLabel();
 +
 +  /**
 +   * @brief Downcast a handle to TextLabel.
 +   *
 +   * If the BaseHandle points is a TextLabel the downcast returns a valid handle.
 +   * If not the returned handle is left empty.
 +   *
 +   * @param[in] handle Handle to an object
 +   * @return handle to a TextLabel or an empty handle
 +   */
 +  static TextLabel DownCast( BaseHandle handle );
 +
 +public: // Not intended for application developers
 +
 +  /**
 +   * @brief Creates a handle using the Toolkit::Internal implementation.
 +   *
 +   * @param[in] implementation The Control implementation.
 +   */
 +  DALI_INTERNAL TextLabel( Internal::TextLabel& implementation );
 +
 +  /**
 +   * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
 +   *
 +   * @param[in]  internal  A pointer to the internal CustomActor.
 +   */
 +  explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
 +};
 +
 +} // namespace Toolkit
 +
 +} // namespace Dali
 +
 +#endif // __DALI_TOOLKIT_TEXT_LABEL_H__
diff --combined docs/content/main-page.h
@@@ -14,7 -14,7 +14,7 @@@
   * - \link hello-world Hello World - explained \endlink
   *
   * \section Actors Actors
 - * - \link image-text-mesh-actor Image, Text and Mesh actors \endlink
 + * - \link image-mesh-actor Image and Mesh actors \endlink
   * - \link event-system Event Handling \endlink
   * - \link custom-actor Custom Actor \endlink
   *
   * \section Constraints
   * - \link constraints-intro Introduction to Constraints \endlink
   *
+  * \section SizeNegotiation Size Negotiation
+  * - \link size-negotiation Size Negotiation \endlink
+  *
   * \section UIControls UI Controls
 + * - \link text-label Text Label \endlink
   * - \link item-view Item View \endlink
 - * - \link text-view Text View \endlink
 - * - \link text-input Text Input \endlink
   * - \link scroll-view Scroll View \endlink
-  * - \link size-negotiation Size Negotiation \endlink
+  * - \link size-negotiation-controls Size Negotiation for Controls \endlink
 - * - \link markup-processor Markup Processor \endlink
   * - \link type-registration Type Registration \endlink
   * - \link properties Properties \endlink
   * - \link background Background \endlink
@@@ -1,14 -1,12 +1,14 @@@
  Name:       dali-toolkit
  Summary:    The OpenGLES Canvas Core Library Toolkit
- Version:    1.0.34
+ Version:    1.0.35
  Release:    1
  Group:      System/Libraries
  License:    Apache-2.0
  URL:        https://review.tizen.org/git/?p=platform/core/uifw/dali-toolkit.git;a=summary
  Source0:    %{name}-%{version}.tar.gz
  
 +%define dali_profile MOBILE
 +
  Requires(post): /sbin/ldconfig
  Requires(postun): /sbin/ldconfig
  Requires:       dali
@@@ -18,6 -16,7 +18,6 @@@ BuildRequires:  pkgconfig(dlog
  BuildRequires:  boost-devel
  BuildRequires:  pkgconfig(dali)
  BuildRequires:  pkgconfig(dali-core)
 -BuildRequires:  fribidi-devel
  
  %description
  The OpenGLES Canvas Core Library Toolkit - a set of controls that provide
@@@ -60,7 -59,7 +60,7 @@@ cd %{_builddir}/dali-toolkit-%{version}
  autoreconf --install
  DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
  DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
 -%configure
 +%configure --enable-profile=%{dali_profile}
  make %{?jobs:-j%jobs}
  
  ##############################
@@@ -12,14 -12,18 +12,15 @@@ script_v8_plugin_src_files = 
     $(v8_plugin_dir)/actors/actor-wrapper.cpp \
     $(v8_plugin_dir)/actors/actor-api.cpp \
     $(v8_plugin_dir)/actors/layer-api.cpp \
 -   $(v8_plugin_dir)/actors/text-actor-api.cpp \
     $(v8_plugin_dir)/actors/image-actor-api.cpp \
     $(v8_plugin_dir)/actors/camera-actor-api.cpp \
     $(v8_plugin_dir)/actors/mesh-actor-api.cpp \
     $(v8_plugin_dir)/actors/renderable-actor-api.cpp \
     $(v8_plugin_dir)/constants/constants-wrapper.cpp \
 -   $(v8_plugin_dir)/text/font-api.cpp \
 -   $(v8_plugin_dir)/text/font-wrapper.cpp \
     $(v8_plugin_dir)/animation/animation-api.cpp \
     $(v8_plugin_dir)/animation/animation-wrapper.cpp \
     $(v8_plugin_dir)/animation/path-api.cpp \
+    $(v8_plugin_dir)/animation/path-constraint-wrapper.cpp \
     $(v8_plugin_dir)/animation/path-wrapper.cpp \
     $(v8_plugin_dir)/stage/stage-wrapper.cpp \
     $(v8_plugin_dir)/events/event-object-generator.cpp \
  #include "actor-api.h"
  
  // EXTERNAL INCLUDES
 -#include <dali-toolkit/public-api/controls/text-view/text-view.h>
 +#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
  
  // INTERNAL INCLUDES
  #include <v8-utils.h>
  #include <actors/actor-wrapper.h>
+ #include <animation/path-constraint-wrapper.h>
  
  namespace Dali
  {
@@@ -41,11 -42,11 +42,11 @@@ Actor GetActor( v8::Isolate* isolate, c
  } //unanmed namespace
  
  
 -namespace TextViewApi
 +namespace TextLabelApi
  {
   Actor New( const v8::FunctionCallbackInfo< v8::Value >& args )
   {
 -   return Dali::Toolkit::TextView::New();
 +   return Dali::Toolkit::TextLabel::New();
   }
  }
  
@@@ -485,7 -486,7 +486,7 @@@ void ActorApi::IsKeyboardFocusable( con
   *
   * @for Actor
   * @method getActorType
 - * @return {String} Actor, ImageActor, TextActor, MeshActor, Layer, CameraActor ...
 + * @return {String} Actor, ImageActor, MeshActor, Layer, CameraActor ...
   */
  void ActorApi::GetActorType( const v8::FunctionCallbackInfo<v8::Value>& args )
  {
@@@ -609,6 -610,111 +610,111 @@@ void ActorApi::ScaleBy( const v8::Funct
    actor.ScaleBy( vector );
  }
  
+ void ActorApi::ApplyPathConstraint( const v8::FunctionCallbackInfo< v8::Value >& args )
+ {
+   v8::Isolate* isolate = args.GetIsolate();
+   v8::HandleScope handleScope( isolate );
+   //Get target actor
+   Actor targetActor = GetActor( isolate, args );
+   //Get PathConstraint
+   bool found(false);
+   Handle pathConstraintHandle =  V8Utils::GetHandleParameter(PARAMETER_0, found, isolate, args );
+   if( !found )
+   {
+     DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 0 (PathConstraint)" );
+     return;
+   }
+   PathConstraint pathConstraint = PathConstraint::DownCast(pathConstraintHandle);
+   //Get target property
+   std::string propertyName = V8Utils::GetStringParameter( PARAMETER_1, found, isolate, args );
+   if(!found)
+   {
+     DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 1 (Property name)" );
+     return;
+   }
+   // try both properties with dashes and without
+   Property::Index targetPropertyIndex = targetActor.GetPropertyIndex( propertyName );
+   if( targetPropertyIndex == Property::INVALID_INDEX )
+   {
+     std::string convertedName = V8Utils::JavaScriptNameToPropertyName( propertyName );
+     targetPropertyIndex = targetActor.GetPropertyIndex( convertedName );
+     if( targetPropertyIndex == Property::INVALID_INDEX )
+     {
+       DALI_SCRIPT_EXCEPTION( isolate, "Property not found" );
+     }
+   }
+   //Get source actor
+   Actor sourceActor = V8Utils::GetActorParameter( PARAMETER_2, found, isolate, args );
+   if( !found )
+   {
+     DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 2 (Actor)" );
+   }
+   // try both properties with dashes and without
+   propertyName = V8Utils::GetStringParameter( PARAMETER_3, found, isolate, args );
+   if(!found)
+   {
+     DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 3 (Property name)" );
+     return;
+   }
+   Property::Index sourcePropertyIndex = sourceActor.GetPropertyIndex( propertyName );
+   if( sourcePropertyIndex == Property::INVALID_INDEX )
+   {
+     std::string convertedName = V8Utils::JavaScriptNameToPropertyName( propertyName );
+     sourcePropertyIndex = sourceActor.GetPropertyIndex( convertedName );
+     if( sourcePropertyIndex == Property::INVALID_INDEX )
+     {
+       DALI_SCRIPT_EXCEPTION( isolate, "Property not found" );
+       return;
+     }
+   }
+   //Check if forward vector is specified
+   Vector3 forward( 0.0f,0.0f,0.0f);
+   if( args.Length() > 4 )
+   {
+     forward =  V8Utils::GetVector3Parameter( PARAMETER_4, found, isolate, args );
+     if( !found )
+     {
+       DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 4 (Vector3)" );
+       return;
+     }
+   }
+   pathConstraint.Apply( Dali::Property(sourceActor,sourcePropertyIndex),
+                         Dali::Property(targetActor,targetPropertyIndex),
+                         forward );
+ }
+ void ActorApi::RemovePathConstraint( const v8::FunctionCallbackInfo< v8::Value >& args )
+ {
+   v8::Isolate* isolate = args.GetIsolate();
+   v8::HandleScope handleScope( isolate );
+   //Get target actor
+   Actor actor = GetActor( isolate, args );
+   //Get PathConstraint
+   bool found(false);
+   Handle pathConstraintHandle =  V8Utils::GetHandleParameter(PARAMETER_0, found, isolate, args );
+   if( !found )
+   {
+     DALI_SCRIPT_EXCEPTION( isolate, "bad parameter 0 (PathConstraint)" );
+     return;
+   }
+   PathConstraint pathConstraint = PathConstraint::DownCast(pathConstraintHandle);
+   pathConstraint.Remove(actor);
+ }
  } // namespace V8Plugin
  
  } // namespace Dali
@@@ -28,7 -28,7 +28,7 @@@ namespace Dal
  namespace V8Plugin
  {
  
 -namespace TextViewApi
 +namespace TextLabelApi
  {
    /**
     * Temporary TextView constructor
@@@ -68,6 -68,12 +68,12 @@@ namespace ActorAp
    void RotateBy( const v8::FunctionCallbackInfo< v8::Value >& args );
    void ScaleBy( const v8::FunctionCallbackInfo< v8::Value >& args );
  
+   // new function just for JavaScript API, to apply a PathConstraint to an actor
+   void ApplyPathConstraint( const v8::FunctionCallbackInfo< v8::Value >& args );
+   // new function just for JavaScript API, to remove a PathConstraint from an actor
+   void RemovePathConstraint( const v8::FunctionCallbackInfo< v8::Value >& args );
    // new function just for JavaScript API, to help developers know what type of actor
    // they're dealing with, returns actor name as a string
    void GetActorType( const v8::FunctionCallbackInfo< v8::Value >& args );
@@@ -25,6 -25,7 +25,6 @@@
  #include <actors/layer-api.h>
  #include <actors/actor-api.h>
  #include <actors/image-actor-api.h>
 -#include <actors/text-actor-api.h>
  #include <actors/mesh-actor-api.h>
  #include <actors/camera-actor-api.h>
  #include <actors/renderable-actor-api.h>
@@@ -39,10 -40,11 +39,10 @@@ namespace V8Plugi
  
  v8::Persistent<v8::ObjectTemplate> ActorWrapper::mActorTemplate;
  v8::Persistent<v8::ObjectTemplate> ActorWrapper::mImageActorTemplate;
 -v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextActorTemplate;
  v8::Persistent<v8::ObjectTemplate> ActorWrapper::mMeshActorTemplate;
  v8::Persistent<v8::ObjectTemplate> ActorWrapper::mCameraActorTemplate;
  v8::Persistent<v8::ObjectTemplate> ActorWrapper::mLayerActorTemplate;
 -v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextViewTemplate;
 +v8::Persistent<v8::ObjectTemplate> ActorWrapper::mTextLabelTemplate;
  
  namespace
  {
@@@ -63,10 -65,11 +63,10 @@@ const ActorTemplate ActorTemplateLookup
  {
      { &ActorWrapper::mActorTemplate },        // ACTOR
      { &ActorWrapper::mImageActorTemplate },   // IMAGE_ACTOR
 -    { &ActorWrapper::mTextActorTemplate  },   // TEXT_ACTOR
      { &ActorWrapper::mMeshActorTemplate  },   // MESH_ACTOR
      { &ActorWrapper::mLayerActorTemplate },   // LAYER_ACTOR
      { &ActorWrapper::mCameraActorTemplate},   // CAMERA_ACTOR
 -    { &ActorWrapper::mTextViewTemplate }
 +    { &ActorWrapper::mTextLabelTemplate }
  };
  
  /**
@@@ -77,9 -80,10 +77,9 @@@ enum ActorApiBitMas
    ACTOR_API              = 1 << 0,
    RENDERABLE_ACTOR_API   = 1 << 1,
    IMAGE_ACTOR_API        = 1 << 2,
 -  TEXT_ACTOR_API         = 1 << 3,
 -  MESH_ACTOR_API         = 1 << 4,
 -  LAYER_API              = 1 << 5,
 -  CAMERA_ACTOR_API       = 1 << 6,
 +  MESH_ACTOR_API         = 1 << 3,
 +  LAYER_API              = 1 << 4,
 +  CAMERA_ACTOR_API       = 1 << 5,
  };
  
  /**
@@@ -100,10 -104,11 +100,10 @@@ const ActorApiStruct ActorApiLookup[]
  {
    {"Actor",      ActorWrapper::ACTOR,        ActorApi::New,       ACTOR_API },
    {"ImageActor", ActorWrapper::IMAGE_ACTOR,  ImageActorApi::New,  ACTOR_API | RENDERABLE_ACTOR_API | IMAGE_ACTOR_API   },
 -  {"TextActor",  ActorWrapper::TEXT_ACTOR,   TextActorApi::New,   ACTOR_API | RENDERABLE_ACTOR_API | TEXT_ACTOR_API    },
    {"MeshActor",  ActorWrapper::MESH_ACTOR,   MeshActorApi::New,   ACTOR_API | RENDERABLE_ACTOR_API | MESH_ACTOR_API    },
    {"Layer",      ActorWrapper::LAYER_ACTOR,  LayerApi::New,       ACTOR_API | LAYER_API                                },
    {"CameraActor",ActorWrapper::CAMERA_ACTOR, CameraActorApi::New, ACTOR_API | CAMERA_ACTOR_API                         },
 -  {"TextView",   ActorWrapper::TEXT_VIEW,    TextViewApi::New,    ACTOR_API },
 +  {"TextLabel",  ActorWrapper::TEXT_LABEL,   TextLabelApi::New,   ACTOR_API },
  
  };
  
@@@ -143,7 -148,7 +143,7 @@@ Actor CreateActor( const v8::FunctionCa
    else
    {
      // run the constructor for this type of actor so it can pull out
 -    // custom parameters, e.g. new TextActor("hello world"); or ImageActor( MyImage );
 +    // custom parameters, e.g. new ImageActor( MyImage );
      actor = (ActorApiLookup[actorType].constructor)( args );
    }
    return actor;
@@@ -197,6 -202,8 +197,8 @@@ const ActorFunctions ActorFunctionTable
      { "FindChildById",     ActorApi::FindChildById,    ACTOR_API },
      { "GetParent" ,        ActorApi::GetParent,        ACTOR_API },
      { "GetActorType" ,     ActorApi::GetActorType,     ACTOR_API }, // custom for javascript
+     { "ApplyPathConstraint",  ActorApi::ApplyPathConstraint,  ACTOR_API }, // custom for javascript
+     { "RemovePathConstraint", ActorApi::RemovePathConstraint, ACTOR_API }, // custom for javascript
  
      // ignore. SetParentOrigin() use Actor.parentOrigin
      // ignore. GetCurrentParentOrigin()  use Actor.parentOrigin
      // ignore GetFadeInDuration use imageActor.fadeInDuration
      //{ "GetCurrentImageSize", ImageActorApi::GetCurrentImageSize,  IMAGE_ACTOR_API },
  
 -
 -    /**************************************
 -     * Text Actor API (in order of text-actor.h)
 -     **************************************/
 -    //ignore SetText use textActor.text
 -    { "SetToNaturalSize",   TextActorApi::SetToNaturalSize,      TEXT_ACTOR_API },
 -    // ignore GetFont use textActor.font
 -    // ignore SetFont use textActor.font
 -    // ignore SetGradient use textActor.gradientColor
 -    // ignore GetGradient textActor.gradientColor
 -    // ignore SetGradientStartPoint use textActor.gradientStartPoint
 -    // ignore GetGradientStartPoint textActor.gradientStartPoint
 -    // ignore SetGradientEndPoint use textActor.gradientEndPoint
 -    // ignore GetGradientEndPoint textActor.gradientEndPoint
 -    // @todo? SetTextStyle ( can use individual properties as a work around )
 -    // @todo? GetTextStyle ( can use individual properties as a work around )
 -    // ignore SetTextColor use textActor.textColor
 -    // ignore GetTextColor use textActor.textColor
 -    // ignore SetSmoothEdge use textActor.smoothEdge
 -    // ignore SetOutline use textActor.outLineEnable, outlineColor, thicknessWidth
 -    // ignore SetGlow use textActor.glowEnable, glowColor, glowIntensity
 -    // ignore SetShadow use textActor.shadowEnable, shadowColor, shadowOffset, shadowSize
 -    // ignore SetItalics use textActor.italicsAngle ?
 -    // ignore GetItalics  @todo add italics flag? or just stick with angle
 -    // ignore GetItalicsAngle  use textActor.italicsAngle
 -    // ignore SetUnderline use textActor.underline
 -    // ignore GetUnderline use textActor.underline
 -    // ignore SetWeight use textActor.weight
 -    // ignore GetWeight use textActor.weight
 -    // ignore SetFontDetectionAutomatic use textActor.fontDetectionAutomatic
 -    // ignore IsFontDetectionAutomatic use textActor.fontDetectionAutomatic
 -    // ignore GetLoadingState text is loaded synchronously
 -    // ignore TextAvailableSignal text is loaded synchronously
 -
      /**************************************
       * Mesh Actor API (in order of mesh-actor.h)
       **************************************/
@@@ -448,7 -489,7 +450,7 @@@ void ActorWrapper::NewActor( const v8::
      return;
    }
  
 -  // find out the callee function name...e.g. TextActor, ImageActor, MeshActor
 +  // find out the callee function name...e.g. ImageActor, MeshActor
    v8::Local<v8::Function> callee = args.Callee();
    v8::Local<v8::Value> v8String = callee->GetName();
    std::string typeName = V8Utils::v8StringToStdString( v8String );
@@@ -48,11 -48,11 +48,10 @@@ public
      UNKNOWN_ACTOR = -1,
      ACTOR       = 0,
      IMAGE_ACTOR  =1,
 -    TEXT_ACTOR   =2,
 -    MESH_ACTOR   =3,
 -    LAYER_ACTOR  =4,
 -    CAMERA_ACTOR =5,
 -    TEXT_VIEW    =6
 +    MESH_ACTOR   =2,
 +    LAYER_ACTOR  =3,
 +    CAMERA_ACTOR =4,
-     LIGHT_ACTOR  =5,
-     TEXT_LABEL   =6
++    TEXT_LABEL   =5
    };
  
    /**
    // The Actor ObjectTemplates.
    static v8::Persistent<v8::ObjectTemplate> mActorTemplate;
    static v8::Persistent<v8::ObjectTemplate> mImageActorTemplate;
 -  static v8::Persistent<v8::ObjectTemplate> mTextActorTemplate;
    static v8::Persistent<v8::ObjectTemplate> mMeshActorTemplate;
    static v8::Persistent<v8::ObjectTemplate> mCameraActorTemplate;
    static v8::Persistent<v8::ObjectTemplate> mLayerActorTemplate;
 -  static v8::Persistent<v8::ObjectTemplate> mTextViewTemplate;
 +  static v8::Persistent<v8::ObjectTemplate> mTextLabelTemplate;
  
    /**
     * @return the wrapped actor
@@@ -26,7 -26,9 +26,8 @@@
  #include <stage/stage-wrapper.h>
  #include <image/image-attributes-wrapper.h>
  #include <image/image-wrapper.h>
 -#include <text/font-wrapper.h>
  #include <animation/path-wrapper.h>
+ #include <animation/path-constraint-wrapper.h>
  #include <animation/animation-wrapper.h>
  #include <events/pan-gesture-detector-wrapper.h>
  #include <shader-effects/shader-effect-wrapper.h>
@@@ -58,7 -60,9 +59,8 @@@ const ApiFunction ConstructorFunctionTa
  {
      { "Rotation",           PropertyValueWrapper::NewRotation},
      { "Matrix",             PropertyValueWrapper::NewMatrix},
 -    { "Font",               FontWrapper::NewFont },
      { "Path",               PathWrapper::NewPath },
+     { "PathConstraint",     PathConstraintWrapper::NewPathConstraint },
      { "Actor",              ActorWrapper::NewActor },
      { "TextActor",          ActorWrapper::NewActor },
      { "ImageActor",         ActorWrapper::NewActor },
@@@ -218,6 -222,10 +220,6 @@@ void DaliWrapper::Initialize(
       v8::Local<v8::Object> stageObject = StageWrapper::WrapStage( mIsolate, Stage::GetCurrent() );
       daliObject->Set( v8::String::NewFromUtf8( mIsolate, "stage") , stageObject );
  
 -     // fontObject provides static font functionality like GetFontList...
 -     v8::Local<v8::Object> fontObject = FontWrapper::GetStaticFontObject( mIsolate );
 -     daliObject->Set( v8::String::NewFromUtf8( mIsolate, "font") , fontObject );
 -
       // keyboard focus manager is a singleton
       v8::Local<v8::Object> keyboardObject = KeyboardFocusManagerWrapper::WrapKeyboardFocusManager( mIsolate,Toolkit::KeyboardFocusManager::Get() );
       daliObject->Set( v8::String::NewFromUtf8( mIsolate, "keyboardFocusManager") , keyboardObject );
@@@ -19,6 -19,9 +19,9 @@@
  // CLASS HEADER
  #include "shader-effect-api.h"
  
+ // EXTERNAL INCLUDES
+ #include <dali/public-api/object/type-registry.h>
  // INTERNAL INCLUDES
  #include <v8-utils.h>
  #include <shader-effects/shader-effect-wrapper.h>
@@@ -44,6 -47,7 +47,6 @@@ struct GeometryTypePai
  const GeometryTypePair GeometryTypeTable[]=
  {
      {"image",         GEOMETRY_TYPE_IMAGE },
 -    {"text",          GEOMETRY_TYPE_TEXT  },
      {"mesh",          GEOMETRY_TYPE_UNTEXTURED_MESH  },
      {"textured-mesh", GEOMETRY_TYPE_TEXTURED_MESH },
  };
@@@ -186,14 -190,12 +189,12 @@@ ShaderEffect GetShaderEffect( v8::Isola
   */
  ShaderEffect ShaderEffectApi::New(  v8::Isolate* isolate, const v8::FunctionCallbackInfo< v8::Value >& args )
  {
    v8::HandleScope handleScope( isolate );
  
-   ShaderParameters shaderParams;
    if( args[0]->IsObject() )
    {
+     ShaderParameters shaderParams;
      v8::Local<v8::Object > obj = args[0]->ToObject();
  
      v8::Local<v8::Value> geometryTypeValue = obj->Get(v8::String::NewFromUtf8( isolate, "geometryType"));
        }
        shaderParams.ProcessHintsArray( hintsArray );
      }
+     return shaderParams.NewShader();
    }
-   return shaderParams.NewShader();
+   else
+   {
+     ShaderEffect effect;
  
+     bool found( false );
+     std::string typeName = V8Utils::GetStringParameter( PARAMETER_0, found, isolate, args );
+     if( !found )
+     {
+       DALI_SCRIPT_EXCEPTION( isolate, "string parameter missing" );
+     }
+     else
+     {
+       // create a new shader effect based on type, using the type registry.
+       Dali::TypeInfo typeInfo = Dali::TypeRegistry::Get().GetTypeInfo( typeName );
+       if( typeInfo ) // handle, check if it has a value
+       {
+         Dali::BaseHandle handle = typeInfo.CreateInstance();
+         if( handle )
+         {
+           effect = ShaderEffect::DownCast( handle );
+         }
+       }
+       else
+       {
+         DALI_SCRIPT_EXCEPTION(isolate,"Unknown shader effect type");
+       }
+     }
+     return effect;
+   }
  }
  
  ShaderEffect ShaderEffectApi::GetShaderEffectFromParams( int paramIndex,