photosgallery/viewframework/uiutilities/src/glxskinchangemonitor.cpp
changeset 0 4e91876724a2
child 18 bcb43dc84c44
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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 the CGlxSkinChangeMonitor class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21  // Class definition
       
    22 
       
    23 #include "glxskinchangemonitor.h" 
       
    24 
       
    25 //-----------------------------------------------------------------------------
       
    26 // NewL
       
    27 //-----------------------------------------------------------------------------
       
    28 CGlxSkinChangeMonitor* CGlxSkinChangeMonitor::NewL()
       
    29     {
       
    30     CGlxSkinChangeMonitor* self = new (ELeave) CGlxSkinChangeMonitor( );  
       
    31     CleanupStack::PushL( self );
       
    32     // 2nd phase
       
    33     self->ConstructL( );
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 //-----------------------------------------------------------------------------
       
    39 // Destructor
       
    40 //-----------------------------------------------------------------------------
       
    41 CGlxSkinChangeMonitor::~CGlxSkinChangeMonitor()
       
    42     {
       
    43     //ResetAndDestroy()???
       
    44     iSkinChangeObservers.Close();
       
    45     }
       
    46 
       
    47 //-----------------------------------------------------------------------------
       
    48 // C++ Constructor
       
    49 //-----------------------------------------------------------------------------
       
    50 CGlxSkinChangeMonitor::CGlxSkinChangeMonitor( )
       
    51     {
       
    52     }
       
    53  
       
    54 //-----------------------------------------------------------------------------
       
    55 // Symbian 2 phase constructor
       
    56 //-----------------------------------------------------------------------------    
       
    57 void CGlxSkinChangeMonitor::ConstructL()
       
    58     {
       
    59     CreateWindowL();
       
    60     }
       
    61   
       
    62 
       
    63 //-----------------------------------------------------------------------------
       
    64 // HandleResourceChange
       
    65 //-----------------------------------------------------------------------------
       
    66 void CGlxSkinChangeMonitor::HandleResourceChange( TInt aType )
       
    67     {
       
    68     // Call base class method
       
    69     CCoeControl::HandleResourceChange(aType);
       
    70     
       
    71 	// is it skin change 
       
    72    	if( KAknsMessageSkinChange == aType )
       
    73         {  
       
    74         TInt obsCount = iSkinChangeObservers.Count();
       
    75         for (TInt obsIdx = 0; obsIdx < obsCount; ++obsIdx)
       
    76             {            
       
    77             iSkinChangeObservers[obsIdx]->HandleSkinChanged();
       
    78             }     
       
    79         }
       
    80     }
       
    81 
       
    82 //-----------------------------------------------------------------------------
       
    83 // AddSkinChangedObserverL
       
    84 //-----------------------------------------------------------------------------
       
    85 void CGlxSkinChangeMonitor::AddSkinChangeObserverL( MGlxSkinChangeObserver& aObserver )
       
    86 	{
       
    87 	iSkinChangeObservers.AppendL( &aObserver );
       
    88 	}
       
    89 	
       
    90 //-----------------------------------------------------------------------------
       
    91 // RemoveSkinChangedObserver
       
    92 //-----------------------------------------------------------------------------
       
    93 void CGlxSkinChangeMonitor::RemoveSkinChangeObserver( MGlxSkinChangeObserver& aObserver )
       
    94 	{
       
    95 	TInt index = iSkinChangeObservers.Find( &aObserver );
       
    96 
       
    97     if ( index != KErrNotFound ) 
       
    98         {
       
    99         iSkinChangeObservers.Remove( index );
       
   100         }
       
   101 	}
       
   102 
       
   103