MCPcopy Create free account
hub / github.com/CobaltFusion/DebugViewPP / CPropertyCheckmarkItem

Class CPropertyCheckmarkItem

Libraries/PropertyGrid/PropertyTree.h:61–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59// The Checkmark & Option Controls
60
61class CPropertyCheckmarkItem : public CProperty
62{
63public:
64 CTreeViewCtrl m_tree;
65 HTREEITEM m_hItem;
66 bool m_bValue;
67
68 CPropertyCheckmarkItem(LPCTSTR pstrName, bool bValue, LPARAM lParam) :
69 CProperty(pstrName, lParam),
70 m_hItem(NULL),
71 m_bValue(bValue)
72 {
73 }
74
75 BYTE GetKind() const
76 {
77 return PROPKIND_CHECK;
78 }
79
80 void SetOwner(HWND hWnd, LPVOID pData)
81 {
82 ATLASSERT(::IsWindow(hWnd));
83 ATLASSERT(m_hWndOwner==NULL); // Cannot set it twice
84 m_hWndOwner = hWnd;
85 m_tree.Attach( hWnd );
86 m_hItem = reinterpret_cast<HTREEITEM>(pData);
87 CComVariant v(m_bValue);
88 SetValue(v);
89 }
90
91 BOOL GetValue(VARIANT* pVal) const
92 {
93 return SUCCEEDED( CComVariant(m_bValue).Detach(pVal) );
94 }
95
96 BOOL SetValue(const VARIANT& value)
97 {
98 // Set a new value
99 switch( value.vt ) {
100 case VT_BOOL:
101 m_bValue = (value.boolVal != VARIANT_FALSE);
102 break;
103 default:
104 ATLASSERT(false);
105 return FALSE;
106 }
107
108 // Update images
109 int iImage = m_bValue ? 1 : 0;
110 if( !IsEnabled() ) iImage += 4;
111 m_tree.SetItemImage(m_hItem, iImage, iImage);
112 return TRUE;
113 }
114
115 BOOL Activate(UINT action, LPARAM /*lParam*/)
116 {
117 switch( action ) {
118 case PACT_SPACE:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected