ReactOS 0.4.15-dev-8102-g108db8f
CExplorerBand Class Reference

#include <explorerband.h>

Inheritance diagram for CExplorerBand:
Collaboration diagram for CExplorerBand:

Classes

class  NodeInfo
 

Public Member Functions

 CExplorerBand ()
 
virtual ~CExplorerBand ()
 
STDMETHOD() GetWindow (HWND *lphwnd) override
 
STDMETHOD() ContextSensitiveHelp (BOOL fEnterMode) override
 
STDMETHOD() CloseDW (DWORD dwReserved) override
 
STDMETHOD() ResizeBorderDW (const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) override
 
STDMETHOD() ShowDW (BOOL fShow) override
 
STDMETHOD() GetBandInfo (DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi) override
 
STDMETHOD() SetSite (IUnknown *pUnkSite) override
 
STDMETHOD() GetSite (REFIID riid, void **ppvSite) override
 
STDMETHOD() QueryStatus (const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) override
 
STDMETHOD() Exec (const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override
 
STDMETHOD() QueryService (REFGUID guidService, REFIID riid, void **ppvObject) override
 
STDMETHOD() UIActivateIO (BOOL fActivate, LPMSG lpMsg) override
 
STDMETHOD() HasFocusIO () override
 
STDMETHOD() TranslateAcceleratorIO (LPMSG lpMsg) override
 
STDMETHOD() GetClassID (CLSID *pClassID) override
 
STDMETHOD() IsDirty () override
 
STDMETHOD() Load (IStream *pStm) override
 
STDMETHOD() Save (IStream *pStm, BOOL fClearDirty) override
 
STDMETHOD() GetSizeMax (ULARGE_INTEGER *pcbSize) override
 
STDMETHOD() OnWinEvent (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult) override
 
STDMETHOD() IsWindowOwner (HWND hWnd) override
 
STDMETHOD() Select (long paramC) override
 
STDMETHOD() GetNavigateTarget (long paramC, long param10, long param14) override
 
STDMETHOD() Invoke (long paramC) override
 
STDMETHOD() OnSelectionChanged (long paramC) override
 
STDMETHOD() RefreshFlags (long paramC, long param10, long param14) override
 
STDMETHOD() CacheItem (long paramC) override
 
STDMETHOD() GetTypeInfoCount (UINT *pctinfo) override
 
STDMETHOD() GetTypeInfo (UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) override
 
STDMETHOD() GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) override
 
STDMETHOD() Invoke (DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) override
 
STDMETHOD() DragEnter (IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect) override
 
STDMETHOD() DragOver (DWORD glfKeyState, POINTL pt, DWORD *pdwEffect) override
 
STDMETHOD() DragLeave () override
 
STDMETHOD() Drop (IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect) override
 
STDMETHOD() QueryContinueDrag (BOOL fEscapePressed, DWORD grfKeyState) override
 
STDMETHOD() GiveFeedback (DWORD dwEffect) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
HRESULT GetBandInfo ([in] DWORD dwBandID, [in] DWORD dwViewMode, [in, out] DESKBANDINFO *pdbi)
 
- Public Member Functions inherited from IDockingWindow
HRESULT ShowDW ([in] BOOL fShow)
 
HRESULT CloseDW ([in] DWORD dwReserved)
 
HRESULT ResizeBorderDW ([in] LPCRECT prcBorder, [in] IUnknown *punkToolbarSite, [in] BOOL fReserved)
 
HRESULT GetWindow ([out] HWND *phwnd)
 
HRESULT ContextSensitiveHelp ([in] BOOL fEnterMode)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from IObjectWithSite
HRESULT SetSite ([in] IUnknown *pUnkSite)
 
HRESULT GetSite ([in] REFIID riid, [out, iid_is(riid)] PVOID *ppvSite)
 
HRESULT IsDirty ()
 
HRESULT Load ([in, unique] IStream *pStm)
 
HRESULT Save ([in, unique] IStream *pStm, [in] BOOL fClearDirty)
 
HRESULT GetSizeMax ([out] ULARGE_INTEGER *pcbSize)
 
HRESULT GetClassID ([out] CLSID *pClassID)
 
HRESULT QueryStatus ([in, unique] const GUID *pguidCmdGroup, [in] ULONG cCmds, [in, out, size_is(cCmds)] OLECMD prgCmds[], [in, out, unique] OLECMDTEXT *pCmdText)
 
HRESULT Exec ([in, unique] const GUID *pguidCmdGroup, [in] DWORD nCmdID, [in] DWORD nCmdexecopt, [in, unique] VARIANT *pvaIn, [in, out, unique] VARIANT *pvaOut)
 
- Public Member Functions inherited from IServiceProvider
HRESULT QueryService ([in] REFGUID guidService, [in] REFIID riid, [out] void **ppvObject)
 
HRESULT RemoteQueryService ([in] REFGUID guidService, [in] REFIID riid, [out, iid_is(riid)] IUnknown **ppvObject)
 
- Public Member Functions inherited from IDispatch
HRESULT GetTypeInfoCount ([out] UINT *pctinfo)
 
HRESULT GetTypeInfo ([in] UINT iTInfo, [in] LCID lcid, [out] ITypeInfo **ppTInfo)
 
HRESULT GetIDsOfNames ([in] REFIID riid, [in, size_is(cNames)] LPOLESTR *rgszNames, [in] UINT cNames, [in] LCID lcid, [out, size_is(cNames)] DISPID *rgDispId)
 
HRESULT Invoke ([in] DISPID dispIdMember, [in] REFIID riid, [in] LCID lcid, [in] WORD wFlags, [in, out] DISPPARAMS *pDispParams, [out] VARIANT *pVarResult, [out] EXCEPINFO *pExcepInfo, [out] UINT *puArgErr)
 
HRESULT RemoteInvoke ([in] DISPID dispIdMember, [in] REFIID riid, [in] LCID lcid, [in] DWORD dwFlags, [in] DISPPARAMS *pDispParams, [out] VARIANT *pVarResult, [out] EXCEPINFO *pExcepInfo, [out] UINT *pArgErr, [in] UINT cVarRef, [in, size_is(cVarRef)] UINT *rgVarRefIdx, [in, out, size_is(cVarRef)] VARIANTARG *rgVarRef)
 
HRESULT QueryContinueDrag ([in] BOOL fEscapePressed, [in] DWORD grfKeyState)
 
HRESULT GiveFeedback ([in] DWORD dwEffect)
 
HRESULT DragEnter ([in, unique] IDataObject *pDataObj, [in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
HRESULT DragOver ([in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
HRESULT DragLeave ()
 
HRESULT Drop ([in, unique] IDataObject *pDataObj, [in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 

Private Member Functions

void InitializeExplorerBand ()
 
void DestroyExplorerBand ()
 
HRESULT ExecuteCommand (CComPtr< IContextMenu > &menu, UINT nCmd)
 
BOOL OnTreeItemExpanding (LPNMTREEVIEW pnmtv)
 
void OnSelectionChanged (LPNMTREEVIEW pnmtv)
 
BOOL OnTreeItemDeleted (LPNMTREEVIEW pnmtv)
 
void OnTreeItemDragging (LPNMTREEVIEW pnmtv, BOOL isRightClick)
 
LRESULT OnContextMenu (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT ContextMenuHack (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnShellEvent (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSetFocus (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnKillFocus (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
NodeInfoGetNodeInfo (HTREEITEM hItem)
 
HRESULT UpdateBrowser (LPITEMIDLIST pidlGoto)
 
HTREEITEM InsertItem (HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
 
HTREEITEM InsertItem (HTREEITEM hParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
 
BOOL InsertSubitems (HTREEITEM hItem, NodeInfo *pNodeInfo)
 
BOOL NavigateToPIDL (LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect)
 
BOOL DeleteItem (LPITEMIDLIST toDelete)
 
BOOL RenameItem (HTREEITEM toRename, LPITEMIDLIST newPidl)
 
BOOL RefreshTreePidl (HTREEITEM tree, LPITEMIDLIST pidlParent)
 
BOOL NavigateToCurrentFolder ()
 

Static Private Member Functions

static int CALLBACK CompareTreeItems (LPARAM p1, LPARAM p2, LPARAM p3)
 

Private Attributes

CComPtr< IUnknownm_pSite
 
CComPtr< IShellFolderm_pDesktop
 
BOOL m_fVisible
 
BOOL m_bNavigating
 
BOOL m_bFocused
 
DWORD m_dwBandID
 
BOOL m_isEditing
 
HIMAGELIST m_hImageList
 
HTREEITEM m_hRoot
 
HTREEITEM m_oldSelected
 
LPITEMIDLIST m_pidlCurrent
 
DWORD m_adviseCookie
 
ULONG m_shellRegID
 
CComPtr< IDropTargetm_pDropTarget
 
HTREEITEM m_childTargetNode
 
CComPtr< IDataObjectm_pCurObject
 

Additional Inherited Members

- Public Types inherited from IOleWindow
typedef IOleWindowLPOLEWINDOW
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IObjectWithSite
typedef IObjectWithSiteLPOBJECTWITHSITE
 
- Public Types inherited from IPersistStream
typedef IPersistStreamLPPERSISTSTREAM
 
- Public Types inherited from IPersist
typedef IPersistLPPERSIST
 
- Public Types inherited from IOleCommandTarget
enum  OLECMDF {
  OLECMDF_SUPPORTED = 0x1 , OLECMDF_ENABLED = 0x2 , OLECMDF_LATCHED = 0x4 , OLECMDF_NINCHED = 0x8 ,
  OLECMDF_INVISIBLE = 0x10 , OLECMDF_DEFHIDEONCTXTMENU = 0x20
}
 
enum  OLECMDTEXTF { OLECMDTEXTF_NONE = 0 , OLECMDTEXTF_NAME = 1 , OLECMDTEXTF_STATUS = 2 }
 
enum  OLECMDEXECOPT { OLECMDEXECOPT_DODEFAULT = 0 , OLECMDEXECOPT_PROMPTUSER = 1 , OLECMDEXECOPT_DONTPROMPTUSER = 2 , OLECMDEXECOPT_SHOWHELP = 3 }
 
enum  OLECMDID {
  OLECMDID_OPEN = 1 , OLECMDID_NEW = 2 , OLECMDID_SAVE = 3 , OLECMDID_SAVEAS = 4 ,
  OLECMDID_SAVECOPYAS = 5 , OLECMDID_PRINT = 6 , OLECMDID_PRINTPREVIEW = 7 , OLECMDID_PAGESETUP = 8 ,
  OLECMDID_SPELL = 9 , OLECMDID_PROPERTIES = 10 , OLECMDID_CUT = 11 , OLECMDID_COPY = 12 ,
  OLECMDID_PASTE = 13 , OLECMDID_PASTESPECIAL = 14 , OLECMDID_UNDO = 15 , OLECMDID_REDO = 16 ,
  OLECMDID_SELECTALL = 17 , OLECMDID_CLEARSELECTION = 18 , OLECMDID_ZOOM = 19 , OLECMDID_GETZOOMRANGE = 20 ,
  OLECMDID_UPDATECOMMANDS = 21 , OLECMDID_REFRESH = 22 , OLECMDID_STOP = 23 , OLECMDID_HIDETOOLBARS = 24 ,
  OLECMDID_SETPROGRESSMAX = 25 , OLECMDID_SETPROGRESSPOS = 26 , OLECMDID_SETPROGRESSTEXT = 27 , OLECMDID_SETTITLE = 28 ,
  OLECMDID_SETDOWNLOADSTATE = 29 , OLECMDID_STOPDOWNLOAD = 30 , OLECMDID_ONTOOLBARACTIVATED = 31 , OLECMDID_FIND = 32 ,
  OLECMDID_DELETE = 33 , OLECMDID_HTTPEQUIV = 34 , OLECMDID_HTTPEQUIV_DONE = 35 , OLECMDID_ENABLE_INTERACTION = 36 ,
  OLECMDID_ONUNLOAD = 37 , OLECMDID_PROPERTYBAG2 = 38 , OLECMDID_PREREFRESH = 39 , OLECMDID_SHOWSCRIPTERROR = 40 ,
  OLECMDID_SHOWMESSAGE = 41 , OLECMDID_SHOWFIND = 42 , OLECMDID_SHOWPAGESETUP = 43 , OLECMDID_SHOWPRINT = 44 ,
  OLECMDID_CLOSE = 45 , OLECMDID_ALLOWUILESSSAVEAS = 46 , OLECMDID_DONTDOWNLOADCSS = 47 , OLECMDID_UPDATEPAGESTATUS = 48 ,
  OLECMDID_PRINT2 = 49 , OLECMDID_PRINTPREVIEW2 = 50 , OLECMDID_SETPRINTTEMPLATE = 51 , OLECMDID_GETPRINTTEMPLATE = 52 ,
  OLECMDID_PAGEACTIONBLOCKED = 55 , OLECMDID_PAGEACTIONUIQUERY = 56 , OLECMDID_FOCUSVIEWCONTROLS = 57 , OLECMDID_FOCUSVIEWCONTROLSQUERY = 58 ,
  OLECMDID_SHOWPAGEACTIONMENU = 59 , OLECMDID_ADDTRAVELENTRY = 60 , OLECMDID_UPDATETRAVELENTRY = 61 , OLECMDID_UPDATEBACKFORWARDSTATE = 62 ,
  OLECMDID_OPTICAL_ZOOM = 63 , OLECMDID_OPTICAL_GETZOOMRANGE = 64 , OLECMDID_WINDOWSTATECHANGED = 65 , OLECMDID_ACTIVEXINSTALLSCOPE = 66 ,
  OLECMDID_UPDATETRAVELENTRY_DATARECOVERY = 67 , OLECMDID_SHOWTASKDLG = 68 , OLECMDID_POPSTATEEVENT = 69 , OLECMDID_VIEWPORT_MODE = 70 ,
  OLECMDID_LAYOUT_VIEWPORT_WIDTH = 71 , OLECMDID_VISUAL_VIEWPORT_EXCLUDE_BOTTOM = 72 , OLECMDID_USER_OPTICAL_ZOOM = 73 , OLECMDID_PAGEAVAILABLE = 74 ,
  OLECMDID_GETUSERSCALABLE = 75 , OLECMDID_UPDATE_CARET = 76 , OLECMDID_ENABLE_VISIBILITY = 77 , OLECMDID_MEDIA_PLAYBACK = 78
}
 
typedef IOleCommandTargetLPOLECOMMANDTARGET
 
typedef enum IOleCommandTarget::OLECMDF OLECMDF
 
typedef struct IOleCommandTarget::_tagOLECMD OLECMD
 
typedef struct IOleCommandTarget::_tagOLECMDTEXT OLECMDTEXT
 
typedef enum IOleCommandTarget::OLECMDTEXTF OLECMDTEXTF
 
typedef enum IOleCommandTarget::OLECMDEXECOPT OLECMDEXECOPT
 
typedef enum IOleCommandTarget::OLECMDID OLECMDID
 
- Public Types inherited from IServiceProvider
typedef IServiceProviderLPSERVICEPROVIDER
 
- Public Types inherited from IDispatch
typedef IDispatchLPDISPATCH
 
- Public Types inherited from IDropSource
typedef IDropSourceLPDROPSOURCE
 
- Public Types inherited from IDropTarget
typedef IDropTargetLPDROPTARGET
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from IDispatch
const DISPID DISPID_UNKNOWN = -1
 
const DISPID DISPID_VALUE = 0
 
const DISPID DISPID_PROPERTYPUT = -3
 
const DISPID DISPID_NEWENUM = -4
 
const DISPID DISPID_EVALUATE = -5
 
const DISPID DISPID_CONSTRUCTOR = -6
 
const DISPID DISPID_DESTRUCTOR = -7
 
const DISPID DISPID_COLLECT = -8
 
- Public Attributes inherited from IDropTarget
const DWORD MK_ALT = 0x20
 
const DWORD DROPEFFECT_NONE = 0
 
const DWORD DROPEFFECT_COPY = 1
 
const DWORD DROPEFFECT_MOVE = 2
 
const DWORD DROPEFFECT_LINK = 4
 
const DWORD DROPEFFECT_SCROLL = 0x80000000
 
const DWORD DD_DEFSCROLLINSET = 11
 
const DWORD DD_DEFSCROLLDELAY = 50
 
const DWORD DD_DEFSCROLLINTERVAL = 50
 
const DWORD DD_DEFDRAGDELAY = 200
 
const DWORD DD_DEFDRAGMINDIST = 2
 

Detailed Description

Definition at line 27 of file explorerband.h.

Constructor & Destructor Documentation

◆ CExplorerBand()

CExplorerBand::CExplorerBand ( )

Definition at line 147 of file explorerband.cpp.

148 : m_pSite(NULL)
151 , m_dwBandID(0)
154{
155}
BOOL m_bNavigating
Definition: explorerband.h:60
DWORD m_dwBandID
Definition: explorerband.h:62
LPITEMIDLIST m_pidlCurrent
Definition: explorerband.h:67
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117

◆ ~CExplorerBand()

CExplorerBand::~CExplorerBand ( )
virtual

Definition at line 157 of file explorerband.cpp.

158{
159 if (m_pidlCurrent)
160 {
162 }
163}
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:938

Member Function Documentation

◆ CacheItem()

HRESULT STDMETHODCALLTYPE CExplorerBand::CacheItem ( long  paramC)
override

Definition at line 1426 of file explorerband.cpp.

1427{
1429 return E_NOTIMPL;
1430}
#define UNIMPLEMENTED
Definition: debug.h:118
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CloseDW()

HRESULT STDMETHODCALLTYPE CExplorerBand::CloseDW ( DWORD  dwReserved)
override

Implements IDockingWindow.

Definition at line 1049 of file explorerband.cpp.

1050{
1051 // We do nothing, we don't have anything to save yet
1052 TRACE("CloseDW called\n");
1053 return S_OK;
1054}
#define S_OK
Definition: intsafe.h:52
#define TRACE(s)
Definition: solgame.cpp:4

◆ CompareTreeItems()

int CALLBACK CExplorerBand::CompareTreeItems ( LPARAM  p1,
LPARAM  p2,
LPARAM  p3 
)
staticprivate

Definition at line 979 of file explorerband.cpp.

980{
981 /*
982 * We first sort drive letters (Path root), then PIDLs and then regular folder
983 * display name.
984 * This is not how Windows sorts item, but it gives decent results.
985 */
986 NodeInfo *info1;
987 NodeInfo *info2;
988 CExplorerBand *pThis;
989 WCHAR wszFolder1[MAX_PATH];
990 WCHAR wszFolder2[MAX_PATH];
991
992 info1 = (NodeInfo*)p1;
993 info2 = (NodeInfo*)p2;
994 pThis = (CExplorerBand*)p3;
995
996 GetDisplayName(info1->absolutePidl, wszFolder1, MAX_PATH, SHGDN_FORPARSING);
997 GetDisplayName(info2->absolutePidl, wszFolder2, MAX_PATH, SHGDN_FORPARSING);
998 if (PathIsRoot(wszFolder1) && PathIsRoot(wszFolder2))
999 {
1000 return lstrcmpiW(wszFolder1,wszFolder2);
1001 }
1002 if (PathIsRoot(wszFolder1) && !PathIsRoot(wszFolder2))
1003 {
1004 return -1;
1005 }
1006 if (!PathIsRoot(wszFolder1) && PathIsRoot(wszFolder2))
1007 {
1008 return 1;
1009 }
1010 // Now, we compare non-root folders, grab display name
1011 GetDisplayName(info1->absolutePidl, wszFolder1, MAX_PATH, SHGDN_INFOLDER);
1012 GetDisplayName(info2->absolutePidl, wszFolder2, MAX_PATH, SHGDN_INFOLDER);
1013
1014 if (_ILIsSpecialFolder(info1->relativePidl) && !_ILIsSpecialFolder(info2->relativePidl))
1015 {
1016 return -1;
1017 }
1018 if (!_ILIsSpecialFolder(info1->relativePidl) && _ILIsSpecialFolder(info2->relativePidl))
1019 {
1020 return 1;
1021 }
1022 if (_ILIsSpecialFolder(info1->relativePidl) && !_ILIsSpecialFolder(info2->relativePidl))
1023 {
1024 HRESULT hr;
1025 hr = pThis->m_pDesktop->CompareIDs(0, info1->absolutePidl, info2->absolutePidl);
1026 if (!hr) return 0;
1027 return (hr > 0) ? -1 : 1;
1028 }
1029 return StrCmpLogicalW(wszFolder1, wszFolder2);
1030}
BOOL GetDisplayName(LPCTSTR ServiceName)
Definition: name.c:12
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
#define MAX_PATH
Definition: compat.h:34
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261
INT WINAPI StrCmpLogicalW(LPCWSTR lpszStr, LPCWSTR lpszComp)
Definition: string.c:2304
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
HRESULT hr
Definition: shlfolder.c:183
#define PathIsRoot
Definition: shlwapi.h:955
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by InsertItem(), InsertSubitems(), and RenameItem().

◆ ContextMenuHack()

LRESULT CExplorerBand::ContextMenuHack ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 485 of file explorerband.cpp.

486{
487 bHandled = FALSE;
488 if (uMsg == WM_RBUTTONDOWN)
489 {
491 info.pt.x = LOWORD(lParam);
492 info.pt.y = HIWORD(lParam);
493 info.flags = TVHT_ONITEM;
494 info.hItem = NULL;
495
496 // Save the current location
498
499 // Move to the item selected by the treeview (don't change right pane)
500 TreeView_HitTest(m_hWnd, &info);
502 TreeView_SelectItem(m_hWnd, info.hItem);
504 }
505 return FALSE; /* let the wndproc process the message */
506}
HTREEITEM m_oldSelected
Definition: explorerband.h:66
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define LOWORD(l)
Definition: pedump.c:82
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
#define TVHT_ONITEM
Definition: commctrl.h:3527
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3513
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_RBUTTONDOWN
Definition: winuser.h:1779

◆ ContextSensitiveHelp()

HRESULT STDMETHODCALLTYPE CExplorerBand::ContextSensitiveHelp ( BOOL  fEnterMode)
override

Implements IOleWindow.

Definition at line 1041 of file explorerband.cpp.

1042{
1044 return E_NOTIMPL;
1045}

◆ DeleteItem()

BOOL CExplorerBand::DeleteItem ( LPITEMIDLIST  toDelete)
private

Definition at line 854 of file explorerband.cpp.

855{
856 HTREEITEM toDelete;
857 TVITEM tvItem;
858 HTREEITEM parentNode;
859
860 if (!NavigateToPIDL(idl, &toDelete, FALSE, FALSE, FALSE))
861 return FALSE;
862
863 // TODO: check that the treeview item is really deleted
864
865 parentNode = TreeView_GetParent(m_hWnd, toDelete);
866 // Navigate to parent when deleting child item
867 if (!m_pDesktop->CompareIDs(0, idl, m_pidlCurrent))
868 {
869 TreeView_SelectItem(m_hWnd, parentNode);
870 }
871
872 // Remove the child item
873 TreeView_DeleteItem(m_hWnd, toDelete);
874 // Probe parent to see if it has children
875 if (!TreeView_GetChild(m_hWnd, parentNode))
876 {
877 // Decrement parent's child count
878 ZeroMemory(&tvItem, sizeof(tvItem));
879 tvItem.mask = TVIF_CHILDREN;
880 tvItem.hItem = parentNode;
881 tvItem.cChildren = 0;
882 TreeView_SetItem(m_hWnd, &tvItem);
883 }
884 return TRUE;
885}
BOOL NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect)
#define TVITEM
Definition: commctrl.h:3365
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3469
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3497
#define TreeView_DeleteItem(hwnd, hitem)
Definition: commctrl.h:3415
int cChildren
Definition: treeview.c:154
#define ZeroMemory
Definition: winbase.h:1712

◆ DestroyExplorerBand()

void CExplorerBand::DestroyExplorerBand ( )
private

Definition at line 231 of file explorerband.cpp.

232{
233 HRESULT hr;
234 CComPtr <IWebBrowser2> browserService;
235
236 TRACE("Cleaning up explorer band ...\n");
237
238 hr = IUnknown_QueryService(m_pSite, SID_SWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &browserService));
240 return;
241
242 hr = AtlUnadvise(browserService, DIID_DWebBrowserEvents, m_adviseCookie);
243 /* Remove all items of the treeview */
244 RevokeDragDrop(m_hWnd);
247 m_hRoot = NULL;
248 TRACE("Cleanup done !\n");
249}
HTREEITEM m_hRoot
Definition: explorerband.h:65
DWORD m_adviseCookie
Definition: explorerband.h:70
HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID *iid, DWORD dw)
Definition: atl.c:73
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:639
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1497
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3417
#define SID_SWebBrowserApp
Definition: shlguid.h:111
#define IID_PPV_ARG(Itype, ppType)

Referenced by SetSite().

◆ DragEnter()

HRESULT STDMETHODCALLTYPE CExplorerBand::DragEnter ( IDataObject pObj,
DWORD  glfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
override

Implements IDropTarget.

Definition at line 1466 of file explorerband.cpp.

1467{
1468 ERR("Entering drag\n");
1469 m_pCurObject = pObj;
1471 return DragOver(glfKeyState, pt, pdwEffect);
1472}
#define ERR(fmt,...)
Definition: debug.h:113
CComPtr< IDataObject > m_pCurObject
Definition: explorerband.h:76
STDMETHOD() DragOver(DWORD glfKeyState, POINTL pt, DWORD *pdwEffect) override
#define pt(x, y)
Definition: drawing.c:79

◆ DragLeave()

HRESULT STDMETHODCALLTYPE CExplorerBand::DragLeave ( void  )
override

Implements IDropTarget.

Definition at line 1552 of file explorerband.cpp.

1553{
1558 if (m_pCurObject)
1559 {
1561 }
1562 return S_OK;
1563}
HTREEITEM m_childTargetNode
Definition: explorerband.h:75

Referenced by Drop().

◆ DragOver()

HRESULT STDMETHODCALLTYPE CExplorerBand::DragOver ( DWORD  glfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
override

Implements IDropTarget.

Definition at line 1474 of file explorerband.cpp.

1475{
1477 CComPtr<IShellFolder> pShellFldr;
1478 NodeInfo *nodeInfo;
1479 //LPCITEMIDLIST pChild;
1480 HRESULT hr;
1481
1482 info.pt.x = pt.x;
1483 info.pt.y = pt.y;
1484 info.flags = TVHT_ONITEM;
1485 info.hItem = NULL;
1486 ScreenToClient(&info.pt);
1487
1488 // Move to the item selected by the treeview (don't change right pane)
1489 TreeView_HitTest(m_hWnd, &info);
1490
1491 if (info.hItem)
1492 {
1494 TreeView_SelectItem(m_hWnd, info.hItem);
1496 // Delegate to shell folder
1497 if (m_pDropTarget && info.hItem != m_childTargetNode)
1498 {
1500 }
1501 if (info.hItem != m_childTargetNode)
1502 {
1503 nodeInfo = GetNodeInfo(info.hItem);
1504 if (!nodeInfo)
1505 return E_FAIL;
1506#if 0
1507 hr = SHBindToParent(nodeInfo->absolutePidl, IID_PPV_ARG(IShellFolder, &pShellFldr), &pChild);
1508 if (!SUCCEEDED(hr))
1509 return E_FAIL;
1510 hr = pShellFldr->GetUIObjectOf(m_hWnd, 1, &pChild, IID_IDropTarget, NULL, reinterpret_cast<void**>(&pDropTarget));
1511 if (!SUCCEEDED(hr))
1512 return E_FAIL;
1513#endif
1514 if(_ILIsDesktop(nodeInfo->absolutePidl))
1515 pShellFldr = m_pDesktop;
1516 else
1517 {
1518 hr = m_pDesktop->BindToObject(nodeInfo->absolutePidl, 0, IID_PPV_ARG(IShellFolder, &pShellFldr));
1519 if (!SUCCEEDED(hr))
1520 {
1521 /* Don't allow dnd since we couldn't get our folder object */
1522 ERR("Can't bind to folder object\n");
1523 *pdwEffect = DROPEFFECT_NONE;
1524 return E_FAIL;
1525 }
1526 }
1527 hr = pShellFldr->CreateViewObject(m_hWnd, IID_PPV_ARG(IDropTarget, &m_pDropTarget));
1528 if (!SUCCEEDED(hr))
1529 {
1530 /* Don't allow dnd since we couldn't get our drop target */
1531 ERR("Can't get drop target for folder object\n");
1532 *pdwEffect = DROPEFFECT_NONE;
1533 return E_FAIL;
1534 }
1535 hr = m_pDropTarget->DragEnter(m_pCurObject, glfKeyState, pt, pdwEffect);
1536 m_childTargetNode = info.hItem;
1537 }
1538 if (m_pDropTarget)
1539 {
1540 hr = m_pDropTarget->DragOver(glfKeyState, pt, pdwEffect);
1541 }
1542 }
1543 else
1544 {
1547 *pdwEffect = DROPEFFECT_NONE;
1548 }
1549 return S_OK;
1550}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
NodeInfo * GetNodeInfo(HTREEITEM hItem)
CComPtr< IDropTarget > m_pDropTarget
Definition: explorerband.h:74
#define E_FAIL
Definition: ddrawi.h:102
const DWORD DROPEFFECT_NONE
Definition: oleidl.idl:929
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1348
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by DragEnter().

◆ Drop()

HRESULT STDMETHODCALLTYPE CExplorerBand::Drop ( IDataObject pObj,
DWORD  glfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
override

Implements IDropTarget.

Definition at line 1565 of file explorerband.cpp.

1566{
1567 if (!m_pDropTarget)
1568 return E_FAIL;
1569 m_pDropTarget->Drop(pObj, glfKeyState, pt, pdwEffect);
1570 DragLeave();
1571 return S_OK;
1572}
STDMETHOD() DragLeave() override

◆ Exec()

HRESULT STDMETHODCALLTYPE CExplorerBand::Exec ( const GUID pguidCmdGroup,
DWORD  nCmdID,
DWORD  nCmdexecopt,
VARIANT pvaIn,
VARIANT pvaOut 
)
override

Implements IOleCommandTarget.

Definition at line 1191 of file explorerband.cpp.

1192{
1194 return E_NOTIMPL;
1195}

◆ ExecuteCommand()

HRESULT CExplorerBand::ExecuteCommand ( CComPtr< IContextMenu > &  menu,
UINT  nCmd 
)
private

Definition at line 264 of file explorerband.cpp.

265{
266 CComPtr<IOleWindow> pBrowserOleWnd;
267 CMINVOKECOMMANDINFO cmi;
268 HWND browserWnd;
269 HRESULT hr;
270
273 return hr;
274
275 hr = pBrowserOleWnd->GetWindow(&browserWnd);
277 return hr;
278
279 ZeroMemory(&cmi, sizeof(cmi));
280 cmi.cbSize = sizeof(cmi);
281 cmi.lpVerb = MAKEINTRESOURCEA(nCmd);
282 cmi.hwnd = browserWnd;
283 if (GetKeyState(VK_SHIFT) & 0x8000)
284 cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
285 if (GetKeyState(VK_CONTROL) & 0x8000)
286 cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
287
288 return menu->InvokeCommand(&cmi);
289}
#define SID_SShellBrowser
Definition: shlguid.h:128
#define VK_CONTROL
Definition: winuser.h:2203
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define VK_SHIFT
Definition: winuser.h:2202
SHORT WINAPI GetKeyState(_In_ int)

Referenced by OnContextMenu().

◆ GetBandInfo()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetBandInfo ( DWORD  dwBandID,
DWORD  dwViewMode,
DESKBANDINFO pdbi 
)
override

Implements IDeskBand.

Definition at line 1071 of file explorerband.cpp.

1072{
1073 if (!pdbi)
1074 {
1075 return E_INVALIDARG;
1076 }
1077 this->m_dwBandID = dwBandID;
1078
1079 if (pdbi->dwMask & DBIM_MINSIZE)
1080 {
1081 pdbi->ptMinSize.x = 200;
1082 pdbi->ptMinSize.y = 30;
1083 }
1084
1085 if (pdbi->dwMask & DBIM_MAXSIZE)
1086 {
1087 pdbi->ptMaxSize.y = -1;
1088 }
1089
1090 if (pdbi->dwMask & DBIM_INTEGRAL)
1091 {
1092 pdbi->ptIntegral.y = 1;
1093 }
1094
1095 if (pdbi->dwMask & DBIM_ACTUAL)
1096 {
1097 pdbi->ptActual.x = 200;
1098 pdbi->ptActual.y = 30;
1099 }
1100
1101 if (pdbi->dwMask & DBIM_TITLE)
1102 {
1103 if (!LoadStringW(_AtlBaseModule.GetResourceInstance(), IDS_FOLDERSLABEL, pdbi->wszTitle, _countof(pdbi->wszTitle)))
1105 }
1106
1107 if (pdbi->dwMask & DBIM_MODEFLAGS)
1108 {
1109 pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_VARIABLEHEIGHT;
1110 }
1111
1112 if (pdbi->dwMask & DBIM_BKCOLOR)
1113 {
1114 pdbi->dwMask &= ~DBIM_BKCOLOR;
1115 }
1116 return S_OK;
1117}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define IDS_FOLDERSLABEL
Definition: resource.h:127
#define _countof(array)
Definition: sndvol32.h:70
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
WCHAR wszTitle[256]
Definition: shobjidl.idl:2426
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)

◆ GetClassID()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetClassID ( CLSID pClassID)
override

Implements IPersist.

Definition at line 1242 of file explorerband.cpp.

1243{
1244 if (!pClassID)
1245 return E_POINTER;
1246 memcpy(pClassID, &CLSID_ExplorerBand, sizeof(CLSID));
1247 return S_OK;
1248}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define E_POINTER
Definition: winerror.h:2365

◆ GetIDsOfNames()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetIDsOfNames ( REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
override

Implements IDispatch.

Definition at line 1445 of file explorerband.cpp.

1446{
1448 return E_NOTIMPL;
1449}

◆ GetNavigateTarget()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetNavigateTarget ( long  paramC,
long  param10,
long  param14 
)
override

Definition at line 1402 of file explorerband.cpp.

1403{
1405 return E_NOTIMPL;
1406}

◆ GetNodeInfo()

CExplorerBand::NodeInfo * CExplorerBand::GetNodeInfo ( HTREEITEM  hItem)
private

Definition at line 251 of file explorerband.cpp.

252{
253 TVITEM tvItem;
254
255 tvItem.mask = TVIF_PARAM;
256 tvItem.hItem = hItem;
257
258 if (!TreeView_GetItem(m_hWnd, &tvItem))
259 return 0;
260
261 return reinterpret_cast<NodeInfo*>(tvItem.lParam);
262}
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3490
#define TVIF_PARAM
Definition: commctrl.h:3268
HTREEITEM hItem
Definition: treelist.h:37

Referenced by DragOver(), InitializeExplorerBand(), NavigateToPIDL(), OnContextMenu(), OnSelectionChanged(), OnTreeItemDeleted(), OnTreeItemDragging(), OnTreeItemExpanding(), OnWinEvent(), and RefreshTreePidl().

◆ GetSite()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetSite ( REFIID  riid,
void **  ppvSite 
)
override

Definition at line 1175 of file explorerband.cpp.

1176{
1177 if (!ppvSite)
1178 return E_POINTER;
1179 *ppvSite = m_pSite;
1180 return S_OK;
1181}

◆ GetSizeMax()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetSizeMax ( ULARGE_INTEGER pcbSize)
override

Implements IPersistStream.

Definition at line 1270 of file explorerband.cpp.

1271{
1272 // TODO: calculate max size
1274 return E_NOTIMPL;
1275}

◆ GetTypeInfo()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetTypeInfo ( UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
override

Implements IDispatch.

Definition at line 1439 of file explorerband.cpp.

1440{
1442 return E_NOTIMPL;
1443}

◆ GetTypeInfoCount()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetTypeInfoCount ( UINT pctinfo)
override

Implements IDispatch.

Definition at line 1433 of file explorerband.cpp.

1434{
1436 return E_NOTIMPL;
1437}

◆ GetWindow()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetWindow ( HWND lphwnd)
override

Implements IOleWindow.

Definition at line 1033 of file explorerband.cpp.

1034{
1035 if (!lphwnd)
1036 return E_INVALIDARG;
1037 *lphwnd = m_hWnd;
1038 return S_OK;
1039}

◆ GiveFeedback()

HRESULT STDMETHODCALLTYPE CExplorerBand::GiveFeedback ( DWORD  dwEffect)
override

Implements IDropSource.

Definition at line 1584 of file explorerband.cpp.

1585{
1587}
#define DRAGDROP_S_USEDEFAULTCURSORS
Definition: winerror.h:2648

◆ HasFocusIO()

HRESULT STDMETHODCALLTYPE CExplorerBand::HasFocusIO ( )
override

Definition at line 1223 of file explorerband.cpp.

1224{
1225 return m_bFocused ? S_OK : S_FALSE;
1226}
#define S_FALSE
Definition: winerror.h:2357

◆ InitializeExplorerBand()

void CExplorerBand::InitializeExplorerBand ( )
private

Definition at line 165 of file explorerband.cpp.

166{
167 // Init the treeview here
168 HRESULT hr;
169 LPITEMIDLIST pidl;
170 CComPtr<IWebBrowser2> browserService;
172
175 return;
176
177 hr = SHGetFolderLocation(m_hWnd, CSIDL_DESKTOP, NULL, 0, &pidl);
179 return;
180
181 IImageList * piml;
184 return;
185
187
188 // Insert the root node
189 m_hRoot = InsertItem(0, m_pDesktop, pidl, pidl, FALSE);
190 if (!m_hRoot)
191 {
192 ERR("Failed to create root item\n");
193 return;
194 }
195
196 NodeInfo* pNodeInfo = GetNodeInfo(m_hRoot);
197
198 // Insert child nodes
199 InsertSubitems(m_hRoot, pNodeInfo);
201
202 // Navigate to current folder position
204
205 // Register shell notification
206 shcne.pidl = pidl;
207 shcne.fRecursive = TRUE;
209 m_hWnd,
213 1,
214 &shcne);
215 if (!m_shellRegID)
216 {
217 ERR("Something went wrong, error %08x\n", GetLastError());
218 }
219 // Register browser connection endpoint
220 hr = IUnknown_QueryService(m_pSite, SID_SWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &browserService));
222 return;
223
224 hr = AtlAdvise(browserService, dynamic_cast<IDispatch*>(this), DIID_DWebBrowserEvents, &m_adviseCookie);
226 return;
227
228 ILFree(pidl);
229}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
BOOL NavigateToCurrentFolder()
ULONG m_shellRegID
Definition: explorerband.h:71
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo)
HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD *pdw)
Definition: atl.c:45
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3124
#define WM_USER_SHELLEVENT
Definition: explorerband.h:24
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3420
#define TVSIL_NORMAL
Definition: commctrl.h:3443
#define TVE_EXPAND
Definition: commctrl.h:3423
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3447
#define SHIL_SMALL
Definition: shellapi.h:185
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
Definition: shellord.c:2452
#define SHCNRF_RecursiveInterrupt
Definition: shlobj.h:1923
#define SHCNE_RMDIR
Definition: shlobj.h:1880
#define SHCNE_MKDIR
Definition: shlobj.h:1879
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1893
#define SHCNE_DISKEVENTS
Definition: shlobj.h:1898
#define SHCNRF_ShellLevel
Definition: shlobj.h:1922
#define CSIDL_DESKTOP
Definition: shlobj.h:2159
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1921
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1872

Referenced by SetSite().

◆ InsertItem() [1/2]

HTREEITEM CExplorerBand::InsertItem ( HTREEITEM  hParent,
IShellFolder psfParent,
LPITEMIDLIST  pElt,
LPITEMIDLIST  pEltRelative,
BOOL  bSort 
)
private

Definition at line 566 of file explorerband.cpp.

567{
568 TV_INSERTSTRUCT tvInsert;
569 HTREEITEM htiCreated;
570
571 /* Get the attributes of the node */
572 SFGAOF attrs = SFGAO_STREAM | SFGAO_HASSUBFOLDER;
573 HRESULT hr = psfParent->GetAttributesOf(1, &pEltRelative, &attrs);
575 return NULL;
576
577 /* Ignore streams */
578 if (attrs & SFGAO_STREAM)
579 {
580 TRACE("Ignoring stream\n");
581 return NULL;
582 }
583
584 /* Get the name of the node */
585 WCHAR wszDisplayName[MAX_PATH];
586 STRRET strret;
587 hr = psfParent->GetDisplayNameOf(pEltRelative, SHGDN_INFOLDER, &strret);
589 return NULL;
590
591 hr = StrRetToBufW(&strret, pEltRelative, wszDisplayName, MAX_PATH);
593 return NULL;
594
595 /* Get the icon of the node */
596 INT iIcon = SHMapPIDLToSystemImageListIndex(psfParent, pEltRelative, NULL);
597
598 NodeInfo* pChildInfo = new NodeInfo;
599 if (!pChildInfo)
600 {
601 ERR("Failed to allocate NodeInfo\n");
602 return FALSE;
603 }
604
605 // Store our node info
606 pChildInfo->absolutePidl = ILClone(pElt);
607 pChildInfo->relativePidl = ILClone(pEltRelative);
608 pChildInfo->expanded = FALSE;
609
610 // Set up our treeview template
611 tvInsert.hParent = hParent;
612 tvInsert.hInsertAfter = TVI_LAST;
614 tvInsert.item.cchTextMax = MAX_PATH;
615 tvInsert.item.pszText = wszDisplayName;
616 tvInsert.item.iImage = tvInsert.item.iSelectedImage = iIcon;
617 tvInsert.item.cChildren = (attrs & SFGAO_HASSUBFOLDER) ? 1 : 0;
618 tvInsert.item.lParam = (LPARAM)pChildInfo;
619
620 htiCreated = TreeView_InsertItem(m_hWnd, &tvInsert);
621
622 if (bSort)
623 {
624 TVSORTCB sortCallback;
625 sortCallback.hParent = hParent;
626 sortCallback.lpfnCompare = CompareTreeItems;
627 sortCallback.lParam = (LPARAM)this;
628 SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
629 }
630
631 return htiCreated;
632}
static int CALLBACK CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3)
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1530
static IShellFolder IShellItem **static IBindCtx LPITEMIDLIST SFGAOF
Definition: ebrowser.c:83
int WINAPI SHMapPIDLToSystemImageListIndex(IShellFolder *sh, LPCITEMIDLIST pidl, int *pIndex)
Definition: iconcache.cpp:766
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
HRESULT GetAttributesOf([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
#define TVI_LAST
Definition: commctrl.h:3370
#define TVM_SORTCHILDRENCB
Definition: commctrl.h:3547
#define TVIF_TEXT
Definition: commctrl.h:3266
#define TVIF_IMAGE
Definition: commctrl.h:3267
#define TV_INSERTSTRUCT
Definition: commctrl.h:3377
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3412
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3271
LPARAM lParam
Definition: commctrl.h:3616
HTREEITEM hParent
Definition: commctrl.h:3614
PFNTVCOMPARE lpfnCompare
Definition: commctrl.h:3615
int32_t INT
Definition: typedefs.h:58
LONG_PTR LPARAM
Definition: windef.h:208
#define SendMessage
Definition: winuser.h:5843

Referenced by InitializeExplorerBand(), InsertItem(), InsertSubitems(), and NavigateToPIDL().

◆ InsertItem() [2/2]

HTREEITEM CExplorerBand::InsertItem ( HTREEITEM  hParent,
LPITEMIDLIST  pElt,
LPITEMIDLIST  pEltRelative,
BOOL  bSort 
)
private

Definition at line 635 of file explorerband.cpp.

636{
637 CComPtr<IShellFolder> psfFolder;
638 HRESULT hr = SHBindToParent(pElt, IID_PPV_ARG(IShellFolder, &psfFolder), NULL);
640 return NULL;
641
642 return InsertItem(hParent, psfFolder, pElt, pEltRelative, bSort);
643}

◆ InsertSubitems()

BOOL CExplorerBand::InsertSubitems ( HTREEITEM  hItem,
NodeInfo pNodeInfo 
)
private

Definition at line 645 of file explorerband.cpp.

646{
647 CComPtr<IEnumIDList> pEnumIDList;
648 LPITEMIDLIST pidlSub;
650 SHCONTF EnumFlags;
651 HRESULT hr;
652 ULONG fetched;
653 ULONG uItemCount;
654 CComPtr<IShellFolder> pFolder;
655 TVSORTCB sortCallback;
656
657 entry = pNodeInfo->absolutePidl;
658 fetched = 1;
659 uItemCount = 0;
660 EnumFlags = SHCONTF_FOLDERS;
661
662 hr = SHGetFolderLocation(m_hWnd, CSIDL_DESKTOP, NULL, 0, &pidlSub);
663 if (!SUCCEEDED(hr))
664 {
665 ERR("Can't get desktop PIDL !\n");
666 return FALSE;
667 }
668
669 if (!m_pDesktop->CompareIDs(NULL, pidlSub, entry))
670 {
671 // We are the desktop, so use pDesktop as pFolder
672 pFolder = m_pDesktop;
673 }
674 else
675 {
676 // Get an IShellFolder of our pidl
677 hr = m_pDesktop->BindToObject(entry, NULL, IID_PPV_ARG(IShellFolder, &pFolder));
678 if (!SUCCEEDED(hr))
679 {
680 ILFree(pidlSub);
681 ERR("Can't bind folder to desktop !\n");
682 return FALSE;
683 }
684 }
685 ILFree(pidlSub);
686
687 // TODO: handle hidden folders according to settings !
688 EnumFlags |= SHCONTF_INCLUDEHIDDEN;
689
690 // Enum through objects
691 hr = pFolder->EnumObjects(NULL,EnumFlags,&pEnumIDList);
692
693 // avoid broken IShellFolder implementations that return null pointer with success
694 if (!SUCCEEDED(hr) || !pEnumIDList)
695 {
696 ERR("Can't enum the folder !\n");
697 return FALSE;
698 }
699
700 /* Don't redraw while we add stuff into the tree */
702 while(SUCCEEDED(pEnumIDList->Next(1, &pidlSub, &fetched)) && pidlSub && fetched)
703 {
704 LPITEMIDLIST pidlSubComplete;
705 pidlSubComplete = ILCombine(entry, pidlSub);
706
707 if (InsertItem(hItem, pFolder, pidlSubComplete, pidlSub, FALSE))
708 uItemCount++;
709 ILFree(pidlSubComplete);
710 ILFree(pidlSub);
711 }
712 pNodeInfo->expanded = TRUE;
713 /* Let's do sorting */
714 sortCallback.hParent = hItem;
715 sortCallback.lpfnCompare = CompareTreeItems;
716 sortCallback.lParam = (LPARAM)this;
717 SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
718
719 /* Now we can redraw */
721
722 return (uItemCount > 0) ? TRUE : FALSE;
723}
uint32_t entry
Definition: isohybrid.c:63
static SHCONTF
Definition: ordinal.c:64
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712
uint32_t ULONG
Definition: typedefs.h:59
#define WM_SETREDRAW
Definition: winuser.h:1616

Referenced by InitializeExplorerBand(), NavigateToPIDL(), and OnTreeItemExpanding().

◆ Invoke() [1/2]

HRESULT STDMETHODCALLTYPE CExplorerBand::Invoke ( DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
override

Implements IDispatch.

Definition at line 1451 of file explorerband.cpp.

1452{
1453 switch (dispIdMember)
1454 {
1457 TRACE("DISPID_NAVIGATECOMPLETE2 received\n");
1459 return S_OK;
1460 }
1461 TRACE("Unknown dispid requested: %08x\n", dispIdMember);
1462 return E_INVALIDARG;
1463}
#define DISPID_NAVIGATECOMPLETE2
Definition: webchild.h:54
#define DISPID_DOWNLOADCOMPLETE
Definition: webchild.h:39

◆ Invoke() [2/2]

HRESULT STDMETHODCALLTYPE CExplorerBand::Invoke ( long  paramC)
override

Definition at line 1408 of file explorerband.cpp.

1409{
1411 return E_NOTIMPL;
1412}

◆ IsDirty()

HRESULT STDMETHODCALLTYPE CExplorerBand::IsDirty ( void  )
override

Implements IPersistStream.

Definition at line 1252 of file explorerband.cpp.

1253{
1255 return E_NOTIMPL;
1256}

◆ IsWindowOwner()

HRESULT STDMETHODCALLTYPE CExplorerBand::IsWindowOwner ( HWND  hWnd)
override

Definition at line 1389 of file explorerband.cpp.

1390{
1391 return (hWnd == m_hWnd) ? S_OK : S_FALSE;
1392}
HWND hWnd
Definition: settings.c:17

◆ Load()

HRESULT STDMETHODCALLTYPE CExplorerBand::Load ( IStream pStm)
override

Implements IPersistStream.

Definition at line 1258 of file explorerband.cpp.

1259{
1261 return E_NOTIMPL;
1262}

◆ NavigateToCurrentFolder()

BOOL CExplorerBand::NavigateToCurrentFolder ( )
private

Definition at line 825 of file explorerband.cpp.

826{
827 LPITEMIDLIST explorerPidl;
828 CComPtr<IBrowserService> pBrowserService;
829 HRESULT hr;
831 BOOL result;
832 explorerPidl = NULL;
833
834 hr = IUnknown_QueryService(m_pSite, SID_STopLevelBrowser, IID_PPV_ARG(IBrowserService, &pBrowserService));
835 if (!SUCCEEDED(hr))
836 {
837 ERR("Can't get IBrowserService !\n");
838 return FALSE;
839 }
840
841 hr = pBrowserService->GetPidl(&explorerPidl);
842 if (!SUCCEEDED(hr) || !explorerPidl)
843 {
844 ERR("Unable to get browser PIDL !\n");
845 return FALSE;
846 }
848 /* find PIDL into our explorer */
849 result = NavigateToPIDL(explorerPidl, &dummy, TRUE, FALSE, TRUE);
851 return result;
852}
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint64EXT * result
Definition: glext.h:11304

Referenced by InitializeExplorerBand(), and Invoke().

◆ NavigateToPIDL()

BOOL CExplorerBand::NavigateToPIDL ( LPITEMIDLIST  dest,
HTREEITEM item,
BOOL  bExpand,
BOOL  bInsert,
BOOL  bSelect 
)
private

Navigate to a given PIDL in the treeview, and return matching tree item handle

  • dest: The absolute PIDL we should navigate in the treeview
  • item: Handle of the tree item matching the PIDL
  • bExpand: expand collapsed nodes in order to find the right element
  • bInsert: insert the element at the right place if we don't find it
  • bSelect: select the item after we found it

Definition at line 733 of file explorerband.cpp.

735{
737 HTREEITEM tmp;
739 NodeInfo *nodeData;
740 LPITEMIDLIST relativeChild;
741 TVITEM tvItem;
742
743 if (!item)
744 return FALSE;
745
747 parent = NULL;
748 while (TRUE)
749 {
750 nodeData = GetNodeInfo(current);
751 if (!nodeData)
752 {
753 ERR("Something has gone wrong, no data associated to node !\n");
754 *item = NULL;
755 return FALSE;
756 }
757 // If we found our node, give it back
758 if (!m_pDesktop->CompareIDs(0, nodeData->absolutePidl, dest))
759 {
760 if (bSelect)
762 *item = current;
763 return TRUE;
764 }
765
766 // Check if we are a parent of the requested item
767 relativeChild = ILFindChild(nodeData->absolutePidl, dest);
768 if (relativeChild != 0)
769 {
770 // Notify treeview we have children
771 tvItem.mask = TVIF_CHILDREN;
772 tvItem.hItem = current;
773 tvItem.cChildren = 1;
774 TreeView_SetItem(m_hWnd, &tvItem);
775
776 // If we can expand and the node isn't expanded yet, do it
777 if (bExpand)
778 {
779 if (!nodeData->expanded)
780 InsertSubitems(current, nodeData);
782 }
783
784 // Try to get a child
785 tmp = TreeView_GetChild(m_hWnd, current);
786 if (tmp)
787 {
788 // We have a child, let's continue with it
789 parent = current;
790 current = tmp;
791 continue;
792 }
793
794 if (bInsert && nodeData->expanded)
795 {
796 // Happens when we have to create a subchild inside a child
797 current = InsertItem(current, dest, relativeChild, TRUE);
798 }
799 // We end up here, without any children, so we found nothing
800 // Tell the parent node it has children
801 ZeroMemory(&tvItem, sizeof(tvItem));
802 *item = NULL;
803 return FALSE;
804 }
805
806 // Find sibling
807 tmp = TreeView_GetNextSibling(m_hWnd, current);
808 if (tmp)
809 {
810 current = tmp;
811 continue;
812 }
813 if (bInsert)
814 {
816 *item = current;
817 return TRUE;
818 }
819 *item = NULL;
820 return FALSE;
821 }
823}
static BOOL bInsert
Definition: cmdinput.c:121
r parent
Definition: btrfs.c:3010
struct task_struct * current
Definition: linux.c:32
static char * dest
Definition: rtl.c:135
static ATOM item
Definition: dde.c:856
#define UNREACHABLE
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:198
PUIDLIST_RELATIVE WINAPI ILFindChild(PIDLIST_ABSOLUTE pidl1, PCIDLIST_ABSOLUTE pidl2)
Definition: pidl.c:654
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3467

Referenced by DeleteItem(), NavigateToCurrentFolder(), and OnShellEvent().

◆ OnContextMenu()

LRESULT CExplorerBand::OnContextMenu ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 409 of file explorerband.cpp.

410{
412 NodeInfo *info;
413 HMENU treeMenu;
414 WORD x;
415 WORD y;
416 CComPtr<IShellFolder> pFolder;
417 CComPtr<IContextMenu> contextMenu;
418 HRESULT hr;
419 UINT uCommand;
420 LPITEMIDLIST pidlChild;
421
422 treeMenu = NULL;
423 item = TreeView_GetSelection(m_hWnd);
424 bHandled = TRUE;
425 if (!item)
426 {
427 goto Cleanup;
428 }
429
430 x = LOWORD(lParam);
431 y = HIWORD(lParam);
432 if (x == -1 && y == -1)
433 {
434 // TODO: grab position of tree item and position it correctly
435 }
436
438 if (!info)
439 {
440 ERR("No node data, something has gone wrong !\n");
441 goto Cleanup;
442 }
443 hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pFolder),
444 (LPCITEMIDLIST*)&pidlChild);
445 if (!SUCCEEDED(hr))
446 {
447 ERR("Can't bind to folder!\n");
448 goto Cleanup;
449 }
450 hr = pFolder->GetUIObjectOf(m_hWnd, 1, (LPCITEMIDLIST*)&pidlChild, IID_IContextMenu,
451 NULL, reinterpret_cast<void**>(&contextMenu));
452 if (!SUCCEEDED(hr))
453 {
454 ERR("Can't get IContextMenu interface\n");
455 goto Cleanup;
456 }
457
458 IUnknown_SetSite(contextMenu, (IDeskBand *)this);
459
460 treeMenu = CreatePopupMenu();
461 hr = contextMenu->QueryContextMenu(treeMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST,
462 CMF_EXPLORE);
463 if (!SUCCEEDED(hr))
464 {
465 WARN("Can't get context menu for item\n");
466 DestroyMenu(treeMenu);
467 goto Cleanup;
468 }
470 x, y, 0, m_hWnd, NULL);
471
472 ExecuteCommand(contextMenu, uCommand);
473
474Cleanup:
475 if (contextMenu)
476 IUnknown_SetSite(contextMenu, NULL);
477 if (treeMenu)
478 DestroyMenu(treeMenu);
482 return TRUE;
483}
#define WARN(fmt,...)
Definition: debug.h:115
HRESULT ExecuteCommand(CComPtr< IContextMenu > &menu, UINT nCmd)
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1407
static const WCHAR Cleanup[]
Definition: register.c:80
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned int UINT
Definition: ndis.h:50
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:573
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:607
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define TPM_RIGHTBUTTON
Definition: winuser.h:2380
#define TPM_LEFTALIGN
Definition: winuser.h:2377
#define TPM_LEFTBUTTON
Definition: winuser.h:2379
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define TPM_RETURNCMD
Definition: winuser.h:2387

Referenced by OnWinEvent().

◆ OnKillFocus()

LRESULT CExplorerBand::OnKillFocus ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 558 of file explorerband.cpp.

559{
560 IUnknown_OnFocusChangeIS(m_pSite, reinterpret_cast<IUnknown*>(this), FALSE);
561 bHandled = FALSE;
562 return TRUE;
563}
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4767

◆ OnSelectionChanged() [1/2]

HRESULT STDMETHODCALLTYPE CExplorerBand::OnSelectionChanged ( long  paramC)
override

Definition at line 1414 of file explorerband.cpp.

1415{
1417 return E_NOTIMPL;
1418}

◆ OnSelectionChanged() [2/2]

void CExplorerBand::OnSelectionChanged ( LPNMTREEVIEW  pnmtv)
private

Definition at line 360 of file explorerband.cpp.

361{
362 NodeInfo* pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
363
364 /* Prevents navigation if selection is initiated inside the band */
365 if (m_bNavigating)
366 return;
367
368 UpdateBrowser(pNodeInfo->absolutePidl);
369
370 SetFocus();
371 // Expand the node
372 //TreeView_Expand(m_hWnd, pnmtv->itemNew.hItem, TVE_EXPAND);
373}
HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto)
HWND WINAPI SetFocus(_In_opt_ HWND)

Referenced by OnWinEvent().

◆ OnSetFocus()

LRESULT CExplorerBand::OnSetFocus ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 550 of file explorerband.cpp.

551{
553 IUnknown_OnFocusChangeIS(m_pSite, reinterpret_cast<IUnknown*>(this), TRUE);
554 bHandled = FALSE;
555 return TRUE;
556}

◆ OnShellEvent()

LRESULT CExplorerBand::OnShellEvent ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 508 of file explorerband.cpp.

509{
511 LPITEMIDLIST clean;
512 HTREEITEM pItem;
513
515 /* TODO: handle shell notifications */
516 switch(lParam & ~SHCNE_INTERRUPT)
517 {
518 case SHCNE_MKDIR:
519 if (!SUCCEEDED(_ReparsePIDL(dest[0], &clean)))
520 {
521 ERR("Can't reparse PIDL to a valid one\n");
522 return FALSE;
523 }
524 NavigateToPIDL(clean, &pItem, FALSE, TRUE, FALSE);
525 ILFree(clean);
526 break;
527 case SHCNE_RMDIR:
528 DeleteItem(dest[0]);
529 break;
531 if (!SUCCEEDED(_ReparsePIDL(dest[1], &clean)))
532 {
533 ERR("Can't reparse PIDL to a valid one\n");
534 return FALSE;
535 }
536 if (NavigateToPIDL(dest[0], &pItem, FALSE, FALSE, FALSE))
537 RenameItem(pItem, clean);
538 ILFree(clean);
539 break;
540 case SHCNE_UPDATEDIR:
541 // We don't take care of this message
542 TRACE("Directory updated\n");
543 break;
544 default:
545 TRACE("Unhandled message\n");
546 }
547 return TRUE;
548}
BOOL RenameItem(HTREEITEM toRename, LPITEMIDLIST newPidl)
WPARAM wParam
Definition: combotst.c:138
HRESULT _ReparsePIDL(LPITEMIDLIST buggyPidl, LPITEMIDLIST *cleanPidl)
#define SHCNE_UPDATEDIR
Definition: shlobj.h:1888
#define SHCNE_INTERRUPT
Definition: shlobj.h:1901
#define DeleteItem
Definition: userenv.h:210

◆ OnTreeItemDeleted()

BOOL CExplorerBand::OnTreeItemDeleted ( LPNMTREEVIEW  pnmtv)
private

Definition at line 347 of file explorerband.cpp.

348{
349 /* Destroy memory associated to our node */
350 NodeInfo* ptr = GetNodeInfo(pnmtv->itemOld.hItem);
351 if (ptr)
352 {
353 ILFree(ptr->relativePidl);
354 ILFree(ptr->absolutePidl);
355 delete ptr;
356 }
357 return TRUE;
358}
static PVOID ptr
Definition: dispmode.c:27

Referenced by OnWinEvent().

◆ OnTreeItemDragging()

void CExplorerBand::OnTreeItemDragging ( LPNMTREEVIEW  pnmtv,
BOOL  isRightClick 
)
private

Definition at line 375 of file explorerband.cpp.

376{
377 if (!pnmtv->itemNew.lParam)
378 return;
379
380 NodeInfo* pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
381
382 HRESULT hr;
383 CComPtr<IShellFolder> pSrcFolder;
384 LPCITEMIDLIST pLast;
385 hr = SHBindToParent(pNodeInfo->absolutePidl, IID_PPV_ARG(IShellFolder, &pSrcFolder), &pLast);
386 if (!SUCCEEDED(hr))
387 return;
388
389 SFGAOF attrs = SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_CANLINK;
390 pSrcFolder->GetAttributesOf(1, &pLast, &attrs);
391
392 DWORD dwEffect = 0;
393 if (attrs & SFGAO_CANCOPY)
394 dwEffect |= DROPEFFECT_COPY;
395 if (attrs & SFGAO_CANMOVE)
396 dwEffect |= DROPEFFECT_MOVE;
397 if (attrs & SFGAO_CANLINK)
398 dwEffect |= DROPEFFECT_LINK;
399
401 hr = pSrcFolder->GetUIObjectOf(m_hWnd, 1, &pLast, IID_IDataObject, 0, (LPVOID*)&pObj);
402 if (!SUCCEEDED(hr))
403 return;
404
405 DoDragDrop(pObj, this, dwEffect, &dwEffect);
406}
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:753
unsigned long DWORD
Definition: ntddk_ex.h:95
const DWORD DROPEFFECT_LINK
Definition: oleidl.idl:932
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931
const GUID IID_IDataObject

Referenced by OnWinEvent().

◆ OnTreeItemExpanding()

BOOL CExplorerBand::OnTreeItemExpanding ( LPNMTREEVIEW  pnmtv)
private

Definition at line 313 of file explorerband.cpp.

314{
315 NodeInfo *pNodeInfo;
316
317 if (pnmtv->action == TVE_COLLAPSE) {
318 if (pnmtv->itemNew.hItem == m_hRoot)
319 {
320 // Prenvent root from collapsing
321 pnmtv->itemNew.mask |= TVIF_STATE;
322 pnmtv->itemNew.stateMask |= TVIS_EXPANDED;
323 pnmtv->itemNew.state &= ~TVIS_EXPANDED;
324 pnmtv->action = TVE_EXPAND;
325 return TRUE;
326 }
327 }
328 if (pnmtv->action == TVE_EXPAND) {
329 // Grab our directory PIDL
330 pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
331 // We have it, let's try
332 if (pNodeInfo && !pNodeInfo->expanded)
333 if (!InsertSubitems(pnmtv->itemNew.hItem, pNodeInfo)) {
334 // remove subitem "+" since we failed to add subitems
335 TV_ITEM tvItem;
336
337 tvItem.mask = TVIF_CHILDREN;
338 tvItem.hItem = pnmtv->itemNew.hItem;
339 tvItem.cChildren = 0;
340
341 TreeView_SetItem(m_hWnd, &tvItem);
342 }
343 }
344 return FALSE;
345}
#define TV_ITEM
Definition: commctrl.h:3300
#define TVE_COLLAPSE
Definition: commctrl.h:3422
#define TVIS_EXPANDED
Definition: commctrl.h:3284
#define TVIF_STATE
Definition: commctrl.h:3269

Referenced by OnWinEvent().

◆ OnWinEvent()

HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT theResult 
)
override

Definition at line 1279 of file explorerband.cpp.

1280{
1281 BOOL bHandled;
1283
1284 if (uMsg == WM_NOTIFY)
1285 {
1286 NMHDR *pNotifyHeader = (NMHDR*)lParam;
1287 switch (pNotifyHeader->code)
1288 {
1289 case TVN_ITEMEXPANDING:
1291 if (theResult)
1292 *theResult = result;
1293 break;
1294 case TVN_SELCHANGED:
1296 break;
1297 case TVN_DELETEITEM:
1299 break;
1300 case NM_RCLICK:
1301 OnContextMenu(WM_CONTEXTMENU, (WPARAM)m_hWnd, GetMessagePos(), bHandled);
1302 if (theResult)
1303 *theResult = 1;
1304 break;
1305 case TVN_BEGINDRAG:
1306 case TVN_BEGINRDRAG:
1308 break;
1310 {
1311 // TODO: put this in a function ? (mostly copypasta from CDefView)
1312 DWORD dwAttr = SFGAO_CANRENAME;
1315 LPCITEMIDLIST pChild;
1316 HRESULT hr;
1317
1318 if (theResult)
1319 *theResult = 1;
1320 NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
1321 if (!info)
1322 return E_FAIL;
1323 hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pParent), &pChild);
1324 if (!SUCCEEDED(hr) || !pParent.p)
1325 return E_FAIL;
1326
1327 hr = pParent->GetAttributesOf(1, &pChild, &dwAttr);
1328 if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME))
1329 {
1330 if (theResult)
1331 *theResult = 0;
1332 m_isEditing = TRUE;
1333 }
1334 return S_OK;
1335 }
1336 case TVN_ENDLABELEDITW:
1337 {
1339 NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
1340 HRESULT hr;
1341
1343 if (theResult)
1344 *theResult = 0;
1345 if (dispInfo->item.pszText)
1346 {
1347 LPITEMIDLIST pidlNew;
1349 LPCITEMIDLIST pidlChild;
1350
1351 hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pParent), &pidlChild);
1352 if (!SUCCEEDED(hr) || !pParent.p)
1353 return E_FAIL;
1354
1355 hr = pParent->SetNameOf(0, pidlChild, dispInfo->item.pszText, SHGDN_INFOLDER, &pidlNew);
1356 if(SUCCEEDED(hr) && pidlNew)
1357 {
1358 CComPtr<IPersistFolder2> pPersist;
1359 LPITEMIDLIST pidlParent, pidlNewAbs;
1360
1362 if(!SUCCEEDED(hr))
1363 return E_FAIL;
1364
1365 hr = pPersist->GetCurFolder(&pidlParent);
1366 if(!SUCCEEDED(hr))
1367 return E_FAIL;
1368 pidlNewAbs = ILCombine(pidlParent, pidlNew);
1369
1370 // Navigate to our new location
1371 UpdateBrowser(pidlNewAbs);
1372
1373 ILFree(pidlParent);
1374 ILFree(pidlNewAbs);
1375 ILFree(pidlNew);
1376 if (theResult)
1377 *theResult = 1;
1378 }
1379 return S_OK;
1380 }
1381 }
1382 default:
1383 break;
1384 }
1385 }
1386 return S_OK;
1387}
BOOL OnTreeItemExpanding(LPNMTREEVIEW pnmtv)
void OnSelectionChanged(LPNMTREEVIEW pnmtv)
void OnTreeItemDragging(LPNMTREEVIEW pnmtv, BOOL isRightClick)
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
BOOL OnTreeItemDeleted(LPNMTREEVIEW pnmtv)
virtual _Must_inspect_result_ NTSTATUS QueryInterface(__in FxQueryInterfaceParams *Params)
Definition: fxobject.cpp:255
FxObject * pParent
Definition: fxdpcapi.cpp:86
#define TVN_DELETEITEM
Definition: commctrl.h:3742
#define TVN_SELCHANGED
Definition: commctrl.h:3735
#define TVN_BEGINDRAG
Definition: commctrl.h:3740
#define LPNMTREEVIEW
Definition: commctrl.h:3643
#define TVN_BEGINRDRAG
Definition: commctrl.h:3741
#define NM_RCLICK
Definition: commctrl.h:133
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3738
#define TVN_BEGINLABELEDITW
Definition: commctrl.h:3710
#define LPNMTVDISPINFO
Definition: commctrl.h:3676
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3712
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_NOTIFY
Definition: richedit.h:61
UINT code
Definition: winuser.h:3159
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351

◆ QueryContinueDrag()

HRESULT STDMETHODCALLTYPE CExplorerBand::QueryContinueDrag ( BOOL  fEscapePressed,
DWORD  grfKeyState 
)
override

Implements IDropSource.

Definition at line 1575 of file explorerband.cpp.

1576{
1577 if (fEscapePressed)
1578 return DRAGDROP_S_CANCEL;
1579 if ((grfKeyState & MK_LBUTTON) || (grfKeyState & MK_RBUTTON))
1580 return S_OK;
1581 return DRAGDROP_S_DROP;
1582}
#define DRAGDROP_S_DROP
Definition: winerror.h:2646
#define DRAGDROP_S_CANCEL
Definition: winerror.h:2647
#define MK_RBUTTON
Definition: winuser.h:2368
#define MK_LBUTTON
Definition: winuser.h:2367

◆ QueryService()

HRESULT STDMETHODCALLTYPE CExplorerBand::QueryService ( REFGUID  guidService,
REFIID  riid,
void **  ppvObject 
)
override

Implements IServiceProvider.

Definition at line 1199 of file explorerband.cpp.

1200{
1201 /* FIXME: we probably want to handle more services here */
1203}
REFIID riid
Definition: atlbase.h:39
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082

◆ QueryStatus()

HRESULT STDMETHODCALLTYPE CExplorerBand::QueryStatus ( const GUID pguidCmdGroup,
ULONG  cCmds,
OLECMD  prgCmds[],
OLECMDTEXT pCmdText 
)
override

Implements IOleCommandTarget.

Definition at line 1185 of file explorerband.cpp.

1186{
1188 return E_NOTIMPL;
1189}

◆ RefreshFlags()

HRESULT STDMETHODCALLTYPE CExplorerBand::RefreshFlags ( long  paramC,
long  param10,
long  param14 
)
override

Definition at line 1420 of file explorerband.cpp.

1421{
1423 return E_NOTIMPL;
1424}

◆ RefreshTreePidl()

BOOL CExplorerBand::RefreshTreePidl ( HTREEITEM  tree,
LPITEMIDLIST  pidlParent 
)
private

Definition at line 937 of file explorerband.cpp.

938{
939 HTREEITEM tmp;
940 NodeInfo *pInfo;
941
942 // Update our node data
943 pInfo = GetNodeInfo(tree);
944 if (!pInfo)
945 {
946 WARN("No tree info !\n");
947 return FALSE;
948 }
949 ILFree(pInfo->absolutePidl);
950 pInfo->absolutePidl = ILCombine(pidlParent, pInfo->relativePidl);
951 if (!pInfo->absolutePidl)
952 {
953 WARN("PIDL allocation failed\n");
954 return FALSE;
955 }
956 // Recursively update children
957 if ((tmp = TreeView_GetChild(m_hWnd, tree)) != NULL)
958 {
959 RefreshTreePidl(tmp, pInfo->absolutePidl);
960 }
961
962 tmp = TreeView_GetNextSibling(m_hWnd, tree);
963 while(tmp != NULL)
964 {
965 pInfo = GetNodeInfo(tmp);
966 if(!pInfo)
967 {
968 WARN("No tree info !\n");
969 continue;
970 }
971 ILFree(pInfo->absolutePidl);
972 pInfo->absolutePidl = ILCombine(pidlParent, pInfo->relativePidl);
973 tmp = TreeView_GetNextSibling(m_hWnd, tmp);
974 }
975 return TRUE;
976}
BOOL RefreshTreePidl(HTREEITEM tree, LPITEMIDLIST pidlParent)

Referenced by RefreshTreePidl(), and RenameItem().

◆ RenameItem()

BOOL CExplorerBand::RenameItem ( HTREEITEM  toRename,
LPITEMIDLIST  newPidl 
)
private

Definition at line 887 of file explorerband.cpp.

888{
889 WCHAR wszDisplayName[MAX_PATH];
890 TVITEM itemInfo;
891 LPCITEMIDLIST relPidl;
892 NodeInfo *treeInfo;
893 TVSORTCB sortCallback;
895
896 ZeroMemory(&itemInfo, sizeof(itemInfo));
897 itemInfo.mask = TVIF_PARAM;
898 itemInfo.hItem = toRename;
899
900 // Change PIDL associated to the item
901 relPidl = ILFindLastID(newPidl);
902 TreeView_GetItem(m_hWnd, &itemInfo);
903 if (!itemInfo.lParam)
904 {
905 ERR("Unable to fetch lParam\n");
906 return FALSE;
907 }
909 treeInfo = (NodeInfo*)itemInfo.lParam;
910 ILFree(treeInfo->absolutePidl);
911 ILFree(treeInfo->relativePidl);
912 treeInfo->absolutePidl = ILClone(newPidl);
913 treeInfo->relativePidl = ILClone(relPidl);
914
915 // Change the display name
916 GetDisplayName(newPidl, wszDisplayName, MAX_PATH, SHGDN_INFOLDER);
917 ZeroMemory(&itemInfo, sizeof(itemInfo));
918 itemInfo.hItem = toRename;
919 itemInfo.mask = TVIF_TEXT;
920 itemInfo.pszText = wszDisplayName;
921 TreeView_SetItem(m_hWnd, &itemInfo);
922
923 if((child = TreeView_GetChild(m_hWnd, toRename)) != NULL)
924 {
925 RefreshTreePidl(child, newPidl);
926 }
927
928 // Sorting
929 sortCallback.hParent = TreeView_GetParent(m_hWnd, toRename);
930 sortCallback.lpfnCompare = CompareTreeItems;
931 sortCallback.lParam = (LPARAM)this;
932 SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
934 return TRUE;
935}
static HWND child
Definition: cursoricon.c:298

Referenced by OnShellEvent().

◆ ResizeBorderDW()

HRESULT STDMETHODCALLTYPE CExplorerBand::ResizeBorderDW ( const RECT prcBorder,
IUnknown punkToolbarSite,
BOOL  fReserved 
)
override

Definition at line 1056 of file explorerband.cpp.

1057{
1058 /* Must return E_NOTIMPL according to MSDN */
1059 return E_NOTIMPL;
1060}

◆ Save()

HRESULT STDMETHODCALLTYPE CExplorerBand::Save ( IStream pStm,
BOOL  fClearDirty 
)
override

Implements IPersistStream.

Definition at line 1264 of file explorerband.cpp.

1265{
1267 return E_NOTIMPL;
1268}

◆ Select()

HRESULT STDMETHODCALLTYPE CExplorerBand::Select ( long  paramC)
override

Definition at line 1395 of file explorerband.cpp.

1396{
1398 return E_NOTIMPL;
1399}

◆ SetSite()

HRESULT STDMETHODCALLTYPE CExplorerBand::SetSite ( IUnknown pUnkSite)
override

Implements IObjectWithSite.

Definition at line 1121 of file explorerband.cpp.

1122{
1123 HRESULT hr;
1124 HWND parentWnd;
1125
1126 if (pUnkSite == m_pSite)
1127 return S_OK;
1128
1129 TRACE("SetSite called \n");
1130 if (!pUnkSite)
1131 {
1133 DestroyWindow();
1134 m_hWnd = NULL;
1135 }
1136
1137 if (pUnkSite != m_pSite)
1138 {
1139 m_pSite = NULL;
1140 }
1141
1142 if(!pUnkSite)
1143 return S_OK;
1144
1145 hr = IUnknown_GetWindow(pUnkSite, &parentWnd);
1146 if (!SUCCEEDED(hr))
1147 {
1148 ERR("Could not get parent's window ! Status: %08lx\n", hr);
1149 return E_INVALIDARG;
1150 }
1151
1152 m_pSite = pUnkSite;
1153
1154 if (m_hWnd)
1155 {
1156 // Change its parent
1157 SetParent(parentWnd);
1158 }
1159 else
1160 {
1162 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TVS_HASLINES | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_EDITLABELS /* | TVS_SINGLEEXPAND*/ , // remove TVS_SINGLEEXPAND for now since it has strange behaviour
1163 0, 0, 0, 0, parentWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
1164
1165 // Subclass the window
1166 SubclassWindow(wnd);
1167
1168 // Initialize our treeview now
1170 RegisterDragDrop(m_hWnd, dynamic_cast<IDropTarget*>(this));
1171 }
1172 return S_OK;
1173}
void DestroyExplorerBand()
void InitializeExplorerBand()
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:557
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1332
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3252
#define TVS_HASLINES
Definition: commctrl.h:3248
#define WC_TREEVIEW
Definition: commctrl.h:3245
#define TVS_HASBUTTONS
Definition: commctrl.h:3247
#define TVS_EDITLABELS
Definition: commctrl.h:3250
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define CreateWindow
Definition: winuser.h:5754
BOOL WINAPI DestroyWindow(_In_ HWND)

◆ ShowDW()

HRESULT STDMETHODCALLTYPE CExplorerBand::ShowDW ( BOOL  fShow)
override

Implements IDockingWindow.

Definition at line 1062 of file explorerband.cpp.

1063{
1064 m_fVisible = fShow;
1065 ShowWindow(fShow);
1066 return S_OK;
1067}
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)

◆ TranslateAcceleratorIO()

HRESULT STDMETHODCALLTYPE CExplorerBand::TranslateAcceleratorIO ( LPMSG  lpMsg)
override

Definition at line 1228 of file explorerband.cpp.

1229{
1230 if (lpMsg->hwnd == m_hWnd ||
1231 (m_isEditing && IsChild(lpMsg->hwnd)))
1232 {
1233 TranslateMessage(lpMsg);
1234 DispatchMessage(lpMsg);
1235 return S_OK;
1236 }
1237
1238 return S_FALSE;
1239}
HWND hwnd
Definition: winuser.h:3114
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI IsChild(_In_ HWND, _In_ HWND)
#define DispatchMessage
Definition: winuser.h:5765

◆ UIActivateIO()

HRESULT STDMETHODCALLTYPE CExplorerBand::UIActivateIO ( BOOL  fActivate,
LPMSG  lpMsg 
)
override

Definition at line 1207 of file explorerband.cpp.

1208{
1209 if (fActivate)
1210 {
1211 //SetFocus();
1213 }
1214 // TODO: handle message
1215 if(lpMsg)
1216 {
1217 TranslateMessage(lpMsg);
1218 DispatchMessage(lpMsg);
1219 }
1220 return S_OK;
1221}
HWND WINAPI SetActiveWindow(_In_ HWND)

