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