PropertyGridItemButton.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include "stdafx.h"
  2. #include "PropertyGridInplaceEdit.h"
  3. #include "PropertyGridInplaceButton.h"
  4. #include "PropertyGridInplaceList.h"
  5. #include "PropertyGridItem.h"
  6. #include "PropertyGridItemButton.h"
  7. //////////////////////////////////////////////////////////////////////
  8. // Construction/Destruction
  9. //////////////////////////////////////////////////////////////////////
  10. CPropertyGridItemButton::CPropertyGridItemButton(CString strCaption, HWND hNotifyWnd, UINT nNotifyMsg)
  11. : CPropertyGridItem(strCaption)
  12. {
  13. ASSERT(hNotifyWnd);
  14. m_hNotifyWnd = hNotifyWnd;
  15. m_nNotifyMsg = nNotifyMsg;
  16. // 设置属性项风格:不可编辑,有按钮
  17. SetFlags(pgitemHasExpandButton);
  18. }
  19. CPropertyGridItemButton::CPropertyGridItemButton(UINT nID, HWND hNotifyWnd, UINT nNotifyMsg)
  20. : CPropertyGridItem(nID)
  21. {
  22. ASSERT(hNotifyWnd);
  23. m_hNotifyWnd = hNotifyWnd;
  24. m_nNotifyMsg = nNotifyMsg;
  25. // 设置属性项风格:不可编辑,有按钮
  26. SetFlags(pgitemHasExpandButton);
  27. }
  28. CPropertyGridItemButton::~CPropertyGridItemButton()
  29. {
  30. }
  31. void CPropertyGridItemButton::OnInplaceButtonDown()
  32. {
  33. // 向指定窗口发送消息
  34. ::SendMessage(m_hNotifyWnd, m_nNotifyMsg, 0, 0);
  35. }
  36. void CPropertyGridItemButton::OnLButtonDblClk()
  37. {
  38. // 向指定窗口发送消息
  39. ::SendMessage(m_hNotifyWnd, m_nNotifyMsg, 0, 0);
  40. }