+// Styling
+
+void TextInputPopup::SetCutPastePopUpColor( const Vector4& color )
+{
+ mCutPasteButtonsColor = color;
+}
+
+const Vector4& TextInputPopup::GetCutPastePopUpColor() const
+{
+ return mCutPasteButtonsColor;
+}
+
+void TextInputPopup::SetCutPastePopUpPressedColor( const Vector4& color )
+{
+ mCutPasteButtonsPressedColor = color;
+}
+
+const Vector4& TextInputPopup::GetCutPastePopUpPressedColor() const
+{
+ return mCutPasteButtonsPressedColor;
+}
+
+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()
+{
+ 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, false );
+ }
+ }
+
+ float visiblePopUpWidth = std::min( mContentSize.width - POP_UP_SCREEN_EDGE_MARGIN*2 , mBoundingRect.width - POP_UP_SCREEN_EDGE_MARGIN *2);
+ float visbilePopUpHeight = std::max( mContentSize.height, POPUP_MINIMUM_SIZE.height );
+ Vector2 visiblePopUpSize = Vector2( visiblePopUpWidth, visbilePopUpHeight );
+
+ visiblePopUpWidth = std::max( visiblePopUpWidth, POPUP_MINIMUM_SIZE.width );
+
+ mBackground.SetSize( mContentSize.width, mContentSize.height );
+ mRootActor.SetSize( visiblePopUpWidth, visbilePopUpHeight ); // Make Root Actor reflect the size of its content
+
+ CreateLayer( visiblePopUpSize );
+ CreateStencil( visiblePopUpSize );
+ CreateScrollView( Vector2( mContentSize.width, mContentSize.height ), visiblePopUpSize );
+
+ mLayer.Add( mStencil );
+ mLayer.Add( mScrollView );
+ mScrollView.Add( mBackground );
+ mRootActor.Add( mTail );
+
+ Self().Add(mLayer);
+}
+
+void TextInputPopup::SetPopupBoundary( const Rect<float>& boundingRectangle )
+{
+ mBoundingRect = boundingRectangle;
+}
+
+void TextInputPopup::SetTailPosition( const Vector3& position )
+{
+ mPopupTailXPosition = position.x;
+ ApplyTailConstraint();
+}
+