Owen Rudge : comctl32: Implement Copy, Merge and Clone methods in IImageList.

Alexandre Julliard julliard at winehq.org
Mon Nov 16 11:43:57 CST 2009


Module: wine
Branch: master
Commit: 76c7f280505fe6dc06068e320f3570eb87d03324
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=76c7f280505fe6dc06068e320f3570eb87d03324

Author: Owen Rudge <orudge at codeweavers.com>
Date:   Fri Nov 13 11:14:38 2009 -0600

comctl32: Implement Copy, Merge and Clone methods in IImageList.

---

 dlls/comctl32/imagelist.c |   61 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 0f2d042..71f77b0 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -3102,23 +3102,70 @@ static HRESULT WINAPI ImageListImpl_GetImageInfo(IImageList *iface, int i,
 static HRESULT WINAPI ImageListImpl_Copy(IImageList *iface, int iDst,
     IUnknown *punkSrc, int iSrc, UINT uFlags)
 {
-    FIXME("STUB: %p %d %p %d %x\n", iface, iDst, punkSrc, iSrc, uFlags);
-    return E_NOTIMPL;
+    HIMAGELIST This = (HIMAGELIST) iface;
+    IImageList *src = NULL;
+    HRESULT ret;
+
+    if (!punkSrc)
+        return E_FAIL;
+
+    /* TODO: Add test for IID_ImageList2 too */
+    if (!SUCCEEDED(IImageList_QueryInterface(punkSrc, &IID_IImageList,
+            (void **) &src)))
+        return E_FAIL;
+
+    if (ImageList_Copy(This, iDst, (HIMAGELIST) src, iSrc, uFlags))
+        ret = S_OK;
+    else
+        ret = E_FAIL;
+
+    IImageList_Release(src);
+    return ret;
 }
 
 static HRESULT WINAPI ImageListImpl_Merge(IImageList *iface, int i1,
     IUnknown *punk2, int i2, int dx, int dy, REFIID riid, PVOID *ppv)
 {
-    FIXME("STUB: %p %d %p %d %d %d %s %p\n", iface, i1, punk2, i2, dx, dy,
-        debugstr_guid(riid), ppv);
-    return E_NOTIMPL;
+    HIMAGELIST This = (HIMAGELIST) iface;
+    IImageList *iml2 = NULL;
+    HIMAGELIST hNew;
+    HRESULT ret = E_FAIL;
+
+    if (!punk2 || !ppv)
+        return E_FAIL;
+
+    /* TODO: Add test for IID_ImageList2 too */
+    if (!SUCCEEDED(IImageList_QueryInterface(punk2, &IID_IImageList,
+            (void **) &iml2)))
+        return E_FAIL;
+
+    hNew = ImageList_Merge(This, i1, (HIMAGELIST) iml2, i2, dx, dy);
+
+    /* Get the interface for the new image list */
+    if (hNew)
+        ret = HIMAGELIST_QueryInterface(hNew, riid, ppv);
+
+    IImageList_Release(iml2);
+    return ret;
 }
 
 static HRESULT WINAPI ImageListImpl_Clone(IImageList *iface, REFIID riid,
     PVOID *ppv)
 {
-    FIXME("STUB: %p %s %p\n", iface, debugstr_guid(riid), ppv);
-    return E_NOTIMPL;
+    HIMAGELIST This = (HIMAGELIST) iface;
+    HIMAGELIST hNew;
+    HRESULT ret = E_FAIL;
+
+    if (!ppv)
+        return E_FAIL;
+
+    hNew = ImageList_Duplicate(This);
+
+    /* Get the interface for the new image list */
+    if (hNew)
+        ret = HIMAGELIST_QueryInterface(hNew, riid, ppv);
+
+    return ret;
 }
 
 static HRESULT WINAPI ImageListImpl_GetImageRect(IImageList *iface, int i,




More information about the wine-cvs mailing list