ReactOS  0.4.12-dev-75-g00dd17e
ShellBrowser Struct Reference

Implementation of IShellBrowserImpl interface in explorer child windows. More...

#include <ieframe.h>

Inheritance diagram for ShellBrowser:
Collaboration diagram for ShellBrowser:

Public Member Functions

 ShellBrowser (HWND hwnd, HWND hwndFrame, HWND left_hwnd, WindowHandle &right_hwnd, ShellPathInfo &create_info, BrowserCallback *cb, CtxMenuInterfaces &cm_ifs)
 
virtual ~ShellBrowser ()
 
virtual HRESULT STDMETHODCALLTYPE GetWindow (HWND *lphwnd)
 
virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView (IShellView **ppshv)
 
virtual HRESULT STDMETHODCALLTYPE GetControlWindow (UINT id, HWND *lphwnd)
 
virtual HRESULT STDMETHODCALLTYPE SendControlMsg (UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
 
const Rootget_root () const
 
void OnTreeGetDispInfo (int idCtrl, LPNMHDR pnmh)
 
void OnTreeItemExpanding (int idCtrl, LPNMTREEVIEW pnmtv)
 
void OnTreeItemRClick (int idCtrl, LPNMHDR pnmh)
 
void OnTreeItemSelected (int idCtrl, LPNMTREEVIEW pnmtv)
 
void Init ()
 
int InsertSubitems (HTREEITEM hParentItem, Entry *entry, IShellFolder *pParentFolder)
 
bool jump_to_pidl (LPCITEMIDLIST pidl)
 
HRESULT OnDefaultCommand (LPIDA pida)
 
void UpdateFolderView (IShellFolder *folder)
 
HTREEITEM select_entry (HTREEITEM hitem, Entry *entry, bool expand=true)
 
bool select_folder (Entry *entry, bool expand)
 
void jump_to (LPCITEMIDLIST pidl)
 
void invalidate_cache ()
 
bool TranslateAccelerator (LPMSG lpmsg)
 
- Public Member Functions inherited from IShellBrowserImpl
 IShellBrowserImpl ()
 
virtual ~IShellBrowserImpl ()
 
virtual HRESULT STDMETHODCALLTYPE QueryInterface (REFIID iid, void **ppvObject)
 
virtual ULONG STDMETHODCALLTYPE AddRef ()
 
virtual ULONG STDMETHODCALLTYPE Release ()
 
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp (BOOL fEnterMode)
 
virtual HRESULT STDMETHODCALLTYPE OnDefaultCommand (IShellView *ppshv)
 
virtual HRESULT STDMETHODCALLTYPE OnStateChange (IShellView *ppshv, ULONG uChange)
 
virtual HRESULT STDMETHODCALLTYPE IncludeObject (IShellView *ppshv, LPCITEMIDLIST pidl)
 
virtual HRESULT STDMETHODCALLTYPE InsertMenusSB (HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
 
virtual HRESULT STDMETHODCALLTYPE SetMenuSB (HMENU hmenuShared, HOLEMENU holemenuReserved, HWND hwndActiveObject)
 
virtual HRESULT STDMETHODCALLTYPE RemoveMenusSB (HMENU hmenuShared)
 
virtual HRESULT STDMETHODCALLTYPE SetStatusTextSB (LPCOLESTR lpszStatusText)
 
virtual HRESULT STDMETHODCALLTYPE EnableModelessSB (BOOL fEnable)
 
virtual HRESULT STDMETHODCALLTYPE BrowseObject (LPCITEMIDLIST pidl, UINT wFlags)
 
virtual HRESULT STDMETHODCALLTYPE GetViewStateStream (DWORD grfMode, LPSTREAM *ppStrm)
 
virtual HRESULT STDMETHODCALLTYPE OnViewWindowActive (IShellView *ppshv)
 
virtual HRESULT STDMETHODCALLTYPE SetToolbarItems (LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags)
 
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorSB (LPMSG lpmsg, WORD wID)
 
virtual HRESULT STDMETHODCALLTYPE QueryService (REFGUID guidService, REFIID riid, void **ppvObject)
 
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)
 
- Public Member Functions inherited from IShellBrowser
HRESULT TranslateAcceleratorSB ([in] MSG *pmsg, [in] WORD wID)
 
HRESULT GetViewStateStream ([in] DWORD grfMode, [out] IStream **ppStrm)
 
- 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 IComSrvBase< IShellFolderViewCB, ShellBrowser >
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 
- Public Member Functions inherited from IComSrvQI< IShellFolderViewCB >
 IComSrvQI (REFIID uuid_base)
 
STDMETHODIMP QueryInterface (REFIID riid, LPVOID *ppv)
 
- Public Member Functions inherited from SimpleComObject
ULONG IncRef ()
 
ULONG DecRef ()
 

Public Attributes

IShellBrowser IShellBrowser_iface
 
IBrowserService IBrowserService_iface
 
IDocObjectService IDocObjectService_iface
 
LONG ref
 
DocHostdoc_host
 
- Public Attributes inherited from IShellBrowserImpl
IShellBrowser IShellBrowser_iface
 
ICommDlgBrowser ICommDlgBrowser_iface
 
IServiceProvider IServiceProvider_iface
 
LONG ref
 
HWND hwndOwner
 
- Public Attributes inherited from IShellBrowser
FCT_ADDTOEND typedef LPARAM LPTBBUTTONSB
 
- Public Attributes inherited from ICommDlgBrowser
CDBOSC_STATECHANGE typedef ICommDlgBrowserLPCOMMDLGBROWSER
 

Protected Types

typedef IComSrvBase< IShellFolderViewCB, ShellBrowsersuper
 

Protected Member Functions

void InitializeTree ()
 
bool InitDragDrop ()
 
virtual HRESULT STDMETHODCALLTYPE MessageSFVCB (UINT uMsg, WPARAM wParam, LPARAM lParam)
 shell view callback More...
 
int get_image_idx (int icon_id)
 
void refresh ()
 
- Protected Member Functions inherited from IComSrvBase< IShellFolderViewCB, ShellBrowser >
 IComSrvBase (REFIID uuid_base)
 
- Protected Member Functions inherited from IComSrvQI< IShellFolderViewCB >
 IComSrvQI ()
 
virtual ~IComSrvQI ()
 
- Protected Member Functions inherited from ComSrvObject
 ComSrvObject ()
 
virtual ~ComSrvObject ()
 

Protected Attributes

HWND _hwnd
 
HWND _hwndFrame
 
HWND _left_hwnd
 
WindowHandle & _right_hwnd
 
ShellPathInfo_create_info
 
HIMAGELIST _himl
 
HIMAGELIST _himl_old
 
BrowserCallback_callback
 
ShellFolder _folder
 
IShellView_pShellView
 
TreeDropTarget_pDropTarget
 
HTREEITEM _last_sel
 
Root _root
 
ShellDirectory_cur_dir
 
CtxMenuInterfaces_cm_ifs
 
map< int, int_image_map
 
- Protected Attributes inherited from IShellBrowserImpl
DWORD _dwRef
 
- Protected Attributes inherited from IComSrvQI< IShellFolderViewCB >
REFIID _uuid_base
 
- Protected Attributes inherited from ComSrvObject
ULONG _ref
 

Additional Inherited Members

- Public Types inherited from IShellBrowser
typedef IShellBrowserLPSHELLBROWSER
 
typedef LPTBBUTTON LPTBBUTTONSB
 
- Public Types inherited from IOleWindow
typedef IOleWindowLPOLEWINDOW
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IServiceProvider
typedef IServiceProviderLPSERVICEPROVIDER
 
- 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
 

Detailed Description

Implementation of IShellBrowserImpl interface in explorer child windows.

Definition at line 84 of file ieframe.h.

Member Typedef Documentation

◆ super

typedef IComSrvBase<IShellFolderViewCB, ShellBrowser> ShellBrowser::super
protected

Definition at line 169 of file shellbrowser.h.

Constructor & Destructor Documentation

◆ ShellBrowser()

ShellBrowser::ShellBrowser ( HWND  hwnd,
HWND  hwndFrame,
HWND  left_hwnd,
WindowHandle &  right_hwnd,
ShellPathInfo create_info,
BrowserCallback cb,
CtxMenuInterfaces cm_ifs 
)

Definition at line 36 of file shellbrowser.cpp.

38  : super(IID_IShellFolderViewCB),
39  _hwnd(hwnd),
40  _hwndFrame(hwndFrame),
41  _left_hwnd(left_hwnd),
42  _right_hwnd(right_hwnd),
43  _create_info(create_info),
44  _callback(cb),
45  _cm_ifs(cm_ifs)
46 {
47  _pShellView = NULL;
49  _last_sel = 0;
50 
51  _cur_dir = NULL;
52 
53  HDC hDC = GetDC(NULL);
54  if (hDC)
55  {
57  ReleaseDC(NULL, hDC);
58 
59  DWORD ilMask;
60  if (bpp <= 4)
61  ilMask = ILC_COLOR4;
62  else if (bpp <= 8)
63  ilMask = ILC_COLOR8;
64  else if (bpp <= 16)
65  ilMask = ILC_COLOR16;
66  else if (bpp <= 24)
67  ilMask = ILC_COLOR24;
68  else if (bpp <= 32)
69  ilMask = ILC_COLOR32;
70  else
71  ilMask = ILC_COLOR;
72 
73  ilMask |= ILC_MASK;
74 
77  }
78 }
#define HDC
Definition: msvc.h:22
#define ILC_COLOR16
Definition: commctrl.h:341
#define BITSPIXEL
Definition: wingdi.h:718
COLORREF WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk)
Definition: imagelist.c:2787
WindowHandle & _right_hwnd
Definition: shellbrowser.h:148
HDC WINAPI GetDC(_In_opt_ HWND)
HTREEITEM _last_sel
Definition: shellbrowser.h:159
#define SM_CYSMICON
Definition: winuser.h:1003
#define COLOR_WINDOW
Definition: winuser.h:908
int32_t INT
Definition: typedefs.h:56
DWORD WINAPI GetSysColor(_In_ int)
#define ILC_COLOR4
Definition: commctrl.h:339
#define ILC_COLOR32
Definition: commctrl.h:343
CtxMenuInterfaces & _cm_ifs
Definition: shellbrowser.h:164
BrowserCallback * _callback
Definition: shellbrowser.h:152
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ILC_COLOR
Definition: commctrl.h:337
smooth NULL
Definition: ftsmooth.c:416
HIMAGELIST _himl
Definition: shellbrowser.h:150
#define ILC_COLOR24
Definition: commctrl.h:342
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SM_CXSMICON
Definition: winuser.h:1002
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define ILC_MASK
Definition: commctrl.h:336
IComSrvBase< IShellFolderViewCB, ShellBrowser > super
Definition: shellbrowser.h:169
IShellView * _pShellView
Definition: shellbrowser.h:156
static HDC hDC
Definition: 3dtext.c:33
ShellPathInfo & _create_info
Definition: shellbrowser.h:149
ShellDirectory * _cur_dir
Definition: shellbrowser.h:162
TreeDropTarget * _pDropTarget
Definition: shellbrowser.h:157
#define ILC_COLOR8
Definition: commctrl.h:340
DWORD bpp
Definition: surface.c:181

