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

📄 wavegen_listbox.cpp

📁 symbian学习音乐播放的源代码
💻 CPP
字号:
//
// wavegen_listbox.cpp
//
// Copyright (C) 2005 Nokia Corporation. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////

// INCLUDE FILES
#include "wavegen_listbox.h"
#include "wavegen_engine.h"     // for CStreamAudioEngine
#include "wavegen_volumesett.h" // for CWaveGenVolumeSettingItem
#include "wavegen.hrh"

#include "wavegen_view.h"

//
// CWaveGenListbox class
//
/*    
-------------------------------------------------------------------------------
    CWaveGenListbox

    Description: Constructor

    Return Value: N/A
-------------------------------------------------------------------------------
*/
CWaveGenListbox::CWaveGenListbox(CStreamAudioEngine* aEng)
:   iEng(aEng),
    iEditing(EFalse)   
    {
    // copy the initial parameters from the engine
	iVolume = iEng->Volume();
    iFrequency = iEng->Frequency();
	iWaveform = iEng->Waveform();
    }

/*    
-------------------------------------------------------------------------------
    ~CWaveGenListbox

    Description: Destructor

    Return Value: N/A
-------------------------------------------------------------------------------
*/
CWaveGenListbox::~CWaveGenListbox()
    {	
    }

/*    
-------------------------------------------------------------------------------
    CreateSettingItemL

    Description: Creates the setting items for this listbox

    Return Value: CAknSettingItem*
-------------------------------------------------------------------------------
*/
CAknSettingItem* CWaveGenListbox::CreateSettingItemL(TInt aIdentifier)
    {
    CAknSettingItem* settingItem = NULL;
    
    switch (aIdentifier)
    {    
    case EWaveGenVolume:
        settingItem = new (ELeave) CWaveGenVolumeSettingItem(iEng, aIdentifier,
            iVolume);
        break;
    case EWaveGenFrequency:
        settingItem = new (ELeave) CWaveGenVolumeSettingItem(iEng, aIdentifier,
            iFrequency);        
        break;
	case EWaveGenWaveform:
        settingItem = new (ELeave) CAknBinaryPopupSettingItem(aIdentifier,
            iWaveform);
        break;
    default:		
        break;
        }

    return settingItem;
    }


/*
-------------------------------------------------------------------------------
    OfferKeyEventL

    Description: Handles the listbox key events. Left/right arrow key events
                 are not consumed (so they can be used for tab switching in app
                 UI).

    Return Value: TKeyResponse
-------------------------------------------------------------------------------
*/
TKeyResponse CWaveGenListbox::OfferKeyEventL(const TKeyEvent & aKeyEvent,  
  TEventCode  aType) 
    {

    // call base class implementation first, then decide what to return
    TKeyResponse response = 
        CAknSettingItemList::OfferKeyEventL(aKeyEvent, aType);

    switch (aKeyEvent.iCode)
        {
        case EKeyLeftArrow:
        case EKeyRightArrow:
            return EKeyWasNotConsumed;
            
        default:
            break;
        }

    return response;
    }


/*
-------------------------------------------------------------------------------
    HandleListBoxEventL

    Description: handles the listbox events, notified by CEikListBox to this
                 observer

    Parameters: aListBox - originating listbox
                aEventType - type of the listbox event

    Return Value: N/A
-------------------------------------------------------------------------------
*/
void CWaveGenListbox::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent
    aEventType)
	{    
	switch(aEventType)
        {
        case EEventEnterKeyPressed: 
        case EEventItemDoubleClicked: // in emulator
		    {
            // store the values from all setting items to their external variables
		    StoreSettingsL();

            // notify the engine if waveform setting has changed
		    if(aListBox->CurrentItemIndex() == EWaveGenWaveform)            					
	            iEng->SetWaveform(!iWaveform);

            break;           
		    }
    
        default:
            break;
        }        

    // call the base classes handler
	CAknSettingItemList::HandleListBoxEventL(aListBox, aEventType);
	}  


/*
-------------------------------------------------------------------------------
    SizeChanged

    Description: Size changed handler

    Return Value: 
-------------------------------------------------------------------------------
*/
void CWaveGenListbox::SizeChanged()
    {
    if (ListBox())         
        ListBox()->SetRect(Rect());        
    }

// eof

⌨️ 快捷键说明

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