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_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_INDICATOR_MODEL_H 18 19 #include "base/geometry/axis.h" 20 #include "core/components/declaration/swiper/swiper_declaration.h" 21 #include "core/components_ng/pattern/swiper_indicator/indicator_common/indicator_controller.h" 22 23 namespace OHOS::Ace { 24 25 class ACE_EXPORT IndicatorModel { 26 public: 27 static IndicatorModel* GetInstance(); 28 virtual ~IndicatorModel() = default; 29 30 virtual RefPtr<NG::IndicatorController> Create() = 0; 31 virtual void SetInitialIndex(uint32_t index) = 0; 32 virtual void SetCount(uint32_t count) = 0; 33 virtual void SetLoop(bool loop) = 0; 34 virtual void SetDirection(Axis axis) = 0; 35 virtual void SetOnChange(std::function<void(const BaseEventInfo* info)>&& onChange) = 0; 36 virtual void SetIndicatorStyle(const SwiperParameters& swiperParameters) = 0; 37 virtual void SetIndicatorType(SwiperIndicatorType indicatorType) = 0; 38 virtual void SetIsIndicatorCustomSize(bool isCustomSize) = 0; 39 virtual void SetDotIndicatorStyle(const SwiperParameters& swiperParameters) = 0; 40 virtual void SetDigitIndicatorStyle(const SwiperDigitalParameters& swiperDigitalParameters) = 0; 41 virtual void SetShowIndicator(bool showIndicator) = 0; 42 private: 43 static std::unique_ptr<IndicatorModel> instance_; 44 static std::mutex mutex_; 45 }; 46 47 } // namespace OHOS::Ace 48 49 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_INDICATOR_MODEL_NG_H 50