myselectioncontrol.h

来自「一个可以加载图片作为下拉菜单的symbian手机示例」· C头文件 代码 · 共 104 行

H
104
字号
/*
============================================================================
 Name        : MySelectionControl.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CMySelectionControl declaration
============================================================================
*/

#ifndef MySELECTIONCONTROL_H
#define MySELECTIONCONTROL_H

//#include "ControlBase.h"
#include <coecntrl.h>	// CCoeControl
#include "Tag.h"

_LIT(KSelectName,"name");
_LIT(KAreaText,"area");
_LIT(KSexText,"sex");
_LIT(KHeadImage,"head");
_LIT(KAgeText,"age");
_LIT(KLabel,"lab");

_LIT(KValue,"value");
_LIT(KControlSelection,"select");

class CFbsBitmap;
class CMyPopMenuControl;

class CMySelectionControl :public CCoeControl
{
public:
	CMySelectionControl();
	virtual ~CMySelectionControl();
	void InitControlL(const CCoeControl* aParent);
	
protected:
	void SetDefaultSize(TInt aWidth,TInt aHeight);

	void SetDefaultSize(TSize aSize);
	
	void VertMoveControl(TInt aSpan);

private:
	void OutputText(CWindowGc & aGc,const TRgb &aColor ) const;

	void SizeChanged();

	void virtual Draw(const TRect& aRect) const;

	virtual void FocusChanged(TDrawNow aDrawNow);
	
	TInt CountComponentControls() const;

	CCoeControl* ComponentControl( TInt aIndex ) const;

public:
	//���?���¼�
	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);   
	
	void SetTextL(const TDesC& aText);
	void SetUrlL(const TDesC& aUrl);
	void SetColor(const TRgb& aColor);
	void SetFont(const CFont* aFont);
	
	void LoadTextListL(TInt aTextResource);
	void LoadTextListL(const TDesC& aText);
	void LoadScrollBitmapL(TInt aBitmapResource, TInt aNumberOfBitmap);
	void CreateBitmapL(TInt aBitmapResource, TInt aNumberOfBitmap);
	TInt GetIntValue(const TDesC& aValue);

	void ParseTag(TTag& aTag);
	TTag GetTag();
	
    TInt GetScrollIndex() const;
	TPtrC GetSelectValue();

private:
	//�ı���Ϣ
	HBufC *  iText;

	CDesCArrayFlat* iTextList;
	RPointerArray<CFbsBitmap> iBitmapList;
	RPointerArray<CFbsBitmap> iScrollBitmap;

	const CFont*	iFont;
	TRgb	iColor;
	TInt iCurrentIndex;
	TPoint iTextTopLeft;
	TRect iSelectionRect;
	TInt iNumberOfItems;
	TBuf<3> iIntToBuf;
	TBuf<20> iSelectName;
	CMyPopMenuControl* iPopList;
	/*
	 * 2009-4-27
	 * Desciptor:
	 * */
	const CCoeControl* iParent;
};

#endif // MySELECTIONCONTROL_H

⌨️ 快捷键说明

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