00001 /* 00002 * Copyright 2003, 2004 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 // entries.h 00024 // 00025 // Martin Fuchs, 23.07.2003 00026 // 00027 00028 00029 enum ENTRY_TYPE { 00030 ET_UNKNOWN, 00031 #ifndef _NO_WIN_FS 00032 ET_WINDOWS, 00033 #endif 00034 #ifdef __WINE__ 00035 ET_UNIX, 00036 #endif 00037 ET_SHELL, 00038 ET_NTOBJS, 00039 ET_REGISTRY, 00040 ET_FAT, 00041 ET_WEB 00042 }; 00043 00044 enum SORT_ORDER { 00045 SORT_NONE, 00046 SORT_NAME, 00047 SORT_EXT, 00048 SORT_SIZE, 00049 SORT_DATE 00050 }; 00051 00052 enum SCAN_FLAGS { 00053 SCAN_DONT_EXTRACT_ICONS = 1, 00054 SCAN_DONT_ACCESS = 2, 00055 SCAN_NO_FILESYSTEM = 4 00056 }; 00057 00058 #ifndef ATTRIBUTE_SYMBOLIC_LINK 00059 #define ATTRIBUTE_LONGNAME 0x08000000 00060 #define ATTRIBUTE_VOLNAME 0x10000000 00061 #define ATTRIBUTE_ERASED 0x20000000 00062 #define ATTRIBUTE_SYMBOLIC_LINK 0x40000000 00063 #define ATTRIBUTE_EXECUTABLE 0x80000000 00064 #endif 00065 00066 enum ICONCACHE_FLAGS { 00067 ICF_NORMAL = 0, 00068 ICF_MIDDLE = 1, 00069 ICF_LARGE = 2, 00070 ICF_OPEN = 4, 00071 ICF_OVERLAYS = 8, 00072 ICF_HICON = 16, 00073 ICF_SYSCACHE = 32 00074 }; 00075 00076 #ifndef SHGFI_ADDOVERLAYS // missing in MinGW (as of 28.12.2005) 00077 #define SHGFI_ADDOVERLAYS 0x000000020 00078 #endif 00079 00080 00081 /// base of all file and directory entries 00082 struct Entry 00083 { 00084 protected: 00085 Entry(ENTRY_TYPE etype); 00086 Entry(Entry* parent, ENTRY_TYPE etype); 00087 Entry(const Entry&); 00088 00089 public: 00090 virtual ~Entry(); 00091 00092 Entry* _next; 00093 Entry* _down; 00094 Entry* _up; 00095 00096 bool _expanded; 00097 bool _scanned; 00098 int _level; 00099 00100 WIN32_FIND_DATA _data; 00101 00102 SFGAOF _shell_attribs; 00103 LPTSTR _display_name; 00104 LPTSTR _type_name; 00105 LPTSTR _content; 00106 00107 ENTRY_TYPE _etype; 00108 int /*ICON_ID*/ _icon_id; 00109 00110 BY_HANDLE_FILE_INFORMATION _bhfi; 00111 bool _bhfi_valid; 00112 00113 void free_subentries(); 00114 00115 void read_directory_base(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0); 00116 Entry* read_tree(const void* path, SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0); 00117 void sort_directory(SORT_ORDER sortOrder); 00118 void smart_scan(SORT_ORDER sortOrder=SORT_NAME, int scan_flags=0); 00119 int extract_icon(ICONCACHE_FLAGS flags=ICF_NORMAL); 00120 int safe_extract_icon(ICONCACHE_FLAGS flags=ICF_NORMAL); 00121 00122 virtual void read_directory(int scan_flags=0) {} 00123 virtual const void* get_next_path_component(const void*) const {return NULL;} 00124 virtual Entry* find_entry(const void*) {return NULL;} 00125 virtual bool get_path(PTSTR path, size_t path_count) const = 0; 00126 virtual ShellPath create_absolute_pidl() const {return (LPCITEMIDLIST)NULL;} 00127 virtual HRESULT GetUIObjectOf(HWND hWnd, REFIID riid, LPVOID* ppvOut); 00128 virtual ShellFolder get_shell_folder() const; 00129 virtual BOOL launch_entry(HWND hwnd, UINT nCmdShow=SW_SHOWNORMAL); 00130 virtual HRESULT do_context_menu(HWND hwnd, const POINT& pos, CtxMenuInterfaces& cm_ifs); 00131 00132 protected: 00133 bool get_path_base(PTSTR path, size_t path_count, ENTRY_TYPE etype) const; 00134 }; 00135 00136 00137 /// base for all directory entries 00138 struct Directory { 00139 protected: 00140 Directory() : _path(NULL) {} 00141 virtual ~Directory() {} 00142 00143 void* _path; 00144 }; 00145 00146 00147 /// root entry for file system trees 00148 struct Root { 00149 Root(); 00150 ~Root(); 00151 00152 Entry* _entry; 00153 TCHAR _path[MAX_PATH]; 00154 TCHAR _volname[_MAX_FNAME]; 00155 TCHAR _fs[_MAX_DIR]; 00156 DWORD _drive_type; 00157 DWORD _fs_flags; 00158 SORT_ORDER _sort_order; 00159 00160 Entry* read_tree(LPCTSTR path, int scan_flags=0); 00161 Entry* read_tree(LPCITEMIDLIST pidl, int scan_flags=0); 00162 };
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |