ReactOS  0.4.14-dev-838-g99f979d
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< IUnknownpSite
 
CComPtr< IShellFolderpDesktop
 
BOOL fVisible
 
BOOL bNavigating
 
BOOL bFocused
 
DWORD dwBandID
 
HIMAGELIST hImageList
 
HTREEITEM hRoot
 
HTREEITEM oldSelected
 
LPITEMIDLIST pidlCurrent
 
DWORD adviseCookie
 
ULONG shellRegID
 
CComPtr< IDropTargetpDropTarget
 
HTREEITEM childTargetNode
 
CComPtr< IDataObjectpCurObject
 

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 26 of file explorerband.h.

Constructor & Destructor Documentation

◆ CExplorerBand()

CExplorerBand::CExplorerBand ( )

Definition at line 146 of file explorerband.cpp.

146  :
148 {
149 }
smooth NULL
Definition: ftsmooth.c:416
CComPtr< IUnknown > pSite
Definition: explorerband.h:54
LPITEMIDLIST pidlCurrent
Definition: explorerband.h:65

◆ ~CExplorerBand()

CExplorerBand::~CExplorerBand ( )
virtual

Definition at line 151 of file explorerband.cpp.

152 {
153  if(pidlCurrent)
154  {
156  }
157 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
LPITEMIDLIST pidlCurrent
Definition: explorerband.h:65

Member Function Documentation

◆ CacheItem()

HRESULT STDMETHODCALLTYPE CExplorerBand::CacheItem ( long  paramC)
virtual

Definition at line 1406 of file explorerband.cpp.

1407 {
1408  UNIMPLEMENTED;
1409  return E_NOTIMPL;
1410 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ CloseDW()

HRESULT STDMETHODCALLTYPE CExplorerBand::CloseDW ( DWORD  dwReserved)
virtual

Implements IDockingWindow.

Definition at line 1036 of file explorerband.cpp.

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

◆ CompareTreeItems()

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

Definition at line 966 of file explorerband.cpp.

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

471 {
472  bHandled = FALSE;
473  if (uMsg == WM_RBUTTONDOWN)
474  {
476  info.pt.x = LOWORD(lParam);
477  info.pt.y = HIWORD(lParam);
478  info.flags = TVHT_ONITEM;
479  info.hItem = NULL;
480 
481  // Save the current location
483 
484  // Move to the item selected by the treeview (don't change right pane)
485  TreeView_HitTest(m_hWnd, &info);
486  bNavigating = TRUE;
487  TreeView_SelectItem(m_hWnd, info.hItem);
488  bNavigating = FALSE;
489  }
490  return FALSE; /* let the wndproc process the message */
491 }
#define TRUE
Definition: types.h:120
HTREEITEM oldSelected
Definition: explorerband.h:64
struct _test_info info[]
Definition: SetCursorPos.c:19
smooth NULL
Definition: ftsmooth.c:416
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3469
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3509
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3477
#define HIWORD(l)
Definition: typedefs.h:246
#define TVHT_ONITEM
Definition: commctrl.h:3523
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 1028 of file explorerband.cpp.

1029 {
1030  UNIMPLEMENTED;
1031  return E_NOTIMPL;
1032 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ DeleteItem()

BOOL CExplorerBand::DeleteItem ( LPITEMIDLIST  toDelete)
private

Definition at line 841 of file explorerband.cpp.

842 {
843  HTREEITEM toDelete;
844  TVITEM tvItem;
845  HTREEITEM parentNode;
846 
847  if (!NavigateToPIDL(idl, &toDelete, FALSE, FALSE, FALSE))
848  return FALSE;
849 
850  // TODO: check that the treeview item is really deleted
851 
852  parentNode = TreeView_GetParent(m_hWnd, toDelete);
853  // Navigate to parent when deleting child item
854  if (!pDesktop->CompareIDs(0, idl, pidlCurrent))
855  {
856  TreeView_SelectItem(m_hWnd, parentNode);
857  }
858 
859  // Remove the child item
860  TreeView_DeleteItem(m_hWnd, toDelete);
861  // Probe parent to see if it has children
862  if (!TreeView_GetChild(m_hWnd, parentNode))
863  {
864  // Decrement parent's child count
865  ZeroMemory(&tvItem, sizeof(tvItem));
866  tvItem.mask = TVIF_CHILDREN;
867  tvItem.hItem = parentNode;
868  tvItem.cChildren = 0;
869  TreeView_SetItem(m_hWnd, &tvItem);
870  }
871  return TRUE;
872 }
BOOL NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect)
#define TRUE
Definition: types.h:120
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3462
#define ZeroMemory
Definition: winbase.h:1642
int cChildren
Definition: treeview.c:154
#define TVIF_CHILDREN
Definition: commctrl.h:3268
#define TreeView_DeleteItem(hwnd, hitem)
Definition: commctrl.h:3411
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3465
#define TVITEM
Definition: commctrl.h:3361
CComPtr< IShellFolder > pDesktop
Definition: explorerband.h:55
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3477
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3493
LPITEMIDLIST pidlCurrent
Definition: explorerband.h:65

Referenced by OnShellEvent().

◆ DestroyExplorerBand()

void CExplorerBand::DestroyExplorerBand ( )
private

Definition at line 225 of file explorerband.cpp.

226 {
227  HRESULT hr;
228  CComPtr <IWebBrowser2> browserService;
229 
230  TRACE("Cleaning up explorer band ...\n");
231 
232  hr = IUnknown_QueryService(pSite, SID_SWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &browserService));
233  if (FAILED_UNEXPECTEDLY(hr))
234  return;
235 
236  hr = AtlUnadvise(browserService, DIID_DWebBrowserEvents, adviseCookie);
237  /* Remove all items of the treeview */
238  RevokeDragDrop(m_hWnd);
239  TreeView_DeleteAllItems(m_hWnd);
240  pDesktop = NULL;
241  hRoot = NULL;
242  TRACE("Cleanup done !\n");
243 }
HRESULT hr
Definition: shlfolder.c:183
#define TreeView_DeleteAllItems(hwnd)
Definition: commctrl.h:3413
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:639
smooth NULL
Definition: ftsmooth.c:416
#define SID_SWebBrowserApp
Definition: shlguid.h:108
#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:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
HTREEITEM hRoot
Definition: explorerband.h:63
DWORD adviseCookie
Definition: explorerband.h:68
CComPtr< IShellFolder > pDesktop
Definition: explorerband.h:55
CComPtr< IUnknown > pSite
Definition: explorerband.h:54

Referenced by SetSite().

◆ DragEnter()

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

Implements IDropTarget.

Definition at line 1446 of file explorerband.cpp.

1447 {
1448  ERR("Entering drag\n");
1449  pCurObject = pObj;
1451  return DragOver(glfKeyState, pt, pdwEffect);
1452 }
CComPtr< IDataObject > pCurObject
Definition: explorerband.h:74
#define pt(x, y)
Definition: drawing.c:79
HTREEITEM oldSelected
Definition: explorerband.h:64
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3469
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD glfKeyState, POINTL pt, DWORD *pdwEffect)
#define ERR(fmt,...)
Definition: debug.h:109

◆ DragLeave()

HRESULT STDMETHODCALLTYPE CExplorerBand::DragLeave ( void  )
virtual

Implements IDropTarget.

Definition at line 1532 of file explorerband.cpp.

1533 {
1534  bNavigating = TRUE;
1536  bNavigating = FALSE;
1538  if (pCurObject)
1539  {
1540  pCurObject = NULL;
1541  }
1542  return S_OK;
1543 }
CComPtr< IDataObject > pCurObject
Definition: explorerband.h:74
#define TRUE
Definition: types.h:120
HTREEITEM oldSelected
Definition: explorerband.h:64
smooth NULL
Definition: ftsmooth.c:416
HTREEITEM childTargetNode
Definition: explorerband.h:73
#define S_OK
Definition: intsafe.h:59
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3477

Referenced by Drop().

◆ DragOver()

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

Implements IDropTarget.

Definition at line 1454 of file explorerband.cpp.

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

Referenced by DragEnter().

◆ Drop()

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

Implements IDropTarget.

Definition at line 1545 of file explorerband.cpp.

1546 {
1547  if (!pDropTarget)
1548  return E_FAIL;
1549  pDropTarget->Drop(pObj, glfKeyState, pt, pdwEffect);
1550  DragLeave();
1551  return S_OK;
1552 }
#define pt(x, y)
Definition: drawing.c:79
#define E_FAIL
Definition: ddrawi.h:102
CComPtr< IDropTarget > pDropTarget
Definition: explorerband.h:72
virtual HRESULT STDMETHODCALLTYPE DragLeave()
#define S_OK
Definition: intsafe.h:59

◆ Exec()

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

Implements IOleCommandTarget.

Definition at line 1178 of file explorerband.cpp.

