ReactOS  0.4.15-dev-499-g1f31905
explorerband.h
Go to the documentation of this file.
1 /*
2  * ReactOS Explorer
3  *
4  * Copyright 2016 Sylvain Deverre <deverre dot sylv at gmail dot com>
5  * Copyright 2020 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */
21 
22 #pragma once
23 
24 #define WM_USER_SHELLEVENT WM_USER+88
25 #define WM_USER_FOLDEREVENT WM_USER+88
26 
28  public CComCoClass<CExplorerBand, &CLSID_ExplorerBand>,
29  public CComObjectRootEx<CComMultiThreadModelNoCS>,
30  public IDeskBand,
31  public IObjectWithSite,
32  public IInputObject,
33  public IPersistStream,
34  public IOleCommandTarget,
35  public IServiceProvider,
36  public IBandNavigate,
37  public IWinEventHandler,
38  public INamespaceProxy,
39  public IDispatch,
40  public IDropSource,
41  public IDropTarget,
42  public CWindowImpl<CExplorerBand, CWindow, CControlWinTraits>
43 {
44 
45 private:
46  class NodeInfo
47  {
48  public:
52  };
53 
54  // *** BaseBarSite information ***
55  CComPtr<IUnknown> m_pSite;
56  CComPtr<IShellFolder> m_pDesktop;
57 
58  // *** tree explorer band stuff ***
67 
68  // *** notification cookies ***
71 
72  // *** Drop target information ***
73  CComPtr<IDropTarget> m_pDropTarget;
75  CComPtr<IDataObject> m_pCurObject;
76 
78  void DestroyExplorerBand();
79  HRESULT ExecuteCommand(CComPtr<IContextMenu>& menu, UINT nCmd);
80 
81  // *** notifications handling ***
83  void OnSelectionChanged(LPNMTREEVIEW pnmtv);
85  void OnTreeItemDragging(LPNMTREEVIEW pnmtv, BOOL isRightClick);
86 
87  // *** ATL event handlers ***
91  LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
93 
94  // *** Helper functions ***
97  HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort);
101  BOOL DeleteItem(LPITEMIDLIST toDelete);
102  BOOL RenameItem(HTREEITEM toRename, LPITEMIDLIST newPidl);
105 
106  // *** Tree item sorting callback ***
107  static int CALLBACK CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3);
108 
109 public:
110  CExplorerBand();
111  virtual ~CExplorerBand();
112 
113  // *** IOleWindow methods ***
114  virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
116 
117  // *** IDockingWindow methods ***
119  virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
120  virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
121 
122  // *** IDeskBand methods ***
123  virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
124 
125  // *** IObjectWithSite methods ***
126  virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
127  virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
128 
129  // *** IOleCommandTarget methods ***
130  virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
131  virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
132 
133  // *** IServiceProvider methods ***
134  virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
135 
136  // *** IInputObject methods ***
137  virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
140 
141  // *** IPersist methods ***
142  virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
143 
144  // *** IPersistStream methods ***
146  virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
147  virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
149 
150  // *** IWinEventHandler methods ***
153 
154  // *** IBandNavigate methods ***
155  virtual HRESULT STDMETHODCALLTYPE Select(long paramC);
156 
157  // *** INamespaceProxy ***
158  virtual HRESULT STDMETHODCALLTYPE GetNavigateTarget(long paramC, long param10, long param14);
159  virtual HRESULT STDMETHODCALLTYPE Invoke(long paramC);
160  virtual HRESULT STDMETHODCALLTYPE OnSelectionChanged(long paramC);
161  virtual HRESULT STDMETHODCALLTYPE RefreshFlags(long paramC, long param10, long param14);
162  virtual HRESULT STDMETHODCALLTYPE CacheItem(long paramC);
163 
164  // *** IDispatch methods ***
166  virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
167  virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
168  virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
169 
170  // *** IDropTarget methods ***
171  virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect);
172  virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD glfKeyState, POINTL pt, DWORD *pdwEffect);
174  virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect);
175 
176  // *** IDropSource methods ***
177  virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
178  virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect);
179 
182 
184 
187  COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
188  COM_INTERFACE_ENTRY_IID(IID_IBandNavigate, IBandNavigate)
189  COM_INTERFACE_ENTRY_IID(IID_INamespaceProxy, INamespaceProxy)
192  COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
194  COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
195  COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
196  COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
199  END_COM_MAP()
200 
206  // MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
207  END_MSG_MAP()
208 };
DBIM_BKCOLOR struct tagDESKBANDINFO DESKBANDINFO
LPITEMIDLIST relativePidl
Definition: explorerband.h:50
BOOL OnTreeItemDeleted(LPNMTREEVIEW pnmtv)
BOOL NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect)
virtual HRESULT STDMETHODCALLTYPE GetNavigateTarget(long paramC, long param10, long param14)
#define REFIID
Definition: guiddef.h:118
DWORD m_adviseCookie
Definition: explorerband.h:69
#define WM_CONTEXTMENU
Definition: richedit.h:64
Definition: scsiwmi.h:51
void OnSelectionChanged(LPNMTREEVIEW pnmtv)
HTREEITEM m_oldSelected
Definition: explorerband.h:65
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
#define pt(x, y)
Definition: drawing.c:79
LPITEMIDLIST m_pidlCurrent
Definition: explorerband.h:66
REFIID riid
Definition: precomp.h:44
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState)
const GUID IID_IPersist
Definition: proxy.cpp:14
virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm)
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg)
NodeInfo * GetNodeInfo(HTREEITEM hItem)
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite)
#define CALLBACK
Definition: compat.h:27
HWND hWnd
Definition: settings.c:17
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID)
#define LPNMTREEVIEW
Definition: commctrl.h:3639
DWORD m_dwBandID
Definition: explorerband.h:62
virtual HRESULT STDMETHODCALLTYPE Select(long paramC)
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:611
static int CALLBACK CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3)
DWORD LCID
Definition: nls.h:13
UINT_PTR WPARAM
Definition: windef.h:207
BOOL m_bNavigating
Definition: explorerband.h:60
static LPOLESTR
Definition: stg_prop.c:27
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty)
WPARAM wParam
Definition: combotst.c:138
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
HTREEITEM m_hRoot
Definition: explorerband.h:64
HRESULT ExecuteCommand(CComPtr< IContextMenu > &menu, UINT nCmd)
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd)
BOOL OnTreeItemExpanding(LPNMTREEVIEW pnmtv)
#define IDR_EXPLORERBAND
Definition: resource.h:101
virtual HRESULT STDMETHODCALLTYPE IsDirty()
#define WM_USER_SHELLEVENT
Definition: explorerband.h:24
BOOL RefreshTreePidl(HTREEITEM tree, LPITEMIDLIST pidlParent)
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL NavigateToCurrentFolder()
BOOL DeleteItem(LPITEMIDLIST toDelete)
HTREEITEM m_childTargetNode
Definition: explorerband.h:74
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
LPITEMIDLIST absolutePidl
Definition: explorerband.h:49
LONG_PTR LPARAM
Definition: windef.h:208
CComPtr< IDataObject > m_pCurObject
Definition: explorerband.h:75
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg)
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
CComPtr< IDropTarget > m_pDropTarget
Definition: explorerband.h:73
HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto)
LONG HRESULT
Definition: typedefs.h:78
#define END_MSG_MAP()
Definition: atlwin.h:1799
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
const IID IID_IObjectWithSite
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
virtual HRESULT STDMETHODCALLTYPE DragLeave()
LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
#define COM_INTERFACE_ENTRY2_IID(iid, x, x2)
Definition: atlcom.h:569
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
const GUID IID_IPersistStream
Definition: proxy.cpp:13
void InitializeExplorerBand()
virtual HRESULT STDMETHODCALLTYPE HasFocusIO()
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd)
HIMAGELIST m_hImageList
Definition: explorerband.h:63
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
const GUID IID_IDispatch
virtual HRESULT STDMETHODCALLTYPE CacheItem(long paramC)
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite)
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize)
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:605
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
void OnTreeItemDragging(LPNMTREEVIEW pnmtv, BOOL isRightClick)
virtual HRESULT STDMETHODCALLTYPE Invoke(long paramC)
virtual HRESULT STDMETHODCALLTYPE RefreshFlags(long paramC, long param10, long param14)
static BOOL bInsert
Definition: cmdinput.c:121
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:534
struct stdole::EXCEPINFO EXCEPINFO
virtual ~CExplorerBand()
static VARIANTARG static DISPID
Definition: ordinal.c:49
LRESULT OnShellEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
static ATOM item
Definition: dde.c:856
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo)
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:561
ULONG m_shellRegID
Definition: explorerband.h:70
BOOL RenameItem(HTREEITEM toRename, LPITEMIDLIST newPidl)
virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved)
virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect)
unsigned int UINT
Definition: ndis.h:50
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode)
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1780
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1808
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
struct stdole::DISPPARAMS DISPPARAMS
const GUID IID_IOleWindow
unsigned int ULONG
Definition: retypes.h:1
static char * dest
Definition: rtl.c:135
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
#define END_COM_MAP()
Definition: atlcom.h:552
#define WM_SETFOCUS
Definition: winuser.h:1595
LONG_PTR LRESULT
Definition: windef.h:209
LRESULT ContextMenuHack(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139
void DestroyExplorerBand()
virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow)