Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUi_IKeyEventListener.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file        FUi_IKeyEventListener.h
19  * @brief       This is the header file for the _IKeyEventListener class.
20  *
21  * This header file contains the declarations of the %_IKeyEventListener class.
22  */
23
24 #ifndef _FUI_INTERNAL_IKEY_EVENT_LISTENER_H_
25 #define _FUI_INTERNAL_IKEY_EVENT_LISTENER_H_
26
27 #include "FUi_IUiEventListener.h"
28 #include "FUi_UiKeyEvent.h"
29
30 namespace Tizen {namespace Ui
31 {
32
33 class _Control;
34
35 /**
36  * @interface   _IKeyEventListener
37  * @brief                       This interface implements the listener for the key event.
38  * @since                       2.0
39  *
40  * @remarks             A key event callback is called when key codes corresponding to the physical keys are
41  * pressed or released. ITextEventListener can be used to get the text value of the key in EditField and EditArea.
42  *
43  * The listener interface for receiving key events. The class that
44  * processes a key event implements this interface, and the instance created with
45  * that class is registered with a UI control, using the control's AddKeyEventListener()
46  * method. When the key event occurs, the OnKeyPressed(), OnKeyReleased(), or
47  * OnKeyLongPressed() method of that instance is invoked. @n
48  *
49  * Only the current focus owner can listen to key events. Use the control's SetFocus()
50  * method to give the input focus to a UI control.
51  *
52  */
53 class _IKeyEventListener
54         : virtual public _IUiEventListener
55         , virtual public Tizen::Base::Runtime::IEventListener
56 {
57 // Operation
58 public:
59         /**
60          * This is internal. If used in an application, the application can get rejected during the certification process.
61          * This is the destructor for this class.
62          *
63          * @since                               2.0
64          */
65         virtual ~_IKeyEventListener(void) {}
66
67         /**
68          * Notifies when a key is pressed.
69          *
70          * @since                               2.0
71          * @param[in]   source          The source of the event
72          * @param[in]   keyCode         The key code
73          */
74         virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) = 0;
75
76         /**
77          * Notifies when a key is released.
78          *
79          * @since                               2.0
80          * @param[in]   source          The source of the event
81          * @param[in]   keyCode         The key code
82          */
83         virtual bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo) = 0;
84 }; // _IKeyEventListener
85
86 }} // Tizen::Ui
87
88 #endif //_FUI_INTERNAL_IKEY_EVENT_LISTENER_H_