• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "core/components/texttimer/texttimer_component.h"
17 
18 #include "base/i18n/localization.h"
19 #include "core/components/texttimer/render_texttimer.h"
20 #include "core/components/texttimer/texttimer_element.h"
21 
22 namespace OHOS::Ace {
TextTimerComponent()23 TextTimerComponent::TextTimerComponent()
24 {
25     if (!declaration_) {
26         declaration_ = AceType::MakeRefPtr<TextTimerDeclaration>();
27         declaration_->Init();
28     }
29 }
30 
CreateRenderNode()31 RefPtr<RenderNode> TextTimerComponent::CreateRenderNode()
32 {
33     return RenderTextTimer::Create();
34 }
35 
CreateElement()36 RefPtr<Element> TextTimerComponent::CreateElement()
37 {
38     return AceType::MakeRefPtr<TextTimerElement>();
39 }
40 
GetInputCount() const41 double TextTimerComponent::GetInputCount() const
42 {
43     return declaration_->GetInputCount();
44 }
45 
SetInputCount(double value)46 void TextTimerComponent::SetInputCount(double value)
47 {
48     declaration_->SetInputCount(value);
49 }
50 
GetIsCountDown() const51 bool TextTimerComponent::GetIsCountDown() const
52 {
53     return declaration_->GetIsCountDown();
54 }
55 
SetIsCountDown(bool isCountDown)56 void TextTimerComponent::SetIsCountDown(bool isCountDown)
57 {
58     declaration_->SetIsCountDown(isCountDown);
59 }
60 
GetFormat() const61 const std::string& TextTimerComponent::GetFormat() const
62 {
63     return declaration_->GetFormat();
64 }
65 
SetFormat(const std::string & value)66 void TextTimerComponent::SetFormat(const std::string& value)
67 {
68     declaration_->SetFormat(value);
69 }
70 
GetTextStyle() const71 const TextStyle& TextTimerComponent::GetTextStyle() const
72 {
73     return declaration_->GetTextStyle();
74 }
75 
SetTextStyle(const TextStyle & style)76 void TextTimerComponent::SetTextStyle(const TextStyle& style)
77 {
78     declaration_->SetTextStyle(style);
79 }
80 
GetTextTimerController() const81 RefPtr<TextTimerController> TextTimerComponent::GetTextTimerController() const
82 {
83     return declaration_->GetTextTimerController();
84 }
85 } // namespace OHOS::Ace