implement support for returning several elements at once from IEnumFORMATETC (part of patch 649438)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21818 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
875c17fa8f
commit
1f1c42109d
@ -187,31 +187,27 @@ wxIEnumFORMATETC::wxIEnumFORMATETC(const wxDataFormat *formats, ULONG nCount)
|
||||
|
||||
STDMETHODIMP wxIEnumFORMATETC::Next(ULONG celt,
|
||||
FORMATETC *rgelt,
|
||||
ULONG *WXUNUSED(pceltFetched))
|
||||
ULONG *pceltFetched)
|
||||
{
|
||||
wxLogTrace(wxTRACE_OleCalls, wxT("wxIEnumFORMATETC::Next"));
|
||||
|
||||
if ( celt > 1 ) {
|
||||
// we only return 1 element at a time - mainly because I'm too lazy to
|
||||
// implement something which you're never asked for anyhow
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
if ( m_nCurrent < m_nCount ) {
|
||||
ULONG numFetched = 0;
|
||||
while (m_nCurrent < m_nCount && numFetched < celt) {
|
||||
FORMATETC format;
|
||||
format.cfFormat = m_formats[m_nCurrent++];
|
||||
format.ptd = NULL;
|
||||
format.dwAspect = DVASPECT_CONTENT;
|
||||
format.lindex = -1;
|
||||
format.tymed = TYMED_HGLOBAL;
|
||||
*rgelt = format;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
else {
|
||||
// bad index
|
||||
return S_FALSE;
|
||||
*rgelt++ = format;
|
||||
numFetched++;
|
||||
}
|
||||
|
||||
if (pceltFetched)
|
||||
*pceltFetched = numFetched;
|
||||
|
||||
return numFetched == celt ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP wxIEnumFORMATETC::Skip(ULONG celt)
|
||||
|
Loading…
Reference in New Issue
Block a user