• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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_TEXTTIMER_TEXTTIMER_COMPONENT_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEXTTIMER_TEXTTIMER_COMPONENT_H
18 
19 #include <string>
20 #include "core/components_v2/common/common_def.h"
21 #include "core/components/declaration/texttimer/texttimer_declaration.h"
22 #include "core/components/texttimer/texttimer_controller.h"
23 #include "core/pipeline/base/render_component.h"
24 #include "core/pipeline/base/sole_child_component.h"
25 
26 namespace OHOS::Ace {
27 class ACE_EXPORT TextTimerComponent : public SoleChildComponent {
28     DECLARE_ACE_TYPE(TextTimerComponent, SoleChildComponent);
29 
30 public:
31     TextTimerComponent();
32     ~TextTimerComponent() override = default;
33 
34     RefPtr<RenderNode> CreateRenderNode() override;
35     RefPtr<Element> CreateElement() override;
36 
37     double GetInputCount() const;
38     void SetInputCount(double value);
39 
40     bool GetIsCountDown() const;
41     void SetIsCountDown(bool isCountDown);
42 
43     const std::string& GetFormat() const;
44     void SetFormat(const std::string& value);
45 
46     const TextStyle& GetTextStyle() const;
47     void SetTextStyle(const TextStyle& style);
48 
49     RefPtr<TextTimerController> GetTextTimerController() const;
50 
51     ACE_DEFINE_COMPONENT_EVENT(OnTimer, void(int64_t, int64_t));
52 
53 private:
54     RefPtr<TextTimerController> textTimerController_;
55     RefPtr<TextTimerDeclaration> declaration_;
56 };
57 } // namespace OHOS::Ace
58 
59 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEXTTIMER_TEXTTIMER_COMPONENT_H