Leaked source code of windows server 2003
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.

144 lines
5.7 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. friend HRESULT CHistBand_CreateInstance(IUnknown *punkOuter, IUnknown **ppunk
  96. , LPCOBJECTINFO poi);
  97. LPITEMIDLIST _pidl;
  98. WCHAR _szTitle[40];
  99. INSCTree2 * _pns; // name space control data.
  100. IWinEventHandler * _pweh; // name space control's OnWinEvent handler
  101. BITBOOL _fInited :1; // true if band has been inited.
  102. BITBOOL _fVisible :1; // true if band is showing
  103. DWORD _dwStyle; // Treeview style
  104. LPCOBJECTINFO _poi; // cached object info.
  105. HACCEL _haccTree;
  106. HIMAGELIST _himlNormal; // shared image list
  107. HIMAGELIST _himlHot;
  108. };
  109. #endif /* _NSCBAND_H */