1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/fepbutils.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,137 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __FEPBUTILS_H__
1.20 +#define __FEPBUTILS_H__
1.21 +
1.22 +
1.23 +
1.24 +
1.25 +/** Macro to be called by a keyboard-based FEP at the start of its CCoeControl::OfferKeyEventL()-overriding
1.26 +function.
1.27 +
1.28 +It causes key up and key down events to be consumed so that the FEP only receives
1.29 +standard key events (of type EEventKey, see the TEventCode enumeration). It
1.30 +also causes key events that turn the FEP on or off to be consumed. If the
1.31 +FEP is simulating key events, or is off, no key events are consumed (so that
1.32 +all are passed on to the underlying application) and the macro returns with
1.33 +EKeyWasNotConsumed.
1.34 +
1.35 +This should be the first thing called in the OfferKeyEventL() function. The
1.36 +FEP_END_KEY_EVENT_HANDLER_L macro should be used to return from the function.
1.37 +
1.38 +@param aFep The CCoeFep object, should not be a pointer
1.39 +@param aKeyEvent The TKeyEvent object from OfferKeyEventL()
1.40 +@param aEventCode The TEventCode object from OfferKeyEventL()
1.41 +
1.42 +@see TEventCode
1.43 +@publishedAll
1.44 +@released */
1.45 +#define FEP_START_KEY_EVENT_HANDLER_L(aFep, aKeyEvent, aEventCode)\
1.46 + {\
1.47 + if ((aFep).IsSimulatingKeyEvent())\
1.48 + {\
1.49 + return EKeyWasNotConsumed;\
1.50 + }\
1.51 + (aFep).OnStartingHandlingKeyEvent_WithDownUpFilterLC();\
1.52 + if (((aEventCode)!=EEventKey))\
1.53 + {\
1.54 + return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasConsumed);\
1.55 + }\
1.56 + if (!(aFep).IsOn())\
1.57 + {\
1.58 + return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasNotConsumed);\
1.59 + }\
1.60 + }
1.61 +
1.62 +/** Macro to be called by a keyboard-based FEP to return from its CCoeControl::OfferKeyEventL()-overriding
1.63 +function.
1.64 +
1.65 +It should be used instead of the return statement. It should only be used
1.66 +if the FEP_START_KEY_EVENT_HANDLER_L macro was used at the start of the function.
1.67 +
1.68 +@param aFep The CCoeFep object, should not be a pointer
1.69 +@param aKeyEvent The TKeyEvent object from OfferKeyEventL()
1.70 +@param aKeyResponse Defined in EPOC32\INCLUDE\COEDEF.H
1.71 + If set to EKeyWasNotConsumed, allows the key event to reach the underlying application.
1.72 + If set to EKeyWasConsumed, prevents the key event reaching the underlying application.
1.73 +
1.74 +@publishedAll
1.75 +@released */
1.76 +#define FEP_END_KEY_EVENT_HANDLER_L(aFep, aKeyEvent, aKeyResponse)\
1.77 + {\
1.78 + return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL(EEventKey, (aKeyEvent), (aKeyResponse));\
1.79 + }
1.80 +
1.81 +/** Macro to be called by a keyboard-based FEP at the start of its CCoeControl::OfferKeyEventL()-overriding
1.82 +function.
1.83 +
1.84 +It causes events that turn the FEP on or off to be consumed. This variant
1.85 +of the macro ignores key up and key down events so that it should be used
1.86 +in preference to FEP_START_KEY_EVENT_HANDLER_L in the rare cases where the
1.87 +FEP wishes to handle EEventKeyDown or EEventKeyUp events. If the FEP is simulating
1.88 +key events, or is off, no key events are consumed and OfferKeyEventL() returns
1.89 +with EKeyWasNotConsumed.
1.90 +
1.91 +This should be the first thing called in the OfferKeyEventL() function. The
1.92 +FEP_END_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L macro should be used to return
1.93 +from the function.
1.94 +
1.95 +@param aFep The CCoeFep object, should not be a pointer
1.96 +@param aKeyEvent The TKeyEvent object from OfferKeyEventL()
1.97 +@param aEventCode The TEventCode object from OfferKeyEventL()
1.98 +
1.99 +@publishedAll
1.100 +@released */
1.101 +#define FEP_START_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L(aFep, aKeyEvent, aEventCode)\
1.102 + {\
1.103 + if ((aFep).IsSimulatingKeyEvent())\
1.104 + {\
1.105 + return EKeyWasNotConsumed;\
1.106 + }\
1.107 + (aFep).OnStartingHandlingKeyEvent_NoDownUpFilterLC();\
1.108 + if ((aEventCode)==EEventKey)\
1.109 + {\
1.110 + if (!(aFep).IsOn())\
1.111 + {\
1.112 + return (aFep).OnFinishingHandlingKeyEvent_NoDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasNotConsumed);\
1.113 + }\
1.114 + }\
1.115 + }
1.116 +
1.117 +/** Macro to be called by a keyboard-based FEP to return from its CCoeControl::OfferKeyEventL()-overriding
1.118 +function.
1.119 +
1.120 +It should be used instead of the return statement. This variant of the macro
1.121 +should only be used if the FEP_START_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L
1.122 +macro was used at the start of the function.
1.123 +
1.124 +@param aFep The CCoeFep object, should not be a pointer
1.125 +@param aKeyEvent The TKeyEvent object from OfferKeyEventL()
1.126 +@param aEventCode The TEventCode object from OfferKeyEventL()
1.127 +@param aKeyResponse Defined in EPOC32\INCLUDE\COEDEF.
1.128 + If set to EKeyWasNotConsumed, allows the key event to reach the underlying application.
1.129 + If set to EKeyWasConsumed, prevents the key event reaching the underlying application.
1.130 +
1.131 +@publishedAll
1.132 +@released */
1.133 +#define FEP_END_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L(aFep, aKeyEvent, aEventCode, aKeyResponse)\
1.134 + {\
1.135 + return (aFep).OnFinishingHandlingKeyEvent_NoDownUpFilterL((aEventCode), (aKeyEvent), (aKeyResponse));\
1.136 + }
1.137 +
1.138 +
1.139 +
1.140 +#endif // __FEPBUTILS_H__