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

📄 svexlistview.cpp

📁 演示如何使用的symbian v9服务器应用框架
💻 CPP
字号:
// Copyright (c) 2006 Murray Read, All rights reserved

#include "SvexListView.h"
#include "SvexService.hrh"
#include <AknUtils.h>


EXPORT_C void MSvexMenuObserver::DynInitMenuPaneL(TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
	{
	}

EXPORT_C void MSvexMenuObserver::HandleCommandL(TInt aCommand)
	{
	// The standard S60 exit behavior
	if (aCommand == EAknCmdExit)
		CAknEnv::Static()->RunAppShutter();
	}



EXPORT_C CSvexListView::CSvexListView()
	{
	}

EXPORT_C CSvexListView::~CSvexListView()
	{
	delete iListBox;
	}

EXPORT_C void CSvexListView::ConstructMainPaneL()
	{
	// This ConstructL creates a window owning control
    CreateWindowL();
	ConstructControlL();
    HandleResourceChange(KEikDynamicLayoutVariantSwitch);	// to set the rectangle
    ActivateL();
	}

EXPORT_C void CSvexListView::ConstructControlL()
	{
	// This ConstructL assumes a window is set elsewhere
    iListBox = NewListBoxL();
    iListBox->SetContainerWindowL(*this);
    iListBox->ConstructL(this, EAknListBoxLoopScrolling);
    iListBox->Model()->SetItemTextArray(this);
    iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
    iListBox->SetListBoxObserver(this);
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
	}

EXPORT_C void CSvexListView::SizeChanged()
	{
    iListBox->SetRect(Rect());
	}

EXPORT_C TInt CSvexListView::CountComponentControls() const
	{
	return 1;
	}

EXPORT_C CCoeControl* CSvexListView::ComponentControl(TInt /*aIndex*/) const
	{
	return iListBox;
	}

EXPORT_C TKeyResponse CSvexListView::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
	{
    return iListBox->OfferKeyEventL(aKeyEvent, aType);
	}

EXPORT_C void CSvexListView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
	{
	// if a list item is selected, call OpenL()
	if (aEventType == EEventEnterKeyPressed)
		OpenL();
	}

EXPORT_C void CSvexListView::HandleCommandL(TInt aCommand)
	{
	// if the Open menu command is selected, call OpenL()
	if (aCommand == KSvexCmdIdOpen)
		OpenL();
	}

EXPORT_C TInt CSvexListView::MdcaCount() const
	{
	return Count();
	}

EXPORT_C TPtrC16 CSvexListView::MdcaPoint(TInt aIndex) const
	{
	// lists do not seem to need the returned TPtrC to last till
	// the next call to MdcaPoint, so a single buffer is reused
	// for all text
	GetText(aIndex, iBuf);
	return iBuf;
	}

EXPORT_C void CSvexListView::OpenL()
	{
	}

EXPORT_C void CSvexListView::HandleResourceChange(TInt aType)
	{
	// watch for layout change messages
	if (aType == KEikDynamicLayoutVariantSwitch && OwnsWindow())
		{
		// main pane controls are window owning and need to position
		// themselves in the main pane area.
		TRect rect;
		AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
		SetRect(rect);
		}
	CCoeControl::HandleResourceChange(aType);
	}

⌨️ 快捷键说明

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