+ return mRoot;
+}
+
+// Styling
+
+void TextInputPopup::SetCutPastePopupColor( const Vector4& color )
+{
+ mBackgroundColor = color;
+}
+
+const Vector4& TextInputPopup::GetCutPastePopupColor() const
+{
+ return mBackgroundColor;
+}
+
+void TextInputPopup::SetCutPastePopupPressedColor( const Vector4& color )
+{
+ mBackgroundPressedColor = color;
+}
+
+const Vector4& TextInputPopup::GetCutPastePopupPressedColor() const
+{
+ return mBackgroundPressedColor;
+}
+
+void TextInputPopup::SetCutPastePopupBorderColor( const Vector4& color )
+{
+ mLineColor = color;
+}
+
+const Vector4& TextInputPopup::GetCutPastePopupBorderColor() const
+{
+ return mLineColor;
+}
+
+void TextInputPopup::SetCutPastePopupIconColor( const Vector4& color )
+{
+ mIconColor = color;
+}
+
+const Vector4& TextInputPopup::GetCutPastePopupIconColor() const
+{
+ return mIconColor;
+}
+
+void TextInputPopup::SetCutPastePopupIconPressedColor( const Vector4& color )
+{
+ mIconPressedColor = color;
+}
+
+const Vector4& TextInputPopup::GetCutPastePopupIconPressedColor()
+{
+ return mIconPressedColor;
+}
+
+void TextInputPopup::SetCutPastePopupTextColor( const Vector4& color )
+{
+ mTextColor = color;
+}
+
+const Vector4& TextInputPopup::GetCutPastePopupTextColor()
+{
+ return mTextColor;
+}
+
+void TextInputPopup::SetCutPastePopupTextPressedColor( const Vector4& color )
+{
+ mTextPressedColor = color;
+}
+
+const Vector4& TextInputPopup::GetCutPastePopupTextPressedColor()
+{
+ return mTextPressedColor;
+}
+
+void TextInputPopup::TogglePopupButtonOnOff( TextInputPopup::Buttons requiredButton, bool enable )
+{
+ bool match ( false );
+ for( std::vector<ButtonRequirement>::iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt && !match ); ++it )
+ {
+ ButtonRequirement& button( *it );
+ if ( requiredButton == button.buttonId )
+ {
+ button.enabled = enable;
+ match = true;
+ }
+ }
+}
+
+void TextInputPopup::SetButtonPriorityPosition( TextInputPopup::Buttons button, unsigned int priority )
+{
+ switch ( button )
+ {
+ case ButtonsCut:
+ {
+ mCutOptionPriority = priority;
+ break;
+ }
+ case ButtonsCopy:
+ {
+ mCopyOptionPriority = priority;
+ break;
+ }
+ case ButtonsPaste:
+ {
+ mPasteOptionPriority = priority;
+ break;
+ }
+ case ButtonsSelect:
+ {
+ mSelectOptionPriority = priority;
+ break;
+ }
+ case ButtonsSelectAll:
+ {
+ mSelectAllOptionPriority = priority;
+ break;
+ }
+ case ButtonsClipboard:
+ {
+ mClipboardOptionPriority = priority;
+ break;
+ }
+ case ButtonsEnumEnd:
+ {
+ DALI_ASSERT_DEBUG( "ButtonsEnumEnd used but an invalid choice");
+ break;
+ }
+ }
+ CreateOrderedListOfOptions(); // Update list of options as priority changed.
+}
+
+unsigned int TextInputPopup::GetButtonPriorityPosition( TextInputPopup::Buttons button ) const
+{
+ unsigned int priority = 0;
+
+ switch ( button )
+ {
+ case ButtonsCut:
+ {
+ priority = mCutOptionPriority;
+ break;
+ }
+ case ButtonsCopy:
+ {
+ priority = mCopyOptionPriority;
+ break;
+ }
+ case ButtonsPaste:
+ {
+ priority = mPasteOptionPriority;
+ break;
+ }
+ case ButtonsSelect:
+ {
+ priority = mSelectOptionPriority;
+ break;
+ }
+ case ButtonsSelectAll:
+ {
+ priority = mSelectAllOptionPriority;
+ break;
+ }
+ case ButtonsClipboard:
+ {
+ priority = mClipboardOptionPriority;
+ break;
+ }
+ case ButtonsEnumEnd:
+ {
+ DALI_ASSERT_DEBUG( "ButtonsEnumEnd used but an invalid choice");
+ break;
+ }
+ }
+
+ return priority;
+}
+
+void TextInputPopup::AddPopupOptions()
+{
+ mContentSize = Vector2( POPUP_MIN_SIZE.width, ( POPUP_BORDER.y + POPUP_BORDER.z ) );
+
+ // 1. Create the background.
+ CreateBackground();
+
+ // 2. Create the tail.
+ CreateTail();
+
+ // 3. Create the scroll view and Actor to hold buttons.
+ CreateScrollView();
+
+ // Clear previous buttons
+ if ( mButtons )
+ {
+ UnparentAndReset( mButtons );
+ }
+
+ mButtons = Actor::New();
+ mButtons.SetParentOrigin( ParentOrigin::CENTER );
+ mButtons.SetAnchorPoint( AnchorPoint::CENTER );
+
+ // 4. Create the options and add into the scroll view.
+ for( std::vector<ButtonRequirement>::const_iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt ); ++it )
+ {
+ const ButtonRequirement& button( *it );
+ if ( button.enabled )
+ {
+ AddOption( button.name, button.caption, button.iconImage, it != ( endIt - 1 ) ? false : true );
+ }
+ }
+
+ // 5. Calculate size of content and of popup including borders
+ const Vector2 popupSize = Vector2( std::min ( ( POPUP_BORDER.x + mContentSize.width + POPUP_BORDER.z ), POPUP_MAX_SIZE.width ) , POPUP_BORDER.y + mContentSize.height + POPUP_BORDER.w );
+
+ mVisiblePopUpSize = Vector3( popupSize.width - POPUP_BORDER.x - POPUP_BORDER.z , mContentSize.height, 1.0f);
+
+ mBackground.SetSize( popupSize.x + 28 - POPUP_BORDER.x - POPUP_BORDER.z, popupSize.y + 28 - POPUP_BORDER.y - POPUP_BORDER.w );
+ mButtons.SetSize( mVisiblePopUpSize.GetVectorXY() );
+
+ // 6. Set the scroll view ruler.
+ UpdateScrollViewRulerAndSize( mVisiblePopUpSize.GetVectorXY() );
+
+ // 7. Create stencil
+ const Vector2 stencilSize = Vector2( mVisiblePopUpSize.GetVectorXY() );
+
+ CreateLayer( stencilSize );
+ CreateStencil( stencilSize );
+
+ mScrollView.Add ( mButtons );
+ mLayer.Add( mScrollView);
+ mLayer.Add( mStencil);
+ mRoot.Add( mTail );
+ mRoot.Add( mBackground );
+ mRoot.Add( mLayer );
+
+ // 8. Set the root size.
+ mRoot.SetSize( popupSize ); // Make Root Actor reflect the size of its content
+}
+
+const Vector3& TextInputPopup::GetVisibileSize() const
+{
+ return mVisiblePopUpSize;
+}
+
+void TextInputPopup::SetTailPosition( const Vector3& position, bool yAxisFlip )
+{
+ mPopupTailXPosition = std::max( position.x, POPUP_TAIL_SIZE.width*0.5f - mVisiblePopUpSize.width*0.5f + POPUP_BORDER.x );
+
+ std::min( mPopupTailXPosition, mVisiblePopUpSize.width*0.5f - POPUP_BORDER.x - POPUP_TAIL_SIZE.width*0.5f );
+
+ mTail.SetX( mPopupTailXPosition );
+
+ if ( yAxisFlip )
+ {
+ Image tail = Image::New( POPUP_TAIL_TOP );
+ Image tailEffect = Image::New( POPUP_TAIL_TOP_EFFECT );
+ Image tailLine = Image::New( POPUP_TAIL_TOP_LINE );
+
+ mTail.SetImage( tail );
+ mTailEffect.SetImage( tailEffect );
+ mTailLine.SetImage( tailLine );
+
+ mTail.SetParentOrigin( ParentOrigin::TOP_CENTER );
+ mTail.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
+ mTail.SetY( POPUP_BORDER.y - POPUP_TAIL_Y_OFFSET );
+ }