imstutils/imconversationview/imcvuiapp/src/cimcvappinputabsorber.cpp
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     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:  Instance of this class catches key inputs when it is activated
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "cimcvappinputabsorber.h"
       
    22 #include	<eikenv.h>
       
    23 #include	<eikappui.h>
       
    24 #include	<avkon.rsg>
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CIMCVAppInputAbsorber::CIMCVAppInputAbsorber
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CIMCVAppInputAbsorber::CIMCVAppInputAbsorber()
       
    35     {
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CIMCVAppInputAbsorber::ConstructL
       
    40 // Symbian 2nd phase constructor can leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void CIMCVAppInputAbsorber::ConstructL()
       
    44     {
       
    45 	CreateWindowL();
       
    46 	SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) );
       
    47 	ActivateL();
       
    48 	ClaimPointerGrab( ETrue );	
       
    49 	iAppUi = iEikonEnv->EikAppUi();	
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CIMCVAppInputAbsorber::NewL
       
    54 // Two-phased constructor.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 CIMCVAppInputAbsorber* CIMCVAppInputAbsorber::NewL()
       
    58     {
       
    59     CIMCVAppInputAbsorber* self = new( ELeave ) CIMCVAppInputAbsorber;
       
    60     
       
    61     CleanupStack::PushL( self );
       
    62     self->ConstructL();
       
    63     CleanupStack::Pop( self );
       
    64 
       
    65     return self;
       
    66     }
       
    67 
       
    68     
       
    69 // Destructor
       
    70 CIMCVAppInputAbsorber::~CIMCVAppInputAbsorber()
       
    71     {
       
    72     if ( iIsCaptured ) 
       
    73         {
       
    74         if ( iAppUi ) 
       
    75             {
       
    76             iAppUi->RemoveFromStack( this );
       
    77             }
       
    78         }
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------
       
    82 // CIMCVAppInputAbsorber::CaptureEventsL()
       
    83 // (other items were commented in a header).
       
    84 // ---------------------------------------------------------
       
    85 //
       
    86 void CIMCVAppInputAbsorber::CaptureEventsL()
       
    87 	{
       
    88 	if ( !iIsCaptured ) 
       
    89 		{
       
    90 		iAppUi->AddToStackL( this );
       
    91         SetPointerCapture();
       
    92 		}
       
    93     
       
    94 	iIsCaptured = ETrue;	
       
    95 	}
       
    96 
       
    97 // ---------------------------------------------------------
       
    98 // CIMCVAppInputAbsorber::Release()
       
    99 // (other items were commented in a header).
       
   100 // ---------------------------------------------------------
       
   101 //
       
   102 void CIMCVAppInputAbsorber::Release()
       
   103 	{
       
   104 	if ( iIsCaptured ) 
       
   105 		{
       
   106 		iAppUi->RemoveFromStack( this );
       
   107 		SetPointerCapture( EFalse );
       
   108 		}	
       
   109 
       
   110 	iIsCaptured = EFalse;
       
   111 	}
       
   112 
       
   113 
       
   114 // ---------------------------------------------------------
       
   115 // CIMCVAppInputAbsorber::IsCaptured()
       
   116 // (other items were commented in a header).
       
   117 // ---------------------------------------------------------
       
   118 //
       
   119 TBool CIMCVAppInputAbsorber::IsCaptured() const
       
   120 	{
       
   121 	return iIsCaptured;
       
   122 	}
       
   123 
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CIMCVAppInputAbsorber::OfferKeyEventL
       
   127 // (other items were commented in a header).
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 TKeyResponse CIMCVAppInputAbsorber::OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/, 
       
   131 											  TEventCode /*aType*/ )
       
   132 	{
       
   133     // consume all keys
       
   134 	return EKeyWasConsumed;
       
   135 	}
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CIMCVAppInputAbsorber::HandlePointerEventL
       
   139 // (other items were commented in a header).
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 void CIMCVAppInputAbsorber::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   143     {
       
   144     // For debugging purposes. 
       
   145     CCoeControl::HandlePointerEventL( aPointerEvent );
       
   146     }
       
   147 
       
   148 //  End of File