class CHeaderCtrl : public CWnd
{
DECLARE_DYNAMIC(CHeaderCtrl)
// Constructors
public:
CHeaderCtrl();
BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
// Attributes
int GetItemCount() const;//获取项目数量
BOOL GetItem(int nPos, HDITEM* pHeaderItem) const;//获取项目
BOOL SetItem(int nPos, HDITEM* pHeaderItem);//设置项目
CImageList* GetImageList() const;//获取图片列表
CImageList* SetImageList(CImageList* pImageList);//设置图片列表
BOOL GetItemRect(int nIndex, LPRECT lpRect) const;//获取项目矩形区域
BOOL GetOrderArray(LPINT piArray, int iCount = -1);//获取顺序数组
BOOL SetOrderArray(int iCount, LPINT piArray);//设置顺序数组
int OrderToIndex(int nOrder) const;//按序号排序
// Operations
int InsertItem(int nPos, HDITEM* phdi);//插入一项
BOOL DeleteItem(int nPos);//删除项目
BOOL Layout(HDLAYOUT* pHeaderLayout);//布局?
CImageList* CreateDragImage(int nIndex);//创建拖动图片
int SetHotDivider(CPoint pt);//设置热点分割者?
int SetHotDivider(int nIndex);
// Overridables
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);//虚函数,绘制项目
// Implementation
public:
virtual ~CHeaderCtrl();
protected:
virtual BOOL OnChildNotify(UINT, WPARAM, LPARAM, LRESULT*);//?
};
相关:
#ifdef _AFXDLL
#define
DECLARE_DYNAMIC(class_name) \
protected: \
static CRuntimeClass* PASCAL _GetBaseClass(); \
public: \
static const AFX_DATA CRuntimeClass class##class_name; \
virtual CRuntimeClass* GetRuntimeClass() const; \
#define _DECLARE_DYNAMIC(class_name) \
protected: \
static CRuntimeClass* PASCAL _GetBaseClass(); \
public: \
static AFX_DATA CRuntimeClass class##class_name; \
virtual CRuntimeClass* GetRuntimeClass() const; \
#else
#define DECLARE_DYNAMIC(class_name) \
public: \
static const AFX_DATA CRuntimeClass class##class_name; \
virtual CRuntimeClass* GetRuntimeClass() const; \
#define _DECLARE_DYNAMIC(class_name) \
public: \
static AFX_DATA CRuntimeClass class##class_name; \
virtual CRuntimeClass* GetRuntimeClass() const; \
#endif
DECLARE_DYNAMIC(classname)是什么意思?主要是做什么工作?
在MSDN里面的解释是:
Add the DECLARE_DYNAMIC macro to the header (.h) module for the class, then include that module in all .cpp modules that need access to objects of this class.
If you use the DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC macros as described, you can then use the RUNTIME_CLASS macro and the CObject::IsKindOf function to determine the class of your objects at run time.
If DECLARE_DYNAMIC is included in the class declaration, then IMPLEMENT_DYNAMIC must be included in the class implementation.
主要是说用了DECLARE_DYNAMIC这个宏的类,在运行时支持RUNTIME_CLASS以及动态编译。不过,这只是表面意思,具体有什么意思我还不清楚。
网上查到的资料是:
mfc的三个宏
DECLARE_DYNAMIC 支持RTTI
DECLARE_DYNCREATE 支持RTTI 类动态创建
DECLARE_SERIAL 支持RTTI 类动态创建 及序列化