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 "core/components/texttimer/render_texttimer.h" 19 #include "core/components/texttimer/texttimer_element.h" 20 21 namespace OHOS::Ace { TextTimerComponent()22TextTimerComponent::TextTimerComponent() 23 { 24 if (!declaration_) { 25 declaration_ = AceType::MakeRefPtr<TextTimerDeclaration>(); 26 declaration_->Init(); 27 } 28 } 29 CreateRenderNode()30RefPtr<RenderNode> TextTimerComponent::CreateRenderNode() 31 { 32 return RenderTextTimer::Create(); 33 } 34 CreateElement()35RefPtr<Element> TextTimerComponent::CreateElement() 36 { 37 return AceType::MakeRefPtr<TextTimerElement>(); 38 } 39 GetInputCount() const40double TextTimerComponent::GetInputCount() const 41 { 42 return declaration_->GetInputCount(); 43 } 44 SetInputCount(double value)45void TextTimerComponent::SetInputCount(double value) 46 { 47 declaration_->SetInputCount(value); 48 } 49 GetIsCountDown() const50bool TextTimerComponent::GetIsCountDown() const 51 { 52 return declaration_->GetIsCountDown(); 53 } 54 SetIsCountDown(bool isCountDown)55void TextTimerComponent::SetIsCountDown(bool isCountDown) 56 { 57 declaration_->SetIsCountDown(isCountDown); 58 } 59 GetFormat() const60const std::string& TextTimerComponent::GetFormat() const 61 { 62 return declaration_->GetFormat(); 63 } 64 SetFormat(const std::string & value)65void TextTimerComponent::SetFormat(const std::string& value) 66 { 67 declaration_->SetFormat(value); 68 } 69 GetTextStyle() const70const TextStyle& TextTimerComponent::GetTextStyle() const 71 { 72 return declaration_->GetTextStyle(); 73 } 74 SetTextStyle(const TextStyle & style)75void TextTimerComponent::SetTextStyle(const TextStyle& style) 76 { 77 declaration_->SetTextStyle(style); 78 } 79 GetTextTimerController() const80RefPtr<TextTimerController> TextTimerComponent::GetTextTimerController() const 81 { 82 return declaration_->GetTextTimerController(); 83 } 84 } // namespace OHOS::Ace