ReactOS 0.4.16-dev-88-ga65b6ae
shellfs.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 // shellfs.h
24 //
25 // Martin Fuchs, 23.07.2003
26 //
27
28
30struct ShellEntry : public Entry
31{
32 ShellEntry(Entry* parent, LPITEMIDLIST shell_path) : Entry(parent, ET_SHELL), _pidl(shell_path) {}
33 ShellEntry(Entry* parent, const ShellPath& shell_path) : Entry(parent, ET_SHELL), _pidl(shell_path) {}
34
35 virtual bool get_path(PTSTR path, size_t path_count) const;
36 virtual ShellPath create_absolute_pidl() const;
37 virtual HRESULT GetUIObjectOf(HWND hWnd, REFIID riid, LPVOID* ppvOut);
38 virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL);
39 virtual HRESULT do_context_menu(HWND hwnd, const POINT& pptScreen, CtxMenuInterfaces& cm_ifs);
40 virtual ShellFolder get_shell_folder() const;
41
43
44 ShellPath _pidl; // parent relative PIDL
45
46protected:
47 ShellEntry(LPITEMIDLIST shell_path) : Entry(ET_SHELL), _pidl(shell_path) {}
48 ShellEntry(const ShellPath& shell_path) : Entry(ET_SHELL), _pidl(shell_path) {}
49};
50
51
53struct ShellDirectory : public ShellEntry, public Directory
54{
55 ShellDirectory(ShellFolder& root_folder, const ShellPath& shell_path, HWND hwnd)
56 : ShellEntry(shell_path),
57 _folder(root_folder, shell_path),
58 _hwnd(hwnd)
59 {
60 CONTEXT("ShellDirectory::ShellDirectory()");
61
62 lstrcpy(_data.cFileName, root_folder.get_name(shell_path, SHGDN_FORADDRESSBAR));
63 _data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
64 _shell_attribs = SFGAO_FOLDER;
65
66 ShellFolder subfolder(root_folder, shell_path);
67 IShellFolder* pFolder = subfolder;
68 pFolder->AddRef();
69 _path = pFolder;
70 }
71
73 : ShellEntry(parent, shell_path),
74 _folder(parent->_folder, shell_path),
75 _hwnd(hwnd)
76 {
77 /* not neccessary - the caller will fill the info
78 lstrcpy(_data.cFileName, _folder.get_name(shell_path));
79 _data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
80 _shell_attribs = SFGAO_FOLDER; */
81
82 _folder->AddRef();
83 _path = _folder;
84 }
85
91 {
92 IShellFolder* pFolder = (IShellFolder*)_path;
93 pFolder->AddRef();
94 }
95
97 {
98 IShellFolder* pFolder = (IShellFolder*)_path;
99 _path = NULL;
100 pFolder->Release();
101 }
102
103 virtual void read_directory(int scan_flags=0);
104 virtual const void* get_next_path_component(const void*) const;
105 virtual Entry* find_entry(const void*);
106
107 virtual bool get_path(PTSTR path, size_t path_count) const;
108 virtual ShellFolder get_shell_folder() const;
109
111
114
115protected:
117};
118
119
121{
122 if (_up)
123 return static_cast<ShellDirectory*>(_up)->_folder;
124 else
125 return GetDesktopFolder();
126}
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
r parent
Definition: btrfs.c:3010
static IShellFolder IShellItem **static IBindCtx LPITEMIDLIST SFGAOF
Definition: ebrowser.c:83
ICONCACHE_FLAGS
Definition: entries.h:66
@ ET_SHELL
Definition: entries.h:37
unsigned int BOOL
Definition: ntddk_ex.h:94
GLbitfield flags
Definition: glext.h:7161
const GLint * attribs
Definition: glext.h:10538
REFIID riid
Definition: atlbase.h:39
ULONG AddRef()
ULONG Release()
int other
Definition: msacm.c:1376
unsigned int UINT
Definition: ndis.h:50
struct _CONTEXT CONTEXT
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define REFIID
Definition: guiddef.h:118
ShellFolder & GetDesktopFolder()
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
base for all directory entries
Definition: entries.h:138
void * _path
Definition: entries.h:143
base of all file and directory entries
Definition: entries.h:83
SFGAOF _shell_attribs
Definition: entries.h:102
WIN32_FIND_DATA _data
Definition: entries.h:100
Entry * _up
Definition: entries.h:94
shell folder entry
Definition: shellfs.h:54
ShellDirectory(ShellDirectory *parent, LPITEMIDLIST shell_path, HWND hwnd)
Definition: shellfs.h:72
int extract_icons(ICONCACHE_FLAGS flags)
Definition: shellfs.cpp:524
virtual ShellFolder get_shell_folder() const
Definition: shellfs.cpp:247
virtual void read_directory(int scan_flags=0)
Definition: shellfs.cpp:253
ShellFolder _folder
Definition: shellfs.h:112
bool fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA *, BY_HANDLE_FILE_INFORMATION *, bool do_access=true)
Definition: shellfs.cpp:31
virtual const void * get_next_path_component(const void *) const
Definition: shellfs.cpp:482
virtual Entry * find_entry(const void *)
Definition: shellfs.cpp:495
virtual bool get_path(PTSTR path, size_t path_count) const
Definition: shellfs.cpp:155
ShellDirectory(const ShellDirectory &other)
Definition: shellfs.h:86
~ShellDirectory()
Definition: shellfs.h:96
ShellDirectory(ShellFolder &root_folder, const ShellPath &shell_path, HWND hwnd)
Definition: shellfs.h:55
shell file/directory entry
Definition: shellfs.h:31
virtual HRESULT do_context_menu(HWND hwnd, const POINT &pptScreen, CtxMenuInterfaces &cm_ifs)
Definition: shellfs.cpp:218
ShellEntry(const ShellPath &shell_path)
Definition: shellfs.h:48
IShellFolder * get_parent_folder() const
Definition: shellfs.h:120
ShellEntry(LPITEMIDLIST shell_path)
Definition: shellfs.h:47
virtual ShellPath create_absolute_pidl() const
Definition: shellfs.cpp:114
ShellEntry(Entry *parent, const ShellPath &shell_path)
Definition: shellfs.h:33
virtual bool get_path(PTSTR path, size_t path_count) const
Definition: shellfs.cpp:133
virtual HRESULT GetUIObjectOf(HWND hWnd, REFIID riid, LPVOID *ppvOut)
Definition: shellfs.cpp:229
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL)
Definition: shellfs.cpp:186
ShellPath _pidl
Definition: shellfs.h:44
virtual ShellFolder get_shell_folder() const
Definition: shellfs.cpp:242
ShellEntry(Entry *parent, LPITEMIDLIST shell_path)
Definition: shellfs.h:32
IShellFolder smart pointer.
Definition: shellclasses.h:594
String get_name(LPCITEMIDLIST pidl, SHGDNF flags=SHGDN_NORMAL) const
wrapper class for item ID lists
Definition: shellclasses.h:652
#define lstrcpy
Definition: winbase.h:3874
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define SW_SHOWNORMAL
Definition: winuser.h:773
CHAR * PTSTR
Definition: xmlstorage.h:191