1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TEXT_FIELD_TEXT_FIELD_ACCESSIBILITY_PROPERTY_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TEXT_FIELD_TEXT_FIELD_ACCESSIBILITY_PROPERTY_H
18 
19 #include <string>
20 
21 #include "base/utils/utils.h"
22 #include "core/components_ng/property/accessibility_property.h"
23 
24 namespace OHOS::Ace::NG {
25 class TextFieldAccessibilityProperty : public AccessibilityProperty {
26     DECLARE_ACE_TYPE(TextFieldAccessibilityProperty, AccessibilityProperty);
27 
28 public:
29     TextFieldAccessibilityProperty() = default;
30 
31     ~TextFieldAccessibilityProperty() override = default;
32 
33     int32_t GetTextLengthLimit() const override;
34 
35     bool IsPassword() const override;
36 
37     AceTextCategory GetTextInputType() const override;
38 
39     bool IsEditable() const override;
40 
41     bool IsMultiLine() const override;
42 
43     bool IsSelected() const override;
44 
45     int32_t GetTextSelectionStart() const override;
46 
47     int32_t GetTextSelectionEnd() const override;
48 
49     std::string GetText() const override;
50 
51     bool IsHint() const override;
52 
53     std::string GetHintText() const override;
54 
SetErrorText(const std::string & errorText)55     void SetErrorText(const std::string& errorText)
56     {
57         errorText_ = errorText;
58     }
59 
60     std::string GetErrorText() const override;
61 
62     bool GetContentInvalid() const override;
63 
64     bool IsScrollable() const override;
65 
66 protected:
67     void SetSpecificSupportAction() override;
68 
69 private:
70     std::string errorText_;
71 
72     ACE_DISALLOW_COPY_AND_MOVE(TextFieldAccessibilityProperty);
73 };
74 } // namespace OHOS::Ace::NG
75 
76 #endif
77