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-toolbar-impl.h;h=5b30dcff7dd189dedae41aaa286b82736dee6ceb;hp=29d25db2233020631d84ec13e84c47af892f8569;hb=HEAD;hpb=5369bf3fe6cfa8b44c5d8923d8625007d2d8e91b diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h index 29d25db..36c7e56 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H__ -#define __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H__ +#ifndef DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H +#define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,32 +19,24 @@ */ // INTERNAL INCLUDES +#include +#include +#include #include #include -#include -#include // EXTERNAL INCLUDES #include namespace Dali { - namespace Toolkit { - namespace Internal { - -namespace -{ - -} // namespace - class TextSelectionToolbar : public Control { public: - /** * @copydoc Dali::Toollkit::TextSelectionToolbar::New() */ @@ -58,7 +50,7 @@ public: * @param[in] index The property index. * @param[in] value The new property value. */ - static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ); + static void SetProperty(BaseObject* object, Property::Index index, const Property::Value& value); /** * @brief Called to retrieve a property of an object of this type. @@ -67,50 +59,61 @@ public: * @param[in] index The property index. * @return The current value of the property. */ - static Property::Value GetProperty( BaseObject* object, Property::Index index ); + static Property::Value GetProperty(BaseObject* object, Property::Index index); /** * @copydoc Toolkit::TextSelectionToolbar::AddOption() */ - void AddOption( Actor& option ); + void AddOption(Actor& option); /** * @copydoc Toolkit::TextSelectionToolbar::AddDivider() */ - void AddDivider( Actor& divider ); + void AddDivider(Actor& divider); /** * @copydoc Toolkit::TextSelectionToolbar::ResizeDividers() */ - void ResizeDividers( Size& size ); + void ResizeDividers(Size& size); /** * @copydoc Toolkit::TextSelectionToolbar::RaiseAbove() */ - void RaiseAbove( Layer target ); + void RaiseAbove(Actor target); -private: // From Control + /** + * Sets the scroll bar padding. + * + * @param[in] padding The padding value. + */ + void SetScrollBarPadding(const Vector2& padding); /** - * @copydoc Control::OnInitialize() + * @return The padding value. */ - virtual void OnInitialize(); + const Vector2& GetScrollBarPadding() const; /** - * @copydoc Control::OnRelayout() - */ - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); + * @copydoc Toolkit::TextSelectionToolbar::ScrollTo() + */ + void ScrollTo(const Vector2& position); +private: // From Control /** - * @copydoc Control::OnStageConnection() + * @copydoc Control::OnInitialize() */ - virtual void OnStageConnection( int depth ); + void OnInitialize() override; + + /** + * @copydoc Control::OnRelayout() + */ + void OnRelayout(const Vector2& size, RelayoutContainer& container) override; /** * @brief Set max size of Popup * @param[in] maxSize Size (Vector2) */ - void SetPopupMaxSize( const Size& maxSize ); + void SetPopupMaxSize(const Size& maxSize); /** * @brief Get Max size of Popup @@ -118,6 +121,12 @@ private: // From Control */ const Dali::Vector2& GetPopupMaxSize() const; +private: // Implementation + /** + * @copydoc Toolkit::TextSelectionToolbar::ConfigureScrollview() + */ + void ConfigureScrollview(const Property::Map& properties); + /** * @brief Set up scrollview to scroll Toolbar horizontally */ @@ -129,18 +138,23 @@ private: // From Control void SetUp(); /** + * @brief Enable or disable the scroll-bar + * + * @param[in] enable True if the scroll-bar is required + */ + void SetUpScrollBar(bool enable); + + /** * Toolbar has started to scroll * @param[in] position current scroll view position */ - void OnScrollStarted( const Vector2& position ); + void OnScrollStarted(const Vector2& position); /** * Toolbar has stopped scrolling * @param[in] position current scroll view position */ - void OnScrollCompleted( const Vector2& position ); - -private: // Implementation + void OnScrollCompleted(const Vector2& position); /** * Construct a new TextField. @@ -153,39 +167,39 @@ private: // Implementation virtual ~TextSelectionToolbar(); private: - // Undefined copy constructor and assignment operators TextSelectionToolbar(const TextSelectionToolbar&); TextSelectionToolbar& operator=(const TextSelectionToolbar& rhs); -private: // Data - - Layer mStencilLayer; ///< The stencil layer - Toolkit::TableView mTableOfButtons; ///< Actor which holds all the buttons, sensitivity can be set on buttons via this actor - Toolkit::ScrollView mScrollView; ///< Provides scrolling of Toolbar when content does not fit. - RulerPtr mRulerX; ///< Ruler to clamp horizontal scrolling. Updates on Relayout - Size mMaxSize; ///< Max size of the Toolbar - unsigned int mIndexInTable; ///< Index in table to add option - Dali::Vector< unsigned int > mDividerIndexes; ///< Vector of indexes in the Toolbar that contain dividers. - +private: // Data + Actor mToolbarActor; ///< The actor used to house the toolbar. + Toolkit::TableView mTableOfButtons; ///< Actor which holds all the buttons, sensitivity can be set on buttons via this actor + Toolkit::ScrollView mScrollView; ///< Provides scrolling of Toolbar when content does not fit. + Toolkit::ScrollBar mScrollBar; ///< An horizontal scroll bar for the text's popup options. + RulerPtr mRulerX; ///< Ruler to clamp horizontal scrolling. Updates on Relayout + Size mMaxSize; ///< Max size of the Toolbar + Vector2 mScrollBarPadding; ///< The padding used to position the scroll indicator. + unsigned int mIndexInTable; ///< Index in table to add option + Dali::Vector mDividerIndexes; ///< Vector of indexes in the Toolbar that contain dividers. + bool mFirstScrollEnd; ///< Used for RTL mirroring. Avoids the overshoot to be shown the first time the popup is shown. }; } // namespace Internal // Helpers for public-api forwarding methods -inline Toolkit::Internal::TextSelectionToolbar& GetImpl( Toolkit::TextSelectionToolbar& textSelectionToolbar ) +inline Toolkit::Internal::TextSelectionToolbar& GetImpl(Toolkit::TextSelectionToolbar& textSelectionToolbar) { - DALI_ASSERT_ALWAYS( textSelectionToolbar ); + DALI_ASSERT_ALWAYS(textSelectionToolbar); Dali::RefObject& handle = textSelectionToolbar.GetImplementation(); return static_cast(handle); } -inline const Toolkit::Internal::TextSelectionToolbar& GetImpl( const Toolkit::TextSelectionToolbar& textSelectionToolbar ) +inline const Toolkit::Internal::TextSelectionToolbar& GetImpl(const Toolkit::TextSelectionToolbar& textSelectionToolbar) { - DALI_ASSERT_ALWAYS( textSelectionToolbar ); + DALI_ASSERT_ALWAYS(textSelectionToolbar); const Dali::RefObject& handle = textSelectionToolbar.GetImplementation(); @@ -196,4 +210,4 @@ inline const Toolkit::Internal::TextSelectionToolbar& GetImpl( const Toolkit::Te } // namespace Dali -#endif // __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H__ +#endif // DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H