1 #ifndef DALI_TOOLKIT_INTERNAL_AUTOFILL_CONTAINER_H
2 #define DALI_TOOLKIT_INTERNAL_AUTOFILL_CONTAINER_H
5 * Copyright (c) 2019 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/public-api/object/base-object.h>
23 #include <dali/devel-api/adaptor-framework/autofill-manager.h>
27 #include <dali-toolkit/public-api/controls/control-impl.h>
28 #include <dali-toolkit/devel-api/controls/text-controls/autofill-container.h>
41 * @copydoc Toolkit::AutofillContainer
43 class AutofillContainer : public Dali::BaseObject
48 * @copydoc Dali::Toollkit::AutofillContainer::New()
50 static Toolkit::AutofillContainer New( const std::string& name );
53 * @brief Initialize AutofillContainer
55 void Initialize( const std::string& name );
58 * @copydoc Dali::Toollkit::AutofillContainer::AddAutofillItem()
60 void AddAutofillItem( Dali::Toolkit::Control control, Dali::Property::Index propertyIndex, const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool isSensitive );
63 * @copydoc Dali::Toollkit::AutofillContainer::RemoveAutofillItem()
65 void RemoveAutofillItem( Dali::Toolkit::Control control );
68 * @brief Gets AutofillGroup setting to AutofillContainer.
70 * @return The AutofillGroup instance
72 Dali::AutofillGroup GetAutofillGroup();
75 * @copydoc Dali::Toollkit::AutofillContainer::SetFocusedControl()
77 void SetFocusedControl( Toolkit::Control focused );
80 * @copydoc Dali::Toollkit::AutofillContainer::GetFocusedControl()
82 Toolkit::Control GetFocusedControl();
85 * @copydoc Dali::Toollkit::AutofillContainer::SaveAutofillData()
87 void SaveAutofillData();
90 * @copydoc Dali::Toollkit::AutofillContainer::RequestFillData()
92 void RequestFillData();
95 * @brief Sets the Autofill Service Name
97 * @param serviceName Autofill Service Name
99 void SetAutofillServiceName( const std::string& serviceName );
102 * @copydoc Dali::Toollkit::AutofillContainer::GetAutofillServiceName()
104 const std::string& GetAutofillServiceName() const;
107 * @brief Sets the Autofill Service Message
109 * @param serviceMessage Autofill Service Message
111 void SetAutofillServiceMessage( const std::string& serviceMessage );
114 * @copydoc Dali::Toollkit::AutofillContainer::GetAutofillServiceMessage()
116 const std::string& GetAutofillServiceMessage() const;
119 * @brief Sets the Autofill Service Image Path
121 * @param serviceImagePath Autofill Service Image Path
123 void SetAutofillServiceImagePath( const std::string& serviceImagePath );
126 * @copydoc Dali::Toollkit::AutofillContainer::GetAutofillServiceImagePath()
128 const std::string& GetAutofillServiceImagePath() const;
131 * @copydoc Dali::Toollkit::AutofillContainer::GetListCount()
133 unsigned int GetListCount();
136 * @copydoc Dali::Toollkit::AutofillContainer::GetListItem()
138 const std::string& GetListItem( unsigned int index ) const;
141 * @copydoc Dali::Toollkit::AutofillContainer::SetSelectedItem()
143 void SetSelectedItem( const std::string& selected );
146 * @brief Callback when Autofill Authentication information is recieved.
148 void OnAutofillAuthReceived();
151 * @brief Callback when Autofill Fill Response is recieved.
152 * @param[in] item The callback parameter
154 void OnDataFillReceived( Dali::AutofillItem item );
157 * @brief Callback when the values to be filled are multiple.
159 void OnListReceived();
162 * @copydoc Dali::Toollkit::AutofillContainer::AutofillServiceShownSignal()
164 Toolkit::AutofillContainer::AuthenticationSignalType& AutofillServiceShownSignal();
167 * @copydoc Dali::Toollkit::AutofillContainer::AutofillListShownSignal()
169 Toolkit::AutofillContainer::ListShownSignalType& AutofillListShownSignal();
172 * Connects a callback function with the object's signals.
173 * @param[in] object The object providing the signal.
174 * @param[in] tracker Used to disconnect the signal.
175 * @param[in] signalName The signal to connect to.
176 * @param[in] functor A newly allocated FunctorDelegate.
177 * @return True if the signal was connected.
178 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
180 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
183 private: // Implementation
186 * Construct a new AutofillContainer.
191 * A reference counted object may only be deleted by calling Unreference()
193 virtual ~AutofillContainer();
197 // Undefined copy constructor and assignment operators
198 AutofillContainer(const AutofillContainer&);
199 AutofillContainer& operator=(const AutofillContainer& rhs);
203 Dali::AutofillManager mAutofillManager;
204 Dali::AutofillGroup mAutofillGroup;
205 std::vector<Dali::Toolkit::Control> mControlItemList; ///< The List of Control adding to AutofillContainer
206 //std::map<Dali::Toolkit::Control, Dali::AutofillItem> mControlList;
207 std::vector< std::pair< Dali::Toolkit::Control, Dali::AutofillItem > > mControlList;
209 SlotDelegate< AutofillContainer > mSlotDelegate;
211 Property::Index mPropertyIndex; ///< The index of property registered by each control
213 Toolkit::AutofillContainer::AuthenticationSignalType mAuthenticationEventSignal;
214 Toolkit::AutofillContainer::ListShownSignalType mListEventSignal;
216 std::string mAutofillServiceName;
217 std::string mAutofillServiceMessage;
218 std::string mAutofillServiceImagePath;
220 Toolkit::Control mCurrentFocused;
223 } // namespace Internal
225 // Helpers for public-api forwarding methods
227 inline Toolkit::Internal::AutofillContainer& GetImpl( Toolkit::AutofillContainer& autofillContainer )
229 DALI_ASSERT_ALWAYS(autofillContainer);
231 Dali::BaseObject& handle = autofillContainer.GetBaseObject();
233 return static_cast<Toolkit::Internal::AutofillContainer&>(handle);
236 inline const Toolkit::Internal::AutofillContainer& GetImpl( const Toolkit::AutofillContainer& autofillContainer )
238 DALI_ASSERT_ALWAYS(autofillContainer);
240 const Dali::BaseObject& handle = autofillContainer.GetBaseObject();
242 return static_cast<const Toolkit::Internal::AutofillContainer&>(handle);
245 } // namespace Toolkit
249 #endif // DALI_TOOLKIT_INTERNAL_AUTOFILL_CONTAINER_H