2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUiIKeyEventListener.h
19 * @brief This is the header file for the %IKeyEventListener interface.
21 * This header file contains the declarations of the %IKeyEventListener interface. @n
22 * If a key event is generated, a method of this interface is called. @n
23 * If an application performs tasks related to the key event, use the methods of this interface.
25 #ifndef _FUI_IKEY_EVENT_LISTENER_H_
26 #define _FUI_IKEY_EVENT_LISTENER_H_
28 #include <FBaseRtIEventListener.h>
29 #include <FBaseTypes.h>
30 #include <FUiKeyTypes.h>
32 namespace Tizen {namespace Ui
37 * @interface IKeyEventListener
38 * @brief This interface implements the listener for the key event.
42 * @remarks Use the ITextEventListener interface to listen to key events related to the virtual keypad used with EditField and EditArea.
44 * The %IKeyEventListener interface is the listener interface for receiving key events, which are fired when hardware keyboard keys are pressed or
45 * released. The class that processes a key event implements this interface, and the instance created with that class is
46 * registered with a UI control, using the Control::AddKeyEventListener() method. When the key event occurs, a method of that
47 * instance is invoked.
49 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/event_listener.htm">Event Listeners</a>.
53 class _OSP_EXPORT_ IKeyEventListener
54 : virtual public Tizen::Base::Runtime::IEventListener
59 // This method is for internal use only.
60 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
62 // This is the destructor for this class.
66 virtual ~IKeyEventListener(void) {}
70 * Called when a key is pressed.
74 * @param[in] source The source of the event
75 * @param[in] keyCode The key code
77 virtual void OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode) = 0;
81 * Called when a key is released.
85 * @param[in] source The source of the event
86 * @param[in] keyCode The key code
88 virtual void OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode) = 0;
92 * Called when a key is pressed and held down for some time.
96 * @param[in] source The source of the event
97 * @param[in] keyCode The key code
98 * @remarks The key long pressed event is fired after the key pressed event is initially generated.
100 virtual void OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode) = 0;
103 // Reserved virtual methods for later extension
105 // The following methods are reserved and may change its name at any time without prior notice.
107 virtual void IKeyEventListener_Reserved1(void) {}
109 // Reserved virtual methods for later extension
111 // The following methods are reserved and may change its name at any time without prior notice.
113 virtual void IKeyEventListener_Reserved2(void) {}
115 // Reserved virtual methods for later extension
117 // The following methods are reserved and may change its name at any time without prior notice.
119 virtual void IKeyEventListener_Reserved3(void) {}
121 }; // IKeyEventListener
125 #endif //_FUI_IKEY_EVENT_LISTENER_H_