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 24 namespace OHOS::Ace::NG { 25 // update flag of text properties 26 const uint32_t FLAG_DISAPPEAR_COLOR = 0x0001; 27 const uint32_t FLAG_COLOR = 0x0002; 28 const uint32_t FLAG_SELECTED_COLOR = 0x0004; 29 const uint32_t FLAG_DISAPPEAR_FONTSIZE = 0x0008; 30 const uint32_t FLAG_FONTSIZE = 0x0010; 31 const uint32_t FLAG_SELECTED_FONTSIZE = 0x0020; 32 const uint32_t FLAG_DISAPPEAR_WEIGHT = 0x0040; 33 const uint32_t FLAG_WEIGHT = 0x0080; 34 const uint32_t FLAG_SELECTED_WEIGHT = 0x0100; 35 struct PickerTextStyle { 36 std::optional<Color> textColor; 37 std::optional<Dimension> fontSize; 38 std::optional<FontWeight> fontWeight; 39 std::optional<std::vector<std::string>> fontFamily; 40 std::optional<Ace::FontStyle> fontStyle; 41 }; 42 struct PickerTextProperties { 43 PickerTextStyle disappearTextStyle_; 44 PickerTextStyle normalTextStyle_; 45 PickerTextStyle selectedTextStyle_; 46 }; 47 48 // textpicker column kind 49 const uint32_t ICON = 0x01; 50 const uint32_t TEXT = 0x02; 51 const uint32_t MIXTURE = 0x03; 52 53 struct RangeContent { 54 std::string icon_; 55 std::string text_; 56 }; 57 58 struct TextCascadePickerOptions { 59 std::vector<std::string> rangeResult; 60 std::vector<TextCascadePickerOptions> children; 61 }; 62 63 struct TextCascadePickerOptionsAttr { 64 bool isCascade = false; 65 bool isHasSelectAttr = false; 66 }; 67 68 struct DatePickerSettingData { 69 bool isLunar; 70 bool lunarswitch; 71 bool showTime; 72 bool useMilitary; 73 std::map<std::string, PickerDate> datePickerProperty; 74 std::map<std::string, PickerTime> timePickerProperty; 75 PickerTextProperties properties; 76 }; 77 78 struct TextPickerSettingData { 79 std::vector<RangeContent> rangeVector; 80 uint32_t selected; 81 uint32_t columnKind; 82 Dimension height; 83 bool canLoop = true; 84 PickerTextProperties properties; 85 std::vector<uint32_t> selectedValues; 86 std::vector<std::string> values; 87 std::vector<NG::TextCascadePickerOptions> options; 88 NG::TextCascadePickerOptionsAttr attr; 89 }; 90 91 struct TimePickerSettingData { 92 bool isUseMilitaryTime; 93 PickerDate dialogTitleDate; 94 PickerTextProperties properties; 95 }; 96 } // namespace OHOS::Ace::NG 97 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PICKER_PICKER_TYPE_DEFINE_H 98