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

📄 simpledlgappui.cpp

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

// INCLUDE FILES
#include <eiklabel.h>     // for CEikLabel
#include <avkon.hrh>
#include <akndialog.h>    // for CAknDialog
#include <SimpleDlg.rsg>  // for R_SIMPLEDLG_DIALOG

#include "SimpleDlgAppui.h"
#include "SimpleDlgContainer.h" 
#include "SimpleDlg.hrh"
#include "MySimpleDialog.h" // for CMySimpleDialog

// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CSimpleDlgAppUi::ConstructL()
// 
// ----------------------------------------------------------
//
void CSimpleDlgAppUi::ConstructL()
    {
    BaseConstructL();

    iAppContainer = new (ELeave) CSimpleDlgContainer;
    iAppContainer->SetMopParent( this );
    iAppContainer->ConstructL( ClientRect() );
    AddToStackL( iAppContainer );
    }

// ----------------------------------------------------
// CSimpleDlgAppUi::~CSimpleDlgAppUi()
// Destructor
// Frees reserved resources
// ----------------------------------------------------
//
CSimpleDlgAppUi::~CSimpleDlgAppUi()
    {
    if (iAppContainer)
        {
        RemoveFromStack( iAppContainer );
        delete iAppContainer;
        }
   }

// ------------------------------------------------------------------------------
// CSimpleDlgAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
//  This function is called by the EIKON framework just before it displays
//  a menu pane. Its default implementation is empty, and by overriding it,
//  the application can set the state of menu items dynamically according
//  to the state of application data.
// ------------------------------------------------------------------------------
//
void CSimpleDlgAppUi::DynInitMenuPaneL(
    TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
    {
    }

// ----------------------------------------------------
// CSimpleDlgAppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// takes care of key event handling
// ----------------------------------------------------
//
TKeyResponse CSimpleDlgAppUi::HandleKeyEventL(
    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
    {
    return EKeyWasNotConsumed;
    }

// ----------------------------------------------------
// CSimpleDlgAppUi::HandleCommandL(TInt aCommand)
// takes care of command handling
// ----------------------------------------------------
//
void CSimpleDlgAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
        case EAknSoftkeyBack:
        case EEikCmdExit:
            {
            Exit();
            break;
            }
        case ESimpleDlgCmdDialog:
            {
            CAknDialog* dialog = new(ELeave) CAknDialog;
            if(dialog->ExecuteLD(R_SIMPLEDLG_DIALOG))
                {
                _LIT(KButtonOk, "OK");
                iEikonEnv->InfoMsg(KButtonOk());
                }
            else
                {
                _LIT(KButtonCancel, "Cancel");
                iEikonEnv->InfoMsg(KButtonCancel());
                }
            break;
            }
        case ESimpleDlgCmdPrepare:
            {
            CAknDialog* dialog = new(ELeave) CMySimpleDialog;
            dialog->PrepareLC(R_SIMPLEDLG_DIALOG);
            CEikLabel* label = static_cast<CEikLabel*>(dialog->Control(ESimpleDlgCtlLabel));
            _LIT(KMyLabel, "Changed after PrepareLC()");
            label->SetTextL(KMyLabel());
            dialog->RunLD();
            break;
            }
        case ESimpleDlgCmdPreLayout:
            {
            CAknDialog* dialog = new(ELeave) CMySimpleDialog;
            dialog->ExecuteLD(R_SIMPLEDLG_DIALOG);
            break;
            }
        default:
            break;      
        }
    }



// End of File  

⌨️ 快捷键说明

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