2 * Copyright 2003 Martin Fuchs
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 // Martin Fuchs, 23.07.2003
29 struct ShellEntry : public Entry
31 ShellEntry(Entry* parent, LPITEMIDLIST shell_path) : Entry(parent), _pidl(shell_path) {}
32 ShellEntry(Entry* parent, const ShellPath& shell_path) : Entry(parent), _pidl(shell_path) {}
34 virtual void get_path(PTSTR path) const;
35 virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL);
37 IShellFolder* get_parent_folder() const;
38 LPITEMIDLIST create_absolute_pidl(HWND hwnd);
43 ShellEntry(LPITEMIDLIST shell_path) : Entry(ET_SHELL), _pidl(shell_path) {}
44 ShellEntry(const ShellPath& shell_path) : Entry(ET_SHELL), _pidl(shell_path) {}
48 struct ShellDirectory : public ShellEntry, public Directory
50 ShellDirectory(ShellFolder& root_folder, const ShellPath& shell_path, HWND hwnd)
51 : ShellEntry(shell_path),
52 _folder(root_folder, shell_path),
55 lstrcpy(_data.cFileName, root_folder.get_name(shell_path));
56 _data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
57 _shell_attribs = SFGAO_FOLDER;
59 ShellFolder subfolder(root_folder, shell_path);
60 IShellFolder* pFolder = subfolder;
65 explicit ShellDirectory(ShellDirectory* parent, LPITEMIDLIST shell_path, HWND hwnd)
66 : ShellEntry(parent, shell_path),
67 _folder(parent->_folder, shell_path),
70 /* not neccessary - the caller will fill the info
71 lstrcpy(_data.cFileName, _folder.get_name(shell_path));
72 _data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
73 _shell_attribs = SFGAO_FOLDER; */
79 ShellDirectory(const ShellDirectory& other)
82 _folder(other._folder),
85 IShellFolder* pFolder = (IShellFolder*)_path;
91 IShellFolder* pFolder = (IShellFolder*)_path;
96 virtual void read_directory();
97 virtual const void* get_next_path_component(const void*);
98 virtual Entry* find_entry(const void* p);
100 virtual void get_path(PTSTR path) const;
106 bool fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA*, BY_HANDLE_FILE_INFORMATION*);
110 inline IShellFolder* ShellEntry::get_parent_folder() const
113 return static_cast<ShellDirectory*>(_up)->_folder;