idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlAppUi.cpp
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
child 103 966d119a7e67
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
     1 /*
       
     2 * Copyright (c) 2010 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:  Content Control example
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // [[[ begin generated region: do not modify [Generated System Includes]
       
    20 #include <eikmenub.h>
       
    21 #include <hscontentcontrolexample.rsg>
       
    22 // ]]] end generated region [Generated System Includes]
       
    23 
       
    24 // [[[ begin generated region: do not modify [Generated User Includes]
       
    25 #include "HsContentControlAppUi.h"
       
    26 #include "HsContentControlListBox.h"
       
    27 // ]]] end generated region [Generated User Includes]
       
    28 
       
    29 // [[[ begin generated region: do not modify [Generated Constants]
       
    30 // ]]] end generated region [Generated Constants]
       
    31 
       
    32 /**
       
    33  * Construct the CHsContentControlAppUi instance
       
    34  */ 
       
    35 CHsContentControlAppUi::CHsContentControlAppUi()
       
    36     {
       
    37     // [[[ begin generated region: do not modify [Generated Contents]
       
    38     iHsContentControlListBox = NULL;
       
    39     // ]]] end generated region [Generated Contents]
       
    40     
       
    41     }
       
    42 
       
    43 /** 
       
    44  * The appui's destructor removes the container from the control
       
    45  * stack and destroys it.
       
    46  */
       
    47 CHsContentControlAppUi::~CHsContentControlAppUi()
       
    48     {
       
    49     // [[[ begin generated region: do not modify [Generated Contents]
       
    50     if ( iHsContentControlListBox != NULL )
       
    51         {
       
    52         RemoveFromStack( iHsContentControlListBox );
       
    53         delete iHsContentControlListBox;
       
    54         iHsContentControlListBox = NULL;
       
    55         }
       
    56     // ]]] end generated region [Generated Contents]
       
    57     
       
    58     }
       
    59 
       
    60 /**
       
    61  * @brief Completes the second phase of Symbian object construction. 
       
    62  * Put initialization code that could leave here. 
       
    63  */ 
       
    64 void CHsContentControlAppUi::ConstructL()
       
    65     {
       
    66     // [[[ begin generated region: do not modify [Generated Contents]
       
    67     
       
    68     BaseConstructL( EAknEnableSkin | EAknEnableMSK |                      
       
    69         EAknTouchCompatible | EAknSingleClickCompatible );
       
    70                         
       
    71     InitializeContainersL();
       
    72     // ]]] end generated region [Generated Contents]
       
    73     
       
    74     }
       
    75 
       
    76 // [[[ begin generated function: do not modify
       
    77 void CHsContentControlAppUi::InitializeContainersL()
       
    78     {
       
    79     iHsContentControlListBox = CHsContentControlListBox::NewL( ClientRect(), NULL, this );
       
    80     iHsContentControlListBox->SetMopParent( this );
       
    81     AddToStackL( iHsContentControlListBox );
       
    82     
       
    83     iHsContentControlListBox->DrawNow();
       
    84     }
       
    85 // ]]] end generated function
       
    86 
       
    87 /**
       
    88  * Handle a command for this appui (override)
       
    89  * @param aCommand command id to be handled
       
    90  */
       
    91 void CHsContentControlAppUi::HandleCommandL( TInt aCommand )
       
    92     {
       
    93     // [[[ begin generated region: do not modify [Generated Code]
       
    94     TBool commandHandled = EFalse;
       
    95     switch ( aCommand )
       
    96         { // code to dispatch to the AppUi's menu and CBA commands is generated here
       
    97         default:
       
    98             break;
       
    99         }
       
   100     
       
   101         
       
   102     if ( !commandHandled ) 
       
   103         {
       
   104         if ( aCommand == EAknSoftkeyExit || 
       
   105             aCommand == EAknSoftkeyBack || 
       
   106             aCommand == EEikCmdExit )
       
   107             {
       
   108             Exit();
       
   109             }
       
   110         }
       
   111     // ]]] end generated region [Generated Code]
       
   112     
       
   113     }
       
   114 
       
   115 /** 
       
   116  * Override of the HandleResourceChangeL virtual function
       
   117  */
       
   118 void CHsContentControlAppUi::HandleResourceChangeL( TInt aType )
       
   119     {
       
   120     CAknAppUi::HandleResourceChangeL( aType );
       
   121     // [[[ begin generated region: do not modify [Generated Code]
       
   122     // ]]] end generated region [Generated Code]
       
   123     
       
   124     }
       
   125