uifw/AvKon/aknconf/src/aknconfview.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2009 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:  AknConf view
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <aknViewAppUi.h>
       
    20 #include <aknconf.rsg>
       
    21 
       
    22 #include "aknconfappui.h"
       
    23 #include "aknconfsettinglist.h"
       
    24 #include "aknconfgesturesettinglist.h"
       
    25 #include "aknconfphysicssettinglist.h"
       
    26 #include "aknconfview.h"
       
    27 
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CAknConfView::CAknConfView()
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CAknConfView::CAknConfView( const TInt aViewId )
       
    36     :
       
    37     iSettingList( NULL ),
       
    38     iId( aViewId )
       
    39     {
       
    40     }
       
    41 
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // CAknConfView::ConstructL()
       
    45 // Symbian 2nd phase constructor.
       
    46 // ----------------------------------------------------------------------------
       
    47 void CAknConfView::ConstructL( TInt aResId )
       
    48     {
       
    49     BaseConstructL( aResId );
       
    50 
       
    51     // Create container
       
    52     if ( iId == KPhysicsViewUid )
       
    53         {
       
    54         iSettingList = CAknConfPhysicsSettingList::NewL();
       
    55         }
       
    56     else
       
    57         {
       
    58         iSettingList = CAknConfGestureSettingList::NewL();
       
    59         }
       
    60     // Destructor will delete iSettingList.
       
    61     iSettingList->SetMopParent( this );
       
    62     iSettingList->ActivateL();
       
    63     iSettingList->MakeVisible( EFalse );
       
    64     }
       
    65 
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CAknConfView::~CAknConfView()
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 CAknConfView::~CAknConfView()
       
    72     {
       
    73     delete iSettingList;
       
    74     }
       
    75 
       
    76 
       
    77 // ----------------------------------------------------------------------------
       
    78 // CAknConfView::Id()
       
    79 // Return Uid.
       
    80 // ----------------------------------------------------------------------------
       
    81 TUid CAknConfView::Id() const
       
    82     {
       
    83     return TUid::Uid( iId );
       
    84     }
       
    85 
       
    86 
       
    87 // ----------------------------------------------------------------------------
       
    88 // CAknConfView::HandleCommandL().
       
    89 // Takes care of command handling.
       
    90 // ----------------------------------------------------------------------------
       
    91 void CAknConfView::HandleCommandL( TInt aCommand )
       
    92     {
       
    93     if ( aCommand == EResetValues )
       
    94         {
       
    95         iSettingList->ResetValues();
       
    96         }
       
    97     else
       
    98         {
       
    99         AppUi()->HandleCommandL( aCommand );
       
   100         }
       
   101     }
       
   102 
       
   103 
       
   104 // ----------------------------------------------------------------------------
       
   105 // CAknConfView::DoActivateL().
       
   106 // Handles the view activation.
       
   107 // ----------------------------------------------------------------------------
       
   108 void CAknConfView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
       
   109                                       TUid /*aCustomMessageId*/, 
       
   110                                       const TDesC8& /*aCustomMessage*/ )
       
   111     {
       
   112     if ( iSettingList )
       
   113         {
       
   114         AppUi()->AddToStackL( iSettingList );
       
   115         iSettingList->SetRect( ClientRect() );
       
   116         iSettingList->MakeVisible( ETrue );
       
   117         }
       
   118     CAknConfAppUi* appUi = static_cast<CAknConfAppUi*>( AppUi() );
       
   119     if ( appUi )
       
   120         {
       
   121         appUi->SetTabIndex( iId );
       
   122         }
       
   123     }
       
   124 
       
   125 
       
   126 // ----------------------------------------------------------------------------
       
   127 // CAknConfView::DoDeactivate()
       
   128 // Handles the view deactivation.
       
   129 // ----------------------------------------------------------------------------
       
   130 void CAknConfView::DoDeactivate()
       
   131     {
       
   132     if ( iSettingList && iSettingList->IsVisible() )
       
   133         {
       
   134         iSettingList->MakeVisible( EFalse );
       
   135         AppUi()->RemoveFromStack( iSettingList );
       
   136         }
       
   137     }
       
   138 
       
   139 
       
   140 // ----------------------------------------------------------------------------
       
   141 // CAknConfView::DynInitMenuPaneL()
       
   142 // This function is called by the UIKON framework just before it displays
       
   143 // a menu pane. Its default implementation is empty, and by overriding it,
       
   144 // the application can set the state of menu items dynamically according
       
   145 // to the state of application data.
       
   146 // ----------------------------------------------------------------------------
       
   147 void CAknConfView::DynInitMenuPaneL(
       
   148         TInt aResourceId,
       
   149         CEikMenuPane* aMenuPane )
       
   150     {
       
   151     if ( aResourceId == R_MENU && aMenuPane )
       
   152         {
       
   153         aMenuPane->SetItemDimmed( KPhysicsViewUid, EFalse );
       
   154         aMenuPane->SetItemDimmed( KGestureViewUid, EFalse );
       
   155         aMenuPane->SetItemDimmed( iId, ETrue );
       
   156         }
       
   157     }
       
   158 
       
   159 // End of File