PropertyGridItemButton.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. m_nFlags = pgitemHasEdit | pgitemHasExpandButton;
  19. }
  20. CPropertyGridItemButton::CPropertyGridItemButton(UINT nID, HWND hNotifyWnd, UINT nNotifyMsg)
  21. : CPropertyGridItem(nID)
  22. {
  23. ASSERT(hNotifyWnd);
  24. m_hNotifyWnd = hNotifyWnd;
  25. m_nNotifyMsg = nNotifyMsg;
  26. // 设置属性项风格:不可编辑,有按钮
  27. SetFlags(pgitemHasExpandButton);
  28. }
  29. CPropertyGridItemButton::~CPropertyGridItemButton()
  30. {
  31. }
  32. void CPropertyGridItemButton::OnInplaceButtonDown()
  33. {
  34. // 向指定窗口发送消息
  35. ::SendMessage(m_hNotifyWnd, m_nNotifyMsg, 0, 0);
  36. }
  37. void CPropertyGridItemButton::OnLButtonDblClk()
  38. {
  39. // 向指定窗口发送消息
  40. ::SendMessage(m_hNotifyWnd, m_nNotifyMsg, 0, 0);
  41. }