本文整理汇总了C++中WebDragData类的典型用法代码示例。如果您正苦于以下问题:C++ WebDragData类的具体用法?C++ WebDragData怎么用?C++ WebDragData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WebDragData类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: beginDragWithFiles
void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVariant* result)
{
currentDragData.initialize();
Vector<string> files = arguments[0].toStringVector();
Vector<WebString> absoluteFilenames;
for (size_t i = 0; i < files.size(); ++i) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeFilename;
item.filenameData = webkit_support::GetAbsoluteWebStringFromUTF8Path(files[i]);
currentDragData.addItem(item);
absoluteFilenames.append(item.filenameData);
}
currentDragData.setFilesystemId(webkit_support::RegisterIsolatedFileSystem(absoluteFilenames));
currentDragEffectsAllowed = WebKit::WebDragOperationCopy;
// Provide a drag source.
webview()->dragTargetDragEnter(currentDragData, lastMousePos, lastMousePos, currentDragEffectsAllowed);
// dragMode saves events and then replays them later. We don't need/want that.
dragMode.set(false);
// Make the rest of eventSender think a drag is in progress.
pressedButton = WebMouseEvent::ButtonLeft;
result->setNull();
}
开发者ID:,项目名称:,代码行数:26,代码来源:
示例2: itemList
WebDragData DataObject::toWebDragData() {
WebDragData data;
data.initialize();
data.setModifierKeyState(m_modifiers);
WebVector<WebDragData::Item> itemList(length());
for (size_t i = 0; i < length(); ++i) {
DataObjectItem* originalItem = item(i);
WebDragData::Item item;
if (originalItem->kind() == DataObjectItem::StringKind) {
item.storageType = WebDragData::Item::StorageTypeString;
item.stringType = originalItem->type();
item.stringData = originalItem->getAsString();
} else if (originalItem->kind() == DataObjectItem::FileKind) {
if (originalItem->sharedBuffer()) {
item.storageType = WebDragData::Item::StorageTypeBinaryData;
item.binaryData = originalItem->sharedBuffer();
} else if (originalItem->isFilename()) {
Blob* blob = originalItem->getAsFile();
if (blob->isFile()) {
File* file = toFile(blob);
if (file->hasBackingFile()) {
item.storageType = WebDragData::Item::StorageTypeFilename;
item.filenameData = file->path();
item.displayNameData = file->name();
} else if (!file->fileSystemURL().isEmpty()) {
item.storageType = WebDragData::Item::StorageTypeFileSystemFile;
item.fileSystemURL = file->fileSystemURL();
item.fileSystemFileSize = file->size();
} else {
// FIXME: support dragging constructed Files across renderers, see
// http://crbug.com/394955
item.storageType = WebDragData::Item::StorageTypeString;
item.stringType = "text/plain";
item.stringData = file->name();
}
} else {
ASSERT_NOT_REACHED();
}
} else {
ASSERT_NOT_REACHED();
}
} else {
ASSERT_NOT_REACHED();
}
item.title = originalItem->title();
item.baseURL = originalItem->baseURL();
itemList[i] = item;
}
data.swapItems(itemList);
return data;
}
开发者ID:,项目名称:,代码行数:52,代码来源:
示例3: dumpFilenameBeingDragged
void EventSender::dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*)
{
WebString filename;
WebVector<WebDragData::Item> items = currentDragData.items();
for (size_t i = 0; i < items.size(); ++i) {
if (items[i].storageType == WebDragData::Item::StorageTypeBinaryData) {
filename = items[i].title;
break;
}
}
printf("Filename being dragged: %s\n", filename.utf8().data());
}
开发者ID:,项目名称:,代码行数:12,代码来源:
示例4: reset
void EventSender::reset()
{
// The test should have finished a drag and the mouse button state.
ASSERT(currentDragData.isNull());
currentDragData.reset();
currentDragEffect = WebKit::WebDragOperationNone;
currentDragEffectsAllowed = WebKit::WebDragOperationNone;
pressedButton = WebMouseEvent::ButtonNone;
dragMode.set(true);
#if OS(WINDOWS)
wmKeyDown.set(WM_KEYDOWN);
wmKeyUp.set(WM_KEYUP);
wmChar.set(WM_CHAR);
wmDeadChar.set(WM_DEADCHAR);
wmSysKeyDown.set(WM_SYSKEYDOWN);
wmSysKeyUp.set(WM_SYSKEYUP);
wmSysChar.set(WM_SYSCHAR);
wmSysDeadChar.set(WM_SYSDEADCHAR);
#endif
lastMousePos = WebPoint(0, 0);
lastClickTimeSec = 0;
lastClickPos = WebPoint(0, 0);
clickCount = 0;
lastButtonType = WebMouseEvent::ButtonNone;
timeOffsetMs = 0;
touchModifiers = 0;
touchPoints.clear();
m_taskList.revokeAll();
}
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:29,代码来源:EventSender.cpp
示例5: doMouseMove
void EventSender::doMouseMove(const WebMouseEvent& e)
{
lastMousePos = WebPoint(e.x, e.y);
webview()->handleInputEvent(e);
if (pressedButton == WebMouseEvent::ButtonNone || currentDragData.isNull())
return;
WebPoint clientPoint(e.x, e.y);
WebPoint screenPoint(e.globalX, e.globalY);
currentDragEffect = webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed);
}
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:12,代码来源:EventSender.cpp
示例6: doMouseUp
void EventSender::doMouseUp(const WebMouseEvent& e)
{
webview()->handleInputEvent(e);
pressedButton = WebMouseEvent::ButtonNone;
lastClickTimeSec = e.timeStampSeconds;
lastClickPos = lastMousePos;
// If we're in a drag operation, complete it.
if (currentDragData.isNull())
return;
WebPoint clientPoint(e.x, e.y);
WebPoint screenPoint(e.globalX, e.globalY);
currentDragEffect = webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed);
if (currentDragEffect)
webview()->dragTargetDrop(clientPoint, screenPoint);
else
webview()->dragTargetDragLeave();
webview()->dragSourceEndedAt(clientPoint, screenPoint, currentDragEffect);
webview()->dragSourceSystemDragEnded();
currentDragData.reset();
}
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:24,代码来源:EventSender.cpp
注:本文中的WebDragData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论