1 /* 2 * Copyright (c) 2024 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_INDICATOR_MODEL_NG_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_INDICATOR_MODEL_NG_H 18 19 #include "core/components_ng/pattern/swiper_indicator/indicator_common/indicator_model.h" 20 21 namespace OHOS::Ace::NG { 22 class ACE_EXPORT IndicatorModelNG : public OHOS::Ace::IndicatorModel { 23 public: 24 RefPtr<IndicatorController> Create() override; 25 void SetCount(uint32_t count) override; 26 void SetInitialIndex(uint32_t index) override; 27 void SetLoop(bool loop) override; 28 void SetDirection(Axis axis) override; 29 void SetIndicatorType(SwiperIndicatorType indicatorType) override; 30 void SetIndicatorStyle(const SwiperParameters& swiperParameters) override; 31 32 void SetDotIndicatorStyle(const SwiperParameters& swiperParameters) override; 33 void SetDigitIndicatorStyle(const SwiperDigitalParameters& swiperDigitalParameters) override; 34 void SetOnChange(std::function<void(const BaseEventInfo* info)>&& onChange) override; 35 void SetShowIndicator(bool showIndicator) override; 36 void SetIsIndicatorCustomSize(bool isCustomSize) override; 37 static RefPtr<FrameNode> CreateFrameNode(int32_t nodeId); 38 static void SetOnChange(FrameNode* frameNode, std::function<void(const BaseEventInfo* info)>&& onChange); 39 static void SetDigitIndicatorStyle(FrameNode* frameNode, const SwiperDigitalParameters& swiperDigitalParameters); 40 static void SetDotIndicatorStyle(FrameNode* frameNode, const SwiperParameters& swiperParameters); 41 static void SetIndicatorType(FrameNode* frameNode, SwiperIndicatorType indicatorType); 42 43 static bool GetLoop(FrameNode* frameNode); 44 static void SetInitialIndex(FrameNode* frameNode, uint32_t index); 45 static void SetCount(FrameNode* frameNode, uint32_t count); 46 static void SetLoop(FrameNode* frameNode, bool loop); 47 static void SetDirection(FrameNode* frameNode, Axis axis); 48 static void SetIsIndicatorCustomSize(FrameNode* frameNode, bool isCustomSize); 49 static void SetShowIndicator(FrameNode* frameNode, bool showIndicator); 50 static int32_t GetCount(FrameNode* frameNode); 51 static void ProcessDotSizeWithResourceObj(FrameNode* frameNode, const std::string& name, 52 const RefPtr<ResourceObject>& resObj); 53 static void ProcessDotColorWithResourceObj(FrameNode* frameNode, const std::string& name, 54 const RefPtr<ResourceObject>& resObj); 55 static void ProcessDigitalFontSizeWithResourceObj(FrameNode* frameNode, const std::string& name, 56 const RefPtr<ResourceObject>& resObj); 57 static void ProcessDigitalColorWithResourceObj(FrameNode* frameNode, const std::string& name, 58 const RefPtr<ResourceObject>& resObj); 59 static void CreateDotWithResourceObj(FrameNode* frameNode, const SwiperParameters& swiperParameters); 60 static void CreateDigitWithResourceObj(FrameNode* frameNode, 61 const SwiperDigitalParameters& swiperDigitalParameters); 62 }; 63 64 } // namespace OHOS::Ace::NG 65 66 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_INDICATOR_MODEL_NG_H 67