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

@@@ -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
  {
@@@ -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
@@@ -256,14 -263,58 +263,30 @@@ void Popup::SetButtonAreaImage( Actor i
  
  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 );
@@@ -763,9 -740,32 +712,9 @@@ 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 )
@@@ -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() )
@@@ -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 )
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__
Simple merge
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
@@@ -585,22 -365,12 +379,14 @@@ public
    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()
  {
@@@ -82,13 -82,8 +82,9 @@@ 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
      };
    };
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__
   * \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
Simple merge
Simple merge
@@@ -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
    };
  
    /**
@@@ -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 },