1 /* 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 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 OHOS_ACELITE_DIV_COMPONENT_H 17 #define OHOS_ACELITE_DIV_COMPONENT_H 18 #include "component.h" 19 #include "flex_layout.h" 20 #include "non_copyable.h" 21 22 namespace OHOS { 23 namespace ACELite { 24 class DivComponent final : public Component { 25 public: 26 27 ACE_DISALLOW_COPY_AND_MOVE(DivComponent); 28 DivComponent() = delete; 29 DivComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager); ~DivComponent()30 ~DivComponent() override {} 31 32 protected: 33 UIView *GetComponentRootView() const override; 34 bool ApplyPrivateStyle(const AppStyleItem* style) override; 35 bool ProcessChildren() override; 36 void PostUpdate(uint16_t attrKeyId) override; 37 void AttachView(const Component *child) override; 38 void LayoutChildren() override; 39 40 private: 41 void NativeViewSetDirection(const AppStyleItem* style, uint16_t stylePropNameId, 42 const char * const strValue, bool& applyResult); 43 void NativeViewSetLayoutDirection(uint16_t valueId, bool& applyResult); 44 void NativeViewSetMajorAxisAlign(uint16_t valueId, bool& applyResult); 45 bool isSecondaryAxisAlignSet_; 46 bool isVerticalLayout_; 47 FlexLayout nativeView_; 48 }; 49 } // namespace ACELite 50 } // namespace OHOS 51 52 #endif // OHOS_ACELITE_DIV_COMPONENT_H 53