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