ReactOS  0.4.14-dev-1034-g1e60116
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  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 
21 #pragma once
22 
23 #define WM_USER_SHELLEVENT WM_USER+88
24 #define WM_USER_FOLDEREVENT WM_USER+88
25 
27  public CComCoClass<CExplorerBand, &CLSID_ExplorerBand>,
28  public CComObjectRootEx<CComMultiThreadModelNoCS>,
29  public IDeskBand,
30  public IObjectWithSite,
31  public IInputObject,
32  public IPersistStream,
33  public IOleCommandTarget,
34  public IServiceProvider,
35  public IBandNavigate,
36  public IWinEventHandler,
37  public INamespaceProxy,
38  public IDispatch,
39  public IDropSource,
40  public IDropTarget,
41  public CWindowImpl<CExplorerBand, CWindow, CControlWinTraits>
42 {
43 
44 private:
45  class NodeInfo
46  {
47  public:
51  };
52 
53  // *** BaseBarSite information ***
54  CComPtr<IUnknown> pSite;
55  CComPtr<IShellFolder> pDesktop;
56 
57  // *** tree explorer band stuff ***
66 
67  // *** notification cookies ***
70 
71  // *** Drop target information ***
72  CComPtr<IDropTarget> pDropTarget;
74  CComPtr<IDataObject> pCurObject;
75 
77  void DestroyExplorerBand();
78  HRESULT ExecuteCommand(CComPtr<IContextMenu>& menu, UINT nCmd);
79 
80  // *** notifications handling ***
82  void OnSelectionChanged(LPNMTREEVIEW pnmtv);
84  void OnTreeItemDragging(LPNMTREEVIEW pnmtv, BOOL isRightClick);
85 
86  // *** ATL event handlers ***
90  LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
92 
93  // *** Helper functions ***
96  HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort);
100  BOOL DeleteItem(LPITEMIDLIST toDelete);
101  BOOL RenameItem(HTREEITEM toRename, LPITEMIDLIST newPidl);
104 
105  // *** Tree item sorting callback ***
106  static int CALLBACK CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3);
107 
108 public:
109  CExplorerBand();
110  virtual ~CExplorerBand();
111 
112  // *** IOleWindow methods ***
113  virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
115 
116  // *** IDockingWindow methods ***
118  virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
119  virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
120 
121  // *** IDeskBand methods ***
123 
124  // *** IObjectWithSite methods ***
125  virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
126  virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
127 
128  // *** IOleCommandTarget methods ***
129  virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
130  virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
131 
132  // *** IServiceProvider methods ***
133  virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
134 
135  // *** IInputObject methods ***
136  virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
139 
140  // *** IPersist methods ***
141  virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
142 
143  // *** IPersistStream methods ***
145  virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
146  virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
148 
149  // *** IWinEventHandler methods ***
152 
153  // *** IBandNavigate methods ***
154  virtual HRESULT STDMETHODCALLTYPE Select(long paramC);
155 
156  // *** INamespaceProxy ***
157  virtual HRESULT STDMETHODCALLTYPE GetNavigateTarget(long paramC, long param10, long param14);
158  virtual HRESULT STDMETHODCALLTYPE Invoke(long paramC);
159  virtual HRESULT STDMETHODCALLTYPE OnSelectionChanged(long paramC);
160  virtual HRESULT STDMETHODCALLTYPE RefreshFlags(long paramC, long param10, long param14);
161  virtual HRESULT STDMETHODCALLTYPE CacheItem(long paramC);
162 
163  // *** IDispatch methods ***
165  virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
166  virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
167  virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
168 
169  // *** IDropTarget methods ***
170  virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect);
171  virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD glfKeyState, POINTL pt, DWORD *pdwEffect);
173  virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect);
174 
175  // *** IDropSource methods ***
176  virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState);
177  virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect);
178 
181 
183 
186  COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
187  COM_INTERFACE_ENTRY_IID(IID_IBandNavigate, IBandNavigate)
188  COM_INTERFACE_ENTRY_IID(IID_INamespaceProxy, INamespaceProxy)
191  COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
193  COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
194  COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
195  COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
198  END_COM_MAP()
199 
205  // MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
206  END_MSG_MAP()
207 };
DBIM_BKCOLOR struct tagDESKBANDINFO DESKBANDINFO
LPITEMIDLIST relativePidl
Definition: explorerband.h:49
CComPtr< IDataObject > pCurObject
Definition: explorerband.h:74
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
#define WM_CONTEXTMENU
Definition: richedit.h:64
Definition: scsiwmi.h:51
void OnSelectionChanged(LPNMTREEVIEW pnmtv)
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
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
HTREEITEM oldSelected
Definition: explorerband.h:64
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID)
#define LPNMTREEVIEW
Definition: commctrl.h:3639
virtual HRESULT STDMETHODCALLTYPE Select(long paramC)
#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
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)
ULONG shellRegID
Definition: explorerband.h:69
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:23
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)
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
HIMAGELIST hImageList
Definition: explorerband.h:62
LPITEMIDLIST absolutePidl
Definition: explorerband.h:48
LONG_PTR LPARAM
Definition: windef.h:208
HTREEITEM childTargetNode
Definition: explorerband.h:73
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg)
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:541
HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto)
CComPtr< IDropTarget > pDropTarget
Definition: explorerband.h:72
LONG HRESULT
Definition: typedefs.h:78
#define END_MSG_MAP()
Definition: atlwin.h:1789
#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
HTREEITEM hRoot
Definition: explorerband.h:63
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)
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)
DWORD adviseCookie
Definition: explorerband.h:68
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)
CComPtr< IShellFolder > pDesktop
Definition: explorerband.h:55
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
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)
CComPtr< IUnknown > pSite
Definition: explorerband.h:54
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1770
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:639
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1798
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
LPITEMIDLIST pidlCurrent
Definition: explorerband.h:65
void DestroyExplorerBand()
virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow)