photosgallery/viewframework/uiutilities/src/glxskinchangemonitor.cpp
branchRCL_3
changeset 26 5b3385a43d68
equal deleted inserted replaced
25:8e5f6eea9c9f 26:5b3385a43d68
       
     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     iSkinChangeObservers.Close();
       
    44     }
       
    45 
       
    46 //-----------------------------------------------------------------------------
       
    47 // C++ Constructor
       
    48 //-----------------------------------------------------------------------------
       
    49 CGlxSkinChangeMonitor::CGlxSkinChangeMonitor( )
       
    50     {
       
    51     }
       
    52  
       
    53 //-----------------------------------------------------------------------------
       
    54 // Symbian 2 phase constructor
       
    55 //-----------------------------------------------------------------------------    
       
    56 void CGlxSkinChangeMonitor::ConstructL()
       
    57     {
       
    58     CreateWindowL();
       
    59     }
       
    60   
       
    61 
       
    62 //-----------------------------------------------------------------------------
       
    63 // HandleResourceChange
       
    64 //-----------------------------------------------------------------------------
       
    65 void CGlxSkinChangeMonitor::HandleResourceChange( TInt aType )
       
    66     {
       
    67     // Call base class method
       
    68     CCoeControl::HandleResourceChange(aType);
       
    69     
       
    70 	// is it skin change 
       
    71    	if( KAknsMessageSkinChange == aType )
       
    72         {  
       
    73         TInt obsCount = iSkinChangeObservers.Count();
       
    74         for (TInt obsIdx = 0; obsIdx < obsCount; ++obsIdx)
       
    75             {            
       
    76             iSkinChangeObservers[obsIdx]->HandleSkinChanged();
       
    77             }     
       
    78         }
       
    79     }
       
    80 
       
    81 //-----------------------------------------------------------------------------
       
    82 // AddSkinChangedObserverL
       
    83 //-----------------------------------------------------------------------------
       
    84 void CGlxSkinChangeMonitor::AddSkinChangeObserverL( MGlxSkinChangeObserver& aObserver )
       
    85 	{
       
    86 	iSkinChangeObservers.AppendL( &aObserver );
       
    87 	}
       
    88 	
       
    89 //-----------------------------------------------------------------------------
       
    90 // RemoveSkinChangedObserver
       
    91 //-----------------------------------------------------------------------------
       
    92 void CGlxSkinChangeMonitor::RemoveSkinChangeObserver( MGlxSkinChangeObserver& aObserver )
       
    93 	{
       
    94 	TInt index = iSkinChangeObservers.Find( &aObserver );
       
    95 
       
    96     if ( index != KErrNotFound ) 
       
    97         {
       
    98         iSkinChangeObservers.Remove( index );
       
    99         }
       
   100 	}
       
   101 
       
   102