1 /* 2 * Copyright (c) 2024 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 wrapperied. 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_mouse_event_wrapper.h" 17 18 #include "base/bridge/ark_web_bridge_macros.h" 19 20 namespace OHOS::ArkWeb { 21 ArkWebMouseEventWrapper(ArkWebRefPtr<ArkWebMouseEvent> mouseEvent)22ArkWebMouseEventWrapper::ArkWebMouseEventWrapper(ArkWebRefPtr<ArkWebMouseEvent> mouseEvent) 23 : mouseEvent_(mouseEvent) 24 {} 25 GetX()26int32_t ArkWebMouseEventWrapper::GetX() 27 { 28 return mouseEvent_->GetX(); 29 } 30 GetY()31int32_t ArkWebMouseEventWrapper::GetY() 32 { 33 return mouseEvent_->GetY(); 34 } 35 GetButton()36int32_t ArkWebMouseEventWrapper::GetButton() 37 { 38 return mouseEvent_->GetButton(); 39 } 40 GetAction()41int32_t ArkWebMouseEventWrapper::GetAction() 42 { 43 return mouseEvent_->GetAction(); 44 } 45 GetClickNum()46int32_t ArkWebMouseEventWrapper::GetClickNum() 47 { 48 return mouseEvent_->GetClickNum(); 49 } 50 GetPressKeyCodes()51std::vector<int32_t> ArkWebMouseEventWrapper::GetPressKeyCodes() 52 { 53 ArkWebInt32Vector pressKeyCodes = mouseEvent_->GetPressKeyCodes(); 54 55 std::vector<int32_t> result = ArkWebBasicVectorStructToClass<int32_t, ArkWebInt32Vector>(pressKeyCodes); 56 57 ArkWebBasicVectorStructRelease(pressKeyCodes); 58 59 return result; 60 } 61 GetRawX()62int32_t ArkWebMouseEventWrapper::GetRawX() 63 { 64 return mouseEvent_->GetRawX(); 65 } 66 GetRawY()67int32_t ArkWebMouseEventWrapper::GetRawY() 68 { 69 return mouseEvent_->GetRawY(); 70 } 71 72 } // namespace OHOS::ArkWeb 73