X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-selection-popup-impl.h;h=a94fee99d1e7627e78a4ddf7797c67ff360dc9de;hp=619dc3754fd9e232e581093fb6235a32886fed6f;hb=3d655cb57a51fee5d3a887aa36f4c6b8b77c2f7d;hpb=536dbd95b845181336b94928d26e92b2f5da47fc 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 619dc37..a94fee9 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) 2020 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. @@ -18,17 +18,19 @@ * */ +// EXTERNAL INCLUDES +#include +#include +#include + // INTERNAL INCLUDES #include #include -#include +#include +#include #include #include -// EXTERNAL INCLUDES -#include -#include - namespace Dali { @@ -38,9 +40,6 @@ namespace Toolkit namespace Internal { -namespace -{ - enum PopupCustomisations { POPUP_MAXIMUM_SIZE, @@ -49,8 +48,6 @@ enum PopupCustomisations OPTION_DIVIDER_SIZE }; -} // namespace - class TextSelectionPopup : public Control { public: @@ -62,7 +59,6 @@ public: priority( 0u ), name(), caption(), - icon(), enabled( false ) {} @@ -70,13 +66,11 @@ public: std::size_t buttonPriority, const std::string& buttonName, const std::string& buttonCaption, - Dali::Image& buttonIcon, bool buttonEnabled ) : id( buttonId ), priority( buttonPriority ), name( buttonName ), caption( buttonCaption ), - icon( buttonIcon ), enabled( buttonEnabled ) {} @@ -84,7 +78,6 @@ public: std::size_t priority; std::string name; std::string caption; - Dali::Image icon; bool enabled; }; @@ -97,12 +90,10 @@ public: /** * @brief New constructor with provided buttons to enable. - * @param[in] buttonsToEnable bit mask of 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( Toolkit::TextSelectionPopup::Buttons buttonsToEnable, - TextSelectionPopupCallbackInterface* callbackInterface ); + static Toolkit::TextSelectionPopup New( TextSelectionPopupCallbackInterface* callbackInterface ); // Properties @@ -124,29 +115,36 @@ 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 ); + void RaiseAbove( Actor target ); /** * @copydoc Toolkit::TextSelectionPopup::ShowPopup() */ void ShowPopup(); -private: // From Control - /** - * @copydoc Control::OnInitialize() + * @copydoc Toolkiut::TextSelectionPopup::HidePopup() */ - virtual void OnInitialize(); + void HidePopup(); + +private: // From Control /** - * @copydoc Control::OnStageConnection() + * @copydoc Control::OnInitialize() */ - virtual void OnStageConnection( int depth ); + void OnInitialize() override; private: // Implementation + void HideAnimationFinished( Animation& animation ); + /** * @brief When the cut button is pressed. * @param[in] button the button pressed @@ -202,7 +200,7 @@ private: // Implementation * * @param[in] setting The setting from the PopupCustomisations enum */ - Size GetDimensionToCustomise( const PopupCustomisations& setting ); + Size GetDimensionToCustomise( const PopupCustomisations& setting ) const; /** * @brief Sets the image for the given button of the Popup. @@ -210,7 +208,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( Toolkit::TextSelectionPopup::Buttons button, Dali::Image image ); + void SetButtonImage( Toolkit::TextSelectionPopup::Buttons button, const std::string& image ); /** * @brief Retrieves the image of the given button used by the popup @@ -218,17 +216,36 @@ private: // Implementation * @param[in] button The button to get the image from * @return The image used for that button. */ - Dali::Image GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ); + const std::string& GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ) const; + + /** + * @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 ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption ); - std::size_t GetNumberOfEnabledOptions(); + std::size_t GetNumberOfEnabledOptions() const; 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. @@ -253,26 +270,28 @@ private: // Data Dali::Toolkit::TableView mTableOfButtons; // Actor which holds all the buttons, sensitivity can be set on buttons via this actor - // Images to be used by the Popup buttons - Image mCutIconImage; - Image mCopyIconImage; - Image mPasteIconImage; - Image mClipboardIconImage; - Image mSelectIconImage; - Image mSelectAllIconImage; + // Images paths to be used by the Popup buttons + std::string mCutIconImage; + std::string mCopyIconImage; + std::string mPasteIconImage; + std::string mClipboardIconImage; + std::string mSelectIconImage; + std::string mSelectAllIconImage; - 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. 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 mPressedColor; // Color of the popup option 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 @@ -281,9 +300,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: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 }; @@ -313,5 +336,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