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()23TextTimerComponent::TextTimerComponent() 24 { 25 if (!declaration_) { 26 declaration_ = AceType::MakeRefPtr<TextTimerDeclaration>(); 27 declaration_->Init(); 28 } 29 } 30 CreateRenderNode()31RefPtr<RenderNode> TextTimerComponent::CreateRenderNode() 32 { 33 return RenderTextTimer::Create(); 34 } 35 CreateElement()36RefPtr<Element> TextTimerComponent::CreateElement() 37 { 38 return AceType::MakeRefPtr<TextTimerElement>(); 39 } 40 GetInputCount() const41double TextTimerComponent::GetInputCount() const 42 { 43 return declaration_->GetInputCount(); 44 } 45 SetInputCount(double value)46void TextTimerComponent::SetInputCount(double value) 47 { 48 declaration_->SetInputCount(value); 49 } 50 GetIsCountDown() const51bool TextTimerComponent::GetIsCountDown() const 52 { 53 return declaration_->GetIsCountDown(); 54 } 55 SetIsCountDown(bool isCountDown)56void TextTimerComponent::SetIsCountDown(bool isCountDown) 57 { 58 declaration_->SetIsCountDown(isCountDown); 59 } 60 GetFormat() const61const std::string& TextTimerComponent::GetFormat() const 62 { 63 return declaration_->GetFormat(); 64 } 65 SetFormat(const std::string & value)66void TextTimerComponent::SetFormat(const std::string& value) 67 { 68 declaration_->SetFormat(value); 69 } 70 GetTextStyle() const71const TextStyle& TextTimerComponent::GetTextStyle() const 72 { 73 return declaration_->GetTextStyle(); 74 } 75 SetTextStyle(const TextStyle & style)76void TextTimerComponent::SetTextStyle(const TextStyle& style) 77 { 78 declaration_->SetTextStyle(style); 79 } 80 GetTextTimerController() const81RefPtr<TextTimerController> TextTimerComponent::GetTextTimerController() const 82 { 83 return declaration_->GetTextTimerController(); 84 } 85 } // namespace OHOS::Ace