1 /*
2  * Copyright (c) 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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SCROLL_BAR_SCROLL_BAR_MODEL_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SCROLL_BAR_SCROLL_BAR_MODEL_H
18 
19 #include <mutex>
20 
21 #include "base/memory/referenced.h"
22 #include "core/components/scroll_bar/scroll_bar_component.h"
23 #include "core/components/scroll_bar/scroll_bar_proxy.h"
24 #include "core/components/scroll_bar/scroll_proxy.h"
25 #include "core/components_ng/pattern/scroll_bar/proxy/scroll_bar_proxy.h"
26 #include "core/components_ng/pattern/scroll_bar/scroll_bar_pattern.h"
27 #include "core/components_ng/pattern/scroll_bar/scroll_bar_model.h"
28 
29 namespace OHOS::Ace {
30 class ACE_FORCE_EXPORT ScrollBarModel {
31 public:
32     static ScrollBarModel* GetInstance();
33     virtual ~ScrollBarModel() = default;
34 
35     virtual RefPtr<ScrollProxy> GetScrollBarProxy(const RefPtr<ScrollProxy>& scrollProxy) = 0;
36     virtual void Create(const RefPtr<ScrollProxy>& proxy, bool infoflag, bool proxyFlag,
37         int directionValue, int stateValue) = 0;
38     virtual void SetEnableNestedScroll(bool enableNestedSroll) = 0;
39 private:
40     static std::unique_ptr<ScrollBarModel> instance_;
41     static std::mutex mutex_;
42 };
43 } // namespace OHOS::Ace
44 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_SCROLL_BAR_SCROLL_BAR_MODEL_H
45