camerauis/cameraapp/generic/src/CamIndicatorData.cpp
changeset 0 1ddebce53859
equal deleted inserted replaced
-1:000000000000 0:1ddebce53859
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Camera Indicator control*
       
    15 */
       
    16 
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <cameraapp.rsg>
       
    20 #include <vgacamsettings.rsg>
       
    21 #include "CamIndicatorResourceReader.h"
       
    22 #include "CamIndicatorData.h"
       
    23 #include "camlogging.h"
       
    24 
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CCamIndicatorData::NewL
       
    32 // Symbian OS two-phased constructor
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CCamIndicatorData* CCamIndicatorData::NewLC( TResourceReader& aReader )
       
    36     {
       
    37     CCamIndicatorData* self = new( ELeave ) CCamIndicatorData();
       
    38     CleanupStack::PushL( self );
       
    39     self->ConstructL( aReader );
       
    40     return self;
       
    41     }
       
    42 
       
    43 // Destructor
       
    44 CCamIndicatorData::~CCamIndicatorData()
       
    45   {
       
    46   PRINT( _L("Camera => ~CCamIndicatorData") );
       
    47   iBitmapIdArray.Reset();
       
    48   iBitmapIdArray.Close();
       
    49   PRINT( _L("Camera <= ~CCamIndicatorData") );
       
    50   }
       
    51 
       
    52 // ---------------------------------------------------------
       
    53 // CCamIndicatorData::ConstructL
       
    54 // Symbian OS 2nd phase constructor
       
    55 // ---------------------------------------------------------
       
    56 //
       
    57 void CCamIndicatorData::ConstructL( TResourceReader& aReader )
       
    58     {
       
    59     // first integer (TInt16) represent indicator id
       
    60     iIndicatorId = aReader.ReadInt16();
       
    61 
       
    62     // next 4 integers (TInt16) represent TRect cordinates
       
    63     iRect.iTl.iX = aReader.ReadInt16();
       
    64     iRect.iTl.iY = aReader.ReadInt16();
       
    65     iRect.iBr.iX = aReader.ReadInt16();
       
    66     iRect.iBr.iY = aReader.ReadInt16();
       
    67 
       
    68     // next integer (TInt16) represents the number of bitmaps
       
    69     iIndicatorBitmapCount = aReader.ReadInt16();
       
    70 
       
    71     // bitmap ids are TInt32
       
    72     TInt32 bmpid;
       
    73 	TInt ii;
       
    74     for ( ii = 0; ii < iIndicatorBitmapCount; ii++ )
       
    75         {
       
    76         bmpid=aReader.ReadInt32();
       
    77         User::LeaveIfError( iBitmapIdArray.Append( bmpid ) );
       
    78         }
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // CCamIndicatorData::CCamIndicatorData
       
    83 // C++ constructor
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 CCamIndicatorData::CCamIndicatorData()
       
    87     {
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // CCamIndicatorData::IndicatorId
       
    92 // returns the camera indicator identifier
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 TInt CCamIndicatorData::IndicatorId() const
       
    96     {
       
    97     return iIndicatorId;
       
    98     }
       
    99 
       
   100 // ---------------------------------------------------------------------------
       
   101 // CCamIndicatorData::IndicatorRect
       
   102 // returns the indicator rectangle cooords
       
   103 // ---------------------------------------------------------------------------
       
   104 //
       
   105 TRect CCamIndicatorData::IndicatorRect() const
       
   106     {
       
   107     return iRect;
       
   108     }
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // CCamIndicatorData::IndicatorBitmapCount
       
   112 // returns the number of available bitmaps for the indicator
       
   113 // ---------------------------------------------------------------------------
       
   114 //
       
   115 TInt CCamIndicatorData::IndicatorBitmapCount() const
       
   116     {
       
   117     return iIndicatorBitmapCount;
       
   118     }
       
   119 
       
   120 // ---------------------------------------------------------------------------
       
   121 // CCamIndicatorData::IndicatorBitmapId
       
   122 // returns the bitmap id for the specified index
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 TInt32 CCamIndicatorData::IndicatorBitmapId( TInt aIndex ) const
       
   126     {
       
   127     return iBitmapIdArray[ aIndex ];
       
   128     }
       
   129 
       
   130 // End of File