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

📄 cmmslcontainer.cpp

📁 The MMS List example demonstrates how to: List the MMS messages in the Inbox and sort them by sen
💻 CPP
字号:
/* Copyright (c) 2003, Nokia. All rights reserved */

// INCLUDE FILES
#include <aknlists.h>

#include "CMmslContainer.h"
#include "CMmslAppUi.h"
#include "MMmslObsInterface.h"


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

// ---------------------------------------------------------------------------
// CMmslContainer::ConstructL()
// Two phased constructor.
// ---------------------------------------------------------------------------
//
void CMmslContainer::ConstructL( const TRect& aRect )
    {
    CreateWindowL();

    iListBox = new ( ELeave ) CAknDoubleStyleListBox;
    iListBox->SetContainerWindowL( *this );
    iListBox->ConstructL( this, EAknListBoxSelectionList );

    iListBox->Model()->SetItemTextArray(
        static_cast< CMmslAppUi* > (
        iCoeEnv->AppUi() )->Model()->ItemArray() );
    iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );

    iListBox->CreateScrollBarFrameL( ETrue );
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );

    iListBox->SetListBoxObserver( this );

    TRect rect( Rect() );
    iListBox->SetRect( rect );
    iListBox->ActivateL();

    SetRect( aRect );
    ActivateL();
    }

// ---------------------------------------------------------------------------
// CMmslContainer::~CMmslContainer()
// Destructor.
// Frees reserved resources.
// ---------------------------------------------------------------------------
//
CMmslContainer::~CMmslContainer()
    {
    delete iListBox;
    }

// ---------------------------------------------------------------------------
// CMmslContainer::SizeChanged()
// Called by framework when the view size is changed.
// ---------------------------------------------------------------------------
//
void CMmslContainer::SizeChanged()
    {
    if( iListBox )
        {
        iListBox->SetRect( Rect() );
        }
    }

// ---------------------------------------------------------------------------
// CMmslContainer::CountComponentControls()
// ---------------------------------------------------------------------------
//
TInt CMmslContainer::CountComponentControls() const
    {
    return 1; // return number of controls inside this container
    }

// ---------------------------------------------------------------------------
// CLogContainer::ComponentControl()
// ---------------------------------------------------------------------------
//
CCoeControl* CMmslContainer::ComponentControl( TInt aIndex )
    const
    {
    switch ( aIndex )
        {
        case 0:
            return iListBox;
        default:
            return NULL;
        }
    }

// ---------------------------------------------------------------------------
// CMmslContainer::OfferKeyEventL()
// Handles keyevents.
// ---------------------------------------------------------------------------
//
TKeyResponse CMmslContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
    TEventCode aType )
    {
    //Let AppUi handle Left and Right keys
    if( aKeyEvent.iCode == EKeyLeftArrow ||
        aKeyEvent.iCode == EKeyRightArrow )
        {
        return EKeyWasNotConsumed;
        }

    if( iListBox )
        {
        return iListBox->OfferKeyEventL( aKeyEvent, aType );
        }

    return EKeyWasNotConsumed;
    }

// ---------------------------------------------------------------------------
// CMmslContainer::HandleListBoxEventL()
// Handles listboxevents.
// ---------------------------------------------------------------------------
//
void CMmslContainer::HandleListBoxEventL( CEikListBox* /*aListBox*/,
    TListBoxEvent aEventType )
    {
    switch( aEventType )
        {
        case EEventEnterKeyPressed: // Flow through
        case EEventItemClicked:
            static_cast< CMmslAppUi* > (
                iCoeEnv->AppUi() )->ViewDialogL();
            break;
        default:
            break;
        }

    }

// End of File

⌨️ 快捷键说明

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