1179 {
1180  UNIMPLEMENTED;
1181  return E_NOTIMPL;
1182 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ ExecuteCommand()

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

Definition at line 258 of file explorerband.cpp.

259 {
260  CComPtr<IOleWindow> pBrowserOleWnd;
261  CMINVOKECOMMANDINFO cmi;
262  HWND browserWnd;
263  HRESULT hr;
264 
266  if (FAILED_UNEXPECTEDLY(hr))
267  return hr;
268 
269  hr = pBrowserOleWnd->GetWindow(&browserWnd);
270  if (FAILED_UNEXPECTEDLY(hr))
271  return hr;
272 
273  ZeroMemory(&cmi, sizeof(cmi));
274  cmi.cbSize = sizeof(cmi);
275  cmi.lpVerb = MAKEINTRESOURCEA(nCmd);
276  cmi.hwnd = browserWnd;
277  if (GetKeyState(VK_SHIFT) & 0x8000)
278  cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
279  if (GetKeyState(VK_CONTROL) & 0x8000)
280  cmi.fMask |= CMIC_MASK_CONTROL_DOWN;
281 
282  return menu->InvokeCommand(&cmi);
283 }
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1642
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
#define VK_SHIFT
Definition: winuser.h:2177
SHORT WINAPI GetKeyState(_In_ int)
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
CComPtr< IUnknown > pSite
Definition: explorerband.h:54
#define VK_CONTROL
Definition: winuser.h:2178
#define SID_SShellBrowser
Definition: shlguid.h:125

Referenced by OnContextMenu().

◆ GetBandInfo()

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

Implements IDeskBand.

Definition at line 1058 of file explorerband.cpp.

1059 {
1060  if (!pdbi)
1061  {
1062  return E_INVALIDARG;
1063  }
1064  this->dwBandID = dwBandID;
1065 
1066  if (pdbi->dwMask & DBIM_MINSIZE)
1067  {
1068  pdbi->ptMinSize.x = 200;
1069  pdbi->ptMinSize.y = 30;
1070  }
1071 
1072  if (pdbi->dwMask & DBIM_MAXSIZE)
1073  {
1074  pdbi->ptMaxSize.y = -1;
1075  }
1076 
1077  if (pdbi->dwMask & DBIM_INTEGRAL)
1078  {
1079  pdbi->ptIntegral.y = 1;
1080  }
1081 
1082  if (pdbi->dwMask & DBIM_ACTUAL)
1083  {
1084  pdbi->ptActual.x = 200;
1085  pdbi->ptActual.y = 30;
1086  }
1087 
1088  if (pdbi->dwMask & DBIM_TITLE)
1089  {
1090  if (!LoadStringW(_AtlBaseModule.GetResourceInstance(), IDS_FOLDERSLABEL, pdbi->wszTitle, _countof(pdbi->wszTitle)))
1091  return HRESULT_FROM_WIN32(GetLastError());
1092  }
1093 
1094  if (pdbi->dwMask & DBIM_MODEFLAGS)
1095  {
1096  pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_VARIABLEHEIGHT;
1097  }
1098 
1099  if (pdbi->dwMask & DBIM_BKCOLOR)
1100  {
1101  pdbi->dwMask &= ~DBIM_BKCOLOR;
1102  }
1103  return S_OK;
1104 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define _countof(array)
Definition: fontsub.cpp:30
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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 IDS_FOLDERSLABEL
Definition: resource.h:124
#define S_OK
Definition: intsafe.h:59

◆ GetClassID()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetClassID ( CLSID pClassID)
virtual

Implements IPersist.

Definition at line 1228 of file explorerband.cpp.

1229 {
1230  if (!pClassID)
1231  return E_POINTER;
1232  memcpy(pClassID, &CLSID_ExplorerBand, sizeof(CLSID));
1233  return S_OK;
1234 }
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
#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 1425 of file explorerband.cpp.

1426 {
1427  UNIMPLEMENTED;
1428  return E_NOTIMPL;
1429 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ GetNavigateTarget()

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

Definition at line 1382 of file explorerband.cpp.

1383 {
1384  UNIMPLEMENTED;
1385  return E_NOTIMPL;
1386 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ GetNodeInfo()

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

Definition at line 245 of file explorerband.cpp.

246 {
247  TVITEM tvItem;
248 
249  tvItem.mask = TVIF_PARAM;
250  tvItem.hItem = hItem;
251 
252  if (!TreeView_GetItem(m_hWnd, &tvItem))
253  return 0;
254 
255  return reinterpret_cast<NodeInfo*>(tvItem.lParam);
256 }
HTREEITEM hItem
Definition: treelist.h:37
#define TVITEM
Definition: commctrl.h:3361
#define TVIF_PARAM
Definition: commctrl.h:3264
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3486

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

1163 {
1164  if (!ppvSite)
1165  return E_POINTER;
1166  *ppvSite = pSite;
1167  return S_OK;
1168 }
#define S_OK
Definition: intsafe.h:59
CComPtr< IUnknown > pSite
Definition: explorerband.h:54
#define E_POINTER
Definition: winerror.h:2365

◆ GetSizeMax()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetSizeMax ( ULARGE_INTEGER pcbSize)
virtual

Implements IPersistStream.

Definition at line 1256 of file explorerband.cpp.

1257 {
1258  // TODO: calculate max size
1259  UNIMPLEMENTED;
1260  return E_NOTIMPL;
1261 }
#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 1419 of file explorerband.cpp.

1420 {
1421  UNIMPLEMENTED;
1422  return E_NOTIMPL;
1423 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ GetTypeInfoCount()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetTypeInfoCount ( UINT pctinfo)
virtual

Implements IDispatch.

Definition at line 1413 of file explorerband.cpp.

1414 {
1415  UNIMPLEMENTED;
1416  return E_NOTIMPL;
1417 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ GetWindow()

HRESULT STDMETHODCALLTYPE CExplorerBand::GetWindow ( HWND lphwnd)
virtual

Implements IOleWindow.

Definition at line 1020 of file explorerband.cpp.

1021 {
1022  if (!lphwnd)
1023  return E_INVALIDARG;
1024  *lphwnd = m_hWnd;
1025  return S_OK;
1026 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:59

◆ GiveFeedback()

HRESULT STDMETHODCALLTYPE CExplorerBand::GiveFeedback ( DWORD  dwEffect)
virtual

Implements IDropSource.

Definition at line 1564 of file explorerband.cpp.

1565 {
1567 }
#define DRAGDROP_S_USEDEFAULTCURSORS
Definition: winerror.h:2648

◆ HasFocusIO()

HRESULT STDMETHODCALLTYPE CExplorerBand::HasFocusIO ( )
virtual

Definition at line 1210 of file explorerband.cpp.

1211 {
1212  return bFocused ? S_OK : S_FALSE;
1213 }
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:59

◆ InitializeExplorerBand()

void CExplorerBand::InitializeExplorerBand ( )
private

Definition at line 159 of file explorerband.cpp.

160 {
161  // Init the treeview here
162  HRESULT hr;
163  LPITEMIDLIST pidl;
164  CComPtr<IWebBrowser2> browserService;
165  SHChangeNotifyEntry shcne;
166 
168  if (FAILED_UNEXPECTEDLY(hr))
169  return;
170 
171  hr = SHGetFolderLocation(m_hWnd, CSIDL_DESKTOP, NULL, 0, &pidl);
172  if (FAILED_UNEXPECTEDLY(hr))
173  return;
174 
175  IImageList * piml;
177  if (FAILED_UNEXPECTEDLY(hr))
178  return;
179 
181 
182  // Insert the root node
183  hRoot = InsertItem(0, pDesktop, pidl, pidl, FALSE);
184  if (!hRoot)
185  {
186  ERR("Failed to create root item\n");
187  return;
188  }
189 
190  NodeInfo* pNodeInfo = GetNodeInfo(hRoot);
191 
192  // Insert child nodes
193  InsertSubitems(hRoot, pNodeInfo);
194  TreeView_Expand(m_hWnd, hRoot, TVE_EXPAND);
195 
196  // Navigate to current folder position
198 
199  // Register shell notification
200  shcne.pidl = pidl;
201  shcne.fRecursive = TRUE;
203  m_hWnd,
207  1,
208  &shcne);
209  if (!shellRegID)
210  {
211  ERR("Something went wrong, error %08x\n", GetLastError());
212  }
213  // Register browser connection endpoint
214  hr = IUnknown_QueryService(pSite, SID_SWebBrowserApp, IID_PPV_ARG(IWebBrowser2, &browserService));
215  if (FAILED_UNEXPECTEDLY(hr))
216  return;
217 
218  hr = AtlAdvise(browserService, dynamic_cast<IDispatch*>(this), DIID_DWebBrowserEvents, &adviseCookie);
219  if (FAILED_UNEXPECTEDLY(hr))
220  return;
221 
222  ILFree(pidl);
223 }
#define SHCNE_MKDIR
Definition: shlobj.h:1731
ULONG WINAPI SHChangeNotifyRegister(HWND hwnd, int fSources, LONG wEventMask, UINT uMsg, int cItems, SHChangeNotifyEntry *lpItems)
Definition: changenotify.c:215
#define TRUE
Definition: types.h:120
#define SHCNE_RMDIR
Definition: shlobj.h:1732
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define SHCNE_DISKEVENTS
Definition: shlobj.h:1750
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, DWORD *pdw)
Definition: atl.c:45
#define CSIDL_DESKTOP
Definition: shlobj.h:2011
NodeInfo * GetNodeInfo(HTREEITEM hItem)
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1745
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define SHCNRF_RecursiveInterrupt
Definition: shlobj.h:1775
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
ULONG shellRegID
Definition: explorerband.h:69
#define WM_USER_SHELLEVENT
Definition: explorerband.h:23
BOOL NavigateToCurrentFolder()
HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
Definition: shellord.c:2013
#define SHCNRF_InterruptLevel
Definition: shlobj.h:1773
smooth NULL
Definition: ftsmooth.c:416
#define SID_SWebBrowserApp
Definition: shlguid.h:108
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3443
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define SHCNRF_ShellLevel
Definition: shlobj.h:1774
HTREEITEM hRoot
Definition: explorerband.h:63
#define TVE_EXPAND
Definition: commctrl.h:3419
PCIDLIST_ABSOLUTE pidl
Definition: shlobj.h:1724
DWORD adviseCookie
Definition: explorerband.h:68
#define ERR(fmt,...)
Definition: debug.h:109
CComPtr< IShellFolder > pDesktop
Definition: explorerband.h:55
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo)
CComPtr< IUnknown > pSite
Definition: explorerband.h:54
#define TVSIL_NORMAL
Definition: commctrl.h:3439
HRESULT WINAPI SHGetFolderLocation(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2606
#define SHIL_SMALL
Definition: shellapi.h:183
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3416
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 551 of file explorerband.cpp.

552 {
553  TV_INSERTSTRUCT tvInsert;
554  HTREEITEM htiCreated;
555 
556  /* Get the attributes of the node */
557  SFGAOF attrs = SFGAO_STREAM | SFGAO_HASSUBFOLDER;
558  HRESULT hr = psfParent->GetAttributesOf(1, &pEltRelative, &attrs);
559  if (FAILED_UNEXPECTEDLY(hr))
560  return NULL;
561 
562  /* Ignore streams */
563  if ((attrs & SFGAO_STREAM))
564  {
565  TRACE("Ignoring stream\n");
566  return NULL;
567  }
568 
569  /* Get the name of the node */
570  WCHAR wszDisplayName[MAX_PATH];
571  STRRET strret;
572  hr = psfParent->GetDisplayNameOf(pEltRelative, SHGDN_INFOLDER, &strret);
573  if (FAILED_UNEXPECTEDLY(hr))
574  return NULL;
575 
576  hr = StrRetToBufW(&strret, pEltRelative, wszDisplayName, MAX_PATH);
577  if (FAILED_UNEXPECTEDLY(hr))
578  return NULL;
579 
580  /* Get the icon of the node */
581  INT iIcon = SHMapPIDLToSystemImageListIndex(psfParent, pEltRelative, NULL);
582 
583  NodeInfo* pChildInfo = new NodeInfo;
584  if (!pChildInfo)
585  {
586  ERR("Failed to allocate NodeInfo\n");
587  return FALSE;
588  }
589 
590  // Store our node info
591  pChildInfo->absolutePidl = ILClone(pElt);
592  pChildInfo->relativePidl = ILClone(pEltRelative);
593  pChildInfo->expanded = FALSE;
594 
595  // Set up our treeview template
596  tvInsert.hParent = hParent;
597  tvInsert.hInsertAfter = TVI_LAST;
598  tvInsert.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN;
599  tvInsert.item.cchTextMax = MAX_PATH;
600  tvInsert.item.pszText = wszDisplayName;
601  tvInsert.item.iImage = tvInsert.item.iSelectedImage = iIcon;
602  tvInsert.item.cChildren = (attrs & SFGAO_HASSUBFOLDER) ? 1 : 0;
603  tvInsert.item.lParam = (LPARAM)pChildInfo;
604 
605  htiCreated = TreeView_InsertItem(m_hWnd, &tvInsert);
606 
607  if (bSort)
608  {
609  TVSORTCB sortCallback;
610  sortCallback.hParent = hParent;
611  sortCallback.lpfnCompare = CompareTreeItems;
612  sortCallback.lParam = (LPARAM)this;
613  SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
614  }
615 
616  return htiCreated;
617 }
HRESULT hr
Definition: shlfolder.c:183
#define TVM_SORTCHILDRENCB
Definition: commctrl.h:3543
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:3267
int32_t INT
Definition: typedefs.h:56
HRESULT GetDisplayNameOf([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3408
#define TVIF_CHILDREN
Definition: commctrl.h:3268
HRESULT GetAttributesOf([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define TVI_LAST
Definition: commctrl.h:3366
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:26
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
HTREEITEM hParent
Definition: commctrl.h:3610
#define ERR(fmt,...)
Definition: debug.h:109
PFNTVCOMPARE lpfnCompare
Definition: commctrl.h:3611
#define TVIF_TEXT
Definition: commctrl.h:3262
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define TVIF_IMAGE
Definition: commctrl.h:3263
#define SendMessage
Definition: winuser.h:5818
int WINAPI SHMapPIDLToSystemImageListIndex(IShellFolder *sh, LPCITEMIDLIST pidl, int *pIndex)
Definition: iconcache.cpp:789
#define TVIF_PARAM
Definition: commctrl.h:3264
#define TV_INSERTSTRUCT
Definition: commctrl.h:3373
LPARAM lParam
Definition: commctrl.h:3612
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 620 of file explorerband.cpp.

621 {
622  CComPtr<IShellFolder> psfFolder;
623  HRESULT hr = SHBindToParent(pElt, IID_PPV_ARG(IShellFolder, &psfFolder), NULL);
624  if (FAILED_UNEXPECTEDLY(hr))
625  return NULL;
626 
627  return InsertItem(hParent, psfFolder, pElt, pEltRelative, bSort);
628 }
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
const DOCKBAR PVOID HWND hParent
Definition: tooldock.h:22
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1323

◆ InsertSubitems()

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

Definition at line 630 of file explorerband.cpp.

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

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

◆ Invoke() [1/2]

HRESULT STDMETHODCALLTYPE CExplorerBand::Invoke ( long  paramC)
virtual

Definition at line 1388 of file explorerband.cpp.

1389 {
1390  UNIMPLEMENTED;
1391  return E_NOTIMPL;
1392 }
#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 1431 of file explorerband.cpp.

1432 {
1433  switch (dispIdMember)
1434  {
1437  TRACE("DISPID_NAVIGATECOMPLETE2 received\n");
1439  return S_OK;
1440  }
1441  TRACE("Unknown dispid requested: %08x\n", dispIdMember);
1442  return E_INVALIDARG;
1443 }
#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:59

◆ IsDirty()

HRESULT STDMETHODCALLTYPE CExplorerBand::IsDirty ( void  )
virtual

Implements IPersistStream.

Definition at line 1238 of file explorerband.cpp.

1239 {
1240  UNIMPLEMENTED;
1241  return E_NOTIMPL;
1242 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ IsWindowOwner()

HRESULT STDMETHODCALLTYPE CExplorerBand::IsWindowOwner ( HWND  hWnd)
virtual

Definition at line 1369 of file explorerband.cpp.

1370 {
1371  return (hWnd == m_hWnd) ? S_OK : S_FALSE;
1372 }
HWND hWnd
Definition: settings.c:17
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:59

◆ Load()

HRESULT STDMETHODCALLTYPE CExplorerBand::Load ( IStream pStm)
virtual

Implements IPersistStream.

Definition at line 1244 of file explorerband.cpp.

1245 {
1246  UNIMPLEMENTED;
1247  return E_NOTIMPL;
1248 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ NavigateToCurrentFolder()

BOOL CExplorerBand::NavigateToCurrentFolder ( )
private

Definition at line 812 of file explorerband.cpp.

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

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

720 {
722  HTREEITEM tmp;
724  BOOL found;
725  NodeInfo *nodeData;
726  LPITEMIDLIST relativeChild;
727  TVITEM tvItem;
728 
729  if (!item)
730  return FALSE;
731 
732  found = FALSE;
733  current = hRoot;
734  parent = NULL;
735  while(!found)
736  {
737  nodeData = GetNodeInfo(current);
738  if (!nodeData)
739  {
740  ERR("Something has gone wrong, no data associated to node !\n");
741  *item = NULL;
742  return FALSE;
743  }
744  // If we found our node, give it back
745  if (!pDesktop->CompareIDs(0, nodeData->absolutePidl, dest))
746  {
747  if (bSelect)
748  TreeView_SelectItem(m_hWnd, current);
749  *item = current;
750  return TRUE;
751  }
752 
753  // Check if we are a parent of the requested item
754  relativeChild = ILFindChild(nodeData->absolutePidl, dest);
755  if (relativeChild != 0)
756  {
757  // Notify treeview we have children
758  tvItem.mask = TVIF_CHILDREN;
759  tvItem.hItem = current;
760  tvItem.cChildren = 1;
761  TreeView_SetItem(m_hWnd, &tvItem);
762 
763  // If we can expand and the node isn't expanded yet, do it
764  if (bExpand)
765  {
766  if (!nodeData->expanded)
767  InsertSubitems(current, nodeData);
769  }
770 
771  // Try to get a child
772  tmp = TreeView_GetChild(m_hWnd, current);
773  if (tmp)
774  {
775  // We have a child, let's continue with it
776  parent = current;
777  current = tmp;
778  continue;
779  }
780 
781  if (bInsert && nodeData->expanded)
782  {
783  // Happens when we have to create a subchild inside a child
784  current = InsertItem(current, dest, relativeChild, TRUE);
785  }
786  // We end up here, without any children, so we found nothing
787  // Tell the parent node it has children
788  ZeroMemory(&tvItem, sizeof(tvItem));
789  *item = NULL;
790  return FALSE;
791  }
792 
793  // Find sibling
794  tmp = TreeView_GetNextSibling(m_hWnd, current);
795  if (tmp)
796  {
797  current = tmp;
798  continue;
799  }
800  if (bInsert)
801  {
803  *item = current;
804  return TRUE;
805  }
806  *item = NULL;
807  return FALSE;
808  }
809  return FALSE;
810 }
#define TRUE
Definition: types.h:120
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3462
NodeInfo * GetNodeInfo(HTREEITEM hItem)
#define ZeroMemory
Definition: winbase.h:1642
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3463
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort)
#define TVIF_CHILDREN
Definition: commctrl.h:3268
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
r parent
Definition: btrfs.c:2869
HTREEITEM hRoot
Definition: explorerband.h:63
#define TVE_EXPAND
Definition: commctrl.h:3419
static BOOL bInsert
Definition: cmdinput.c:121
#define TVITEM
Definition: commctrl.h:3361
#define ERR(fmt,...)
Definition: debug.h:109
CComPtr< IShellFolder > pDesktop
Definition: explorerband.h:55
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:3477
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3493
static char * dest
Definition: rtl.c:135
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3416
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
struct task_struct * current
Definition: linux.c:32

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

◆ OnContextMenu()

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

Definition at line 394 of file explorerband.cpp.

395 {
396  HTREEITEM item;
397  NodeInfo *info;
398  HMENU treeMenu;
399  WORD x;
400  WORD y;
401  CComPtr<IShellFolder> pFolder;
402  CComPtr<IContextMenu> contextMenu;
403  HRESULT hr;
404  UINT uCommand;
405  LPITEMIDLIST pidlChild;
406 
407  treeMenu = NULL;
408  item = TreeView_GetSelection(m_hWnd);
409  bHandled = TRUE;
410  if (!item)
411  {
412  goto Cleanup;
413  }
414 
415  x = LOWORD(lParam);
416  y = HIWORD(lParam);
417  if (x == -1 && y == -1)
418  {
419  // TODO: grab position of tree item and position it correctly
420  }
421 
422  info = GetNodeInfo(item);
423  if (!info)
424  {
425  ERR("No node data, something has gone wrong !\n");
426  goto Cleanup;
427  }
428  hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pFolder),
429  (LPCITEMIDLIST*)&pidlChild);
430  if (!SUCCEEDED(hr))
431  {
432  ERR("Can't bind to folder!\n");
433  goto Cleanup;
434  }
435  hr = pFolder->GetUIObjectOf(m_hWnd, 1, (LPCITEMIDLIST*)&pidlChild, IID_IContextMenu,
436  NULL, reinterpret_cast<void**>(&contextMenu));
437  if (!SUCCEEDED(hr))
438  {
439  ERR("Can't get IContextMenu interface\n");
440  goto Cleanup;
441  }
442 
443  IUnknown_SetSite(contextMenu, (IDeskBand *)this);
444 
445  treeMenu = CreatePopupMenu();
446  hr = contextMenu->QueryContextMenu(treeMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST,
447  CMF_EXPLORE);
448  if (!SUCCEEDED(hr))
449  {
450  WARN("Can't get context menu for item\n");
451  DestroyMenu(treeMenu);
452  goto Cleanup;
453  }
455  x, y, 0, m_hWnd, NULL);
456 
457  ExecuteCommand(contextMenu, uCommand);
458 
459 Cleanup:
460  if (contextMenu)
461  IUnknown_SetSite(contextMenu, NULL);
462  if (treeMenu)
463  DestroyMenu(treeMenu);
464  bNavigating = TRUE;
466  bNavigating = FALSE;
467  return TRUE;
468 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define TPM_LEFTALIGN
Definition: winuser.h:2352
#define TPM_RETURNCMD
Definition: winuser.h:2362
NodeInfo * GetNodeInfo(HTREEITEM hItem)
#define WARN(fmt,...)
Definition: debug.h:111
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
HTREEITEM oldSelected
Definition: explorerband.h:64
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:507
#define IID_PPV_ARG(Itype, ppType)
struct _test_info info[]
Definition: SetCursorPos.c:19
HRESULT ExecuteCommand(CComPtr< IContextMenu > &menu, UINT nCmd)
#define TPM_RIGHTBUTTON
Definition: winuser.h:2355
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1358
smooth NULL
Definition: ftsmooth.c:416
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:540
#define TreeView_GetSelection(hwnd)
Definition: commctrl.h:3469
LONG HRESULT
Definition: typedefs.h:77
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:109
static ATOM item
Definition: dde.c:856
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1323
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3477
unsigned int UINT
Definition: ndis.h:50
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:2354
#define HIWORD(l)
Definition: typedefs.h:246
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
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by OnWinEvent().

◆ OnKillFocus()

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

Definition at line 543 of file explorerband.cpp.

544 {
545  IUnknown_OnFocusChangeIS(pSite, reinterpret_cast<IUnknown*>(this), FALSE);
546  bHandled = FALSE;
547  return TRUE;
548 }
#define TRUE
Definition: types.h:120
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4594
CComPtr< IUnknown > pSite
Definition: explorerband.h:54

◆ OnSelectionChanged() [1/2]

void CExplorerBand::OnSelectionChanged ( LPNMTREEVIEW  pnmtv)
private

Definition at line 354 of file explorerband.cpp.

355 {
356  NodeInfo* pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
357 
358  /* Prevents navigation if selection is initiated inside the band */
359  if (bNavigating)
360  return;
361 
362  UpdateBrowser(pNodeInfo->absolutePidl);
363 
364  SetFocus();
365  // Expand the node
366  //TreeView_Expand(m_hWnd, pnmtv->itemNew.hItem, TVE_EXPAND);
367 }
NodeInfo * GetNodeInfo(HTREEITEM hItem)
HWND WINAPI SetFocus(_In_opt_ HWND)
HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto)

Referenced by OnWinEvent().

◆ OnSelectionChanged() [2/2]

HRESULT STDMETHODCALLTYPE CExplorerBand::OnSelectionChanged ( long  paramC)
virtual

Definition at line 1394 of file explorerband.cpp.

1395 {
1396  UNIMPLEMENTED;
1397  return E_NOTIMPL;
1398 }
#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 535 of file explorerband.cpp.

536 {
537  bFocused = TRUE;
538  IUnknown_OnFocusChangeIS(pSite, reinterpret_cast<IUnknown*>(this), TRUE);
539  bHandled = FALSE;
540  return TRUE;
541 }
#define TRUE
Definition: types.h:120
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4594
CComPtr< IUnknown > pSite
Definition: explorerband.h:54

◆ OnShellEvent()

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

Definition at line 493 of file explorerband.cpp.

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

◆ OnTreeItemDeleted()

BOOL CExplorerBand::OnTreeItemDeleted ( LPNMTREEVIEW  pnmtv)
private

Definition at line 341 of file explorerband.cpp.

342 {
343  /* Destroy memory associated to our node */
344  NodeInfo* ptr = GetNodeInfo(pnmtv->itemNew.hItem);
345  if (ptr)
346  {
347  ILFree(ptr->relativePidl);
348  ILFree(ptr->absolutePidl);
349  delete ptr;
350  }
351  return TRUE;
352 }
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
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 369 of file explorerband.cpp.

370 {
371  CComPtr<IShellFolder> pSrcFolder;
373  LPCITEMIDLIST pLast;
374  HRESULT hr;
375  DWORD dwEffect;
376  DWORD dwEffect2;
377 
378  dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE;
379  if (!pnmtv->itemNew.lParam)
380  return;
381  NodeInfo* pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
382  hr = SHBindToParent(pNodeInfo->absolutePidl, IID_PPV_ARG(IShellFolder, &pSrcFolder), &pLast);
383  if (!SUCCEEDED(hr))
384  return;
385  hr = pSrcFolder->GetUIObjectOf(m_hWnd, 1, &pLast, IID_IDataObject, 0, reinterpret_cast<void**>(&pObj));
386  if (!SUCCEEDED(hr))
387  return;
388  DoDragDrop(pObj, this, dwEffect, &dwEffect2);
389  return;
390 }
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
LONG HRESULT
Definition: typedefs.h:77
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:1323
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:753
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by OnWinEvent().

◆ OnTreeItemExpanding()

BOOL CExplorerBand::OnTreeItemExpanding ( LPNMTREEVIEW  pnmtv)
private

Definition at line 307 of file explorerband.cpp.

308 {
309  NodeInfo *pNodeInfo;
310 
311  if (pnmtv->action == TVE_COLLAPSE) {
312  if (pnmtv->itemNew.hItem == hRoot)
313  {
314  // Prenvent root from collapsing
315  pnmtv->itemNew.mask |= TVIF_STATE;
316  pnmtv->itemNew.stateMask |= TVIS_EXPANDED;
317  pnmtv->itemNew.state &= ~TVIS_EXPANDED;
318  pnmtv->action = TVE_EXPAND;
319  return TRUE;
320  }
321  }
322  if (pnmtv->action == TVE_EXPAND) {
323  // Grab our directory PIDL
324  pNodeInfo = GetNodeInfo(pnmtv->itemNew.hItem);
325  // We have it, let's try
326  if (pNodeInfo && !pNodeInfo->expanded)
327  if (!InsertSubitems(pnmtv->itemNew.hItem, pNodeInfo)) {
328  // remove subitem "+" since we failed to add subitems
329  TV_ITEM tvItem;
330 
331  tvItem.mask = TVIF_CHILDREN;
332  tvItem.hItem = pnmtv->itemNew.hItem;
333  tvItem.cChildren = 0;
334 
335  TreeView_SetItem(m_hWnd, &tvItem);
336  }
337  }
338  return FALSE;
339 }
#define TRUE
Definition: types.h:120
NodeInfo * GetNodeInfo(HTREEITEM hItem)
#define TVIF_CHILDREN
Definition: commctrl.h:3268
#define TVE_COLLAPSE
Definition: commctrl.h:3418
HTREEITEM hRoot
Definition: explorerband.h:63
#define TVE_EXPAND
Definition: commctrl.h:3419
#define TVIS_EXPANDED
Definition: commctrl.h:3280
#define TV_ITEM
Definition: commctrl.h:3296
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo)
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3493
#define TVIF_STATE
Definition: commctrl.h:3265

Referenced by OnWinEvent().

◆ OnWinEvent()

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

Definition at line 1265 of file explorerband.cpp.

1266 {
1267  BOOL bHandled;
1268  LRESULT result;
1269 
1270  if (uMsg == WM_NOTIFY)
1271  {
1272  NMHDR *pNotifyHeader = (NMHDR*)lParam;
1273  switch (pNotifyHeader->code)
1274  {
1275  case TVN_ITEMEXPANDING:
1277  if (theResult)
1278  *theResult = result;
1279  break;
1280  case TVN_SELCHANGED:
1282  break;
1283  case TVN_DELETEITEM:
1285  break;
1286  case NM_RCLICK:
1287  OnContextMenu(WM_CONTEXTMENU, (WPARAM)m_hWnd, GetMessagePos(), bHandled);
1288  if (theResult)
1289  *theResult = 1;
1290  break;
1291  case TVN_BEGINDRAG:
1292  case TVN_BEGINRDRAG:
1294  case TVN_BEGINLABELEDITW:
1295  {
1296  // TODO: put this in a function ? (mostly copypasta from CDefView)
1297  DWORD dwAttr = SFGAO_CANRENAME;
1298  LPNMTVDISPINFO dispInfo = (LPNMTVDISPINFO)lParam;
1299  CComPtr<IShellFolder> pParent;
1300  LPCITEMIDLIST pChild;
1301  HRESULT hr;
1302 
1303  if (theResult)
1304  *theResult = 1;
1305  NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
1306  if (!info)
1307  return E_FAIL;
1308  hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pParent), &pChild);
1309  if (!SUCCEEDED(hr) || !pParent.p)
1310  return E_FAIL;
1311 
1312  hr = pParent->GetAttributesOf(1, &pChild, &dwAttr);
1313  if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME) && theResult)
1314  *theResult = 0;
1315  return S_OK;
1316  }
1317  case TVN_ENDLABELEDITW:
1318  {
1319  LPNMTVDISPINFO dispInfo = (LPNMTVDISPINFO)lParam;
1320  NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
1321  HRESULT hr;
1322 
1323  if (theResult)
1324  *theResult = 0;
1325  if (dispInfo->item.pszText)
1326  {
1327  LPITEMIDLIST pidlNew;
1328  CComPtr<IShellFolder> pParent;
1329  LPCITEMIDLIST pidlChild;
1330 
1331  hr = SHBindToParent(info->absolutePidl, IID_PPV_ARG(IShellFolder, &pParent), &pidlChild);
1332  if (!SUCCEEDED(hr) || !pParent.p)
1333  return E_FAIL;
1334 
1335  hr = pParent->SetNameOf(0, pidlChild, dispInfo->item.pszText, SHGDN_INFOLDER, &pidlNew);
1336  if(SUCCEEDED(hr) && pidlNew)
1337  {
1338  CComPtr<IPersistFolder2> pPersist;
1339  LPITEMIDLIST pidlParent, pidlNewAbs;
1340 
1341  hr = pParent->QueryInterface(IID_PPV_ARG(IPersistFolder2, &pPersist));
1342  if(!SUCCEEDED(hr))
1343  return E_FAIL;
1344 
1345  hr = pPersist->GetCurFolder(&pidlParent);
1346  if(!SUCCEEDED(hr))
1347  return E_FAIL;
1348  pidlNewAbs = ILCombine(pidlParent, pidlNew);
1349 
1350  // Navigate to our new location
1351  UpdateBrowser(pidlNewAbs);
1352 
1353  ILFree(pidlParent);
1354  ILFree(pidlNewAbs);
1355  ILFree(pidlNew);
1356  if (theResult)
1357  *theResult = 1;
1358  }
1359  return S_OK;
1360  }
1361  }
1362  default:
1363  break;
1364  }
1365  }
1366  return S_OK;
1367 }
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
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:3639
UINT_PTR WPARAM
Definition: windef.h:207
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1350
#define TVN_BEGINDRAG
Definition: commctrl.h:3736
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
UINT code
Definition: winuser.h:3134
#define TVN_ENDLABELEDITW
Definition: commctrl.h:3708
BOOL OnTreeItemExpanding(LPNMTREEVIEW pnmtv)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TVN_BEGINRDRAG
Definition: commctrl.h:3737
HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto)
LONG HRESULT
Definition: typedefs.h:77
#define TVN_SELCHANGED
Definition: commctrl.h:3731
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TVN_BEGINLABELEDITW
Definition: commctrl.h:3706
void OnTreeItemDragging(LPNMTREEVIEW pnmtv, BOOL isRightClick)
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3734
#define S_OK
Definition: intsafe.h:59
#define TVN_DELETEITEM
Definition: commctrl.h:3738
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1323
#define NM_RCLICK
Definition: commctrl.h:133
#define LPNMTVDISPINFO
Definition: commctrl.h:3672
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LONG_PTR LRESULT
Definition: windef.h:209
GLuint64EXT * result
Definition: glext.h:11304
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ QueryContinueDrag()

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

Implements IDropSource.

Definition at line 1555 of file explorerband.cpp.

1556 {
1557  if (fEscapePressed)
1558  return DRAGDROP_S_CANCEL;
1559  if ((grfKeyState & MK_LBUTTON) || (grfKeyState & MK_RBUTTON))
1560  return S_OK;
1561  return DRAGDROP_S_DROP;
1562 }
#define MK_LBUTTON
Definition: winuser.h:2342
#define DRAGDROP_S_CANCEL
Definition: winerror.h:2647
#define MK_RBUTTON
Definition: winuser.h:2343
#define S_OK
Definition: intsafe.h:59
#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 1186 of file explorerband.cpp.

1187 {
1188  /* FIXME: we probably want to handle more services here */
1190 }
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
REFIID LPVOID * ppvObject
Definition: precomp.h:44
CComPtr< IUnknown > pSite
Definition: explorerband.h:54
#define SID_SShellBrowser
Definition: shlguid.h:125

◆ QueryStatus()

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

Implements IOleCommandTarget.

Definition at line 1172 of file explorerband.cpp.

1173 {
1174  UNIMPLEMENTED;
1175  return E_NOTIMPL;
1176 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ RefreshFlags()

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

Definition at line 1400 of file explorerband.cpp.

1401 {
1402  UNIMPLEMENTED;
1403  return E_NOTIMPL;
1404 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ RefreshTreePidl()

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

Definition at line 924 of file explorerband.cpp.

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

Referenced by RenameItem().

◆ RenameItem()

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

Definition at line 874 of file explorerband.cpp.

875 {
876  WCHAR wszDisplayName[MAX_PATH];
877  TVITEM itemInfo;
878  LPCITEMIDLIST relPidl;
879  NodeInfo *treeInfo;
880  TVSORTCB sortCallback;
882 
883  ZeroMemory(&itemInfo, sizeof(itemInfo));
884  itemInfo.mask = TVIF_PARAM;
885  itemInfo.hItem = toRename;
886 
887  // Change PIDL associated to the item
888  relPidl = ILFindLastID(newPidl);
889  TreeView_GetItem(m_hWnd, &itemInfo);
890  if (!itemInfo.lParam)
891  {
892  ERR("Unable to fetch lParam\n");
893  return FALSE;
894  }
896  treeInfo = (NodeInfo*)itemInfo.lParam;
897  ILFree(treeInfo->absolutePidl);
898  ILFree(treeInfo->relativePidl);
899  treeInfo->absolutePidl = ILClone(newPidl);
900  treeInfo->relativePidl = ILClone(relPidl);
901 
902  // Change the display name
903  GetDisplayName(newPidl, wszDisplayName, MAX_PATH, SHGDN_INFOLDER);
904  ZeroMemory(&itemInfo, sizeof(itemInfo));
905  itemInfo.hItem = toRename;
906  itemInfo.mask = TVIF_TEXT;
907  itemInfo.pszText = wszDisplayName;
908  TreeView_SetItem(m_hWnd, &itemInfo);
909 
910  if((child = TreeView_GetChild(m_hWnd, toRename)) != NULL)
911  {
912  RefreshTreePidl(child, newPidl);
913  }
914 
915  // Sorting
916  sortCallback.hParent = TreeView_GetParent(m_hWnd, toRename);
917  sortCallback.lpfnCompare = CompareTreeItems;
918  sortCallback.lParam = (LPARAM)this;
919  SendMessage(TVM_SORTCHILDRENCB, 0, (LPARAM)&sortCallback);
921  return TRUE;
922 }
#define TRUE
Definition: types.h:120
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
#define TVM_SORTCHILDRENCB
Definition: commctrl.h:3543
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3462
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define WM_SETREDRAW
Definition: winuser.h:1598
#define ZeroMemory
Definition: winbase.h:1642
static int CALLBACK CompareTreeItems(LPARAM p1, LPARAM p2, LPARAM p3)
static HWND child
Definition: cursoricon.c:298
BOOL RefreshTreePidl(HTREEITEM tree, LPITEMIDLIST pidlParent)
smooth NULL
Definition: ftsmooth.c:416
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:26
#define TreeView_GetParent(hwnd, hitem)
Definition: commctrl.h:3465
HRESULT GetDisplayName(LPCITEMIDLIST pidlDirectory, TCHAR *szDisplayName, UINT cchMax, DWORD uFlags)
HTREEITEM hParent
Definition: commctrl.h:3610
#define TVITEM
Definition: commctrl.h:3361
#define ERR(fmt,...)
Definition: debug.h:109
PFNTVCOMPARE lpfnCompare
Definition: commctrl.h:3611
#define TVIF_TEXT
Definition: commctrl.h:3262
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3493
#define SendMessage
Definition: winuser.h:5818
#define TVIF_PARAM
Definition: commctrl.h:3264
LPARAM lParam
Definition: commctrl.h:3612
#define TreeView_GetItem(hwnd, pitem)
Definition: commctrl.h:3486

Referenced by OnShellEvent().

◆ ResizeBorderDW()

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

Definition at line 1043 of file explorerband.cpp.

1044 {
1045  /* Must return E_NOTIMPL according to MSDN */
1046  return E_NOTIMPL;
1047 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Save()

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

Implements IPersistStream.

Definition at line 1250 of file explorerband.cpp.

1251 {
1252  UNIMPLEMENTED;
1253  return E_NOTIMPL;
1254 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ Select()

HRESULT STDMETHODCALLTYPE CExplorerBand::Select ( long  paramC)
virtual

Definition at line 1375 of file explorerband.cpp.

1376 {
1377  UNIMPLEMENTED;
1378  return E_NOTIMPL;
1379 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define UNIMPLEMENTED

◆ SetSite()

HRESULT STDMETHODCALLTYPE CExplorerBand::SetSite ( IUnknown pUnkSite)
virtual

Implements IObjectWithSite.

Definition at line 1108 of file explorerband.cpp.

1109 {
1110  HRESULT hr;
1111  HWND parentWnd;
1112 
1113  if (pUnkSite == pSite)
1114  return S_OK;
1115 
1116  TRACE("SetSite called \n");
1117  if (!pUnkSite)
1118  {
1120  DestroyWindow();
1121  m_hWnd = NULL;
1122  }
1123 
1124  if (pUnkSite != pSite)
1125  {
1126  pSite = NULL;
1127  }
1128 
1129  if(!pUnkSite)
1130  return S_OK;
1131 
1132  hr = IUnknown_GetWindow(pUnkSite, &parentWnd);
1133  if (!SUCCEEDED(hr))
1134  {
1135  ERR("Could not get parent's window ! Status: %08lx\n", hr);
1136  return E_INVALIDARG;
1137  }
1138 
1139  pSite = pUnkSite;
1140 
1141  if (m_hWnd)
1142  {
1143  // Change its parent
1144  SetParent(parentWnd);
1145  }
1146  else
1147  {
1149  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
1150  0, 0, 0, 0, parentWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
1151 
1152  // Subclass the window
1153  SubclassWindow(wnd);
1154 
1155  // Initialize our treeview now
1157  RegisterDragDrop(m_hWnd, dynamic_cast<IDropTarget*>(this));
1158  }
1159  return S_OK;
1160 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define CreateWindow
Definition: winuser.h:5729
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:1283
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:517
#define TVS_HASBUTTONS
Definition: commctrl.h:3243
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define WC_TREEVIEW
Definition: commctrl.h:3241
LONG HRESULT
Definition: typedefs.h:77
void InitializeExplorerBand()
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
CComPtr< IUnknown > pSite
Definition: explorerband.h:54
#define TVS_SHOWSELALWAYS
Definition: commctrl.h:3248
#define TVS_HASLINES
Definition: commctrl.h:3244
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define TVS_EDITLABELS
Definition: commctrl.h:3246
void DestroyExplorerBand()

◆ ShowDW()

HRESULT STDMETHODCALLTYPE CExplorerBand::ShowDW ( BOOL  fShow)
virtual

Implements IDockingWindow.

Definition at line 1049 of file explorerband.cpp.

1050 {
1051  fVisible = fShow;
1052  ShowWindow(fShow);
1053  return S_OK;
1054 }
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define S_OK
Definition: intsafe.h:59

◆ TranslateAcceleratorIO()

HRESULT STDMETHODCALLTYPE CExplorerBand::TranslateAcceleratorIO ( LPMSG  lpMsg)
virtual

Definition at line 1215 of file explorerband.cpp.

1216 {
1217  if (lpMsg->hwnd == m_hWnd)
1218  {
1219  TranslateMessage(lpMsg);
1220  DispatchMessage(lpMsg);
1221  return S_OK;
1222  }
1223 
1224  return S_FALSE;
1225 }
#define DispatchMessage
Definition: winuser.h:5740
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:59
HWND hwnd
Definition: winuser.h:3089

◆ UIActivateIO()

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

Definition at line 1194 of file explorerband.cpp.

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

◆ UpdateBrowser()

HRESULT CExplorerBand::UpdateBrowser ( LPITEMIDLIST  pidlGoto)
private

Definition at line 285 of file explorerband.cpp.

286 {
287  CComPtr<IShellBrowser> pBrowserService;
288  HRESULT hr;
289 
290  hr = IUnknown_QueryService(pSite, SID_STopLevelBrowser, IID_PPV_ARG(IShellBrowser, &pBrowserService));
291  if (FAILED_UNEXPECTEDLY(hr))
292  return hr;
293 
294  hr = pBrowserService->BrowseObject(pidlGoto, SBSP_SAMEBROWSER | SBSP_ABSOLUTE);
295  if (FAILED_UNEXPECTEDLY(hr))
296  return hr;
297 
298  if(pidlCurrent)
299  {
301  pidlCurrent = ILClone(pidlGoto);
302  }
303  return hr;
304 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
CComPtr< IUnknown > pSite
Definition: explorerband.h:54
LPITEMIDLIST pidlCurrent
Definition: explorerband.h:65

Referenced by OnSelectionChanged(), and OnWinEvent().

Member Data Documentation

◆ adviseCookie

DWORD CExplorerBand::adviseCookie
private

Definition at line 68 of file explorerband.h.

Referenced by DestroyExplorerBand(), and InitializeExplorerBand().

◆ bFocused

BOOL CExplorerBand::bFocused
private

Definition at line 60 of file explorerband.h.

Referenced by HasFocusIO(), and OnSetFocus().

◆ bNavigating

BOOL CExplorerBand::bNavigating
private

◆ childTargetNode

HTREEITEM CExplorerBand::childTargetNode
private

Definition at line 73 of file explorerband.h.

Referenced by DragLeave(), and DragOver().

◆ dwBandID

DWORD CExplorerBand::dwBandID
private

Definition at line 61 of file explorerband.h.

Referenced by GetBandInfo().

◆ fVisible

BOOL CExplorerBand::fVisible
private

Definition at line 58 of file explorerband.h.

Referenced by ShowDW().

◆ hImageList

HIMAGELIST CExplorerBand::hImageList
private

Definition at line 62 of file explorerband.h.

◆ hRoot

HTREEITEM CExplorerBand::hRoot
private

◆ oldSelected

HTREEITEM CExplorerBand::oldSelected
private

Definition at line 64 of file explorerband.h.

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

◆ pCurObject

CComPtr<IDataObject> CExplorerBand::pCurObject
private

Definition at line 74 of file explorerband.h.

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

◆ pDesktop

CComPtr<IShellFolder> CExplorerBand::pDesktop
private

◆ pDropTarget

CComPtr<IDropTarget> CExplorerBand::pDropTarget
private

Definition at line 72 of file explorerband.h.

Referenced by DragOver(), and Drop().

◆ pidlCurrent

LPITEMIDLIST CExplorerBand::pidlCurrent
private

Definition at line 65 of file explorerband.h.

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

◆ pSite

◆ shellRegID

ULONG CExplorerBand::shellRegID
private

Definition at line 69 of file explorerband.h.

Referenced by InitializeExplorerBand().


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