fep/frontendprocessor/include/FEPBUTILS.H
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __FEPBUTILS_H__
       
    17 #define __FEPBUTILS_H__
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 /** Macro to be called by a keyboard-based FEP at the start of its CCoeControl::OfferKeyEventL()-overriding 
       
    23 function.
       
    24 
       
    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 
       
    30 EKeyWasNotConsumed.
       
    31 
       
    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.
       
    34 
       
    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()
       
    38 
       
    39 @see TEventCode 
       
    40 @publishedAll
       
    41 @released */
       
    42 #define FEP_START_KEY_EVENT_HANDLER_L(aFep, aKeyEvent, aEventCode)\
       
    43 	{\
       
    44 	if ((aFep).IsSimulatingKeyEvent())\
       
    45 		{\
       
    46 		return EKeyWasNotConsumed;\
       
    47 		}\
       
    48 	(aFep).OnStartingHandlingKeyEvent_WithDownUpFilterLC();\
       
    49 	if (((aEventCode)!=EEventKey))\
       
    50 		{\
       
    51 		return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasConsumed);\
       
    52 		}\
       
    53 	if (!(aFep).IsOn())\
       
    54 		{\
       
    55 		return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasNotConsumed);\
       
    56 		}\
       
    57 	}
       
    58 
       
    59 /** Macro to be called by a keyboard-based FEP to return from its CCoeControl::OfferKeyEventL()-overriding 
       
    60 function.
       
    61 
       
    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. 
       
    64 
       
    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.
       
    70 
       
    71 @publishedAll
       
    72 @released */
       
    73 #define FEP_END_KEY_EVENT_HANDLER_L(aFep, aKeyEvent, aKeyResponse)\
       
    74 	{\
       
    75 	return (aFep).OnFinishingHandlingKeyEvent_WithDownUpFilterL(EEventKey, (aKeyEvent), (aKeyResponse));\
       
    76 	}
       
    77 
       
    78 /** Macro to be called by a keyboard-based FEP at the start of its CCoeControl::OfferKeyEventL()-overriding 
       
    79 function.
       
    80 
       
    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. 
       
    87 
       
    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 
       
    90 from the function. 
       
    91 
       
    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()
       
    95 
       
    96 @publishedAll
       
    97 @released */
       
    98 #define FEP_START_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L(aFep, aKeyEvent, aEventCode)\
       
    99 	{\
       
   100 	if ((aFep).IsSimulatingKeyEvent())\
       
   101 		{\
       
   102 		return EKeyWasNotConsumed;\
       
   103 		}\
       
   104 	(aFep).OnStartingHandlingKeyEvent_NoDownUpFilterLC();\
       
   105 	if ((aEventCode)==EEventKey)\
       
   106 		{\
       
   107 		if (!(aFep).IsOn())\
       
   108 			{\
       
   109 			return (aFep).OnFinishingHandlingKeyEvent_NoDownUpFilterL((aEventCode), (aKeyEvent), EKeyWasNotConsumed);\
       
   110 			}\
       
   111 		}\
       
   112 	}
       
   113 
       
   114 /** Macro to be called by a keyboard-based FEP to return from its CCoeControl::OfferKeyEventL()-overriding 
       
   115 function.
       
   116 
       
   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. 
       
   120 
       
   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.
       
   127 
       
   128 @publishedAll
       
   129 @released */
       
   130 #define FEP_END_KEY_EVENT_HANDLER_NO_DOWN_UP_FILTER_L(aFep, aKeyEvent, aEventCode, aKeyResponse)\
       
   131 	{\
       
   132 	return (aFep).OnFinishingHandlingKeyEvent_NoDownUpFilterL((aEventCode), (aKeyEvent), (aKeyResponse));\
       
   133 	}
       
   134 
       
   135 
       
   136 
       
   137 #endif // __FEPBUTILS_H__
       
   138 
       
   139