1 /* 2 * Copyright (c) 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 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 #ifndef OHOS_ACELITE_INPUT_RADIO_COMPONENT_H 16 #define OHOS_ACELITE_INPUT_RADIO_COMPONENT_H 17 #include "component.h" 18 #include "key_parser.h" 19 #include "non_copyable.h" 20 #include "ui_radio_button.h" 21 22 namespace OHOS { 23 namespace ACELite { 24 class InputRadioComponent final : public Component { 25 public: 26 ACE_DISALLOW_COPY_AND_MOVE(InputRadioComponent); 27 InputRadioComponent() = delete; InputRadioComponent(jerry_value_t options,jerry_value_t children,AppStyleManager * manager)28 InputRadioComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *manager) 29 : Component(options, children, manager), 30 changeListener_(nullptr), 31 clickListener_(nullptr), 32 normalBackGroundImg_(nullptr), 33 pressedBackGroundImg_(nullptr) 34 { 35 SetComponentName(K_INPUT); 36 } ~InputRadioComponent()37 ~InputRadioComponent() override {} 38 void ReleaseNativeViews() override; 39 bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override; 40 bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override; 41 bool ApplyPrivateStyle(const AppStyleItem *style) override; 42 void PostRender() override; 43 44 protected: GetComponentRootView()45 UIView *GetComponentRootView() const override 46 { 47 return const_cast<UIRadioButton *>(&radioButton_); 48 } 49 50 private: 51 void DealEvent(); 52 UIRadioButton radioButton_; 53 StateChangeListener *changeListener_; 54 ViewOnClickListener *clickListener_; 55 char *normalBackGroundImg_; 56 char *pressedBackGroundImg_; 57 }; 58 } // namespace ACELite 59 } // namespace OHOS 60 #endif // OHOS_ACELITE_INPUT_RADIO_COMPONENT_H 61