Merge "Add InputFilter to TextField, TextEditor" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / text-controls / input-filter-properties.h
1 #ifndef DALI_INPUT_FILTER_PROPERTIES_H
2 #define DALI_INPUT_FILTER_PROPERTIES_H
3
4 /*
5  * Copyright (c) 2021 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 namespace Dali
22 {
23 namespace Toolkit
24 {
25 /**
26  * @addtogroup dali_toolkit_controls_text_controls
27  * @{
28  */
29
30 namespace InputFilter
31 {
32 /**
33  * @brief InputFilter Property.
34  * @SINCE_2_0.33
35  */
36 namespace Property
37 {
38 /**
39  * @brief Enumeration for the type of InputFilter.
40  *
41  * An enum that determines the input filter type of the InputFilter map.
42  * Users can set the ACCEPTED or REJECTED character set, or both.
43  * If both are used, REJECTED has higher priority.
44  * The character set must follow the regular expression rules.
45  * Behaviour can not be guaranteed for incorrect grammars.
46  *
47  * Useful Meta characters:
48  *
49  * | %Meta characters  | Description
50  * |-------------------|------------------------------------------------------------------------------------------------------------|
51  * | \\w               | Matches an alphanumeric character, including "_"; same as [A-Za-z0-9_].                                    |
52  * | \\W               | Matches a non-alphanumeric character, excluding "_"; same as [^A-Za-z0-9_].                                |
53  * | \\s               | Matches a whitespace character, which in ASCII are tab, line feed, form feed, carriage return, and space.  |
54  * | \\S               | Matches anything but a whitespace.                                                                         |
55  * | \\d               | Matches a digit; same as [0-9].                                                                            |
56  * | \\D               | Matches a non-digit; same as [^0-9].                                                                       |
57  *
58  * Example Usage:
59  * @code
60  *   Property::Map filter;
61  *   filter[InputFilter::Property::ACCEPTED] = "[\\d]"; // accept whole digits
62  *   filter[InputFilter::Property::REJECTED] = "[0-5]"; // reject 0, 1, 2, 3, 4, 5
63  *
64  *   field.SetProperty(DevelTextField::Property::INPUT_FILTER, filter); // acceptable inputs are 6, 7, 8, 9
65  * @endcode
66  * @SINCE_2_0.33
67  */
68 enum Type
69 {
70   /**
71    * @brief The set of characters to be accepted.
72    * @details Name "accepted", type Property::STRING.
73    * @SINCE_2_0.33
74    * @note Available on regex string.
75    */
76   ACCEPTED,
77
78   /**
79    * @brief The set of characters to be rejected.
80    * @details Name "rejected", type Property::STRING.
81    * @SINCE_2_0.33
82    * @note Available on regex string.
83    */
84   REJECTED
85 };
86
87 } // namespace Property
88
89 } // namespace InputFilter
90
91 /**
92  * @}
93  */
94
95 } // namespace Toolkit
96
97 } // namespace Dali
98
99 #endif // DALI_INPUT_FILTER_PROPERTIES_H