extras/about/src/AboutImage.cpp
changeset 13 83b3f7c09925
parent 2 c4c2ac0facfd
equal deleted inserted replaced
2:c4c2ac0facfd 13:83b3f7c09925
     1 /*
       
     2 * Copyright (c) 2002 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: offer bitmap for application.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <fbs.h>
       
    21 #include "AboutImage.h"
       
    22 #include <AknIconUtils.h>
       
    23 
       
    24 // ================= MEMBER FUNCTIONS ==========================================
       
    25 
       
    26 CAboutImage::CAboutImage()
       
    27     {
       
    28     }
       
    29 
       
    30 CAboutImage::~CAboutImage()
       
    31     {
       
    32     delete iBitmap;
       
    33     }
       
    34 
       
    35 CAboutImage* CAboutImage::NewLC( const TDesC& aFileName,
       
    36                                  TInt aBitmapId,
       
    37                                  TInt aStartLine,
       
    38                                  TInt aBaseLineDelta )
       
    39     {
       
    40     CAboutImage* self = new( ELeave ) CAboutImage();
       
    41     CleanupStack::PushL( self );
       
    42 
       
    43     /*self->iBitmap = new( ELeave ) CFbsBitmap;
       
    44     self->iBitmap->Load( aFileName, aBitmapId );*/
       
    45 
       
    46 	self->iBitmap  = AknIconUtils::CreateIconL(aFileName, aBitmapId );
       
    47     self->iStartLine = aStartLine;
       
    48 
       
    49     // enough lines so that image and margins fit in them.
       
    50 
       
    51     TInt lines( ( self->HeightInPixels() + 
       
    52                   KImageTopMargin + 
       
    53                   KImageBottomMargin +
       
    54                   aBaseLineDelta - 1 ) / aBaseLineDelta );
       
    55 
       
    56     self->iEndLine = aStartLine + lines - 1;
       
    57     return self;
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CAboutImage::HeightInPixels()
       
    62 // -----------------------------------------------------------------------------
       
    63 
       
    64 TInt CAboutImage::HeightInPixels() const
       
    65     {
       
    66     return iBitmap->SizeInPixels().iHeight;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CAboutImage::WidthInPixels()
       
    71 // -----------------------------------------------------------------------------
       
    72 
       
    73 TInt CAboutImage::WidthInPixels() const
       
    74     {
       
    75     return iBitmap->SizeInPixels().iWidth;
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CAboutImage::StartLine()
       
    80 // -----------------------------------------------------------------------------
       
    81 
       
    82 TInt CAboutImage::StartLine() const
       
    83     {
       
    84     return iStartLine;
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CAboutImage::EndLine()
       
    89 // -----------------------------------------------------------------------------
       
    90 
       
    91 TInt CAboutImage::EndLine() const
       
    92     {
       
    93     return iEndLine;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CAboutImage::Lines()
       
    98 // -----------------------------------------------------------------------------
       
    99 
       
   100 TInt CAboutImage::Lines() const
       
   101     {
       
   102     return iEndLine - iStartLine + 1;
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CAboutImage::Bitmap()
       
   107 // -----------------------------------------------------------------------------
       
   108 
       
   109 const CFbsBitmap* CAboutImage::Bitmap() const
       
   110     {
       
   111     return iBitmap;
       
   112     }
       
   113 
       
   114 // End of File