⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aknexlistflagtestcontainer.cpp

📁 symbian ui的 例子 初学者可以 好好看看,这个是培训的资料,应该比较宝贵
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/*  Copyright (c) 2005, Nokia. All rights reserved */

// INCLUDE FILES
#include <aknlists.h> // for avrell style listbox
#include <akntabgrp.h>
#include <akndef.h>
#include <aknexlist.rsg>
#include <aknexlist.mbg>
#include "AknExList.hrh"
#include "AknExListConst.h" // For bitmap file name
#include "AknExListFlagTestView.h"
#include "AknExListFlagTestContainer.h"


// ================= MEMBER FUNCTIONS =========================================

// ----------------------------------------------------------------------------
// CAknExListFlagTestContainer::CAknExListFlagTestContainer()
// Copy constructor.
// ----------------------------------------------------------------------------
//
CAknExListFlagTestContainer::CAknExListFlagTestContainer( 
    CAknExListFlagTestView* aView )
: iListBox( NULL ), iView( aView ), iOutlineId( KAknExListInitOutlineId ),
    iInternalFlag( EFalse ), iKeyEvent( EFalse )
    {
    }

// ----------------------------------------------------------------------------
// void CAknExListFlagTestContainer::ConstructL()
// Symbian constructor.
// ----------------------------------------------------------------------------
//
void CAknExListFlagTestContainer::ConstructL( const TRect& aRect )
    {
    CreateWindowL(); // Creates window.
    SetRect( aRect ); // Sets rectangle of frame.
    ActivateL(); // Activates window. ( Ready to draw )
    }

// ----------------------------------------------------------------------------
// CAknExListFlagTestContainer::~CAknExListFlagTestContainer()
// Destructor.
// ----------------------------------------------------------------------------
//
CAknExListFlagTestContainer::~CAknExListFlagTestContainer()
    {
    delete iListBox; // Deletes listbox object.
    }

// ----------------------------------------------------------------------------
// CAknExListFlagTestContainer::DisplayListBoxL()
// Displays listbox.
// ----------------------------------------------------------------------------
//
void CAknExListFlagTestContainer::DisplayListBoxL( const TInt aTabId )
    {
    // Deletes listbox object.
    if ( iListBox )
        {
        delete iListBox;
        iListBox = NULL;
        }

    // Initialize of iInternalFlag except via key event.
    if ( iKeyEvent == EFalse )
        {
        iInternalFlag = EFalse;
        }

    if ( aTabId == EAknExListTabIdType01 ||
         aTabId == EAknExListTabIdType01Withs )
        {
        // Sets outlineId.
        iOutlineId = iView->OutlineId();
        }

    TInt resourceId( KAknExListInitListResourceId ); // For listbox.
    TInt messageId( KAknExListMessageInitId ); // For displaying message.
    TBool flagsOfGraphic( EFalse ); // Flag for graphic.
    TBool flagsOfNumber( EFalse ); // Flag for auto numbering.
    CEikColumnListBox* columnListBox = NULL;
    CEikFormattedCellListBox* formattedListBox = NULL;

    // Creates ListBox control object and sets resource ID.
    switch ( aTabId ) // Tab ID is...
        {
        // Single pane.
        case EAknExListTabIdType01:
        case EAknExListTabIdType01Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdSingle();
                }
            IsNeedGarphic( flagsOfGraphic );
            columnListBox = new ( ELeave ) CAknSingleStyleListBox();
            break;
        // Single number pane.
        case EAknExListTabIdType02:
        case EAknExListTabIdType02Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdSingleNumber();
                }
            IsNeedGarphic( flagsOfGraphic );
            flagsOfNumber = ETrue;
            columnListBox = new ( ELeave ) CAknSingleNumberStyleListBox();
            break;
        // Single heading pane.
        case EAknExListTabIdType03:
        case EAknExListTabIdType03Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdSingleHeading();
                }
            IsNeedGarphic( flagsOfGraphic );
            columnListBox = new ( ELeave ) CAknSingleHeadingStyleListBox();
            break;
        // Single graphic pane.
        case EAknExListTabIdType04:
        case EAknExListTabIdType04Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdSingleGraphic();
                }
            flagsOfGraphic = ETrue;
            columnListBox = new ( ELeave ) CAknSingleGraphicStyleListBox();
            break;
        // Single graphic heading pane.
        case EAknExListTabIdType05:
        case EAknExListTabIdType05Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdSingleGraphicHeading();
                }
            flagsOfGraphic = ETrue;
            columnListBox =
                new ( ELeave ) CAknSingleGraphicHeadingStyleListBox();
            break;
        // Single number heading pane.
        case EAknExListTabIdType06:
        case EAknExListTabIdType06Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdSingleNumberHeading();
                }
            IsNeedGarphic( flagsOfGraphic );
            flagsOfNumber = ETrue;
            columnListBox =
                new ( ELeave ) CAknSingleNumberHeadingStyleListBox();
            break;
        // Single large graphic pane.
        case EAknExListTabIdType07:
        case EAknExListTabIdType07Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdSingleLargeGraphic();
                }
            flagsOfGraphic = ETrue;
            columnListBox = new ( ELeave ) CAknSingleLargeStyleListBox();
            break;
        // Single big pane.
        case EAknExListTabIdType08:
        case EAknExListTabIdType08Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdBigSingle();
                }
            IsNeedGarphic( flagsOfGraphic );
            formattedListBox = new ( ELeave ) CAknDoubleStyleListBox();
            break;
        // Single big number pane.
        case EAknExListTabIdType09:
        case EAknExListTabIdType09Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdBigSingleNumber();
                }
            IsNeedGarphic( flagsOfGraphic );
            flagsOfNumber = ETrue;
            formattedListBox = new ( ELeave ) CAknDoubleNumberStyleListBox();
            break;
        // Single big large graphic pane.
        case EAknExListTabIdType10:
        case EAknExListTabIdType10Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdBigSingleLargeGraphic();
                }
            flagsOfGraphic = ETrue;
            formattedListBox = new ( ELeave ) CAknDoubleLargeStyleListBox();
            break;
        // Double pane.
        case EAknExListTabIdType11:
        case EAknExListTabIdType11Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdDouble();
                }
            IsNeedGarphic( flagsOfGraphic );
            formattedListBox = new ( ELeave ) CAknDoubleStyleListBox();
            break;
        // Double number pane.
        case EAknExListTabIdType12:
        case EAknExListTabIdType12Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdDoubleNumber();
                }
            IsNeedGarphic( flagsOfGraphic );
            flagsOfNumber = ETrue;
            formattedListBox = new ( ELeave ) CAknDoubleNumberStyleListBox();
            break;
        // Double large graphic pane.
        case EAknExListTabIdType13:
        case EAknExListTabIdType13Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdDoubleLargeGraphic();
                }
            flagsOfGraphic = ETrue;
            formattedListBox = new ( ELeave ) CAknDoubleLargeStyleListBox();
            break;
        // Setting pane.
        case EAknExListTabIdType14:
        case EAknExListTabIdType14Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdSetting();
                }
            flagsOfGraphic = ETrue;
            formattedListBox = new ( ELeave ) CAknSettingStyleListBox();
            break;
        // Setting number pane.
        case EAknExListTabIdType15:
        case EAknExListTabIdType15Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdSettingNumber();
                }
            flagsOfGraphic = ETrue;
            flagsOfNumber = ETrue;
            formattedListBox = new ( ELeave ) CAknSettingNumberStyleListBox();
            break;
        // Double graphic pane.
        case EAknExListTabIdType16:
        case EAknExListTabIdType16Withs:
            if ( !iInternalFlag )
                {
                resourceId = ResourceIdDoubleGraphic();
                }
            flagsOfGraphic = ETrue;
            formattedListBox = new ( ELeave ) CAknDoubleGraphicStyleListBox();
            break;
        default:
            break;
        }

    if ( columnListBox )
        {
        iListBox = columnListBox;
        // Sets ListBox.
        if ( resourceId )
            {
            // From resource.
            SetListBoxFromResourceL( columnListBox, resourceId );
            // If you show the message( "Make from resource" ), 
            // please delete comment( '//' );
            // messageId = R_AKNEXLIST_RESOURCE_MSG;
            }
        else
            {
            // From internal( only flag ).
            TInt flags( ListFlags() );
            CDesCArray* textArray = ListItemsL( aTabId );
            SetListBoxFromInnerDescriptionL( columnListBox, flags, textArray );
            // If you show the message( "Make from code" ), please delete comment( '//' );
            // messageId = R_AKNEXLIST_INTERNAL_MSG;
            }
        if ( flagsOfGraphic )
            {
            // Creates graphic.
            SetGraphicIconL( columnListBox );
            }
        }

    else if ( formattedListBox )
        {
        iListBox = formattedListBox;
        // Sets ListBox.
        if ( resourceId )
            {
            // From resource.
            SetListBoxFromResourceL( formattedListBox, resourceId );
            // If you show the message( "Make from resource" ), please delete comment( '//' );
            // messageId = R_AKNEXLIST_RESOURCE_MSG;
            }
        else
            {
            // From internal( only flag ).
            TInt flags( ListFlags() );
            CDesCArray* textArray = ListItemsL( aTabId );
            SetListBoxFromInnerDescriptionL( 
                formattedListBox, flags, textArray );
            // If you show the message( "Make from code" ), 
            // please delete comment( '//' );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -