imstutils/imconversationview/imcvuiapp/src/cimcvappinputabsorber.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:33:36 +0100
branchRCL_3
changeset 29 9a48e301e94b
parent 0 5e5d6b214f4f
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Instance of this class catches key inputs when it is activated
*
*/



// INCLUDE FILES
#include    "cimcvappinputabsorber.h"
#include	<eikenv.h>
#include	<eikappui.h>
#include	<avkon.rsg>

// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CIMCVAppInputAbsorber::CIMCVAppInputAbsorber
// C++ default constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
CIMCVAppInputAbsorber::CIMCVAppInputAbsorber()
    {
    }

// -----------------------------------------------------------------------------
// CIMCVAppInputAbsorber::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CIMCVAppInputAbsorber::ConstructL()
    {
	CreateWindowL();
	SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
	ActivateL();
	ClaimPointerGrab( ETrue );	
	iAppUi = iEikonEnv->EikAppUi();	
    }

// -----------------------------------------------------------------------------
// CIMCVAppInputAbsorber::NewL
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CIMCVAppInputAbsorber* CIMCVAppInputAbsorber::NewL()
    {
    CIMCVAppInputAbsorber* self = new( ELeave ) CIMCVAppInputAbsorber;
    
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );

    return self;
    }

    
// Destructor
CIMCVAppInputAbsorber::~CIMCVAppInputAbsorber()
    {
    if ( iIsCaptured ) 
        {
        if ( iAppUi ) 
            {
            iAppUi->RemoveFromStack( this );
            }
        }
    }

// ---------------------------------------------------------
// CIMCVAppInputAbsorber::CaptureEventsL()
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CIMCVAppInputAbsorber::CaptureEventsL()
	{
	if ( !iIsCaptured ) 
		{
		iAppUi->AddToStackL( this );
        SetPointerCapture();
		}
    
	iIsCaptured = ETrue;	
	}

// ---------------------------------------------------------
// CIMCVAppInputAbsorber::Release()
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CIMCVAppInputAbsorber::Release()
	{
	if ( iIsCaptured ) 
		{
		iAppUi->RemoveFromStack( this );
		SetPointerCapture( EFalse );
		}	

	iIsCaptured = EFalse;
	}


// ---------------------------------------------------------
// CIMCVAppInputAbsorber::IsCaptured()
// (other items were commented in a header).
// ---------------------------------------------------------
//
TBool CIMCVAppInputAbsorber::IsCaptured() const
	{
	return iIsCaptured;
	}


// -----------------------------------------------------------------------------
// CIMCVAppInputAbsorber::OfferKeyEventL
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TKeyResponse CIMCVAppInputAbsorber::OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/, 
											  TEventCode /*aType*/ )
	{
    // consume all keys
	return EKeyWasConsumed;
	}

// -----------------------------------------------------------------------------
// CIMCVAppInputAbsorber::HandlePointerEventL
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CIMCVAppInputAbsorber::HandlePointerEventL( const TPointerEvent& aPointerEvent )
    {
    // For debugging purposes. 
    CCoeControl::HandlePointerEventL( aPointerEvent );
    }

//  End of File