1 /*
2  * Copyright (c) 2023 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 FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DISPATCHER_INTERFACE_H
17 #define FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DISPATCHER_INTERFACE_H
18 
19 #include <ipc_types.h>
20 #include <iremote_broker.h>
21 
22 #include "pointer_event.h"
23 
24 #include "base/utils/macros.h"
25 #include "interfaces/inner_api/ace/serialized_gesture.h"
26 
27 namespace OHOS::Rosen {
28 class RSTransaction;
29 }
30 namespace OHOS {
31 namespace Ace {
32 /**
33  * @class IFormRendererDispatcher
34  * IFormRendererDispatcher interface is used to form render dispatcher.
35  */
36 class ACE_EXPORT IFormRendererDispatcher : public OHOS::IRemoteBroker {
37 public:
38     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.ace.FormRendererDispatcher")
39 
40     IFormRendererDispatcher() = default;
41     ~IFormRendererDispatcher() override = default;
42     /**
43      * @brief Dispatcher pointer event.
44      * @param pointerEvent The pointer event info.
45      */
46     virtual void DispatchPointerEvent(
47         const std::shared_ptr<OHOS::MMI::PointerEvent>& pointerEvent,
48         SerializedGesture& serializedGesture) = 0;
49     /**
50      * @brief Set AllowUpdate.
51      * @param allowUpdate The allowUpdate.
52      */
53     virtual void SetAllowUpdate(bool allowUpdate) = 0;
54 
55     virtual void DispatchSurfaceChangeEvent(float width, float height, uint32_t reason = 0,
56         const std::shared_ptr<Rosen::RSTransaction>& rsTransaction = nullptr, float borderWidth = 0.0) = 0;
57     virtual void SetObscured(bool isObscured) = 0;
58 
59     virtual void OnAccessibilityChildTreeRegister(uint32_t windowId, int32_t treeId, int64_t accessibilityId) = 0;
60     virtual void OnAccessibilityChildTreeDeregister() = 0;
61     virtual void OnAccessibilityDumpChildInfo(
62         const std::vector<std::string>& params, std::vector<std::string>& info) = 0;
63     virtual void OnAccessibilityTransferHoverEvent(float pointX, float pointY, int32_t sourceType,
64         int32_t eventType, int64_t timeMs) = 0;
65 
66     enum Message : uint32_t {
67         DISPATCH_POINTER_EVENT = 1,
68         SET_ALLOW_UPDATE,
69         DISPATCH_SURFACE_CHANGE_EVENT,
70         SET_OBSCURED,
71         ACCESSIBILITY_CHILD_TREE_REGISTER,
72         ACCESSIBILITY_CHILD_TREE_DEREGISTER,
73         ACCESSIBILITY_DUMP_CHILD_INFO,
74         ACCESSIBILITY_TRANSFER_HOVER_EVENT,
75     };
76 };
77 }  // namespace Ace
78 }  // namespace OHOS
79 #endif  // FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DISPATCHER_INTERFACE_H
80