X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-selection-popup-impl.h;h=a79a925c55ab99d089a64e3aca970af9cdb8c425;hb=cbda2de83c5025276c35d69044934ab1258b4998;hp=34c2235710c57e86ab1fc9bdce5df8dff9bf6484;hpb=577d26decfe241610f22fc92ea0019cd8ac5ceca;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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..a79a925 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 @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H__ -#define __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H__ +#ifndef DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H +#define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,13 +20,15 @@ // INTERNAL INCLUDES #include +#include +#include #include #include #include // EXTERNAL INCLUDES -#include #include +#include namespace Dali { @@ -37,39 +39,22 @@ namespace Toolkit namespace Internal { -namespace -{ - enum PopupCustomisations { POPUP_MAXIMUM_SIZE, - POPUP_MINIMUM_SIZE, OPTION_MAXIMUM_SIZE, OPTION_MINIMUM_SIZE, OPTION_DIVIDER_SIZE }; -} // namespace - 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 +62,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 +76,7 @@ public: enabled( buttonEnabled ) {} - Buttons id; + Toolkit::TextSelectionPopup::Buttons id; std::size_t priority; std::string name; std::string caption; @@ -107,9 +92,11 @@ public: }; /** - * @copydoc Dali::Toollkit::TextSelectionPopup::New() + * @brief New constructor with provided buttons to enable. + * @param[in] callbackInterface The text popup callback interface which receives the button click callbacks. + * @return A handle to the TextSelectionPopup control. */ - static Toolkit::TextSelectionPopup New(); + static Toolkit::TextSelectionPopup New( TextSelectionPopupCallbackInterface* callbackInterface ); // Properties @@ -130,6 +117,26 @@ public: */ static Property::Value GetProperty( BaseObject* object, Property::Index index ); + /** + * @copydoc Toolkit::EnableButtons + */ + void EnableButtons( Toolkit::TextSelectionPopup::Buttons buttonsToEnable ); + + /** + * @copydoc Toolkit::TextSelectionPopup::RaiseAbove() + */ + void RaiseAbove( Layer target ); + + /** + * @copydoc Toolkit::TextSelectionPopup::ShowPopup() + */ + void ShowPopup(); + + /** + * @copydoc Toolkiut::TextSelectionPopup::HidePopup() + */ + void HidePopup(); + private: // From Control /** @@ -139,6 +146,50 @@ private: // From Control private: // Implementation + void HideAnimationFinished( Animation& animation ); + + /** + * @brief When the cut button is pressed. + * @param[in] button the button pressed + * @return @e true to consume the event. + */ + bool OnCutButtonPressed( Toolkit::Button button ); + + /** + * @brief When the copy button is pressed. + * @param[in] button the button pressed + * @return @e true to consume the event. + */ + bool OnCopyButtonPressed( Toolkit::Button button ); + + /** + * @brief When the paste button is pressed. + * @param[in] button the button pressed + * @return @e true to consume the event. + */ + bool OnPasteButtonPressed( Toolkit::Button button ); + + /** + * @brief When the select button is pressed. + * @param[in] button the button pressed + * @return @e true to consume the event. + */ + bool OnSelectButtonPressed( Toolkit::Button button ); + + /** + * @brief When the select all button is pressed. + * @param[in] button the button pressed + * @return @e true to consume the event. + */ + bool OnSelectAllButtonPressed( Toolkit::Button button ); + + /** + * @brief When the clipboard button is pressed. + * @param[in] button the button pressed + * @return @e true to consume the event. + */ + bool OnClipboardButtonPressed( Toolkit::Button button ); + /** * @brief Method to set the dimension or dimension constraint on certain aspects of the Popup. * @@ -160,7 +211,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,22 +219,41 @@ 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 ); + + /** + * @brief Sets the image for the pressed state of a popup option. + * + * @param[in] filename The image filename to use. + */ + void SetPressedImage( const std::string& filename); + + /** + * @brief Gets the image used for the pressed state of a popup option. + * + * @return The image filename used. + */ + std::string GetPressedImage() const; void CreateOrderedListOfPopupOptions(); - void AddOption( const std::string& name, const std::string& caption, const Image iconImage, bool showDivider, bool showIcons, bool showCaption ); + void AddOption( const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption ); std::size_t GetNumberOfEnabledOptions(); void AddPopupOptionsToToolbar( bool showIcons, bool showCaptions ); - void CreatePopup(); + /** + * Creates the background-border image + * + * @param[in] propertyMap The properties describing the background-border + */ + void CreateBackgroundBorder( Property::Map& propertyMap ); /** * Construct a new TextField. */ - TextSelectionPopup(); + TextSelectionPopup( TextSelectionPopupCallbackInterface* callbackInterface ); /** * A reference counted object may only be deleted by calling Unreference() @@ -211,18 +281,20 @@ private: // Data Image mSelectIconImage; Image mSelectAllIconImage; - Size mMaxSize; // Maximum size of the Popup - Size mMinSize; // Minimum size of the Popup - - Size mOptionMaxSize; // Maximum size of an Option button - Size mOptionMinSize; // Minimum size of an Option button - Size mOptionDividerSize; // Size of divider line + Size mPopupMaxSize; // Maximum size of the Popup + Size mOptionMaxSize; // Maximum size of an Option button + Size mOptionMinSize; // Minimum size of an Option button + Size mOptionDividerSize; // Size of divider line std::vector mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed. - Vector4 mLineColor; // Color of the line around the text input popup + Toolkit::TextSelectionPopup::Buttons mEnabledButtons; // stores enabled buttons + Toolkit::TextSelectionPopupCallbackInterface* mCallbackInterface; + + std::string mPressedImage; // Image used for the popup option when pressed. + Vector4 mPressedColor; // Color of the popup option when pressed. + Vector4 mDividerColor; // Color of the divider between buttons Vector4 mIconColor; // Color of the popup icon. - Vector4 mIconPressedColor; // Color of the popup icon when pressed. // Priority of Options/Buttons in the Cut and Paste pop-up, higher priority buttons are displayed first, left to right. std::size_t mSelectOptionPriority; // Position of Select Button @@ -231,9 +303,13 @@ private: // Data std::size_t mCopyOptionPriority; // Position of Copy button std::size_t mPasteOptionPriority; // Position of Paste button std::size_t mClipboardOptionPriority; // Position of Clipboard button + float mFadeInDuration; // Duration of the animation to fade in the Popup + float mFadeOutDuration; // Duration of the animation to fade out the Popup - 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 + bool mPopupShowing:1; // Flag to indicate Popup showing + bool mButtonsChanged:1; // Flag to indicate the Popup Buttons have changed }; @@ -263,5 +339,5 @@ inline const Toolkit::Internal::TextSelectionPopup& GetImpl( const Toolkit::Text } // namespace Dali -#endif // __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H__ +#endif // DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H