browserutilities/connectionmanager/Src/ConnManKeyAbsorber.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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: 
       
    15 *       Methods for CConnManKeyAbsorber class. Absorbs all the key presses.
       
    16 *       
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #include <eikenv.h>
       
    22 #include <eikappui.h>
       
    23 #include "ConnManKeyAbsorber.h"
       
    24 
       
    25 CConnManKeyAbsorber::CConnManKeyAbsorber()
       
    26 	{
       
    27 	}
       
    28 
       
    29 CConnManKeyAbsorber::~CConnManKeyAbsorber()
       
    30 	{
       
    31 	if (iCoeEnv && iAppUi)
       
    32 	iAppUi->RemoveFromStack(this);
       
    33 	}
       
    34 
       
    35 CConnManKeyAbsorber* CConnManKeyAbsorber::NewLC()
       
    36 	{
       
    37 	CConnManKeyAbsorber* self=new(ELeave) CConnManKeyAbsorber();
       
    38 	CleanupStack::PushL(self);
       
    39 	self->ConstructL();
       
    40 	return self;
       
    41 	}
       
    42 
       
    43 
       
    44 void CConnManKeyAbsorber::ConstructL()
       
    45 	{
       
    46 	CreateWindowL();
       
    47 	SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
    48 	ActivateL();
       
    49 	SetPointerCapture( ETrue );
       
    50 	ClaimPointerGrab( ETrue );
       
    51 	iAppUi=iEikonEnv->EikAppUi();
       
    52 	}
       
    53 
       
    54 TKeyResponse CConnManKeyAbsorber::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
       
    55 	{
       
    56 	return EKeyWasConsumed;
       
    57 	}
       
    58 
       
    59 
       
    60 void CConnManKeyAbsorber::AddToStackL()
       
    61 	{
       
    62 	if ( !iAddedToStack )
       
    63 		{
       
    64 		iAppUi->AddToStackL( this, ECoeStackPriorityCba );
       
    65 		iAddedToStack = ETrue;
       
    66 		}
       
    67 	}
       
    68 
       
    69 
       
    70 void CConnManKeyAbsorber::RemoveFromStack()
       
    71 	{
       
    72 	if ( iAddedToStack )
       
    73 		{
       
    74 		iAppUi->RemoveFromStack( this );
       
    75 		}
       
    76 	iAddedToStack = EFalse;
       
    77 	}
       
    78 
       
    79 
       
    80 void CConnManKeyAbsorber::CleanupOnLeave( TAny* aSelf )
       
    81 	{
       
    82 	( static_cast< CConnManKeyAbsorber* >( aSelf ) )->RemoveFromStack( );
       
    83 	}
       
    84 // End of File