IEFolderTreeCtrl.h
上传用户:yatsl7111
上传日期:2007-01-08
资源大小:1433k
文件大小:4k
源码类别:

图形图象

开发平台:

Visual C++

  1. //*******************************************************************************
  2. // COPYRIGHT NOTES
  3. // ---------------
  4. // You may use this source code, compile or redistribute it as part of your application 
  5. // for free. You cannot redistribute it as a part of a software development 
  6. // library without the agreement of the author. If the sources are 
  7. // distributed along with the application, you should leave the original 
  8. // copyright notes in the source code without any changes.
  9. // This code can be used WITHOUT ANY WARRANTIES at your own risk.
  10. // 
  11. // For the latest updates to this code, check this site:
  12. // http://www.masmex.com 
  13. // after Sept 2000
  14. // 
  15. // Copyright(C) 2000 Philip Oldaker <email: philip@masmex.com>
  16. //*******************************************************************************
  17. #if !defined(AFX_IEFOLDERTREECTRL_H__9743E545_1F3A_11D2_A40D_9CB186000000__INCLUDED_)
  18. #define AFX_IEFOLDERTREECTRL_H__9743E545_1F3A_11D2_A40D_9CB186000000__INCLUDED_
  19. #if _MSC_VER >= 1000
  20. #pragma once
  21. #endif // _MSC_VER >= 1000
  22. // IEFolderTreeCtrl.h : header file
  23. //
  24. #include "ShellPidl.h"
  25. #include "ShellSettings.h"
  26. #include "Refresh.h"
  27. #include "UITreeCtrl.h"
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CIEFolderTreeCtrl window
  30. #include <shlobj.h>
  31. class CTRL_EXT_CLASS CIEFolderTreeCtrl : public CUITreeCtrl
  32. {
  33. // Construction
  34. public:
  35. CIEFolderTreeCtrl();
  36. // Attributes
  37. public:
  38. CShellPidl &GetShellPidl();
  39. CString GetRootPath();
  40. void SetRootPath(const CString &sPath);
  41. const CShellSettings &GetShellSettings() const;
  42. CShellSettings &GetShellSettings();
  43. virtual LPCITEMIDLIST GetPathPidl(HTREEITEM hItem);
  44. virtual CString GetPathName(HTREEITEM hItem=NULL);
  45. // Operations
  46. public:
  47. virtual void Sort(HTREEITEM hParent,LPSHELLFOLDER pFolder);
  48. virtual void Refresh();
  49. protected:
  50. virtual LPSHELLFOLDER GetItemFolder(HTREEITEM hItem);
  51. virtual HTREEITEM AddFolder(HTREEITEM hItem,LPITEMIDLIST pidl,LPSHELLFOLDER pFolder);
  52. virtual HTREEITEM AddFolder(HTREEITEM hItem,LPCTSTR pszPath);
  53. virtual bool LoadItems(LPCTSTR pszPath=NULL,DWORD dwFolderType=0);
  54. virtual bool AddItems(HTREEITEM hItem,IShellFolder* pFolder);
  55. virtual void OnDeleteItemData(DWORD dwData);
  56. virtual void SetButtonState(HTREEITEM hItem);
  57. virtual void RefreshNode(HTREEITEM hItem);
  58. virtual void SetAttributes(HTREEITEM hItem,LPSHELLFOLDER pFolder,LPITEMIDLIST pidl);
  59. // Overrides
  60. // ClassWizard generated virtual function overrides
  61. //{{AFX_VIRTUAL(CIEFolderTreeCtrl)
  62. public:
  63. virtual void Init();
  64. protected:
  65. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  66. virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder);
  67. //}}AFX_VIRTUAL
  68. virtual BOOL LoadURL(HTREEITEM hItem);
  69. // Implementation
  70. public:
  71. virtual ~CIEFolderTreeCtrl();
  72. // Generated message map functions
  73. protected:
  74. static int CALLBACK CompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  75. //{{AFX_MSG(CIEFolderTreeCtrl)
  76. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  77. afx_msg void OnDeleteItem(NMHDR* pNMHDR, LRESULT* pResult);
  78. afx_msg LRESULT OnSettingChange(WPARAM wParam,LPARAM lParam);
  79. afx_msg void OnDestroy();
  80. //}}AFX_MSG
  81. DECLARE_MESSAGE_MAP()
  82. private:
  83. IMalloc* m_pMalloc;
  84. CShellPidl m_ShellPidl;
  85. CString m_sRootPath;
  86.     HIMAGELIST  m_hImageList;
  87. CShellSettings m_ShellSettings;
  88. };
  89. inline const CShellSettings &CIEFolderTreeCtrl::GetShellSettings() const
  90. {
  91. return m_ShellSettings;
  92. }
  93. inline CShellSettings &CIEFolderTreeCtrl::GetShellSettings()
  94. {
  95. return m_ShellSettings;
  96. }
  97. inline CString CIEFolderTreeCtrl::GetRootPath()
  98. {
  99. return m_sRootPath;
  100. }
  101. inline void CIEFolderTreeCtrl::SetRootPath(const CString &sPath)
  102. {
  103. m_sRootPath = sPath;
  104. }
  105. inline CShellPidl &CIEFolderTreeCtrl::GetShellPidl()
  106. {
  107. return m_ShellPidl;
  108. }
  109. /////////////////////////////////////////////////////////////////////////////
  110. //{{AFX_INSERT_LOCATION}}
  111. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  112. #endif // !defined(AFX_IEFOLDERTREECTRL_H__9743E545_1F3A_11D2_A40D_9CB186000000__INCLUDED_)