shellbrowserimpl.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2003 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  // shellbrowserimpl.cpp
00024  //
00025  // Martin Fuchs, 28.09.2003
00026  //
00027  // Credits: Thanks to Leon Finker for his explorer cabinet window example
00028  //
00029 
00030 
00031 #include <precomp.h>
00032 
00033 
00034 HRESULT IShellBrowserImpl::QueryInterface(REFIID iid, void** ppvObject)
00035 {
00036     if (!ppvObject)
00037         return E_POINTER;
00038 
00039     if (iid == IID_IUnknown)
00040         *ppvObject = (IUnknown*)static_cast<IShellBrowser*>(this);
00041     else if (iid == IID_IOleWindow)
00042         *ppvObject = static_cast<IOleWindow*>(this);
00043     else if (iid == IID_IShellBrowser)
00044         *ppvObject = static_cast<IShellBrowser*>(this);
00045     else if (iid == IID_ICommDlgBrowser)
00046         *ppvObject = static_cast<ICommDlgBrowser*>(this);
00047     else if (iid == IID_IServiceProvider)
00048         *ppvObject = static_cast<IServiceProvider*>(this);
00049     else {
00050         *ppvObject = NULL;
00051         return E_NOINTERFACE;
00052     }
00053 
00054     return S_OK;
00055 }
00056 
00057 HRESULT IShellBrowserImpl::QueryService(REFGUID guidService, REFIID riid, void** ppvObject)
00058 {
00059     if (!ppvObject)
00060         return E_POINTER;
00061 
00062     ///@todo use guidService
00063 
00064     if (riid == IID_IUnknown)
00065         *ppvObject = (IUnknown*)static_cast<IShellBrowser*>(this);
00066     else if (riid == IID_IOleWindow)
00067         *ppvObject = static_cast<IOleWindow*>(this);
00068     else if (riid == IID_IShellBrowser)
00069         *ppvObject = static_cast<IShellBrowser*>(this);
00070     else if (riid == IID_ICommDlgBrowser)
00071         *ppvObject = static_cast<ICommDlgBrowser*>(this);
00072     else if (riid == IID_IServiceProvider)
00073         *ppvObject = static_cast<IServiceProvider*>(this);
00074     else if (riid == IID_IOleCommandTarget)
00075         *ppvObject = static_cast<IOleCommandTarget*>(this);
00076     else {
00077         *ppvObject = NULL;
00078         return E_NOINTERFACE;
00079     }
00080 
00081     return S_OK;
00082 }
00083 
00084 HRESULT IShellBrowserImpl::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT* pCmdText)
00085 {
00086     return E_FAIL;  ///@todo implement IOleCommandTarget
00087 }
00088 
00089 HRESULT IShellBrowserImpl::Exec(const GUID* pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT* pvaIn, VARIANT* pvaOut)
00090 {
00091     return E_FAIL;  ///@todo implement IOleCommandTarget
00092 }
00093 
00094 
00095  // process default command: look for folders and traverse into them
00096 HRESULT IShellBrowserImpl::OnDefaultCommand(IShellView* ppshv)
00097 {
00098     IDataObject* selection;
00099 
00100     HRESULT hr = ppshv->GetItemObject(SVGIO_SELECTION, IID_IDataObject, (void**)&selection);
00101     if (FAILED(hr))
00102         return hr;
00103 
00104     PIDList pidList;
00105 
00106     hr = pidList.GetData(selection);
00107     if (FAILED(hr)) {
00108         selection->Release();
00109         return hr;
00110     }
00111 
00112     hr = OnDefaultCommand(pidList);
00113 
00114     selection->Release();
00115 
00116     return hr;
00117 }

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage