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

📄 aknexlistcolumncontainer.cpp

📁 Symbian手机编程
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/*
* =============================================================================
*  Name     : CAknExListColumnContainer
*  Part of  : AknExList
*  Copyright (c) 2003 Nokia. All rights reserved.
* =============================================================================
*/

// INCLUDE FILES
#include <aknlists.h> // for avrell style listbox
#include <akntabgrp.h>
#include <coemain.h>
#include <aknexlist.rsg>
#include <aknexlist.mbg>
#include "AknExList.hrh"
#include "AknExListConst.h" // For bitmap file name
#include "AknExListColumnView.h"
#include "AknExListColumnContainer.h"
#include "AknExListAppUi.h"

// CONSTANTS
// for length.
const TInt KAknExListLabelBufLength = 256;
const TInt KAknExListMarkedIndexBufLength = 256;
const TInt KAknExListInfoTextBufLength =256;
const TInt KAknExListInformationBufLength = 256;
const TInt KAknExListSelectionIndexFormatBufLength = 256;
const TInt KAknExListNonTextBufLength = 256;
const TInt KAknExListTabBufLength = 4;
const TInt KAknExListItemBufLength = 256;
// for initialization.
const TInt KAknExListInitValueOfListFlags = 0;
const TInt KAknExListInitItemCount = 0;
const TInt KAknExListInitTabCount = 0;
const TInt KAknExListInitPosition = 0;
const TInt KAknExListInitCount = 0;
const TInt KAknExListStartCount = 0;
// for key event.
#define AKNEXLIST_ICONPRIORITY_KEY '0'
#define AKNEXLIST_MARKEDINDEX_KEY '0'

#define IAPPUI STATIC_CAST(CAknExListAppUi*, iCoeEnv->AppUi())

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

// ----------------------------------------------------------------------------
// CAknExListColumnContainer::CAknExListColumnContainer(
//  CAknExListColumnView* )
// Copy constructor.
// ----------------------------------------------------------------------------
//
CAknExListColumnContainer::CAknExListColumnContainer(
    CAknExListColumnView* aView )
:   iLabel( NULL ),
    iListBox( NULL ),
    iView( aView ),
    iFindBox( NULL ),
    iOutlineId( KAknExListInitOutlineId )
    {
    }

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

// ----------------------------------------------------------------------------
// CAknExListColumnContainer::~CAknExListColumnContainer()
// Destructor.
// ----------------------------------------------------------------------------
//
CAknExListColumnContainer::~CAknExListColumnContainer()
    {
    delete iLabel; // Deletes label object.
    delete iListBox; // Deletes listbox object.
    delete iFindBox; // Deletes findbox object.
    }

// ----------------------------------------------------------------------------
// void CAknExListColumnContainer::DisplayListBoxL( const TInt )
// Displays listbox or start screen.
// ----------------------------------------------------------------------------
//
void CAknExListColumnContainer::DisplayListBoxL( const TInt aOutlineId )
    {
    // Sets outlineId.
    iOutlineId = aOutlineId;

    // Deletes listbox object.
    if ( iListBox )
        {
        delete iListBox;
        iListBox = NULL;
        }

    // Deletes findbox object.
    if ( iFindBox )
        {
        delete iFindBox;
        iFindBox = NULL;
        }

    // Deletes label object.
    if ( iLabel )
        {
        delete iLabel;
        iLabel = NULL;
        }

    TInt resourceId( KAknExListInitListResourceId ); // For listbox.
    TInt emptyResourceId( KAknExListInitEmptyResourceId ); // For empty text.
    TInt messageId( KAknExListMessageInitId ); // For displaying message.
    TBool flagsOfGraphic( EFalse ); // Flag for graphic.
    TBool flagsOfNumber( EFalse ); // Flag for auto numbering.
    TBool flagsOfFindBox( EFalse ); // Flag for findbox.
    TBool flagsOfPopup( EFalse ); // Flag for find popup.
    CAknTabGroup* tabGroup = iView->TabGroup();

    // Creates ListBox control object and sets resource ID.
    switch ( iOutlineId ) // Outline ID is...
        {
        case EAknExListCmdEmptyOutline: // Start screen.
            SetLabelL( R_AKNEXLIST_APP_TITLE );
            break;
        case EAknExListCmdOutline01: // OUTLINE01 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline02: // OUTLINE02 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline03: // OUTLINE03 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline04: // OUTLINE04 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline05: // OUTLINE05 screen.
            resourceId = R_AKNEXLIST_SINGLE_NUMBER;
            flagsOfNumber = ETrue;
            iListBox = new( ELeave ) CAknSingleNumberStyleListBox();
            break;
        case EAknExListCmdOutline07: // OUTLINE07 screen.
            resourceId = R_AKNEXLIST_SINGLE_NUMBER_INDICATOR;
            flagsOfNumber = ETrue;
            iListBox = new( ELeave ) CAknSingleNumberStyleListBox();
            break;
        case EAknExListCmdOutline08: // OUTLINE08 screen.
            resourceId = R_AKNEXLIST_SINGLE_6;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline09: // OUTLINE09 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline10: // OUTLINE10 screen.
            resourceId = R_AKNEXLIST_SINGLE_NUMBER;
            if ( tabGroup ) // Is tab group created?
                {
                flagsOfNumber = ETrue;
                }
            else
                {
                messageId = R_AKNEXLIST_USER_DEFINED_NUMBERING_MSG;
                }
            iListBox = new( ELeave ) CAknSingleNumberStyleListBox();
            break;
        case EAknExListCmdOutline11: // OUTLINE11 screen.
            resourceId = R_AKNEXLIST_SINGLE_HEADING;
            iListBox = new( ELeave ) CAknSingleHeadingStyleListBox();
            break;
        case EAknExListCmdOutline12: // OUTLINE12 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicStyleListBox();
            break;
        case EAknExListCmdOutline13: // OUTLINE13 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC_HEADING;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicHeadingStyleListBox();
            break;
        case EAknExListCmdOutline14: // OUTLINE14 screen.
            resourceId = R_AKNEXLIST_SINGLE_NUMBER_HEADING;
            if ( tabGroup ) // Is tab group created?
                {
                flagsOfNumber = ETrue;
                }
            else
                {
                messageId = R_AKNEXLIST_USER_DEFINED_NUMBERING_MSG;
                }
            iListBox = new( ELeave ) CAknSingleNumberHeadingStyleListBox();
            break;
        case EAknExListCmdOutline15: // OUTLINE15 screen.
            resourceId = R_AKNEXLIST_SINGLE_LARGE_GRAPHIC;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleLargeStyleListBox();
            break;
        case EAknExListCmdOutline27: // OUTLINE27 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            iListBox->SetListBoxObserver( this );
            break;
        case EAknExListCmdOutline30T1: // Type1 of OUTLINE30 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC_MULTI;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicStyleListBox();
            break;
        case EAknExListCmdOutline30T2: // Type2 of OUTLINE30 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC_HEADING_MULTI;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicHeadingStyleListBox();
            break;
        case EAknExListCmdOutline31: // OUTLINE33 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC_MULTI;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicStyleListBox();
            break;
        case EAknExListCmdOutline33: // OUTLINE33 screen.
            resourceId = R_AKNEXLIST_SINGLE_2;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline41T1: // Fixed findbox of OUTLINE41 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC;
            flagsOfGraphic = ETrue;
            flagsOfFindBox = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicStyleListBox();
            break;
        case EAknExListCmdOutline41T2: // Popup findbox of OUTLINE41 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            flagsOfFindBox = ETrue;
            flagsOfPopup = ETrue;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline43: // OUTLINE43 screen.
            resourceId = R_AKNEXLIST_LAYOUT1;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicHeadingStyleListBox();
            break;
        case EAknExListCmdOutline44: // OUTLINE44 screen.
            resourceId = R_AKNEXLIST_SINGLE_5;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline45: // OUTLINE45 screen.
            resourceId = R_AKNEXLIST_LAYOUT2;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicHeadingStyleListBox();
            break;
        case EAknExListCmdOutline46: // OUTLINE46 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline47: // OUTLINE47 screen.
            resourceId = R_AKNEXLIST_SINGLE_NUMBER;
            flagsOfNumber = ETrue;
            iListBox = new( ELeave ) CAknSingleNumberStyleListBox();
            break;
        case EAknExListCmdOutline48: // OUTLINE48 screen.
            resourceId = R_AKNEXLIST_SINGLE_HEADING;
            iListBox = new( ELeave ) CAknSingleHeadingStyleListBox();
            break;
        case EAknExListCmdOutline49: // OUTLINE49 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicStyleListBox();
            break;
        case EAknExListCmdOutline50: // OUTLINE50 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC_HEADING;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicHeadingStyleListBox();
            break;
        case EAknExListCmdOutline51: // OUTLINE51 screen.
            resourceId = R_AKNEXLIST_SINGLE_NUMBER_HEADING;
            flagsOfNumber = ETrue;
            iListBox = new( ELeave ) CAknSingleNumberHeadingStyleListBox();
            break;
        case EAknExListCmdOutline52: // OUTLINE52 screen.
            resourceId = R_AKNEXLIST_SINGLE_LARGE_GRAPHIC;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleLargeStyleListBox();
            break;
        case EAknExListCmdOutline60: // OUTLINE60 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline61: // OUTLINE61 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline62: // OUTLINE62 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline63: // OUTLINE63 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC;
            flagsOfGraphic = ETrue;
            flagsOfFindBox = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicStyleListBox();
            break;
        case EAknExListCmdOutline64: // OUTLINE64 screen.
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline66: // OUTLINE66 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline69: // OUTLINE69 screen.
            emptyResourceId = R_AKNEXLIST_EMPTY_LABEL;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline70: // OUTLINE70 screen.
            emptyResourceId = R_AKNEXLIST_TWO_LINES_EMPTY_LABEL;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline77: // OUTLINE77 screen.
            resourceId = R_AKNEXLIST_SINGLE_1;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            break;
        case EAknExListCmdOutline78: // OUTLINE78 screen.
            resourceId = R_AKNEXLIST_SINGLE_GRAPHIC_MULTI;
            flagsOfGraphic = ETrue;
            iListBox = new( ELeave ) CAknSingleGraphicStyleListBox();
            break;
        case EAknExListCmdOutline80: // OUTLINE80 screen.
            resourceId = R_AKNEXLIST_SINGLE_7;
            iListBox = new( ELeave ) CAknSingleStyleListBox();
            iListBox->SetListBoxObserver( this );
            break;
        case EAknExListCmdOutline80Sub: // Sub of OUTLINE80 screen.

⌨️ 快捷键说明

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