svexlistview.h

来自「演示如何使用的symbian v9服务器应用框架」· C头文件 代码 · 共 71 行

H
71
字号
// Copyright (c) 2006 Murray Read, All rights reserved

#ifndef SVEXLISTVIEW_H
#define SVEXLISTVIEW_H

#include <CoeCntrl.h>
#include <aknlists.h>

const TInt KMaxListText = 256;


// An observer interface for menu and command handling
class MSvexMenuObserver
	{
public:
	IMPORT_C virtual void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
	IMPORT_C virtual void HandleCommandL(TInt aCommand);
	};


// The base class for the list views used extensively in 
// this demo suite. This can be constructed as a window owning
// control for main views, or non-window owning for use in
// dialogs.
// The behavior of the class is customisable by list style,
// item count, item text and behavior on "open".
// It implements the MDesCArray interface to act as the text
// source for the contained listbox.
class CSvexListView : public CCoeControl, public MEikListBoxObserver, public MDesCArray, public MSvexMenuObserver
    {
public:
    IMPORT_C CSvexListView();
    IMPORT_C ~CSvexListView();
    IMPORT_C void ConstructControlL();				// non window owning
    IMPORT_C void ConstructMainPaneL();				// window owning

public:	// virtuals to be implemented
	// Create the list box, allows style customisation
	virtual CEikTextListBox* NewListBoxL() const = 0;
	// Return the number of items in the list
	virtual TInt Count() const = 0;
	// Get the text for a list item
	virtual void GetText(TInt aIndex, TBuf<KMaxListText>& aText) const = 0;
	// Handle the "Open" command, eg from menu or "ok" click.
	IMPORT_C virtual void OpenL();

protected:	// from CCoeControl
	IMPORT_C void SizeChanged();
	IMPORT_C TInt CountComponentControls() const;
	IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
	IMPORT_C void HandleResourceChange(TInt aType);

protected:	// from MEikListBoxObserver
	IMPORT_C void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);

public :  // from MSvexMenuObserver
	IMPORT_C void HandleCommandL(TInt aCommand);

protected:	// from MDesCArray
	IMPORT_C TInt MdcaCount() const;
	IMPORT_C TPtrC16 MdcaPoint(TInt aIndex) const;

protected:
	mutable TBuf<KMaxListText> iBuf;
    CEikTextListBox* iListBox;
    };


#endif

⌨️ 快捷键说明

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