• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_PROGRESS_PROGRESS_DATE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_PROGRESS_PROGRESS_DATE_H
18 
19 #include "base/geometry/dimension.h"
20 #include "core/components/common/properties/color.h"
21 #include "core/components_ng/property/property.h"
22 
23 namespace OHOS::Ace::NG {
24 
25 enum class ProgressType {
26     LINEAR = 1,
27     RING = 2,
28     SCALE = 3,
29     CIRCLE = 4,
30     GAUGE = 5,
31     ARC = 6,
32     MOON = 7,
33     BUBBLE = 8,
34     CAPSULE = 9,
35 };
36 
37 class ProgressTypeUtils {
38 public:
ConvertProgressTypeToString(ProgressType progressType)39     static std::string ConvertProgressTypeToString(ProgressType progressType)
40     {
41         std::string progressTypeUtils = "";
42         switch (progressType) {
43             case ProgressType::LINEAR:
44                 progressTypeUtils = "ProgressStyle.Linear";
45                 break;
46             case ProgressType::MOON:
47                 progressTypeUtils = "ProgressStyle.Eclipse";
48                 break;
49             case ProgressType::SCALE:
50                 progressTypeUtils = "ProgressStyle.ScaleRing";
51                 break;
52             case ProgressType::RING:
53                 progressTypeUtils = "ProgressStyle.Ring";
54                 break;
55             case ProgressType::CAPSULE:
56                 progressTypeUtils = "ProgressStyle.Capsule";
57                 break;
58             default:
59                 progressTypeUtils = "ProgressStyle.Linear";
60         }
61         return progressTypeUtils;
62     }
63 };
64 
65 struct ProgressDate {
66     ACE_DEFINE_PROPERTY_GROUP_ITEM(MaxValue, double);
67     ACE_DEFINE_PROPERTY_GROUP_ITEM(Value, double);
68     ACE_DEFINE_PROPERTY_GROUP_ITEM(StrokeWidth, Dimension);
69     ACE_DEFINE_PROPERTY_GROUP_ITEM(ScaleCount, int32_t);
70     ACE_DEFINE_PROPERTY_GROUP_ITEM(ScaleWidth, Dimension);
71 };
72 
73 struct ProgressStyle {
74     ACE_DEFINE_PROPERTY_GROUP_ITEM(Color, Color);
75     ACE_DEFINE_PROPERTY_GROUP_ITEM(BackgroundColor, Color);
76     ACE_DEFINE_PROPERTY_GROUP_ITEM(Type, ProgressType);
77 };
78 
79 } // namespace OHOS::Ace::NG
80 
81 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_PROGRESS_PROGRESS_DATE_H
82