#include <idraganddrop.h>
Public Member Functions |
|
| DropClipFormat () | |
| virtual bool | CheckClipFormat (IDataObject *pDataObject) |
| virtual DropType * | ParseDataObject (IDataObject *pDataObject) |
Static Public Member Functions |
|
| static CoreExport DropClipFormat * | FindClipFormat (IDataObject *pDataObject) |
Static Protected Attributes |
|
| static
CoreExport Tab < DropClipFormat * > |
clipFmts |
| DropClipFormat | ( | ) | [inline] |
{ DropClipFormat* cf = this; clipFmts.Append(1, &cf); }
| static CoreExport DropClipFormat* FindClipFormat | ( | IDataObject * | pDataObject | ) | [static] |
| virtual bool CheckClipFormat | ( | IDataObject * | pDataObject | ) | [inline, virtual] |
Reimplemented in IDropPackageClipFmt, VIZableClipFmt, and DropScriptClipFmt.
{ return false; }
| virtual DropType* ParseDataObject | ( | IDataObject * | pDataObject | ) | [inline, virtual] |
bool VIZableClipFmt::CheckClipFormat(IDataObject* pDataObject)
{
// accept CF_MAXURL clip formats
FORMATETC fmt = { NULL, NULL, DVASPECT_CONTENT, -1, NULL };
fmt.cfFormat = RegisterClipboardFormat(_M("CF_MAXURL"));
fmt.tymed = TYMED_HGLOBAL;
return SUCCEEDED(pDataObject->QueryGetData(&fmt)) ==
TRUE;
}
DropType* VIZableClipFmt::ParseDataObject(IDataObject* pDataObject)
{
// parse a CF_MAXURL clipformat into one of the FileDropTypes
&
// fill in the FileDropType::current_packge URLTab
HRESULT hr;
FORMATETC fmt = { NULL, NULL, DVASPECT_CONTENT, -1, NULL };
STGMEDIUM stg = { TYMED_NULL, NULL, NULL };
fmt.tymed = TYMED_HGLOBAL;
fmt.cfFormat = RegisterClipboardFormat(_M("CF_MAXURL"));
// clear out the file drop current data
FileDropType::Init();
// look for CF_MAXURL formats
hr = pDataObject->GetData(&fmt, &stg);
if(SUCCEEDED(hr)) {
// found, get the max file name
MCHAR szUrl[MAX_PATH];
ZeroMemory(szUrl, sizeof(szUrl));
wcstombs(szUrl,
reinterpret_cast<wchar_t*>(GlobalLock(stg.hGlobal)),
MAX_PATH-1);
GlobalUnlock(stg.hGlobal);
ReleaseStgMedium(&stg);
// add it to the current_package URLTab
FileDropType::current_package.Add(szUrl);
}
// if we have a non-NULL package, get the appropriate
// FileDropType (usually based on file extension), by asking the
// utility DropType finder in FileDropType
if (FileDropType::current_package.Count() > 0)
return FileDropType::FindDropType(
FileDropType::current_package[0], pDataObject);
else
return NULL;
}
Reimplemented in IDropPackageClipFmt, VIZableClipFmt, and DropScriptClipFmt.
{ return NULL; }
CoreExport Tab<DropClipFormat*> clipFmts
[static, protected] |