ReactOS 0.4.15-dev-7953-g1f49173
shellbrowser.h
Go to the documentation of this file.
1/*
2 * Copyright 2003, 2004, 2005 Martin Fuchs
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19
20 //
21 // Explorer clone
22 //
23 // shellbrowser.h
24 //
25 // Martin Fuchs, 23.07.2003
26 //
27
28#include "../utility/treedroptarget.h"
29#include "../utility/shellbrowserimpl.h"
30
31#include <memory>
32
35{
37
42 {
43 }
44
47
48 int _open_mode; //OPEN_WINDOW_MODE
49};
50
51
53{
54 virtual ~BrowserCallback() {}
55 virtual void entry_selected(Entry* entry) = 0;
56};
57
58
60struct ShellBrowser : public IShellBrowserImpl,
61 public IComSrvBase<IShellFolderViewCB, ShellBrowser>, public SimpleComObject
62{
63 ShellBrowser(HWND hwnd, HWND hwndFrame, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
65 virtual ~ShellBrowser();
66
67 //IOleWindow
69 {
70 *lphwnd = _hwnd;
71 return S_OK;
72 }
73
74 //IShellBrowser
76 {
78 *ppshv = _pShellView;
79 return S_OK;
80 }
81
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 }
101
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 }
116
117 const Root& get_root() const {return _root;}
118
119 void OnTreeGetDispInfo(int idCtrl, LPNMHDR pnmh);
120 void OnTreeItemExpanding(int idCtrl, LPNMTREEVIEW pnmtv);
121 void OnTreeItemRClick(int idCtrl, LPNMHDR pnmh);
122 void OnTreeItemSelected(int idCtrl, LPNMTREEVIEW pnmtv);
123
124 void Init();
125
126 int InsertSubitems(HTREEITEM hParentItem, Entry* entry, IShellFolder* pParentFolder);
127
128 bool jump_to_pidl(LPCITEMIDLIST pidl);
129
131
133 HTREEITEM select_entry(HTREEITEM hitem, Entry* entry, bool expand=true);
134
135 bool select_folder(Entry* entry, bool expand);
136
137 // for SDIMainFrame
138 void jump_to(LPCITEMIDLIST pidl);
139
140 void invalidate_cache();
141
142 bool TranslateAccelerator(LPMSG lpmsg);
143
144protected:
148 WindowHandle& _right_hwnd;
153
155
156 IShellView* _pShellView; // current hosted shellview
158
160
163
165
166 void InitializeTree();
167 bool InitDragDrop();
168
170
171 // IShellFolderViewCB
173
175
176 int get_image_idx(int icon_id);
177
178 void refresh();
179};
180
181
182#define C_DRIVE_STR TEXT("C:\\")
183
184 // work around GCC's wide string constant bug
185#ifdef __GNUC__
186extern const LPCTSTR C_DRIVE;
187#else
188#define C_DRIVE C_DRIVE_STR
189#endif
190
191template<typename BASE> struct ShellBrowserChildT
192 : public BASE, public BrowserCallback
193{
194 typedef BASE super;
195
196 // constructor for SDIMainFrame
198 : super(hwnd)
199 {
200 }
201
202 // constructor for MDIShellBrowserChild
204 : super(hwnd, info)
205 {
206 }
207
208protected:
210
212 {
213 switch(nmsg) {
215 return (LRESULT)&*_shellBrowser;
216
217 case WM_GETISHELLBROWSER: // for Registry Explorer Plugin
218 return (LRESULT)static_cast<IShellBrowser*>(&*_shellBrowser);
219
220 default:
221 return super::WndProc(nmsg, wparam, lparam);
222 }
223
224 return 0;
225 }
226
227 int Notify(int id, NMHDR* pnmh)
228 {
229 if (_shellBrowser.get())
230 switch(pnmh->code) {
231 case TVN_GETDISPINFO: _shellBrowser->OnTreeGetDispInfo(id, pnmh); break;
234 case NM_RCLICK: _shellBrowser->OnTreeItemRClick(id, pnmh); break;
235 default: return super::Notify(id, pnmh);
236 }
237 else
238 return super::Notify(id, pnmh);
239
240 return 0;
241 }
242};
243
244
245#ifndef _NO_MDI
246
248 ShellBrowserChildT<ChildWindow>
249 >
250{
254
256
258
260
261 virtual String jump_to_int(LPCTSTR url);
262
263protected:
266
268
270
271 // interface BrowserCallback
272 virtual void entry_selected(Entry* entry);
273};
274
275#endif
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
static BOOL expand(LPINT ac, LPTSTR **arg, LPCTSTR pattern)
Definition: misc.c:214
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
OLE drop target for tree controls.
_Tp * get() const _STLP_NOTHROW
Definition: _auto_ptr.h:66
Definition: _map.h:48
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_NOTIMPL
Definition: ddrawi.h:99
#define WM_GETISHELLBROWSER
Definition: filedlg.c:200
HANDLE HWND
Definition: compat.h:19
#define BASE
Definition: inflate.c:58
#define PM_GET_CONTROLWINDOW
Definition: explorer.h:64
#define PM_GET_SHELLBROWSER_PTR
Definition: explorer.h:62
GLenum mode
Definition: glext.h:6217
ULONG AddRef()
#define S_OK
Definition: intsafe.h:52
uint32_t entry
Definition: isohybrid.c:63
static const WCHAR url[]
Definition: encode.c:1432
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static const struct access_res create[16]
Definition: package.c:7644
unsigned int UINT
Definition: ndis.h:50
#define TVN_SELCHANGED
Definition: commctrl.h:3735
#define LPNMTREEVIEW
Definition: commctrl.h:3643
#define NM_RCLICK
Definition: commctrl.h:133
#define TVN_ITEMEXPANDING
Definition: commctrl.h:3738
#define TVN_GETDISPINFO
Definition: commctrl.h:3736
#define C_DRIVE
Definition: shellbrowser.h:188
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
virtual void entry_selected(Entry *entry)=0
virtual ~BrowserCallback()
Definition: shellbrowser.h:54
Definition: shlobj.h:565
base of all file and directory entries
Definition: entries.h:83
Implementation of IShellBrowser and ICommDlgBrowser interfaces for explorer child windows (see ShellB...
ExtContextMenuHandlerT< ShellBrowserChildT< ChildWindow > > super
Definition: shellbrowser.h:253
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
ShellChildWndInfo _create_info
Definition: shellbrowser.h:264
virtual void entry_selected(Entry *entry)
ShellPathInfo _shellpath_info
Definition: shellbrowser.h:265
virtual String jump_to_int(LPCTSTR url)
root entry for file system trees
Definition: entries.h:148
ShellBrowserChildT(HWND hwnd)
Definition: shellbrowser.h:197
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: shellbrowser.h:211
int Notify(int id, NMHDR *pnmh)
Definition: shellbrowser.h:227
ShellBrowserChildT(HWND hwnd, const ShellChildWndInfo &info)
Definition: shellbrowser.h:203
auto_ptr< ShellBrowser > _shellBrowser
Definition: shellbrowser.h:209
Implementation of IShellBrowserImpl interface in explorer child windows.
Definition: ieframe.h:84
HRESULT OnDefaultCommand(LPIDA pida)
HIMAGELIST _himl_old
Definition: shellbrowser.h:151
TreeDropTarget * _pDropTarget
Definition: shellbrowser.h:157
void OnTreeItemSelected(int idCtrl, LPNMTREEVIEW pnmtv)
IComSrvBase< IShellFolderViewCB, ShellBrowser > super
Definition: shellbrowser.h:169
void UpdateFolderView(IShellFolder *folder)
HIMAGELIST _himl
Definition: shellbrowser.h:150
WindowHandle & _right_hwnd
Definition: shellbrowser.h:148
virtual HRESULT STDMETHODCALLTYPE SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
Definition: shellbrowser.h:102
ShellFolder _folder
Definition: shellbrowser.h:154
void OnTreeItemExpanding(int idCtrl, LPNMTREEVIEW pnmtv)
const Root & get_root() const
Definition: shellbrowser.h:117
int InsertSubitems(HTREEITEM hParentItem, Entry *entry, IShellFolder *pParentFolder)
void InitializeTree()
void jump_to(LPCITEMIDLIST pidl)
HTREEITEM _last_sel
Definition: shellbrowser.h:159
virtual HRESULT STDMETHODCALLTYPE MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
shell view callback
BrowserCallback * _callback
Definition: shellbrowser.h:152
void invalidate_cache()
virtual HRESULT STDMETHODCALLTYPE GetControlWindow(UINT id, HWND *lphwnd)
Definition: shellbrowser.h:82
CtxMenuInterfaces & _cm_ifs
Definition: shellbrowser.h:164
virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView(IShellView **ppshv)
Definition: shellbrowser.h:75
bool jump_to_pidl(LPCITEMIDLIST pidl)
map< int, int > _image_map
Definition: shellbrowser.h:174
bool select_folder(Entry *entry, bool expand)
bool InitDragDrop()
IShellView * _pShellView
Definition: shellbrowser.h:156
HTREEITEM select_entry(HTREEITEM hitem, Entry *entry, bool expand=true)
ShellPathInfo & _create_info
Definition: shellbrowser.h:149
virtual ~ShellBrowser()
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd)
Definition: shellbrowser.h:68
ShellDirectory * _cur_dir
Definition: shellbrowser.h:162
void OnTreeItemRClick(int idCtrl, LPNMHDR pnmh)
void OnTreeGetDispInfo(int idCtrl, LPNMHDR pnmh)
int get_image_idx(int icon_id)
information structure for creation of MDIShellBrowserChild
Definition: filechild.h:45
shell folder entry
Definition: shellfs.h:54
IShellFolder smart pointer.
Definition: shellclasses.h:594
information structure to hold current shell folder information
Definition: shellbrowser.h:35
ShellPathInfo(int mode=0)
Definition: shellbrowser.h:36
ShellPath _shell_path
Definition: shellbrowser.h:45
ShellPathInfo(const ShellChildWndInfo &info)
Definition: shellbrowser.h:38
ShellPath _root_shell_path
Definition: shellbrowser.h:46
wrapper class for item ID lists
Definition: shellclasses.h:652
Definition: fci.c:116
UINT code
Definition: winuser.h:3159
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define E_POINTER
Definition: winerror.h:2365
#define SendMessage
Definition: winuser.h:5843
#define TranslateAccelerator
Definition: winuser.h:5860
const CHAR * LPCTSTR
Definition: xmlstorage.h:193