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

📄 mypopmenucontrol.h

📁 一个可以加载图片作为下拉菜单的symbian手机示例
💻 H
字号:
/*
============================================================================
 Name        : MyPopMenuControl.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CMyPopMenuControl declaration
============================================================================
*/

#ifndef MyPOPMENUCONTROL_H
#define MyPOPMENUCONTROL_H

#include <coecntrl.h>
// INCLUDES
//#include "ControlBase.h"

const TInt KMaxPopItem = 5;	//����һ��pop�����ܹ���ʾ�������Ŀ��
const TInt KItemHeight = 18;
const TInt KItemWidth = 66;
// CLASS DECLARATION
class CFbsBitmap;

class CMyPopMenuControl : public CCoeControl
{
public: // Constructors and destructor

	~CMyPopMenuControl();

	static CMyPopMenuControl* NewL(CDesCArrayFlat* aItemList,
		   CFbsBitmap* aBackgroundImage = NULL,const CCoeControl* aParent = NULL);

	static CMyPopMenuControl* NewLC(CDesCArrayFlat* aItemList,
		   CFbsBitmap* aBackgroundImage = NULL,const CCoeControl* aParent =NULL);
	//���?���¼�
	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);   

	TInt GetCurrentItemIndex();	//��ȡ��ǰ�˵�ѡ������

	void ResetMenuItem();
	
	void InitControlL(const CCoeControl* aParent);
	
protected:
	void SetDefaultSize(TInt aWidth,TInt aHeight);

	void SetDefaultSize(TSize aSize);
	
	TBool IsFocusChangeKey(const TKeyEvent& aKeyEvent,TEventCode aType);
private:
	CMyPopMenuControl();	
	
	void ConstructL(CDesCArrayFlat* aItemList,CFbsBitmap* aBackgroundImage,const CCoeControl* aParent);
	
	void virtual Draw(const TRect& aRect) const;

	void DrawPopMenu(const TPoint& aItemTopLeft) const;
	
	void SizeChanged();

private:
	CDesCArrayFlat* iItemList;		//����˵�ѡ���б�
	TInt iNumberOfItems;
	CFbsBitmap* iBackgroundImage;	//����˵�����ͼƬ
	CFont *iFont;
	TInt iItemIndex;	//����˵���ǰѡ������
	TInt iTopIndex;     //����˵���ʾ��һ������
	TBool iNeedScroll;
	TInt iMoveSpan;
};

#endif // MyPOPMENUCONTROL_H

⌨️ 快捷键说明

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