[Tizen] Add DALi Autofill implementation
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / autofill-item.h
1 #ifndef DALI_AUTOFILL_ITEM_H
2 #define DALI_AUTOFILL_ITEM_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-handle.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/dali-adaptor-common.h>
26
27 namespace Dali
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 namespace Adaptor
33 {
34 class AutofillItem;
35 }
36 }
37
38
39 /**
40  * @brief The AutofillItem class
41  *
42  * is used to pass on data from the AutofillItem.
43  * AutofillItem includes Id, Label, Autofill Hint, and whether it is sensitive or not.
44  */
45 class DALI_ADAPTOR_API AutofillItem : public BaseHandle
46 {
47 public:
48
49   /**
50    * @brief Enumeration for hint of the autofill item.
51    */
52   enum class Hint
53   {
54     CREDIT_CARD_EXPIRATION_DATE,      ///< Autofill hint for a credit card expiration date
55     CREDIT_CARD_EXPIRATION_DAY,       ///< Autofill hint for a credit card expiration day
56     CREDIT_CARD_EXPIRATION_MONTH,     ///< Autofill hint for a credit card expiration month
57     CREDIT_CARD_EXPIRATION_YEAR,      ///< Autofill hint for a credit card expiration year
58     CREDIT_CARD_NUMBER,               ///< Autofill hint for a credit card number
59     EMAIL_ADDRESS,                    ///< Autofill hint for an email address
60     NAME,                             ///< Autofill hint for a user's real name
61     PHONE,                            ///< Autofill hint for a phone number
62     POSTAL_ADDRESS,                   ///< Autofill hint for a postal address
63     POSTAL_CODE,                      ///< Autofill hint for a postal code
64     ID,                               ///< Autofill hint for a user's ID
65     PASSWORD,                         ///< Autofill hint for password
66     CREDIT_CARD_SECURITY_CODE         ///< Autofill hint for a credit card security code
67   };
68
69 public:
70
71   /**
72    * @brief Creates an uninitialized AutofillItem.
73    *
74    * To create AutofillItem instance, please refer to Dali::AutofillManager::CreateAutofillItem().
75    */
76   AutofillItem();
77
78   /**
79    * @brief AutofillItem Destructor.
80    */
81   ~AutofillItem();
82
83   /**
84     * @brief Copy constructor.
85     *
86     * @param[in] item AutofillItem to copy. The copied player will point at the same implementation
87     */
88    AutofillItem( const AutofillItem& item );
89
90   /**
91     * @brief Assignment operator.
92     *
93     * @param[in] item The AutofillItem to assign from.
94     * @return The updated AutofillItem.
95     */
96    AutofillItem& operator=( const AutofillItem& item );
97
98   /**
99    * @brief Downcast a handle to AutofillItem handle.
100    *
101    * If handle points to a AutofillItem the downcast produces valid
102    * handle. If not the returned handle is left uninitialized.
103    *
104    * @param[in] handle Handle to an object
105    * @return Handle to a AutofillItem or an uninitialized handle
106    */
107   static AutofillItem DownCast( BaseHandle handle );
108
109   /**
110    * @brief Equality operator.
111    *
112    * @param[in] rhs The AutofillItem structure to test against
113    * @return True if AutofillItems are equal
114    */
115   bool operator==( const AutofillItem& rhs ) const
116   {
117     if( &rhs == this )
118     {
119       return true;
120     }
121     return false;
122   }
123
124   /**
125    * @brief Gets AutofillItem Id.
126    *
127    * @return AutofillItem Id
128    */
129   const std::string& GetId() const;
130
131   /**
132    * @brief Gets AutofillItem Label.
133    *
134    * @return AutofillItem Label
135    */
136   const std::string& GetLabel() const;
137
138   /**
139    * @brief Gets AutofillItem Hint.
140    *
141    * @return AutofillItem Hint
142    */
143   Dali::AutofillItem::Hint GetHint() const;
144
145   /**
146    * @brief Gets whether AutofillItem is sensitive data or not.
147    *
148    * @return True if the AutofillItem is sensitive.
149    */
150   bool IsSensitiveData() const;
151
152   /**
153    * @brief Sets AutofillItem value for saving.
154    *
155    * @param[in] value The value for saving
156    */
157   void SetSaveValue( const std::string& value );
158
159   /**
160    * @brief Gets the saved value of AutofillItem.
161    *
162    * @return The saved value
163    */
164   const std::string& GetSaveValue() const;
165
166   /**
167    * @brief Gets the presentation text with a index of the list.
168    *
169    * @param index The index for the presentation text list
170    * @return The presentation text to show up for the fill value
171    */
172   const std::string& GetPresentationText( int index ) const;
173
174   /**
175    * @brief Gets the value to be filled with a index of the list.
176    *
177    * @param index The index for the value list
178    * @return The value to be filled
179    */
180   const std::string& GetFillValue( int index ) const;
181
182   /**
183    * @brief Clears the presentation text list.
184    */
185   void ClearPresentationTextList();
186
187   /**
188    * @brief Clears the value list.
189    */
190   void ClearFillValueList();
191
192   /**
193    * @brief Gets the number of fill value in the list.
194    *
195    * @return The number of fill value in the list
196    */
197   unsigned int GetFillValueCount();
198
199 public: // Not intended for application developers
200
201   /**
202    * @brief Internal constructor
203    */
204   explicit DALI_INTERNAL AutofillItem( Internal::Adaptor::AutofillItem* internal );
205
206 };
207
208 } // namespace Dali
209
210 #endif // DALI_AUTOFILL_ITEM_H