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

📄 listboxcontainer.h

📁 这是一个学习Symbian的ListBox的好例子,我也是看学个学会的
💻 H
字号:
#ifndef LISTBOXCONTAINER_H
#define LISTBOXCONTAINER_H

#include <coecntrl.h>
#include <eikclb.h>

class CEikLabel;

class ListBoxContainer : public CCoeControl, MCoeControlObserver, MEikListBoxObserver
{
public: 
	ListBoxContainer() : 
	  _currentListBoxType(eFirst), _listBox(0), _displayListBoxNotifications(EFalse) {}
	void ConstructL(const TRect& aRect);	// EPOC 2nd phase constructor
	~ListBoxContainer();

	// called from app ui
	void cmdActivatePrevListBoxL();
	void cmdActivateNextListBoxL();
	void cmdAddL();
	void cmdRemoveL();
	void cmdMark(TInt item, TBool mark);
	TBool isListBoxEmpty() const;
	TInt getCurrentListBoxItem() const;
    void cmdToggleNotifications() // MEikListBoxObserver events info
        { _displayListBoxNotifications = !_displayListBoxNotifications; }

protected:
	CArrayPtr<CGulIcon>* loadIconListL() const;

	// From CoeControl
	void SizeChanged();
	TInt CountComponentControls() const;
	CCoeControl* ComponentControl(TInt aIndex) const;
	void Draw(const TRect& aRect) const;

	virtual void HandleControlEventL(CCoeControl* control, TCoeEvent eventType);
	virtual TKeyResponse OfferKeyEventL(const TKeyEvent& keyEvent, TEventCode type);

	// MEikListBoxObserver interface implementation
	virtual void HandleListBoxEventL(CEikListBox* listBox, TListBoxEvent eventType);

	typedef enum 
	{ 
		eFirst,
		eSingle = eFirst, 
        eSingleNumber,
        eSingleHeading,
		eSingleGraphic,
		eSingleGraphicHeading,
		eSingleNumberHeading,
		eSingleLarge,
		eDouble,
		eDouble2,
		eDoubleNumber,
		eDoubleTime,
		eDoubleLarge,
		eDoubleGraphic,
		eFormDoubleGraphic,
		eFormDouble,
		eSingleBigHeading = eFormDouble,
		eSetting1,
		eSetting2,
		eSetting3,
		eSetting4,
		eSettingNumber,
		// popup styles, should not be used directly
		eSinglePopupMenu,
		eSingleGraphicPopupMenu,
		eSingleGraphicBtPopupMenu,
		eSingleHeadingPopupMenu,
		eSingleGraphicHeadingPopupMenu,
		eDoublePopupMenu,
		eDoubleLargeGraphicPopupMenu,
		eSet1,
		eSet2,
		eFormGraphic1,
		eFormGraphic2,
		eFormGraphicWide1,
		eFormGraphicWide2,
		eLast = eFormGraphicWide2
	} EAvkonListBoxType;

	typedef enum { eColumn, eFormattedCell } EAvkonListBoxBaseType;

	void activateListBoxL(TBool redraw = true);
	void createListBoxL(EAvkonListBoxType listBoxType);
	CDesCArray* generateListBoxItemsL(EAvkonListBoxType listBoxType) const;
	void addListBoxItemL(EAvkonListBoxType listBoxType, CDesCArray* listBoxItems) const;
	void getListBoxItemFormat(EAvkonListBoxType listBoxType, TDes& itemFormat) const;
	EAvkonListBoxBaseType getListBoxBaseType(EAvkonListBoxType type) const;
	void getListBoxTitle(EAvkonListBoxType listBoxType, TDes& title) const;

private: 
	CEikTextListBox* _listBox;
	TUint _currentListBoxType;
	TBool _displayListBoxNotifications;
};

#endif

⌨️ 快捷键说明

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