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

📄 settinglistcontainer.cpp

📁 《基于Symbian OS的手机开发与应用实践》这本书的配套源码。
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CSettingListContainer from SettingListContainer.h
*  Part of  : SettingList
*  Created  : 16.03.2006 by ToBeReplacedByAuthor
*  Implementation notes:
*     Initial content was generated by Series 60 Application Wizard.
*  Version  :
*  Copyright: ToBeReplacedByCopyright
* ============================================================================
*/

// INCLUDE FILES
#include <SettingList.rsg>

#include "SettingListContainer.h"
#include "MySettings.h"

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

// ---------------------------------------------------------
// CSettingListContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CSettingListContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    iSettings = new(ELeave) CMySettings;

    iSettingList = new(ELeave) CMySettingList(*iSettings, *this);
    iSettingList->SetMopParent(this);
    iSettingList->ConstructFromResourceL(R_SETTINGLIST_MYSETTINGLIST);

    SetRect(aRect);
    ActivateL();
    }

// Destructor
CSettingListContainer::~CSettingListContainer()
    {
    delete iSettingList;
    delete iSettings;
    }

// New functions
void CSettingListContainer::EditL()
    {
    iSettingList->EditL();
    }

// Functions from CMySettingList::MObserver
void CSettingListContainer::OnChangedL()
    {
    // Do something like saving the new value
    }

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

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

// ---------------------------------------------------------
// CSettingListContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CSettingListContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    // TODO: Add your drawing code here
    // example code...
    gc.SetPenStyle( CGraphicsContext::ENullPen );
    gc.SetBrushColor( KRgbGray );
    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
    gc.DrawRect( aRect );
    }

TKeyResponse CSettingListContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    return iSettingList->OfferKeyEventL (aKeyEvent, aType);
    }
// End of File  

⌨️ 快捷键说明

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