uifw/AvKon/tsrc/bc/bctesttemplate/src/bctesttemplateview.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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:  view
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <aknviewappui.h>
       
    20 #include <bctesttemplate.rsg>
       
    21 
       
    22 #include "bctesttemplate.hrh"
       
    23 #include "bctesttemplateview.h"
       
    24 #include "bctesttemplatecontainer.h"
       
    25 #include "bctestutil.h"
       
    26 
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // Symbian 2nd static Constructor
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CBCTestTemplateView* CBCTestTemplateView::NewL( CBCTestUtil* aUtil )
       
    35     {
       
    36     CBCTestTemplateView* self = new( ELeave ) CBCTestTemplateView();
       
    37     CleanupStack::PushL( self );
       
    38     self->ConstructL( aUtil );
       
    39     CleanupStack::Pop( self );
       
    40     return self;
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // C++ default Constructor
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 CBCTestTemplateView::CBCTestTemplateView()
       
    48     {
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // Symbian 2nd Constructor
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CBCTestTemplateView::ConstructL( CBCTestUtil* aUtil )
       
    56     {
       
    57     BaseConstructL( R_BCTESTTEMPLATE_VIEW );
       
    58 
       
    59     iContainer = new( ELeave ) CBCTestTemplateContainer();
       
    60     iContainer->SetMopParent( this );
       
    61     iContainer->ConstructL( ClientRect() );
       
    62     AppUi()->AddToStackL( *this, iContainer );
       
    63     iContainer->MakeVisible( ETrue );
       
    64 
       
    65     iTestUtil = aUtil;
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // Destructor
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CBCTestTemplateView::~CBCTestTemplateView()
       
    73     {
       
    74     if ( iContainer )
       
    75         {
       
    76         AppUi()->RemoveFromStack( iContainer );
       
    77         }
       
    78     delete iContainer;
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // CBCTestTemplateView::Id
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 TUid CBCTestTemplateView::Id() const
       
    86     {
       
    87     return KBCTestTemplateViewId;
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // CBCTestTemplateView::DoActivateL
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 void CBCTestTemplateView::DoActivateL( const TVwsViewId&, TUid, 
       
    95     const TDesC8& )
       
    96     {
       
    97     }
       
    98 
       
    99 // ---------------------------------------------------------------------------
       
   100 // CBCTestTemplateView::DoDeactivate
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 void CBCTestTemplateView::DoDeactivate()
       
   104     {
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CBCTestTemplateView::Container
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 CBCTestTemplateContainer* CBCTestTemplateView::Container()
       
   112     {
       
   113 	return iContainer;
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // CBCTestTemplateView::HandleCommandL
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 void CBCTestTemplateView::HandleCommandL( TInt aCommand )
       
   121     {
       
   122     switch ( aCommand )
       
   123         {
       
   124         case EProgCmdAutoTest:
       
   125             iTestUtil->RunL();
       
   126             break;
       
   127         default:
       
   128             if ( aCommand > EBCTestCmdEmptyOutline &&
       
   129                  aCommand < EBCTestCmdMaxOutline )
       
   130                 {
       
   131                 iTestUtil->RunL( aCommand );
       
   132                 }
       
   133             break;
       
   134         }
       
   135     }