| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #pragma once
- //////////////////////////////////////////////////////////////////////
- // CPropertyGridItemSize is a CPropertyGridItem derived class.
- // It is used to create size-value item in a Property Grid control.
- //
- class CPropertyGridItemSubSelect : public CPropertyGridItem
- {
- public:
- // Constructs a CPropertyGridItemSize object.
- //
- CPropertyGridItemSubSelect(
- // Caption of the item.
- CString strCaption,
- HWND hNotifyWnd,
- UINT nNotifyMsg,
- // Initial value
- BOOL bValue = FALSE);
- // Constructs a CPropertyGridItemSize object.
- //
- CPropertyGridItemSubSelect(
- // Identifier of the item.
- UINT nID,
- //
- HWND hNotifyWnd,
- UINT nNotifyMsg,
- // Initial value
- BOOL bValue = FALSE);
- // Destroys a CPropertyGridItemSize object.
- //
- virtual ~CPropertyGridItemSubSelect(void);
- private:
-
- class CPropertyGridItemSubSelectColor;
- class CPropertyGridItemSubSelectString;
- HWND m_hNotifyWnd; // 接收自定义消息的窗口句柄
- UINT m_nNotifyMsg; // 自定义消息
- CString m_strDescription;
- COLORREF m_clrValue;
- BOOL m_bValue;
- BOOL* m_pBindBool; // 绑定到属性项的CSize对象
- CPropertyGridItemSubSelectColor* m_itemColor;
- CPropertyGridItemSubSelectString* m_itemString;
- public:
-
- // Call this method to change item's value
- //
- void SetBool(
- // The new Size value of the item.
- BOOL bValue);
- // Call this method to get the size value of the item.
- //
- CSize GetBool();
- // 把一个CSize对象绑定到属性项
- void BindToBool(BOOL* pBindBool)
- {
- m_pBindBool = pBindBool;
- if (m_pBindBool)
- SetBool(*m_pBindBool);
- }
- private:
- void _Init(BOOL bValue);
- void SetColor(COLORREF clr);
- void SetString(CString strName);
- //CString SizeToString(CSize size);
- //CSize StringToSize(CString str);
- virtual void OnAddChildItem();
- virtual void SetValue(CString strValue);
-
- void UpdateChilds();
- friend class CPropertyGridItemSubSelectColor;
- friend class CPropertyGridItemSubSelectString;
- };
- //////////////////////////////////////////////////////////////////////
- AFX_INLINE CSize CPropertyGridItemSubSelect::GetBool() {
- return m_bValue;
- }
|