• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 "ohos_nweb/bridge/ark_web_native_embed_mouse_event_impl.h"
17 
18 #include "ohos_nweb/bridge/ark_web_mouse_event_result_impl.h"
19 
20 #include "base/bridge/ark_web_bridge_macros.h"
21 
22 namespace OHOS::ArkWeb {
23 
ArkWebNativeEmbedMouseEventImpl(std::shared_ptr<OHOS::NWeb::NWebNativeEmbedMouseEvent> nweb_native_embed_mouse_event)24 ArkWebNativeEmbedMouseEventImpl::ArkWebNativeEmbedMouseEventImpl(
25     std::shared_ptr<OHOS::NWeb::NWebNativeEmbedMouseEvent> nweb_native_embed_mouse_event)
26     : nweb_native_embed_mouse_event_(nweb_native_embed_mouse_event)
27 {}
28 
GetX()29 float ArkWebNativeEmbedMouseEventImpl::GetX()
30 {
31     return nweb_native_embed_mouse_event_->GetX();
32 }
33 
GetY()34 float ArkWebNativeEmbedMouseEventImpl::GetY()
35 {
36     return nweb_native_embed_mouse_event_->GetY();
37 }
38 
IsHitNativeArea()39 bool ArkWebNativeEmbedMouseEventImpl::IsHitNativeArea()
40 {
41     return nweb_native_embed_mouse_event_->IsHitNativeArea();
42 }
43 
GetType()44 size_t ArkWebNativeEmbedMouseEventImpl::GetType()
45 {
46     return static_cast<size_t>(nweb_native_embed_mouse_event_->GetType());
47 }
48 
GetButton()49 size_t ArkWebNativeEmbedMouseEventImpl::GetButton()
50 {
51     return static_cast<size_t>(nweb_native_embed_mouse_event_->GetButton());
52 }
53 
GetOffsetX()54 float ArkWebNativeEmbedMouseEventImpl::GetOffsetX()
55 {
56     return nweb_native_embed_mouse_event_->GetOffsetX();
57 }
58 
GetOffsetY()59 float ArkWebNativeEmbedMouseEventImpl::GetOffsetY()
60 {
61     return nweb_native_embed_mouse_event_->GetOffsetY();
62 }
63 
GetScreenX()64 float ArkWebNativeEmbedMouseEventImpl::GetScreenX()
65 {
66     return nweb_native_embed_mouse_event_->GetScreenX();
67 }
68 
GetScreenY()69 float ArkWebNativeEmbedMouseEventImpl::GetScreenY()
70 {
71     return nweb_native_embed_mouse_event_->GetScreenY();
72 }
73 
GetEmbedId()74 ArkWebString ArkWebNativeEmbedMouseEventImpl::GetEmbedId()
75 {
76     return ArkWebStringClassToStruct(nweb_native_embed_mouse_event_->GetEmbedId());
77 }
78 
GetResult()79 ArkWebRefPtr<ArkWebMouseEventResult> ArkWebNativeEmbedMouseEventImpl::GetResult()
80 {
81     std::shared_ptr<OHOS::NWeb::NWebMouseEventResult> result = nweb_native_embed_mouse_event_->GetResult();
82     if (CHECK_SHARED_PTR_IS_NULL(result)) {
83         return nullptr;
84     }
85     return new ArkWebMouseEventResultImpl(result);
86 }
87 
88 } // namespace OHOS::ArkWeb
89