userlistboxcontainer.h
来自「symbian s60 2th 自定义ListBox」· C头文件 代码 · 共 88 行
H
88 行
#ifndef __REDCONTAINER_H__
#define __REDCONTAINER_H__
// INCLUDES
#include <aknview.h>
#include <e32base.h>
class CNDListItem;
class CUserListboxContainer : public CCoeControl
{
public: // Constructors and destructor
CUserListboxContainer();
virtual ~CUserListboxContainer();
void ConstructL(const TRect& aRect);
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
private: // Functions from base classes
void SizeChanged();
TInt CountComponentControls() const;
CCoeControl* ComponentControl( TInt aIndex ) const;
void Draw( const TRect& aRect ) const;
void GetAppPath(TDes& aPath);
void Reset();
//////////////////////////////////////////////////////////自定义
public:
TInt Selected();//获取当前选中项索引
void SetSelected(TInt aIndex);//设置指定索引为选中项
void AppendAnItem(const TDesC& aBody);//添加条目到列表项结尾处
void AppendAnItem(CNDListItem *anItem);
void DeleteAnItem(TInt aIndex);
void DeleteSelectItem();
private:
RPointerArray<CNDListItem> iDataArray; //保存数据的数组
TInt iSeleIndex; //选择索引
TInt iDrawIndex;
TInt iIndex;
TInt iScrollIndex;
//////////////////////////////////////////////////////////
};
class CNDListItem:public CBase //MDU
{
private:
HBufC *ipBody;
TBool iSelect;
public:
~CNDListItem();
static CNDListItem *NewL();
static CNDListItem *NewLC();
void SetBody(const TDesC &aBody);
HBufC *GetBody() const;
void SetSelect(const TBool aSelect);
TBool GetSelect() const;
private:
CNDListItem();
void ConstructL();
};
#define MOMERAY_FREE(a) if(a){delete a; a = NULL;} //释放内存
#endif // __UserListboxCONTAINER_H__
// End of File
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?