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.

153 lines
6.0 KiB

  1. /**************************************************************\
  2. FILE: NSCBand.h
  3. DESCRIPTION: the class CNscBand exists to support name
  4. space control bands. A name space control uses IShellFolder
  5. rooted in various namespaces including Favorites, history,
  6. Shell Name Space, etc. to depict a hierarchical UI
  7. representation of the given name space.
  8. AUTHOR: chrisny
  9. \**************************************************************/
  10. #include "bands.h"
  11. #include "nsc.h"
  12. #include "uemapp.h"
  13. #ifndef _NSCBAND_H
  14. #define _NSCBAND_H
  15. // for degug trace messages.
  16. #define DM_PERSIST 0 // trace IPS::Load, ::Save, etc.
  17. #define DM_MENU 0 // menu code
  18. #define DM_FOCUS 0 // focus
  19. #define DM_FOCUS2 0 // like DM_FOCUS, but verbose
  20. const short CSIDL_NIL = -32767;
  21. ////////////////
  22. /// NSC band
  23. class CNSCBand : public CToolBand
  24. , public IContextMenu
  25. , public IBandNavigate
  26. , public IWinEventHandler
  27. , public INamespaceProxy
  28. {
  29. public:
  30. // *** IUnknown ***
  31. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  32. STDMETHODIMP_(ULONG) AddRef(void) { return CToolBand::AddRef(); };
  33. STDMETHODIMP_(ULONG) Release(void) { return CToolBand::Release(); };
  34. // *** IOleWindow methods ***
  35. virtual STDMETHODIMP GetWindow(HWND * lphwnd);
  36. // *** IDockingWindow methods ***
  37. virtual STDMETHODIMP ShowDW(BOOL fShow);
  38. virtual STDMETHODIMP CloseDW(DWORD dw);
  39. // *** IDeskBand methods ***
  40. virtual STDMETHODIMP GetBandInfo(DWORD dwBandID, DWORD fViewMode,
  41. DESKBANDINFO* pdbi);
  42. // *** IPersistStream methods ***
  43. // (others use base class implementation)
  44. virtual STDMETHODIMP GetClassID(CLSID *pClassID);
  45. virtual STDMETHODIMP Load(IStream *pStm);
  46. virtual STDMETHODIMP Save(IStream *pStm, BOOL fClearDirty);
  47. // *** IWinEventHandler methods ***
  48. virtual STDMETHODIMP OnWinEvent(HWND hwnd, UINT dwMsg
  49. , WPARAM wParam, LPARAM lParam
  50. , LRESULT *plres);
  51. virtual STDMETHODIMP IsWindowOwner(HWND hwnd);
  52. // *** IContextMenu methods ***
  53. STDMETHOD(QueryContextMenu)(HMENU hmenu,
  54. UINT indexMenu,
  55. UINT idCmdFirst,
  56. UINT idCmdLast,
  57. UINT uFlags);
  58. STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici);
  59. STDMETHOD(GetCommandString)(UINT_PTR idCmd,
  60. UINT uType,
  61. UINT * pwReserved,
  62. LPSTR pszName,
  63. UINT cchMax) { return E_NOTIMPL; };
  64. // *** IOleCommandTarget methods ***
  65. virtual STDMETHODIMP Exec(const GUID *pguidCmdGroup,
  66. DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
  67. virtual STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD rgCmds[], OLECMDTEXT *pcmdtext);
  68. // *** IBandNavigate methods ***
  69. virtual STDMETHODIMP Select(LPCITEMIDLIST pidl);
  70. // *** IInputObject methods ***
  71. virtual STDMETHODIMP TranslateAcceleratorIO(LPMSG lpMsg);
  72. // *** INamespaceProxy ***
  73. virtual STDMETHODIMP GetNavigateTarget(LPCITEMIDLIST pidl, LPITEMIDLIST *ppidlTarget, ULONG *pulAttrib);
  74. virtual STDMETHODIMP Invoke(LPCITEMIDLIST pidl);
  75. virtual STDMETHODIMP OnSelectionChanged(LPCITEMIDLIST pidl);
  76. virtual STDMETHODIMP RefreshFlags(DWORD *pdwStyle, DWORD *pdwExStyle, DWORD *pdwEnum)
  77. {*pdwStyle = _GetTVStyle(); *pdwExStyle = _GetTVExStyle(); *pdwEnum = _GetEnumFlags(); return S_OK; };
  78. virtual STDMETHODIMP CacheItem(LPCITEMIDLIST pidl) { return S_OK; };
  79. protected:
  80. void _SetNscMode(UINT nMode) { _pns->SetNscMode(nMode); };
  81. virtual DWORD _GetTVStyle();
  82. virtual DWORD _GetTVExStyle() { return 0; };
  83. virtual DWORD _GetEnumFlags() { return SHCONTF_FOLDERS | SHCONTF_NONFOLDERS; };
  84. HRESULT _Init(LPCITEMIDLIST pidl);
  85. virtual HRESULT _InitializeNsc();
  86. virtual ~CNSCBand();
  87. virtual HRESULT _OnRegisterBand(IOleCommandTarget *poctProxy) { return S_OK; } // meant to be overridden
  88. void _UnregisterBand();
  89. void _EnsureImageListsLoaded();
  90. virtual HRESULT _TranslatePidl(LPCITEMIDLIST pidl, LPITEMIDLIST *ppidlTarget, ULONG *pulAttrib);
  91. virtual BOOL _ShouldNavigateToPidl(LPCITEMIDLIST pidl, ULONG ulAttrib);
  92. virtual HRESULT _NavigateRightPane(IShellBrowser *psb, LPCITEMIDLIST pidl);
  93. HRESULT _QueryContextMenuSelection(IContextMenu ** ppcm);
  94. HRESULT _InvokeCommandOnItem(LPCTSTR pszVerb);
  95. #ifndef ENABLE_CCHANNELBAND
  96. friend HRESULT CNSCBand_CreateInstanceEx(IUnknown *punkOuter, IUnknown **ppunk
  97. , LPCOBJECTINFO poi, LPCITEMIDLIST pidl);
  98. #endif
  99. friend HRESULT CHistBand_CreateInstance(IUnknown *punkOuter, IUnknown **ppunk
  100. , LPCOBJECTINFO poi);
  101. #ifndef ENABLE_CCHANNELBAND
  102. friend HRESULT CChannelBand_CreateInstance(IUnknown *punkOuter, IUnknown **ppunk
  103. , LPCOBJECTINFO poi);
  104. #endif // ENABLE_CCHANNELBAND
  105. LPITEMIDLIST _pidl;
  106. WCHAR _szTitle[40];
  107. INSCTree2 * _pns; // name space control data.
  108. IWinEventHandler * _pweh; // name space control's OnWinEvent handler
  109. BITBOOL _fInited :1; // true if band has been inited.
  110. BITBOOL _fVisible :1; // true if band is showing
  111. DWORD _dwStyle; // Treeview style
  112. LPCOBJECTINFO _poi; // cached object info.
  113. HACCEL _haccTree;
  114. HIMAGELIST _himlNormal; // shared image list
  115. HIMAGELIST _himlHot;
  116. };
  117. #endif /* _NSCBAND_H */