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