📄 formitem.h
字号:
// FormItem.h: interface for the CFormItem class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_FORMITEM_H__81D6EB6D_31D0_4B32_9BD0_03472FC205F2__INCLUDED_)
#define AFX_FORMITEM_H__81D6EB6D_31D0_4B32_9BD0_03472FC205F2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CFormListCtrl;
#define IDC_FORM_ITEM 1201
//
// Form item flags
//
#define FIF_LINE 0x00000001 // Draw a line at the bottom
#define FIF_VISIBLE 0x00000002 // Item is visible
#define FIF_ENABLED 0x00000004 // Item is enabled
#define FIF_MANDATORY 0x00000008 // Data for the item must be filled in by the user
#define FIF_UNDERLINE 0x00000010 // Underline the caption text
#define FIF_HASOPTIONS 0x00000020 // The item has a context menu (on the caption)
#define FIF_DRAWOPTIONS 0x00000040 // Internal flag
#define FIF_SELECTED 0x00000080 // The item is selected
#define FIF_NORMAL (FIF_LINE|FIF_VISIBLE|FIF_ENABLED)
//---------------------------------------------------------------------------
//
// CFormItem
//
//---------------------------------------------------------------------------
class CFormItem
{
public:
CFormItem();
virtual ~CFormItem();
/// Initializes the form item.
void Init(LPCTSTR pszCaption, DWORD dwFlags = FIF_NORMAL)
{
SetCaption(pszCaption);
SetFlags(dwFlags);
}
/// Sets the for item caption.
void SetCaption(LPCTSTR pszCaption) { m_strCaption = pszCaption; }
/// Sets the item's flags.
void SetFlags(DWORD dwFlags) { m_dwFlags = dwFlags; }
/// Returns the field's flags
DWORD GetFlags() { return m_dwFlags; }
/// Returns the visibility status of the item.
bool IsVisible() { return (m_dwFlags & FIF_VISIBLE) == FIF_VISIBLE; }
/// Returns the selection status of the item.
bool IsSelected() { return (m_dwFlags & FIF_SELECTED) == FIF_SELECTED; }
/// Shows or hides the item.
void Show(BOOL bShow = TRUE);
/// Returns the enabled status of an item.
bool IsEnabled() { return (m_dwFlags & FIF_ENABLED) == FIF_ENABLED; }
/// Enables or disables an item.
void Enable(BOOL bEnable = TRUE);
/// Enables or disables the drawing of active option's button
void DrawOptions(BOOL bEnable = TRUE);
bool IsMandatory() { return (m_dwFlags & FIF_MANDATORY) == FIF_MANDATORY; }
bool IsUnderlined() { return (m_dwFlags & FIF_UNDERLINE) == FIF_UNDERLINE; }
bool HasOptions() { return (m_dwFlags & FIF_HASOPTIONS) == FIF_HASOPTIONS; }
//
// Virtual methods
//
virtual LPCTSTR RenderData (LV_DISPINFO *pDispInfo);
virtual LRESULT CustomDraw (CFormListCtrl* pForm, NMLVCUSTOMDRAW *pLVCD);
virtual BOOL ShowEditor (CFormListCtrl* pForm, BOOL bShow, int iItem, int iSubItem);
virtual BOOL Select (CFormListCtrl* pForm, BOOL bSelect, int iItem);
virtual BOOL ValidateData();
virtual BOOL OnCtrlNotify(CFormListCtrl* pForm, int iItem, WORD wNotify);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual void MoveEditor(const RECT &rcItem);
virtual int InsertOn(CFormListCtrl* pForm, int iItem = -1);
virtual void GetControlData();
protected:
CString m_strCaption; //!< Item caption
DWORD m_dwFlags; //!< Flags
//
// Drawing helpers
//
void DrawCaption(CFormListCtrl* pForm, NMLVCUSTOMDRAW *pLVCD);
void DrawContent(CFormListCtrl* pForm, NMLVCUSTOMDRAW *pLVCD);
/// Draws the bottom line
void DrawBottomLine(NMLVCUSTOMDRAW* pLVCD);
void DrawArrow(HDC hDC, const CRect &rc, BOOL bSelected);
/// Draws the focus rectangle around the item.
void DrawFocus(HDC hDC, RECT* prc);
};
#endif // !defined(AFX_FORMITEM_H__81D6EB6D_31D0_4B32_9BD0_03472FC205F2__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -