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

📄 mylistboxappui.cpp

📁 MyListBox Symbian 3rd custom control.
💻 CPP
字号:
// --------------------------------------------------------------------------
// MyListBoxAppUi.cpp
//
// Copyright 2005, Antony Pranata
// http://www.antonypranata.com
//
// An application UI for custom list box example.
// --------------------------------------------------------------------------

// INCLUDE FILES
#include <eikenv.h>
#include <eikmenup.h>

#include "MyListBoxAppui.h"
#include "MyListBoxAppView.h"
#include "CustomListBox.h"
#include <MyListBox.rsg>
#include "MyListBox.hrh"
#include <qikon.hrh>

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

void CMyListBoxAppUi::ConstructL()
	{
	BaseConstructL();

	iAppView = new (ELeave) CMyListBoxAppView();
	iAppView->ConstructL(ClientRect());
	AddToStackL(iAppView);
	AddToStackL(iAppView->ListBox());
	}

CMyListBoxAppUi::~CMyListBoxAppUi()
	{
	if (iAppView)
		{
		RemoveFromStack(iAppView->ListBox());
		RemoveFromStack(iAppView);
		delete iAppView;
		}
	}

void CMyListBoxAppUi::DynInitMenuPaneL(TInt aResourceId,
									   CEikMenuPane* aMenuPane)
	{
	if (R_MYLISTBOX_MENU == aResourceId)
		{
		if (iAppView->IsDoubleLine())
			{
			aMenuPane->SetItemButtonState(ECmdMyListBoxDoubleLine,
				EEikMenuItemSymbolOn);
			}
		else
			{
			aMenuPane->SetItemButtonState(ECmdMyListBoxDoubleLine,
				EEikMenuItemSymbolIndeterminate);
			}
		}

#ifdef __WINS__
	// This gives us the option to close down our application, letting the framework
	// check for memory and resource leaks. This menu option should not exist in
	// released versions, thus the ifdef
	if (R_MYLISTBOX_MENU == aResourceId)
		{
		_LIT(KCloseMenu, "Close (debug)");
		CEikMenuPaneItem::SData itemData;
		itemData.iText      = KCloseMenu;
		itemData.iCommandId = EEikCmdExit;
		itemData.iFlags     = 0;
		itemData.iCascadeId = 0;
		aMenuPane->AddMenuItemL(itemData);
		}
#endif // __S60__
	}

TKeyResponse CMyListBoxAppUi::HandleKeyEventL(
	const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/)
	{
	return EKeyWasNotConsumed;
	}

void CMyListBoxAppUi::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case EEikCmdExit:
			{
			Exit();
			break;
			}
		case ECmdMyListBoxDoubleLine:
			{
			iAppView->UpdateListBoxL(!iAppView->IsDoubleLine());
			break;
			}
		}
	}

// End of File  

⌨️ 快捷键说明

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