From: daemyung jang Date: Thu, 19 Jun 2014 14:12:32 +0000 (+0900) Subject: Update the text input popup GUI. X-Git-Tag: dali_1.0.0~36 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=4314e7c509e44abac7585ff142fb28393b6c6593;hp=f6be8012c03a25aca4a8403e4a0da31854a2ef69 Update the text input popup GUI. [problem] The text input popup is expired. [cause] The new gui guide is published. [solution] Update the new gui. Change-Id: I9a3bf7348be0138803f1e8978303449c53bc696d Signed-off-by: Adeel Kazmi --- diff --git a/base/dali-toolkit/images/00_popup_bg.png b/base/dali-toolkit/images/00_popup_bg.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/images/00_popup_button_bg.png b/base/dali-toolkit/images/00_popup_button_bg.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/images/insertpoint-icon.png b/base/dali-toolkit/images/insertpoint-icon.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/images/popup_bg.png b/base/dali-toolkit/images/popup_bg.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/images/popup_bubble_bg.#.png b/base/dali-toolkit/images/popup_bubble_bg.#.png new file mode 100644 index 0000000..202ecec Binary files /dev/null and b/base/dali-toolkit/images/popup_bubble_bg.#.png differ diff --git a/base/dali-toolkit/images/popup_bubble_bg_ef.#.png b/base/dali-toolkit/images/popup_bubble_bg_ef.#.png new file mode 100644 index 0000000..462c9db Binary files /dev/null and b/base/dali-toolkit/images/popup_bubble_bg_ef.#.png differ diff --git a/base/dali-toolkit/images/popup_bubble_bg_line.#.png b/base/dali-toolkit/images/popup_bubble_bg_line.#.png new file mode 100644 index 0000000..92aee52 Binary files /dev/null and b/base/dali-toolkit/images/popup_bubble_bg_line.#.png differ diff --git a/base/dali-toolkit/images/popup_bubble_tail_bottom.png b/base/dali-toolkit/images/popup_bubble_tail_bottom.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/images/popup_bubble_tail_bottom_ef.png b/base/dali-toolkit/images/popup_bubble_tail_bottom_ef.png new file mode 100644 index 0000000..53b87fe Binary files /dev/null and b/base/dali-toolkit/images/popup_bubble_tail_bottom_ef.png differ diff --git a/base/dali-toolkit/images/popup_bubble_tail_bottom_line.png b/base/dali-toolkit/images/popup_bubble_tail_bottom_line.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/images/text-input-selection-handle-left-press.png b/base/dali-toolkit/images/text-input-selection-handle-left-press.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/images/text-input-selection-handle-left.png b/base/dali-toolkit/images/text-input-selection-handle-left.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/images/text-input-selection-handle-right-press.png b/base/dali-toolkit/images/text-input-selection-handle-right-press.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/images/text-input-selection-handle-right.png b/base/dali-toolkit/images/text-input-selection-handle-right.png old mode 100755 new mode 100644 diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp b/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp index 25f898b..952503a 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp @@ -312,7 +312,7 @@ TextInput::TextInput() mTouchStartTime( 0 ), mTextLayoutInfo(), mCurrentCopySelecton(), - mPopUpPanel(), + mPopupPanel(), mScrollTimer(), mScrollDisplacement(), mCurrentHandlePosition(), @@ -796,7 +796,7 @@ void TextInput::SetBoundingRectangle( const Rect& boundingRectangle ) mBoundingRectangleWorldCoordinates = boundary; // Set Boundary for Popup so it keeps the Pop-up within the area also. - mPopUpPanel.SetPopupBoundary( boundingRectangle ); + mPopupPanel.SetPopupBoundary( boundingRectangle ); } const Rect TextInput::GetBoundingRectangle() const @@ -1279,7 +1279,7 @@ void TextInput::OnHandlePan(Actor actor, PanGesture gesture) { mActualGrabHandlePosition = MoveGrabHandle( gesture.displacement ); SetCursorVisibility( true ); - SetUpPopUpSelection(); + SetUpPopupSelection(); ShowPopup(); } if (actor == mHandleOneGrabArea) @@ -1423,9 +1423,9 @@ void TextInput::OnTextTap(Dali::Actor actor, Dali::TapGesture tap) if( mGrabArea == actor ) { - if( mPopUpPanel.GetState() == TextInputPopup::StateHidden || mPopUpPanel.GetState() == TextInputPopup::StateHiding ) + if( mPopupPanel.GetState() == TextInputPopup::StateHidden || mPopupPanel.GetState() == TextInputPopup::StateHiding ) { - SetUpPopUpSelection(); + SetUpPopupSelection(); ShowPopup(); } @@ -1614,7 +1614,7 @@ void TextInput::OnClipboardTextSelected( ClipboardEventNotifier& notifier ) bool TextInput::OnPopupButtonPressed( Toolkit::Button button ) { - mPopUpPanel.PressedSignal().Disconnect( this, &TextInput::OnPopupButtonPressed ); + mPopupPanel.PressedSignal().Disconnect( this, &TextInput::OnPopupButtonPressed ); const std::string& name = button.GetName(); @@ -3704,29 +3704,29 @@ void TextInput::UpdateHighlight() void TextInput::ClearPopup() { - mPopUpPanel.Clear(); + mPopupPanel.Clear(); } void TextInput::AddPopupOptions() { - mPopUpPanel.AddPopupOptions(); + mPopupPanel.AddPopupOptions(); } void TextInput::SetPopupPosition( const Vector3& position ) { - mPopUpPanel.SetTailPosition( position ); - mPopUpPanel.Self().SetPosition( position ); + mPopupPanel.SetTailPosition( position ); + mPopupPanel.GetRootActor().SetPosition( position ); } void TextInput::HidePopup(bool animate, bool signalFinished ) { - if ( ( mPopUpPanel.GetState() == TextInputPopup::StateShowing ) || ( mPopUpPanel.GetState() == TextInputPopup::StateShown ) ) + if ( ( mPopupPanel.GetState() == TextInputPopup::StateShowing ) || ( mPopupPanel.GetState() == TextInputPopup::StateShown ) ) { - mPopUpPanel.Hide( animate ); + mPopupPanel.Hide( animate ); if( animate && signalFinished ) { - mPopUpPanel.HideFinishedSignal().Connect( this, &TextInput::OnPopupHideFinished ); + mPopupPanel.HideFinishedSignal().Connect( this, &TextInput::OnPopupHideFinished ); } } } @@ -3758,7 +3758,7 @@ void TextInput::ShowPopup(bool animate) position = Vector3(topHandle.x, topHandle.y, 0.0f); bottomHandle.y += GetSelectionHandleSize().y + mPopupOffsetFromText.w; - mPopUpPanel.SetAlternativeOffset(Vector2( mBoundingRectangleWorldCoordinates.x, bottomHandle.y - topHandle.y)); + mPopupPanel.SetAlternativeOffset(Vector2( mBoundingRectangleWorldCoordinates.x, bottomHandle.y - topHandle.y)); float xPosition = ( fabsf( topHandle.x - bottomHandle.x ) )*0.5f + std::min( topHandle.x , bottomHandle.x ); @@ -3771,13 +3771,13 @@ void TextInput::ShowPopup(bool animate) const Size rowSize = GetRowRectFromCharacterPosition( mCursorPosition ); position.y -= ( mPopupOffsetFromText.y + rowSize.height ); // if can't be positioned above, then position below row. - Vector2 alternativePopUpPosition( mBoundingRectangleWorldCoordinates.x, position.y ); // default if no grab handle + Vector2 alternativePopupPosition( mBoundingRectangleWorldCoordinates.x, position.y ); // default if no grab handle if ( mGrabHandle ) { // If grab handle enabled then position pop-up below the grab handle. - alternativePopUpPosition.y = rowSize.height + mGrabHandle.GetCurrentSize().height + mPopupOffsetFromText.w +50.0f; + alternativePopupPosition.y = rowSize.height + mGrabHandle.GetCurrentSize().height + mPopupOffsetFromText.w +50.0f; } - mPopUpPanel.SetAlternativeOffset( alternativePopUpPosition ); + mPopupPanel.SetAlternativeOffset( alternativePopupPosition ); } // reposition popup above the desired cursor posiiton. @@ -3789,63 +3789,62 @@ void TextInput::ShowPopup(bool animate) SetPopupPosition( worldPosition ); // Show popup - mPopUpPanel.Show(animate); + mPopupPanel.Show(animate); StartMonitoringStageForTouch(); - mPopUpPanel.PressedSignal().Connect( this, &TextInput::OnPopupButtonPressed ); + mPopupPanel.PressedSignal().Connect( this, &TextInput::OnPopupButtonPressed ); } void TextInput::ShowPopupCutCopyPaste() { ClearPopup(); - mPopUpPanel.CreateOrderedListOfOptions(); // todo Move this so only run when order has changed + mPopupPanel.CreateOrderedListOfOptions(); // todo Move this so only run when order has changed // Check the selected text is whole text or not. if( IsTextSelected() && ( mStyledText.size() != GetSelectedText().size() ) ) { - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsSelectAll, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelectAll, true ); } if ( !mStyledText.empty() ) { - - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsCopy, true ); - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsCut, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsCopy, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsCut, true ); } if( mClipboard && mClipboard.NumberOfItems() ) { - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsPaste, true ); - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsClipboard, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsPaste, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsClipboard, true ); } AddPopupOptions(); - mPopUpPanel.Hide(false); + mPopupPanel.Hide(false); ShowPopup(); } -void TextInput::SetUpPopUpSelection() +void TextInput::SetUpPopupSelection() { ClearPopup(); - mPopUpPanel.CreateOrderedListOfOptions(); // todo Move this so only run when order has changed + mPopupPanel.CreateOrderedListOfOptions(); // todo Move this so only run when order has changed // If no text exists then don't offer to select if ( !mStyledText.empty() ) { - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsSelectAll, true ); - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsSelect, true ); - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsCut, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelectAll, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelect, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsCut, true ); } // if clipboard has valid contents then offer paste option if( mClipboard && mClipboard.NumberOfItems() ) { - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsPaste, true ); - mPopUpPanel.TogglePopUpButtonOnOff( TextInputPopup::ButtonsClipboard, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsPaste, true ); + mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsClipboard, true ); } AddPopupOptions(); - mPopUpPanel.Hide(false); + mPopupPanel.Hide(false); } bool TextInput::ReturnClosestIndex(const Vector2& source, std::size_t& closestIndex ) @@ -4489,7 +4488,7 @@ Size TextInput::GetRowRectFromCharacterPosition(std::size_t characterPosition, V bool TextInput::WasTouchedCheck( const Actor& touchedActor ) const { - Actor popUpPanel = mPopUpPanel.GetRootActor(); + Actor popUpPanel = mPopupPanel.GetRootActor(); if ( ( touchedActor == Self() ) || ( touchedActor == popUpPanel ) ) { @@ -4530,7 +4529,7 @@ void TextInput::OnStageTouched(const TouchEvent& event) bool popUpShown( false ); - if ( ( mPopUpPanel.GetState() == TextInputPopup::StateShowing ) || ( mPopUpPanel.GetState() == TextInputPopup::StateShown ) ) + if ( ( mPopupPanel.GetState() == TextInputPopup::StateShowing ) || ( mPopupPanel.GetState() == TextInputPopup::StateShown ) ) { popUpShown = true; } @@ -4665,7 +4664,7 @@ void TextInput::KeyboardStatusChanged(bool keyboardShown) ShowGrabHandleAndSetVisibility( false ); // If the keyboard is not now being shown, then hide the popup panel - mPopUpPanel.Hide( true ); + mPopupPanel.Hide( true ); } } @@ -5179,67 +5178,67 @@ void TextInput::SetProperty( BaseObject* object, Property::Index propertyIndex, } case Toolkit::TextInput::CUT_AND_PASTE_COLOR_PROPERTY: { - textInputImpl.mPopUpPanel.SetCutPastePopUpColor( value.Get< Vector4 >() ); + textInputImpl.mPopupPanel.SetCutPastePopupColor( value.Get< Vector4 >() ); break; } case Toolkit::TextInput::CUT_AND_PASTE_PRESSED_COLOR_PROPERTY: { - textInputImpl.mPopUpPanel.SetCutPastePopUpPressedColor( value.Get< Vector4 >() ); + textInputImpl.mPopupPanel.SetCutPastePopupPressedColor( value.Get< Vector4 >() ); break; } case Toolkit::TextInput::CUT_AND_PASTE_BORDER_COLOR_PROPERTY: { - textInputImpl.mPopUpPanel.SetCutPastePopUpBorderColor( value.Get< Vector4 >() ); + textInputImpl.mPopupPanel.SetCutPastePopupBorderColor( value.Get< Vector4 >() ); break; } case Toolkit::TextInput::CUT_AND_PASTE_ICON_COLOR_PROPERTY: { - textInputImpl.mPopUpPanel.SetCutPastePopUpIconColor( value.Get< Vector4 >() ); + textInputImpl.mPopupPanel.SetCutPastePopupIconColor( value.Get< Vector4 >() ); break; } case Toolkit::TextInput::CUT_AND_PASTE_ICON_PRESSED_COLOR_PROPERTY: { - textInputImpl.mPopUpPanel.SetCutPastePopUpIconPressedColor( value.Get< Vector4 >() ); + textInputImpl.mPopupPanel.SetCutPastePopupIconPressedColor( value.Get< Vector4 >() ); break; } case Toolkit::TextInput::CUT_AND_PASTE_TEXT_COLOR_PROPERTY: { - textInputImpl.mPopUpPanel.SetCutPastePopUpTextColor( value.Get< Vector4 >() ); + textInputImpl.mPopupPanel.SetCutPastePopupTextColor( value.Get< Vector4 >() ); break; } case Toolkit::TextInput::CUT_AND_PASTE_TEXT_PRESSED_COLOR_PROPERTY: { - textInputImpl.mPopUpPanel.SetCutPastePopUpTextPressedColor( value.Get< Vector4 >() ); + textInputImpl.mPopupPanel.SetCutPastePopupTextPressedColor( value.Get< Vector4 >() ); break; } case Toolkit::TextInput::CUT_BUTTON_POSITION_PRIORITY_PROPERTY: { - textInputImpl.mPopUpPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsCut, value.Get() ); + textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsCut, value.Get() ); break; } case Toolkit::TextInput::COPY_BUTTON_POSITION_PRIORITY_PROPERTY: { - textInputImpl.mPopUpPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsCopy, value.Get() ); + textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsCopy, value.Get() ); break; } case Toolkit::TextInput::PASTE_BUTTON_POSITION_PRIORITY_PROPERTY: { - textInputImpl.mPopUpPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsPaste, value.Get() ); + textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsPaste, value.Get() ); break; } case Toolkit::TextInput::SELECT_BUTTON_POSITION_PRIORITY_PROPERTY: { - textInputImpl.mPopUpPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsSelect, value.Get() ); + textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsSelect, value.Get() ); break; } case Toolkit::TextInput::SELECT_ALL_BUTTON_POSITION_PRIORITY_PROPERTY: { - textInputImpl.mPopUpPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsSelectAll, value.Get() ); + textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsSelectAll, value.Get() ); break; } case Toolkit::TextInput::CLIPBOARD_BUTTON_POSITION_PRIORITY_PROPERTY: { - textInputImpl.mPopUpPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsClipboard, value.Get() ); + textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsClipboard, value.Get() ); break; } case Toolkit::TextInput::POP_UP_OFFSET_FROM_TEXT_PROPERTY: @@ -5270,67 +5269,67 @@ Property::Value TextInput::GetProperty( BaseObject* object, Property::Index prop } case Toolkit::TextInput::CUT_AND_PASTE_COLOR_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetCutPastePopUpColor(); + value = textInputImpl.mPopupPanel.GetCutPastePopupColor(); break; } case Toolkit::TextInput::CUT_AND_PASTE_PRESSED_COLOR_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetCutPastePopUpPressedColor(); + value = textInputImpl.mPopupPanel.GetCutPastePopupPressedColor(); break; } case Toolkit::TextInput::CUT_AND_PASTE_BORDER_COLOR_PROPERTY : { - value = textInputImpl.mPopUpPanel.GetCutPastePopUpBorderColor(); + value = textInputImpl.mPopupPanel.GetCutPastePopupBorderColor(); break; } case Toolkit::TextInput::CUT_AND_PASTE_ICON_COLOR_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetCutPastePopUpIconColor(); + value = textInputImpl.mPopupPanel.GetCutPastePopupIconColor(); break; } case Toolkit::TextInput::CUT_AND_PASTE_ICON_PRESSED_COLOR_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetCutPastePopUpIconPressedColor(); + value = textInputImpl.mPopupPanel.GetCutPastePopupIconPressedColor(); break; } case Toolkit::TextInput::CUT_AND_PASTE_TEXT_COLOR_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetCutPastePopUpTextColor(); + value = textInputImpl.mPopupPanel.GetCutPastePopupTextColor(); break; } case Toolkit::TextInput::CUT_AND_PASTE_TEXT_PRESSED_COLOR_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetCutPastePopUpTextPressedColor(); + value = textInputImpl.mPopupPanel.GetCutPastePopupTextPressedColor(); break; } case Toolkit::TextInput::CUT_BUTTON_POSITION_PRIORITY_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsCut ); + value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsCut ); break; } case Toolkit::TextInput::COPY_BUTTON_POSITION_PRIORITY_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsCopy ); + value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsCopy ); break; } case Toolkit::TextInput::PASTE_BUTTON_POSITION_PRIORITY_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsPaste ); + value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsPaste ); break; } case Toolkit::TextInput::SELECT_BUTTON_POSITION_PRIORITY_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsSelect ); + value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsSelect ); break; } case Toolkit::TextInput::SELECT_ALL_BUTTON_POSITION_PRIORITY_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsSelectAll ); + value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsSelectAll ); break; } case Toolkit::TextInput::CLIPBOARD_BUTTON_POSITION_PRIORITY_PROPERTY: { - value = textInputImpl.mPopUpPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsClipboard ); + value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsClipboard ); break; } case Toolkit::TextInput::POP_UP_OFFSET_FROM_TEXT_PROPERTY: diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-impl.h b/base/dali-toolkit/internal/controls/text-input/text-input-impl.h index e7a4f42..35d9313 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-impl.h +++ b/base/dali-toolkit/internal/controls/text-input/text-input-impl.h @@ -1086,7 +1086,7 @@ public: // Public to allow internal testing. /** * Setup the selection popup and clipboard if relevant so the correct options are shown when ShowPopup is called. */ - void SetUpPopUpSelection(); + void SetUpPopupSelection(); /** * Return the logical index containing the character position closest to the source. @@ -1453,7 +1453,7 @@ private: ///< the text size after layout and the scroll offset. MarkupProcessor::StyledTextArray mCurrentCopySelecton; ///< Array to store copied text. - TextInputPopup mPopUpPanel; ///< Panel to house cut and paste, select all buttons. + TextInputPopup mPopupPanel; ///< Panel to house cut and paste, select all buttons. Timer mScrollTimer; Vector2 mScrollDisplacement; diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp b/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp index c2d8640..3fbe619 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp +++ b/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp @@ -15,8 +15,9 @@ * */ -#include +#include +#include #include #include @@ -27,72 +28,66 @@ using namespace Dali; #define GET_LOCALE_TEXT(string) dgettext("sys_string", string) -namespace { - -// Default Colors - -const Vector4 DEFAULT_POPUP_BACKGROUND( Vector4( .20f, 0.29f, 0.44f, 1.0f ) ); -const Vector4 DEFAULT_POPUP_BUTTON_PRESSED( Vector4( 0.07f, 0.10f, 0.17f, 1.0f ) ); -const Vector4 DEFAULT_BORDER_COLOR( Vector4( 0.36f, 0.45f, 0.59f, 1.0f ) ); -const Vector4 DEFAULT_POPUP_ICON( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); -const Vector4 DEFAULT_POPUP_ICON_PRESSED( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); -const Vector4 DEFAULT_POPUP_TEXT( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); -const Vector4 DEFAULT_POPUP_TEXT_PRESSED( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); -const Vector3 POPUP_BORDER( Vector3( 1.0f, 1.0f, 0.0f ) ); - -/* Functionality in place to have the end buttons using different images to inner button. - * Supply a centre image and then a left and right image, the centre image can have straight ends while - * the left image can be rounded on the left and straight on the right, the right image can be straight on the left and rounded on the right. - */ - -// Popup: Tails -const char* DEFAULT_POPUP_TAIL_BOTTOM( DALI_IMAGE_DIR "popup_bubble_tail_bottom.png" ); -const char* DEFAULT_POPUP_TAIL_BOTTOM_OUTLINE( DALI_IMAGE_DIR "popup_bubble_tail_bottom_line.png" ); -const float TAIL_Y_POSITION( -1.5f ); - -// Popup: Vertical Constraint -// TODO: Remove - this should come from application - it is not possible to get the -// height of the indicator actor from Dali-Toolkit. - -const float POP_UP_SCREEN_EDGE_MARGIN( 4.0f ); -const Vector2 DEFAULT_POPUP_INDICATOR_OFFSET(POP_UP_SCREEN_EDGE_MARGIN, 60.0f); - -const Vector3 POPUP_TEXT_OFFSET( 0.0f, 0.0f, 0.0f ); -const Vector3 POPUP_TEXT_ENLARGE( 12.0f, 28.0f, 0.0f ); -const Vector3 POPUP_MINIMUM_SIZE( 128.0f, 124.0f, 0.0f ); - -const Vector3 BUTTON_TEXT_ENLARGE( 32.0f, 0.0f, 0.0f ); -const Vector3 BUTTON_TEXT_MINIMUM_SIZE( 128.0f, 126.0f, 0.0f ); -const Vector3 BUTTON_TEXT_MAXIMUM_SIZE( 190.0f, 126.0f, 0.0f ); -const Vector3 TEXT_LABEL_MAX_SIZE( 160.0f, 30.0f, 0.0f ); - -const float DIVIDER_WIDTH(2.0f); ///< Width of each button divider -const float DIVIDER_MARGIN(0.0f); ///< Top/Bottom Margin between divider and edge of popup. - -const float DEFAULT_UI_FONT_SIZE(7.0f); ///< Standard font size for Text-Input's UI - -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 Vector2 DEFAULT_ICON_SIZE( 45.0f, 45.0f ); ///< Default icon size for image in options -const float TEXT_POSITION_OFFSET( -19.0f ); ///< Default offset for text label -const float ICON_POSITION_OFFSET( 19.0f ); ///< Default offset for icon +namespace +{ +const Vector2 DEFAULT_POPUP_INDICATOR_OFFSET(0.0f, 60.0f); -const char* DEFAULT_ICON_CLIPBOARD( DALI_IMAGE_DIR "copy_paste_icon_clipboard.png" ); -const char* DEFAULT_ICON_COPY( DALI_IMAGE_DIR "copy_paste_icon_copy.png" ); -const char* DEFAULT_ICON_CUT( DALI_IMAGE_DIR "copy_paste_icon_cut.png" ); -const char* DEFAULT_ICON_PASTE( DALI_IMAGE_DIR "copy_paste_icon_paste.png" ); -const char* DEFAULT_ICON_SELECT( DALI_IMAGE_DIR "copy_paste_icon_select.png" ); -const char* DEFAULT_ICON_SELECT_ALL( DALI_IMAGE_DIR "copy_paste_icon_select_all.png" ); // TODO: This should be based on the content for example: // 1. For selection: should be above top of highlighted selection, or below bottom of highlighted selection + end handle. // 2. For cursor: should be above top of cursor, or below bottom of cursor + grab handle. const std::string POPUP_ALTERNATIVE_OFFSET("popup-alternative-offset"); ///< Alternative offset property for confinenment constraint. - const std::string POPUP_REQUESTED_POSITION("popup-requested-position"); ///< Position the Popup was requested to be, for confinenment constraint. /** + * Image resource paths + */ +const std::string POPUP_BACKGROUND( DALI_IMAGE_DIR "popup_bubble_bg.#.png" ); +const std::string POPUP_BACKGROUND_EFFECT( DALI_IMAGE_DIR "popup_bubble_bg_ef.#.png" ); +const std::string POPUP_BACKGROUND_LINE( DALI_IMAGE_DIR "popup_bubble_bg_line.#.png" ); +const std::string POPUP_TAIL_BOTTOM( DALI_IMAGE_DIR "popup_bubble_tail_bottom.png" ); +const std::string POPUP_TAIL_BOTTOM_EFFECT( DALI_IMAGE_DIR "popup_bubble_tail_bottom_ef.png" ); +const std::string POPUP_TAIL_BOTTOM_LINE( DALI_IMAGE_DIR "popup_bubble_tail_bottom_line.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" ); + +/** + * Constant values for building the GUI + */ +const Vector4 POPUP_BORDER( 14.0f, 14.0f, 14.0f, 14.0f ); ///< The margin of the popup. +const Vector2 POPUP_MIN_SIZE( 0.0f, 126.0f ); ///< The minimum size of the popup. +const Vector2 POPUP_MAX_SIZE( 720.0f, 126.0f ); ///< The maximum size of the popup. +const float POPUP_TAIL_Y_OFFSET( -2.25f ); ///< The y offset of the tail. +const Vector2 POPUP_TAIL_SIZE( 36.0f, 36.0f ); ///< The size of the tail. +const Vector2 POPUP_DIVIDER_SIZE( 1.0f, 126.0f ); ///< The size of the divider. + +const Vector4 OPTION_MARGIN( 0.0f, 0.0f, 24.0f, 19.0f ); ///< The margin of the icon. the order is left, right, top and bottom +const Vector2 OPTION_MAX_SIZE( 360.0f, 126.0f ); ///< The maximum size of the option. +const Vector2 OPTION_MIN_SIZE( 128.0f, 126.0f ); ///< The minimum size of the option. +const Vector2 OPTION_ICON_SIZE( 45.0f, 45.0f ); ///< The size of the icon. +const Vector2 OPTION_TEXT_MIN_SIZE( 128.0f, 30.0f ); ///< The minimum size of the text. +const float OPTION_GAP_ICON_TEXT( 8.0f ); ///< The gap between the icon and the text + +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. + +/** + * Default Colors + */ +const Vector4 DEFAULT_POPUP_BACKGROUND( Vector4( .20f, 0.29f, 0.44f, 1.0f ) ); +const Vector4 DEFAULT_POPUP_BACKGROUND_PRESSED( Vector4( 0.07f, 0.10f, 0.17f, 1.0f ) ); +const Vector4 DEFAULT_POPUP_LINE_COLOR( Vector4( 0.36f, 0.45f, 0.59f, 1.0f ) ); +const Vector4 DEFAULT_OPTION_ICON( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); +const Vector4 DEFAULT_OPTION_ICON_PRESSED( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); +const Vector4 DEFAULT_OPTION_TEXT( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); +const Vector4 DEFAULT_OPTION_TEXT_PRESSED( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); + + +/** * Confine Actor to boundaries of reference actor (e.g. Parent) * Actor bounds (top-left position + size) are confined to reference Actor's * bounds. @@ -143,16 +138,16 @@ struct ConfinementConstraint if ( mFlipHorizontal ) { - if( corner.x < mBoundingRect.x + POP_UP_SCREEN_EDGE_MARGIN ) + if( corner.x < mBoundingRect.x ) { - // Snap PopUp to left hand boundary so stays visible - corner.x = mBoundingRect.x + POP_UP_SCREEN_EDGE_MARGIN - ( origin.x * referenceSize.x ) + ( size.x * anchor.x ); + // Snap Popup to left hand boundary so stays visible + corner.x = mBoundingRect.x - ( origin.x * referenceSize.x ) + ( size.x * anchor.x ); newPosition.x = corner.x; } - else if ( ( corner.x + size.x ) > ( ( mBoundingRect.x + mBoundingRect.width ) - POP_UP_SCREEN_EDGE_MARGIN )) + else if ( ( corner.x + size.x ) > ( mBoundingRect.x + mBoundingRect.width )) { - // Calculate offset from left boundary PopUp must be placed at so it does not exceed right side boundary. - float requiredOffSetFromLeftBoundaryToFit = mBoundingRect.width - POP_UP_SCREEN_EDGE_MARGIN - size.x; + // Calculate offset from left boundary Popup must be placed at so it does not exceed right side boundary. + float requiredOffSetFromLeftBoundaryToFit = mBoundingRect.width - size.x; corner.x = mBoundingRect.x + requiredOffSetFromLeftBoundaryToFit - ( origin.x * referenceSize.x ) + ( size.x * anchor.x ); newPosition.x = corner.x; } @@ -239,16 +234,16 @@ const char* const TextInputPopup::OPTION_CLIPBOARD("option-clipboard"); TextInputPopup::TextInputPopup() : mState(StateHidden), - mRootActor(Layer::New()), + mRoot(Layer::New()), mPopupTailXPosition( 0.0f ), - mContentSize( Vector3::ZERO ), - mCutPasteButtonsColor( DEFAULT_POPUP_BACKGROUND ), - mCutPasteButtonsPressedColor( DEFAULT_POPUP_BUTTON_PRESSED ), - mBorderColor( DEFAULT_BORDER_COLOR ), - mCutPasteIconsColor( DEFAULT_POPUP_ICON ), - mCutPasteIconsPressedColor( DEFAULT_POPUP_ICON_PRESSED ), - mCutPasteTextsColor( DEFAULT_POPUP_TEXT ), - mCutPasteTextsPressedColor( DEFAULT_POPUP_TEXT_PRESSED ), + mContentSize( POPUP_MIN_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), @@ -259,30 +254,25 @@ TextInputPopup::TextInputPopup() mHideFinishedSignal(), mShowFinishedSignal() { - mAlternativeOffsetProperty = mRootActor.RegisterProperty( POPUP_ALTERNATIVE_OFFSET, Vector2::ZERO ); - mRequestionPositionProperty = mRootActor.RegisterProperty( POPUP_REQUESTED_POSITION, Vector3::ZERO ); - mRootActor.SetParentOrigin( ParentOrigin::CENTER ); - mRootActor.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + mAlternativeOffsetProperty = mRoot.RegisterProperty( POPUP_ALTERNATIVE_OFFSET, Vector2::ZERO ); + mRequestionPositionProperty = mRoot.RegisterProperty( POPUP_REQUESTED_POSITION, Vector3::ZERO ); + mRoot.SetParentOrigin( ParentOrigin::CENTER ); + mRoot.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); // constrain popup to size of parent. } -Actor TextInputPopup::Self() -{ - return mRootActor; -} - void TextInputPopup::AddToStage() { // TODO: Confinement constraint borders should be defined by the application. // It should also not use the stage directly, instead it should add to parent container. - Stage::GetCurrent().Add(mRootActor); + Stage::GetCurrent().Add(mRoot); ApplyConfinementConstraint(); } void TextInputPopup::ApplyConfinementConstraint() { - mRootActor.RemoveConstraints(); + mRoot.RemoveConstraints(); Constraint constraint = Constraint::New( Actor::POSITION, LocalSource( Actor::SIZE ), LocalSource( Actor::PARENT_ORIGIN ), @@ -294,7 +284,7 @@ void TextInputPopup::ApplyConfinementConstraint() Vector2::ZERO, true, true, mBoundingRect ) ); - mRootActor.ApplyConstraint(constraint); + mRoot.ApplyConstraint(constraint); } void TextInputPopup::ApplyTailConstraint() @@ -308,24 +298,15 @@ void TextInputPopup::ApplyTailConstraint() mTail.ApplyConstraint( constraint ); } -void TextInputPopup::CreateLayer( const Vector2& size ) -{ - mLayer = Layer::New(); - mLayer.SetParentOrigin(ParentOrigin::CENTER); - mLayer.SetAnchorPoint(AnchorPoint::CENTER); - mLayer.SetSize( size ); // matches stencil size - mLayer.SetName("popup-mLayer"); -} - -void TextInputPopup::CreateStencil( const Vector2& size ) +void TextInputPopup::CreateStencil( const Vector2& size) { mStencil = CreateSolidColorActor( Color::BLUE ); - mStencil.SetParentOrigin( Vector3( ParentOrigin::CENTER ) ); + mStencil.SetParentOrigin( ParentOrigin::CENTER ); mStencil.SetAnchorPoint( AnchorPoint::CENTER ); mStencil.SetDrawMode( DrawMode::STENCIL ); - mStencil.SetSize( size ); // slightly smaller than layer and stencil so over shoot always inside. mStencil.SetVisible( true ); - mStencil.SetName("popup-stencil"); + mStencil.SetName( "popup-stencil" ); + mStencil.SetSize( size ); } void TextInputPopup::OnScrollStarted( const Vector3& position ) @@ -338,30 +319,34 @@ void TextInputPopup::OnScrollCompleted( const Vector3& position ) mBackground.SetSensitive( true ); } -void TextInputPopup::CreateScrollView( const Vector2& domainSize, const Vector2& visibleSize ) +void TextInputPopup::CreateScrollView() { mScrollView = Toolkit::ScrollView::New(); mScrollView.SetName("popup-scroll-view"); mScrollView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mScrollView.SetParentOrigin( ParentOrigin::TOP_LEFT ); - mScrollView.SetSize( visibleSize.x, visibleSize.y ); + mScrollView.SetPosition( POPUP_BORDER.x, POPUP_BORDER.y ); mScrollView.SetScrollingDirection( PanGestureDetector::DIRECTION_HORIZONTAL, Degree( 40.0f ) ); mScrollView.SetAxisAutoLock( true ); mScrollView.ScrollStartedSignal().Connect( this, &TextInputPopup::OnScrollStarted ); mScrollView.ScrollCompletedSignal().Connect( this, &TextInputPopup::OnScrollCompleted ); +} + +void TextInputPopup::UpdateScrollViewProperty( const Vector2& visibleSize ) +{ + mScrollView.SetSize( visibleSize.x, visibleSize.y ); RulerPtr rulerX = new DefaultRuler(); // IntrusivePtr which is unreferenced when ScrollView is destroyed. RulerPtr rulerY = new DefaultRuler(); // IntrusivePtr which is unreferenced when ScrollView is destroyed. rulerY->Disable(); - rulerX->SetDomain( RulerDomain( 0, domainSize.width, true ) ); + rulerX->SetDomain( RulerDomain( 0, mContentSize.width, true ) ); mScrollView.SetRulerX(rulerX); mScrollView.SetRulerY(rulerY); } void TextInputPopup::RemoveFromStage() { - Actor rootActor = Self(); - Stage::GetCurrent().Remove( rootActor ); + Stage::GetCurrent().Remove( mRoot ); } void TextInputPopup::Clear() @@ -372,113 +357,151 @@ void TextInputPopup::Clear() UnparentAndReset( mStencil ); UnparentAndReset( mBackground ); UnparentAndReset( mScrollView ); - UnparentAndReset( mLayer ); mButtonContainer.clear(); mDividerContainer.clear(); RemoveFromStage(); - mRootActor.RemoveConstraints(); + mRoot.RemoveConstraints(); mState = StateHidden; } } -Toolkit::TextView TextInputPopup::CreateOptionText( const MarkupProcessor::StyledTextArray& styledCaption ) -{ - Toolkit::TextView label = Toolkit::TextView::New( styledCaption ); - label.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed ); - label.SetWidthExceedPolicy( Toolkit::TextView::Fade ); - label.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); - label.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - label.SetPosition( 0.0f, TEXT_POSITION_OFFSET ); - - return label; -} - ImageActor TextInputPopup::CreateOptionIcon( Image iconImage, const Vector4& color ) { ImageActor icon = ImageActor::New( iconImage ); - - icon.SetSize( DEFAULT_ICON_SIZE ); + icon.SetSize( OPTION_ICON_SIZE ); icon.SetParentOrigin( ParentOrigin::TOP_CENTER ); icon.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - icon.SetPosition( 0.0f, ICON_POSITION_OFFSET ); icon.SetColor( color ); - + icon.SetY( OPTION_MARGIN.z ); return icon; } -void TextInputPopup::CreatePopUpBackground() +Toolkit::TextView TextInputPopup::CreateOptionCaption( const std::string& caption, const Vector4& color ) +{ + TextStyle style; + style.SetTextColor( color ); + + PointSize pointSize( Font::PixelsToPoints( OPTION_TEXT_MIN_SIZE.y ) ); + style.SetFontPointSize( pointSize ); + + MarkupProcessor::StyledTextArray styledCaption; + styledCaption.push_back( MarkupProcessor::StyledText( Text( caption ), style ) ); + + Toolkit::TextView textView = Toolkit::TextView::New( styledCaption ); + textView.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed ); + textView.SetWidthExceedPolicy( Toolkit::TextView::ShrinkToFit ); + textView.SetHeightExceedPolicy( Toolkit::TextView::ShrinkToFit ); + textView.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + textView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + textView.SetY( -OPTION_MARGIN.w ); + + const float textWidth = textView.GetWidthForHeight( OPTION_TEXT_MIN_SIZE.y ); + textView.SetSize( textWidth, OPTION_TEXT_MIN_SIZE.y ); + + return textView; +} + +void TextInputPopup::CreateBackground() { // Create background-panel if not already created (required if we have at least one option) if ( !mBackground ) { - mBackground = Toolkit::CreateSolidColorActor( GetCutPastePopUpColor(), true, mBorderColor ); - mBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mBackground.SetParentOrigin( ParentOrigin::TOP_LEFT ); - mBackground.SetName("pop-up-background"); - mContentSize = POPUP_TEXT_OFFSET; + Image bgImg = Image::New( POPUP_BACKGROUND ); + mBackground = ImageActor::New( bgImg ); + mBackground.SetAnchorPoint( AnchorPoint::CENTER ); + mBackground.SetParentOrigin( ParentOrigin::CENTER ); + mBackground.SetName( "text-input-popup-background" ); + mBackground.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mBackground.SetColor( mBackgroundColor ); + + Image bgEffectImg = Image::New( POPUP_BACKGROUND_EFFECT ); + mBackgroundEffect = ImageActor::New( bgEffectImg ); + mBackgroundEffect.SetAnchorPoint( AnchorPoint::CENTER ); + mBackgroundEffect.SetParentOrigin( ParentOrigin::CENTER ); + mBackgroundEffect.SetName( "text-input-popup-background-effect" ); + mBackgroundEffect.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mBackgroundEffect.SetZ( 1.0f ); + mBackground.Add( mBackgroundEffect ); + + Image bgLine = Image::New( POPUP_BACKGROUND_LINE ); + mBackgroundLine = ImageActor::New( bgLine ); + mBackgroundLine.SetAnchorPoint( AnchorPoint::CENTER); + mBackgroundLine.SetParentOrigin( ParentOrigin::CENTER ); + mBackgroundLine.SetName( "text-input-popup-background-effect" ); + mBackgroundLine.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mBackgroundLine.SetColor( mLineColor ); + mBackgroundLine.SetZ( 0.1f ); + mBackgroundEffect.Add( mBackgroundLine ); + Hide(false); AddToStage(); + } +} - // Add Tail too. - Image tailImage = Image::New( DEFAULT_POPUP_TAIL_BOTTOM ); - Image tailImageOutline = Image::New( DEFAULT_POPUP_TAIL_BOTTOM_OUTLINE ); - - mTailOutline = ImageActor::New ( tailImageOutline ); - mTailOutline.SetParentOrigin( ParentOrigin::CENTER ); - mTailOutline.SetAnchorPoint( AnchorPoint::CENTER ); - mTailOutline.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); - - mTail = ImageActor::New( tailImage ); +void TextInputPopup::CreateTail() +{ + if ( !mTail ) + { + Image tail = Image::New( POPUP_TAIL_BOTTOM ); + mTail = ImageActor::New( tail ); mTail.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); mTail.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - mTail.SetPosition( 0.0f, TAIL_Y_POSITION ); - // TODO: Make tail visible, and positioned in relation to original intended position of popup (i.e. before constrained effects) - mTail.SetVisible(true); - mTail.SetColor( mCutPasteButtonsColor ); - mTailOutline.SetColor( mBorderColor ); - mTail.Add( mTailOutline); + mTail.SetName( "text-input-popup-tail" ); + mTail.SetPosition( 0.0f, POPUP_TAIL_Y_OFFSET - POPUP_BORDER.w, 1.2f ); + mTail.SetColor( mBackgroundColor ); + + Image tailEffect = Image::New( POPUP_TAIL_BOTTOM_EFFECT ); + mTailEffect = ImageActor::New( tailEffect ); + mTailEffect.SetParentOrigin( ParentOrigin::CENTER ); + mTailEffect.SetAnchorPoint( AnchorPoint::CENTER ); + mTailEffect.SetName( "text-input-popup-tail-effect" ); + mTailEffect.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mTailEffect.SetZ( 0.1f ); + mTail.Add( mTailEffect ); + + Image tailLine = Image::New( POPUP_TAIL_BOTTOM_LINE ); + mTailLine = ImageActor::New( tailLine ); + mTailLine.SetParentOrigin( ParentOrigin::CENTER ); + mTailLine.SetAnchorPoint( AnchorPoint::CENTER ); + mTailLine.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mTailLine.SetName( "text-input-popup-tail-line" ); + mTailLine.SetColor( mLineColor ); + mTailLine.SetZ( 0.1f ); + mTailEffect.Add( mTailLine ); } } -void TextInputPopup::CreateDivider() +ImageActor TextInputPopup::CreateDivider() { - if(mButtonContainer.size() > 0) - { - ImageActor divider = Toolkit::CreateSolidColorActor( mBorderColor ); + ImageActor divider = Toolkit::CreateSolidColorActor( mLineColor ); divider.SetParentOrigin( ParentOrigin::TOP_LEFT ); divider.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - divider.SetPosition( Vector3( mContentSize.width, POPUP_TEXT_OFFSET.y, 0.0f ) ); - divider.SetColor( mBorderColor ); + divider.SetSize( POPUP_DIVIDER_SIZE ); + divider.SetPosition( mContentSize.width - POPUP_DIVIDER_SIZE.width, 0.0f ); + // Keep track of all the dividers. As their height's need to be updated to the max. of all // buttons currently added. - mDividerContainer.push_back(divider); - mBackground.Add( divider ); - mContentSize.width += DIVIDER_WIDTH; - } + mDividerContainer.push_back( divider ); + + return divider; } -ImageActor TextInputPopup::CreatePressedBackground( const Vector3 requiredSize ) +ImageActor TextInputPopup::CreatePressedBackground( const Vector2& requiredSize ) { - std::string pressedImageFilename; - Vector4 pressedImageBorder; - Vector2 pressedImageSize; - - ImageActor pressedButtonBg = Toolkit::CreateSolidColorActor( GetCutPastePopUpPressedColor() ); - - pressedButtonBg.SetSize ( requiredSize ); - pressedButtonBg.SetParentOrigin( ParentOrigin::CENTER ); - pressedButtonBg.SetAnchorPoint( AnchorPoint::CENTER ); - - return pressedButtonBg; + ImageActor pressedBg = Toolkit::CreateSolidColorActor( mBackgroundPressedColor ); + pressedBg.SetDrawMode( DrawMode::OVERLAY ); + pressedBg.SetParentOrigin( ParentOrigin::CENTER ); + pressedBg.SetAnchorPoint( AnchorPoint::CENTER ); + pressedBg.SetSize( requiredSize ); + return pressedBg; } TextInputPopup::ButtonRequirement TextInputPopup::CreateRequiredButton( TextInputPopup::Buttons buttonId, std::size_t orderOfPriority, const std::string& name, const std::string& caption, Image iconImage, bool enabled ) { TextInputPopup::ButtonRequirement currentButton; - currentButton.buttonId = buttonId; currentButton.orderOfPriority = orderOfPriority; currentButton.name = name; @@ -502,37 +525,37 @@ void TextInputPopup::CreateOrderedListOfOptions() { case ButtonsCut: { - Image cutIcon = Image::New( DEFAULT_ICON_CUT ); + Image cutIcon = Image::New( OPTION_ICON_CUT ); currentButton = CreateRequiredButton( ButtonsCut, mCutOptionPriority, OPTION_CUT, GET_LOCALE_TEXT("IDS_COM_BODY_CUT"), cutIcon, false ); break; } case ButtonsCopy: { - Image copyIcon = Image::New( DEFAULT_ICON_COPY ); + Image copyIcon = Image::New( OPTION_ICON_COPY ); currentButton = CreateRequiredButton( ButtonsCopy, mCopyOptionPriority, OPTION_COPY, GET_LOCALE_TEXT("IDS_COM_BODY_COPY"), copyIcon, false ); break; } case ButtonsPaste: { - Image pasteIcon = Image::New( DEFAULT_ICON_PASTE ); + Image pasteIcon = Image::New( OPTION_ICON_PASTE ); currentButton = CreateRequiredButton( ButtonsPaste, mPasteOptionPriority, OPTION_PASTE, GET_LOCALE_TEXT("IDS_COM_BODY_PASTE"), pasteIcon, false ); break; } case ButtonsSelect: { - Image selectIcon = Image::New( DEFAULT_ICON_SELECT ); + Image selectIcon = Image::New( OPTION_ICON_SELECT ); currentButton = CreateRequiredButton( ButtonsSelect, mSelectOptionPriority, OPTION_SELECT_WORD, GET_LOCALE_TEXT("IDS_COM_SK_SELECT"), selectIcon, false ); break; } case ButtonsSelectAll: { - Image selectAllIcon = Image::New( DEFAULT_ICON_SELECT_ALL ); + Image selectAllIcon = Image::New( OPTION_ICON_SELECT_ALL ); currentButton = CreateRequiredButton( ButtonsSelectAll, mSelectAllOptionPriority, OPTION_SELECT_ALL, GET_LOCALE_TEXT("IDS_COM_BODY_SELECT_ALL"), selectAllIcon, false ); break; } case ButtonsClipboard: { - Image clipboardIcon = Image::New( DEFAULT_ICON_CLIPBOARD ); + Image clipboardIcon = Image::New( OPTION_ICON_CLIPBOARD ); currentButton = CreateRequiredButton( ButtonsClipboard, mClipboardOptionPriority, OPTION_CLIPBOARD, GET_LOCALE_TEXT("IDS_COM_BODY_CLIPBOARD"), clipboardIcon, false ); break; } @@ -567,94 +590,74 @@ void TextInputPopup::CreateOrderedListOfOptions() } } -void TextInputPopup::AddOption(const std::string& name, const std::string& caption, const Image iconImage, bool finalOption) +void TextInputPopup::AddOption(const std::string& name, const std::string& caption, const Image iconImage, bool finalOption) { - CreatePopUpBackground(); - - CreateDivider(); + // 1. Create container for text and icon when not pressed. + Actor optionContainer = Actor::New(); + optionContainer.SetParentOrigin( ParentOrigin::TOP_LEFT ); + optionContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - // Create a Button with Text, Icon and highlight when pressed + // 2. Add text. + Toolkit::TextView captionTextView = CreateOptionCaption( caption, mTextColor ); + optionContainer.Add( captionTextView ); - Toolkit::PushButton button = Toolkit::PushButton::New(); - button.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed ); - button.SetName( name ); + // 3. Add icon. + ImageActor icon = CreateOptionIcon( iconImage, mIconColor ); + optionContainer.Add( icon ); - // Create container for text and icon when not pressed - Actor iconTextContainer = Actor::New(); - iconTextContainer.SetParentOrigin( ParentOrigin::TOP_LEFT ); - iconTextContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + // 4. Calculate the size of option. + const Vector2 textSize = Vector2( captionTextView.GetNaturalSize() ); + const Vector2 optionSize( std::max( textSize.x, OPTION_ICON_SIZE.x ), + OPTION_MARGIN.z + OPTION_ICON_SIZE.y + OPTION_GAP_ICON_TEXT + textSize.y + OPTION_MARGIN.w ); + const Vector2 constrainedOptionSize = Min( Max( optionSize, OPTION_MIN_SIZE ), OPTION_MAX_SIZE ); - // 1. Add text. - TextStyle style; - style.SetFontPointSize( PointSize( DEFAULT_UI_FONT_SIZE ) ); - style.SetTextColor( mCutPasteTextsColor ); - MarkupProcessor::StyledTextArray styledCaption; - styledCaption.push_back( MarkupProcessor::StyledText( Text( caption ), style ) ); - Toolkit::TextView label = CreateOptionText( styledCaption ); - label.SetName( name ); + // 5. Create a option. + Toolkit::PushButton option = Toolkit::PushButton::New(); + option.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed ); + option.SetParentOrigin( ParentOrigin::TOP_LEFT ); + option.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + option.SetSize( constrainedOptionSize ); + option.SetX( mContentSize.x ); + option.SetName( name ); + option.ClickedSignal().Connect( this, &TextInputPopup::OnButtonPressed ); + mScrollView.Add( option ); - iconTextContainer.Add( label ); + // 6. Set the normal option image. + option.SetButtonImage( optionContainer ); - // Get natural size of text and then constrain it to bounds. - const Vector3 textSize = label.GetNaturalSize(); - const Vector3 constrainedTextSize = Min( textSize, TEXT_LABEL_MAX_SIZE ); - Vector3 buttonSize( Max(constrainedTextSize + BUTTON_TEXT_ENLARGE, BUTTON_TEXT_MINIMUM_SIZE) ); - buttonSize = ( Min(buttonSize, BUTTON_TEXT_MAXIMUM_SIZE) ); - label.SetSize( Min( buttonSize, constrainedTextSize ) ); + // 7. Update the content size. + mContentSize.x += constrainedOptionSize.x; - button.SetParentOrigin( ParentOrigin::TOP_LEFT ); - button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - button.SetSize( buttonSize ); - button.SetPosition( Vector3( mContentSize.width, POPUP_BORDER.y, 0.0f ) ); + // 8. Create the pressed container. + Actor optionPressedContainer = Actor::New(); - // 2. Add icon - ImageActor icon = CreateOptionIcon( iconImage, mCutPasteIconsColor ); + // 9. Add option pressed background. + Vector2 optionPressedBackgroundSize( constrainedOptionSize.x - 1.0f, constrainedOptionSize.y - 2.0f ); + ImageActor optionPressedBackground = CreatePressedBackground( optionPressedBackgroundSize ); + optionPressedContainer.Add( optionPressedBackground ); - iconTextContainer.Add( icon ); + // 10. Add pressed text + Toolkit::TextView pressedCaptionTextView = CreateOptionCaption( caption, mTextPressedColor ); + optionPressedBackground.Add( pressedCaptionTextView ); - // 3. Add highlight - Pressed state in Pushbutton needs a new image which means creating the text and icon again but including a highlight this time. - ImageActor pressedImageBg = CreatePressedBackground( buttonSize ); + // 11. Add pressed icon + ImageActor pressedIcon = CreateOptionIcon( iconImage, mIconPressedColor ); + optionPressedBackground.Add( pressedIcon ); - Actor iconPressedTextContainer = Actor::New(); - iconPressedTextContainer.SetDrawMode( DrawMode::OVERLAY ); + // 12. Set the pressed option image + option.SetPressedImage( optionPressedContainer ); - style.SetTextColor( mCutPasteTextsPressedColor ); - styledCaption.clear(); - styledCaption.push_back( MarkupProcessor::StyledText( Text( caption ), style ) ); - Toolkit::TextView pressedLabel = CreateOptionText( styledCaption ); - pressedLabel.SetSize( Min( buttonSize, TEXT_LABEL_MAX_SIZE ) ); - ImageActor pressedIcon = CreateOptionIcon( iconImage, mCutPasteIconsPressedColor ); - - iconPressedTextContainer.Add( pressedImageBg ); - iconPressedTextContainer.Add( pressedLabel ); - iconPressedTextContainer.Add( pressedIcon ); - - // Set Pressed button Image - iconPressedTextContainer.SetSize( buttonSize ); - button.SetPressedImage( iconPressedTextContainer ); - - // Set Normal button Image - iconTextContainer.SetSize( buttonSize ); - button.SetButtonImage( iconTextContainer ); - mBackground.Add( button ); - - // Update content size (represents size of all content i.e. from top-left of first button, to bottom-right of last button) - mContentSize.width += buttonSize.width; - mContentSize.height = std::max(mContentSize.height + ( POPUP_BORDER.y ), buttonSize.height); - mButtonContainer.push_back(button); - - // resize all dividers based on the height content (i.e. max of all button heights) - const float dividerHeight = mContentSize.height - DIVIDER_MARGIN; - for(ActorIter i = mDividerContainer.begin(); i != mDividerContainer.end(); ++i) + // 13. Add the divider + if ( !finalOption ) { - i->SetSize( DIVIDER_WIDTH, dividerHeight ); + ImageActor divider = CreateDivider(); + mScrollView.Add( divider ); } - button.ClickedSignal().Connect( this, &TextInputPopup::OnButtonPressed ); } void TextInputPopup::Hide(bool animate) { - if( mRootActor ) + if( mRoot ) { if(mAnimation) { @@ -665,8 +668,8 @@ void TextInputPopup::Hide(bool animate) if(animate) { mAnimation = Animation::New( HIDE_POPUP_ANIMATION_DURATION ); - mAnimation.AnimateTo( Property(mRootActor, Actor::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut ); - mAnimation.AnimateTo( Property(mRootActor, Actor::COLOR_ALPHA), 0.0f, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property(mRoot, Actor::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property(mRoot, Actor::COLOR_ALPHA), 0.0f, AlphaFunctions::EaseOut ); mAnimation.Play(); mAnimation.FinishedSignal().Connect( this, &TextInputPopup::OnHideFinished ); @@ -674,8 +677,8 @@ void TextInputPopup::Hide(bool animate) } else { - mRootActor.SetProperty(Actor::SCALE, Vector3::ZERO); - mRootActor.SetProperty(Actor::COLOR_ALPHA, 0.0f); + mRoot.SetProperty(Actor::SCALE, Vector3::ZERO); + mRoot.SetProperty(Actor::COLOR_ALPHA, 0.0f); mState = StateHidden; } } @@ -683,9 +686,9 @@ void TextInputPopup::Hide(bool animate) void TextInputPopup::Show(bool animate) { - if( mRootActor ) + if( mRoot ) { - mRootActor.SetSensitive( true ); + mRoot.SetSensitive( true ); if(mAnimation) { @@ -696,8 +699,8 @@ void TextInputPopup::Show(bool animate) if(animate) { mAnimation = Animation::New( SHOW_POPUP_ANIMATION_DURATION ); - mAnimation.AnimateTo( Property(mRootActor, Actor::SCALE), Vector3::ONE, AlphaFunctions::EaseOut ); - mAnimation.AnimateTo( Property(mRootActor, Actor::COLOR_ALPHA), 1.0f, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property(mRoot, Actor::SCALE), Vector3::ONE, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property(mRoot, Actor::COLOR_ALPHA), 1.0f, AlphaFunctions::EaseOut ); mAnimation.Play(); mAnimation.FinishedSignal().Connect( this, &TextInputPopup::OnShowFinished ); @@ -705,8 +708,8 @@ void TextInputPopup::Show(bool animate) } else { - mRootActor.SetProperty(Actor::SCALE, Vector3::ONE); - mRootActor.SetProperty(Actor::COLOR_ALPHA, 1.0f); + mRoot.SetProperty(Actor::SCALE, Vector3::ONE); + mRoot.SetProperty(Actor::COLOR_ALPHA, 1.0f); mState = StateShown; } } @@ -714,7 +717,7 @@ void TextInputPopup::Show(bool animate) void TextInputPopup::SetAlternativeOffset(Vector2 offset) { - mRootActor.SetProperty( mAlternativeOffsetProperty, offset ); + mRoot.SetProperty( mAlternativeOffsetProperty, offset ); ApplyConfinementConstraint(); } @@ -725,82 +728,82 @@ TextInputPopup::State TextInputPopup::GetState(void) const Actor TextInputPopup::GetRootActor() const { - return mRootActor; + return mRoot; } // Styling -void TextInputPopup::SetCutPastePopUpColor( const Vector4& color ) +void TextInputPopup::SetCutPastePopupColor( const Vector4& color ) { - mCutPasteButtonsColor = color; + mBackgroundColor = color; } -const Vector4& TextInputPopup::GetCutPastePopUpColor() const +const Vector4& TextInputPopup::GetCutPastePopupColor() const { - return mCutPasteButtonsColor; + return mBackgroundColor; } -void TextInputPopup::SetCutPastePopUpPressedColor( const Vector4& color ) +void TextInputPopup::SetCutPastePopupPressedColor( const Vector4& color ) { - mCutPasteButtonsPressedColor = color; + mBackgroundPressedColor = color; } -const Vector4& TextInputPopup::GetCutPastePopUpPressedColor() const +const Vector4& TextInputPopup::GetCutPastePopupPressedColor() const { - return mCutPasteButtonsPressedColor; + return mBackgroundPressedColor; } -void TextInputPopup::SetCutPastePopUpBorderColor( const Vector4& color ) +void TextInputPopup::SetCutPastePopupBorderColor( const Vector4& color ) { - mBorderColor = color; + mLineColor = color; } -const Vector4& TextInputPopup::GetCutPastePopUpBorderColor() const +const Vector4& TextInputPopup::GetCutPastePopupBorderColor() const { - return mBorderColor; + return mLineColor; } -void TextInputPopup::SetCutPastePopUpIconColor( const Vector4& color ) +void TextInputPopup::SetCutPastePopupIconColor( const Vector4& color ) { - mCutPasteIconsColor = color; + mIconColor = color; } -const Vector4& TextInputPopup::GetCutPastePopUpIconColor() const +const Vector4& TextInputPopup::GetCutPastePopupIconColor() const { - return mCutPasteIconsColor; + return mIconColor; } -void TextInputPopup::SetCutPastePopUpIconPressedColor( const Vector4& color ) +void TextInputPopup::SetCutPastePopupIconPressedColor( const Vector4& color ) { - mCutPasteIconsPressedColor = color; + mIconPressedColor = color; } -const Vector4& TextInputPopup::GetCutPastePopUpIconPressedColor() +const Vector4& TextInputPopup::GetCutPastePopupIconPressedColor() { - return mCutPasteIconsPressedColor; + return mIconPressedColor; } -void TextInputPopup::SetCutPastePopUpTextColor( const Vector4& color ) +void TextInputPopup::SetCutPastePopupTextColor( const Vector4& color ) { - mCutPasteTextsColor = color; + mTextColor = color; } -const Vector4& TextInputPopup::GetCutPastePopUpTextColor() +const Vector4& TextInputPopup::GetCutPastePopupTextColor() { - return mCutPasteTextsColor; + return mTextColor; } -void TextInputPopup::SetCutPastePopUpTextPressedColor( const Vector4& color ) +void TextInputPopup::SetCutPastePopupTextPressedColor( const Vector4& color ) { - mCutPasteTextsPressedColor = color; + mTextPressedColor = color; } -const Vector4& TextInputPopup::GetCutPastePopUpTextPressedColor() +const Vector4& TextInputPopup::GetCutPastePopupTextPressedColor() { - return mCutPasteTextsPressedColor; + return mTextPressedColor; } -void TextInputPopup::TogglePopUpButtonOnOff( TextInputPopup::Buttons requiredButton, bool enable ) +void TextInputPopup::TogglePopupButtonOnOff( TextInputPopup::Buttons requiredButton, bool enable ) { bool match ( false ); for( std::vector::iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt && !match ); ++it ) @@ -905,36 +908,46 @@ unsigned int TextInputPopup::GetButtonPriorityPosition( TextInputPopup::Buttons void TextInputPopup::AddPopupOptions() { + mContentSize = POPUP_MIN_SIZE; + + // 1. Create the background. + CreateBackground(); + mRoot.Add(mBackground); + + // 2. Create the tail. + CreateTail(); + mBackground.Add( mTail ); + + // 3. Create the scroll view. + CreateScrollView(); + mBackground.Add( mScrollView ); + + // 4. Create the options and add into the scroll view. for( std::vector::const_iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt ); ++it ) { const ButtonRequirement& button( *it ); - if ( button.enabled ) + if ( button.enabled ) { - AddOption( button.name, button.caption, button.iconImage, false ); + AddOption( button.name, button.caption, button.iconImage, it != ( endIt - 1 ) ? false : true ); } } - 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 + // 5. Calcurate a lot of size to make the layout. + const Vector2 visibleContentSize = Vector2( std::min( mContentSize.x, POPUP_MAX_SIZE.x - POPUP_BORDER.x - POPUP_BORDER.y ), mContentSize.y ); + const Vector2 popupSize = Vector2( POPUP_BORDER.x + visibleContentSize.x + POPUP_BORDER.y, + POPUP_BORDER.z + visibleContentSize.y + POPUP_BORDER.w ); - CreateLayer( visiblePopUpSize ); - CreateStencil( visiblePopUpSize ); - CreateScrollView( Vector2( mContentSize.width, mContentSize.height ), visiblePopUpSize ); + // 6. Set the scroll view ruller. + UpdateScrollViewProperty( visibleContentSize ); - mLayer.Add( mStencil ); - mLayer.Add( mScrollView ); - mScrollView.Add( mBackground ); - mRootActor.Add( mTail ); + // 8. Create stencil + const Vector2 stencilSize = Vector2( popupSize.x, popupSize.y + POPUP_TAIL_SIZE.x + POPUP_TAIL_Y_OFFSET ); + CreateStencil( stencilSize ); + mRoot.Add( mStencil ); - Self().Add(mLayer); + // 7. Set the root size. + mRoot.SetSize( popupSize ); // Make Root Actor reflect the size of its content - mLayer.Lower(); } void TextInputPopup::SetPopupBoundary( const Rect& boundingRectangle ) @@ -944,7 +957,7 @@ void TextInputPopup::SetPopupBoundary( const Rect& boundingRectangle ) void TextInputPopup::SetTailPosition( const Vector3& position ) { - mRootActor.SetProperty( mRequestionPositionProperty, position ); + mRoot.SetProperty( mRequestionPositionProperty, position ); mPopupTailXPosition = position.x; ApplyConfinementConstraint(); ApplyTailConstraint(); diff --git a/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.h b/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.h index c4e9597..41b9bb6 100644 --- a/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.h +++ b/base/dali-toolkit/internal/controls/text-input/text-input-popup-impl.h @@ -116,45 +116,45 @@ public: TextInputPopup(); /** - * @return The root actor of for this popup is returned. - */ - Actor Self(); - - /** * Clears popup options (popup no longer exists) */ void Clear(); /** * Create the label + * @return the newly created Image actor to be used as the icon + */ + ImageActor CreateOptionIcon( Image iconImage, const Vector4& color ); + + /** + * Create the caption * @param[in] styledCaption The text to be displayed * @return the newly created label */ - Toolkit::TextView CreateOptionText( const MarkupProcessor::StyledTextArray& styledCaption ); + Toolkit::TextView CreateOptionCaption( const std::string& caption, const Vector4& color ); /** - * Create the label - * @param[in] iconImage the image to be used - * @return the newly created Image actor to be used as the icon + * Creates and sets up the background */ - ImageActor CreateOptionIcon( Image iconImage, const Vector4& color ); + void CreateBackground(); /** - * Creates and sets up the popup background + * Create and set up the tail */ - void CreatePopUpBackground(); + void CreateTail(); /** * Create divider if multiple options + * @return Return a divider image actor */ - void CreateDivider(); + ImageActor CreateDivider(); /** - * Create a background to be used when button pressed + * Create a background to be used when option pressed * @param[in] requiredSize size Image actor should be * @return Returns an Image Actor to be used a pressed background */ - ImageActor CreatePressedBackground( const Vector3 requiredSize ); + ImageActor CreatePressedBackground( const Vector2& requiredSize ); /** * Creates a ordered vector of button options @@ -208,44 +208,44 @@ public: * Set the Cut and Paste buttons color when in normal state * @param[in] color color to use */ - void SetCutPastePopUpColor( const Vector4& color ); + void SetCutPastePopupColor( const Vector4& color ); /** - * Get the set color of the Copy and Paste PopUp buttons + * Get the set color of the Copy and Paste Popup buttons * @return color */ - const Vector4& GetCutPastePopUpColor() const; + const Vector4& GetCutPastePopupColor() const; /** * Set the Cut and Paste button color when pressed. * @param[in] color color to use */ - void SetCutPastePopUpPressedColor( const Vector4& color ); + void SetCutPastePopupPressedColor( const Vector4& color ); /** * Get the Cut and Paste pressed button color. * @return color */ - const Vector4& GetCutPastePopUpPressedColor() const; + const Vector4& GetCutPastePopupPressedColor() const; /** * Set the border color of the popup * @param[in] color required color */ - void SetCutPastePopUpBorderColor( const Vector4& color ); + void SetCutPastePopupBorderColor( const Vector4& color ); /** * Get the border color * @return Vector4 the color of the border */ - const Vector4& GetCutPastePopUpBorderColor() const; + const Vector4& GetCutPastePopupBorderColor() const; /** * Toggle if a popup button should be enabled (shown) or not * @param[in] requiredButton Button Id to enable or disable * @param[in] enable toggle to enable (true) or disable (false) */ - void TogglePopUpButtonOnOff( TextInputPopup::Buttons requiredButton, bool enable ); + void TogglePopupButtonOnOff( TextInputPopup::Buttons requiredButton, bool enable ); /** * Set the Button Priority Position @@ -258,49 +258,49 @@ public: * Set the icon color of the popup * @param[in] color required color */ - void SetCutPastePopUpIconColor( const Vector4& color ); + void SetCutPastePopupIconColor( const Vector4& color ); /** * Get the popup icon color * @return Vector4 the color of the popup icon */ - const Vector4& GetCutPastePopUpIconColor() const; + const Vector4& GetCutPastePopupIconColor() const; /** * Set the pressed icon color of the popup * @param[in] color required color */ - void SetCutPastePopUpIconPressedColor( const Vector4& color ); + void SetCutPastePopupIconPressedColor( const Vector4& color ); /** * Get the popup pressed icon color * @return Vector4 the color of the popup pressed icon */ - const Vector4& GetCutPastePopUpIconPressedColor(); + const Vector4& GetCutPastePopupIconPressedColor(); /** * Set the text color of the popup * @param[in] color required color */ - void SetCutPastePopUpTextColor( const Vector4& color ); + void SetCutPastePopupTextColor( const Vector4& color ); /** * Get the popup text color * @return Vector4 the color of the popup text */ - const Vector4& GetCutPastePopUpTextColor(); + const Vector4& GetCutPastePopupTextColor(); /** * Set the pressed text color of the popup * @param[in] color required color */ - void SetCutPastePopUpTextPressedColor( const Vector4& color ); + void SetCutPastePopupTextPressedColor( const Vector4& color ); /** * Get the popup pressed text color * @return Vector4 the color of the popup pressed text */ - const Vector4& GetCutPastePopUpTextPressedColor(); + const Vector4& GetCutPastePopupTextPressedColor(); /** * Get the Button Priority Position @@ -315,13 +315,13 @@ public: void AddPopupOptions(); /** - * Set Boundary that PopUp should stay within + * Set Boundary that Popup should stay within * @param[in] boundingRectangle coordinates of bounding box from Top Left */ void SetPopupBoundary( const Rect& boundingRectangle ); /** - * Sets the positon of the PopUp tail relative to TextInput + * Sets the positon of the Popup tail relative to TextInput * @param position Position to set */ void SetTailPosition( const Vector3& position ); @@ -356,14 +356,8 @@ private: void ApplyTailConstraint(); /** - * Create a layer to hold the stencil - * @param[in] size Size to of layer - */ - void CreateLayer( const Vector2& size ); - - /** * Create a stencil to clip the scroll view content - * @param[in] size Size to of stencil + * @param[in] size of the stencil. */ void CreateStencil( const Vector2& size ); @@ -381,10 +375,14 @@ private: /** * Create a scroll view to hold the popup buttons and allow scrolling if too many buttons to fit within the visible boundary - * @param[in] scrollViewSize size of content of the scroll view which can exceed its visible size + */ + void CreateScrollView(); + + /** + * Set the scroll view size and ruler. * @param[in] visibleSize size of the visible scroll view */ - void CreateScrollView( const Vector2& scrollViewSize, const Vector2& visibleSize ); + void UpdateScrollViewProperty( const Vector2& visibleSize ); /** * Removes Popup from the stage. @@ -414,33 +412,35 @@ private: private: State mState; ///< Popup State. - Actor mRootActor; ///< The actor which all popup content is added to (i.e. panel and buttons) + Layer mRoot; ///< The actor which all popup content is added to (i.e. panel and buttons) Property::Index mAlternativeOffsetProperty; ///< Property [Vector3] how much to offset the popup if it goes out of the screen Property::Index mRequestionPositionProperty; ///< Prperty [Vector3] Requested position to place popup ImageActor mBackground; ///< The background popup panel + ImageActor mBackgroundEffect; ///< The background effect + ImageActor mBackgroundLine; ///< The background line ImageActor mTail; ///< The tail for the popup - ImageActor mTailOutline; ///< The border/outline around the tail + ImageActor mTailEffect; ///< the tail effect + ImageActor mTailLine; ///< The border/outline around the tail - float mPopupTailXPosition; ///< X position of PopUp tail. + float mPopupTailXPosition; ///< X position of Popup tail. - Vector3 mContentSize; ///< Size of Content (i.e. Buttons) + Vector2 mContentSize; ///< Size of Content (i.e. Buttons) ActorContainer mButtonContainer; ///< List of buttons added to popup. ActorContainer mDividerContainer; ///< List of dividers added to popup. Animation mAnimation; ///< Popup Hide/Show animation. Actor mStencil; ///< Stencil to clip scrollview Toolkit::ScrollView mScrollView; ///< Scrollview to house the popup - Layer mLayer; ///< Layer to house the scroll view and stencil std::vector mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed. - Vector4 mCutPasteButtonsColor; // Color of the cut and paste popup. - Vector4 mCutPasteButtonsPressedColor; // Color of the cut and paste buttons when pressed. - Vector4 mBorderColor; // Color of the border around the Cut and Paste Popup. - Vector4 mCutPasteIconsColor; // Color of the popup icon. - Vector4 mCutPasteIconsPressedColor; // Color of the popup icon when pressed. - Vector4 mCutPasteTextsColor; // Color of the popup text. - Vector4 mCutPasteTextsPressedColor; // Color of the popup text when pressed. + 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. Rect mBoundingRect; // Boundary that Popup must stay within. diff --git a/base/dali-toolkit/styles/tizen-dark-theme.json b/base/dali-toolkit/styles/tizen-dark-theme.json index bcdc3e3..a875c57 100644 --- a/base/dali-toolkit/styles/tizen-dark-theme.json +++ b/base/dali-toolkit/styles/tizen-dark-theme.json @@ -36,7 +36,7 @@ distributing this software or its derivatives. "highlight-color":"F060", "cut-and-paste-bg-color":"B061L41", "cut-and-paste-pressed-color":"B061L41P", - "cut-and-paste-border-color":"B0623L2", + "cut-and-paste-border-color":"B061L42", "cut-and-paste-icon-color":"T126", "cut-and-paste-icon-pressed-color":"T126P", "cut-and-paste-text-color":"T1221",