From: Agnelo Vaz Date: Mon, 15 Jun 2015 15:57:16 +0000 (+0100) Subject: TextSelectionPopup buttons can be enabled from TextController X-Git-Tag: dali_1.0.46~18^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=a8f695318919be238c1cf3c94add9567abd82351 TextSelectionPopup buttons can be enabled from TextController Change-Id: I2940fe925a12864b0471a1340803766cca76fc27 Signed-off-by: Agnelo Vaz --- diff --git a/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp b/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp index f41f667..7cf97da 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp +++ b/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp @@ -34,6 +34,11 @@ TextSelectionPopup TextSelectionPopup::New() return Internal::TextSelectionPopup::New(); } +TextSelectionPopup TextSelectionPopup::New( Buttons enabledButtons ) +{ + return Internal::TextSelectionPopup::New( enabledButtons ); +} + TextSelectionPopup::TextSelectionPopup() { } diff --git a/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h b/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h index 69df315..292d5c5 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h @@ -46,6 +46,17 @@ class DALI_IMPORT_API TextSelectionPopup : public Control { public: + enum Buttons + { + CUT = 1u << 0, + COPY = 1u << 1, + PASTE = 1u << 2, + SELECT = 1u << 3, + SELECT_ALL = 1u << 4, + CLIPBOARD = 1u << 5, + NONE = 1u << 6, + }; + /** * @brief The start and end property ranges for this control. */ @@ -62,12 +73,11 @@ public: { enum { - - POPUP_MAX_SIZE = PROPERTY_START_INDEX, ///< name "popup-max-size", The maximum size the Popup can be, type VECTOR2 - POPUP_MIN_SIZE, ///< name "popup-min-size", The minimum size the Popup can be, type VECTOR2 - OPTION_MAX_SIZE, ///< name "option-max-size", The maximum size an option can be, type VECTOR2 - OPTION_MIN_SIZE, ///< name "option-min-size", The minimum size an option can be, type VECTOR2 - OPTION_DIVIDER_SIZE, ///< name "option-divider-size", The size of the divider between options type VECTOR2 + POPUP_MAX_SIZE = PROPERTY_START_INDEX, ///< name "popup-max-size", maximum size the Popup can be, type VECTOR2 + POPUP_MIN_SIZE, ///< name "popup-min-size", minimum size the Popup can be, type VECTOR2 + OPTION_MAX_SIZE, ///< name "option-max-size", maximum size an option can be, type VECTOR2 + OPTION_MIN_SIZE, ///< name "option-min-size", minimum size an option can be, type VECTOR2 + OPTION_DIVIDER_SIZE, ///< name "option-divider-size", size of the divider between options type VECTOR2 POPUP_CLIPBOARD_BUTTON_ICON_IMAGE, ///< name "popup-clipboard-button-image", The image to use as the popup clipboard icon, type STRING POPUP_CUT_BUTTON_ICON_IMAGE, ///< name "popup-cut-button-image", The image to use as the popup cut icon, type STRING POPUP_COPY_BUTTON_ICON_IMAGE, ///< name "popup-copy-button-image", The image to use as the popup copy icon, type STRING @@ -84,6 +94,13 @@ public: static TextSelectionPopup New(); /** + * Create the TextSelectionPopup control with the given set of buttons. + * @param[in] enabledButtons The given set of buttons to enable + * @return A handle to the TextSelectionPopup control. + */ + static TextSelectionPopup New( Buttons enabledButtons ); + + /** * @brief Creates an empty handle. */ TextSelectionPopup(); diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index be7834a..28a3d18 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -19,7 +19,6 @@ #include // INTERNAL INCLUDES -#include #include #include @@ -127,6 +126,22 @@ Dali::Toolkit::TextSelectionPopup TextSelectionPopup::New() return handle; } +Dali::Toolkit::TextSelectionPopup TextSelectionPopup::New( Toolkit::TextSelectionPopup::Buttons buttonsToEnable ) +{ + // 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 ); + + impl->mEnabledButtons = buttonsToEnable; + + // 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 ) ); @@ -165,37 +180,37 @@ void TextSelectionPopup::SetProperty( BaseObject* object, Property::Index index, case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE: { ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( CLIPBOARD, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::CLIPBOARD, image ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE: { ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( CUT, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::CUT, image ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE: { ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( COPY, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::COPY, image ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE: { ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( PASTE, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::PASTE, image ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE: { ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( SELECT, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::SELECT, image ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE: { ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( SELECT_ALL, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::SELECT_ALL, image ); break; } } // switch @@ -236,7 +251,7 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I } case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( CLIPBOARD ) ); + ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::CLIPBOARD ) ); if( image ) { value = image.GetUrl(); @@ -245,7 +260,7 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I } case Toolkit::TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( CUT ) ); + ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::CUT ) ); if( image ) { value = image.GetUrl(); @@ -254,7 +269,7 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I } case Toolkit::TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( COPY ) ); + ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::COPY ) ); if( image ) { value = image.GetUrl(); @@ -263,7 +278,7 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I } case Toolkit::TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( PASTE ) ); + ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::PASTE ) ); if( image ) { value = image.GetUrl(); @@ -272,7 +287,7 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I } case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( SELECT ) ); + ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::SELECT ) ); if( image ) { value = image.GetUrl(); @@ -281,7 +296,7 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I } case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( SELECT_ALL ) ); + ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::SELECT_ALL ) ); if( image ) { value = image.GetUrl(); @@ -298,6 +313,11 @@ void TextSelectionPopup::OnInitialize() CreatePopup(); } +bool TextSelectionPopup::OnButtonPressed( Toolkit::Button button ) +{ + return true; +} + void TextSelectionPopup::SetDimensionToCustomise( const PopupCustomisations& settingToCustomise, const Size& dimension ) { switch( settingToCustomise ) @@ -373,37 +393,37 @@ Size TextSelectionPopup::GetDimensionToCustomise( const PopupCustomisations& set return Size::ZERO; } -void TextSelectionPopup::SetButtonImage( Buttons button, Dali::Image image ) +void TextSelectionPopup::SetButtonImage( Toolkit::TextSelectionPopup::Buttons button, Dali::Image image ) { switch ( button ) { break; - case CLIPBOARD: + case Toolkit::TextSelectionPopup::CLIPBOARD: { mClipboardIconImage = image; } break; - case CUT : + case Toolkit::TextSelectionPopup::CUT : { mCutIconImage = image; } break; - case COPY : + case Toolkit::TextSelectionPopup::COPY : { mCopyIconImage = image; } break; - case PASTE : + case Toolkit::TextSelectionPopup::PASTE : { mPasteIconImage = image; } break; - case SELECT : + case Toolkit::TextSelectionPopup::SELECT : { mSelectIconImage = image; } break; - case SELECT_ALL : + case Toolkit::TextSelectionPopup::SELECT_ALL : { mSelectAllIconImage = image; } @@ -415,36 +435,36 @@ void TextSelectionPopup::SetButtonImage( Buttons button, Dali::Image image ) } // switch } -Dali::Image TextSelectionPopup::GetButtonImage( Buttons button ) +Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ) { switch ( button ) { - case CLIPBOARD : + case Toolkit::TextSelectionPopup::CLIPBOARD : { return mClipboardIconImage; } break; - case CUT : + case Toolkit::TextSelectionPopup::CUT : { return mCutIconImage; } break; - case COPY : + case Toolkit::TextSelectionPopup::COPY : { return mCopyIconImage; } break; - case PASTE : + case Toolkit::TextSelectionPopup::PASTE : { return mPasteIconImage; } break; - case SELECT : + case Toolkit::TextSelectionPopup::SELECT : { return mSelectIconImage; } break; - case SELECT_ALL : + case Toolkit::TextSelectionPopup::SELECT_ALL : { return mSelectAllIconImage; } @@ -467,35 +487,35 @@ Dali::Image TextSelectionPopup::GetButtonImage( Buttons button ) { mCutIconImage = ResourceImage::New( OPTION_ICON_CUT ); } - mOrderListOfButtons.push_back( ButtonRequirement( CUT, mCutOptionPriority, OPTION_CUT, POPUP_CUT_STRING , mCutIconImage, false ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::CUT, mCutOptionPriority, OPTION_CUT, POPUP_CUT_STRING , mCutIconImage, ( mEnabledButtons & Toolkit::TextSelectionPopup::CUT) ) ); if ( !mCopyIconImage ) { mCopyIconImage = ResourceImage::New( OPTION_ICON_COPY ); } - mOrderListOfButtons.push_back( ButtonRequirement( COPY, mCopyOptionPriority, OPTION_COPY, POPUP_COPY_STRING, mCopyIconImage, false ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::COPY, mCopyOptionPriority, OPTION_COPY, POPUP_COPY_STRING, mCopyIconImage, ( mEnabledButtons & Toolkit::TextSelectionPopup::COPY) ) ); if ( !mPasteIconImage ) { mPasteIconImage = ResourceImage::New( OPTION_ICON_PASTE ); } - mOrderListOfButtons.push_back( ButtonRequirement( PASTE, mPasteOptionPriority, OPTION_PASTE, POPUP_PASTE_STRING, mPasteIconImage, false ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::PASTE, mPasteOptionPriority, OPTION_PASTE, POPUP_PASTE_STRING, mPasteIconImage, ( mEnabledButtons & Toolkit::TextSelectionPopup::PASTE) ) ); if ( !mSelectIconImage ) mSelectIconImage = ResourceImage::New( OPTION_ICON_SELECT ); - mOrderListOfButtons.push_back( ButtonRequirement( SELECT, mSelectOptionPriority, OPTION_SELECT_WORD, POPUP_SELECT_STRING, mSelectIconImage, true ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::SELECT, mSelectOptionPriority, OPTION_SELECT_WORD, POPUP_SELECT_STRING, mSelectIconImage, ( mEnabledButtons & Toolkit::TextSelectionPopup::SELECT) ) ); if ( !mSelectAllIconImage ) { mSelectAllIconImage = ResourceImage::New( OPTION_ICON_SELECT_ALL ); } - mOrderListOfButtons.push_back( ButtonRequirement( SELECT_ALL, mSelectAllOptionPriority, OPTION_SELECT_ALL, POPUP_SELECT_ALL_STRING, mSelectAllIconImage, true ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::SELECT_ALL, mSelectAllOptionPriority, OPTION_SELECT_ALL, POPUP_SELECT_ALL_STRING, mSelectAllIconImage, ( mEnabledButtons & Toolkit::TextSelectionPopup::SELECT_ALL) ) ); if ( !mClipboardIconImage ) { mClipboardIconImage = ResourceImage::New( OPTION_ICON_CLIPBOARD ); } - mOrderListOfButtons.push_back( ButtonRequirement( CLIPBOARD, mClipboardOptionPriority, OPTION_CLIPBOARD, POPUP_CLIPBOARD_STRING, mClipboardIconImage, false ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::CLIPBOARD, mClipboardOptionPriority, OPTION_CLIPBOARD, POPUP_CLIPBOARD_STRING, mClipboardIconImage, ( mEnabledButtons & Toolkit::TextSelectionPopup::CLIPBOARD) ) ); // Sort the buttons according their priorities. std::sort( mOrderListOfButtons.begin(), mOrderListOfButtons.end(), TextSelectionPopup::ButtonPriorityCompare() ); @@ -576,7 +596,7 @@ Dali::Image TextSelectionPopup::GetButtonImage( Buttons button ) option.SetName( name ); option.SetAnimationTime( 0.0f ); option.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS ); - //option.ClickedSignal().Connect( this, &TextInputPopup::OnButtonPressed ); + option.ClickedSignal().Connect( this, &TextSelectionPopup::OnButtonPressed ); // 5. Set the normal option image. option.SetButtonImage( optionContainer ); @@ -654,6 +674,7 @@ TextSelectionPopup::TextSelectionPopup() mMaxSize(), mMinSize(), mOptionDividerSize( Size( 2.0f, 0.0f) ), + mEnabledButtons( Toolkit::TextSelectionPopup::NONE ), mLineColor( DEFAULT_POPUP_LINE_COLOR ), mIconColor( DEFAULT_OPTION_ICON ), mIconPressedColor( DEFAULT_OPTION_ICON_PRESSED ), diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h index 34c2235..3650977 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h @@ -20,6 +20,7 @@ // INTERNAL INCLUDES #include +#include #include #include #include @@ -55,21 +56,10 @@ class TextSelectionPopup : public Control { public: - enum Buttons - { - CUT, - COPY, - PASTE, - SELECT, - SELECT_ALL, - CLIPBOARD, - ENUM_END - }; - struct ButtonRequirement { ButtonRequirement() - : id( ENUM_END ), + : id( Toolkit::TextSelectionPopup::NONE ), priority( 0u ), name(), caption(), @@ -77,7 +67,7 @@ public: enabled( false ) {} - ButtonRequirement( Buttons buttonId, + ButtonRequirement( Toolkit::TextSelectionPopup::Buttons buttonId, std::size_t buttonPriority, const std::string& buttonName, const std::string& buttonCaption, @@ -91,7 +81,7 @@ public: enabled( buttonEnabled ) {} - Buttons id; + Toolkit::TextSelectionPopup::Buttons id; std::size_t priority; std::string name; std::string caption; @@ -111,6 +101,13 @@ public: */ static Toolkit::TextSelectionPopup New(); + /** + * @brief New constructor with provided buttons to enable. + * @param[in] buttonsToEnable bit mask of buttons to enable + * @return A handle to the TextSelectionPopup control. + */ + static Toolkit::TextSelectionPopup New( Toolkit::TextSelectionPopup::Buttons buttonsToEnable ); + // Properties /** @@ -140,6 +137,13 @@ private: // From Control private: // Implementation /** + * @brief When a popup button is pressed + * @param[in] button the button pressed + * @return bool + */ + bool OnButtonPressed( Toolkit::Button button ); + + /** * @brief Method to set the dimension or dimension constraint on certain aspects of the Popup. * * @param[in] settingToCustomise The setting for the PopupCustomisations enum that can be customised @@ -160,7 +164,7 @@ private: // Implementation * @param[in] button The button the image should be used for from the Buttons Enum. * @param[in] image The image to use. */ - void SetButtonImage( Buttons button, Dali::Image image ); + void SetButtonImage( Toolkit::TextSelectionPopup::Buttons button, Dali::Image image ); /** * @brief Retrieves the image of the given button used by the popup @@ -168,7 +172,7 @@ private: // Implementation * @param[in] button The button to get the image from * @return The image used for that button. */ - Dali::Image GetButtonImage( Buttons button ); + Dali::Image GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ); void CreateOrderedListOfPopupOptions(); @@ -220,6 +224,8 @@ private: // Data std::vector mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed. + Toolkit::TextSelectionPopup::Buttons mEnabledButtons; // stores enabled buttons + 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. @@ -232,8 +238,8 @@ private: // Data std::size_t mPasteOptionPriority; // Position of Paste button std::size_t mClipboardOptionPriority; // Position of Clipboard button - bool mShowIcons; // Flag to show icons - bool mShowCaptions; // Flag to show text captions + bool mShowIcons:1; // Flag to show icons + bool mShowCaptions:1; // Flag to show text captions }; diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index b2fcda0..6bc65c5 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -211,6 +211,7 @@ struct Decorator::Impl : public ConnectionTracker Impl( ControllerInterface& controller ) : mController( controller ), + mEnabledPopupButtons( TextSelectionPopup::NONE ), mBoundingBox( Rect() ), mHighlightColor( LIGHT_BLUE ), mActiveCursor( ACTIVE_CURSOR_NONE ), @@ -393,7 +394,7 @@ struct Decorator::Impl : public ConnectionTracker { if ( !mCopyPastePopup ) { - mCopyPastePopup = TextSelectionPopup::New(); + mCopyPastePopup = TextSelectionPopup::New( mEnabledPopupButtons ); #ifdef DECORATOR_DEBUG mCopyPastePopup.SetName("mCopyPastePopup"); #endif @@ -1065,6 +1066,7 @@ struct Decorator::Impl : public ConnectionTracker ImageActor mSecondaryCursor; MeshActor mHighlightMeshActor; ///< Mesh Actor to display highlight TextSelectionPopup mCopyPastePopup; + TextSelectionPopup::Buttons mEnabledPopupButtons; /// Bit mask of currently enabled Popup buttons Image mHandleImages[HANDLE_TYPE_COUNT][HANDLE_IMAGE_TYPE_COUNT]; Image mCursorImage; @@ -1292,6 +1294,16 @@ bool Decorator::IsPopupActive() const return mImpl->mActiveCopyPastePopup ; } +void Decorator::SetEnabledPopupButtons( TextSelectionPopup::Buttons& enabledButtonsBitMask ) +{ + mImpl->mEnabledPopupButtons = enabledButtonsBitMask; +} + +TextSelectionPopup::Buttons& Decorator::GetEnabledPopupButtons() +{ + return mImpl->mEnabledPopupButtons; +} + /** Scroll **/ void Decorator::SetScrollThreshold( float threshold ) diff --git a/dali-toolkit/internal/text/decorator/text-decorator.h b/dali-toolkit/internal/text/decorator/text-decorator.h index 873bdcc..29d1631 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.h +++ b/dali-toolkit/internal/text/decorator/text-decorator.h @@ -24,6 +24,9 @@ #include #include +// INTERNAL INCLUDES +#include + namespace Dali { @@ -414,6 +417,18 @@ public: bool IsPopupActive() const; /** + * @brief Set a bit mask of the buttons to be shown by Popup + * @param[in] enabledButtonsBitMask from TextSelectionPopup::Buttons enum + */ + void SetEnabledPopupButtons( TextSelectionPopup::Buttons& enabledButtonsBitMask ); + + /** + * @brief Get the current bit mask of buttons to be shown by Popup + * @return bitmask of TextSelectionPopup::Buttons + */ + TextSelectionPopup::Buttons& GetEnabledPopupButtons(); + + /** * @brief Sets the scroll threshold. * * It defines a square area inside the control, close to the edge. diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index f41bddd..4636e18 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -840,6 +840,8 @@ void Controller::Impl::ChangeState( EventData::State newState ) mEventData->mDecorator->SetHandleActive( RIGHT_SELECTION_HANDLE, true ); if( mEventData->mGrabHandlePopupEnabled ) { + TextSelectionPopup::Buttons selectedButtons = TextSelectionPopup::Buttons( TextSelectionPopup::COPY ); + mEventData->mDecorator->SetEnabledPopupButtons( selectedButtons ); mEventData->mDecorator->SetPopupActive( true ); } mEventData->mDecoratorUpdated = true; @@ -879,6 +881,8 @@ void Controller::Impl::ChangeState( EventData::State newState ) } if( mEventData->mGrabHandlePopupEnabled ) { + TextSelectionPopup::Buttons selectionButtons = TextSelectionPopup::Buttons( TextSelectionPopup::SELECT | TextSelectionPopup::SELECT_ALL ); + mEventData->mDecorator->SetEnabledPopupButtons( selectionButtons ); mEventData->mDecorator->SetPopupActive( true ); } mEventData->mDecoratorUpdated = true;