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_V2_LIST_LIST_PROPERTIES_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_LIST_LIST_PROPERTIES_H 18 19 #include <string> 20 21 #include "base/geometry/dimension.h" 22 #include "base/utils/macros.h" 23 #include "core/components/common/properties/color.h" 24 #include "core/components/scroll/scrollable.h" 25 26 namespace OHOS::Ace { 27 28 namespace V2 { 29 30 enum class ListItemAlign { 31 /* 32 * display list item at start of cross axis. 33 */ 34 START = 0, 35 36 /* 37 * display list item at center of cross axis. 38 */ 39 CENTER, 40 41 /* 42 * display list item at center of cross axis. 43 */ 44 END, 45 }; 46 47 enum class StickyStyle : uint32_t { 48 NONE = 0, 49 HEADER = 1, 50 FOOTER = 2, 51 BOTH = 3, 52 }; 53 54 enum class StickyMode { 55 NONE = 0, 56 NORMAL, 57 OPACITY, 58 }; 59 60 enum class ScrollSnapAlign { 61 NONE = 0, 62 START, 63 CENTER, 64 END, 65 }; 66 67 enum class SwipeEdgeEffect { 68 Spring = 0, 69 None, 70 }; 71 72 enum class ListItemStyle { 73 NONE = 0, 74 CARD, 75 }; 76 77 enum class ListItemGroupStyle { 78 NONE = 0, 79 CARD, 80 }; 81 82 struct EditMode { 83 enum : uint32_t { 84 NONE = 0, 85 DELETABLE = (1 << 0), 86 MOVABLE = (1 << 1), 87 SHAM = (1 << 2), // this enum value [SHAM] is added for inspector use, it works as [NONE] 88 }; 89 }; 90 91 struct ItemDivider final { 92 Dimension strokeWidth = 0.0_vp; 93 Dimension startMargin = 0.0_vp; 94 Dimension endMargin = 0.0_vp; 95 Color color = Color::TRANSPARENT; 96 bool operator==(const ItemDivider& itemDivider) const 97 { 98 return (strokeWidth == itemDivider.strokeWidth) && (startMargin == itemDivider.startMargin) && 99 (endMargin == itemDivider.endMargin) && (color == itemDivider.color); 100 } 101 }; 102 } // namespace V2 103 104 struct ChainAnimationOptions { 105 CalcDimension minSpace; 106 CalcDimension maxSpace; 107 double conductivity = 0; 108 double intensity = 0; 109 int32_t edgeEffect = 0; 110 double stiffness = 0; 111 double damping = 0; 112 }; 113 114 using OnItemDeleteEvent = std::function<bool(int32_t)>; 115 using OnItemMoveEvent = std::function<bool(int32_t, int32_t)>; 116 using OnItemDragStartFunc = std::function<RefPtr<AceType>(const ItemDragInfo&, int32_t)>; 117 using OnItemDragEnterFunc = std::function<void(const ItemDragInfo&)>; 118 using OnItemDragMoveFunc = std::function<void(const ItemDragInfo&, int32_t, int32_t)>; 119 using OnItemDragLeaveFunc = std::function<void(const ItemDragInfo&, int32_t)>; 120 using OnItemDropFunc = std::function<void(const ItemDragInfo&, int32_t, int32_t, bool)>; 121 using OnSelectFunc = std::function<void(bool)>; 122 using OnDeleteEvent = std::function<void()>; 123 using OnEnterDeleteAreaEvent = std::function<void()>; 124 using OnExitDeleteAreaEvent = std::function<void()>; 125 using OnOffsetChangeFunc = std::function<void(int32_t)>; 126 using OnStateChangedEvent = std::function<void(SwipeActionState)>; 127 128 } // namespace OHOS::Ace 129 130 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_LIST_LIST_ITEM_GROUP_COMPONENT_H 131