◆ UpdateBrowser()

HRESULT CExplorerBand::UpdateBrowser ( LPITEMIDLIST  pidlGoto)
private

Definition at line 291 of file explorerband.cpp.

292{
293 CComPtr<IShellBrowser> pBrowserService;
294 HRESULT hr;
295
296 hr = IUnknown_QueryService(m_pSite, SID_STopLevelBrowser, IID_PPV_ARG(IShellBrowser, &pBrowserService));
298 return hr;
299
300 hr = pBrowserService->BrowseObject(pidlGoto, SBSP_SAMEBROWSER | SBSP_ABSOLUTE);
302 return hr;
303
304 if (m_pidlCurrent)
305 {
307 m_pidlCurrent = ILClone(pidlGoto);
308 }
309 return hr;
310}

Referenced by OnSelectionChanged(), and OnWinEvent().

Member Data Documentation

◆ m_adviseCookie

DWORD CExplorerBand::m_adviseCookie
private

Definition at line 70 of file explorerband.h.

Referenced by DestroyExplorerBand(), and InitializeExplorerBand().

◆ m_bFocused

BOOL CExplorerBand::m_bFocused
private

Definition at line 61 of file explorerband.h.

Referenced by HasFocusIO(), and OnSetFocus().

◆ m_bNavigating

