idlehomescreen/examples/hscontentcontrolexample/src/HsContentControlAppUi.cpp
author jake
Mon, 02 Aug 2010 12:02:47 +0300
branchRCL_3
changeset 29 d12a7ea0f775
permissions -rw-r--r--
Example applications for various Homescreen APIs.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
     1
/*
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
     3
* All rights reserved.
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
     4
* This component and the accompanying materials are made available
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
     6
* which accompanies this distribution, and is available
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
     8
*
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
     9
* Initial Contributors:
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    11
*
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    12
* Contributors:
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    13
*
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    14
* Description:  Content Control example
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    15
*
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    16
*/
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    17
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    18
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    19
// [[[ begin generated region: do not modify [Generated System Includes]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    20
#include <eikmenub.h>
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    21
#include <hscontentcontrolexample.rsg>
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    22
// ]]] end generated region [Generated System Includes]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    23
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    24
// [[[ begin generated region: do not modify [Generated User Includes]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    25
#include "HsContentControlAppUi.h"
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    26
#include "HsContentControlListBox.h"
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    27
// ]]] end generated region [Generated User Includes]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    28
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    29
// [[[ begin generated region: do not modify [Generated Constants]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    30
// ]]] end generated region [Generated Constants]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    31
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    32
/**
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    33
 * Construct the CHsContentControlAppUi instance
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    34
 */ 
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    35
CHsContentControlAppUi::CHsContentControlAppUi()
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    36
    {
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    37
    // [[[ begin generated region: do not modify [Generated Contents]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    38
    iHsContentControlListBox = NULL;
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    39
    // ]]] end generated region [Generated Contents]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    40
    
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    41
    }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    42
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    43
/** 
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    44
 * The appui's destructor removes the container from the control
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    45
 * stack and destroys it.
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    46
 */
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    47
CHsContentControlAppUi::~CHsContentControlAppUi()
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    48
    {
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    49
    // [[[ begin generated region: do not modify [Generated Contents]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    50
    if ( iHsContentControlListBox != NULL )
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    51
        {
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    52
        RemoveFromStack( iHsContentControlListBox );
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    53
        delete iHsContentControlListBox;
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    54
        iHsContentControlListBox = NULL;
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    55
        }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    56
    // ]]] end generated region [Generated Contents]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    57
    
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    58
    }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    59
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    60
/**
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    61
 * @brief Completes the second phase of Symbian object construction. 
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    62
 * Put initialization code that could leave here. 
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    63
 */ 
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    64
void CHsContentControlAppUi::ConstructL()
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    65
    {
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    66
    // [[[ begin generated region: do not modify [Generated Contents]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    67
    
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    68
    BaseConstructL( EAknEnableSkin | EAknEnableMSK |                      
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    69
        EAknTouchCompatible | EAknSingleClickCompatible );
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    70
                        
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    71
    InitializeContainersL();
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    72
    // ]]] end generated region [Generated Contents]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    73
    
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    74
    }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    75
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    76
// [[[ begin generated function: do not modify
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    77
void CHsContentControlAppUi::InitializeContainersL()
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    78
    {
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    79
    iHsContentControlListBox = CHsContentControlListBox::NewL( ClientRect(), NULL, this );
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    80
    iHsContentControlListBox->SetMopParent( this );
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    81
    AddToStackL( iHsContentControlListBox );
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    82
    
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    83
    iHsContentControlListBox->DrawNow();
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    84
    }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    85
// ]]] end generated function
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    86
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    87
/**
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    88
 * Handle a command for this appui (override)
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    89
 * @param aCommand command id to be handled
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    90
 */
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    91
void CHsContentControlAppUi::HandleCommandL( TInt aCommand )
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    92
    {
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    93
    // [[[ begin generated region: do not modify [Generated Code]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    94
    TBool commandHandled = EFalse;
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    95
    switch ( aCommand )
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    96
        { // code to dispatch to the AppUi's menu and CBA commands is generated here
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    97
        default:
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    98
            break;
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
    99
        }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   100
    
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   101
        
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   102
    if ( !commandHandled ) 
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   103
        {
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   104
        if ( aCommand == EAknSoftkeyExit || 
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   105
            aCommand == EAknSoftkeyBack || 
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   106
            aCommand == EEikCmdExit )
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   107
            {
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   108
            Exit();
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   109
            }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   110
        }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   111
    // ]]] end generated region [Generated Code]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   112
    
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   113
    }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   114
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   115
/** 
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   116
 * Override of the HandleResourceChangeL virtual function
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   117
 */
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   118
void CHsContentControlAppUi::HandleResourceChangeL( TInt aType )
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   119
    {
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   120
    CAknAppUi::HandleResourceChangeL( aType );
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   121
    // [[[ begin generated region: do not modify [Generated Code]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   122
    // ]]] end generated region [Generated Code]
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   123
    
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   124
    }
d12a7ea0f775 Example applications for various Homescreen APIs.
jake
parents:
diff changeset
   125