1 /* 2 * Copyright (c) 2021-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 FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_LIST_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_LIST_H 18 19 #include "bridge/declarative_frontend/engine/functions/js_function.h" 20 #include "bridge/declarative_frontend/jsview/js_scrollable_base.h" 21 #include "bridge/declarative_frontend/jsview/js_scroller.h" 22 23 namespace OHOS::Ace::Framework { 24 25 class JSListScroller : public JSScroller { 26 public: 27 static void JSBind(BindingTarget globalObj); 28 static void Constructor(const JSCallbackInfo& args); 29 static void Destructor(JSListScroller* scroller); 30 31 void GetItemRectInGroup(const JSCallbackInfo& args); 32 void ScrollToItemInGroup(const JSCallbackInfo& args); 33 void CloseAllSwipeActions(const JSCallbackInfo& args); 34 }; 35 36 class JSList : public JSScrollableBase { 37 public: 38 static void JSBind(BindingTarget globalObj); 39 static void SetScroller(RefPtr<JSScroller> scroller); 40 static void Create(const JSCallbackInfo& args); 41 42 static void JsWidth(const JSCallbackInfo& info); 43 static void JsHeight(const JSCallbackInfo& info); 44 static void ScrollCallback(const JSCallbackInfo& args); 45 static void ReachStartCallback(const JSCallbackInfo& args); 46 static void ReachEndCallback(const JSCallbackInfo& args); 47 static void ScrollStartCallback(const JSCallbackInfo& args); 48 static void ScrollStopCallback(const JSCallbackInfo& args); 49 static void ItemDeleteCallback(const JSCallbackInfo& args); 50 static void ItemMoveCallback(const JSCallbackInfo& args); 51 static void ScrollIndexCallback(const JSCallbackInfo& args); 52 static void ScrollBeginCallback(const JSCallbackInfo& args); 53 static void ScrollFrameBeginCallback(const JSCallbackInfo& args); 54 55 static void SetDivider(const JSCallbackInfo& args); 56 static void SetDirection(int32_t direction); 57 static void SetScrollBar(const JSCallbackInfo& info); 58 static void SetScrollBarColor(const std::string& color); 59 static void SetScrollBarWidth(const JSCallbackInfo& scrollWidth); 60 static void SetEdgeEffect(const JSCallbackInfo& info); 61 static void SetEditMode(bool editMode); 62 static void SetCachedCount(const JSCallbackInfo& info); 63 static void SetChainAnimation(bool enableChainAnimation); 64 static void SetChainAnimationOptions(const JSCallbackInfo& info); 65 static void SetMultiSelectable(bool multiSelectable); 66 static void SetListItemAlign(int32_t itemAlignment); 67 static void SetLanes(const JSCallbackInfo& info); 68 static void SetSticky(int32_t sticky); 69 static void SetContentStartOffset(const JSCallbackInfo& info); 70 static void SetContentEndOffset(const JSCallbackInfo& info); 71 static void SetNestedScroll(const JSCallbackInfo& args); 72 static void SetScrollEnabled(const JSCallbackInfo& args); 73 static void SetScrollSnapAlign(int32_t scrollSnapAlign); 74 static void SetFriction(const JSCallbackInfo& info); 75 76 static void ItemDragStartCallback(const JSCallbackInfo& info); 77 static void ItemDragEnterCallback(const JSCallbackInfo& info); 78 static void ItemDragMoveCallback(const JSCallbackInfo& info); 79 static void ItemDragLeaveCallback(const JSCallbackInfo& info); 80 static void ItemDropCallback(const JSCallbackInfo& info); 81 }; 82 83 } // namespace OHOS::Ace::Framework 84 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_LIST_H 85