uifw/AvKon/src/AknNaviForegroundObserver.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2003-2007 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:  A foreground observer control in the status pane's
       
    15 *                navigation pane.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "AknNaviForegroundObserver.h"
       
    22 
       
    23 #include <AknTasHook.h>
       
    24 CAknNaviForegroundObserver::CAknNaviForegroundObserver(){};
       
    25 
       
    26 CAknNaviForegroundObserver::~CAknNaviForegroundObserver()
       
    27     {
       
    28     AKNTASHOOK_REMOVE();
       
    29     iCoeEnv->RemoveForegroundObserver( *this );     
       
    30     };
       
    31 
       
    32 CAknNaviForegroundObserver* CAknNaviForegroundObserver::NewL(
       
    33     CAknNavigationControlContainer* aParent )
       
    34     {
       
    35 	CAknNaviForegroundObserver* self =
       
    36 	    CAknNaviForegroundObserver::NewLC( aParent );
       
    37 	CleanupStack::Pop( self );
       
    38 	return self;
       
    39     }
       
    40 
       
    41 CAknNaviForegroundObserver* CAknNaviForegroundObserver::NewLC(
       
    42     CAknNavigationControlContainer* aParent )
       
    43     {
       
    44 	CAknNaviForegroundObserver* self =
       
    45 	    new (ELeave) CAknNaviForegroundObserver();
       
    46 	CleanupStack::PushL( self );
       
    47 	self->ConstructL( aParent );
       
    48 	AKNTASHOOK_ADDL( self, "CAknNaviForegroundObserver" );
       
    49 	return self;
       
    50     }
       
    51 
       
    52 void CAknNaviForegroundObserver::ConstructL(
       
    53     CAknNavigationControlContainer* aParent )
       
    54     {
       
    55     iParent = aParent;
       
    56     iHasForegroundGained = EFalse;
       
    57     iCoeEnv->AddForegroundObserverL( *this );
       
    58     MakeVisible( EFalse );
       
    59     }
       
    60 
       
    61 void CAknNaviForegroundObserver::HandleGainingForeground()
       
    62     {
       
    63     iHasForegroundGained = ETrue;
       
    64     TRAP_IGNORE( iParent->HandleGainingForegroundL() );
       
    65     }
       
    66 
       
    67 void CAknNaviForegroundObserver::HandleLosingForeground()
       
    68     {
       
    69     iHasForegroundGained = EFalse;
       
    70     iParent->HandleLosingForeground();
       
    71     }
       
    72 
       
    73 TBool CAknNaviForegroundObserver::HasForegroundGained()
       
    74     {
       
    75     return iHasForegroundGained;
       
    76     }