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

📄 dummyprojdialog.cpp

📁 symbian 3rd下的单元测试工具 里面包括一个框架 一个实例程序 还有使用手册 很好用的 我自己用过 有问题的可以交流奥
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CDummyProjDialog from DummyProjDialog.h
*  Part of  : DummyProj
*  Created  : 13/04/2005 by Mike Howson
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: Penrillian. All rights reserved
*  Web      : www.penrillian.com
* ============================================================================
*/

// INCLUDE FILES
#include    "DummyProjDialog.h"

#include <eiklabel.h>  // for example label control
#include <avkon.hrh>
#include <aknappui.h>
#include <EikEnv.h>
#include <eikclbd.h>
#include <AknLists.h>
#include <barsread.h>
#include <dummyproj.rsg>
#include <badesca.h>
#include <akndialog.h> 


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



// Destructor
CDummyProjDialog::~CDummyProjDialog()
    {
		delete iListBox;
    }

// ---------------------------------------------------------
// CDummyProjDialog::OkToExitL(TInt aButtonId)
// called by framework when the softkey is pressed
// ---------------------------------------------------------
//
TBool CDummyProjDialog::OkToExitL(TInt aButtonId)
{
    // Translate the button presses into commands for the appui & current
    // view to handle
    if ( aButtonId == EAknSoftkeyOptions )
        {
        iAvkonAppUi->ProcessCommandL( EAknSoftkeyOptions );
        }
    else if ( aButtonId == EAknSoftkeyBack )
        {
        iAvkonAppUi->ProcessCommandL( EEikCmdExit );
        }
    
    return EFalse;
}

// ---------------------------------------------------------
// CDummyProjDialog::PreLayoutDynInitL();
// called by framework before dialog is shown 
// ---------------------------------------------------------
//
void CDummyProjDialog::PreLayoutDynInitL()
    {
	TResourceReader reader;
	
	iEikonEnv->CreateResourceReaderLC(reader, R_DUMMYPROJ_DIALOG_LISTBOX);
	iListBox = new (ELeave) CAknSingleStyleListBox;
	iListBox->SetMopParent(this);
	iListBox->SetContainerWindowL(*this);
	iListBox->ConstructFromResourceL(reader);
	CleanupStack::PopAndDestroy(); // reader

	iListBox->CreateScrollBarFrameL(ETrue);
	iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
	iListBox->ActivateL();
}

void CDummyProjDialog::PostLayoutDynInitL()
{
	iListBox->SetRect(this->Rect());
}


TKeyResponse CDummyProjDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aEventCode)
{
	return iListBox->OfferKeyEventL(aKeyEvent, aEventCode);
}


void CDummyProjDialog::AddListboxItemL(const TDesC& aPtr)
{
	CTextListBoxModel* model = iListBox->Model();
	CDesCArray* itemArray=STATIC_CAST(CDesCArray*,model->ItemTextArray());
	itemArray->AppendL(aPtr);
	iListBox->HandleItemAdditionL();
}

TInt CDummyProjDialog::CountComponentControls() const
{
	if (iListBox)
		return 1;
	return 0;
}
CCoeControl* CDummyProjDialog::ComponentControl(TInt aIndex) const
{
	switch (aIndex)
	{
	case 0:
		{
			return iListBox;
		}
	default:
		{
			ASSERT(EFalse);
			break;
		}
	}
	return NULL;
}

// End of File

⌨️ 快捷键说明

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