Fix svace/coverity issue (key events constructor)
[platform/core/uifw/dali-core.git] / dali / devel-api / events / key-event-devel.h
1 #ifndef DALI_KEY_EVENT_DEVEL_H\r
2 #define DALI_KEY_EVENT_DEVEL_H\r
3 \r
4 /*\r
5  * Copyright (c) 2023 Samsung Electronics Co., Ltd.\r
6  *\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  * http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  *\r
19  */\r
20 \r
21 // INTERNAL INCLUDES\r
22 #include <dali/public-api/events/key-event.h>\r
23 \r
24 namespace Dali\r
25 {\r
26 namespace DevelKeyEvent\r
27 {\r
28 /**\r
29  * @brief Creates an initialized KeyEvent as default.\r
30  *\r
31  * @SINCE_2_2.45\r
32  * @return A handle to a newly allocated Dali resource\r
33  */\r
34 DALI_CORE_API KeyEvent New();\r
35 \r
36 /**\r
37  * @brief Creates an initialized KeyEvent.\r
38  *\r
39  * @SINCE_1_9.27\r
40  * @param[in]  keyName         The name of the key pressed or command from the IMF, if later then the some following parameters will be needed.\r
41  * @param[in]  logicalKey      The logical key symbol (eg. shift + 1 == "exclamation")\r
42  * @param[in]  keyString       The string of input characters or key pressed\r
43  * @param[in]  keyCode         The unique key code for the key pressed.\r
44  * @param[in]  keyModifier     The key modifier for special keys like shift and alt\r
45  * @param[in]  timeStamp       The time (in ms) that the key event occurred.\r
46  * @param[in]  keyState        The state of the key event.\r
47  * @param[in]  compose         The key compose\r
48  * @param[in]  deviceName      The name of device the key event originated from\r
49  * @param[in]  deviceClass     The class of device the key event originated from\r
50  * @param[in]  deviceSubclass  The subclass of device the key event originated from\r
51  * @return A handle to a newly allocated Dali resource\r
52  */\r
53 DALI_CORE_API KeyEvent New(const std::string&           keyName,\r
54                            const std::string&           logicalKey,\r
55                            const std::string&           keyString,\r
56                            int                          keyCode,\r
57                            int                          keyModifier,\r
58                            unsigned long                timeStamp,\r
59                            const Dali::KeyEvent::State& keyState,\r
60                            const std::string&           compose,\r
61                            const std::string&           deviceName,\r
62                            const Device::Class::Type    deviceClass,\r
63                            const Device::Subclass::Type deviceSubclass);\r
64 \r
65 /**\r
66  * @brief Set the name given to the key pressed\r
67  *\r
68  * @SINCE_1_9.27\r
69  * @param[in] keyEvent The instance of KeyEvent.\r
70  * @param[in] keyName The name given to the key pressed.\r
71  */\r
72 DALI_CORE_API void SetKeyName(KeyEvent keyEvent, const std::string& keyName);\r
73 \r
74 /**\r
75  * @brief Set the actual string of input characters that should be used for input editors.\r
76  *\r
77  * @SINCE_1_9.27\r
78  * @param[in] keyEvent The instance of KeyEvent.\r
79  * @param[in] keyString The actual string of input characters\r
80  */\r
81 DALI_CORE_API void SetKeyString(KeyEvent keyEvent, const std::string& keyString);\r
82 \r
83 /**\r
84  * @brief Set the unique key code for the key pressed.\r
85  *\r
86  * @SINCE_1_9.27\r
87  * @param[in] keyEvent The instance of KeyEvent.\r
88  * @param[in] keyCode The unique key code for the key pressed\r
89  */\r
90 DALI_CORE_API void SetKeyCode(KeyEvent keyEvent, int32_t keyCode);\r
91 \r
92 /**\r
93  * @brief Set the key modifier for special keys like Shift, Alt and Ctrl which modify the next key pressed.\r
94  *\r
95  * @SINCE_1_9.27\r
96  * @param[in] keyEvent The instance of KeyEvent.\r
97  * @param[in] keyModifier The key modifier\r
98  */\r
99 DALI_CORE_API void SetKeyModifier(KeyEvent keyEvent, int32_t keyModifier);\r
100 \r
101 /**\r
102  * @brief Set the time (in ms) that the key event occurred.\r
103  *\r
104  * @SINCE_1_9.27\r
105  * @param[in] keyEvent The instance of KeyEvent.\r
106  * @param[in] time The time (in ms)\r
107  */\r
108 DALI_CORE_API void SetTime(KeyEvent keyEvent, unsigned long time);\r
109 \r
110 /**\r
111  * @brief Set the state of the key event.\r
112  *\r
113  * @SINCE_1_9.27\r
114  * @param[in] keyEvent The instance of KeyEvent.\r
115  * @param[in] state The state of the key event\r
116  */\r
117 DALI_CORE_API void SetState(KeyEvent keyEvent, const KeyEvent::State& state);\r
118 \r
119 /**\r
120  * @brief Set whether to repeat key event.\r
121  *\r
122  * @SINCE_2_2.44\r
123  * @param[in] keyEvent The instance of KeyEvent.\r
124  * @param[in] repeat Whether the key event is a repeating key.\r
125  */\r
126 DALI_CORE_API void SetRepeat(KeyEvent keyEvent, const bool repeat);\r
127 \r
128 } // namespace DevelKeyEvent\r
129 \r
130 } // namespace Dali\r
131 \r
132 #endif // DALI_KEY_EVENT_DEVEL_H\r