ReactOS  0.4.15-dev-5109-g2469ce2
CExplorerBand Class Reference

#include <explorerband.h>

Inheritance diagram for CExplorerBand:
Collaboration diagram for CExplorerBand:

Classes

class  NodeInfo
 

Public Member Functions

 CExplorerBand ()
 
virtual ~CExplorerBand ()
 
virtual HRESULT STDMETHODCALLTYPE GetWindow (HWND *lphwnd)
 
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp (BOOL fEnterMode)
 
virtual HRESULT STDMETHODCALLTYPE CloseDW (DWORD dwReserved)
 
virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW (const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
 
virtual HRESULT STDMETHODCALLTYPE ShowDW (BOOL fShow)
 
virtual HRESULT STDMETHODCALLTYPE GetBandInfo (DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
 
virtual HRESULT STDMETHODCALLTYPE SetSite (IUnknown *pUnkSite)
 
virtual HRESULT STDMETHODCALLTYPE GetSite (REFIID riid, void **ppvSite)
 
virtual HRESULT STDMETHODCALLTYPE QueryStatus (const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
 
virtual HRESULT STDMETHODCALLTYPE Exec (const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 
virtual HRESULT STDMETHODCALLTYPE QueryService (REFGUID guidService, REFIID riid, void **ppvObject)
 
virtual HRESULT STDMETHODCALLTYPE UIActivateIO (BOOL fActivate, LPMSG lpMsg)
 
virtual HRESULT STDMETHODCALLTYPE HasFocusIO ()
 
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO (LPMSG lpMsg)
 
virtual HRESULT STDMETHODCALLTYPE GetClassID (CLSID *pClassID)
 
virtual HRESULT STDMETHODCALLTYPE IsDirty ()
 
virtual HRESULT STDMETHODCALLTYPE Load (IStream *pStm)
 
virtual HRESULT STDMETHODCALLTYPE Save (IStream *pStm, BOOL fClearDirty)
 
virtual HRESULT STDMETHODCALLTYPE GetSizeMax (ULARGE_INTEGER *pcbSize)
 
virtual HRESULT STDMETHODCALLTYPE OnWinEvent (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
 
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner (HWND hWnd)
 
virtual HRESULT STDMETHODCALLTYPE Select (long paramC)
 
virtual HRESULT STDMETHODCALLTYPE GetNavigateTarget (long paramC, long param10, long param14)
 
virtual HRESULT STDMETHODCALLTYPE Invoke (long paramC)
 
virtual HRESULT STDMETHODCALLTYPE OnSelectionChanged (long paramC)
 
virtual HRESULT STDMETHODCALLTYPE RefreshFlags (long paramC, long param10, long param14)
 
virtual HRESULT STDMETHODCALLTYPE CacheItem (long paramC)
 
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount (UINT *pctinfo)
 
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo (UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames (REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
virtual HRESULT STDMETHODCALLTYPE Invoke (DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
virtual HRESULT STDMETHODCALLTYPE DragEnter (IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
 
virtual HRESULT STDMETHODCALLTYPE DragOver (DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
 
virtual HRESULT STDMETHODCALLTYPE DragLeave ()
 
virtual HRESULT STDMETHODCALLTYPE Drop (IDataObject *pObj, DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
 
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag (BOOL fEscapePressed, DWORD grfKeyState)
 
virtual HRESULT STDMETHODCALLTYPE GiveFeedback (DWORD dwEffect)
 
- 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 ()
 
- Public Member Functions inherited from IDockingWindow
HRESULT ResizeBorderDW ([in] LPCRECT prcBorder, [in] IUnknown *punkToolbarSite, [in] BOOL fReserved)
 
- 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 GetSite ([in] REFIID riid, [out, iid_is(riid)] PVOID *ppvSite)
 
- Public Member Functions inherited from IServiceProvider
HRESULT RemoteQueryService ([in] REFGUID guidService, [in] REFIID riid, [out, iid_is(riid)] IUnknown **ppvObject)
 
- Public Member Functions inherited from IDispatch
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)
 

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
 
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)
149  , m_fVisible(FALSE)
151  , m_dwBandID(0)
153 {
154 }
LPITEMIDLIST m_pidlCurrent
Definition: explorerband.h:66
DWORD m_dwBandID
Definition: explorerband.h:62
BOOL m_bNavigating
Definition: explorerband.h:60
#define FALSE
Definition: types.h:117
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
#define NULL
Definition: types.h:112

◆ ~CExplorerBand()

CExplorerBand::~CExplorerBand ( )
virtual

Definition at line 156 of file explorerband.cpp.

157 {
158  if (m_pidlCurrent)
159  {
161  }
162 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
LPITEMIDLIST m_pidlCurrent
Definition: explorerband.h:66

Member Function Documentation

◆ CacheItem()

HRESULT STDMETHODCALLTYPE CExplorerBand::CacheItem ( long  paramC)
virtual

Definition at line 1409 of file explorerband.cpp.

1410 {
1411  UNIMPLEMENTED;
1412  return E_NOTIMPL;
1413 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ CloseDW()

HRESULT STDMETHODCALLTYPE CExplorerBand::CloseDW ( DWORD  dwReserved)
virtual

Implements IDockingWindow.

Definition at line 1039 of file explorerband.cpp.

1040 {
1041  // We do nothing, we don't have anything to save yet
1042  TRACE("CloseDW called\n");
1043  return S_OK;
1044 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52

◆ CompareTreeItems()

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

Definition at line 969 of file explorerband.cpp.

970 {
971  /*
972  * We first sort drive letters (Path root), then PIDLs and then regular folder
973  * display name.
974  * This is not how Windows sorts item, but it gives decent results.
975  */
976  NodeInfo *info1;
977  NodeInfo *info2;
978  CExplorerBand *pThis;
979  WCHAR wszFolder1[MAX_PATH];
980  WCHAR wszFolder2[MAX_PATH];
981 
982  info1 = (NodeInfo*)p1;
983  info2 = (NodeInfo*)p2;
984  pThis = (CExplorerBand*)p3;
985 
986  GetDisplayName(info1->absolutePidl, wszFolder1, MAX_PATH, SHGDN_FORPARSING);
987  GetDisplayName(info2->absolutePidl, wszFolder2, MAX_PATH, SHGDN_FORPARSING);
988  if (PathIsRoot(wszFolder1) && PathIsRoot(wszFolder2))
989  {
990  return lstrcmpiW(wszFolder1,wszFolder2);
991  }
992  if (PathIsRoot(wszFolder1) && !PathIsRoot(wszFolder2))
993  {
994  return -1;
995  }
996  if (!PathIsRoot(wszFolder1) && PathIsRoot(wszFolder2))
997  {
998  return 1;
999  }
1000  // Now, we compare non-root folders, grab display name
1001  GetDisplayName(info1->absolutePidl, wszFolder1, MAX_PATH, SHGDN_INFOLDER);
1002  GetDisplayName(info2->absolutePidl, wszFolder2, MAX_PATH, SHGDN_INFOLDER);
1003 
1004  if (_ILIsSpecialFolder(info1->relativePidl) && !_ILIsSpecialFolder(info2->relativePidl))
1005  {
1006  return -1;
1007  }
1008  if (!_ILIsSpecialFolder(info1->relativePidl) && _ILIsSpecialFolder(info2->relativePidl))
1009  {
1010  return 1;
1011  }
1012  if (_ILIsSpecialFolder(info1->relativePidl) && !_ILIsSpecialFolder(info2->relativePidl))
1013  {
1014  HRESULT hr;
1015  hr = pThis->m_pDesktop->CompareIDs(0, info1->absolutePidl, info2->absolutePidl);
1016  if (!hr) return 0;
1017  return (hr > 0) ? -1 : 1;
1018  }
1019  return StrCmpLogicalW(wszFolder1, wszFolder2);
1020 }
HRESULT hr
Definition: shlfolder.c:183
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
static BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
INT WINAPI StrCmpLogicalW(LPCWSTR lpszStr, LPCWSTR lpszComp)
Definition: string.c:2296
HRESULT GetDisplayName(LPCITEMIDLIST pidlDirectory, TCHAR *szDisplayName, UINT cchMax, DWORD uFlags)
#define PathIsRoot
Definition: shlwapi.h:955

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

◆ ContextMenuHack()

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

Definition at line 475 of file explorerband.cpp.

476 {
477  bHandled = FALSE;
478  if (uMsg == WM_RBUTTONDOWN)
479  {
481  info.pt.x = LOWORD(lParam);
482  info.pt.y = HIWORD(lParam);
483  info.flags = TVHT_ONITEM;
484  info.hItem = NULL;
485 
486  // Save the current location
488 
489  // Move to the item selected by the treeview (don't change right pane)
490  TreeView_HitTest(m_hWnd, &info);
492  TreeView_SelectItem(m_hWnd, info.hItem);
494  }
495  return FALSE; /* let the wndproc process the message */
496 }
HTREEITEM m_oldSelected
Definition: explorerband.h:65
#define TRUE
Definition: types.h:120
BOOL m_bNavigating
Definition: explorerband.h:60
#define FALSE
Definition: types.h:117
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define WM_RBUTTONDOWN
Definition: winuser.h:1769
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3513
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
#define NULL
Definition: types.h:112
#define HIWORD(l)
Definition: typedefs.h:247
#define TVHT_ONITEM
Definition: commctrl.h:3527
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ ContextSensitiveHelp()

HRESULT STDMETHODCALLTYPE CExplorerBand::ContextSensitiveHelp ( BOOL  fEnterMode)
virtual

Implements IOleWindow.

Definition at line 1031 of file explorerband.cpp.

1032 {
1033  UNIMPLEMENTED;
1034  return E_NOTIMPL;
1035 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ DeleteItem()

BOOL CExplorerBand::DeleteItem ( LPITEMIDLIST  toDelete)
private

Definition at line 844 of file explorerband.cpp.

845 {
846  HTREEITEM toDelete;
847  TVITEM tvItem;
848  HTREEITEM parentNode;
849 
850  if (!NavigateToPIDL(idl, &toDelete, FALSE, FALSE, FALSE))
851  return FALSE;
852 
853  // TODO: check that the treeview item is really deleted
854 
855  parentNode = TreeView_GetParent(m_hWnd, toDelete);
856  // Navigate to parent when deleting child item
857  if (!m_pDesktop->CompareIDs(0, idl, m_pidlCurrent))
858  {
859  TreeView_SelectItem(m_hWnd, parentNode);
860  }
861 
862  // Remove the child item
863  TreeView_DeleteItem(m_hWnd, toDelete);
864  // Probe parent to see if it has children
865  if (!TreeView_GetChild(m_hWnd, parentNode))
866  {
867  // Decrement parent's child count
868  ZeroMemory(&tvItem, sizeof(tvItem));
869  tvItem.mask = TVIF_CHILDREN;
870  tvItem.hItem = parentNode;
871  tvItem.cChildren = 0;
872  TreeView_SetItem(m_hWnd, &tvItem);
873  }
874  return TRUE;
875 }
BOOL NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect)
#define TRUE
Definition: types.h:120
LPITEMIDLIST m_pidlCurrent
Definition: explorerband.h:66
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
#define ZeroMemory
Definition: winbase.h:1667
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
int cChildren
Definition: treeview.c:154
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define FALSE
Definition: types.h:117
#define TreeView_DeleteItem(hwnd, hitem)
Definition: commctrl.h:3415
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3469
#define TVITEM
Definition: commctrl.h:3365
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3497

Referenced by OnShellEvent().

◆ DestroyExplorerBand()

void CExplorerBand::DestroyExplorerBand ( )
private

Definition at line 230 of file explorerband.cpp.

231 {
232  HRESULT hr;
233  CComPtr <IWebBrowser2> browserService;
234 
235  TRACE("Cleaning up explorer band ...\n");
236 
237  hr = IUnknown_QueryService(m_pSite, SID_SWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &browserService));
238  if (FAILED_UNEXPECTEDLY(hr))
239  return;
240 
241  hr = AtlUnadvise(browserService, DIID_DWebBrowserEvents, m_adviseCookie);
242  /* Remove all items of the treeview */
243  RevokeDragDrop(m_hWnd);
244  TreeView_DeleteAllItems(m_hWnd);
245  m_pDesktop = NULL;
246  m_hRoot = NULL;
247  TRACE("Cleanup done !\n");
248 }
DWORD m_adviseCookie
Definition: explorerband.h:69
HRESULT hr
Definition: shlfolder.c:183
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3417
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:639
HTREEITEM m_hRoot
Definition: explorerband.h:64
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
#define SID_SWebBrowserApp
Definition: shlguid.h:111
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID *iid, DWORD dw)
Definition: atl.c:73
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define NULL
Definition: types.h:112

Referenced by SetSite().

◆ DragEnter()

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

Implements IDropTarget.

Definition at line 1449 of file explorerband.cpp.

1450 {
1451  ERR("Entering drag\n");
1452  m_pCurObject = pObj;
1454  return DragOver(glfKeyState, pt, pdwEffect);
1455 }
HTREEITEM m_oldSelected
Definition: explorerband.h:65
#define pt(x, y)
Definition: drawing.c:79
CComPtr< IDataObject > m_pCurObject
Definition: explorerband.h:75
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
#define ERR(fmt,...)
Definition: debug.h:110

◆ DragLeave()

HRESULT STDMETHODCALLTYPE CExplorerBand::DragLeave ( void  )
virtual

Implements IDropTarget.

Definition at line 1535 of file explorerband.cpp.

1536 {
1537  m_bNavigating = TRUE;
1539  m_bNavigating = FALSE;
1541  if (m_pCurObject)
1542  {
1543  m_pCurObject = NULL;
1544  }
1545  return S_OK;
1546 }
HTREEITEM m_oldSelected
Definition: explorerband.h:65
#define TRUE
Definition: types.h:120
BOOL m_bNavigating
Definition: explorerband.h:60
#define FALSE
Definition: types.h:117
HTREEITEM m_childTargetNode
Definition: explorerband.h:74
CComPtr< IDataObject > m_pCurObject
Definition: explorerband.h:75
#define S_OK
Definition: intsafe.h:52
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
#define NULL
Definition: types.h:112

Referenced by Drop().

◆ DragOver()

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

Implements IDropTarget.

Definition at line 1457 of file explorerband.cpp.

1458 {
1460  CComPtr<IShellFolder> pShellFldr;
1461  NodeInfo *nodeInfo;
1462  //LPCITEMIDLIST pChild;
1463  HRESULT hr;
1464 
1465  info.pt.x = pt.x;
1466  info.pt.y = pt.y;
1467  info.flags = TVHT_ONITEM;
1468  info.hItem = NULL;
1469  ScreenToClient(&info.pt);
1470 
1471  // Move to the item selected by the treeview (don't change right pane)
1472  TreeView_HitTest(m_hWnd, &info);
1473 
1474  if (info.hItem)
1475  {
1476  m_bNavigating = TRUE;
1477  TreeView_SelectItem(m_hWnd, info.hItem);
1478  m_bNavigating = FALSE;
1479  // Delegate to shell folder
1480  if (m_pDropTarget && info.hItem != m_childTargetNode)
1481  {
1482  m_pDropTarget = NULL;
1483  }
1484  if (info.hItem != m_childTargetNode)
1485  {
1486  nodeInfo = GetNodeInfo(info.hItem);
1487  if (!nodeInfo)
1488  return E_FAIL;
1489 #if 0
1490  hr = SHBindToParent(nodeInfo->absolutePidl, IID_PPV_ARG(IShellFolder, &pShellFldr), &pChild);
1491  if (!SUCCEEDED(hr))
1492  return E_FAIL;
1493  hr = pShellFldr->GetUIObjectOf(m_hWnd, 1, &pChild, IID_IDropTarget, NULL, reinterpret_cast<void**>(&pDropTarget));
1494  if (!SUCCEEDED(hr))
1495  return E_FAIL;
1496 #endif
1497  if(_ILIsDesktop(nodeInfo->absolutePidl))
1498  pShellFldr = m_pDesktop;
1499  else
1500  {
1501  hr = m_pDesktop->BindToObject(nodeInfo->absolutePidl, 0, IID_PPV_ARG(IShellFolder, &pShellFldr));
1502  if (!SUCCEEDED(hr))
1503  {
1504  /* Don't allow dnd since we couldn't get our folder object */
1505  ERR("Can't bind to folder object\n");
1506  *pdwEffect = DROPEFFECT_NONE;
1507  return E_FAIL;
1508  }
1509  }
1510  hr = pShellFldr->CreateViewObject(m_hWnd, IID_PPV_ARG(IDropTarget, &m_pDropTarget));
1511  if (!SUCCEEDED(hr))
1512  {
1513  /* Don't allow dnd since we couldn't get our drop target */
1514  ERR("Can't get drop target for folder object\n");
1515  *pdwEffect = DROPEFFECT_NONE;
1516  return E_FAIL;
1517  }
1518  hr = m_pDropTarget->DragEnter(m_pCurObject, glfKeyState, pt, pdwEffect);
1519  m_childTargetNode = info.hItem;
1520  }
1521  if (m_pDropTarget)
1522  {
1523  hr = m_pDropTarget->DragOver(glfKeyState, pt, pdwEffect);
1524  }
1525  }
1526  else
1527  {
1529  m_pDropTarget = NULL;
1530  *pdwEffect = DROPEFFECT_NONE;
1531  }
1532  return S_OK;
1533 }
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
NodeInfo * GetNodeInfo(HTREEITEM hItem)
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
BOOL m_bNavigating
Definition: explorerband.h:60
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
const DWORD DROPEFFECT_NONE
Definition: oleidl.idl:929
#define FALSE
Definition: types.h:117
static struct _test_info info[]
Definition: SetCursorPos.c:19
if SUCCEEDED(hr)
HTREEITEM m_childTargetNode
Definition: explorerband.h:74
CComPtr< IDataObject > m_pCurObject
Definition: explorerband.h:75
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
CComPtr< IDropTarget > m_pDropTarget
Definition: explorerband.h:73
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3513
LONG HRESULT
Definition: typedefs.h:79
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
#define NULL
Definition: types.h:112
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define TVHT_ONITEM
Definition: commctrl.h:3527

Referenced by DragEnter().

◆ Drop()

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

Implements IDropTarget.

Definition at line 1548 of file explorerband.cpp.

1549 {
1550  if (!m_pDropTarget)
1551  return E_FAIL;
1552  m_pDropTarget->Drop(pObj, glfKeyState, pt, pdwEffect);
1553  DragLeave();
1554  return S_OK;
1555 }
#define pt(x, y)
Definition: drawing.c:79
#define E_FAIL
Definition: ddrawi.h:102
CComPtr< IDropTarget > m_pDropTarget
Definition: explorerband.h:73
virtual HRESULT STDMETHODCALLTYPE DragLeave()
#define S_OK
Definition: intsafe.h:52

◆ Exec()

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

Implements IOleCommandTarget.

Definition at line 1181 of file explorerband.cpp.

1182 {
1183  UNIMPLEMENTED;
1184  return E_NOTIMPL;
1185 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ ExecuteCommand()

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

Definition at line 263 of file explorerband.cpp.

264 {
265  CComPtr<IOleWindow> pBrowserOleWnd;
266  CMINVOKECOMMANDINFO cmi;
267  HWND browserWnd;
268  HRESULT hr;
269 
271  if (FAILED_UNEXPECTEDLY(hr))
272  return hr;
273 
274  hr = pBrowserOleWnd->GetWindow(&browserWnd);
275  if (FAILED_UNEXPECTEDLY(hr))
276  return hr;
277 
278  ZeroMemory(&cmi, sizeof(cmi));
279  cmi.cbSize = sizeof(cmi);
280  cmi.lpVerb = MAKEINTRESOURCEA(nCmd);
281  cmi.hwnd = browserWnd;
282  if (GetKeyState(VK_SHIFT) & 0x8000)
283  cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
284  if (GetKeyState(VK_CONTROL) & 0x8000)
285  cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
286 
287  return menu->InvokeCommand(&cmi);
288 }
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1667
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
#define VK_SHIFT
Definition: winuser.h:2192
SHORT WINAPI GetKeyState(_In_ int)
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define VK_CONTROL
Definition: winuser.h:2193
#define SID_SShellBrowser
Definition: shlguid.h:128

Referenced by OnContextMenu().

◆ GetBandInfo()

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

Implements IDeskBand.

Definition at line 1061 of file explorerband.cpp.

1062 {
1063  if (!pdbi)
1064  {
1065  return E_INVALIDARG;
1066  }
1067  this->m_dwBandID = dwBandID;
1068 
1069  if (pdbi->dwMask & DBIM_MINSIZE)
1070  {
1071  pdbi->ptMinSize.x = 200;
1072  pdbi->ptMinSize.y = 30;
1073  }
1074 
1075  if (pdbi->dwMask & DBIM_MAXSIZE)
1076  {
1077  pdbi->ptMaxSize.y = -1;
1078  }
1079 
1080  if (pdbi->dwMask & DBIM_INTEGRAL)
1081  {
1082  pdbi->ptIntegral.y = 1;
1083  }
1084 
1085  if (pdbi->dwMask & DBIM_ACTUAL)
1086  {
1087  pdbi->ptActual.x = 200;
1088  pdbi->ptActual.y = 30;
1089  }
1090 
1091  if (pdbi->dwMask & DBIM_TITLE)
1092  {
1093  if (!LoadStringW(_AtlBaseModule.GetResourceInstance(), IDS_FOLDERSLABEL, pdbi->wszTitle, _countof(pdbi->wszTitle)))
1094  return HRESULT_FROM_WIN32(GetLastError());
1095  }
1096 
1097  if (pdbi->dwMask & DBIM_MODEFLAGS)
1098  {
1099  pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_VARIABLEHEIGHT;
1100  }
1101 
1102  if (pdbi->dwMask & DBIM_BKCOLOR)
1103  {
1104  pdbi->dwMask &= ~DBIM_BKCOLOR;
1105  }
1106  return S_OK;
1107 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
DWORD m_dwBandID
Definition: explorerband.h:62
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define _countof(array)
Definition: sndvol32.h:68
#define IDS_FOLDERSLABEL
Definition: resource.h:127
#define S_OK
Definition: intsafe.h:52

◆ GetClassID()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetClassID ( CLSID pClassID)
virtual

Implements IPersist.

Definition at line 1231 of file explorerband.cpp.

1232 {
1233  if (!pClassID)
1234  return E_POINTER;
1235  memcpy(pClassID, &CLSID_ExplorerBand, sizeof(CLSID));
1236  return S_OK;
1237 }
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:52
#define E_POINTER
Definition: winerror.h:2365

◆ GetIDsOfNames()

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

Implements IDispatch.

Definition at line 1428 of file explorerband.cpp.

1429 {
1430  UNIMPLEMENTED;
1431  return E_NOTIMPL;
1432 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ GetNavigateTarget()

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

Definition at line 1385 of file explorerband.cpp.

1386 {
1387  UNIMPLEMENTED;
1388  return E_NOTIMPL;
1389 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ GetNodeInfo()

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

Definition at line 250 of file explorerband.cpp.

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

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

◆ GetSite()

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

Definition at line 1165 of file explorerband.cpp.

1166 {
1167  if (!ppvSite)
1168  return E_POINTER;
1169  *ppvSite = m_pSite;
1170  return S_OK;
1171 }
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
#define S_OK
Definition: intsafe.h:52
#define E_POINTER
Definition: winerror.h:2365

◆ GetSizeMax()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetSizeMax ( ULARGE_INTEGER pcbSize)
virtual

Implements IPersistStream.

Definition at line 1259 of file explorerband.cpp.

1260 {
1261  // TODO: calculate max size
1262  UNIMPLEMENTED;
1263  return E_NOTIMPL;
1264 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ GetTypeInfo()

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

Implements IDispatch.

Definition at line 1422 of file explorerband.cpp.

1423 {
1424  UNIMPLEMENTED;
1425  return E_NOTIMPL;
1426 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ GetTypeInfoCount()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetTypeInfoCount ( UINT pctinfo)
virtual

Implements IDispatch.

Definition at line 1416 of file explorerband.cpp.

1417 {
1418  UNIMPLEMENTED;
1419  return E_NOTIMPL;
1420 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ GetWindow()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetWindow ( HWND lphwnd)
virtual

Implements IOleWindow.

Definition at line 1023 of file explorerband.cpp.

1024 {
1025  if (!lphwnd)
1026  return E_INVALIDARG;
1027  *lphwnd = m_hWnd;
1028  return S_OK;
1029 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:52

◆ GiveFeedback()

HRESULT STDMETHODCALLTYPE CExplorerBand::GiveFeedback ( DWORD  dwEffect)
virtual

Implements IDropSource.

Definition at line 1567 of file explorerband.cpp.

1568 {
1570 }
#define DRAGDROP_S_USEDEFAULTCURSORS
Definition: winerror.h:2648

◆ HasFocusIO()

HRESULT STDMETHODCALLTYPE CExplorerBand::HasFocusIO ( )
virtual

Definition at line 1213 of file explorerband.cpp.

1214 {
1215  return m_bFocused ? S_OK : S_FALSE;
1216 }
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:52

◆ InitializeExplorerBand()

void CExplorerBand::InitializeExplorerBand ( )
private

Definition at line 164 of file explorerband.cpp.

165 {
166  // Init the treeview here
167  HRESULT hr;
168  LPITEMIDLIST pidl;
169  CComPtr<IWebBrowser2> browserService;
170  SHChangeNotifyEntry shcne;
171 
173  if (FAILED_UNEXPECTEDLY(hr))
174  return;
175 
176  hr = SHGetFolderLocation(m_hWnd, CSIDL_DESKTOP, NULL, 0, &pidl);
177  if (FAILED_UNEXPECTEDLY(hr))
178  return;
179 
180  IImageList * piml;
182  if (FAILED_UNEXPECTEDLY(hr))
183  return;
184 
186 
187  // Insert the root node
188  m_hRoot = InsertItem(0, m_pDesktop, pidl, pidl, FALSE);
189  if (!m_hRoot)
190  {
191  ERR("Failed to create root item\n");
192  return;
193  }
194 
195  NodeInfo* pNodeInfo = GetNodeInfo(m_hRoot);
196 
197  // Insert child nodes
198  InsertSubitems(m_hRoot, pNodeInfo);
200 
201  // Navigate to current folder position
203 
204  // Register shell notification
205  shcne.pidl = pidl;
206  shcne.fRecursive = TRUE;
208  m_hWnd,
212  1,
213  &shcne);
214  if (!m_shellRegID)
215  {
216  ERR("Something went wrong, error %08x\n", GetLastError());
217  }
218  // Register browser connection endpoint
219  hr = IUnknown_QueryService(m_pSite, SID_SWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &browserService));
220  if (FAILED_UNEXPECTEDLY(hr))
221  return;
222 
223  hr = AtlAdvise(browserService, dynamic_cast<IDispatch*>(this), DIID_DWebBrowserEvents, &m_adviseCookie);
224  if (FAILED_UNEXPECTEDLY(hr))
225  return;
226 
227  ILFree(pidl);
228 }
#define SHCNE_MKDIR
Definition: shlobj.h:1732
#define SHCNE_RMDIR
Definition: shlobj.h:1733
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define SHCNE_DISKEVENTS
Definition: shlobj.h:1751
DWORD m_adviseCookie
Definition: explorerband.h:69
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD *pdw)
Definition: atl.c:45
#define TRUE
Definition: types.h:120
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
NodeInfo * GetNodeInfo(HTREEITEM hItem)
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1746
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
#define SHCNRF_RecursiveInterrupt
Definition: shlobj.h:1776
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
HTREEITEM m_hRoot
Definition: explorerband.h:64
#define WM_USER_SHELLEVENT
Definition: explorerband.h:24
#define FALSE
Definition: types.h:117
BOOL NavigateToCurrentFolder()
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
Definition: shellord.c:2406
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1774
#define SID_SWebBrowserApp
Definition: shlguid.h:111
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3447
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define SHCNRF_ShellLevel
Definition: shlobj.h:1775
#define TVE_EXPAND
Definition: commctrl.h:3423
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1725
#define ERR(fmt,...)
Definition: debug.h:110
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo)
ULONG m_shellRegID
Definition: explorerband.h:70
#define NULL
Definition: types.h:112
#define TVSIL_NORMAL
Definition: commctrl.h:3443
EXTERN_C ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, INT fSources, LONG wEventMask, UINT uMsg, INT cItems, SHChangeNotifyEntry *lpItems)
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2883
#define SHIL_SMALL
Definition: shellapi.h:183
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3420
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by SetSite().

◆ InsertItem() [1/2]

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

Definition at line 556 of file explorerband.cpp.

557 {
558  TV_INSERTSTRUCT tvInsert;
559  HTREEITEM htiCreated;
560 
561  /* Get the attributes of the node */
562  SFGAOF attrs = SFGAO_STREAM | SFGAO_HASSUBFOLDER;
563  HRESULT hr = psfParent->GetAttributesOf(1, &pEltRelative, &attrs);
564  if (FAILED_UNEXPECTEDLY(hr))
565  return NULL;
566 
567  /* Ignore streams */
568  if ((attrs & SFGAO_STREAM))
569  {
570  TRACE("Ignoring stream\n");
571  return NULL;
572  }
573 
574  /* Get the name of the node */
575  WCHAR wszDisplayName[MAX_PATH];
576  STRRET strret;
577  hr = psfParent->GetDisplayNameOf(pEltRelative, SHGDN_INFOLDER, &strret);
578  if (FAILED_UNEXPECTEDLY(hr))
579  return NULL;
580 
581  hr = StrRetToBufW(&strret, pEltRelative, wszDisplayName, MAX_PATH);
582  if (FAILED_UNEXPECTEDLY(hr))
583  return NULL;
584 
585  /* Get the icon of the node */
586  INT iIcon = SHMapPIDLToSystemImageListIndex(psfParent, pEltRelative, NULL);
587 
588  NodeInfo* pChildInfo = new NodeInfo;
589  if (!pChildInfo)
590  {
591  ERR("Failed to allocate NodeInfo\n");
592  return FALSE;
593  }
594 
595  // Store our node info
596  pChildInfo->absolutePidl = ILClone(pElt);
597  pChildInfo->relativePidl = ILClone(pEltRelative);
598  pChildInfo->expanded = FALSE;
599 
600  // Set up our treeview template
601  tvInsert.hParent = hParent;
602  tvInsert.hInsertAfter = TVI_LAST;
603  tvInsert.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN;
604  tvInsert.item.cchTextMax = MAX_PATH;
605  tvInsert.item.pszText = wszDisplayName;
606  tvInsert.item.iImage = tvInsert.item.iSelectedImage = iIcon;
607  tvInsert.item.cChildren = (attrs & SFGAO_HASSUBFOLDER) ? 1 : 0;
608  tvInsert.item.lParam = (LPARAM)pChildInfo;
609 
610  htiCreated = TreeView_InsertItem(m_hWnd, &tvInsert);
611 
612  if (bSort)
613  {
614  TVSORTCB sortCallback;
615  sortCallback.hParent = hParent;
616  sortCallback.lpfnCompare = CompareTreeItems;
617  sortCallback.lParam = (LPARAM)this;
618  SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
619  }
620 
621  return htiCreated;
622 }
HRESULT hr
Definition: shlfolder.c:183
#define TVM_SORTCHILDRENCB
Definition: commctrl.h:3547
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1522
static int CALLBACK CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3)
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3271
int32_t INT
Definition: typedefs.h:58
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3412
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define FALSE
Definition: types.h:117
HRESULT GetAttributesOf([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
LONG_PTR LPARAM
Definition: windef.h:208
#define TVI_LAST
Definition: commctrl.h:3370
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define MAX_PATH
Definition: compat.h:34
HTREEITEM hParent
Definition: commctrl.h:3614
#define ERR(fmt,...)
Definition: debug.h:110
PFNTVCOMPARE lpfnCompare
Definition: commctrl.h:3615
#define TVIF_TEXT
Definition: commctrl.h:3266
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define TVIF_IMAGE
Definition: commctrl.h:3267
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5833
int WINAPI SHMapPIDLToSystemImageListIndex(IShellFolder *sh, LPCITEMIDLIST pidl, int *pIndex)
Definition: iconcache.cpp:783
#define TVIF_PARAM
Definition: commctrl.h:3268
#define TV_INSERTSTRUCT
Definition: commctrl.h:3377
LPARAM lParam
Definition: commctrl.h:3616
static IShellFolder IShellItem **static IBindCtx LPITEMIDLIST SFGAOF
Definition: ebrowser.c:83

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 625 of file explorerband.cpp.

626 {
627  CComPtr<IShellFolder> psfFolder;
628  HRESULT hr = SHBindToParent(pElt, IID_PPV_ARG(IShellFolder, &psfFolder), NULL);
629  if (FAILED_UNEXPECTEDLY(hr))
630  return NULL;
631 
632  return InsertItem(hParent, psfFolder, pElt, pEltRelative, bSort);
633 }
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
#define NULL
Definition: types.h:112

◆ InsertSubitems()

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

Definition at line 635 of file explorerband.cpp.

636 {
637  CComPtr<IEnumIDList> pEnumIDList;
638  LPITEMIDLIST pidlSub;
640  SHCONTF EnumFlags;
641  HRESULT hr;
642  ULONG fetched;
643  ULONG uItemCount;
644  CComPtr<IShellFolder> pFolder;
645  TVSORTCB sortCallback;
646 
647  entry = pNodeInfo->absolutePidl;
648  fetched = 1;
649  uItemCount = 0;
650  EnumFlags = SHCONTF_FOLDERS;
651 
652  hr = SHGetFolderLocation(m_hWnd, CSIDL_DESKTOP, NULL, 0, &pidlSub);
653  if (!SUCCEEDED(hr))
654  {
655  ERR("Can't get desktop PIDL !\n");
656  return FALSE;
657  }
658 
659  if (!m_pDesktop->CompareIDs(NULL, pidlSub, entry))
660  {
661  // We are the desktop, so use pDesktop as pFolder
662  pFolder = m_pDesktop;
663  }
664  else
665  {
666  // Get an IShellFolder of our pidl
667  hr = m_pDesktop->BindToObject(entry, NULL, IID_PPV_ARG(IShellFolder, &pFolder));
668  if (!SUCCEEDED(hr))
669  {
670  ILFree(pidlSub);
671  ERR("Can't bind folder to desktop !\n");
672  return FALSE;
673  }
674  }
675  ILFree(pidlSub);
676 
677  // TODO: handle hidden folders according to settings !
678  EnumFlags |= SHCONTF_INCLUDEHIDDEN;
679 
680  // Enum through objects
681  hr = pFolder->EnumObjects(NULL,EnumFlags,&pEnumIDList);
682 
683  // avoid broken IShellFolder implementations that return null pointer with success
684  if (!SUCCEEDED(hr) || !pEnumIDList)
685  {
686  ERR("Can't enum the folder !\n");
687  return FALSE;
688  }
689 
690  /* Don't redraw while we add stuff into the tree */
692  while(SUCCEEDED(pEnumIDList->Next(1, &pidlSub, &fetched)) && pidlSub && fetched)
693  {
694  LPITEMIDLIST pidlSubComplete;
695  pidlSubComplete = ILCombine(entry, pidlSub);
696 
697  if (InsertItem(hItem, pFolder, pidlSubComplete, pidlSub, FALSE))
698  uItemCount++;
699  ILFree(pidlSubComplete);
700  ILFree(pidlSub);
701  }
702  pNodeInfo->expanded = TRUE;
703  /* Let's do sorting */
704  sortCallback.hParent = hItem;
705  sortCallback.lpfnCompare = CompareTreeItems;
706  sortCallback.lParam = (LPARAM)this;
707  SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
708 
709  /* Now we can redraw */
711 
712  return (uItemCount > 0) ? TRUE : FALSE;
713 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
#define TVM_SORTCHILDRENCB
Definition: commctrl.h:3547
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
#define WM_SETREDRAW
Definition: winuser.h:1606
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
static int CALLBACK CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3)
#define IID_PPV_ARG(Itype, ppType)
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
#define FALSE
Definition: types.h:117
if SUCCEEDED(hr)
HTREEITEM hItem
Definition: treelist.h:37
LONG_PTR LPARAM
Definition: windef.h:208
LONG HRESULT
Definition: typedefs.h:79
uint32_t entry
Definition: isohybrid.c:63
HTREEITEM hParent
Definition: commctrl.h:3614
#define ERR(fmt,...)
Definition: debug.h:110
PFNTVCOMPARE lpfnCompare
Definition: commctrl.h:3615
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5833
unsigned int ULONG
Definition: retypes.h:1
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2883
LPARAM lParam
Definition: commctrl.h:3616
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static SHCONTF
Definition: ordinal.c:61

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

◆ Invoke() [1/2]

HRESULT STDMETHODCALLTYPE CExplorerBand::Invoke ( long  paramC)
virtual

Definition at line 1391 of file explorerband.cpp.

1392 {
1393  UNIMPLEMENTED;
1394  return E_NOTIMPL;
1395 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ Invoke() [2/2]

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

Implements IDispatch.

Definition at line 1434 of file explorerband.cpp.

1435 {
1436  switch (dispIdMember)
1437  {
1440  TRACE("DISPID_NAVIGATECOMPLETE2 received\n");
1442  return S_OK;
1443  }
1444  TRACE("Unknown dispid requested: %08x\n", dispIdMember);
1445  return E_INVALIDARG;
1446 }
#define DISPID_DOWNLOADCOMPLETE
Definition: webchild.h:39
BOOL NavigateToCurrentFolder()
#define E_INVALIDARG
Definition: ddrawi.h:101
#define DISPID_NAVIGATECOMPLETE2
Definition: webchild.h:54
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52

◆ IsDirty()

HRESULT STDMETHODCALLTYPE CExplorerBand::IsDirty ( void  )
virtual

Implements IPersistStream.

Definition at line 1241 of file explorerband.cpp.

1242 {
1243  UNIMPLEMENTED;
1244  return E_NOTIMPL;
1245 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ IsWindowOwner()

HRESULT STDMETHODCALLTYPE CExplorerBand::IsWindowOwner ( HWND  hWnd)
virtual

Definition at line 1372 of file explorerband.cpp.

1373 {
1374  return (hWnd == m_hWnd) ? S_OK : S_FALSE;
1375 }
HWND hWnd
Definition: settings.c:17
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:52

◆ Load()

HRESULT STDMETHODCALLTYPE CExplorerBand::Load ( IStream pStm)
virtual

Implements IPersistStream.

Definition at line 1247 of file explorerband.cpp.

1248 {
1249  UNIMPLEMENTED;
1250  return E_NOTIMPL;
1251 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ NavigateToCurrentFolder()

BOOL CExplorerBand::NavigateToCurrentFolder ( )
private

Definition at line 815 of file explorerband.cpp.

816 {
817  LPITEMIDLIST explorerPidl;
818  CComPtr<IBrowserService> pBrowserService;
819  HRESULT hr;
821  BOOL result;
822  explorerPidl = NULL;
823 
824  hr = IUnknown_QueryService(m_pSite, SID_STopLevelBrowser, IID_PPV_ARG(IBrowserService, &pBrowserService));
825  if (!SUCCEEDED(hr))
826  {
827  ERR("Can't get IBrowserService !\n");
828  return FALSE;
829  }
830 
831  hr = pBrowserService->GetPidl(&explorerPidl);
832  if (!SUCCEEDED(hr) || !explorerPidl)
833  {
834  ERR("Unable to get browser PIDL !\n");
835  return FALSE;
836  }
838  /* find PIDL into our explorer */
839  result = NavigateToPIDL(explorerPidl, &dummy, TRUE, FALSE, TRUE);
841  return result;
842 }
BOOL NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect)
HRESULT hr
Definition: shlfolder.c:183
GLuint64EXT * result
Definition: glext.h:11304
#define TRUE
Definition: types.h:120
BOOL m_bNavigating
Definition: explorerband.h:60
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
LONG HRESULT
Definition: typedefs.h:79
#define ERR(fmt,...)
Definition: debug.h:110
unsigned char dummy
Definition: maze.c:118
#define NULL
Definition: types.h:112
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

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 723 of file explorerband.cpp.

725 {
727  HTREEITEM tmp;
729  NodeInfo *nodeData;
730  LPITEMIDLIST relativeChild;
731  TVITEM tvItem;
732 
733  if (!item)
734  return FALSE;
735 
736  current = m_hRoot;
737  parent = NULL;
738  while (TRUE)
739  {
740  nodeData = GetNodeInfo(current);
741  if (!nodeData)
742  {
743  ERR("Something has gone wrong, no data associated to node !\n");
744  *item = NULL;
745  return FALSE;
746  }
747  // If we found our node, give it back
748  if (!m_pDesktop->CompareIDs(0, nodeData->absolutePidl, dest))
749  {
750  if (bSelect)
751  TreeView_SelectItem(m_hWnd, current);
752  *item = current;
753  return TRUE;
754  }
755 
756  // Check if we are a parent of the requested item
757  relativeChild = ILFindChild(nodeData->absolutePidl, dest);
758  if (relativeChild != 0)
759  {
760  // Notify treeview we have children
761  tvItem.mask = TVIF_CHILDREN;
762  tvItem.hItem = current;
763  tvItem.cChildren = 1;
764  TreeView_SetItem(m_hWnd, &tvItem);
765 
766  // If we can expand and the node isn't expanded yet, do it
767  if (bExpand)
768  {
769  if (!nodeData->expanded)
770  InsertSubitems(current, nodeData);
772  }
773 
774  // Try to get a child
775  tmp = TreeView_GetChild(m_hWnd, current);
776  if (tmp)
777  {
778  // We have a child, let's continue with it
779  parent = current;
780  current = tmp;
781  continue;
782  }
783 
784  if (bInsert && nodeData->expanded)
785  {
786  // Happens when we have to create a subchild inside a child
787  current = InsertItem(current, dest, relativeChild, TRUE);
788  }
789  // We end up here, without any children, so we found nothing
790  // Tell the parent node it has children
791  ZeroMemory(&tvItem, sizeof(tvItem));
792  *item = NULL;
793  return FALSE;
794  }
795 
796  // Find sibling
797  tmp = TreeView_GetNextSibling(m_hWnd, current);
798  if (tmp)
799  {
800  current = tmp;
801  continue;
802  }
803  if (bInsert)
804  {
806  *item = current;
807  return TRUE;
808  }
809  *item = NULL;
810  return FALSE;
811  }
812  UNREACHABLE;
813 }
#define TRUE
Definition: types.h:120
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
NodeInfo * GetNodeInfo(HTREEITEM hItem)
#define ZeroMemory
Definition: winbase.h:1667
CComPtr< IShellFolder > m_pDesktop
Definition: explorerband.h:56
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3467
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
HTREEITEM m_hRoot
Definition: explorerband.h:64
#define TVIF_CHILDREN
Definition: commctrl.h:3272
#define FALSE
Definition: types.h:117
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
r parent
Definition: btrfs.c:2979
struct task_struct * current
Definition: linux.c:32
#define TVE_EXPAND
Definition: commctrl.h:3423
static BOOL bInsert
Definition: cmdinput.c:121
#define TVITEM
Definition: commctrl.h:3365
#define ERR(fmt,...)
Definition: debug.h:110
static ATOM item
Definition: dde.c:856
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo)
PUIDLIST_RELATIVE WINAPI ILFindChild(PIDLIST_ABSOLUTE pidl1, PCIDLIST_ABSOLUTE pidl2)
Definition: pidl.c:641
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
#define NULL
Definition: types.h:112
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3497
#define UNREACHABLE
static char * dest
Definition: rtl.c:135
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3420
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

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

◆ OnContextMenu()

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

Definition at line 399 of file explorerband.cpp.

400 {
401  HTREEITEM item;
402  NodeInfo *info;
403  HMENU treeMenu;
404  WORD x;
405  WORD y;
406  CComPtr<IShellFolder> pFolder;
407  CComPtr<IContextMenu> contextMenu;
408  HRESULT hr;
409  UINT uCommand;
410  LPITEMIDLIST pidlChild;
411 
412  treeMenu = NULL;
413  item = TreeView_GetSelection(m_hWnd);
414  bHandled = TRUE;
415  if (!item)
416  {
417  goto Cleanup;
418  }
419 
420  x = LOWORD(lParam);
421  y = HIWORD(lParam);
422  if (x == -1 && y == -1)
423  {
424  // TODO: grab position of tree item and position it correctly
425  }
426 
427  info = GetNodeInfo(item);
428  if (!info)
429  {
430  ERR("No node data, something has gone wrong !\n");
431  goto Cleanup;
432  }
433  hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pFolder),
434  (LPCITEMIDLIST*)&pidlChild);
435  if (!SUCCEEDED(hr))
436  {
437  ERR("Can't bind to folder!\n");
438  goto Cleanup;
439  }
440  hr = pFolder->GetUIObjectOf(m_hWnd, 1, (LPCITEMIDLIST*)&pidlChild, IID_IContextMenu,
441  NULL, reinterpret_cast<void**>(&contextMenu));
442  if (!SUCCEEDED(hr))
443  {
444  ERR("Can't get IContextMenu interface\n");
445  goto Cleanup;
446  }
447 
448  IUnknown_SetSite(contextMenu, (IDeskBand *)this);
449 
450  treeMenu = CreatePopupMenu();
451  hr = contextMenu->QueryContextMenu(treeMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST,
452  CMF_EXPLORE);
453  if (!SUCCEEDED(hr))
454  {
455  WARN("Can't get context menu for item\n");
456  DestroyMenu(treeMenu);
457  goto Cleanup;
458  }
460  x, y, 0, m_hWnd, NULL);
461 
462  ExecuteCommand(contextMenu, uCommand);
463 
464 Cleanup:
465  if (contextMenu)
466  IUnknown_SetSite(contextMenu, NULL);
467  if (treeMenu)
468  DestroyMenu(treeMenu);
472  return TRUE;
473 }
HRESULT hr
Definition: shlfolder.c:183
HTREEITEM m_oldSelected
Definition: explorerband.h:65
#define TRUE
Definition: types.h:120
#define TPM_LEFTALIGN
Definition: winuser.h:2367
#define TPM_RETURNCMD
Definition: winuser.h:2377
NodeInfo * GetNodeInfo(HTREEITEM hItem)
#define WARN(fmt,...)
Definition: debug.h:112
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:507
BOOL m_bNavigating
Definition: explorerband.h:60
#define IID_PPV_ARG(Itype, ppType)
HRESULT ExecuteCommand(CComPtr< IContextMenu > &menu, UINT nCmd)
#define TPM_RIGHTBUTTON
Definition: winuser.h:2370
#define FALSE
Definition: types.h:117
static struct _test_info info[]
Definition: SetCursorPos.c:19
if SUCCEEDED(hr)
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1404
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:541
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3473
LONG HRESULT
Definition: typedefs.h:79
unsigned short WORD
Definition: ntddk_ex.h:93
static const WCHAR Cleanup[]
Definition: register.c:80
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define ERR(fmt,...)
Definition: debug.h:110
static ATOM item
Definition: dde.c:856
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3481
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
#define TPM_LEFTBUTTON
Definition: winuser.h:2369
#define HIWORD(l)
Definition: typedefs.h:247
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define LOWORD(l)
Definition: pedump.c:82

Referenced by OnWinEvent().

◆ OnKillFocus()

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

Definition at line 548 of file explorerband.cpp.

549 {
550  IUnknown_OnFocusChangeIS(m_pSite, reinterpret_cast<IUnknown*>(this), FALSE);
551  bHandled = FALSE;
552  return TRUE;
553 }
#define TRUE
Definition: types.h:120
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4652
#define FALSE
Definition: types.h:117
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55

◆ OnSelectionChanged() [1/2]

void CExplorerBand::OnSelectionChanged ( LPNMTREEVIEW  pnmtv)
private

Definition at line 359 of file explorerband.cpp.

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

Referenced by OnWinEvent().

◆ OnSelectionChanged() [2/2]

HRESULT STDMETHODCALLTYPE CExplorerBand::OnSelectionChanged ( long  paramC)
virtual

Definition at line 1397 of file explorerband.cpp.

1398 {
1399  UNIMPLEMENTED;
1400  return E_NOTIMPL;
1401 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ OnSetFocus()

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

Definition at line 540 of file explorerband.cpp.

541 {
542  m_bFocused = TRUE;
543  IUnknown_OnFocusChangeIS(m_pSite, reinterpret_cast<IUnknown*>(this), TRUE);
544  bHandled = FALSE;
545  return TRUE;
546 }
#define TRUE
Definition: types.h:120
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4652
#define FALSE
Definition: types.h:117
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55

◆ OnShellEvent()

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

Definition at line 498 of file explorerband.cpp.

499 {
501  LPITEMIDLIST clean;
502  HTREEITEM pItem;
503 
505  /* TODO: handle shell notifications */
506  switch(lParam & ~SHCNE_INTERRUPT)
507  {
508  case SHCNE_MKDIR:
509  if (!SUCCEEDED(_ReparsePIDL(dest[0], &clean)))
510  {
511  ERR("Can't reparse PIDL to a valid one\n");
512  return FALSE;
513  }
514  NavigateToPIDL(clean, &pItem, FALSE, TRUE, FALSE);
515  ILFree(clean);
516  break;
517  case SHCNE_RMDIR:
518  DeleteItem(dest[0]);
519  break;
520  case SHCNE_RENAMEFOLDER:
521  if (!SUCCEEDED(_ReparsePIDL(dest[1], &clean)))
522  {
523  ERR("Can't reparse PIDL to a valid one\n");
524  return FALSE;
525  }
526  if (NavigateToPIDL(dest[0], &pItem, FALSE, FALSE, FALSE))
527  RenameItem(pItem, clean);
528  ILFree(clean);
529  break;
530  case SHCNE_UPDATEDIR:
531  // We don't take care of this message
532  TRACE("Directory updated\n");
533  break;
534  default:
535  TRACE("Unhandled message\n");
536  }
537  return TRUE;
538 }
#define SHCNE_MKDIR
Definition: shlobj.h:1732
BOOL NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect)
#define SHCNE_RMDIR
Definition: shlobj.h:1733
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define TRUE
Definition: types.h:120
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1746
#define SHCNE_INTERRUPT
Definition: shlobj.h:1754
HRESULT _ReparsePIDL(LPITEMIDLIST buggyPidl, LPITEMIDLIST *cleanPidl)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
BOOL DeleteItem(LPITEMIDLIST toDelete)
if SUCCEEDED(hr)
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:110
BOOL RenameItem(HTREEITEM toRename, LPITEMIDLIST newPidl)
#define SHCNE_UPDATEDIR
Definition: shlobj.h:1741
static char * dest
Definition: rtl.c:135
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139

◆ OnTreeItemDeleted()

BOOL CExplorerBand::OnTreeItemDeleted ( LPNMTREEVIEW  pnmtv)
private

Definition at line 346 of file explorerband.cpp.

347 {
348  /* Destroy memory associated to our node */
349  NodeInfo* ptr = GetNodeInfo(pnmtv->itemNew.hItem);
350  if (ptr)
351  {
352  ILFree(ptr->relativePidl);
353  ILFree(ptr->absolutePidl);
354  delete ptr;
355  }
356  return TRUE;
357 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define TRUE
Definition: types.h:120
NodeInfo * GetNodeInfo(HTREEITEM hItem)
static PVOID ptr
Definition: dispmode.c:27

Referenced by OnWinEvent().

◆ OnTreeItemDragging()

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

Definition at line 374 of file explorerband.cpp.

375 {
376  CComPtr<IShellFolder> pSrcFolder;
378  LPCITEMIDLIST pLast;
379  HRESULT hr;
380  DWORD dwEffect;
381  DWORD dwEffect2;
382 
383  dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
384  if (!pnmtv->itemNew.lParam)
385  return;
386  NodeInfo* pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
387  hr = SHBindToParent(pNodeInfo->absolutePidl, IID_PPV_ARG(IShellFolder, &pSrcFolder), &pLast);
388  if (!SUCCEEDED(hr))
389  return;
390  hr = pSrcFolder->GetUIObjectOf(m_hWnd, 1, &pLast, IID_IDataObject, 0, reinterpret_cast<void**>(&pObj));
391  if (!SUCCEEDED(hr))
392  return;
393  DoDragDrop(pObj, this, dwEffect, &dwEffect2);
394  return;
395 }
HRESULT hr
Definition: shlfolder.c:183
NodeInfo * GetNodeInfo(HTREEITEM hItem)
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
const GUID IID_IDataObject
#define IID_PPV_ARG(Itype, ppType)
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
if SUCCEEDED(hr)
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:753

Referenced by OnWinEvent().

◆ OnTreeItemExpanding()

BOOL CExplorerBand::OnTreeItemExpanding ( LPNMTREEVIEW  pnmtv)
private

Definition at line 312 of file explorerband.cpp.

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

Definition at line 1268 of file explorerband.cpp.

1269 {
1270  BOOL bHandled;
1271  LRESULT result;
1272 
1273  if (uMsg == WM_NOTIFY)
1274  {
1275  NMHDR *pNotifyHeader = (NMHDR*)lParam;
1276  switch (pNotifyHeader->code)
1277  {
1278  case TVN_ITEMEXPANDING:
1280  if (theResult)
1281  *theResult = result;
1282  break;
1283  case TVN_SELCHANGED:
1285  break;
1286  case TVN_DELETEITEM:
1288  break;
1289  case NM_RCLICK:
1290  OnContextMenu(WM_CONTEXTMENU, (WPARAM)m_hWnd, GetMessagePos(), bHandled);
1291  if (theResult)
1292  *theResult = 1;
1293  break;
1294  case TVN_BEGINDRAG:
1295  case TVN_BEGINRDRAG:
1297  case TVN_BEGINLABELEDITW:
1298  {
1299  // TODO: put this in a function ? (mostly copypasta from CDefView)
1300  DWORD dwAttr = SFGAO_CANRENAME;
1301  LPNMTVDISPINFO dispInfo = (LPNMTVDISPINFO)lParam;
1303  LPCITEMIDLIST pChild;
1304  HRESULT hr;
1305 
1306  if (theResult)
1307  *theResult = 1;
1308  NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
1309  if (!info)
1310  return E_FAIL;
1311  hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pParent), &pChild);
1312  if (!SUCCEEDED(hr) || !pParent.p)
1313  return E_FAIL;
1314 
1315  hr = pParent->GetAttributesOf(1, &pChild, &dwAttr);
1316  if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME) && theResult)
1317  *theResult = 0;
1318  return S_OK;
1319  }
1320  case TVN_ENDLABELEDITW:
1321  {
1322  LPNMTVDISPINFO dispInfo = (LPNMTVDISPINFO)lParam;
1323  NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
1324  HRESULT hr;
1325 
1326  if (theResult)
1327  *theResult = 0;
1328  if (dispInfo->item.pszText)
1329  {
1330  LPITEMIDLIST pidlNew;
1332  LPCITEMIDLIST pidlChild;
1333 
1334  hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pParent), &pidlChild);
1335  if (!SUCCEEDED(hr) || !pParent.p)
1336  return E_FAIL;
1337 
1338  hr = pParent->SetNameOf(0, pidlChild, dispInfo->item.pszText, SHGDN_INFOLDER, &pidlNew);
1339  if(SUCCEEDED(hr) && pidlNew)
1340  {
1341  CComPtr<IPersistFolder2> pPersist;
1342  LPITEMIDLIST pidlParent, pidlNewAbs;
1343 
1345  if(!SUCCEEDED(hr))
1346  return E_FAIL;
1347 
1348  hr = pPersist->GetCurFolder(&pidlParent);
1349  if(!SUCCEEDED(hr))
1350  return E_FAIL;
1351  pidlNewAbs = ILCombine(pidlParent, pidlNew);
1352 
1353  // Navigate to our new location
1354  UpdateBrowser(pidlNewAbs);
1355 
1356  ILFree(pidlParent);
1357  ILFree(pidlNewAbs);
1358  ILFree(pidlNew);
1359  if (theResult)
1360  *theResult = 1;
1361  }
1362  return S_OK;
1363  }
1364  }
1365  default:
1366  break;
1367  }
1368  }
1369  return S_OK;
1370 }
BOOL OnTreeItemDeleted(LPNMTREEVIEW pnmtv)
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define WM_CONTEXTMENU
Definition: richedit.h:64
HRESULT hr
Definition: shlfolder.c:183
GLuint64EXT * result
Definition: glext.h:11304
void OnSelectionChanged(LPNMTREEVIEW pnmtv)
NodeInfo * GetNodeInfo(HTREEITEM hItem)
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define LPNMTREEVIEW
Definition: commctrl.h:3643
UINT_PTR WPARAM
Definition: windef.h:207
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351
#define TVN_BEGINDRAG
Definition: commctrl.h:3740
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
UINT code
Definition: winuser.h:3149
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3712
BOOL OnTreeItemExpanding(LPNMTREEVIEW pnmtv)
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
#define TVN_BEGINRDRAG
Definition: commctrl.h:3741
HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto)
LONG HRESULT
Definition: typedefs.h:79
#define TVN_SELCHANGED
Definition: commctrl.h:3735
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TVN_BEGINLABELEDITW
Definition: commctrl.h:3710
void OnTreeItemDragging(LPNMTREEVIEW pnmtv, BOOL isRightClick)
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3738
#define S_OK
Definition: intsafe.h:52
#define TVN_DELETEITEM
Definition: commctrl.h:3742
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
#define NM_RCLICK
Definition: commctrl.h:133
#define LPNMTVDISPINFO
Definition: commctrl.h:3676
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
FxObject * pParent
Definition: fxdpcapi.cpp:86
virtual _Must_inspect_result_ NTSTATUS QueryInterface(__in FxQueryInterfaceParams *Params)
Definition: fxobject.cpp:255
LONG_PTR LRESULT
Definition: windef.h:209
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61

◆ QueryContinueDrag()

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

Implements IDropSource.

Definition at line 1558 of file explorerband.cpp.

1559 {
1560  if (fEscapePressed)
1561  return DRAGDROP_S_CANCEL;
1562  if ((grfKeyState & MK_LBUTTON) || (grfKeyState & MK_RBUTTON))
1563  return S_OK;
1564  return DRAGDROP_S_DROP;
1565 }
#define MK_LBUTTON
Definition: winuser.h:2357
#define DRAGDROP_S_CANCEL
Definition: winerror.h:2647
#define MK_RBUTTON
Definition: winuser.h:2358
#define S_OK
Definition: intsafe.h:52
#define DRAGDROP_S_DROP
Definition: winerror.h:2646

◆ QueryService()

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

Implements IServiceProvider.

Definition at line 1189 of file explorerband.cpp.

1190 {
1191  /* FIXME: we probably want to handle more services here */
1193 }
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define SID_SShellBrowser
Definition: shlguid.h:128

◆ QueryStatus()

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

Implements IOleCommandTarget.

Definition at line 1175 of file explorerband.cpp.

1176 {
1177  UNIMPLEMENTED;
1178  return E_NOTIMPL;
1179 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ RefreshFlags()

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

Definition at line 1403 of file explorerband.cpp.

1404 {
1405  UNIMPLEMENTED;
1406  return E_NOTIMPL;
1407 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ RefreshTreePidl()

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

Definition at line 927 of file explorerband.cpp.

928 {
929  HTREEITEM tmp;
930  NodeInfo *pInfo;
931 
932  // Update our node data
933  pInfo = GetNodeInfo(tree);
934  if (!pInfo)
935  {
936  WARN("No tree info !\n");
937  return FALSE;
938  }
939  ILFree(pInfo->absolutePidl);
940  pInfo->absolutePidl = ILCombine(pidlParent, pInfo->relativePidl);
941  if (!pInfo->absolutePidl)
942  {
943  WARN("PIDL allocation failed\n");
944  return FALSE;
945  }
946  // Recursively update children
947  if ((tmp = TreeView_GetChild(m_hWnd, tree)) != NULL)
948  {
949  RefreshTreePidl(tmp, pInfo->absolutePidl);
950  }
951 
952  tmp = TreeView_GetNextSibling(m_hWnd, tree);
953  while(tmp != NULL)
954  {
955  pInfo = GetNodeInfo(tmp);
956  if(!pInfo)
957  {
958  WARN("No tree info !\n");
959  continue;
960  }
961  ILFree(pInfo->absolutePidl);
962  pInfo->absolutePidl = ILCombine(pidlParent, pInfo->relativePidl);
963  tmp = TreeView_GetNextSibling(m_hWnd, tmp);
964  }
965  return TRUE;
966 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define TRUE
Definition: types.h:120
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
NodeInfo * GetNodeInfo(HTREEITEM hItem)
#define WARN(fmt,...)
Definition: debug.h:112
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3467
#define FALSE
Definition: types.h:117
BOOL RefreshTreePidl(HTREEITEM tree, LPITEMIDLIST pidlParent)
#define NULL
Definition: types.h:112

Referenced by RenameItem().

◆ RenameItem()

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

Definition at line 877 of file explorerband.cpp.

878 {
879  WCHAR wszDisplayName[MAX_PATH];
880  TVITEM itemInfo;
881  LPCITEMIDLIST relPidl;
882  NodeInfo *treeInfo;
883  TVSORTCB sortCallback;
885 
886  ZeroMemory(&itemInfo, sizeof(itemInfo));
887  itemInfo.mask = TVIF_PARAM;
888  itemInfo.hItem = toRename;
889 
890  // Change PIDL associated to the item
891  relPidl = ILFindLastID(newPidl);
892  TreeView_GetItem(m_hWnd, &itemInfo);
893  if (!itemInfo.lParam)
894  {
895  ERR("Unable to fetch lParam\n");
896  return FALSE;
897  }
899  treeInfo = (NodeInfo*)itemInfo.lParam;
900  ILFree(treeInfo->absolutePidl);
901  ILFree(treeInfo->relativePidl);
902  treeInfo->absolutePidl = ILClone(newPidl);
903  treeInfo->relativePidl = ILClone(relPidl);
904 
905  // Change the display name
906  GetDisplayName(newPidl, wszDisplayName, MAX_PATH, SHGDN_INFOLDER);
907  ZeroMemory(&itemInfo, sizeof(itemInfo));
908  itemInfo.hItem = toRename;
909  itemInfo.mask = TVIF_TEXT;
910  itemInfo.pszText = wszDisplayName;
911  TreeView_SetItem(m_hWnd, &itemInfo);
912 
913  if((child = TreeView_GetChild(m_hWnd, toRename)) != NULL)
914  {
915  RefreshTreePidl(child, newPidl);
916  }
917 
918  // Sorting
919  sortCallback.hParent = TreeView_GetParent(m_hWnd, toRename);
920  sortCallback.lpfnCompare = CompareTreeItems;
921  sortCallback.lParam = (LPARAM)this;
922  SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
924  return TRUE;
925 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define TRUE
Definition: types.h:120
#define TVM_SORTCHILDRENCB
Definition: commctrl.h:3547
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3466
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define WM_SETREDRAW
Definition: winuser.h:1606
#define ZeroMemory
Definition: winbase.h:1667
static int CALLBACK CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3)
static HWND child
Definition: cursoricon.c:298
#define FALSE
Definition: types.h:117
BOOL RefreshTreePidl(HTREEITEM tree, LPITEMIDLIST pidlParent)
LONG_PTR LPARAM
Definition: windef.h:208
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3469
HRESULT GetDisplayName(LPCITEMIDLIST pidlDirectory, TCHAR *szDisplayName, UINT cchMax, DWORD uFlags)
HTREEITEM hParent
Definition: commctrl.h:3614
#define TVITEM
Definition: commctrl.h:3365
#define ERR(fmt,...)
Definition: debug.h:110
PFNTVCOMPARE lpfnCompare
Definition: commctrl.h:3615
#define TVIF_TEXT
Definition: commctrl.h:3266
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define NULL
Definition: types.h:112
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3497
#define SendMessage
Definition: winuser.h:5833
#define TVIF_PARAM
Definition: commctrl.h:3268
LPARAM lParam
Definition: commctrl.h:3616
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3490

Referenced by OnShellEvent().

◆ ResizeBorderDW()

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

Definition at line 1046 of file explorerband.cpp.

1047 {
1048  /* Must return E_NOTIMPL according to MSDN */
1049  return E_NOTIMPL;
1050 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Save()

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

Implements IPersistStream.

Definition at line 1253 of file explorerband.cpp.

1254 {
1255  UNIMPLEMENTED;
1256  return E_NOTIMPL;
1257 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ Select()

HRESULT STDMETHODCALLTYPE CExplorerBand::Select ( long  paramC)
virtual

Definition at line 1378 of file explorerband.cpp.

1379 {
1380  UNIMPLEMENTED;
1381  return E_NOTIMPL;
1382 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ SetSite()

HRESULT STDMETHODCALLTYPE CExplorerBand::SetSite ( IUnknown pUnkSite)
virtual

Implements IObjectWithSite.

Definition at line 1111 of file explorerband.cpp.

1112 {
1113  HRESULT hr;
1114  HWND parentWnd;
1115 
1116  if (pUnkSite == m_pSite)
1117  return S_OK;
1118 
1119  TRACE("SetSite called \n");
1120  if (!pUnkSite)
1121  {
1123  DestroyWindow();
1124  m_hWnd = NULL;
1125  }
1126 
1127  if (pUnkSite != m_pSite)
1128  {
1129  m_pSite = NULL;
1130  }
1131 
1132  if(!pUnkSite)
1133  return S_OK;
1134 
1135  hr = IUnknown_GetWindow(pUnkSite, &parentWnd);
1136  if (!SUCCEEDED(hr))
1137  {
1138  ERR("Could not get parent's window ! Status: %08lx\n", hr);
1139  return E_INVALIDARG;
1140  }
1141 
1142  m_pSite = pUnkSite;
1143 
1144  if (m_hWnd)
1145  {
1146  // Change its parent
1147  SetParent(parentWnd);
1148  }
1149  else
1150  {
1152  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
1153  0, 0, 0, 0, parentWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
1154 
1155  // Subclass the window
1156  SubclassWindow(wnd);
1157 
1158  // Initialize our treeview now
1160  RegisterDragDrop(m_hWnd, dynamic_cast<IDropTarget*>(this));
1161  }
1162  return S_OK;
1163 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define CreateWindow
Definition: winuser.h:5744
HRESULT hr
Definition: shlfolder.c:183
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:557
#define WS_CHILD
Definition: pedump.c:617
#define WS_CLIPCHILDREN
Definition: pedump.c:619
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1329
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:517
if SUCCEEDED(hr)
#define TVS_HASBUTTONS
Definition: commctrl.h:3247
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define WC_TREEVIEW
Definition: commctrl.h:3245
LONG HRESULT
Definition: typedefs.h:79
void InitializeExplorerBand()
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3252
#define TVS_HASLINES
Definition: commctrl.h:3248
#define TVS_EDITLABELS
Definition: commctrl.h:3250
void DestroyExplorerBand()

◆ ShowDW()

HRESULT STDMETHODCALLTYPE CExplorerBand::ShowDW ( BOOL  fShow)
virtual

Implements IDockingWindow.

Definition at line 1052 of file explorerband.cpp.

1053 {
1054  m_fVisible = fShow;
1055  ShowWindow(fShow);
1056  return S_OK;
1057 }
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define S_OK
Definition: intsafe.h:52

◆ TranslateAcceleratorIO()

HRESULT STDMETHODCALLTYPE CExplorerBand::TranslateAcceleratorIO ( LPMSG  lpMsg)
virtual

Definition at line 1218 of file explorerband.cpp.

1219 {
1220  if (lpMsg->hwnd == m_hWnd)
1221  {
1222  TranslateMessage(lpMsg);
1223  DispatchMessage(lpMsg);
1224  return S_OK;
1225  }
1226 
1227  return S_FALSE;
1228 }
#define DispatchMessage
Definition: winuser.h:5755
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:52
HWND hwnd
Definition: winuser.h:3104

◆ UIActivateIO()

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

Definition at line 1197 of file explorerband.cpp.

1198 {
1199  if (fActivate)
1200  {
1201  //SetFocus();
1202  SetActiveWindow();
1203  }
1204  // TODO: handle message
1205  if(lpMsg)
1206  {
1207  TranslateMessage(lpMsg);
1208  DispatchMessage(lpMsg);
1209  }
1210  return S_OK;
1211 }
#define DispatchMessage
Definition: winuser.h:5755
BOOL WINAPI TranslateMessage(_In_ const MSG *)
HWND WINAPI SetActiveWindow(_In_ HWND)
#define S_OK
Definition: intsafe.h:52

◆ UpdateBrowser()

HRESULT CExplorerBand::UpdateBrowser ( LPITEMIDLIST  pidlGoto)
private

Definition at line 290 of file explorerband.cpp.

291 {
292  CComPtr<IShellBrowser> pBrowserService;
293  HRESULT hr;
294 
295  hr = IUnknown_QueryService(m_pSite, SID_STopLevelBrowser, IID_PPV_ARG(IShellBrowser, &pBrowserService));
296  if (FAILED_UNEXPECTEDLY(hr))
297  return hr;
298 
299  hr = pBrowserService->BrowseObject(pidlGoto, SBSP_SAMEBROWSER | SBSP_ABSOLUTE);
300  if (FAILED_UNEXPECTEDLY(hr))
301  return hr;
302 
303  if (m_pidlCurrent)
304  {
306  m_pidlCurrent = ILClone(pidlGoto);
307  }
308  return hr;
309 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HRESULT hr
Definition: shlfolder.c:183
LPITEMIDLIST m_pidlCurrent
Definition: explorerband.h:66
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
CComPtr< IUnknown > m_pSite
Definition: explorerband.h:55
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228

Referenced by OnSelectionChanged(), and OnWinEvent().

Member Data Documentation

◆ m_adviseCookie

DWORD CExplorerBand::m_adviseCookie
private

Definition at line 69 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 74 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 63 of file explorerband.h.

◆ m_hRoot

HTREEITEM CExplorerBand::m_hRoot
private

◆ m_oldSelected

HTREEITEM CExplorerBand::m_oldSelected
private

Definition at line 65 of file explorerband.h.

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

◆ m_pCurObject

CComPtr<IDataObject> CExplorerBand::m_pCurObject
private

Definition at line 75 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 73 of file explorerband.h.

Referenced by DragOver(), and Drop().

◆ m_pidlCurrent

LPITEMIDLIST CExplorerBand::m_pidlCurrent
private

Definition at line 66 of file explorerband.h.

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

◆ m_pSite

◆ m_shellRegID

ULONG CExplorerBand::m_shellRegID
private

Definition at line 70 of file explorerband.h.

Referenced by InitializeExplorerBand().


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