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

📄 lustrationappui.cpp

📁 一个简单的电子驱蚊器程序,通过调用频率发出声音.
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CLustrationAppUi from LustrationAppUi.cpp
*  Part of  : Lustration
*  Created  : 2006-03-16 by 
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: 
* ============================================================================
*/

// INCLUDE FILES
#include "LustrationAppUi.h"
#include "LustrationContainer.h" 
#include <Lustration.rsg>
#include "lustration.hrh"
#include <eikmenup.h>
#include <avkon.hrh>
#include <eikbtgpc.h>
// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CLustrationAppUi::ConstructL()
// ?implementation_description
// ----------------------------------------------------------
//
void CLustrationAppUi::ConstructL()
    {
    BaseConstructL();
    iAppContainer = CLustrationContainer::NewL(ClientRect());
    iAppContainer->SetMopParent(this);
    AddToStackL( iAppContainer );

	Cba()->MakeVisible(ETrue);
    }

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

// ------------------------------------------------------------------------------
// CLustrationAppUi::::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 CLustrationAppUi::DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane)
    {
	if (aResourceId != R_LUSTRATION_MENU)
		{
		return;
		}

		switch (iAppContainer->State())
		{
		case CToneAdapater::EStopped:
			aMenuPane->SetItemDimmed(ELustrationCmdOne, EFalse);
			aMenuPane->SetItemDimmed(ELustrationCmdTwo, EFalse);
			aMenuPane->SetItemDimmed(ELustrationCmdFour, EFalse);
			aMenuPane->SetItemDimmed(ELustrationCmdSix, EFalse);
			aMenuPane->SetItemDimmed(ELustrationCmdEight, EFalse);
			aMenuPane->SetItemDimmed(ELustrationCmdTen, EFalse);
			aMenuPane->SetItemDimmed(ELustrationCmdMenuStop, ETrue);
			aMenuPane->SetItemDimmed(EAknSoftkeyExit, ETrue);
			break;
		case CToneAdapater::EPlaying:
			aMenuPane->SetItemDimmed(ELustrationCmdOne, ETrue);
			aMenuPane->SetItemDimmed(ELustrationCmdTwo, ETrue);
			aMenuPane->SetItemDimmed(ELustrationCmdFour, ETrue);
			aMenuPane->SetItemDimmed(ELustrationCmdSix, ETrue);
			aMenuPane->SetItemDimmed(ELustrationCmdEight, ETrue);
			aMenuPane->SetItemDimmed(ELustrationCmdTen, ETrue);
			aMenuPane->SetItemDimmed(ELustrationCmdMenuStop, EFalse);
			aMenuPane->SetItemDimmed(EAknSoftkeyExit, EFalse);
			break;
		default:
			break;
		}
    }

// ----------------------------------------------------
// CLustrationAppUi::HandleKeyEventL(
//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
// ?implementation_description
// ----------------------------------------------------
//
TKeyResponse CLustrationAppUi::HandleKeyEventL(
    const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
    {
    return EKeyWasNotConsumed;
    }

// ----------------------------------------------------
// CLustrationAppUi::HandleCommandL(TInt aCommand)
// ?implementation_description
// ----------------------------------------------------
//
void CLustrationAppUi::HandleCommandL(TInt aCommand)
    {
    switch ( aCommand )
        {
		case EAknSoftkeyExit:
        case EAknSoftkeyBack:
			{
			Exit();
			break;
			}
        case ELustrationCmdOne:
            {
			iAppContainer->PlayToneL(1);
            break;
            }
        case ELustrationCmdTwo:
            {
			iAppContainer->PlayToneL(2);
            break;
            }
		case ELustrationCmdFour:
			{
			iAppContainer->PlayToneL(4);
            break;
			}
			case ELustrationCmdSix:
			{
			iAppContainer->PlayToneL(6);
            break;
			}
			case ELustrationCmdEight:
			{
			iAppContainer->PlayToneL(8);
            break;
			}
			case ELustrationCmdTen:
			{
   			iAppContainer->PlayToneL(10);
            break;
			}
			case ELustrationCmdMenuStop:
			{
			iAppContainer->StopL();
			break;
			}
        // TODO: Add Your command handling code here

        default:
            break;      
        }
    }

// End of File  

⌨️ 快捷键说明

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