1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali-toolkit/public-api/controls/control-impl.h>
23 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
24 #include <dali-toolkit/public-api/controls/table-view/table-view.h>
25 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
28 #include <dali/public-api/actors/layer.h>
39 class TextSelectionToolbar : public Control
44 * @copydoc Dali::Toollkit::TextSelectionToolbar::New()
46 static Toolkit::TextSelectionToolbar New();
51 * @brief Called when a property of an object of this type is set.
52 * @param[in] object The object whose property is set.
53 * @param[in] index The property index.
54 * @param[in] value The new property value.
56 static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
59 * @brief Called to retrieve a property of an object of this type.
61 * @param[in] object The object whose property is to be retrieved.
62 * @param[in] index The property index.
63 * @return The current value of the property.
65 static Property::Value GetProperty( BaseObject* object, Property::Index index );
68 * @copydoc Toolkit::TextSelectionToolbar::AddOption()
70 void AddOption( Actor& option );
73 * @copydoc Toolkit::TextSelectionToolbar::AddDivider()
75 void AddDivider( Actor& divider );
78 * @copydoc Toolkit::TextSelectionToolbar::ResizeDividers()
80 void ResizeDividers( Size& size );
83 * @copydoc Toolkit::TextSelectionToolbar::RaiseAbove()
85 void RaiseAbove( Layer target );
87 private: // From Control
90 * @copydoc Control::OnInitialize()
92 virtual void OnInitialize();
95 * @copydoc Control::OnRelayout()
97 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
100 * @brief Set max size of Popup
101 * @param[in] maxSize Size (Vector2)
103 void SetPopupMaxSize( const Size& maxSize );
106 * @brief Get Max size of Popup
107 * @return Vector2 the max size of the Popup
109 const Dali::Vector2& GetPopupMaxSize() const;
111 private: // Implementation
114 * @copydoc Toolkit::TextSelectionToolbar::ConfigureScrollview()
116 void ConfigureScrollview( const Property::Map& properties );
119 * @brief Set up scrollview to scroll Toolbar horizontally
121 void SetUpScrollView();
124 * @brief Set up the parts that make the Toolbar
129 * Toolbar has started to scroll
130 * @param[in] position current scroll view position
132 void OnScrollStarted( const Vector2& position );
135 * Toolbar has stopped scrolling
136 * @param[in] position current scroll view position
138 void OnScrollCompleted( const Vector2& position );
141 * Construct a new TextField.
143 TextSelectionToolbar();
146 * A reference counted object may only be deleted by calling Unreference()
148 virtual ~TextSelectionToolbar();
152 // Undefined copy constructor and assignment operators
153 TextSelectionToolbar(const TextSelectionToolbar&);
154 TextSelectionToolbar& operator=(const TextSelectionToolbar& rhs);
158 Layer mToolbarLayer; ///< The layer used to house the toolbar.
159 Toolkit::TableView mTableOfButtons; ///< Actor which holds all the buttons, sensitivity can be set on buttons via this actor
160 Toolkit::ScrollView mScrollView; ///< Provides scrolling of Toolbar when content does not fit.
161 RulerPtr mRulerX; ///< Ruler to clamp horizontal scrolling. Updates on Relayout
162 Size mMaxSize; ///< Max size of the Toolbar
163 unsigned int mIndexInTable; ///< Index in table to add option
164 Dali::Vector< unsigned int > mDividerIndexes; ///< Vector of indexes in the Toolbar that contain dividers.
168 } // namespace Internal
170 // Helpers for public-api forwarding methods
172 inline Toolkit::Internal::TextSelectionToolbar& GetImpl( Toolkit::TextSelectionToolbar& textSelectionToolbar )
174 DALI_ASSERT_ALWAYS( textSelectionToolbar );
176 Dali::RefObject& handle = textSelectionToolbar.GetImplementation();
178 return static_cast<Toolkit::Internal::TextSelectionToolbar&>(handle);
181 inline const Toolkit::Internal::TextSelectionToolbar& GetImpl( const Toolkit::TextSelectionToolbar& textSelectionToolbar )
183 DALI_ASSERT_ALWAYS( textSelectionToolbar );
185 const Dali::RefObject& handle = textSelectionToolbar.GetImplementation();
187 return static_cast<const Toolkit::Internal::TextSelectionToolbar&>(handle);
190 } // namespace Toolkit
194 #endif // DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H