• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_DELEGATE_INTERFACE_H
17 #define FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DELEGATE_INTERFACE_H
18 
19 #include <ipc_types.h>
20 #include <iremote_broker.h>
21 
22 #include "form_js_info.h"
23 #include "ui/rs_surface_node.h"
24 #include "want.h"
25 
26 #include "base/utils/macros.h"
27 
28 namespace OHOS {
29 namespace Ace {
30 struct AccessibilityParentRectInfo;
31 /**
32  * @class FormRendererDelegate
33  * FormRendererDelegate interface is used to form renderer delegate.
34  */
35 class ACE_EXPORT IFormRendererDelegate : public OHOS::IRemoteBroker {
36 public:
37     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.ace.FormRendererDelegate")
38 
39     IFormRendererDelegate() = default;
40     ~IFormRendererDelegate() override = default;
41     /**
42      * @brief OnSurfaceCreate.
43      * @param surfaceNode The surfaceNode.
44      * @param formJsInfo The formJsInfo.
45      * @param want The want.
46      */
47     virtual int32_t OnSurfaceCreate(const std::shared_ptr<Rosen::RSSurfaceNode>& surfaceNode,
48         const OHOS::AppExecFwk::FormJsInfo& formJsInfo, const AAFwk::Want& want) = 0;
49     /**
50      * @brief OnSurfaceReuse.
51      * @param surfaceId The surfaceNode ID.
52      * @param formJsInfo The formJsInfo.
53      * @param want The want.
54      */
OnSurfaceReuse(uint64_t surfaceId,const OHOS::AppExecFwk::FormJsInfo & formJsInfo,const AAFwk::Want & want)55     virtual int32_t OnSurfaceReuse(
56         uint64_t surfaceId, const OHOS::AppExecFwk::FormJsInfo& formJsInfo, const AAFwk::Want& want)
57     {
58         return ERR_OK;
59     }
60     /**
61      * @brief OnSurfaceRelease.
62      * @param surfaceId The surfaceNode ID.
63      */
OnSurfaceRelease(uint64_t surfaceId)64     virtual int32_t OnSurfaceRelease(uint64_t surfaceId)
65     {
66         return ERR_OK;
67     }
68     /**
69      * @brief OnActionEvent.
70      * @param action The action.
71      */
72     virtual int32_t OnActionEvent(const std::string& action) = 0;
73     /**
74      * @brief OnError.
75      * @param code The code.
76      * @param msg The msg.
77      */
78     virtual int32_t OnError(const std::string& code, const std::string& msg) = 0;
79     /**
80      * @brief OnSurfaceChange.
81      * @param width
82      * @param height
83      */
84     virtual int32_t OnSurfaceChange(float width, float height, float borderWidth = 0.0) = 0;
85     /**
86      * @brief OnSurfaceDetach.
87      * @param surfaceId The surfaceNode ID.
88      */
89     virtual int32_t OnSurfaceDetach(uint64_t surfaceId) = 0;
90     /**
91      * @brief OnFormLinkInfoUpdate.
92      * @param formLinkInfos
93      */
94     virtual int32_t OnFormLinkInfoUpdate(const std::vector<std::string>& formLinkInfos) = 0;
95 
96     /**
97      * @brief OnGetRectRelativeToWindow.
98      * @param rectF
99      */
100     virtual int32_t OnGetRectRelativeToWindow(AccessibilityParentRectInfo& parentRectInfo) = 0;
101 
102     /**
103      * @brief OnCheckManagerDelegate.
104      * @param rectF
105      */
106     virtual int32_t OnCheckManagerDelegate(bool &checkFlag) = 0;
107 
108     /**
109      * @brief onUpdateFormDone.
110      * @param formId
111      */
112     virtual int32_t OnUpdateFormDone(const int64_t formId) = 0;
113 
114     enum Message : uint32_t {
115         ON_SURFACE_CREATE = 1,
116         ON_SURFACE_REUSE,
117         ON_SURFACE_RELEASE,
118         ON_ACTION_CREATE,
119         ON_ERROR,
120         ON_SURFACE_CHANGE,
121         ON_FORM_LINK_INFO_UPDATE,
122         ON_FORMSURFACE_DETACH,
123         ON_GET_RECT_RELATIVE_TO_WINDOW,
124         ON_CHECK_MANAGER_DELEGATE,
125         ON_UPDATE_FORM_DONE,
126     };
127 };
128 } // namespace Ace
129 } // namespace OHOS
130 #endif // FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DELEGATE_INTERFACE_H
131