[3.0] Add key grab/ungrab interfaces for Tizen (X11/Wayland)
[platform/core/uifw/dali-adaptor.git] / adaptors / tizen / key-grab.h
1 #ifndef __DALI_KEY_GRAB_H__
2 #define __DALI_KEY_GRAB_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23 #include "key.h"
24
25 namespace Dali
26 {
27 class Window;
28
29 namespace KeyGrab
30 {
31
32 /**
33  * @brief Grabs the key specfied by @a key for @a window only when @a window is the topmost window.
34  *
35  * This function can be used for following example scenarios:
36  * Mobile - Using volume up/down as zoom up/down in camera apps.
37  *
38  * @privlevel public
39  * @note This function is only specified by Tizen.
40  * @param[in] window The window to set
41  * @param[in] dailKey The key code to grab (defined in key.h)
42  * @return true if the grab succeed.
43  */
44 DALI_IMPORT_API bool GrabKeyTopmost( Window window, Dali::KEY daliKey );
45
46 /**
47  * @brief Ungrabs the key specfied by @a key for @a window.
48  *
49  * @privlevel public
50  * @note This function is only specified by Tizen.
51  * @param[in] window The window to set
52  * @param[in] dailKey The key code to ungrab (defined in key.h)
53  * @return true if the ungrab succeed.
54  */
55 DALI_IMPORT_API bool UngrabKeyTopmost( Window window, Dali::KEY daliKey );
56
57 /**
58  * @brief Key grab mode for platform-level APIs.
59  */
60 enum KeyGrabMode
61 {
62   TOPMOST = 0,             ///< Grab a key only when on the top of the grabbing-window stack mode.
63   SHARED,                  ///< Grab a key together with the other client window(s) mode.
64   OVERRIDE_EXCLUSIVE,      ///< Grab a key exclusively regardless of the grabbing-window's position on the window stack with the possibility of overriding the grab by the other client window mode.
65   EXCLUSIVE                ///< Grab a key exclusively regardless of the grabbing-window's position on the window stack mode.
66 };
67
68 /**
69  * @brief Grabs the key specfied by @a key for @a window in @a grabMode.
70  *
71  * This function can be used for following example scenarios:
72  * TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app.
73  * Mobile - When a user presses Home key, the homescreen appears regardless of current foreground app.
74  * Mobile - Using volume up/down as zoom up/down in camera apps.
75  *
76  * @privlevel platform
77  * @note This function is only specified by Tizen.
78  * @param[in] window The window to set
79  * @param[in] dailKey The key code to grab (defined in key.h)
80  * @param[in] grabMode The grab mode for the key
81  * @return true if the grab succeed.
82  */
83 DALI_IMPORT_API bool GrabKey( Window window, Dali::KEY daliKey, KeyGrabMode grabMode );
84
85 /**
86  * @brief Ungrabs the key specfied by @a key for @a window.
87  *
88  * @privlevel platform
89  * @note This function is only specified by Tizen.
90  * @param[in] window The window to set
91  * @param[in] dailKey The key code to ungrab (defined in key.h)
92  * @return true if the ungrab succeed.
93  */
94 DALI_IMPORT_API bool UngrabKey( Window window, Dali::KEY daliKey );
95
96 } // namespace KeyGrab
97
98 } // namespace Dali
99
100 #endif // __DALI_KEY_GRAB_H__