00001 /* 00002 * Copyright 2003, 2004, 2005 Martin Fuchs 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 */ 00018 00019 00020 // 00021 // Explorer clone 00022 // 00023 // shellfs.h 00024 // 00025 // Martin Fuchs, 23.07.2003 00026 // 00027 00028 00029 /// shell file/directory entry 00030 struct ShellEntry : public Entry 00031 { 00032 ShellEntry(Entry* parent, LPITEMIDLIST shell_path) : Entry(parent, ET_SHELL), _pidl(shell_path) {} 00033 ShellEntry(Entry* parent, const ShellPath& shell_path) : Entry(parent, ET_SHELL), _pidl(shell_path) {} 00034 00035 virtual bool get_path(PTSTR path, size_t path_count) const; 00036 virtual ShellPath create_absolute_pidl() const; 00037 virtual HRESULT GetUIObjectOf(HWND hWnd, REFIID riid, LPVOID* ppvOut); 00038 virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL); 00039 virtual HRESULT do_context_menu(HWND hwnd, LPPOINT pptScreen, CtxMenuInterfaces& cm_ifs); 00040 virtual ShellFolder get_shell_folder() const; 00041 00042 IShellFolder* get_parent_folder() const; 00043 00044 ShellPath _pidl; // parent relative PIDL 00045 00046 protected: 00047 ShellEntry(LPITEMIDLIST shell_path) : Entry(ET_SHELL), _pidl(shell_path) {} 00048 ShellEntry(const ShellPath& shell_path) : Entry(ET_SHELL), _pidl(shell_path) {} 00049 }; 00050 00051 00052 /// shell folder entry 00053 struct ShellDirectory : public ShellEntry, public Directory 00054 { 00055 ShellDirectory(ShellFolder& root_folder, const ShellPath& shell_path, HWND hwnd) 00056 : ShellEntry(shell_path), 00057 _folder(root_folder, shell_path), 00058 _hwnd(hwnd) 00059 { 00060 CONTEXT("ShellDirectory::ShellDirectory()"); 00061 00062 lstrcpy(_data.cFileName, root_folder.get_name(shell_path, SHGDN_FORADDRESSBAR)); 00063 _data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; 00064 _shell_attribs = SFGAO_FOLDER; 00065 00066 ShellFolder subfolder(root_folder, shell_path); 00067 IShellFolder* pFolder = subfolder; 00068 pFolder->AddRef(); 00069 _path = pFolder; 00070 } 00071 00072 explicit ShellDirectory(ShellDirectory* parent, LPITEMIDLIST shell_path, HWND hwnd) 00073 : ShellEntry(parent, shell_path), 00074 _folder(parent->_folder, shell_path), 00075 _hwnd(hwnd) 00076 { 00077 /* not neccessary - the caller will fill the info 00078 lstrcpy(_data.cFileName, _folder.get_name(shell_path)); 00079 _data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; 00080 _shell_attribs = SFGAO_FOLDER; */ 00081 00082 _folder->AddRef(); 00083 _path = _folder; 00084 } 00085 00086 ShellDirectory(const ShellDirectory& other) 00087 : ShellEntry(other), 00088 Directory(other), 00089 _folder(other._folder), 00090 _hwnd(other._hwnd) 00091 { 00092 IShellFolder* pFolder = (IShellFolder*)_path; 00093 pFolder->AddRef(); 00094 } 00095 00096 ~ShellDirectory() 00097 { 00098 IShellFolder* pFolder = (IShellFolder*)_path; 00099 _path = NULL; 00100 pFolder->Release(); 00101 } 00102 00103 virtual void read_directory(int scan_flags=0); 00104 virtual const void* get_next_path_component(const void*) const; 00105 virtual Entry* find_entry(const void*); 00106 00107 virtual bool get_path(PTSTR path, size_t path_count) const; 00108 virtual ShellFolder get_shell_folder() const; 00109 00110 int extract_icons(ICONCACHE_FLAGS flags); 00111 00112 ShellFolder _folder; 00113 HWND _hwnd; 00114 00115 protected: 00116 bool fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN32_FIND_DATA*, BY_HANDLE_FILE_INFORMATION*, bool do_access=true); 00117 }; 00118 00119 00120 inline IShellFolder* ShellEntry::get_parent_folder() const 00121 { 00122 if (_up) 00123 return static_cast<ShellDirectory*>(_up)->_folder; 00124 else 00125 return GetDesktopFolder(); 00126 }
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |