williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@4
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@4
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __FEPBUTILS_H__
|
williamr@2
|
17 |
#define __FEPBUTILS_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
|
williamr@2
|
22 |
/** Macro to be called by a keyboard-based FEP at the start of its CCoeControl::OfferKeyEventL()-overriding
|
williamr@2
|
23 |
function.
|
williamr@2
|
24 |
|
williamr@2
|
25 |
It causes key up and key down events to be consumed so that the FEP only receives
|
williamr@2
|
26 |
standard key events (of type EEventKey, see the TEventCode enumeration). It
|
williamr@2
|
27 |
also causes key events that turn the FEP on or off to be consumed. If the
|
williamr@2
|
28 |
FEP is simulating key events, or is off, no key events are consumed (so that
|
williamr@2
|
29 |
all are passed on to the underlying application) and the macro returns with
|
williamr@2
|
30 |
EKeyWasNotConsumed.
|
williamr@2
|
31 |
|
williamr@2
|
32 |
This should be the first thing called in the OfferKeyEventL() function. The
|
williamr@2
|
33 |
FEP_END_KEY_EVENT_HANDLER_L macro should be used to return from the function.
|
williamr@2
|
34 |
|
williamr@2
|
35 |
@param aFep The CCoeFep object, should not be a pointer
|
williamr@2
|
36 |
@param aKeyEvent The TKeyEvent object from OfferKeyEventL()
|
williamr@2
|
37 |
@param aEventCode The TEventCode object from OfferKeyEventL()
|
williamr@2
|
38 |
|
williamr@2
|
39 |
@see TEventCode
|
williamr@2
|
40 |
@publishedAll
|
williamr@2
|
41 |
@released */
|
williamr@2
|
42 |
#define FEP_START_KEY_EVENT_HANDLER_L(aFep, aKeyEvent, aEventCode)\
|
williamr@2
|
43 |
{\
|
williamr@2
|
44 |
if ((aFep).IsSimulatingKeyEvent())\
|
williamr@2
|
45 |
{\
|
williamr@2
|
46 |
return EKeyWasNotConsumed;\
|
williamr@2
|
47 |
}\
|
williamr@2
|
48 |
(aFep).OnStartingHandlingKeyEvent_WithDownUpFilterLC();\
|
williamr@2
|
49 |
if (((aEventCode)!=EEventKey))\
|
williamr@2
|
50 |
{\
|
williamr@2
|
51 |
return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasConsumed);\
|
williamr@2
|
52 |
}\
|
williamr@2
|
53 |
if (!(aFep).IsOn())\
|
williamr@2
|
54 |
{\
|
williamr@2
|
55 |
return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasNotConsumed);\
|
williamr@2
|
56 |
}\
|
williamr@2
|
57 |
}
|
williamr@2
|
58 |
|
williamr@2
|
59 |
/** Macro to be called by a keyboard-based FEP to return from its CCoeControl::OfferKeyEventL()-overriding
|
williamr@2
|
60 |
function.
|
williamr@2
|
61 |
|
williamr@2
|
62 |
It should be used instead of the return statement. It should only be used
|
williamr@2
|
63 |
if the FEP_START_KEY_EVENT_HANDLER_L macro was used at the start of the function.
|
williamr@2
|
64 |
|
williamr@2
|
65 |
@param aFep The CCoeFep object, should not be a pointer
|
williamr@2
|
66 |
@param aKeyEvent The TKeyEvent object from OfferKeyEventL()
|
williamr@2
|
67 |
@param aKeyResponse Defined in EPOC32\INCLUDE\COEDEF.H
|
williamr@2
|
68 |
If set to EKeyWasNotConsumed, allows the key event to reach the underlying application.
|
williamr@2
|
69 |
If set to EKeyWasConsumed, prevents the key event reaching the underlying application.
|
williamr@2
|
70 |
|
williamr@2
|
71 |
@publishedAll
|
williamr@2
|
72 |
@released */
|
williamr@2
|
73 |
#define FEP_END_KEY_EVENT_HANDLER_L(aFep, aKeyEvent, aKeyResponse)\
|
williamr@2
|
74 |
{\
|
williamr@2
|
75 |
return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL(EEventKey, (aKeyEvent), (aKeyResponse));\
|
williamr@2
|
76 |
}
|
williamr@2
|
77 |
|
williamr@2
|
78 |
/** Macro to be called by a keyboard-based FEP at the start of its CCoeControl::OfferKeyEventL()-overriding
|
williamr@2
|
79 |
function.
|
williamr@2
|
80 |
|
williamr@2
|
81 |
It causes events that turn the FEP on or off to be consumed. This variant
|
williamr@2
|
82 |
of the macro ignores key up and key down events so that it should be used
|
williamr@2
|
83 |
in preference to FEP_START_KEY_EVENT_HANDLER_L in the rare cases where the
|
williamr@2
|
84 |
FEP wishes to handle EEventKeyDown or EEventKeyUp events. If the FEP is simulating
|
williamr@2
|
85 |
key events, or is off, no key events are consumed and OfferKeyEventL() returns
|
williamr@2
|
86 |
with EKeyWasNotConsumed.
|
williamr@2
|
87 |
|
williamr@2
|
88 |
This should be the first thing called in the OfferKeyEventL() function. The
|
williamr@2
|
89 |
FEP_END_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L macro should be used to return
|
williamr@2
|
90 |
from the function.
|
williamr@2
|
91 |
|
williamr@2
|
92 |
@param aFep The CCoeFep object, should not be a pointer
|
williamr@2
|
93 |
@param aKeyEvent The TKeyEvent object from OfferKeyEventL()
|
williamr@2
|
94 |
@param aEventCode The TEventCode object from OfferKeyEventL()
|
williamr@2
|
95 |
|
williamr@2
|
96 |
@publishedAll
|
williamr@2
|
97 |
@released */
|
williamr@2
|
98 |
#define FEP_START_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L(aFep, aKeyEvent, aEventCode)\
|
williamr@2
|
99 |
{\
|
williamr@2
|
100 |
if ((aFep).IsSimulatingKeyEvent())\
|
williamr@2
|
101 |
{\
|
williamr@2
|
102 |
return EKeyWasNotConsumed;\
|
williamr@2
|
103 |
}\
|
williamr@2
|
104 |
(aFep).OnStartingHandlingKeyEvent_NoDownUpFilterLC();\
|
williamr@2
|
105 |
if ((aEventCode)==EEventKey)\
|
williamr@2
|
106 |
{\
|
williamr@2
|
107 |
if (!(aFep).IsOn())\
|
williamr@2
|
108 |
{\
|
williamr@2
|
109 |
return (aFep).OnFinishingHandlingKeyEvent_NoDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasNotConsumed);\
|
williamr@2
|
110 |
}\
|
williamr@2
|
111 |
}\
|
williamr@2
|
112 |
}
|
williamr@2
|
113 |
|
williamr@2
|
114 |
/** Macro to be called by a keyboard-based FEP to return from its CCoeControl::OfferKeyEventL()-overriding
|
williamr@2
|
115 |
function.
|
williamr@2
|
116 |
|
williamr@2
|
117 |
It should be used instead of the return statement. This variant of the macro
|
williamr@2
|
118 |
should only be used if the FEP_START_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L
|
williamr@2
|
119 |
macro was used at the start of the function.
|
williamr@2
|
120 |
|
williamr@2
|
121 |
@param aFep The CCoeFep object, should not be a pointer
|
williamr@2
|
122 |
@param aKeyEvent The TKeyEvent object from OfferKeyEventL()
|
williamr@2
|
123 |
@param aEventCode The TEventCode object from OfferKeyEventL()
|
williamr@2
|
124 |
@param aKeyResponse Defined in EPOC32\INCLUDE\COEDEF.
|
williamr@2
|
125 |
If set to EKeyWasNotConsumed, allows the key event to reach the underlying application.
|
williamr@2
|
126 |
If set to EKeyWasConsumed, prevents the key event reaching the underlying application.
|
williamr@2
|
127 |
|
williamr@2
|
128 |
@publishedAll
|
williamr@2
|
129 |
@released */
|
williamr@2
|
130 |
#define FEP_END_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L(aFep, aKeyEvent, aEventCode, aKeyResponse)\
|
williamr@2
|
131 |
{\
|
williamr@2
|
132 |
return (aFep).OnFinishingHandlingKeyEvent_NoDownUpFilterL((aEventCode), (aKeyEvent), (aKeyResponse));\
|
williamr@2
|
133 |
}
|
williamr@2
|
134 |
|
williamr@2
|
135 |
|
williamr@2
|
136 |
|
williamr@2
|
137 |
#endif // __FEPBUTILS_H__
|
williamr@4
|
138 |
|
williamr@4
|
139 |
|