BOOL CExplorerBand::m_bNavigating
private

◆ m_childTargetNode

HTREEITEM CExplorerBand::m_childTargetNode
private

Definition at line 75 of file explorerband.h.

Referenced by DragLeave(), and DragOver().

◆ m_dwBandID

DWORD CExplorerBand::m_dwBandID
private

Definition at line 62 of file explorerband.h.

Referenced by GetBandInfo().

◆ m_fVisible

BOOL CExplorerBand::m_fVisible
private

Definition at line 59 of file explorerband.h.

Referenced by ShowDW().

◆ m_hImageList

HIMAGELIST CExplorerBand::m_hImageList
private

Definition at line 64 of file explorerband.h.

◆ m_hRoot

HTREEITEM CExplorerBand::m_hRoot
private

◆ m_isEditing

BOOL CExplorerBand::m_isEditing
private

Definition at line 63 of file explorerband.h.

Referenced by OnWinEvent(), and TranslateAcceleratorIO().

◆ m_oldSelected

HTREEITEM CExplorerBand::m_oldSelected
private

Definition at line 66 of file explorerband.h.

Referenced by ContextMenuHack(), DragEnter(), DragLeave(), and OnContextMenu().

◆ m_pCurObject

CComPtr<IDataObject> CExplorerBand::m_pCurObject
private

Definition at line 76 of file explorerband.h.

Referenced by DragEnter(), DragLeave(), and DragOver().

◆ m_pDesktop

CComPtr<IShellFolder> CExplorerBand::m_pDesktop
private

◆ m_pDropTarget

CComPtr<IDropTarget> CExplorerBand::m_pDropTarget
private

Definition at line 74 of file explorerband.h.

Referenced by DragOver(), and Drop().

◆ m_pidlCurrent

LPITEMIDLIST CExplorerBand::m_pidlCurrent
private

Definition at line 67 of file explorerband.h.

Referenced by DeleteItem(), UpdateBrowser(), and ~CExplorerBand().

◆ m_pSite

◆ m_shellRegID

ULONG CExplorerBand::m_shellRegID
private

Definition at line 71 of file explorerband.h.

Referenced by InitializeExplorerBand().


The documentation for this class was generated from the following files: