1 /* 2 * Copyright (c) 2021 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_REFRESH_REFRESH_CONTROLLER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_REFRESH_REFRESH_CONTROLLER_H 18 19 #include "core/pipeline/base/render_node.h" 20 21 namespace OHOS::Ace { 22 23 enum class RefreshStatus { 24 // The default status. 25 INACTIVE = 0, 26 // While being dragged but not enough to trig refresh. 27 DRAG, 28 // Dragging enough to refresh, and less than the max distance. 29 OVER_DRAG, 30 // While it is refreshing. 31 REFRESH, 32 // While it will scroll back to the top after refreshing. 33 DONE, 34 }; 35 36 class RefreshController : public AceType { 37 DECLARE_ACE_TYPE(RefreshController, AceType); 38 39 public: 40 RefreshController() = default; 41 ~RefreshController() override = default; 42 SetRefresh(const WeakPtr<RenderNode> & refresh)43 void SetRefresh(const WeakPtr<RenderNode>& refresh) 44 { 45 refresh_ = refresh; 46 } 47 48 private: 49 WeakPtr<RenderNode> refresh_; 50 }; 51 52 } // namespace OHOS::Ace 53 54 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_REFRESH_REFRESH_CONTROLLER_H 55