Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/uiribbon/Makefile.in | 1 + dlls/uiribbon/main.c | 1 + dlls/uiribbon/uiimage.c | 110 +++++++++++++++++++++++++++++++ dlls/uiribbon/uiribbon_private.h | 6 ++ 4 files changed, 118 insertions(+) create mode 100644 dlls/uiribbon/uiimage.c
diff --git a/dlls/uiribbon/Makefile.in b/dlls/uiribbon/Makefile.in index f41b4d4a55a..56d9c3ec93c 100644 --- a/dlls/uiribbon/Makefile.in +++ b/dlls/uiribbon/Makefile.in @@ -5,6 +5,7 @@ EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ main.c \ + uiimage.c \ uiribbon.c
IDL_SRCS = uiribbon_classes.idl diff --git a/dlls/uiribbon/main.c b/dlls/uiribbon/main.c index a76c349ad96..7f86d48f9b7 100644 --- a/dlls/uiribbon/main.c +++ b/dlls/uiribbon/main.c @@ -77,6 +77,7 @@ struct object_creation_info static const struct object_creation_info object_creation[] = { { &CLSID_UIRibbonFramework, UIRibbonFrameworkImpl_Create }, + { &CLSID_UIRibbonImageFromBitmapFactory, UIRibbonImageFromBitmapFactoryImpl_Create }, };
static HRESULT WINAPI XFCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, void **ppobj) diff --git a/dlls/uiribbon/uiimage.c b/dlls/uiribbon/uiimage.c new file mode 100644 index 00000000000..6f10159cbaa --- /dev/null +++ b/dlls/uiribbon/uiimage.c @@ -0,0 +1,110 @@ +/* + * Copyright 2021 Vijay Kiran Kamuju + * + * 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 "wine/debug.h" + +#define COBJMACROS + +#include "uiribbon_private.h" + +#include <stdio.h> + +WINE_DEFAULT_DEBUG_CHANNEL(uiribbon); + +static inline UIRibbonImageFromBitmapFactoryImpl *impl_from_IUIImageFromBitmap(IUIImageFromBitmap *iface) +{ + return CONTAINING_RECORD(iface, UIRibbonImageFromBitmapFactoryImpl, IUIImageFromBitmap_iface); +} + +/*** IUnknown methods ***/ + +static HRESULT WINAPI UIRibbonImageFromBitmapFactoryImpl_QueryInterface(IUIImageFromBitmap *iface, REFIID riid, void **ppvObject) +{ + UIRibbonImageFromBitmapFactoryImpl *This = impl_from_IUIImageFromBitmap(iface); + + TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); + + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IUIImageFromBitmap)) + { + IUnknown_AddRef(iface); + *ppvObject = &This->IUIImageFromBitmap_iface; + return S_OK; + } + + ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject); + return E_NOINTERFACE; +} + +static ULONG WINAPI UIRibbonImageFromBitmapFactoryImpl_AddRef(IUIImageFromBitmap *iface) +{ + UIRibbonImageFromBitmapFactoryImpl *This = impl_from_IUIImageFromBitmap(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref); + + return ref; +} + +static ULONG WINAPI UIRibbonImageFromBitmapFactoryImpl_Release(IUIImageFromBitmap *iface) +{ + UIRibbonImageFromBitmapFactoryImpl *This = impl_from_IUIImageFromBitmap(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref); + + if (!ref) + HeapFree(GetProcessHeap(), 0, This); + + return ref; +} + +/*** IUIImageFromBitmap methods ***/ + +static HRESULT WINAPI UIRibbonImageFromBitmapFactoryImpl_CreateImage(IUIImageFromBitmap *iface, HBITMAP bitmap, UI_OWNERSHIP options, IUIImage **image) +{ + FIXME("(%p %d %p): stub!\n", bitmap, options, image); + + return E_NOTIMPL; +} + +static const IUIImageFromBitmapVtbl IUIImageFromBitmap_Vtbl = +{ + UIRibbonImageFromBitmapFactoryImpl_QueryInterface, + UIRibbonImageFromBitmapFactoryImpl_AddRef, + UIRibbonImageFromBitmapFactoryImpl_Release, + UIRibbonImageFromBitmapFactoryImpl_CreateImage +}; + +HRESULT UIRibbonImageFromBitmapFactoryImpl_Create(IUnknown *pUnkOuter, void **ppObj) +{ + UIRibbonImageFromBitmapFactoryImpl *object; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(UIRibbonImageFromBitmapFactoryImpl)); + if (!object) + return E_OUTOFMEMORY; + + object->IUIImageFromBitmap_iface.lpVtbl = &IUIImageFromBitmap_Vtbl; + object->ref = 1; + + *ppObj = &object->IUIImageFromBitmap_iface; + + return S_OK; +} diff --git a/dlls/uiribbon/uiribbon_private.h b/dlls/uiribbon/uiribbon_private.h index 9d7481533d0..b9334e43bbd 100644 --- a/dlls/uiribbon/uiribbon_private.h +++ b/dlls/uiribbon/uiribbon_private.h @@ -26,7 +26,13 @@ typedef struct { LONG ref; } UIRibbonFrameworkImpl;
+typedef struct { + IUIImageFromBitmap IUIImageFromBitmap_iface; + LONG ref; +} UIRibbonImageFromBitmapFactoryImpl; + HRESULT UIRibbonFrameworkImpl_Create(IUnknown *pUnkOuter, void **ppObj) DECLSPEC_HIDDEN; +HRESULT UIRibbonImageFromBitmapFactoryImpl_Create(IUnknown *pUnkOuter, void **ppObj) DECLSPEC_HIDDEN;
#endif /* __UIRIBBON_PRIVATE_INCLUDED__ */