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.

139 lines
4.0 KiB

  1. // Name Space Control definitions
  2. #define NAME_SPACE_CLASS "NameSpaceControl" // window class name
  3. // Window Styles
  4. #define NSS_TREE 0x0000 // tree control
  5. #define NSS_COMBOBOX 0x0001 // combo box
  6. #define NSS_SHOWNONFOLDERS 0x0002 // include non folder things (files)
  7. #define NSS_SHOWHIDDEN 0x0004
  8. #define NSS_ONLYFSDIRS 0x0008 // For finding a folder to start document searching
  9. #define NSS_DONTGOBELOWDOMAIN 0x0010 // For starting the Find Computer
  10. #define NSS_RETURNFSANCESTORS 0x0020
  11. #define NSS_DROPTARGET 0x0040 // register as a drop target
  12. #define NSS_BROWSEFORCOMPUTER 0x4000 // Browsing for Computers.
  13. #define NSS_BROWSEFORPRINTER 0x8000 // Browsing for Printers
  14. // structures
  15. typedef DWORD HNAMESPACEITEM; // handle to a name space item
  16. typedef enum {
  17. NSIF_HITEM = 0x0001,
  18. NSIF_FOLDER = 0x0002,
  19. NSIF_PARENTFOLDER = 0x0004,
  20. NSIF_IDLIST = 0x0008,
  21. NSIF_FULLIDLIST = 0x0010,
  22. NSIF_ATTRIBUTES = 0x0020
  23. } NSI_FLAGS;
  24. typedef struct {
  25. NSI_FLAGS flags;
  26. HNAMESPACEITEM hitem;
  27. IShellFolder *psf;
  28. LPCITEMIDLIST pidl;
  29. DWORD dwAttributes;
  30. } NSC_ITEMINFO;
  31. typedef enum {
  32. NSSR_ENUMBELOWROOT = 0x0001,
  33. NSSR_CREATEPIDL = 0x0002,
  34. } NSSR_FLAGS;
  35. typedef struct {
  36. NSSR_FLAGS flags;
  37. IShellFolder *psf; // NULL -> desktop shell folder
  38. LPCITEMIDLIST pidlRoot; // PIDL, NULL for desktop, or CSIDL for shell special folder
  39. int iExpandDepth; // how many levels to expand the tree
  40. LPCITEMIDLIST pidlExpandTo; // NULL, or PIDL to expand to
  41. } NSC_SETROOT;
  42. // Window Messages
  43. #define NSM_SETROOT (WM_USER + 1)
  44. #define NameSpace_SetRoot(hwnd, psr) \
  45. (BOOL)SendMessage(hwnd, NSM_SETROOT, (WPARAM)0, (LPARAM)psr)
  46. #define NSM_GETIDLIST (WM_USER + 2)
  47. #define NameSpace_GetIDList(hwnd, hitem) \
  48. (LPITEMIDLIST)SendMessage(hwnd, NSM_GETPIDL, 0, (WPARAM)hitem)
  49. #define NameSpace_GetFullIDList(hwnd, hitem) \
  50. (LPITEMIDLIST)SendMessage(hwnd, NSM_GETPIDL, 1, (WPARAM)hitem)
  51. #define NSM_GETITEMINFO (WM_USER + 3)
  52. #define NameSpace_GetItemInfo(hwnd, hitem, pinfo) \
  53. (BOOL)SendMessage(hwnd, NSM_GETITEMINFO, (WPARAM)hitem, (LPARAM)pinfo)
  54. #define NSM_FINDITEM (WM_USER + 4)
  55. #define NameSpace_FindItem(hwnd, pidl, pinfo) \
  56. (HNAMESPACEITEM)SendMessage(hwnd, NSM_FINDITEM, (WPARAM)pidl, (LPARAM)pinfo)
  57. #define NSM_DOVERB (WM_USER + 5)
  58. #define NameSpace_DoVerb(hwnd, hitem, pszVerb) \
  59. (HNAMESPACEITEM)SendMessage(hwnd, NSM_DOVERB, (WPARAM)hitem, (LPARAM)pszVerb)
  60. // WM_NOTIFY codes
  61. #define NSN_FIRST (0U - 800)
  62. #define NSN_SELCHANGE (NSN_FIRST - 1)
  63. #define NSN_BEGINDRAG (NSN_FIRST - 2)
  64. #define NSN_ENDDRAG (NSN_FIRST - 3)
  65. #define NSN_FILTERITEM (NSN_FIRST - 4)
  66. #define NSN_PREDOVERB (NSN_FIRST - 5)
  67. #define NSN_AFTERDOVERB (NSN_FIRST - 6)
  68. // structure in lParam for NSN_FILTERITEM
  69. typedef struct {
  70. NMHDR hdr;
  71. NSC_ITEMINFO item;
  72. } NS_NOTIFY;
  73. // private stuff --------------------------------------
  74. // API
  75. BOOL NameSpace_RegisterClass(HINSTANCE hinst);
  76. typedef struct
  77. {
  78. HWND hwnd; // window handle of this control
  79. HWND hwndParent; // parent window to notify
  80. HWND hwndTree; // tree or combo box
  81. DWORD style;
  82. UINT flags; // NSCF_ state bits
  83. UINT id; // our control ID
  84. BOOL fCacheIsDesktop : 1; // state flags
  85. BOOL fAutoExpanding : 1; // tree is auto-expanding
  86. // HWND hwndNextViewer; // BUGBUG: implement this
  87. // HTREEITEM htiCut;
  88. IContextMenu *pcm; // context menu currently being displayed
  89. IShellFolder *psfRoot;
  90. LPITEMIDLIST pidlRoot;
  91. HTREEITEM htiCache; // tree item associated with Current shell folder
  92. IShellFolder *psfCache; // cache of the last IShellFolder I needed...
  93. HTREEITEM htiDragging; // item being dragged
  94. ULONG nChangeNotifyID; // SHChangeNotify registration ID
  95. } NSC;
  96. LPITEMIDLIST _CacheParentShellFolder(NSC *pns, HTREEITEM hti, LPITEMIDLIST pidl);
  97. // nscdrop.c
  98. void CTreeDropTarget_Register(NSC *pns);
  99. void CTreeDropTarget_Revoke(NSC *pns);