camerauis/cameraapp/generic/src/CamInfoListBoxModel.cpp
changeset 19 d9aefe59d544
parent 3 8b2d6d0384b0
child 21 fa6d9f75d6a6
child 28 3075d9b614e6
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
     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:  Model for CamInfoListBox*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <barsread.h>
       
    21 #include <cameraapp.rsg>
       
    22 #include <vgacamsettings.rsg>
       
    23 #include "CamInfoListBoxModel.h"
       
    24 #include "CamCaptureSetupListItem.h"
       
    25 #include "camlogging.h"
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CCamInfoListBoxModel::CCamInfoListBoxModel
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CCamInfoListBoxModel::CCamInfoListBoxModel( CCamAppController& aController,
       
    37         				 RPointerArray<HBufC>& aSummaryTitleTextArray,
       
    38         				 RPointerArray<HBufC>& aSummaryDescriptionTextArray )
       
    39 : CCamCaptureSetupListBoxModel( aController, ETrue ),  
       
    40   iSummaryTitleTextArray( aSummaryTitleTextArray ),
       
    41   iSummaryDescriptionTextArray( aSummaryDescriptionTextArray )
       
    42     {
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CCamInfoListBoxModel::ConstructL
       
    47 // Symbian 2nd phase constructor can leave.
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 void CCamInfoListBoxModel::ConstructL( TInt aResourceId, TRect aListBoxRect )
       
    51     {
       
    52     // read layout data
       
    53     ReadLayoutData( aListBoxRect ); 
       
    54     GetListboxDataL( aResourceId );    	
       
    55     }
       
    56  
       
    57 // -----------------------------------------------------------------------------
       
    58 // CCamInfoListBoxModel::GetListboxDataL
       
    59 // -----------------------------------------------------------------------------
       
    60 //   
       
    61 void CCamInfoListBoxModel::GetListboxDataL( TInt aArrayResourceId )
       
    62  	{
       
    63  	
       
    64     
       
    65     // create array from resource
       
    66     TResourceReader reader;
       
    67     CEikonEnv::Static()->CreateResourceReaderLC( reader, aArrayResourceId );
       
    68     const TInt count = reader.ReadInt16();
       
    69     
       
    70     // for each entry in the resource array, create a new list item
       
    71 	TInt i;
       
    72     for ( i = 0; i < count; i++ )
       
    73         {
       
    74         CCamCaptureSetupListItem* listItem = CCamCaptureSetupListItem::
       
    75                                NewLC( reader, iIconLayoutData );
       
    76         
       
    77         iItemArray.AppendL( listItem );
       
    78         CleanupStack::Pop( listItem );        
       
    79         }    
       
    80     CleanupStack::PopAndDestroy(); // reader
       
    81  	}
       
    82 
       
    83 
       
    84 	
       
    85 // -----------------------------------------------------------------------------
       
    86 // CCamInfoListBoxModel::NewLC
       
    87 // Two-phased constructor.
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 CCamInfoListBoxModel* CCamInfoListBoxModel::NewLC( CCamAppController& aController,
       
    91         				 RPointerArray<HBufC>& aSummaryTitleTextArray,
       
    92         				 RPointerArray<HBufC>& aSummaryDescriptionTextArray,
       
    93         				 TInt aResourceId,
       
    94         				 TRect aListBoxRect )
       
    95     {
       
    96     CCamInfoListBoxModel* self = new( ELeave ) CCamInfoListBoxModel( aController, 
       
    97     													aSummaryTitleTextArray, 
       
    98     													aSummaryDescriptionTextArray );
       
    99     
       
   100     CleanupStack::PushL( self );
       
   101     self->ConstructL( aResourceId, aListBoxRect );
       
   102     return self;
       
   103     }
       
   104 
       
   105     
       
   106 // Destructor
       
   107 CCamInfoListBoxModel::~CCamInfoListBoxModel()
       
   108     {
       
   109     }
       
   110 
       
   111 //  End of File