ReactOS  0.4.14-dev-49-gfb4591c
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 
30 struct 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 
46 protected:
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 
53 struct 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 
87  : ShellEntry(other),
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 
115 protected:
117 };
118 
119 
121 {
122  if (_up)
123  return static_cast<ShellDirectory*>(_up)->_folder;
124  else
125  return GetDesktopFolder();
126 }
bool fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA *, BY_HANDLE_FILE_INFORMATION *, bool do_access=true)
Definition: shellfs.cpp:31
virtual void read_directory(int scan_flags=0)
Definition: shellfs.cpp:253
virtual ShellPath create_absolute_pidl() const
Definition: shellfs.cpp:114
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
~ShellDirectory()
Definition: shellfs.h:96
struct _CONTEXT CONTEXT
#define REFIID
Definition: guiddef.h:118
ShellEntry(Entry *parent, LPITEMIDLIST shell_path)
Definition: shellfs.h:32
ShellEntry(LPITEMIDLIST shell_path)
Definition: shellfs.h:47
Entry * _up
Definition: entries.h:94
WIN32_FIND_DATA _data
Definition: entries.h:100
REFIID riid
Definition: precomp.h:44
const GLint * attribs
Definition: glext.h:10538
int other
Definition: msacm.c:1364
virtual const void * get_next_path_component(const void *) const
Definition: shellfs.cpp:482
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
HWND hWnd
Definition: settings.c:17
virtual ShellFolder get_shell_folder() const
Definition: shellfs.cpp:242
shell folder entry
Definition: shellfs.h:53
IShellFolder smart pointer.
Definition: shellclasses.h:593
ShellEntry(Entry *parent, const ShellPath &shell_path)
Definition: shellfs.h:33
virtual HRESULT GetUIObjectOf(HWND hWnd, REFIID riid, LPVOID *ppvOut)
Definition: shellfs.cpp:229
unsigned int BOOL
Definition: ntddk_ex.h:94
ShellEntry(const ShellPath &shell_path)
Definition: shellfs.h:48
virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL)
Definition: shellfs.cpp:186
ULONG Release()
ShellDirectory(ShellDirectory *parent, LPITEMIDLIST shell_path, HWND hwnd)
Definition: shellfs.h:72
smooth NULL
Definition: ftsmooth.c:416
String get_name(LPCITEMIDLIST pidl, SHGDNF flags=SHGDN_NORMAL) const
CHAR * PTSTR
Definition: xmlstorage.h:191
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
IShellFolder * get_parent_folder() const
Definition: shellfs.h:120
r parent
Definition: btrfs.c:2897
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
ULONG AddRef()
SFGAOF _shell_attribs
Definition: entries.h:102
ICONCACHE_FLAGS
Definition: entries.h:66
ShellFolder _folder
Definition: shellfs.h:112
ShellDirectory(ShellFolder &root_folder, const ShellPath &shell_path, HWND hwnd)
Definition: shellfs.h:55
ShellPath _pidl
Definition: shellfs.h:44
shell file/directory entry
Definition: shellfs.h:30
virtual HRESULT do_context_menu(HWND hwnd, const POINT &pptScreen, CtxMenuInterfaces &cm_ifs)
Definition: shellfs.cpp:218
ShellFolder & GetDesktopFolder()
#define SW_SHOWNORMAL
Definition: winuser.h:764
int extract_icons(ICONCACHE_FLAGS flags)
Definition: shellfs.cpp:524
void * _path
Definition: entries.h:143
#define lstrcpy
Definition: winbase.h:3691
Definition: services.c:325
virtual Entry * find_entry(const void *)
Definition: shellfs.cpp:495
unsigned int UINT
Definition: ndis.h:50
virtual bool get_path(PTSTR path, size_t path_count) const
Definition: shellfs.cpp:133
virtual bool get_path(PTSTR path, size_t path_count) const
Definition: shellfs.cpp:155
base for all directory entries
Definition: entries.h:138
ShellDirectory(const ShellDirectory &other)
Definition: shellfs.h:86
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
virtual ShellFolder get_shell_folder() const
Definition: shellfs.cpp:247
wrapper class for item ID lists
Definition: shellclasses.h:651
base of all file and directory entries
Definition: entries.h:82
static IShellFolder IShellItem **static IBindCtx LPITEMIDLIST SFGAOF
Definition: ebrowser.c:83