Implementation of IShellBrowserImpl interface in explorer child windows. More...
#include <shellbrowser.h>
Public Member Functions | |
ShellBrowser (HWND hwnd, HWND hwndFrame, HWND left_hwnd, WindowHandle &right_hwnd, ShellPathInfo &create_info, BrowserCallback *cb, CtxMenuInterfaces &cm_ifs) | |
virtual | ~ShellBrowser () |
virtual HRESULT STDMETHODCALLTYPE | GetWindow (HWND *lphwnd) |
virtual HRESULT STDMETHODCALLTYPE | QueryActiveShellView (IShellView **ppshv) |
virtual HRESULT STDMETHODCALLTYPE | GetControlWindow (UINT id, HWND *lphwnd) |
virtual HRESULT STDMETHODCALLTYPE | SendControlMsg (UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret) |
const Root & | get_root () const |
void | OnTreeGetDispInfo (int idCtrl, LPNMHDR pnmh) |
void | OnTreeItemExpanding (int idCtrl, LPNMTREEVIEW pnmtv) |
void | OnTreeItemRClick (int idCtrl, LPNMHDR pnmh) |
void | OnTreeItemSelected (int idCtrl, LPNMTREEVIEW pnmtv) |
void | Init () |
int | InsertSubitems (HTREEITEM hParentItem, Entry *entry, IShellFolder *pParentFolder) |
bool | jump_to_pidl (LPCITEMIDLIST pidl) |
HRESULT | OnDefaultCommand (LPIDA pida) |
void | UpdateFolderView (IShellFolder *folder) |
HTREEITEM | select_entry (HTREEITEM hitem, Entry *entry, bool expand=true) |
bool | select_folder (Entry *entry, bool expand) |
void | jump_to (LPCITEMIDLIST pidl) |
void | invalidate_cache () |
Protected Types | |
typedef IComSrvBase < IShellFolderViewCB, ShellBrowser > | super |
Protected Member Functions | |
void | InitializeTree () |
bool | InitDragDrop () |
virtual HRESULT STDMETHODCALLTYPE | MessageSFVCB (UINT uMsg, WPARAM wParam, LPARAM lParam) |
shell view callback | |
int | get_image_idx (int icon_id) |
void | refresh () |
Protected Attributes | |
HWND | _hwnd |
HWND | _hwndFrame |
HWND | _left_hwnd |
WindowHandle & | _right_hwnd |
ShellPathInfo & | _create_info |
HIMAGELIST | _himl |
HIMAGELIST | _himl_old |
BrowserCallback * | _callback |
ShellFolder | _folder |
IShellView * | _pShellView |
TreeDropTarget * | _pDropTarget |
HTREEITEM | _last_sel |
Root | _root |
ShellDirectory * | _cur_dir |
CtxMenuInterfaces & | _cm_ifs |
map< int, int > | _image_map |
Implementation of IShellBrowserImpl interface in explorer child windows.
Definition at line 60 of file shellbrowser.h.
typedef IComSrvBase<IShellFolderViewCB, ShellBrowser> ShellBrowser::super [protected] |
Reimplemented from IComSrvBase< IShellFolderViewCB, ShellBrowser >.
Definition at line 170 of file shellbrowser.h.
ShellBrowser::ShellBrowser | ( | HWND | hwnd, |
HWND | hwndFrame, | ||
HWND | left_hwnd, | ||
WindowHandle & | right_hwnd, | ||
ShellPathInfo & | create_info, | ||
BrowserCallback * | cb, | ||
CtxMenuInterfaces & | cm_ifs | ||
) |
Definition at line 40 of file shellbrowser.cpp.
: super(IID_IShellFolderViewCB), #else : #endif _hwnd(hwnd), _hwndFrame(hwndFrame), _left_hwnd(left_hwnd), _right_hwnd(right_hwnd), _create_info(create_info), _callback(cb), _cm_ifs(cm_ifs) { _pShellView = NULL; _pDropTarget = NULL; _last_sel = 0; _cur_dir = NULL; _himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK|ILC_COLOR24, 2, 0); ImageList_SetBkColor(_himl, GetSysColor(COLOR_WINDOW)); }
ShellBrowser::~ShellBrowser | ( | ) | [virtual] |
Definition at line 65 of file shellbrowser.cpp.
References _himl, _himl_old, _left_hwnd, _pDropTarget, _pShellView, _right_hwnd, and IDropTargetImpl::Release().
{ (void)TreeView_SetImageList(_left_hwnd, _himl_old, TVSIL_NORMAL); ImageList_Destroy(_himl); if (_pShellView) _pShellView->Release(); if (_pDropTarget) { _pDropTarget->Release(); _pDropTarget = NULL; } if (_right_hwnd) { DestroyWindow(_right_hwnd); _right_hwnd = 0; } }
int ShellBrowser::get_image_idx | ( | int | icon_id ) | [protected] |
Definition at line 237 of file shellbrowser.cpp.
References _himl, ExplorerGlobals::_icon_cache, _image_map, g_Globals, Icon::get_hicon(), IconCache::get_icon(), and ICID_NONE.
Referenced by OnTreeGetDispInfo().
{ if (icon_id != ICID_NONE) { map<int,int>::const_iterator found = _image_map.find(icon_id); if (found != _image_map.end()) return found->second; int idx = ImageList_AddIcon(_himl, g_Globals._icon_cache.get_icon(icon_id).get_hicon()); _image_map[icon_id] = idx; return idx; } else return -1; }
const Root& ShellBrowser::get_root | ( | ) | const [inline] |
Definition at line 119 of file shellbrowser.h.
References _root.
Referenced by MDIMainFrame::activate_child_window().
{return _root;}
virtual HRESULT STDMETHODCALLTYPE ShellBrowser::GetControlWindow | ( | UINT | id, |
HWND * | lphwnd | ||
) | [inline, virtual] |
Definition at line 84 of file shellbrowser.h.
References _hwndFrame, _left_hwnd, HWND, and PM_GET_CONTROLWINDOW.
{ if (!lphwnd) return E_POINTER; if (id == FCW_TREE) { *lphwnd = _left_hwnd; return S_OK; } HWND hwnd = (HWND)SendMessage(_hwndFrame, PM_GET_CONTROLWINDOW, id, 0); if (hwnd) { *lphwnd = hwnd; return S_OK; } return E_NOTIMPL; }
virtual HRESULT STDMETHODCALLTYPE ShellBrowser::GetWindow | ( | HWND * | lphwnd ) | [inline, virtual] |
void ShellBrowser::Init | ( | ) |
Definition at line 85 of file shellbrowser.cpp.
References _create_info, Root::_drive_type, Root::_entry, Root::_fs, Root::_fs_flags, _hwnd, _left_hwnd, _root, ShellPathInfo::_root_shell_path, ShellPathInfo::_shell_path, Root::_volname, CONTEXT, ShellFolder::get_name(), GetDesktopFolder(), InitDragDrop(), InitializeTree(), jump_to(), Entry::read_directory(), SCAN_DONT_ACCESS, SCAN_NO_FILESYSTEM, and TEXT.
{ CONTEXT("ShellBrowser::Init()"); const String& root_name = GetDesktopFolder().get_name(_create_info._root_shell_path, SHGDN_FORADDRESSBAR); _root._drive_type = DRIVE_UNKNOWN; lstrcpy(_root._volname, root_name); _root._fs_flags = 0; lstrcpy(_root._fs, TEXT("Desktop")); _root._entry = new ShellDirectory(GetDesktopFolder(), _create_info._root_shell_path, _hwnd); _root._entry->read_directory(SCAN_DONT_ACCESS|SCAN_NO_FILESYSTEM); // avoid to handle desktop root folder as file system directory if (_left_hwnd) { InitializeTree(); InitDragDrop(); } jump_to(_create_info._shell_path); /* already filled by ShellDirectory constructor lstrcpy(_root._entry->_data.cFileName, TEXT("Desktop")); */ }
bool ShellBrowser::InitDragDrop | ( | ) | [protected] |
Definition at line 183 of file shellbrowser.cpp.
References _left_hwnd, _pDropTarget, IDropTargetImpl::AddRef(), IDropTargetImpl::AddSuportedFormat(), CONTEXT, and IDropTargetImpl::Release().
Referenced by Init().
{ CONTEXT("ShellBrowser::InitDragDrop()"); _pDropTarget = new TreeDropTarget(_left_hwnd); if (!_pDropTarget) return false; _pDropTarget->AddRef(); if (FAILED(RegisterDragDrop(_left_hwnd, _pDropTarget))) {//calls addref _pDropTarget->Release(); // free TreeDropTarget _pDropTarget = NULL; return false; } else _pDropTarget->Release(); FORMATETC ftetc; ftetc.dwAspect = DVASPECT_CONTENT; ftetc.lindex = -1; ftetc.tymed = TYMED_HGLOBAL; ftetc.cfFormat = CF_HDROP; _pDropTarget->AddSuportedFormat(ftetc); return true; }
void ShellBrowser::InitializeTree | ( | ) | [protected] |
Definition at line 159 of file shellbrowser.cpp.
References Root::_entry, _himl, _himl_old, _left_hwnd, _root, Root::_volname, and CONTEXT.
Referenced by Init().
{ CONTEXT("ShellBrowserChild::InitializeTree()"); _himl_old = TreeView_SetImageList(_left_hwnd, _himl, TVSIL_NORMAL); TreeView_SetScrollTime(_left_hwnd, 100); TV_INSERTSTRUCT tvInsert; TV_ITEM& tvItem = tvInsert.item; tvInsert.hParent = 0; tvInsert.hInsertAfter = TVI_LAST; tvItem.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN; tvItem.lParam = (LPARAM)_root._entry; tvItem.pszText = _root._volname; //LPSTR_TEXTCALLBACK; tvItem.iImage = tvItem.iSelectedImage = I_IMAGECALLBACK; tvItem.cChildren = 1; HTREEITEM hItem = TreeView_InsertItem(_left_hwnd, &tvInsert); TreeView_SelectItem(_left_hwnd, hItem); TreeView_Expand(_left_hwnd, hItem, TVE_EXPAND); }
int ShellBrowser::InsertSubitems | ( | HTREEITEM | hParentItem, |
Entry * | entry, | ||
IShellFolder * | pParentFolder | ||
) |
Definition at line 296 of file shellbrowser.cpp.
References Entry::_data, Entry::_down, ExplorerGlobals::_hMainWnd, _left_hwnd, Entry::_next, Entry::_shell_attribs, CONTEXT, g_Globals, HandleException(), SCAN_DONT_ACCESS, Entry::smart_scan(), SORT_NAME, and TEXT.
Referenced by OnTreeItemExpanding().
{ CONTEXT("ShellBrowser::InsertSubitems()"); WaitCursor wait; int cnt = 0; SendMessage(_left_hwnd, WM_SETREDRAW, FALSE, 0); try { entry->smart_scan(SORT_NAME, SCAN_DONT_ACCESS); } catch(COMException& e) { HandleException(e, g_Globals._hMainWnd); } // remove old children items HTREEITEM hchild, hnext; hnext = TreeView_GetChild(_left_hwnd, hParentItem); while((hchild=hnext) != 0) { hnext = TreeView_GetNextSibling(_left_hwnd, hchild); TreeView_DeleteItem(_left_hwnd, hchild); } TV_ITEM tvItem; TV_INSERTSTRUCT tvInsert; for(entry=entry->_down; entry; entry=entry->_next) { #ifndef _LEFT_FILES if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) #endif { // ignore hidden directories if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) continue; // ignore directory entries "." and ".." if (entry->_data.cFileName[0]==TEXT('.') && (entry->_data.cFileName[1]==TEXT('\0') || (entry->_data.cFileName[1]==TEXT('.') && entry->_data.cFileName[2]==TEXT('\0')))) continue; ZeroMemory(&tvItem, sizeof(tvItem)); tvItem.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN; tvItem.pszText = LPSTR_TEXTCALLBACK; tvItem.iImage = tvItem.iSelectedImage = I_IMAGECALLBACK; tvItem.lParam = (LPARAM)entry; tvItem.cChildren = entry->_shell_attribs & SFGAO_HASSUBFOLDER? 1: 0; if (entry->_shell_attribs & SFGAO_SHARE) { tvItem.mask |= TVIF_STATE; tvItem.stateMask |= TVIS_OVERLAYMASK; tvItem.state |= INDEXTOOVERLAYMASK(1); } tvInsert.item = tvItem; tvInsert.hInsertAfter = TVI_LAST; tvInsert.hParent = hParentItem; (void)TreeView_InsertItem(_left_hwnd, &tvInsert); ++cnt; } } SendMessage(_left_hwnd, WM_SETREDRAW, TRUE, 0); return cnt; }
void ShellBrowser::invalidate_cache | ( | ) |
Definition at line 254 of file shellbrowser.cpp.
References _himl, _himl_old, ExplorerGlobals::_icon_cache, _image_map, _left_hwnd, IconCache::free_icon(), and g_Globals.
{ (void)TreeView_SetImageList(_left_hwnd, _himl_old, TVSIL_NORMAL); ImageList_Destroy(_himl); _himl = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK|ILC_COLOR24, 2, 0); ImageList_SetBkColor(_himl, GetSysColor(COLOR_WINDOW)); _himl_old = TreeView_SetImageList(_left_hwnd, _himl, TVSIL_NORMAL); for(map<int,int>::const_iterator it=_image_map.begin(); it!=_image_map.end(); ++it) g_Globals._icon_cache.free_icon(it->first); _image_map.clear(); }
void ShellBrowser::jump_to | ( | LPCITEMIDLIST | pidl ) |
Definition at line 111 of file shellbrowser.cpp.
References _callback, _cur_dir, Root::_entry, _root, ShellEntry::create_absolute_pidl(), BrowserCallback::entry_selected(), ShellDirectory::find_entry(), SCAN_DONT_ACCESS, Entry::smart_scan(), SORT_NAME, TEXT, and UpdateFolderView().
Referenced by Init().
{ Entry* entry = NULL; if (!_cur_dir) _cur_dir = static_cast<ShellDirectory*>(_root._entry); //LOG(FmtString(TEXT("ShellBrowser::jump_to(): pidl=%s"), (LPCTSTR)FileSysShellPath(pidl))); // We could call read_tree() here to iterate through the hierarchy and open all folders // from _create_info._root_shell_path (_cur_dir) to _create_info._shell_path (pidl). // To make it easier we just use ILFindChild() instead. if (_cur_dir) { static DynamicFct<LPITEMIDLIST(WINAPI*)(LPCITEMIDLIST, LPCITEMIDLIST)> ILFindChild(TEXT("SHELL32"), 24); if (ILFindChild) { for(;;) { LPCITEMIDLIST child_pidl = (*ILFindChild)(_cur_dir->create_absolute_pidl(), pidl); if (!child_pidl || !child_pidl->mkid.cb) break; _cur_dir->smart_scan(SORT_NAME, SCAN_DONT_ACCESS); entry = _cur_dir->find_entry(child_pidl); if (!entry) break; _cur_dir = static_cast<ShellDirectory*>(entry); _callback->entry_selected(entry); } } else { _cur_dir->smart_scan(SORT_NAME, SCAN_DONT_ACCESS); entry = _cur_dir->find_entry(pidl); // This is not correct in the common case, but works on the desktop level. if (entry) { _cur_dir = static_cast<ShellDirectory*>(entry); _callback->entry_selected(entry); } } } // If not already called, now directly call UpdateFolderView() using pidl if (!entry) UpdateFolderView(ShellFolder(pidl)); }
bool ShellBrowser::jump_to_pidl | ( | LPCITEMIDLIST | pidl ) |
Definition at line 547 of file shellbrowser.cpp.
References Root::_entry, _left_hwnd, _root, Entry::find_entry(), Entry::get_next_path_component(), SCAN_DONT_ACCESS, select_entry(), Entry::smart_scan(), and SORT_NAME.
{ if (!_root._entry) return false; // iterate through the hierarchy and open all folders to reach pidl WaitCursor wait; HTREEITEM hitem = TreeView_GetRoot(_left_hwnd); Entry* entry = _root._entry; for(const void*p=pidl;;) { if (!p) return true; if (!entry || !hitem) break; entry->smart_scan(SORT_NAME, SCAN_DONT_ACCESS); Entry* found = entry->find_entry(p); p = entry->get_next_path_component(p); if (found) hitem = select_entry(hitem, found); entry = found; } return false; }
HRESULT STDMETHODCALLTYPE ShellBrowser::MessageSFVCB | ( | UINT | uMsg, |
WPARAM | wParam, | ||
LPARAM | lParam | ||
) | [protected, virtual] |
shell view callback
Definition at line 464 of file shellbrowser.cpp.
References TEXT.
{ if (uMsg == SFVM_INITMENUPOPUP) { ///@todo never reached InsertMenu((HMENU)lParam, 0, MF_BYPOSITION, 12345, TEXT("TEST ENTRY")); return S_OK; } return E_NOTIMPL; }
HRESULT ShellBrowser::OnDefaultCommand | ( | LPIDA | pida ) | [virtual] |
Reimplemented from IShellBrowserImpl.
Definition at line 478 of file shellbrowser.cpp.
References Entry::_data, Entry::_etype, _hwndFrame, _last_sel, _left_hwnd, CONTEXT, ET_SHELL, ShellDirectory::find_entry(), MainFrameBase::OpenShellFolders(), SCAN_DONT_ACCESS, select_entry(), Entry::smart_scan(), SORT_NAME, and TreeView_GetItemData().
{ CONTEXT("ShellBrowser::OnDefaultCommand()"); if (pida->cidl >= 1) { if (_left_hwnd) { // explorer mode if (_last_sel) { ShellDirectory* parent = (ShellDirectory*)TreeView_GetItemData(_left_hwnd, _last_sel); if (parent) { try { parent->smart_scan(SORT_NAME, SCAN_DONT_ACCESS); } catch(COMException& e) { return e.Error(); } UINT firstOffset = pida->aoffset[1]; LPITEMIDLIST pidl = (LPITEMIDLIST)((LPBYTE)pida+firstOffset); Entry* entry = parent->find_entry(pidl); if (entry && (entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) if (entry->_etype == ET_SHELL) if (_last_sel && select_entry(_last_sel, entry)) return S_OK; ///@todo look for hidden or new subfolders and refresh/add new entry instead of opening a new window return E_NOTIMPL; } } } else { // no tree control if (MainFrameBase::OpenShellFolders(pida, _hwndFrame)) return S_OK; /* create new Frame Window if (MainFrame::OpenShellFolders(pida, 0)) return S_OK; */ } } return E_NOTIMPL; }
void ShellBrowser::OnTreeGetDispInfo | ( | int | idCtrl, |
LPNMHDR | pnmh | ||
) |
Definition at line 214 of file shellbrowser.cpp.
References Entry::_display_name, CONTEXT, get_image_idx(), ICF_HICON, ICF_OPEN, ICF_OVERLAYS, and Entry::safe_extract_icon().
{ CONTEXT("ShellBrowser::OnTreeGetDispInfo()"); LPNMTVDISPINFO lpdi = (LPNMTVDISPINFO)pnmh; ShellEntry* entry = (ShellEntry*)lpdi->item.lParam; if (entry) { if (lpdi->item.mask & TVIF_TEXT) lpdi->item.pszText = entry->_display_name; if (lpdi->item.mask & (TVIF_IMAGE|TVIF_SELECTEDIMAGE)) { if (lpdi->item.mask & TVIF_IMAGE) lpdi->item.iImage = get_image_idx( entry->safe_extract_icon((ICONCACHE_FLAGS)(ICF_HICON|ICF_OVERLAYS))); if (lpdi->item.mask & TVIF_SELECTEDIMAGE) lpdi->item.iSelectedImage = get_image_idx( entry->safe_extract_icon((ICONCACHE_FLAGS)(ICF_HICON|ICF_OVERLAYS|ICF_OPEN))); } } }
void ShellBrowser::OnTreeItemExpanding | ( | int | idCtrl, |
LPNMTREEVIEW | pnmtv | ||
) |
Definition at line 271 of file shellbrowser.cpp.
References ShellDirectory::_folder, _left_hwnd, Entry::_shell_attribs, CONTEXT, InsertSubitems(), and TreeView_GetItemData().
{ CONTEXT("ShellBrowser::OnTreeItemExpanding()"); if (pnmtv->action == TVE_COLLAPSE) TreeView_Expand(_left_hwnd, pnmtv->itemNew.hItem, TVE_COLLAPSE|TVE_COLLAPSERESET); else if (pnmtv->action == TVE_EXPAND) { ShellDirectory* entry = (ShellDirectory*)TreeView_GetItemData(_left_hwnd, pnmtv->itemNew.hItem); if (entry) if (!InsertSubitems(pnmtv->itemNew.hItem, entry, entry->_folder)) { entry->_shell_attribs &= ~SFGAO_HASSUBFOLDER; // remove subitem "+" TV_ITEM tvItem; tvItem.mask = TVIF_CHILDREN; tvItem.hItem = pnmtv->itemNew.hItem; tvItem.cChildren = 0; TreeView_SetItem(_left_hwnd, &tvItem); } } }
void ShellBrowser::OnTreeItemRClick | ( | int | idCtrl, |
LPNMHDR | pnmh | ||
) |
Definition at line 383 of file shellbrowser.cpp.
References _cm_ifs, _hwnd, _left_hwnd, CHECKERROR, ClientToScreen(), CONTEXT, Entry::do_context_menu(), refresh(), ScreenToClient(), and TreeView_GetItemData().
{ CONTEXT("ShellBrowser::OnTreeItemRClick()"); TVHITTESTINFO tvhti; GetCursorPos(&tvhti.pt); ScreenToClient(_left_hwnd, &tvhti.pt); tvhti.flags = LVHT_NOWHERE; (void)TreeView_HitTest(_left_hwnd, &tvhti); if (TVHT_ONITEM & tvhti.flags) { LPARAM itemData = TreeView_GetItemData(_left_hwnd, tvhti.hItem); if (itemData) { Entry* entry = (Entry*)itemData; ClientToScreen(_left_hwnd, &tvhti.pt); HRESULT hr = entry->do_context_menu(_hwnd, tvhti.pt, _cm_ifs); if (SUCCEEDED(hr)) refresh(); else CHECKERROR(hr); } } }
void ShellBrowser::OnTreeItemSelected | ( | int | idCtrl, |
LPNMTREEVIEW | pnmtv | ||
) |
Definition at line 370 of file shellbrowser.cpp.
References _callback, _last_sel, CONTEXT, and BrowserCallback::entry_selected().
{ CONTEXT("ShellBrowser::OnTreeItemSelected()"); Entry* entry = (Entry*)pnmtv->itemNew.lParam; _last_sel = pnmtv->itemNew.hItem; if (entry) _callback->entry_selected(entry); }
virtual HRESULT STDMETHODCALLTYPE ShellBrowser::QueryActiveShellView | ( | IShellView ** | ppshv ) | [inline, virtual] |
Definition at line 77 of file shellbrowser.h.
References _pShellView.
{ _pShellView->AddRef(); *ppshv = _pShellView; return S_OK; }
void ShellBrowser::refresh | ( | ) | [protected] |
Definition at line 608 of file shellbrowser.cpp.
Referenced by OnTreeItemRClick().
{
///@todo
}
HTREEITEM ShellBrowser::select_entry | ( | HTREEITEM | hitem, |
Entry * | entry, | ||
bool | expand = true |
||
) |
Definition at line 523 of file shellbrowser.cpp.
References _left_hwnd, CONTEXT, and TreeView_GetItemData().
Referenced by jump_to_pidl(), and OnDefaultCommand().
{ CONTEXT("ShellBrowser::select_entry()"); if (expand && !TreeView_Expand(_left_hwnd, hitem, TVE_EXPAND)) return 0; for(hitem=TreeView_GetChild(_left_hwnd,hitem); hitem; hitem=TreeView_GetNextSibling(_left_hwnd,hitem)) { if ((Entry*)TreeView_GetItemData(_left_hwnd,hitem) == entry) { if (TreeView_SelectItem(_left_hwnd, hitem)) { if (expand) TreeView_Expand(_left_hwnd, hitem, TVE_EXPAND); return hitem; } break; } } return 0; }
bool ShellBrowser::select_folder | ( | Entry * | entry, |
bool | expand | ||
) |
Definition at line 580 of file shellbrowser.cpp.
References _last_sel, _left_hwnd, CONTEXT, and TreeView_GetItemData().
{ CONTEXT("ShellBrowser::expand_folder()"); if (!_last_sel) return false; if (!TreeView_Expand(_left_hwnd, _last_sel, TVE_EXPAND)) return false; for(HTREEITEM hitem=TreeView_GetChild(_left_hwnd,_last_sel); hitem; hitem=TreeView_GetNextSibling(_left_hwnd,hitem)) { if ((ShellDirectory*)TreeView_GetItemData(_left_hwnd,hitem) == entry) { if (TreeView_SelectItem(_left_hwnd, hitem)) { if (expand) if (!TreeView_Expand(_left_hwnd, hitem, TVE_EXPAND)) return false; return true; } break; } } return false; }
virtual HRESULT STDMETHODCALLTYPE ShellBrowser::SendControlMsg | ( | UINT | id, |
UINT | uMsg, | ||
WPARAM | wParam, | ||
LPARAM | lParam, | ||
LRESULT * | pret | ||
) | [inline, virtual] |
Definition at line 104 of file shellbrowser.h.
References _hwndFrame, HWND, and PM_GET_CONTROLWINDOW.
{ if (!pret) return E_POINTER; HWND hstatusbar = (HWND)SendMessage(_hwndFrame, PM_GET_CONTROLWINDOW, id, 0); if (hstatusbar) { *pret = ::SendMessage(hstatusbar, uMsg, wParam, lParam); return S_OK; } return E_NOTIMPL; }
void ShellBrowser::UpdateFolderView | ( | IShellFolder * | folder ) |
Definition at line 413 of file shellbrowser.cpp.
References _create_info, _folder, _hwnd, ShellPathInfo::_open_mode, _pShellView, _right_hwnd, CONTEXT, and OWM_DETAILS.
Referenced by jump_to().
{ CONTEXT("ShellBrowser::UpdateFolderView()"); FOLDERSETTINGS fs; IShellView* pLastShellView = _pShellView; _folder = folder; if (pLastShellView) pLastShellView->GetCurrentInfo(&fs); else { fs.ViewMode = _create_info._open_mode&OWM_DETAILS? FVM_DETAILS: FVM_ICON; fs.fFlags = FWF_NOCLIENTEDGE|FWF_BESTFITWINDOW; } #ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005) SFV_CREATE sfv_create; sfv_create.cbSize = sizeof(SFV_CREATE); sfv_create.pshf = folder; sfv_create.psvOuter = NULL; sfv_create.psfvcb = this; HRESULT hr = SHCreateShellFolderView(&sfv_create, &_pShellView); #else HRESULT hr = folder->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView); #endif if (FAILED(hr)) { _pShellView = NULL; return; } RECT rect = {CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT}; hr = _pShellView->CreateViewWindow(pLastShellView, &fs, static_cast<IShellBrowser*>(this), &rect, &_right_hwnd/*&m_hWndListView*/); if (pLastShellView) { pLastShellView->GetCurrentInfo(&fs); pLastShellView->UIActivate(SVUIA_DEACTIVATE); pLastShellView->DestroyViewWindow(); pLastShellView->Release(); } _pShellView->UIActivate(SVUIA_ACTIVATE_NOFOCUS); }
BrowserCallback* ShellBrowser::_callback [protected] |
Definition at line 152 of file shellbrowser.h.
Referenced by jump_to(), and OnTreeItemSelected().
CtxMenuInterfaces& ShellBrowser::_cm_ifs [protected] |
Definition at line 164 of file shellbrowser.h.
Referenced by OnTreeItemRClick().
ShellPathInfo& ShellBrowser::_create_info [protected] |
Definition at line 149 of file shellbrowser.h.
Referenced by Init(), and UpdateFolderView().
ShellDirectory* ShellBrowser::_cur_dir [protected] |
Definition at line 162 of file shellbrowser.h.
Referenced by jump_to().
ShellFolder ShellBrowser::_folder [protected] |
Definition at line 154 of file shellbrowser.h.
Referenced by UpdateFolderView().
HIMAGELIST ShellBrowser::_himl [protected] |
Definition at line 150 of file shellbrowser.h.
Referenced by get_image_idx(), InitializeTree(), invalidate_cache(), and ~ShellBrowser().
HIMAGELIST ShellBrowser::_himl_old [protected] |
Definition at line 151 of file shellbrowser.h.
Referenced by InitializeTree(), invalidate_cache(), and ~ShellBrowser().
HWND ShellBrowser::_hwnd [protected] |
Definition at line 145 of file shellbrowser.h.
Referenced by GetWindow(), Init(), OnTreeItemRClick(), and UpdateFolderView().
HWND ShellBrowser::_hwndFrame [protected] |
Definition at line 146 of file shellbrowser.h.
Referenced by GetControlWindow(), OnDefaultCommand(), and SendControlMsg().
map<int, int> ShellBrowser::_image_map [protected] |
Definition at line 176 of file shellbrowser.h.
Referenced by get_image_idx(), and invalidate_cache().
HTREEITEM ShellBrowser::_last_sel [protected] |
Definition at line 159 of file shellbrowser.h.
Referenced by OnDefaultCommand(), OnTreeItemSelected(), and select_folder().
HWND ShellBrowser::_left_hwnd [protected] |
Definition at line 147 of file shellbrowser.h.
Referenced by GetControlWindow(), Init(), InitDragDrop(), InitializeTree(), InsertSubitems(), invalidate_cache(), jump_to_pidl(), OnDefaultCommand(), OnTreeItemExpanding(), OnTreeItemRClick(), select_entry(), select_folder(), and ~ShellBrowser().
TreeDropTarget* ShellBrowser::_pDropTarget [protected] |
Definition at line 157 of file shellbrowser.h.
Referenced by InitDragDrop(), and ~ShellBrowser().
IShellView* ShellBrowser::_pShellView [protected] |
Definition at line 156 of file shellbrowser.h.
Referenced by QueryActiveShellView(), UpdateFolderView(), and ~ShellBrowser().
WindowHandle& ShellBrowser::_right_hwnd [protected] |
Definition at line 148 of file shellbrowser.h.
Referenced by UpdateFolderView(), and ~ShellBrowser().
Root ShellBrowser::_root [protected] |
Definition at line 161 of file shellbrowser.h.
Referenced by get_root(), Init(), InitializeTree(), jump_to(), and jump_to_pidl().
ROS Explorer Source Code Documentation
generated on 02.01.2013 by ![]() |