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_MODELS_REFRESH_MODEL_IMPL_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_REFRESH_MODEL_IMPL_H
18 
19 #include <optional>
20 #include <string>
21 
22 #include "frameworks/core/components/refresh/refresh_component.h"
23 #include "frameworks/core/components_ng/pattern/refresh/refresh_model.h"
24 
25 namespace OHOS::Ace::Framework {
26 
27 class ACE_EXPORT RefreshModelImpl : public RefreshModel {
28 public:
29     void Create() override;
30     void Pop() override;
31     void SetRefreshing(bool isRefreshing) override;
32     void SetRefreshDistance(const Dimension& refreshDistance) override;
33     void SetUseOffset(bool isUseOffset) override;
34     void SetIndicatorOffset(const Dimension& indicatorOffset) override;
35     void SetFriction(int32_t friction) override;
36     void IsRefresh(bool isRefresh) override;
37     void SetLoadingDistance(const Dimension& loadingDistance) override;
38     void SetProgressDistance(const Dimension& progressDistance) override;
39     void SetProgressDiameter(const Dimension& progressDiameter) override;
40     void SetMaxDistance(const Dimension& maxDistance) override;
41     void SetIsShowLastTime(bool IsShowLastTime) override;
42     void SetShowTimeDistance(const Dimension& showTimeDistance) override;
43     void SetTextStyle(const TextStyle& textStyle) override;
44     void SetProgressColor(const Color& progressColor) override;
45     void SetProgressBackgroundColor(const Color& backgroundColor) override;
46     void SetOnStateChange(std::function<void(const int32_t)>&& stateChange) override;
47     void SetOnRefreshing(std::function<void()>&& refreshing) override;
48     void SetOnOffsetChange(std::function<void(const float)>&& offsetChange) override;
49     void ResetOnOffsetChange() override;
50     void SetChangeEvent(std::function<void(const std::string)>&& changeEvent) override;
51     void SetCustomBuilder(const RefPtr<NG::UINode>& customBuilder) override;
52     void SetLoadingText(const std::string& loadingText) override;
SetRefreshOffset(const Dimension & offset)53     void SetRefreshOffset(const Dimension& offset) override {};
SetPullToRefresh(bool isPullToRefresh)54     void SetPullToRefresh(bool isPullToRefresh) override {};
55 private:
56     static RefPtr<RefreshComponent> GetComponent();
57 };
58 
59 } // namespace OHOS::Ace::Framework
60 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_REFRESH_MODEL_IMPL_H
61