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_NG_PATTERNS_MARQUEE_MODEL_NG_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_MARQUEE_MODEL_NG_H
18 
19 #include "core/components_ng/pattern/marquee/marquee_model.h"
20 
21 namespace OHOS::Ace::NG {
22 class ACE_EXPORT MarqueeModelNG : public OHOS::Ace::MarqueeModel {
23 public:
24     void Create() override;
25     void SetValue(const std::optional<std::string>& value) override;
26     void SetPlayerStatus(const std::optional<bool>& playerStatus) override;
27     void SetScrollAmount(const std::optional<double>& scrollAmount) override;
28     void SetLoop(const std::optional<int32_t>& loop) override;
29     void SetDirection(const std::optional<MarqueeDirection>& direction) override;
30     void SetTextColor(const std::optional<Color>& textColor) override;
31     void SetFontSize(const std::optional<Dimension>& fontSize) override;
32     void SetFontWeight(const std::optional<FontWeight>& fontWeight) override;
33     void SetFontFamily(const std::optional<std::vector<std::string>>& fontFamilies) override;
34     void SetAllowScale(const std::optional<bool>& allowScale) override;
35     void SetMarqueeUpdateStrategy(const std::optional<MarqueeUpdateStrategy>& marqueeUpdateStrategy) override;
36     void SetOnStart(std::function<void()>&& onChange) override;
37     void SetOnBounce(std::function<void()>&& onChange) override;
38     void SetOnFinish(std::function<void()>&& onChange) override;
39 
40     static RefPtr<FrameNode> CreateFrameNode(int32_t nodeId);
41     static void SetAllowScale(FrameNode* frameNode, const bool allowScale);
42     static void SetFontWeight(FrameNode* frameNode, const std::optional<FontWeight>& fontWeight);
43     static void SetFontFamily(FrameNode* frameNode, const std::optional<std::vector<std::string>>& fontFamilies);
44     static void SetFontSize(FrameNode* frameNode, const std::optional<Dimension>& fontSize);
45     static void SetTextColor(FrameNode* frameNode, const std::optional<Color>& textColor);
46     static void SetMarqueeUpdateStrategy(FrameNode* frameNode,
47         const std::optional<MarqueeUpdateStrategy>& marqueeUpdateStrategy);
48     static void SetOnStart(FrameNode* frameNode, std::function<void()>&& onChange);
49     static void SetOnBounce(FrameNode* frameNode, std::function<void()>&& onChange);
50     static void SetOnFinish(FrameNode* frameNode, std::function<void()>&& onChange);
51     static void SetMarqueeFrameRateRange(
52         FrameNode* frameNode, const RefPtr<FrameRateRange>& rateRange, MarqueeDynamicSyncSceneType type);
53     static void SetValue(FrameNode* frameNode, const std::optional<std::string>& value);
54     static void ResetValue(FrameNode* frameNode);
55     static void SetPlayerStatus(FrameNode* frameNode, const std::optional<bool>& playerStatus);
56     static void ResetPlayerStatus(FrameNode* frameNode);
57     static void SetScrollAmount(FrameNode* frameNode, const std::optional<double>& scrollAmount);
58     static void ResetScrollAmount(FrameNode* frameNode);
59     static void SetLoop(FrameNode* frameNode, const std::optional<int32_t>& loop);
60     static void ResetLoop(FrameNode* frameNode);
61     static void SetDirection(FrameNode* frameNode, const std::optional<MarqueeDirection>& direction);
62     static void ResetDirection(FrameNode* frameNode);
63 };
64 } // namespace OHOS::Ace::NG
65 
66 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_MARQUEE_MODEL_NG_H
67