[Tizen] Add DALi Autofill implementation
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / common / autofill-item-impl.h
1 #ifndef DALI_INTERNAL_AUTOFILL_ITEM_IMPL_H
2 #define DALI_INTERNAL_AUTOFILL_ITEM_IMPL_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/autofill-item.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 namespace Adaptor
34 {
35
36 /**
37  * @brief This class is used to pass on data from the AutofillItem of control.
38  */
39 class AutofillItem : public Dali::BaseObject
40 {
41
42 public:
43
44   /**
45    * @brief Constructor.
46    *
47    * @param[in] id A unique ID for this AutofillItem
48    * @param[in] label An auxiliary means to guess what data is
49    * @param[in] hint The hint - id (username), name, password, phone, credit card number, organization, and so on
50    * @param[in] sensitiveData Whether this AutofillItem is a sensitive data or not. (The default is false)
51    * @return A public handle to the newly allocated AutofillItem
52    */
53   static Dali::AutofillItem New( const std::string& id, const std::string& label, Dali::AutofillItem::Hint hint, bool sensitiveData );
54
55   /**
56    * @brief Initialize AutofillItem constructor.
57    */
58   virtual void Initialize() = 0;
59
60   /**
61    * @copydoc Dali::AutofillItem::GetId()
62    */
63   virtual const std::string& GetId() const = 0;
64
65   /**
66    * @copydoc Dali::AutofillItem::GetLabel()
67    */
68   virtual const std::string& GetLabel() const = 0;
69
70   /**
71    * @copydoc Dali::AutofillItem::GetHint()
72    */
73   virtual Dali::AutofillItem::Hint GetHint() const = 0;
74
75   /**
76    * @copydoc Dali::AutofillItem::IsSensitiveData()
77    */
78   virtual bool IsSensitiveData() const = 0;
79
80   /**
81    * @copydoc Dali::AutofillItem::SetSaveValue()
82    */
83   virtual void SetSaveValue( const std::string& value ) = 0;
84
85   /**
86    * @copydoc Dali::AutofillItem::GetSaveValue()
87    */
88   virtual const std::string& GetSaveValue() const = 0;
89
90   /**
91    * @brief Adds the presentation text to fill out in the list.
92    *
93    * @param[in] presentationText The presentation text to fill out
94    */
95   virtual void AddPresentationList( const std::string& presentationText ) = 0;
96
97   /**
98    * @brief Adds the value to fill out in the list.
99    *
100    * @param[in] fillValue The value to fill out
101    */
102   virtual void AddFillValueList( const std::string& fillValue ) = 0;
103
104   /**
105    * @copydoc Dali::AutofillItem::GetPresentationText()
106    */
107   virtual const std::string& GetPresentationText( int index ) const = 0;
108
109   /**
110    * @copydoc Dali::AutofillItem::GetFillValue()
111    */
112   virtual const std::string& GetFillValue( int index ) const = 0;
113
114   /**
115    * @copydoc Dali::AutofillItem::ClearPresentationTextList()
116    */
117   virtual void ClearPresentationTextList() = 0;
118
119   /**
120    * @copydoc Dali::AutofillItem::ClearFillValueList()
121    */
122   virtual void ClearFillValueList() = 0;
123
124   /**
125    * @copydoc Dali::AutofillItem::GetFillValueCount()
126    */
127   virtual unsigned int GetFillValueCount() = 0;
128
129 public:
130   /**
131    * Constructor.
132    */
133   AutofillItem() = default;
134
135 protected:
136   /**
137    * Destructor.
138    */
139   ~AutofillItem() = default;
140
141 private:
142   // Undefined copy constructor
143   AutofillItem( const AutofillItem& autofillItem ) = delete;
144
145   // Undefined assignment operator
146   AutofillItem& operator=( AutofillItem& autofillItem ) = delete;
147
148 };
149
150 inline static Internal::Adaptor::AutofillItem& GetImplementation(Dali::AutofillItem& autofillItem)
151 {
152   DALI_ASSERT_ALWAYS( autofillItem && "AutofillItem handle is empty" );
153
154   BaseObject& handle = autofillItem.GetBaseObject();
155
156   return static_cast<Internal::Adaptor::AutofillItem&>(handle);
157 }
158
159 inline static const Internal::Adaptor::AutofillItem& GetImplementation(const Dali::AutofillItem& autofillItem)
160 {
161   DALI_ASSERT_ALWAYS( autofillItem && "AutofillItem handle is empty" );
162
163   const BaseObject& handle = autofillItem.GetBaseObject();
164
165   return static_cast<const Internal::Adaptor::AutofillItem&>(handle);
166 }
167
168 } // namespace Adaptor
169
170 } // namespace Internal
171
172 } // namespace Dali
173
174 #endif // DALI_INTERNAL_AUTOFILL_ITEM_IMPL_H