idlefw/tsrc/wsplugin/stub/testeventhandler_stub.cpp
branchRCL_3
changeset 111 053c6c7c14f3
equal deleted inserted replaced
110:2c7f27287390 111:053c6c7c14f3
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Keylock handler for Active Idle WS Plug-in.
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 
       
    20 // User includes
       
    21 #include "testeventhandler_stub.h"
       
    22 
       
    23 // Constants
       
    24 
       
    25 namespace T_AiWsPlugin {
       
    26 
       
    27 // ======== LOCAL FUNCTIONS ========
       
    28     
       
    29 // ======== MEMBER FUNCTIONS =======
       
    30 // ----------------------------------------------------------------------------
       
    31 // operator==
       
    32 //
       
    33 // ----------------------------------------------------------------------------
       
    34 //
       
    35 static TBool operator==( const TRawEvent& aLhs, const TRawEvent& aRhs )
       
    36     {
       
    37     const TUint8* lhs = reinterpret_cast<const TUint8*>( &aLhs );
       
    38     const TUint8* rhs = reinterpret_cast<const TUint8*>( &aRhs );
       
    39     
       
    40     return ( Mem::Compare( lhs, sizeof(TRawEvent), rhs, sizeof(TRawEvent) ) == 0 );
       
    41     }
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // ResetEvent
       
    45 //
       
    46 // ----------------------------------------------------------------------------
       
    47 //
       
    48 static void ResetEvent( TRawEvent& aEvent )
       
    49     {
       
    50     Mem::FillZ( &aEvent, sizeof( TRawEvent ) );
       
    51     }
       
    52   
       
    53 // ----------------------------------------------------------------------------
       
    54 // CTestEventHandler::~CTestEventHandler()
       
    55 //
       
    56 // ----------------------------------------------------------------------------
       
    57 //
       
    58 CTestEventHandler::~CTestEventHandler()
       
    59     {
       
    60     }
       
    61 
       
    62 // ----------------------------------------------------------------------------
       
    63 // CTestEventHandler::ResetLastEvent()
       
    64 //
       
    65 // ----------------------------------------------------------------------------
       
    66 //
       
    67 void CTestEventHandler::ResetLastEvent()
       
    68     {
       
    69     ResetEvent( iLastEvent );
       
    70     }
       
    71 
       
    72 // ----------------------------------------------------------------------------
       
    73 // CTestEventHandler::RespondToEvent()
       
    74 //
       
    75 // ----------------------------------------------------------------------------
       
    76 //
       
    77 void CTestEventHandler::RespondToEvent( const TRawEvent& aEvent )
       
    78     {
       
    79     iRespondToEvent = aEvent;
       
    80     }
       
    81 
       
    82 // ----------------------------------------------------------------------------
       
    83 // CTestEventHandler::SetUiStateQuery()
       
    84 //
       
    85 // ----------------------------------------------------------------------------
       
    86 //
       
    87 void CTestEventHandler::SetUiStateQuery( MUiState& aUiState )
       
    88     {
       
    89     iUiState = &aUiState;
       
    90     }
       
    91   
       
    92 // ----------------------------------------------------------------------------
       
    93 // CTestEventHandler::FocusChanged()
       
    94 //
       
    95 // ----------------------------------------------------------------------------
       
    96 //
       
    97 void CTestEventHandler::FocusChanged( TBool aState )
       
    98     {
       
    99     iFocus = aState;
       
   100     }
       
   101 
       
   102 // ----------------------------------------------------------------------------
       
   103 // CTestEventHandler::OfferRawEvent()
       
   104 //
       
   105 // ----------------------------------------------------------------------------
       
   106 //
       
   107 TBool CTestEventHandler::OfferRawEvent( const TRawEvent& aRawEvent )
       
   108     {    
       
   109     if ( iRespondToEvent == aRawEvent )
       
   110         {
       
   111         iLastEvent = aRawEvent;
       
   112         
       
   113         ResetEvent( iRespondToEvent );
       
   114         return ETrue;
       
   115         }
       
   116     
       
   117     return EFalse;    
       
   118     }
       
   119 
       
   120 // ----------------------------------------------------------------------------
       
   121 // CTestEventHandler::CTestEventHandler()
       
   122 //
       
   123 // ----------------------------------------------------------------------------
       
   124 //
       
   125 CTestEventHandler::CTestEventHandler()
       
   126     {    
       
   127     }
       
   128 
       
   129 } // namespace T_AiWsPlugin
       
   130 
       
   131 // End of file