◆ ~ShellBrowser()

ShellBrowser::~ShellBrowser ( )
virtual

Definition at line 80 of file shellbrowser.cpp.

81 {
84 
85  if (_pShellView)
87 
88  if (_pDropTarget) {
91  }
92 
93  if (_right_hwnd) {
95  _right_hwnd = 0;
96  }
97 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:47
WindowHandle & _right_hwnd
Definition: shellbrowser.h:148
HIMAGELIST _himl_old
Definition: shellbrowser.h:151
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:893
ULONG Release()
smooth NULL
Definition: ftsmooth.c:416
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3414
HIMAGELIST _himl
Definition: shellbrowser.h:150
virtual ULONG STDMETHODCALLTYPE Release()
IShellView * _pShellView
Definition: shellbrowser.h:156
#define TVSIL_NORMAL
Definition: commctrl.h:3410
TreeDropTarget * _pDropTarget
Definition: shellbrowser.h:157

Member Function Documentation

◆ get_image_idx()

int ShellBrowser::get_image_idx ( int  icon_id)
protected

Definition at line 252 of file shellbrowser.cpp.

Referenced by OnTreeGetDispInfo().

253 {
254  if (icon_id != ICID_NONE) {
256 
257  if (found != _image_map.end())
258  return found->second;
259 
261 
262  _image_map[icon_id] = idx;
263 
264  return idx;
265  } else
266  return -1;
267 }
map< int, int > _image_map
Definition: shellbrowser.h:174
unsigned int idx
Definition: utils.c:41
HICON get_hicon() const
Definition: globals.h:110
HIMAGELIST _himl
Definition: shellbrowser.h:150
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:505
Definition: _map.h:44
_STLP_TEMPLATE_FOR_CONT_EXT iterator find(const _KT &__x)
Definition: _map.h:210
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
const Icon & get_icon(int icon_id)
Definition: explorer.cpp:625
IconCache _icon_cache
Definition: globals.h:285
iterator end()
Definition: _map.h:165

◆ get_root()

const Root& ShellBrowser::get_root ( ) const
inline

Definition at line 117 of file shellbrowser.h.

Referenced by MDIMainFrame::activate_child_window().

117 {return _root;}

◆ GetControlWindow()

virtual HRESULT STDMETHODCALLTYPE ShellBrowser::GetControlWindow ( UINT  id,
HWND lphwnd 
)
inlinevirtual

Implements IShellBrowser.

Definition at line 82 of file shellbrowser.h.

83  {
84  if (!lphwnd)
85  return E_POINTER;
86 
87  if (id == FCW_TREE) {
88  *lphwnd = _left_hwnd;
89  return S_OK;
90  }
91 
93 
94  if (hwnd) {
95  *lphwnd = hwnd;
96  return S_OK;
97  }
98 
99  return E_NOTIMPL;
100  }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HANDLE HWND
Definition: compat.h:13
#define PM_GET_CONTROLWINDOW
Definition: explorer.h:64
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
#define SendMessage
Definition: winuser.h:5709
#define E_POINTER
Definition: winerror.h:2365

◆ GetWindow()

virtual HRESULT STDMETHODCALLTYPE ShellBrowser::GetWindow ( HWND lphwnd)
inlinevirtual

Implements IOleWindow.

Definition at line 68 of file shellbrowser.h.

69  {
70  *lphwnd = _hwnd;
71  return S_OK;
72  }
#define S_OK
Definition: intsafe.h:59

◆ Init()

void ShellBrowser::Init ( )

Definition at line 100 of file shellbrowser.cpp.

Referenced by SDIMainFrame::update_shell_browser(), and MDIShellBrowserChild::update_shell_browser().

101 {
102  CONTEXT("ShellBrowser::Init()");
103 
104  const String& root_name = GetDesktopFolder().get_name(_create_info._root_shell_path, SHGDN_FORADDRESSBAR);
105 
106  _root._drive_type = DRIVE_UNKNOWN;
107  lstrcpy(_root._volname, root_name);
108  _root._fs_flags = 0;
109  lstrcpy(_root._fs, TEXT("Desktop"));
110 
112 
113  _root._entry->read_directory(SCAN_DONT_ACCESS|SCAN_NO_FILESYSTEM); // avoid to handle desktop root folder as file system directory
114 
115  if (_left_hwnd) {
116  InitializeTree();
117  InitDragDrop();
118  }
119 
121 
122  /* already filled by ShellDirectory constructor
123  lstrcpy(_root._entry->_data.cFileName, TEXT("Desktop")); */
124 }
struct _CONTEXT CONTEXT
shell folder entry
Definition: shellfs.h:53
static WCHAR String[]
Definition: stringtable.c:55
String get_name(LPCITEMIDLIST pidl, SHGDNF flags=SHGDN_NORMAL) const
#define DRIVE_UNKNOWN
Definition: winbase.h:253
ShellPath _root_shell_path
Definition: shellbrowser.h:46
ShellPath _shell_path
Definition: shellbrowser.h:45
ShellFolder & GetDesktopFolder()
#define TEXT(s)
Definition: k32.h:26
#define lstrcpy
Definition: winbase.h:3688
void InitializeTree()
ShellPathInfo & _create_info
Definition: shellbrowser.h:149
bool InitDragDrop()
void jump_to(LPCITEMIDLIST pidl)

◆ InitDragDrop()

bool ShellBrowser::InitDragDrop ( )
protected

Definition at line 198 of file shellbrowser.cpp.

Referenced by Init().

199 {
200  CONTEXT("ShellBrowser::InitDragDrop()");
201 
203 
204  if (!_pDropTarget)
205  return false;
206 
207  _pDropTarget->AddRef();
208 
209  if (FAILED(RegisterDragDrop(_left_hwnd, _pDropTarget))) {//calls addref
210  _pDropTarget->Release(); // free TreeDropTarget
211  _pDropTarget = NULL;
212  return false;
213  } else
215 
216  FORMATETC ftetc;
217 
218  ftetc.dwAspect = DVASPECT_CONTENT;
219  ftetc.lindex = -1;
220  ftetc.tymed = TYMED_HGLOBAL;
221  ftetc.cfFormat = CF_HDROP;
222 
224 
225  return true;
226 }
struct _CONTEXT CONTEXT
void AddSuportedFormat(FORMATETC &ftetc)
Definition: dragdropimpl.h:184
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:551
smooth NULL
Definition: ftsmooth.c:416
#define CF_HDROP
Definition: constants.h:410
virtual ULONG STDMETHODCALLTYPE AddRef()
Definition: dragdropimpl.h:192
OLE drop target for tree controls.
virtual ULONG STDMETHODCALLTYPE Release()
TreeDropTarget * _pDropTarget
Definition: shellbrowser.h:157

◆ InitializeTree()

void ShellBrowser::InitializeTree ( )
protected

Definition at line 174 of file shellbrowser.cpp.

Referenced by Init().

175 {
176  CONTEXT("ShellBrowserChild::InitializeTree()");
177 
180 
181  TV_INSERTSTRUCT tvInsert;
182  TV_ITEM& tvItem = tvInsert.item;
183 
184  tvInsert.hParent = 0;
185  tvInsert.hInsertAfter = TVI_LAST;
186 
188  tvItem.lParam = (LPARAM)_root._entry;
189  tvItem.pszText = _root._volname; //LPSTR_TEXTCALLBACK;
190  tvItem.iImage = tvItem.iSelectedImage = I_IMAGECALLBACK;
191  tvItem.cChildren = 1;
192 
196 }
struct _CONTEXT CONTEXT
HIMAGELIST _himl_old
Definition: shellbrowser.h:151
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3238
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3379
#define TVIF_CHILDREN
Definition: commctrl.h:3239
#define TVI_LAST
Definition: commctrl.h:3337
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3414
HIMAGELIST _himl
Definition: shellbrowser.h:150
#define TVE_EXPAND
Definition: commctrl.h:3390
#define I_IMAGECALLBACK
Definition: commctrl.h:2355
#define TreeView_SetScrollTime(hwnd, uTime)
Definition: commctrl.h:3551
#define TV_ITEM
Definition: commctrl.h:3267
#define TVIF_TEXT
Definition: commctrl.h:3233
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3448
#define TVIF_IMAGE
Definition: commctrl.h:3234
#define TVSIL_NORMAL
Definition: commctrl.h:3410
#define TVIF_PARAM
Definition: commctrl.h:3235
#define TV_INSERTSTRUCT
Definition: commctrl.h:3344
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3387
#define LPARAM
Definition: msvc.h:38

◆ InsertSubitems()

int ShellBrowser::InsertSubitems ( HTREEITEM  hParentItem,
Entry entry,
IShellFolder pParentFolder 
)

Definition at line 311 of file shellbrowser.cpp.

Referenced by OnTreeItemExpanding().

312 {
313  CONTEXT("ShellBrowser::InsertSubitems()");
314 
315  WaitCursor wait;
316 
317  int cnt = 0;
318 
320 
321  try {
323  } catch(COMException& e) {
325  }
326 
327  // remove old children items
328  HTREEITEM hchild, hnext;
329 
330  hnext = TreeView_GetChild(_left_hwnd, hParentItem);
331 
332  while((hchild=hnext) != 0) {
333  hnext = TreeView_GetNextSibling(_left_hwnd, hchild);
335  }
336 
337  TV_ITEM tvItem;
338  TV_INSERTSTRUCT tvInsert;
339 
340  for(entry=entry->_down; entry; entry=entry->_next) {
341 #ifndef _LEFT_FILES
342  if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
343 #endif
344  {
345  // ignore hidden directories
346  if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
347  continue;
348 
349  // ignore directory entries "." and ".."
350  if (entry->_data.cFileName[0]==TEXT('.') &&
351  (entry->_data.cFileName[1]==TEXT('\0') ||
352  (entry->_data.cFileName[1]==TEXT('.') && entry->_data.cFileName[2]==TEXT('\0'))))
353  continue;
354 
355  ZeroMemory(&tvItem, sizeof(tvItem));
356 
358  tvItem.pszText = LPSTR_TEXTCALLBACK;
359  tvItem.iImage = tvItem.iSelectedImage = I_IMAGECALLBACK;
360  tvItem.lParam = (LPARAM)entry;
361  tvItem.cChildren = entry->_shell_attribs & SFGAO_HASSUBFOLDER? 1: 0;
362 
363  if (entry->_shell_attribs & SFGAO_SHARE) {
364  tvItem.mask |= TVIF_STATE;
365  tvItem.stateMask |= TVIS_OVERLAYMASK;
366  tvItem.state |= INDEXTOOVERLAYMASK(1);
367  }
368 
369  tvInsert.item = tvItem;
370  tvInsert.hInsertAfter = TVI_LAST;
371  tvInsert.hParent = hParentItem;
372 
373  (void)TreeView_InsertItem(_left_hwnd, &tvInsert);
374 
375  ++cnt;
376  }
377  }
378 
380 
381  return cnt;
382 }
Entry * _next
Definition: entries.h:92
struct _CONTEXT CONTEXT
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:47
WIN32_FIND_DATA _data
Definition: entries.h:100
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3433
#define WM_SETREDRAW
Definition: winuser.h:1598
#define ZeroMemory
Definition: winbase.h:1635
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3434
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3238
Exception with context information.
Definition: shellclasses.h:113
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3379
#define TVIF_CHILDREN
Definition: commctrl.h:3239
#define e
Definition: ke_i.h:82
#define TVIS_OVERLAYMASK
Definition: commctrl.h:3254
#define TVI_LAST
Definition: commctrl.h:3337
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TreeView_DeleteItem(hwnd, hitem)
Definition: commctrl.h:3382
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
void smart_scan(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:353
Entry * _down
Definition: entries.h:93
#define SORT_NAME
Definition: xpath.c:441
#define INDEXTOOVERLAYMASK(i)
Definition: commctrl.h:410
SFGAOF _shell_attribs
Definition: entries.h:102
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define I_IMAGECALLBACK
Definition: commctrl.h:2355
#define TV_ITEM
Definition: commctrl.h:3267
#define TEXT(s)
Definition: k32.h:26
#define TVIF_TEXT
Definition: commctrl.h:3233
#define TVIF_IMAGE
Definition: commctrl.h:3234
HWND _hMainWnd
Definition: globals.h:275
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
#define SendMessage
Definition: winuser.h:5709
#define TVIF_STATE
Definition: commctrl.h:3236
#define TVIF_PARAM
Definition: commctrl.h:3235
#define LPSTR_TEXTCALLBACK
Definition: commctrl.h:2353
#define TV_INSERTSTRUCT
Definition: commctrl.h:3344
#define LPARAM
Definition: msvc.h:38

◆ invalidate_cache()

void ShellBrowser::invalidate_cache ( )

Definition at line 269 of file shellbrowser.cpp.

Referenced by MDIShellBrowserChild::WndProc().

270 {
273 
276 
278 
280  g_Globals._icon_cache.free_icon(it->first);
281 
282  _image_map.clear();
283 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:47
COLORREF WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk)
Definition: imagelist.c:2787
HIMAGELIST _himl_old
Definition: shellbrowser.h:151
#define SM_CYSMICON
Definition: winuser.h:1003
#define COLOR_WINDOW
Definition: winuser.h:908
DWORD WINAPI GetSysColor(_In_ int)
map< int, int > _image_map
Definition: shellbrowser.h:174
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:893
void free_icon(int icon_id)
Definition: explorer.cpp:650
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:769
#define TreeView_SetImageList(hwnd, himl, iImage)
Definition: commctrl.h:3414
HIMAGELIST _himl
Definition: shellbrowser.h:150
#define ILC_COLOR24
Definition: commctrl.h:342
int WINAPI GetSystemMetrics(_In_ int)
Definition: _map.h:44
#define SM_CXSMICON
Definition: winuser.h:1002
void clear()
Definition: _map.h:206
#define ILC_MASK
Definition: commctrl.h:336
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
#define TVSIL_NORMAL
Definition: commctrl.h:3410
iterator begin()
Definition: _map.h:163
IconCache _icon_cache
Definition: globals.h:285
iterator end()
Definition: _map.h:165

◆ jump_to()

void ShellBrowser::jump_to ( LPCITEMIDLIST  pidl)

Definition at line 126 of file shellbrowser.cpp.

Referenced by Init(), and SDIMainFrame::jump_to().

127 {
128  Entry* entry = NULL;
129 
130  if (!_cur_dir)
131  _cur_dir = static_cast<ShellDirectory*>(_root._entry);
132 
133  //LOG(FmtString(TEXT("ShellBrowser::jump_to(): pidl=%s"), (LPCTSTR)FileSysShellPath(pidl)));
134 
135  // We could call read_tree() here to iterate through the hierarchy and open all folders
136  // from _create_info._root_shell_path (_cur_dir) to _create_info._shell_path (pidl).
137  // To make it easier we just use ILFindChild() instead.
138  if (_cur_dir) {
139  static DynamicFct<LPITEMIDLIST(WINAPI*)(LPCITEMIDLIST, LPCITEMIDLIST)> ILFindChild(TEXT("SHELL32"), 24);
140 
141  if (ILFindChild) {
142  for(;;) {
143  LPCITEMIDLIST child_pidl = (*ILFindChild)(_cur_dir->create_absolute_pidl(), pidl);
144  if (!child_pidl || !child_pidl->mkid.cb)
145  break;
146 
148 
149  entry = _cur_dir->find_entry(child_pidl);
150  if (!entry)
151  break;
152 
153  _cur_dir = static_cast<ShellDirectory*>(entry);
154  _callback->entry_selected(entry);
155  }
156  } else {
158 
159  entry = _cur_dir->find_entry(pidl); // This is not correct in the common case, but works on the desktop level.
160 
161  if (entry) {
162  _cur_dir = static_cast<ShellDirectory*>(entry);
163  _callback->entry_selected(entry);
164  }
165  }
166  }
167 
168  // If not already called, now directly call UpdateFolderView() using pidl
169  if (!entry)
171 }
virtual ShellPath create_absolute_pidl() const
Definition: shellfs.cpp:114
uint8_t entry
Definition: isohybrid.c:63
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
shell folder entry
Definition: shellfs.h:53
BrowserCallback * _callback
Definition: shellbrowser.h:152
smooth NULL
Definition: ftsmooth.c:416
static IShellFolder ShellFolder
Definition: ordinal.c:2632
void smart_scan(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:353
LPITEMIDLIST WINAPI ILFindChild(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:641
#define SORT_NAME
Definition: xpath.c:441
void UpdateFolderView(IShellFolder *folder)
virtual void entry_selected(Entry *entry)=0
#define TEXT(s)
Definition: k32.h:26
virtual Entry * find_entry(const void *)
Definition: shellfs.cpp:495
ShellDirectory * _cur_dir
Definition: shellbrowser.h:162
base of all file and directory entries
Definition: entries.h:82

◆ jump_to_pidl()

bool ShellBrowser::jump_to_pidl ( LPCITEMIDLIST  pidl)

Definition at line 553 of file shellbrowser.cpp.

Referenced by MDIShellBrowserChild::jump_to_int().

554 {
555  if (!_root._entry)
556  return false;
557 
558  // iterate through the hierarchy and open all folders to reach pidl
559  WaitCursor wait;
560 
562  Entry* entry = _root._entry;
563 
564  for(const void*p=pidl;;) {
565  if (!p)
566  return true;
567 
568  if (!entry || !hitem)
569  break;
570 
572 
573  Entry* found = entry->find_entry(p);
574  p = entry->get_next_path_component(p);
575 
576  if (found)
577  hitem = select_entry(hitem, found);
578 
579  entry = found;
580  }
581 
582  return false;
583 }
uint8_t entry
Definition: isohybrid.c:63
virtual const void * get_next_path_component(const void *) const
Definition: entries.h:123
virtual Entry * find_entry(const void *)
Definition: entries.h:124
void smart_scan(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:353
#define SORT_NAME
Definition: xpath.c:441
HTREEITEM select_entry(HTREEITEM hitem, Entry *entry, bool expand=true)
#define TreeView_GetRoot(hwnd)
Definition: commctrl.h:3442
GLfloat GLfloat p
Definition: glext.h:8902
base of all file and directory entries
Definition: entries.h:82

◆ MessageSFVCB()

HRESULT STDMETHODCALLTYPE ShellBrowser::MessageSFVCB ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
protectedvirtual

shell view callback

Todo:
never reached

Definition at line 472 of file shellbrowser.cpp.

473 {
474  if (uMsg == SFVM_INITMENUPOPUP) {
476  InsertMenu((HMENU)lParam, 0, MF_BYPOSITION, 12345, TEXT("TEST ENTRY"));
477  return S_OK;
478  }
479 
480  return E_NOTIMPL;
481 }
#define InsertMenu
Definition: winuser.h:5669
#define MF_BYPOSITION
Definition: winuser.h:203
#define S_OK
Definition: intsafe.h:59
#define TEXT(s)
Definition: k32.h:26
#define E_NOTIMPL
Definition: ddrawi.h:99
#define SFVM_INITMENUPOPUP
Definition: shlobj.h:1203
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

◆ OnDefaultCommand()

HRESULT ShellBrowser::OnDefaultCommand ( LPIDA  pida)
virtual
Todo:
look for hidden or new subfolders and refresh/add new entry instead of opening a new window

Reimplemented from IShellBrowserImpl.

Definition at line 484 of file shellbrowser.cpp.

485 {
486  CONTEXT("ShellBrowser::OnDefaultCommand()");
487 
488  if (pida->cidl >= 1) {
489  if (_left_hwnd) { // explorer mode
490  if (_last_sel) {
492 
493  if (parent) {
494  try {
496  } catch(COMException& e) {
497  return e.Error();
498  }
499 
500  UINT firstOffset = pida->aoffset[1];
501  LPITEMIDLIST pidl = (LPITEMIDLIST)((LPBYTE)pida+firstOffset);
502 
503  Entry* entry = parent->find_entry(pidl);
504 
505  if (entry && (entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
506  if (entry->_etype == ET_SHELL)
507  if (_last_sel && select_entry(_last_sel, entry))
508  return S_OK;
509 
511  return E_NOTIMPL;
512  }
513  }
514  } else { // no tree control
516  return S_OK;
517 
518 /* create new Frame Window
519  if (MainFrame::OpenShellFolders(pida, 0))
520  return S_OK;
521 */
522  }
523  }
524 
525  return E_NOTIMPL;
526 }
struct _CONTEXT CONTEXT
WIN32_FIND_DATA _data
Definition: entries.h:100
HTREEITEM _last_sel
Definition: shellbrowser.h:159
uint8_t entry
Definition: isohybrid.c:63
shell folder entry
Definition: shellfs.h:53
Exception with context information.
Definition: shellclasses.h:113
unsigned char * LPBYTE
Definition: typedefs.h:52
#define e
Definition: ke_i.h:82
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
ENTRY_TYPE _etype
Definition: entries.h:107
r parent
Definition: btrfs.c:2644
void smart_scan(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0)
Definition: entries.cpp:353
unsigned int UINT
Definition: ndis.h:50
UINT cidl
Definition: shlobj.h:476
#define SORT_NAME
Definition: xpath.c:441
HRESULT Error() const
Definition: shellclasses.h:79
#define S_OK
Definition: intsafe.h:59
HTREEITEM select_entry(HTREEITEM hitem, Entry *entry, bool expand=true)
#define E_NOTIMPL
Definition: ddrawi.h:99
virtual Entry * find_entry(const void *)
Definition: shellfs.cpp:495
static int OpenShellFolders(LPIDA pida, HWND hFrameWnd)
Definition: mainframe.cpp:77
UINT aoffset[1]
Definition: shlobj.h:477
LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
Definition: window.h:968
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
base of all file and directory entries
Definition: entries.h:82

◆ OnTreeGetDispInfo()

void ShellBrowser::OnTreeGetDispInfo ( int  idCtrl,
LPNMHDR  pnmh 
)

Definition at line 229 of file shellbrowser.cpp.

Referenced by ShellBrowserChildT< MainFrameBase >::Notify().

230 {
231  CONTEXT("ShellBrowser::OnTreeGetDispInfo()");
232 
233  LPNMTVDISPINFO lpdi = (LPNMTVDISPINFO)pnmh;
234  ShellEntry* entry = (ShellEntry*)lpdi->item.lParam;
235 
236  if (entry) {
237  if (lpdi->item.mask & TVIF_TEXT)
238  lpdi->item.pszText = entry->_display_name;
239 
240  if (lpdi->item.mask & (TVIF_IMAGE|TVIF_SELECTEDIMAGE)) {
241  if (lpdi->item.mask & TVIF_IMAGE)
242  lpdi->item.iImage = get_image_idx(
244 
245  if (lpdi->item.mask & TVIF_SELECTEDIMAGE)
246  lpdi->item.iSelectedImage = get_image_idx(
248  }
249  }
250 }
struct _CONTEXT CONTEXT
uint8_t entry
Definition: isohybrid.c:63
#define TVIF_SELECTEDIMAGE
Definition: commctrl.h:3238
int safe_extract_icon(ICONCACHE_FLAGS flags=ICF_NORMAL)
Definition: entries.cpp:431
if(!(yy_init))
Definition: macro.lex.yy.c:717
ICONCACHE_FLAGS
Definition: entries.h:66
shell file/directory entry
Definition: shellfs.h:30
#define TVIF_TEXT
Definition: commctrl.h:3233
#define TVIF_IMAGE
Definition: commctrl.h:3234
#define LPNMTVDISPINFO
Definition: commctrl.h:3643
LPTSTR _display_name
Definition: entries.h:103
int get_image_idx(int icon_id)

◆ OnTreeItemExpanding()

void ShellBrowser::OnTreeItemExpanding ( int  idCtrl,
LPNMTREEVIEW  pnmtv 
)

Definition at line 286 of file shellbrowser.cpp.

Referenced by ShellBrowserChildT< MainFrameBase >::Notify().

287 {
288  CONTEXT("ShellBrowser::OnTreeItemExpanding()");
289 
290  if (pnmtv->action == TVE_COLLAPSE)
292  else if (pnmtv->action == TVE_EXPAND) {
294 
295  if (entry)
296  if (!InsertSubitems(pnmtv->itemNew.hItem, entry, entry->_folder)) {
297  entry->_shell_attribs &= ~SFGAO_HASSUBFOLDER;
298 
299  // remove subitem "+"
300  TV_ITEM tvItem;
301 
302  tvItem.mask = TVIF_CHILDREN;
303  tvItem.hItem = pnmtv->itemNew.hItem;
304  tvItem.cChildren = 0;
305 
306  TreeView_SetItem(_left_hwnd, &tvItem);
307  }
308  }
309 }
struct _CONTEXT CONTEXT
uint8_t entry
Definition: isohybrid.c:63
shell folder entry
Definition: shellfs.h:53
int InsertSubitems(HTREEITEM hParentItem, Entry *entry, IShellFolder *pParentFolder)
#define TVIF_CHILDREN
Definition: commctrl.h:3239
#define TVE_COLLAPSE
Definition: commctrl.h:3389
#define TVE_EXPAND
Definition: commctrl.h:3390
SFGAOF _shell_attribs
Definition: entries.h:102
ShellFolder _folder
Definition: shellfs.h:112
#define TV_ITEM
Definition: commctrl.h:3267
#define TreeView_SetItem(hwnd, pitem)
Definition: commctrl.h:3464
LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
Definition: window.h:968
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3387
#define TVE_COLLAPSERESET
Definition: commctrl.h:3393

◆ OnTreeItemRClick()

void ShellBrowser::OnTreeItemRClick ( int  idCtrl,
LPNMHDR  pnmh 
)

Definition at line 398 of file shellbrowser.cpp.

Referenced by ShellBrowserChildT< MainFrameBase >::Notify().

399 {
400  CONTEXT("ShellBrowser::OnTreeItemRClick()");
401 
402  TVHITTESTINFO tvhti;
403 
404  GetCursorPos(&tvhti.pt);
405  ScreenToClient(_left_hwnd, &tvhti.pt);
406 
407  tvhti.flags = LVHT_NOWHERE;
408  (void)TreeView_HitTest(_left_hwnd, &tvhti);
409 
410  if (TVHT_ONITEM & tvhti.flags) {
411  LPARAM itemData = TreeView_GetItemData(_left_hwnd, tvhti.hItem);
412 
413  if (itemData) {
414  Entry* entry = (Entry*)itemData;
415  ClientToScreen(_left_hwnd, &tvhti.pt);
416 
417  HRESULT hr = entry->do_context_menu(_hwnd, tvhti.pt, _cm_ifs);
418 
419  if (SUCCEEDED(hr))
420  refresh();
421  else
422  CHECKERROR(hr);
423  }
424  }
425 }
struct _CONTEXT CONTEXT
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:47
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
uint8_t entry
Definition: isohybrid.c:63
virtual HRESULT do_context_menu(HWND hwnd, const POINT &pos, CtxMenuInterfaces &cm_ifs)
Definition: entries.cpp:519
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
CtxMenuInterfaces & _cm_ifs
Definition: shellbrowser.h:164
#define LVHT_NOWHERE
Definition: commctrl.h:2463
LONG_PTR LPARAM
Definition: windef.h:208
#define CHECKERROR(hr)
Definition: shellclasses.h:162
HTREEITEM hItem
Definition: commctrl.h:3488
#define TreeView_HitTest(hwnd, lpht)
Definition: commctrl.h:3480
LONG HRESULT
Definition: typedefs.h:77
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
#define TVHT_ONITEM
Definition: commctrl.h:3494
LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
Definition: window.h:968
base of all file and directory entries
Definition: entries.h:82
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ OnTreeItemSelected()

void ShellBrowser::OnTreeItemSelected ( int  idCtrl,
LPNMTREEVIEW  pnmtv 
)

Definition at line 385 of file shellbrowser.cpp.

Referenced by ShellBrowserChildT< MainFrameBase >::Notify().

386 {
387  CONTEXT("ShellBrowser::OnTreeItemSelected()");
388 
389  Entry* entry = (Entry*)pnmtv->itemNew.lParam;
390 
391  _last_sel = pnmtv->itemNew.hItem;
392 
393  if (entry)
394  _callback->entry_selected(entry);
395 }
struct _CONTEXT CONTEXT
HTREEITEM _last_sel
Definition: shellbrowser.h:159
uint8_t entry
Definition: isohybrid.c:63
BrowserCallback * _callback
Definition: shellbrowser.h:152
if(!(yy_init))
Definition: macro.lex.yy.c:717
virtual void entry_selected(Entry *entry)=0
base of all file and directory entries
Definition: entries.h:82

◆ QueryActiveShellView()

virtual HRESULT STDMETHODCALLTYPE ShellBrowser::QueryActiveShellView ( IShellView **  ppshv)
inlinevirtual

Implements IShellBrowser.

Definition at line 75 of file shellbrowser.h.

76  {
78  *ppshv = _pShellView;
79  return S_OK;
80  }
ULONG AddRef()
IShellView * _pShellView
Definition: shellbrowser.h:156
#define S_OK
Definition: intsafe.h:59

◆ refresh()

void ShellBrowser::refresh ( )
protected
Todo:

Definition at line 635 of file shellbrowser.cpp.

Referenced by OnTreeItemRClick().

636 {
638 }

◆ select_entry()

HTREEITEM ShellBrowser::select_entry ( HTREEITEM  hitem,
Entry entry,
bool  expand = true 
)

Definition at line 529 of file shellbrowser.cpp.

Referenced by jump_to_pidl(), and OnDefaultCommand().

530 {
531  CONTEXT("ShellBrowser::select_entry()");
532 
533  if (expand && !TreeView_Expand(_left_hwnd, hitem, TVE_EXPAND))
534  return 0;
535 
536  for(hitem=TreeView_GetChild(_left_hwnd,hitem); hitem; hitem=TreeView_GetNextSibling(_left_hwnd,hitem)) {
537  if ((Entry*)TreeView_GetItemData(_left_hwnd,hitem) == entry) {
538  if (TreeView_SelectItem(_left_hwnd, hitem)) {
539  if (expand)
541 
542  return hitem;
543  }
544 
545  break;
546  }
547  }
548 
549  return 0;
550 }
struct _CONTEXT CONTEXT
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3433
uint8_t entry
Definition: isohybrid.c:63
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3434
static BOOL expand(LPINT ac, LPTSTR **arg, LPCTSTR pattern)
Definition: misc.c:215
#define TVE_EXPAND
Definition: commctrl.h:3390
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3448
LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
Definition: window.h:968
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3387
base of all file and directory entries
Definition: entries.h:82

◆ select_folder()

bool ShellBrowser::select_folder ( Entry entry,
bool  expand 
)

Definition at line 607 of file shellbrowser.cpp.

Referenced by SDIMainFrame::entry_selected(), and MDIShellBrowserChild::entry_selected().

608 {
609  CONTEXT("ShellBrowser::expand_folder()");
610 
611  if (!_last_sel)
612  return false;
613 
615  return false;
616 
619  if (TreeView_SelectItem(_left_hwnd, hitem)) {
620  if (expand)
621  if (!TreeView_Expand(_left_hwnd, hitem, TVE_EXPAND))
622  return false;
623 
624  return true;
625  }
626 
627  break;
628  }
629  }
630 
631  return false;
632 }
struct _CONTEXT CONTEXT
HTREEITEM _last_sel
Definition: shellbrowser.h:159
#define TreeView_GetChild(hwnd, hitem)
Definition: commctrl.h:3433
uint8_t entry
Definition: isohybrid.c:63
shell folder entry
Definition: shellfs.h:53
#define TreeView_GetNextSibling(hwnd, hitem)
Definition: commctrl.h:3434
static BOOL expand(LPINT ac, LPTSTR **arg, LPCTSTR pattern)
Definition: misc.c:215
#define TVE_EXPAND
Definition: commctrl.h:3390
#define TreeView_SelectItem(hwnd, hitem)
Definition: commctrl.h:3448
LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
Definition: window.h:968
#define TreeView_Expand(hwnd, hitem, code)
Definition: commctrl.h:3387

◆ SendControlMsg()

virtual HRESULT STDMETHODCALLTYPE ShellBrowser::SendControlMsg ( UINT  id,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT pret 
)
inlinevirtual

Implements IShellBrowser.

Definition at line 102 of file shellbrowser.h.

103  {
104  if (!pret)
105  return E_POINTER;
106 
107  HWND hstatusbar = (HWND)SendMessage(_hwndFrame, PM_GET_CONTROLWINDOW, id, 0);
108 
109  if (hstatusbar) {
110  *pret = ::SendMessage(hstatusbar, uMsg, wParam, lParam);
111  return S_OK;
112  }
113 
114  return E_NOTIMPL;
115  }
HANDLE HWND
Definition: compat.h:13
WPARAM wParam
Definition: combotst.c:138
#define PM_GET_CONTROLWINDOW
Definition: explorer.h:64
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
#define SendMessage
Definition: winuser.h:5709
#define E_POINTER
Definition: winerror.h:2365
LPARAM lParam
Definition: combotst.c:139

◆ TranslateAccelerator()

bool ShellBrowser::TranslateAccelerator ( LPMSG  lpmsg)

Definition at line 585 of file shellbrowser.cpp.

Referenced by MDIShellBrowserChild::WndProc().

586 {
587  HWND hwnd;
588 
589  /* TranslateAccelerator is called for all explorer windows that are open
590  so we have to decide if this is the correct recipient */
591  hwnd = lpmsg->hwnd;
592 
593  while(hwnd)
594  {
595  if(hwnd == _hwnd)
596  break;
597 
598  hwnd = GetParent(hwnd);
599  }
600 
601  if (hwnd)
602  return _pShellView->TranslateAccelerator(lpmsg) == S_OK;
603 
604  return false;
605 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
IShellView * _pShellView
Definition: shellbrowser.h:156
HRESULT TranslateAccelerator([in] MSG *pmsg)
HWND WINAPI GetParent(_In_ HWND)
#define S_OK
Definition: intsafe.h:59
HWND hwnd
Definition: winuser.h:3067

◆ UpdateFolderView()

void ShellBrowser::UpdateFolderView ( IShellFolder folder)

Definition at line 428 of file shellbrowser.cpp.

Referenced by SDIMainFrame::entry_selected(), MDIShellBrowserChild::entry_selected(), and jump_to().

429 {
430  CONTEXT("ShellBrowser::UpdateFolderView()");
431 
433  IShellView* pLastShellView = _pShellView;
434 
435  _folder = folder;
436 
437  if (pLastShellView)
438  pLastShellView->GetCurrentInfo(&fs);
439  else {
442  }
443 
444  SFV_CREATE sfv_create;
445 
446  sfv_create.cbSize = sizeof(SFV_CREATE);
447  sfv_create.pshf = folder;
448  sfv_create.psvOuter = NULL;
449  sfv_create.psfvcb = this;
450 
451  HRESULT hr = SHCreateShellFolderView(&sfv_create, &_pShellView);
452 
453  if (FAILED(hr)) {
454  _pShellView = NULL;
455  return;
456  }
457 
458  RECT rect = {CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT};
459  hr = _pShellView->CreateViewWindow(pLastShellView, &fs, static_cast<IShellBrowser*>(this), &rect, &_right_hwnd/*&m_hWndListView*/);
460 
461  if (pLastShellView) {
462  pLastShellView->GetCurrentInfo(&fs);
463  pLastShellView->UIActivate(SVUIA_DEACTIVATE);
464  pLastShellView->DestroyViewWindow();
465  pLastShellView->Release();
466  }
467 
468  _pShellView->UIActivate(SVUIA_ACTIVATE_NOFOCUS);
469 }
struct _CONTEXT CONTEXT
HRESULT CreateViewWindow([in] IShellView *psvPrevious, [in] LPCFOLDERSETTINGS lpfs, [in] IShellBrowser *psb, [out] RECT *prcView, [out] HWND *phWnd)
WindowHandle & _right_hwnd
Definition: shellbrowser.h:148
IShellFolderViewCB * psfvcb
Definition: shlobj.h:1261
IShellView * psvOuter
Definition: shlobj.h:1260
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3300
& rect
Definition: startmenu.cpp:1413
HRESULT DestroyViewWindow()
ULONG Release()
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
struct _SFV_CREATE SFV_CREATE
struct CFFOLDER folder
Definition: fdi.c:110
ShellFolder _folder
Definition: shellbrowser.h:154
"rooted" window with special shell namespace root
Definition: mainframe.h:34
LONG HRESULT
Definition: typedefs.h:77
IShellView * _pShellView
Definition: shellbrowser.h:156
IShellFolder * pshf
Definition: shlobj.h:1259
HRESULT UIActivate([in] UINT uState)
UINT cbSize
Definition: shlobj.h:1258
#define fs
Definition: i386-dis.c:435
ShellPathInfo & _create_info
Definition: shellbrowser.h:149
HRESULT GetCurrentInfo([out] LPFOLDERSETTINGS lpfs)

Member Data Documentation

◆ _callback

BrowserCallback* ShellBrowser::_callback
protected

Definition at line 152 of file shellbrowser.h.

Referenced by jump_to(), and OnTreeItemSelected().

◆ _cm_ifs

CtxMenuInterfaces& ShellBrowser::_cm_ifs
protected

Definition at line 164 of file shellbrowser.h.

Referenced by OnTreeItemRClick().

◆ _create_info

ShellPathInfo& ShellBrowser::_create_info
protected

Definition at line 149 of file shellbrowser.h.

Referenced by Init(), and UpdateFolderView().

◆ _cur_dir

ShellDirectory* ShellBrowser::_cur_dir
protected

Definition at line 162 of file shellbrowser.h.

Referenced by jump_to(), and ShellBrowser().

◆ _folder

ShellFolder ShellBrowser::_folder
protected

Definition at line 154 of file shellbrowser.h.

Referenced by UpdateFolderView().

◆ _himl

HIMAGELIST ShellBrowser::_himl
protected

◆ _himl_old

HIMAGELIST ShellBrowser::_himl_old
protected

Definition at line 151 of file shellbrowser.h.

Referenced by InitializeTree(), invalidate_cache(), and ~ShellBrowser().

◆ _hwnd

HWND ShellBrowser::_hwnd
protected

Definition at line 145 of file shellbrowser.h.

Referenced by Init(), OnTreeItemRClick(), and TranslateAccelerator().

◆ _hwndFrame

HWND ShellBrowser::_hwndFrame
protected

Definition at line 146 of file shellbrowser.h.

Referenced by OnDefaultCommand().

◆ _image_map

map<int, int> ShellBrowser::_image_map
protected

Definition at line 174 of file shellbrowser.h.

Referenced by get_image_idx(), and invalidate_cache().

◆ _last_sel

HTREEITEM ShellBrowser::_last_sel
protected

Definition at line 159 of file shellbrowser.h.

Referenced by OnDefaultCommand(), OnTreeItemSelected(), select_folder(), and ShellBrowser().

◆ _left_hwnd

◆ _pDropTarget

TreeDropTarget* ShellBrowser::_pDropTarget
protected

Definition at line 157 of file shellbrowser.h.

Referenced by InitDragDrop(), ShellBrowser(), and ~ShellBrowser().

◆ _pShellView

IShellView* ShellBrowser::_pShellView
protected

◆ _right_hwnd

WindowHandle& ShellBrowser::_right_hwnd
protected

Definition at line 148 of file shellbrowser.h.

Referenced by UpdateFolderView(), and ~ShellBrowser().

◆ _root

Root ShellBrowser::_root
protected

Definition at line 161 of file shellbrowser.h.

◆ doc_host

◆ IBrowserService_iface

IBrowserService ShellBrowser::IBrowserService_iface

Definition at line 86 of file ieframe.h.

Referenced by create_browser_service(), and ShellBrowser_QueryInterface().

◆ IDocObjectService_iface

IDocObjectService ShellBrowser::IDocObjectService_iface

Definition at line 87 of file ieframe.h.

Referenced by create_browser_service(), and ShellBrowser_QueryInterface().

◆ IShellBrowser_iface

◆ ref

LONG ShellBrowser::ref

Definition at line 89 of file ieframe.h.

Referenced by create_browser_service(), ShellBrowser_AddRef(), and ShellBrowser_Release().


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