Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
5.3 KiB

  1. #ifndef _onetree_h
  2. #define _onetree_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define OTGetRootFolder() (s_pshfRoot->AddRef(), s_pshfRoot)
  7. #define OTGetRootParentFolder() (s_pshfRootParent->AddRef(), s_pshfRootParent)
  8. #define OTIsShared(lpnd) ((lpnd)->dwAttribs & SFGAO_SHARE)
  9. #define OTIsRemovableRoot(lpnd) (((lpnd)->dwAttribs & (SFGAO_REMOVABLE | SFGAO_FILESYSANCESTOR)) == (SFGAO_REMOVABLE | SFGAO_FILESYSANCESTOR))
  10. #define OTGetSubNode(lpn, szSubFolderID) FindKid(lpn, szSubFolderID, TRUE)
  11. #define OTGetRootNode() (OTAddRef(s_lpnRoot), s_lpnRoot)
  12. #define OTInvalidateAll() DoInvalidateAll(s_lpnRoot, -1)
  13. #define OTAddRef(lpnd) ((lpnd)->cRef++)
  14. typedef struct _OTCompareInfo
  15. {
  16. BOOL bFound;
  17. BOOL fRooted;
  18. LPSHELLFOLDER psf;
  19. } OTCompareInfo, *LPOTCompareInfo;
  20. typedef struct _OTEnumInfo
  21. {
  22. BOOL fTimedOut : 1;
  23. BOOL fAllowTimeout :1;
  24. } OTEnumInfo, *LPEnumInfo;
  25. typedef struct _OneTreeNode
  26. {
  27. #ifdef DEBUG
  28. #define OTDEBUG_SIG ((TEXT('O') << 16) + (TEXT('T') << 8) + TEXT('N'))
  29. DWORD dwDebugSig;
  30. #endif
  31. struct _OneTreeNode * lpnParent;
  32. HDPA hdpaKids; // HASNOKIDS || KIDSUNKNOWN || array of kids
  33. LPTSTR lpText; // The text for this item
  34. int iImage;
  35. int iSelectedImage;
  36. BITBOOL fMark : 1;
  37. BITBOOL fRoot : 1;
  38. BITBOOL fInvalid : 1;
  39. BITBOOL fShared : 1;
  40. BITBOOL fRemovable : 1;
  41. BITBOOL fInserted : 1; // this means that this item was forceably added.. it's not safe to remove it if it doesn't show up in enumeration
  42. BITBOOL fHasAttributes : 1;
  43. BITBOOL fValidatePidl :1; // this means the item was invalidated specifically by fsnotify (as opposed to not fully fetched yet)
  44. // so on the next call to GetAttributesOf, we need to pass SFGAO_VALIDATE
  45. BYTE cChildren;
  46. DWORD dwAttribs;
  47. DWORD dwDropEffect;
  48. DWORD dwLastChanged;
  49. int cRef;
  50. LPITEMIDLIST pidl; // this needs to be at the end because it grows
  51. } OneTreeNode, * LPOneTreeNode;
  52. typedef struct _NMOTFSEINFO {
  53. NMHDR nmhdr;
  54. LONG lEvent;
  55. LPITEMIDLIST pidl;
  56. LPITEMIDLIST pidlExtra;
  57. } NMOTFSEINFO, *LPNMOTFSEINFO;
  58. #define OTN_FSE CWM_ONETREEFSE
  59. // from shelldll
  60. #define IDOI_SHARE 1
  61. #define NOKIDS ((HDPA)-1)
  62. #define KIDSUNKNOWN ((HDPA)0)
  63. extern LPOneTreeNode s_lpnRoot;
  64. extern LPSHELLFOLDER s_pshfRoot;
  65. extern LPSHELLFOLDER s_pshfRoot;
  66. extern LPSHELLFOLDER s_pshfRootParent;
  67. #ifdef FOR_GEORGEST
  68. void DebugDumpNode(LPOneTreeNode lpn, LPTSTR lpsz);
  69. #else
  70. #define DebugDumpNode(lpn, lpsz)
  71. #endif
  72. BOOL OneTree_Initialize(LPCITEMIDLIST pidlRootClass);
  73. void OneTree_Terminate();
  74. void OneTree_GetAltColor(void);
  75. #define OTILIsEqual(pidl1, pidl2) IEILIsEqual((pidl1), (pidl2), FALSE)
  76. BOOL WINAPI OTILIsParent(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2, BOOL fImmediate);
  77. BOOL OTIsCompressed(LPOneTreeNode lpNode);
  78. BOOL OTIsBold(LPOneTreeNode lpNode);
  79. STDAPI_(void) OTAssumeThread();
  80. // any calls to this MUST BE IN A CRIT section!
  81. LPITEMIDLIST OTCloneFolderID(LPOneTreeNode lpn);
  82. LPTSTR OTGetNodeName(LPOneTreeNode lpn, LPTSTR pszText, int cch);
  83. HRESULT WINAPI OTRealBindToFolder(LPOneTreeNode lpNode, LPSHELLFOLDER *ppshf);
  84. LPSHELLFOLDER WINAPI OTBindToFolder(LPOneTreeNode lpnd);
  85. HRESULT OTBindToParentFolder(LPOneTreeNode lpNode, IShellFolder **ppsf, LPITEMIDLIST *ppidlChild);
  86. HRESULT WINAPI OTBindToParent(LPOneTreeNode lpnd, LPSHELLFOLDER *ppshf);
  87. HRESULT WINAPI OTBindToFolderEx(LPOneTreeNode lpnd, LPSHELLFOLDER *ppshf);
  88. HRESULT WINAPI OTRealBindToFolder(LPOneTreeNode lpNode, LPSHELLFOLDER *ppshf);
  89. LPOneTreeNode WINAPI OTGetNthSubNode(HWND hwndOwner, LPOneTreeNode lpnd, UINT i);
  90. void WINAPI OTInvalidateAttributeRecursive(LPOneTreeNode lpn);
  91. BOOL WINAPI OTSubNodeCount(HWND hwndOwner, LPOneTreeNode lpNode, LPEnumInfo pei, UINT* pcnd, BOOL fInteractive);
  92. BOOL WINAPI OTHasSubFolders(LPOneTreeNode lpnd);
  93. void WINAPI OTNodeFillTV_ITEM(LPOneTreeNode lpnd, LPTV_ITEM lpItem);
  94. void WINAPI OTUnregister(HWND hwndTree);
  95. void WINAPI OTRegister(HWND hwndTree);
  96. void WINAPI OTGetImageIndex(LPOneTreeNode lpnd, int *lpiImage, int * lpiSelectedImage);
  97. void WINAPI OTGetDefaultImageIndices(int *lpiImage, int *lpiSelectedImage);
  98. void WINAPI OTRelease(LPOneTreeNode lpNode);
  99. void DoInvalidateAll(LPOneTreeNode lpNode, int iImage);
  100. LPOneTreeNode WINAPI OTGetParent(LPOneTreeNode lpnd);
  101. void OTActivate();
  102. #define OTASF_ALLOWDUP 0x00000001
  103. #define OTASF_MAYBESIMPLE 0x00000002
  104. HRESULT WINAPI OTAddSubFolder(LPOneTreeNode lpnd, LPCITEMIDLIST pidl, DWORD dwFlags, LPOneTreeNode *ppndOut);
  105. LPITEMIDLIST WINAPI OTCreateIDListFromNode(LPOneTreeNode lpnd);
  106. BOOL WINAPI OTGetDisplayName(LPCITEMIDLIST pidl, LPTSTR pszName, int fType);
  107. int CALLBACK OTTreeViewCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  108. LPOneTreeNode WINAPI OTGetNodeFromIDListEx(LPCITEMIDLIST pidl, UINT uFlags, HRESULT* phresOut);
  109. #define OTGetNodeFromIDList(pidl, uFlags) OTGetNodeFromIDListEx(pidl, uFlags, (HRESULT*)NULL)
  110. // onetree get node flags
  111. #define OTGNF_VALIDATE 0x01
  112. #define OTGNF_TRYADD 0x02
  113. #define OTGNF_NEARESTMATCH 0x04
  114. #ifdef __cplusplus
  115. }
  116. #endif
  117. #endif // _onetree_h