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

📄 menudemocontainer.cpp

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

// INCLUDE FILES
#include "MenuDemoContainer.h"
#include <barsread.h>  // BAFL, for resource reader
#include <aknlists.h>  // for Listbox
#include <guictrls.rsg>
#include <akntitle.h> // for title pane
#include <eikspane.h>
#include "NoteListDialog.h"
#include "QueryListDialog.h"
#include "DemoForm.h"
#include "EditorForm.h"
#include <eiklabel.h>  // for Label Control
#include "MenuDemoView.h"
#include <eikmenub.h>
// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CMenuDemoContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CMenuDemoContainer::ConstructL(const TRect& aRect, CMenuDemoView* aView)
    {
    CreateWindowL();
    iView = aView;

    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL( *this );
    iLabel->SetTextL( _L("Please navigate through\n the Option Menu") );
    
    SetRect(aRect);
    ActivateL();
    }

// Destructor
CMenuDemoContainer::~CMenuDemoContainer()
    {
    delete iLabel;
    }

// ---------------------------------------------------------
// CMenuDemoContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CMenuDemoContainer::SizeChanged()
    {
    iLabel->SetExtent( TPoint(10,10), iLabel->MinimumSize() );
    }

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

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

// ---------------------------------------------------------
// CMenuDemoContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CMenuDemoContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.Clear();
    }

// ---------------------------------------------------------
// CMenuDemoContainer::OfferKeyEventL(...)
// Notify key events to editors.
// ---------------------------------------------------------
//
TKeyResponse CMenuDemoContainer::OfferKeyEventL(
    const TKeyEvent& aKeyEvent, TEventCode aType)
    {
    if ( ( aType == EEventKey ) && ( aKeyEvent.iCode == EKeyOK ) )
        {
        iView->MenuBar()->TryDisplayMenuBarL();
        return EKeyWasConsumed;
        }
    return EKeyWasNotConsumed;
    }

// End of File  

⌨️ 快捷键说明

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