formitemgroup.h
来自「基于WINDOWS mobile 的用于创建一个窗体和自定义试图的工程」· C头文件 代码 · 共 79 行
H
79 行
// FormItemGroup.h: interface for the CFormItemGroup class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FORMITEMGROUP_H__815058ED_EC2B_4C33_BE62_5C04AD9950BA__INCLUDED_)
#define AFX_FORMITEMGROUP_H__815058ED_EC2B_4C33_BE62_5C04AD9950BA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <vector>
#include "FormItem.h"
//---------------------------------------------------------------------------
//
// CFormItemGroup
//
//---------------------------------------------------------------------------
class CFormItemGroup : public CFormItem
{
typedef std::vector<CFormItem*> CItemVector;
public:
CFormItemGroup();
virtual ~CFormItemGroup();
BOOL IsExpanded() {return m_bExpanded;}
void SetExpanded(BOOL bExpanded = TRUE) {m_bExpanded = bExpanded;}
/// Adds an item to the group. Items do not belong to the group, but to
/// the containing CFormListCtrl.
void AddItem(CFormItem* pItem) {m_vecItem.push_back(pItem);}
virtual BOOL ShowEditor(CFormListCtrl* pForm, BOOL bShow, int iItem, int iSubItem);
/// Handles the item's custom draw
virtual LRESULT CustomDraw(CFormListCtrl* pForm, NMLVCUSTOMDRAW *pLVCD);
virtual int InsertOn(CFormListCtrl* pForm, int iItem = -1);
virtual BOOL ValidateData();
protected:
BOOL m_bExpanded; //!< Expansion state
CItemVector m_vecItem; //!< Dependent item vector
/// Paints the expand / collapse button
void PaintButton(HDC hDC, RECT &rc);
/// Insert the group's children at the given index.
int InsertChildren(CFormListCtrl* pForm, int iIndex);
/// Deletes the children from the given index.
void DeleteChildren(CFormListCtrl* pForm, int iIndex);
void LineVert(HDC hDC, int x, int y0, int y1)
{
POINT line[2] = {{x, y0}, {x, y1}};
DRA::Polyline(hDC, line, 2, DRA::PS_DOWNRIGHT);
}
void LineHorz(HDC hDC, int x0, int x1, int y)
{
POINT line[2] = {{x0, y},{x1, y}};
DRA::Polyline(hDC, line, 2, DRA::PS_DOWNRIGHT);
}
};
#endif // !defined(AFX_FORMITEMGROUP_H__815058ED_EC2B_4C33_BE62_5C04AD9950BA__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?