1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __FEPBUTILS_H__
17 #define __FEPBUTILS_H__
22 /** Macro to be called by a keyboard-based FEP at the start of its CCoeControl::OfferKeyEventL()-overriding
25 It causes key up and key down events to be consumed so that the FEP only receives
26 standard key events (of type EEventKey, see the TEventCode enumeration). It
27 also causes key events that turn the FEP on or off to be consumed. If the
28 FEP is simulating key events, or is off, no key events are consumed (so that
29 all are passed on to the underlying application) and the macro returns with
32 This should be the first thing called in the OfferKeyEventL() function. The
33 FEP_END_KEY_EVENT_HANDLER_L macro should be used to return from the function.
35 @param aFep The CCoeFep object, should not be a pointer
36 @param aKeyEvent The TKeyEvent object from OfferKeyEventL()
37 @param aEventCode The TEventCode object from OfferKeyEventL()
42 #define FEP_START_KEY_EVENT_HANDLER_L(aFep, aKeyEvent, aEventCode)\
44 if ((aFep).IsSimulatingKeyEvent())\
46 return EKeyWasNotConsumed;\
48 (aFep).OnStartingHandlingKeyEvent_WithDownUpFilterLC();\
49 if (((aEventCode)!=EEventKey))\
51 return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasConsumed);\
55 return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasNotConsumed);\
59 /** Macro to be called by a keyboard-based FEP to return from its CCoeControl::OfferKeyEventL()-overriding
62 It should be used instead of the return statement. It should only be used
63 if the FEP_START_KEY_EVENT_HANDLER_L macro was used at the start of the function.
65 @param aFep The CCoeFep object, should not be a pointer
66 @param aKeyEvent The TKeyEvent object from OfferKeyEventL()
67 @param aKeyResponse Defined in EPOC32\INCLUDE\COEDEF.H
68 If set to EKeyWasNotConsumed, allows the key event to reach the underlying application.
69 If set to EKeyWasConsumed, prevents the key event reaching the underlying application.
73 #define FEP_END_KEY_EVENT_HANDLER_L(aFep, aKeyEvent, aKeyResponse)\
75 return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL(EEventKey, (aKeyEvent), (aKeyResponse));\
78 /** Macro to be called by a keyboard-based FEP at the start of its CCoeControl::OfferKeyEventL()-overriding
81 It causes events that turn the FEP on or off to be consumed. This variant
82 of the macro ignores key up and key down events so that it should be used
83 in preference to FEP_START_KEY_EVENT_HANDLER_L in the rare cases where the
84 FEP wishes to handle EEventKeyDown or EEventKeyUp events. If the FEP is simulating
85 key events, or is off, no key events are consumed and OfferKeyEventL() returns
86 with EKeyWasNotConsumed.
88 This should be the first thing called in the OfferKeyEventL() function. The
89 FEP_END_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L macro should be used to return
92 @param aFep The CCoeFep object, should not be a pointer
93 @param aKeyEvent The TKeyEvent object from OfferKeyEventL()
94 @param aEventCode The TEventCode object from OfferKeyEventL()
98 #define FEP_START_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L(aFep, aKeyEvent, aEventCode)\
100 if ((aFep).IsSimulatingKeyEvent())\
102 return EKeyWasNotConsumed;\
104 (aFep).OnStartingHandlingKeyEvent_NoDownUpFilterLC();\
105 if ((aEventCode)==EEventKey)\
109 return (aFep).OnFinishingHandlingKeyEvent_NoDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasNotConsumed);\
114 /** Macro to be called by a keyboard-based FEP to return from its CCoeControl::OfferKeyEventL()-overriding
117 It should be used instead of the return statement. This variant of the macro
118 should only be used if the FEP_START_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L
119 macro was used at the start of the function.
121 @param aFep The CCoeFep object, should not be a pointer
122 @param aKeyEvent The TKeyEvent object from OfferKeyEventL()
123 @param aEventCode The TEventCode object from OfferKeyEventL()
124 @param aKeyResponse Defined in EPOC32\INCLUDE\COEDEF.
125 If set to EKeyWasNotConsumed, allows the key event to reach the underlying application.
126 If set to EKeyWasConsumed, prevents the key event reaching the underlying application.
130 #define FEP_END_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L(aFep, aKeyEvent, aEventCode, aKeyResponse)\
132 return (aFep).OnFinishingHandlingKeyEvent_NoDownUpFilterL((aEventCode), (aKeyEvent), (aKeyResponse));\
137 #endif // __FEPBUTILS_H__