• 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 JS_POINTER_CONTEXT_H
17 #define JS_POINTER_CONTEXT_H
18 #include "js_pointer_manager.h"
19 
20 namespace OHOS {
21 namespace MMI {
22 class JsPointerContext {
23 public:
24     JsPointerContext();
25     DISALLOW_COPY_AND_MOVE(JsPointerContext);
26     ~JsPointerContext() = default;
27     static napi_value Export(napi_env env, napi_value exports);
28     static napi_value SetPointerVisible(napi_env env, napi_callback_info info);
29     static napi_value IsPointerVisible(napi_env env, napi_callback_info info);
30     static napi_value SetPointerStyle(napi_env env, napi_callback_info info);
31     static napi_value GetPointerStyle(napi_env env, napi_callback_info info);
32     std::shared_ptr<JsPointerManager> GetJsPointerMgr() const;
33     static napi_value SetPointerSpeed(napi_env env, napi_callback_info info);
34     static napi_value GetPointerSpeed(napi_env env, napi_callback_info info);
35 
36 private:
37     static napi_value CreateInstance(napi_env env);
38     static JsPointerContext* GetInstance(napi_env env);
39     static napi_value CreateJsObject(napi_env env, napi_callback_info info);
40     static napi_value EnumConstructor(napi_env env, napi_callback_info info);
41     static napi_value CreatePointerStyle(napi_env env, napi_value exports);
42     std::shared_ptr<JsPointerManager> mgr_ { nullptr };
43     napi_ref contextRef_ { nullptr };
44 };
45 } // namespace MMI
46 } // namespace OHOS
47 
48 #endif // JS_POINTER_CONTEXT_H