skins/AknSkins/src/AknsCombinedBackgroundControlContext.cpp
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Container context containing several contextes.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32cmn.h>
       
    20 #include "AknsCppPreface.h"
       
    21 #include "AknsCombinedBackgroundControlContext.h"
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 // ---------------------------------------------------------------------------
       
    25 // Symbian 1st phase constructor.
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 AKNS_EXPORTED_METHOD(CAknsCombinedBackgroundControlContext::NewL)
       
    29 EXPORT_C CAknsCombinedBackgroundControlContext*
       
    30 CAknsCombinedBackgroundControlContext::NewL( TBool /*aParentAbsolute*/ )
       
    31     {
       
    32 #ifndef RD_FULLSCREEN_WALLPAPER
       
    33     User::Leave( KErrNotSupported );
       
    34 #endif //RD_FULLSCREEN_WALLPAPER
       
    35     CAknsCombinedBackgroundControlContext* self =
       
    36         new( ELeave ) CAknsCombinedBackgroundControlContext;
       
    37     return self;
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // Destructor
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 CAknsCombinedBackgroundControlContext::~CAknsCombinedBackgroundControlContext()
       
    45     {
       
    46 #ifndef RD_FULLSCREEN_WALLPAPER
       
    47     return;
       
    48 #else
       
    49     while (iBgCcArray.Count())
       
    50         {
       
    51         RemoveControlContext( iBgCcArray.Count() -1 );
       
    52         }
       
    53     iBgCcArray.ResetAndDestroy();
       
    54 #endif //RD_FULLSCREEN_WALLPAPER
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // Adds context to combination.
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 AKNS_EXPORTED_METHOD(CAknsCombinedBackgroundControlContext::AddControlContext)
       
    62 EXPORT_C TInt CAknsCombinedBackgroundControlContext::AddControlContext( MAknsControlContext* aControlContext )
       
    63     {
       
    64 #ifndef RD_FULLSCREEN_WALLPAPER
       
    65     return KErrNotSupported;
       
    66 #else
       
    67     TInt err = iBgCcArray.Append( aControlContext );
       
    68     TInt retVal = err;
       
    69     if ( err == KErrNone )
       
    70         {
       
    71         retVal = iBgCcArray.Count() -1;
       
    72         }
       
    73     return retVal;
       
    74 #endif //RD_FULLSCREEN_WALLPAPER
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // Removes context from combination.
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 AKNS_EXPORTED_METHOD(CAknsCombinedBackgroundControlContext::RemoveControlContext)
       
    82 EXPORT_C void CAknsCombinedBackgroundControlContext::RemoveControlContext( const TInt aIndex )
       
    83     {
       
    84 #ifndef RD_FULLSCREEN_WALLPAPER
       
    85     return;
       
    86 #else
       
    87     if ( !( ( aIndex > iBgCcArray.Count() -1 ) || ( aIndex < 0 ) ) )
       
    88         {
       
    89         MAknsControlContext* context = iBgCcArray[ aIndex ];
       
    90         iBgCcArray.Remove( aIndex );
       
    91         delete context;
       
    92         }
       
    93 #endif //RD_FULLSCREEN_WALLPAPER
       
    94     }
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // Returns indexed context from combination.
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 AKNS_EXPORTED_METHOD(CAknsCombinedBackgroundControlContext::GetControlContext)
       
   101 EXPORT_C MAknsControlContext* CAknsCombinedBackgroundControlContext::GetControlContext( const TInt aIndex )
       
   102     {
       
   103 #ifndef RD_FULLSCREEN_WALLPAPER
       
   104     return NULL;
       
   105 #else
       
   106     if ( ( aIndex > iBgCcArray.Count() -1 ) || ( aIndex < 0 ) )
       
   107         {
       
   108         return NULL;
       
   109         }
       
   110     return iBgCcArray[ aIndex ];
       
   111 #endif //RD_FULLSCREEN_WALLPAPER
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CAknsCombinedBackgroundControlContext::IsCompatibleWithType
       
   116 // (other items were commented in a header).
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 TBool CAknsCombinedBackgroundControlContext::IsCompatibleWithType(
       
   120     const TAknsControlContextType aType ) const
       
   121     {
       
   122 #ifndef RD_FULLSCREEN_WALLPAPER
       
   123     return EFalse;
       
   124 #else
       
   125     switch( aType )
       
   126         {
       
   127         case EAknsControlContextTypeCombined:
       
   128             return ETrue;
       
   129 
       
   130         case EAknsControlContextTypeUnknown:
       
   131         case EAknsControlContextTypeBasic:
       
   132         case EAknsControlContextTypeLayered:
       
   133         case EAknsControlContextTypeListBox:
       
   134         case EAknsControlContextTypeFrame:
       
   135             break;
       
   136         }
       
   137     return EFalse;
       
   138 #endif //RD_FULLSCREEN_WALLPAPER
       
   139     }
       
   140 
       
   141 // End of file