mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
ShellBrowserImpl::OnDefaultCommand()
svn path=/trunk/; revision=6186
This commit is contained in:
parent
61382e6bca
commit
b48f5abd49
2 changed files with 109 additions and 30 deletions
99
reactos/subsys/system/explorer/utility/shellbrowserimpl.cpp
Normal file
99
reactos/subsys/system/explorer/utility/shellbrowserimpl.cpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright 2003 Martin Fuchs
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// Explorer clone
|
||||
//
|
||||
// shellbrowserimpl.cpp
|
||||
//
|
||||
// Martin Fuchs, 28.09.2003
|
||||
//
|
||||
// Credits: Thanks to Leon Finker for his explorer window example
|
||||
//
|
||||
|
||||
|
||||
#include "utility.h"
|
||||
#include "shellclasses.h"
|
||||
#include "shellbrowserimpl.h"
|
||||
|
||||
|
||||
HRESULT IShellBrowserImpl::QueryInterface(REFIID iid, void** ppvObject)
|
||||
{
|
||||
if (!ppvObject)
|
||||
return E_POINTER;
|
||||
|
||||
if (iid == IID_IUnknown)
|
||||
*ppvObject = (IUnknown*)static_cast<IShellBrowser*>(this);
|
||||
else if (iid == IID_IOleWindow)
|
||||
*ppvObject = static_cast<IOleWindow*>(this);
|
||||
else if (iid == IID_IShellBrowser)
|
||||
*ppvObject = static_cast<IShellBrowser*>(this);
|
||||
else if (iid == IID_ICommDlgBrowser)
|
||||
*ppvObject = static_cast<ICommDlgBrowser*>(this);
|
||||
else {
|
||||
*ppvObject = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
// process default command: look for folders and traverse into them
|
||||
HRESULT IShellBrowserImpl::OnDefaultCommand(IShellView* ppshv)
|
||||
{
|
||||
static UINT CF_IDLIST = RegisterClipboardFormat(CFSTR_SHELLIDLIST);
|
||||
|
||||
IDataObject* selection;
|
||||
HRESULT hr = ppshv->GetItemObject(SVGIO_SELECTION, IID_IDataObject, (void**)&selection);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
||||
FORMATETC fetc;
|
||||
fetc.cfFormat = CF_IDLIST;
|
||||
fetc.ptd = NULL;
|
||||
fetc.dwAspect = DVASPECT_CONTENT;
|
||||
fetc.lindex = -1;
|
||||
fetc.tymed = TYMED_HGLOBAL;
|
||||
|
||||
hr = selection->QueryGetData(&fetc);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
||||
STGMEDIUM stgm = {sizeof(STGMEDIUM), {0}, 0};
|
||||
|
||||
hr = selection->GetData(&fetc, &stgm);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
DWORD pData = (DWORD)GlobalLock(stgm.hGlobal);
|
||||
LPIDA pIDList = (LPIDA)pData;
|
||||
|
||||
HRESULT ret = OnDefaultCommand(pIDList);
|
||||
|
||||
GlobalUnlock(stgm.hGlobal);
|
||||
ReleaseStgMedium(&stgm);
|
||||
|
||||
|
||||
selection->Release();
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -35,26 +35,7 @@ struct IShellBrowserImpl : public IShellBrowser, public ICommDlgBrowser
|
|||
{
|
||||
}
|
||||
|
||||
STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject)
|
||||
{
|
||||
if (!ppvObject)
|
||||
return E_POINTER;
|
||||
|
||||
if (iid == IID_IUnknown)
|
||||
*ppvObject = (IUnknown*)static_cast<IShellBrowser*>(this);
|
||||
else if (iid == IID_IOleWindow)
|
||||
*ppvObject = static_cast<IOleWindow*>(this);
|
||||
else if (iid == IID_IShellBrowser)
|
||||
*ppvObject = static_cast<IShellBrowser*>(this);
|
||||
else if (iid == IID_ICommDlgBrowser)
|
||||
*ppvObject = static_cast<ICommDlgBrowser*>(this);
|
||||
else {
|
||||
*ppvObject = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHOD(QueryInterface)(REFIID iid, void** ppvObject);
|
||||
|
||||
STDMETHOD_(ULONG, AddRef)() {return ++_dwRef;}
|
||||
STDMETHOD_(ULONG, Release)() {return --_dwRef;} //not heap based
|
||||
|
@ -63,35 +44,34 @@ struct IShellBrowserImpl : public IShellBrowser, public ICommDlgBrowser
|
|||
STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode) {return E_NOTIMPL;}
|
||||
|
||||
// *** ICommDlgBrowser methods ***
|
||||
STDMETHOD(OnDefaultCommand)(struct IShellView* ppshv)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
STDMETHOD(OnDefaultCommand)(IShellView* ppshv);
|
||||
|
||||
STDMETHOD(OnStateChange)(struct IShellView* ppshv, ULONG uChange)
|
||||
STDMETHOD(OnStateChange)(IShellView* ppshv, ULONG uChange)
|
||||
{ //handle selection, rename, focus if needed
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHOD(IncludeObject)(struct IShellView* ppshv, LPCITEMIDLIST pidl)
|
||||
STDMETHOD(IncludeObject)(IShellView* ppshv, LPCITEMIDLIST pidl)
|
||||
{ //filter files if needed
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// *** IShellBrowser methods *** (same as IOleInPlaceFrame)
|
||||
STDMETHOD(InsertMenusSB)(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) {return E_NOTIMPL;}
|
||||
STDMETHOD(SetMenuSB)(HMENU hmenuShared, HOLEMENU holemenuReserved,HWND hwndActiveObject) {return E_NOTIMPL;}
|
||||
STDMETHOD(SetMenuSB)(HMENU hmenuShared, HOLEMENU holemenuReserved, HWND hwndActiveObject) {return E_NOTIMPL;}
|
||||
STDMETHOD(RemoveMenusSB)(HMENU hmenuShared) {return E_NOTIMPL;}
|
||||
STDMETHOD(SetStatusTextSB)(LPCOLESTR lpszStatusText) {return E_NOTIMPL;}
|
||||
STDMETHOD(EnableModelessSB)(BOOL fEnable) {return E_NOTIMPL;}
|
||||
STDMETHOD(BrowseObject)(LPCITEMIDLIST pidl, UINT wFlags) {return E_NOTIMPL;}
|
||||
STDMETHOD(GetViewStateStream)(DWORD grfMode,LPSTREAM *ppStrm) {return E_NOTIMPL;}
|
||||
STDMETHOD(OnViewWindowActive)(struct IShellView *ppshv) {return E_NOTIMPL;}
|
||||
STDMETHOD(SetToolbarItems)(LPTBBUTTON lpButtons, UINT nButtons,UINT uFlags) {return E_NOTIMPL;}
|
||||
STDMETHOD(GetViewStateStream)(DWORD grfMode, LPSTREAM* ppStrm) {return E_NOTIMPL;}
|
||||
STDMETHOD(OnViewWindowActive)(IShellView* ppshv) {return E_NOTIMPL;}
|
||||
STDMETHOD(SetToolbarItems)(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags) {return E_NOTIMPL;}
|
||||
STDMETHOD(TranslateAcceleratorSB)(LPMSG lpmsg, WORD wID) {return S_OK;}
|
||||
|
||||
protected:
|
||||
DWORD _dwRef;
|
||||
|
||||
virtual HRESULT OnDefaultCommand(LPIDA pIDList) {return E_NOTIMPL;}
|
||||
};
|
||||
|
||||
#ifndef WM_GETISHELLBROWSER
|
||||
|
|
Loading…
Reference in a new issue