phoneapp/phoneui2/tsrc/ut_phoneuikeyeventadapter/cphoneuicontroller_stub.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2009 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: Implementation of CPhoneUIController class.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 
       
    20 #include "CPhoneUIController_Stub.h"
       
    21 #include "phoneconstants.h"
       
    22 
       
    23 int m_scan_code;
       
    24 int m_code;
       
    25 int m_scan_code_down;
       
    26 int m_code_down;
       
    27 int m_repeats;
       
    28 bool m_leave;
       
    29 TEventCode m_eventCode;
       
    30 
       
    31 
       
    32 // ================= MEMBER FUNCTIONS =======================
       
    33 
       
    34 // -----------------------------------------------------------
       
    35 // CPhoneUIController::CPhoneUIController
       
    36 // C++ default constructor can NOT contain any code, that
       
    37 // might leave.
       
    38 // -----------------------------------------------------------
       
    39 //
       
    40 CPhoneUIController_Stub::CPhoneUIController_Stub()  
       
    41 {
       
    42     m_leave = false;	
       
    43 }
       
    44 
       
    45 
       
    46 
       
    47 // -----------------------------------------------------------
       
    48 // Destructor
       
    49 // 
       
    50 // -----------------------------------------------------------
       
    51 
       
    52 CPhoneUIController_Stub::~CPhoneUIController_Stub()
       
    53 {
       
    54 }
       
    55 
       
    56 
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CPhoneUIController_Stub::HandleKeyEventL
       
    60 // ---------------------------------------------------------
       
    61 //
       
    62 TKeyResponse CPhoneUIController_Stub::HandleKeyEventL(
       
    63     const TKeyEvent& aKeyEvent,
       
    64     TEventCode aEventCode )
       
    65 {
       
    66     m_scan_code = 0;
       
    67     m_code = 0;
       
    68     m_scan_code_down = 0;
       
    69     m_code_down = 0;
       
    70     m_eventCode = aEventCode;
       
    71     
       
    72     if (m_leave) {
       
    73         User::Leave(KErrArgument);
       
    74     }
       
    75         
       
    76     m_repeats = aKeyEvent.iRepeats;
       
    77     
       
    78     if(EEventKeyUp == aEventCode) {
       
    79         m_scan_code = aKeyEvent.iScanCode;
       
    80         m_code = aKeyEvent.iCode;
       
    81     } else if(EEventKey == aEventCode) {
       
    82         m_scan_code_down = aKeyEvent.iScanCode;
       
    83         m_code_down = aKeyEvent.iCode;       	
       
    84     } else if(EEventLongPress) {
       
    85         m_scan_code = aKeyEvent.iScanCode;
       
    86         m_code = aKeyEvent.iCode;
       
    87     }
       
    88     
       
    89     return EKeyWasNotConsumed;
       
    90 }
       
    91 
       
    92 
       
    93 
       
    94 //  End of File