2 * Copyright 2003, 2004, 2005 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 /// shell file/directory entry
30 struct ShellEntry
: public Entry
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
) {}
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
, LPPOINT pptScreen
, CtxMenuInterfaces
& cm_ifs
);
41 IShellFolder
* get_parent_folder() const;
43 ShellPath _pidl
; // parent relative PIDL
46 ShellEntry(LPITEMIDLIST shell_path
) : Entry(ET_SHELL
), _pidl(shell_path
) {}
47 ShellEntry(const ShellPath
& shell_path
) : Entry(ET_SHELL
), _pidl(shell_path
) {}
51 /// shell folder entry
52 struct ShellDirectory
: public ShellEntry
, public Directory
54 ShellDirectory(ShellFolder
& root_folder
, const ShellPath
& shell_path
, HWND hwnd
)
55 : ShellEntry(shell_path
),
56 _folder(root_folder
, shell_path
),
59 CONTEXT("ShellDirectory::ShellDirectory()");
61 lstrcpy(_data
.cFileName
, root_folder
.get_name(shell_path
, SHGDN_FORADDRESSBAR
));
62 _data
.dwFileAttributes
= FILE_ATTRIBUTE_DIRECTORY
;
63 _shell_attribs
= SFGAO_FOLDER
;
65 ShellFolder
subfolder(root_folder
, shell_path
);
66 IShellFolder
* pFolder
= subfolder
;
71 explicit ShellDirectory(ShellDirectory
* parent
, LPITEMIDLIST shell_path
, HWND hwnd
)
72 : ShellEntry(parent
, shell_path
),
73 _folder(parent
->_folder
, shell_path
),
76 /* not neccessary - the caller will fill the info
77 lstrcpy(_data.cFileName, _folder.get_name(shell_path));
78 _data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
79 _shell_attribs = SFGAO_FOLDER; */
85 ShellDirectory(const ShellDirectory
& other
)
88 _folder(other
._folder
),
91 IShellFolder
* pFolder
= (IShellFolder
*)_path
;
97 IShellFolder
* pFolder
= (IShellFolder
*)_path
;
102 virtual void read_directory(int scan_flags
=SCAN_ALL
);
103 virtual const void* get_next_path_component(const void*) const;
104 virtual Entry
* find_entry(const void*);
106 virtual bool get_path(PTSTR path
, size_t path_count
) const;
108 int extract_icons(bool big_icons
);
114 bool fill_w32fdata_shell(LPCITEMIDLIST pidl
, SFGAOF attribs
, WIN32_FIND_DATA
*, BY_HANDLE_FILE_INFORMATION
*, bool do_access
=true);
118 inline IShellFolder
* ShellEntry::get_parent_folder() const
121 return static_cast<ShellDirectory
*>(_up
)->_folder
;
123 return GetDesktopFolder();