• 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 #ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_TEXTTIMER_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_TEXTTIMER_H
18 
19 #include "bridge/declarative_frontend/jsview/js_container_base.h"
20 #include "core/components/texttimer/texttimer_controller.h"
21 
22 namespace OHOS::Ace::Framework {
23 class JSTextTimer : public JSViewAbstract {
24 public:
25     static void JSBind(BindingTarget globalObj);
26     static void Create(const JSCallbackInfo& info);
27 
28 protected:
29     static void SetFormat(const JSCallbackInfo& info);
30     static void SetTextColor(const JSCallbackInfo& info);
31     static void SetFontSize(const JSCallbackInfo& info);
32     static void SetFontWeight(const std::string& value);
33     static void SetFontStyle(int32_t value);
34     static void SetFontFamily(const JSCallbackInfo& info);
35     static void OnTimer(const JSCallbackInfo& info);
36 };
37 
38 class JSTextTimerController final : public Referenced {
39 public:
40     JSTextTimerController() = default;
41     ~JSTextTimerController() override = default;
42 
43     static void JSBind(BindingTarget globalObj);
44     static void Constructor(const JSCallbackInfo& info);
45     static void Destructor(JSTextTimerController* timerController);
46 
47     void Start(const JSCallbackInfo& info);
48     void Pause(const JSCallbackInfo& info);
49     void Reset(const JSCallbackInfo& info);
50 
SetController(const RefPtr<TextTimerController> & controller)51     void SetController(const RefPtr<TextTimerController>& controller)
52     {
53         controller_ = controller;
54     }
55 
GetController()56     RefPtr<TextTimerController> GetController() const
57     {
58         return controller_;
59     }
60 
61 private:
62     RefPtr<TextTimerController> controller_;
63 
64     ACE_DISALLOW_COPY_AND_MOVE(JSTextTimerController);
65 };
66 } // namespace OHOS::Ace::Framework
67 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_TEXTTIMER_H
68