GroupTree.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #pragma once
  2. #include "DittoDropTarget.h"
  3. #define NEW_GROUP_ID -2
  4. class CGroupTree : public CTreeCtrl, IDittoDropTarget
  5. {
  6. // Construction
  7. public:
  8. CGroupTree();
  9. // Attributes
  10. public:
  11. // Operations
  12. public:
  13. void FillTree();
  14. void SetNotificationWndEx(HWND hWnd) { m_NotificationWnd = hWnd; }
  15. long GetSelectedGroup();
  16. void SetSelectedGroup(long lGroupID) { m_lSelectedFolderID = lGroupID; }
  17. HTREEITEM AddNode(CString csText, long lID);
  18. protected:
  19. void FillTree(long lParentID, HTREEITEM hParent);
  20. void SendToParent(HTREEITEM Item);
  21. int GetGroupCount(long lGroupID);
  22. void RefreshTreeItem(HTREEITEM Item);
  23. HWND m_NotificationWnd;
  24. CBitmap m_bmOpenFolder;
  25. CBitmap m_bmClosedFolder;
  26. CDittoDropTarget m_DropTarget;
  27. long m_lSelectedFolderID;
  28. bool m_bShowCounts;
  29. public:
  30. virtual ~CGroupTree();
  31. // Generated message map functions
  32. protected:
  33. DECLARE_MESSAGE_MAP()
  34. public:
  35. virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
  36. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  37. afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
  38. afx_msg void OnKeydown(NMHDR* pNMHDR, LRESULT* pResult);
  39. afx_msg void OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
  40. afx_msg void OnTvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
  41. virtual DROPEFFECT DragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
  42. virtual DROPEFFECT DragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
  43. virtual void DragLeave();
  44. virtual BOOL Drop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
  45. };