Author: hpoussin
Date: Mon Nov 12 23:59:59 2007
New Revision: 30406
URL:
http://svn.reactos.org/svn/reactos?rev=30406&view=rev
Log:
Add IOleCommandTarget to BandSite object
Add BandSiteMenu object
Fix some bugs
Added:
trunk/reactos/dll/win32/browseui/bandsitemenu.c (with props)
Modified:
trunk/reactos/dll/win32/browseui/bandsite.c
trunk/reactos/dll/win32/browseui/browseui.h
trunk/reactos/dll/win32/browseui/browseui.rbuild
trunk/reactos/dll/win32/browseui/browseui_main.c
trunk/reactos/dll/win32/browseui/regsvr.c
Modified: trunk/reactos/dll/win32/browseui/bandsite.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/bandsit…
==============================================================================
--- trunk/reactos/dll/win32/browseui/bandsite.c (original)
+++ trunk/reactos/dll/win32/browseui/bandsite.c Mon Nov 12 23:59:59 2007
@@ -33,6 +33,7 @@
#include "winerror.h"
#include "objbase.h"
+#include "docobj.h"
#include "shlguid.h"
#include "shlobj.h"
#include "shobjidl.h"
@@ -54,14 +55,17 @@
const IBandSiteVtbl *vtbl;
const IWindowEventHandlerVtbl *eventhandlerVtbl;
const IDeskBarClientVtbl *deskbarVtbl;
+ const IOleCommandTargetVtbl *oletargetVtbl;
LONG refCount;
INT nObjs;
struct SubBand *objs;
+ IUnknown *pUnkOuter;
} BandSite;
static const IBandSiteVtbl BandSiteVtbl;
static const IWindowEventHandlerVtbl BandSite_EventHandlerVtbl;
static const IDeskBarClientVtbl BandSite_DeskBarVtbl;
+static const IOleCommandTargetVtbl BandSite_OleTargetVtbl;
static inline BandSite *impl_from_IWindowEventHandler(IWindowEventHandler *iface)
{
@@ -71,6 +75,11 @@
static inline BandSite *impl_from_IDeskBarClient(IDeskBarClient *iface)
{
return (BandSite *)((char *)iface - FIELD_OFFSET(BandSite, deskbarVtbl));
+}
+
+static inline BandSite *impl_from_IOleCommandTarget(IOleCommandTarget *iface)
+{
+ return (BandSite *)((char *)iface - FIELD_OFFSET(BandSite, oletargetVtbl));
}
static struct SubBand *get_band(BandSite *This, DWORD dwBandID)
@@ -91,15 +100,20 @@
HRESULT WINAPI BandSite_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
{
BandSite *This;
- if (pUnkOuter)
- return CLASS_E_NOAGGREGATION;
+
+ if (!pUnkOuter)
+ return E_POINTER;
This = CoTaskMemAlloc(sizeof(BandSite));
if (This == NULL)
return E_OUTOFMEMORY;
ZeroMemory(This, sizeof(*This));
+ This->pUnkOuter = pUnkOuter;
+ IUnknown_AddRef(pUnkOuter);
This->vtbl = &BandSiteVtbl;
This->eventhandlerVtbl = &BandSite_EventHandlerVtbl;
+ This->deskbarVtbl = &BandSite_DeskBarVtbl;
+ This->oletargetVtbl = &BandSite_OleTargetVtbl;
This->refCount = 1;
TRACE("returning %p\n", This);
@@ -112,6 +126,7 @@
{
int i;
TRACE("destroying %p\n", This);
+ IUnknown_Release(This->pUnkOuter);
for (i = 0; i < This->nObjs; i++)
release_obj(&This->objs[i]);
CoTaskMemFree(This->objs);
@@ -124,9 +139,11 @@
BandSite *This = (BandSite *)iface;
*ppvOut = NULL;
+ TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
+
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IBandSite))
{
- *ppvOut = This;
+ *ppvOut = &This->vtbl;
}
else if (IsEqualIID(iid, &IID_IWindowEventHandler))
{
@@ -136,6 +153,10 @@
{
*ppvOut = &This->deskbarVtbl;
}
+ else if (IsEqualIID(iid, &IID_IOleCommandTarget))
+ {
+ *ppvOut = &This->oletargetVtbl;
+ }
if (*ppvOut)
{
@@ -150,6 +171,7 @@
static ULONG WINAPI BandSite_AddRef(IBandSite *iface)
{
BandSite *This = (BandSite *)iface;
+ TRACE("(%p)\n", iface);
return InterlockedIncrement(&This->refCount);
}
@@ -157,6 +179,8 @@
{
BandSite *This = (BandSite *)iface;
ULONG ret;
+
+ TRACE("(%p)\n", iface);
ret = InterlockedDecrement(&This->refCount);
if (ret == 0)
@@ -169,6 +193,8 @@
BandSite *This = (BandSite *)iface;
struct SubBand *newObjs, *current;
DWORD freeID;
+
+ TRACE("(%p, %p)\n", iface, punk);
newObjs = CoTaskMemAlloc((This->nObjs + 1) * sizeof(struct SubBand));
if (!newObjs)
@@ -193,6 +219,8 @@
{
BandSite *This = (BandSite *)iface;
+ TRACE("(%p, %u, %p)\n", iface, uBand, pdwBandID);
+
if (uBand >= This->nObjs)
return E_FAIL;
@@ -204,11 +232,14 @@
{
BandSite *This = (BandSite *)iface;
struct SubBand *band;
+
+ TRACE("(%p, %u, %p, %p, %p, %d)\n", iface, dwBandID, ppstb, pdwState,
pszName, cchName);
band = get_band(This, dwBandID);
if (!band)
return E_FAIL;
+ FIXME("Stub\n");
return E_NOTIMPL;
}
@@ -216,11 +247,14 @@
{
BandSite *This = (BandSite *)iface;
struct SubBand *band;
+
+ TRACE("(%p, %u, %x, %x)\n", iface, dwBandID, dwMask, dwState);
band = get_band(This, dwBandID);
if (!band)
return E_FAIL;
+ FIXME("Stub\n");
return E_NOTIMPL;
}
@@ -228,6 +262,8 @@
{
BandSite *This = (BandSite *)iface;
struct SubBand *band;
+
+ TRACE("(%p, %u)\n", iface, dwBandID);
band = get_band(This, dwBandID);
if (!band)
@@ -243,6 +279,8 @@
BandSite *This = (BandSite *)iface;
struct SubBand *band;
+ TRACE("(%p, %u, %s, %p)\n", iface, dwBandID, debugstr_guid(riid), ppv);
+
band = get_band(This, dwBandID);
if (!band)
return E_FAIL;
@@ -252,11 +290,13 @@
static HRESULT WINAPI BandSite_SetBandSiteInfo(IBandSite *iface, const BANDSITEINFO
*pbsinfo)
{
+ FIXME("(%p, %p)\n", iface, pbsinfo);
return E_NOTIMPL;
}
static HRESULT WINAPI BandSite_GetBandSiteInfo(IBandSite *iface, BANDSITEINFO *pbsinfo)
{
+ FIXME("(%p, %p)\n", iface, pbsinfo);
return E_NOTIMPL;
}
@@ -279,28 +319,33 @@
static HRESULT WINAPI BandSite_IWindowEventHandler_QueryInterface(IWindowEventHandler
*iface, REFIID iid, LPVOID *ppvOut)
{
BandSite *This = impl_from_IWindowEventHandler(iface);
+ TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
return BandSite_QueryInterface((IBandSite *)This, iid, ppvOut);
}
static ULONG WINAPI BandSite_IWindowEventHandler_AddRef(IWindowEventHandler *iface)
{
BandSite *This = impl_from_IWindowEventHandler(iface);
+ TRACE("(%p)\n", iface);
return BandSite_AddRef((IBandSite *)This);
}
static ULONG WINAPI BandSite_IWindowEventHandler_Release(IWindowEventHandler *iface)
{
BandSite *This = impl_from_IWindowEventHandler(iface);
+ TRACE("(%p)\n", iface);
return BandSite_Release((IBandSite *)This);
}
static HRESULT WINAPI BandSite_ProcessMessage(IWindowEventHandler *iface, HWND hWnd, UINT
uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult)
{
+ FIXME("(%p, %p, %u, %p, %p, %p)\n", iface, hWnd, uMsg, wParam, lParam,
plrResult);
return E_NOTIMPL;
}
static HRESULT WINAPI BandSite_ContainsWindow(IWindowEventHandler *iface, HWND hWnd)
{
+ FIXME("(%p, %p)\n", iface, hWnd);
return E_NOTIMPL;
}
@@ -317,48 +362,57 @@
static HRESULT WINAPI BandSite_IDeskBarClient_QueryInterface(IDeskBarClient *iface,
REFIID iid, LPVOID *ppvOut)
{
BandSite *This = impl_from_IDeskBarClient(iface);
+ TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
return BandSite_QueryInterface((IBandSite *)This, iid, ppvOut);
}
static ULONG WINAPI BandSite_IDeskBarClient_AddRef(IDeskBarClient *iface)
{
BandSite *This = impl_from_IDeskBarClient(iface);
+ TRACE("(%p)\n", iface);
return BandSite_AddRef((IBandSite *)This);
}
static ULONG WINAPI BandSite_IDeskBarClient_Release(IDeskBarClient *iface)
{
BandSite *This = impl_from_IDeskBarClient(iface);
+ TRACE("(%p)\n", iface);
return BandSite_Release((IBandSite *)This);
}
static HRESULT WINAPI BandSite_IDeskBarClient_GetWindow(IDeskBarClient *iface, HWND
*phWnd)
{
+ FIXME("(%p, %p)\n", iface, phWnd);
return E_NOTIMPL;
}
static HRESULT WINAPI BandSite_IDeskBarClient_ContextSensitiveHelp(IDeskBarClient *iface,
BOOL fEnterMode)
{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI BandSite_SetDeskBarSite(IDeskBarClient *iface, IUnknown *pUnk)
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI BandSite_SetModeDBC(IDeskBarClient *iface, DWORD unknown)
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI BandSite_UIActivateDBC(IDeskBarClient *iface, DWORD unknown)
-{
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI BandSite_GetSize(IDeskBarClient *iface, DWORD unknown1, LPRECT
unknown2)
-{
+ FIXME("(%p, %d)\n", iface, fEnterMode);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI BandSite_IDeskBarClient_SetDeskBarSite(IDeskBarClient *iface,
IUnknown *pUnk)
+{
+ FIXME("(%p, %p)\n", iface, pUnk);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI BandSite_IDeskBarClient_SetModeDBC(IDeskBarClient *iface, DWORD
unknown)
+{
+ FIXME("(%p, %x)\n", iface, unknown);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI BandSite_IDeskBarClient_UIActivateDBC(IDeskBarClient *iface, DWORD
unknown)
+{
+ FIXME("(%p, %x)\n", iface, unknown);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI BandSite_IDeskBarClient_GetSize(IDeskBarClient *iface, DWORD
unknown1, LPRECT unknown2)
+{
+ FIXME("(%p, %x, %p)\n", iface, unknown1, unknown2);
return E_NOTIMPL;
}
@@ -371,8 +425,51 @@
BandSite_IDeskBarClient_GetWindow,
BandSite_IDeskBarClient_ContextSensitiveHelp,
- BandSite_SetDeskBarSite,
- BandSite_SetModeDBC,
- BandSite_UIActivateDBC,
- BandSite_GetSize,
+ BandSite_IDeskBarClient_SetDeskBarSite,
+ BandSite_IDeskBarClient_SetModeDBC,
+ BandSite_IDeskBarClient_UIActivateDBC,
+ BandSite_IDeskBarClient_GetSize,
};
+
+static HRESULT WINAPI BandSite_IOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
REFIID iid, LPVOID *ppvOut)
+{
+ BandSite *This = impl_from_IOleCommandTarget(iface);
+ TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
+ return BandSite_QueryInterface((IBandSite *)This, iid, ppvOut);
+}
+
+static ULONG WINAPI BandSite_IOleCommandTarget_AddRef(IOleCommandTarget *iface)
+{
+ BandSite *This = impl_from_IOleCommandTarget(iface);
+ TRACE("(%p)\n", iface);
+ return BandSite_AddRef((IBandSite *)This);
+}
+
+static ULONG WINAPI BandSite_IOleCommandTarget_Release(IOleCommandTarget *iface)
+{
+ BandSite *This = impl_from_IOleCommandTarget(iface);
+ TRACE("(%p)\n", iface);
+ return BandSite_Release((IBandSite *)This);
+}
+
+static HRESULT WINAPI BandSite_IOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
const GUID *pguidCmdGroup, DWORD cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
+{
+ FIXME("(%p, %p, %u, %p, %p)\n", iface, pguidCmdGroup, cCmds, prgCmds,
pCmdText);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI BandSite_IOleCommandTarget_Exec(IOleCommandTarget *iface, const
GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG
*pvaOut)
+{
+ FIXME("(%p, %p, %u, %u, %p, %p)\n", iface, pguidCmdGroup, nCmdID,
nCmdExecOpt, pvaIn, pvaOut);
+ return E_NOTIMPL;
+}
+
+static const IOleCommandTargetVtbl BandSite_OleTargetVtbl =
+{
+ BandSite_IOleCommandTarget_QueryInterface,
+ BandSite_IOleCommandTarget_AddRef,
+ BandSite_IOleCommandTarget_Release,
+
+ BandSite_IOleCommandTarget_QueryStatus,
+ BandSite_IOleCommandTarget_Exec,
+};
Added: trunk/reactos/dll/win32/browseui/bandsitemenu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/bandsit…
==============================================================================
--- trunk/reactos/dll/win32/browseui/bandsitemenu.c (added)
+++ trunk/reactos/dll/win32/browseui/bandsitemenu.c Mon Nov 12 23:59:59 2007
@@ -1,0 +1,132 @@
+/*
+ * Band site menu
+ *
+ * Copyright 2007 Hervé Poussineua
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#define COBJMACROS
+
+#include "wine/debug.h"
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+
+#include "shlobj.h"
+#include "shobjidl.h"
+#include "todo.h"
+
+#include "browseui.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(browseui);
+
+typedef struct _tagBandSiteMenu {
+ const IShellServiceVtbl *vtbl;
+ LONG refCount;
+} BandSiteMenu;
+
+static const IShellServiceVtbl BandSiteMenuVtbl;
+
+static inline BandSiteMenu *impl_from_IShellService(IShellService *iface)
+{
+ return (BandSiteMenu *)((char *)iface - FIELD_OFFSET(BandSiteMenu, vtbl));
+}
+
+HRESULT WINAPI BandSiteMenu_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
+{
+ BandSiteMenu *This;
+
+ if (pUnkOuter)
+ return CLASS_E_NOAGGREGATION;
+
+ This = CoTaskMemAlloc(sizeof(BandSiteMenu));
+ if (This == NULL)
+ return E_OUTOFMEMORY;
+ ZeroMemory(This, sizeof(*This));
+ This->vtbl = &BandSiteMenuVtbl;
+ This->refCount = 1;
+
+ TRACE("returning %p\n", This);
+ *ppOut = (IUnknown *)This;
+ BROWSEUI_refCount++;
+ return S_OK;
+}
+
+static void WINAPI BandSiteMenu_Destructor(BandSiteMenu *This)
+{
+ TRACE("destroying %p\n", This);
+ CoTaskMemFree(This);
+ BROWSEUI_refCount--;
+}
+
+static HRESULT WINAPI BandSiteMenu_QueryInterface(IShellService *iface, REFIID iid,
LPVOID *ppvOut)
+{
+ BandSiteMenu *This = impl_from_IShellService(iface);
+ *ppvOut = NULL;
+
+ TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
+
+ if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IShellService))
+ {
+ *ppvOut = &This->vtbl;
+ }
+
+ if (*ppvOut)
+ {
+ IUnknown_AddRef(iface);
+ return S_OK;
+ }
+
+ WARN("unsupported interface: %s\n", debugstr_guid(iid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI BandSiteMenu_AddRef(IShellService *iface)
+{
+ BandSiteMenu *This = impl_from_IShellService(iface);
+ TRACE("(%p)\n", iface);
+ return InterlockedIncrement(&This->refCount);
+}
+
+static ULONG WINAPI BandSiteMenu_Release(IShellService *iface)
+{
+ BandSiteMenu *This = impl_from_IShellService(iface);
+ ULONG ret;
+
+ TRACE("(%p)\n", iface);
+
+ ret = InterlockedDecrement(&This->refCount);
+ if (ret == 0)
+ BandSiteMenu_Destructor(This);
+ return ret;
+}
+
+static HRESULT WINAPI BandSiteMenu_SetOwner(IShellService *iface, IUnknown *pOwner)
+{
+ FIXME("(%p, %p)\n", iface, pOwner);
+ return E_NOTIMPL;
+}
+
+static const IShellServiceVtbl BandSiteMenuVtbl =
+{
+ BandSiteMenu_QueryInterface,
+ BandSiteMenu_AddRef,
+ BandSiteMenu_Release,
+
+ BandSiteMenu_SetOwner,
+};
Propchange: trunk/reactos/dll/win32/browseui/bandsitemenu.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/win32/browseui/browseui.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/browseu…
==============================================================================
--- trunk/reactos/dll/win32/browseui/browseui.h (original)
+++ trunk/reactos/dll/win32/browseui/browseui.h Mon Nov 12 23:59:59 2007
@@ -25,5 +25,6 @@
HRESULT WINAPI ACLMulti_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
HRESULT WINAPI BandSite_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
+HRESULT WINAPI BandSiteMenu_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
#endif /* __WINE_SHDOCVW_H */
Modified: trunk/reactos/dll/win32/browseui/browseui.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/browseu…
==============================================================================
--- trunk/reactos/dll/win32/browseui/browseui.rbuild (original)
+++ trunk/reactos/dll/win32/browseui/browseui.rbuild Mon Nov 12 23:59:59 2007
@@ -21,6 +21,7 @@
<library>ntdll</library>
<file>aclmulti.c</file>
<file>bandsite.c</file>
+ <file>bandsitemenu.c</file>
<file>browseui_main.c</file>
<file>regsvr.c</file>
<file>version.rc</file>
Modified: trunk/reactos/dll/win32/browseui/browseui_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/browseu…
==============================================================================
--- trunk/reactos/dll/win32/browseui/browseui_main.c (original)
+++ trunk/reactos/dll/win32/browseui/browseui_main.c Mon Nov 12 23:59:59 2007
@@ -51,6 +51,7 @@
} ClassesTable[] = {
{&CLSID_ACLMulti, ACLMulti_Constructor},
{&CLSID_RebarBandSite, BandSite_Constructor},
+ {&CLSID_IShellBandSiteMenu, BandSiteMenu_Constructor},
{NULL, NULL}
};
Modified: trunk/reactos/dll/win32/browseui/regsvr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/regsvr.…
==============================================================================
--- trunk/reactos/dll/win32/browseui/regsvr.c (original)
+++ trunk/reactos/dll/win32/browseui/regsvr.c Mon Nov 12 23:59:59 2007
@@ -456,6 +456,13 @@
"browseui.dll",
"Apartment"
},
+ {
+ &CLSID_IShellBandSiteMenu,
+ "Band Site Menu",
+ NULL,
+ "browseui.dll",
+ "Apartment"
+ },
{ NULL } /* list terminator */
};