phoneplugins/telbranding/src/telbrandingimage.cpp
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 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:  Branding specific image.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "telbrandingimage.h"
       
    20 
       
    21 
       
    22 // ======== LOCAL FUNCTIONS ========
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // CTelBrandingImage::CTelBrandingImage
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CTelBrandingImage::CTelBrandingImage() :
       
    30     iVisibilityAllowed( ETrue )
       
    31     {
       
    32     }
       
    33 
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // CTelBrandingImage::ConstructL
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 void CTelBrandingImage::ConstructL()
       
    40     {
       
    41     }
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // CTelBrandingImage::NewL
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CTelBrandingImage* CTelBrandingImage::NewL()
       
    49     {
       
    50     CTelBrandingImage* self = CTelBrandingImage::NewLC();
       
    51     CleanupStack::Pop( self );
       
    52     return self;
       
    53     }
       
    54 
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CTelBrandingImage::NewLC
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 CTelBrandingImage* CTelBrandingImage::NewLC()
       
    61     {
       
    62     CTelBrandingImage* self = new( ELeave ) CTelBrandingImage;
       
    63     CleanupStack::PushL( self );
       
    64     self->ConstructL();
       
    65     return self;
       
    66     }
       
    67 
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // CTelBrandingImage::~CTelBrandingImage
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 CTelBrandingImage::~CTelBrandingImage()
       
    74     {
       
    75 
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------------------------
       
    79 // CTelBrandingImage::MakeVisible
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 void CTelBrandingImage::MakeVisible( TBool aVisible )
       
    83     {
       
    84     if( iVisibilityAllowed && iLowerPriority )
       
    85         {
       
    86         // Inform lower priority element
       
    87         //  - Allow to be shown when this is not shown
       
    88         //  - Dont allow to show when this is shown
       
    89         iLowerPriority->SetVisibilityAllowed( !aVisible );
       
    90         }
       
    91     
       
    92     if( aVisible )
       
    93         {
       
    94         if( iVisibilityAllowed )
       
    95             {
       
    96             // Make visible since its allowed
       
    97             CTelBubbleImage::MakeVisible( aVisible );
       
    98             }
       
    99         else
       
   100             {
       
   101             // Do nothing when visibilty not allowed
       
   102             }
       
   103         }
       
   104     else
       
   105         {
       
   106         // Always make not visible
       
   107         CTelBubbleImage::MakeVisible( aVisible );
       
   108         }
       
   109 
       
   110     }
       
   111 
       
   112 // ---------------------------------------------------------------------------
       
   113 // CTelBrandingImage::SetVisibilityAllowed
       
   114 // ---------------------------------------------------------------------------
       
   115 //
       
   116 void CTelBrandingImage::SetVisibilityAllowed( TBool aAllowed )
       
   117     {
       
   118     iVisibilityAllowed = aAllowed;
       
   119     
       
   120     if( iLowerPriority )
       
   121         {
       
   122         // Inform lower priority elements
       
   123         iLowerPriority->SetVisibilityAllowed( aAllowed );
       
   124         }
       
   125     
       
   126     if( IsVisible() && !iVisibilityAllowed )
       
   127         {
       
   128         // If visible and visibility not allowed
       
   129         CTelBubbleImage::MakeVisible( EFalse );
       
   130         }
       
   131     
       
   132     }
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // CTelBrandingImage::SetLowerPriorityBranding
       
   136 // ---------------------------------------------------------------------------
       
   137 //
       
   138 void CTelBrandingImage::SetLowerPriorityBranding( 
       
   139     MTelBrandingPriorityHandler* aHandler )
       
   140     {
       
   141     iLowerPriority = aHandler;
       
   142     }
       
   143 
       
   144