browser/ui/src/ARView.cpp
changeset 0 c316ab048e9d
equal deleted inserted replaced
-1:000000000000 0:c316ab048e9d
       
     1 /*
       
     2  * Name        : ARView.cpp
       
     3  * Description : 
       
     4  * Project     : This file is part of OpenMAR, an Open Mobile Augmented Reality browser
       
     5  * Website     : http://OpenMAR.org
       
     6  *
       
     7  * Copyright (c) 2010 David Caabeiro
       
     8  *
       
     9  * All rights reserved. This program and the accompanying materials are made available 
       
    10  * under the terms of the Eclipse Public License v1.0 which accompanies this 
       
    11  * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
       
    12  *
       
    13  */
       
    14 
       
    15 #include "ARView.h"
       
    16 
       
    17 #include <AknViewAppui.h>
       
    18 
       
    19 #include <OpenMAR_0x2002E1AB.rsg>
       
    20 
       
    21 #include "Application.hrh"
       
    22 
       
    23 #include "ARContainer.h"
       
    24 
       
    25 #include <AknUtils.h>
       
    26 
       
    27 #include "Logger.h"
       
    28 
       
    29 CARView* CARView::NewL()
       
    30 {
       
    31     CARView* self = new(ELeave) CARView();
       
    32     CleanupStack::PushL(self);
       
    33     self->ConstructL();
       
    34     CleanupStack::Pop(self);
       
    35 
       
    36     return self;
       
    37 }
       
    38 
       
    39 CARView::~CARView()
       
    40 {
       
    41     DoDeactivate();
       
    42 }
       
    43 
       
    44 CARView::CARView()
       
    45 {}
       
    46 
       
    47 void CARView::ConstructL()
       
    48 {
       
    49     BaseConstructL(R_AR_VIEW);
       
    50 }
       
    51 
       
    52 TUid CARView::Id() const
       
    53 {
       
    54     return TUid::Uid(EARView);
       
    55 }
       
    56 
       
    57 void CARView::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)
       
    58 {
       
    59     LOGTXT("CARView::DoActivateL()");
       
    60 
       
    61     if (!iRenderer)
       
    62     {
       
    63         iPrevViewId = aPrevViewId;
       
    64 
       
    65         // Make status pane invisible
       
    66         CEikStatusPane* statusPane = StatusPane();
       
    67         if (statusPane)
       
    68             statusPane->MakeVisible(EFalse);
       
    69 
       
    70         iRenderer = CARContainer::NewL(*this, AppUi()->ApplicationRect());
       
    71 
       
    72         AppUi()->AddToStackL(*this, iRenderer);
       
    73     }
       
    74 }
       
    75 
       
    76 void CARView::DoDeactivate()
       
    77 {
       
    78     if (iRenderer)
       
    79     {
       
    80         AppUi()->RemoveFromViewStack(*this, iRenderer);
       
    81 
       
    82         delete iRenderer;
       
    83         iRenderer = 0;
       
    84     }
       
    85 }
       
    86 
       
    87 void CARView::DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar)
       
    88 {
       
    89 }
       
    90 
       
    91 void CARView::OfferToolbarEventL(TInt aCommand)
       
    92 {
       
    93 //    HandleCommandL(aCommand);
       
    94 }
       
    95 
       
    96 void CARView::HandleCommandL(TInt aCommand)
       
    97 {
       
    98     switch (aCommand)
       
    99     {
       
   100         case EAknSoftkeyBack:
       
   101             AppUi()->ActivateLocalViewL(iPrevViewId.iViewUid);
       
   102             break;
       
   103 
       
   104         default:
       
   105             AppUi()->HandleCommandL(aCommand);
       
   106             break;
       
   107     }
       
   108 }