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 implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef OH_WINDOW_EVENT_FILTER_H
16 #define OH_WINDOW_EVENT_FILTER_H
17 
18 #include "foundation/multimodalinput/input/interfaces/kits/c/input/oh_input_manager.h"
19 #include "key_event.h"
20 #include "oh_window_comm.h"
21 #include "stdint.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 /**
27  * @brief the callback funcation type when keyEvent was filter
28  * @param keyEvent multimodal keyEvent
29  * @since 12
30  */
31 typedef bool (*OH_NativeWindowManager_KeyEventFilter)(Input_KeyEvent* keyEvent);
32 
33 /**
34  * @brief Registers a filter callback for the window, the callback is called when the
35  * window is dispatched to the event
36  *
37  * @param windowId windowId when window is created
38  * @param keyEventFilter key event callback ,called when the window is dispatched
39  * to the event
40  * @return Returns the status code of the execution.
41  * @since 12
42  */
43 WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter(int32_t windowId,
44     OH_NativeWindowManager_KeyEventFilter keyEventFilter);
45 
46 /**
47  * @brief clear callback for the window
48  *
49  * @param windowId windowId when window is created
50  * @return Returns the status code of the execution.
51  * @since 12
52  */
53 WindowManager_ErrorCode OH_NativeWindowManager_UnregisterKeyEventFilter(int32_t windowId);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 #endif // OH_WINDOW_EVENT_FILTER_H
59