1 /*
2  * Copyright (c) 2022-2023 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_GAUGE_MODEL_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GAUGE_MODEL_H
18 
19 #include <mutex>
20 
21 #include "base/memory/ace_type.h"
22 #include "core/components/common/properties/color.h"
23 #include "core/components_ng/pattern/gauge/gauge_paint_property.h"
24 #include "frameworks/base/geometry/dimension.h"
25 
26 namespace OHOS::Ace {
27 class ACE_FORCE_EXPORT GaugeModel {
28 public:
29     static GaugeModel* GetInstance();
30     virtual ~GaugeModel() = default;
31 
32     virtual void Create(float values, float min, float max) = 0;
33     virtual void SetValue(float value) = 0;
34     virtual void SetStartAngle(float startAngle) = 0;
35     virtual void SetEndAngle(float endAngle) = 0;
36     virtual void SetColors(const std::vector<Color>& colors, const std::vector<float>& values) = 0;
37     virtual void SetGradientColors(
38         const std::vector<NG::ColorStopArray>& colors, const std::vector<float>& values, const NG::GaugeType& type) = 0;
39     virtual void SetStrokeWidth(const Dimension& strokeWidth) = 0;
40     virtual void SetLabelMarkedText(const std::string labelTextString) = 0;
41     virtual void SetMarkedTextColor(const Color& color) = 0;
42     virtual void SetDescription(const RefPtr<AceType>& customNode) = 0;
43     virtual void SetIsShowLimitValue(bool isShowLimitValue) = 0;
44     virtual void SetIsShowDescription(bool isShowDescription) = 0;
45     virtual void SetShadowOptions(const NG::GaugeShadowOptions& shadowOptions) = 0;
46     virtual void SetIsShowIndicator(bool isShowIndicator) = 0;
47     virtual void SetIndicatorIconPath(
48         const std::string& iconPath, const std::string& bundleName, const std::string& moduleName) = 0;
49     virtual void SetIndicatorSpace(const Dimension& space) = 0;
50     virtual void ResetGradientColors() = 0;
51     virtual void ResetShadowOptions() = 0;
52     virtual void ResetIndicatorIconPath() = 0;
53     virtual void ResetIndicatorSpace() = 0;
54 
55 private:
56     static std::unique_ptr<GaugeModel> instance_;
57     static std::mutex mutex_;
58 };
59 } // namespace OHOS::Ace
60 
61 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GAUGE_MODEL_H