2 * Copyright (c) 2020-2021 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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef OHOS_ACELITE_INPUT_EDIT_TEXT_COMPONENT_H
17 #define OHOS_ACELITE_INPUT_EDIT_TEXT_COMPONENT_H
18 #include "acelite_config.h"
19 #if (FEATURE_COMPONENT_EDITTEXT == 1)
20 #include "component.h"
21 #include "flex_layout.h"
22 #include "non_copyable.h"
23 #include "key_parser.h"
24 #include "ui_edit_text.h"
28 class InputEditTextComponent final : public Component {
31 ACE_DISALLOW_COPY_AND_MOVE(InputEditTextComponent);
32 InputEditTextComponent() = delete;
33 InputEditTextComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *manager)
34 : Component(options, children, manager),
35 onValueChangeListener_(nullptr),
37 fontSize_(DEFAULT_FONT_SIZE)
39 SetComponentName(K_INPUT);
41 ~InputEditTextComponent() override {};
42 bool CreateNativeViews() override;
43 void ReleaseNativeViews() override;
44 bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override;
45 bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override;
46 bool ApplyPrivateStyle(const AppStyleItem *style) override;
47 void PostUpdate(uint16_t attrKeyId) override;
48 uint8_t GetFontSize();
50 UIView *GetComponentRootView() const override
52 return const_cast<UIEditText *>(&edittext_);
56 bool SetFontSize(const AppStyleItem *style);
57 bool SetColor(const AppStyleItem &style);
58 bool SetPlaceholderColor(const AppStyleItem &style);
60 ValueChangeListener* onValueChangeListener_;
64 } // namespace ACELite
66 #endif // FEATURE_COMPONENT_EDITTEXT
67 #endif // OHOS_ACELITE_INPUT_EDIT_TEXT_COMPONENT_H