1 /*
2  * Copyright (c) 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_PATTERN_PICKER_PICKER_TYPE_DEFINE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PICKER_PICKER_TYPE_DEFINE_H
18 
19 #include <string>
20 
21 #include "core/components/common/properties/text_style.h"
22 #include "core/components/picker/picker_data.h"
23 #include "frameworks/base/i18n/time_format.h"
24 
25 namespace OHOS::Ace::NG {
26 // update flag of text properties
27 const uint32_t FLAG_DISAPPEAR_COLOR = 0x0001;
28 const uint32_t FLAG_COLOR = 0x0002;
29 const uint32_t FLAG_SELECTED_COLOR = 0x0004;
30 const uint32_t FLAG_DISAPPEAR_FONTSIZE = 0x0008;
31 const uint32_t FLAG_FONTSIZE = 0x0010;
32 const uint32_t FLAG_SELECTED_FONTSIZE = 0x0020;
33 const uint32_t FLAG_DISAPPEAR_WEIGHT = 0x0040;
34 const uint32_t FLAG_WEIGHT = 0x0080;
35 const uint32_t FLAG_SELECTED_WEIGHT = 0x0100;
36 struct PickerTextStyle {
37     std::optional<Color> textColor;
38     std::optional<Dimension> fontSize;
39     std::optional<FontWeight> fontWeight;
40     std::optional<std::vector<std::string>> fontFamily;
41     std::optional<Ace::FontStyle> fontStyle;
42 };
43 struct PickerTextProperties {
44     PickerTextStyle disappearTextStyle_;
45     PickerTextStyle normalTextStyle_;
46     PickerTextStyle selectedTextStyle_;
47 };
48 
49 // textpicker column kind
50 const uint32_t ICON = 0x01;
51 const uint32_t TEXT = 0x02;
52 const uint32_t MIXTURE = 0x03;
53 
54 struct RangeContent {
55     std::string icon_;
56     std::string text_;
57 };
58 
59 struct TextCascadePickerOptions {
60     std::vector<std::string> rangeResult;
61     std::vector<TextCascadePickerOptions> children;
62 };
63 
64 struct TextCascadePickerOptionsAttr {
65     bool isCascade = false;
66     bool isHasSelectAttr = false;
67 };
68 
69 struct CheckboxSettingData {
70     std::optional<Color> selectedColor;
71     std::optional<Color> unselectedColor;
72     std::optional<Color> strokeColor;
73 };
74 
75 struct DatePickerSettingData {
76     bool isLunar;
77     bool lunarswitch;
78     CheckboxSettingData checkboxSettingData;
79     bool showTime;
80     bool useMilitary;
81     std::map<std::string, PickerDate> datePickerProperty;
82     std::map<std::string, PickerTime> timePickerProperty;
83     PickerTextProperties properties;
84     DateTimeType dateTimeOptions;
85 };
86 
87 struct TextPickerSettingData {
88     std::vector<RangeContent> rangeVector;
89     uint32_t selected;
90     uint32_t columnKind;
91     Dimension height;
92     bool canLoop = true;
93     PickerTextProperties properties;
94     std::vector<uint32_t> selectedValues;
95     std::vector<std::string> values;
96     std::vector<NG::TextCascadePickerOptions> options;
97     NG::TextCascadePickerOptionsAttr attr;
98 };
99 
100 struct TimePickerSettingData {
101     bool isUseMilitaryTime;
102     PickerDate dialogTitleDate;
103     PickerTextProperties properties;
104     DateTimeType dateTimeOptions;
105     bool showSecond;
106 };
107 } // namespace OHOS::Ace::NG
108 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PICKER_PICKER_TYPE_DEFINE_H
109