mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
61ce52a2a4
Conflicts: CefSharp.Core/SchemeHandlerFactoryWrapper.cpp CefSharp.Core/SchemeHandlerFactoryWrapper.h CefSharp.Core/SchemeHandlerResponse.cpp Merge merge merge, merges are fun.
166 lines
5.2 KiB
C++
166 lines
5.2 KiB
C++
// Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
#pragma once
|
|
|
|
#include "Stdafx.h"
|
|
#include "MCefRefPtr.h"
|
|
#include "include/cef_drag_data.h"
|
|
|
|
using namespace std;
|
|
using namespace System;
|
|
using namespace System::IO;
|
|
using namespace CefSharp;
|
|
|
|
namespace CefSharp
|
|
{
|
|
namespace Internals
|
|
{
|
|
public ref class CefDragDataWrapper : public IDragData
|
|
{
|
|
MCefRefPtr<CefDragData> _wrappedDragData;
|
|
internal:
|
|
CefDragDataWrapper(CefRefPtr<CefDragData> dragData) :
|
|
_wrappedDragData(dragData)
|
|
{
|
|
IsReadOnly = dragData->IsReadOnly();
|
|
FileName = StringUtils::ToClr(dragData->GetFileName());
|
|
IsFile = dragData->IsFile();
|
|
IsFragment = dragData->IsFragment();
|
|
IsLink = dragData->IsLink();
|
|
}
|
|
|
|
~CefDragDataWrapper()
|
|
{
|
|
_wrappedDragData = nullptr;
|
|
}
|
|
|
|
public:
|
|
virtual property bool IsReadOnly;
|
|
virtual property String^ FileName;
|
|
virtual property bool IsFile;
|
|
virtual property bool IsFragment;
|
|
virtual property bool IsLink;
|
|
|
|
///
|
|
// Create a new CefDragData object.
|
|
///
|
|
/*--cef()--*/
|
|
static CefDragDataWrapper^ Create()
|
|
{
|
|
CefRefPtr<CefDragData> cefDragData = CefDragData::Create();
|
|
return gcnew CefDragDataWrapper(cefDragData);
|
|
}
|
|
|
|
virtual property CefRefPtr<CefDragData>* InternalDragData
|
|
{
|
|
CefRefPtr<CefDragData>* get()
|
|
{
|
|
return new CefRefPtr<CefDragData>(_wrappedDragData.get());
|
|
}
|
|
}
|
|
|
|
//TODO: Vector is a pointer, so can potentially be updated (items may be possibly removed)
|
|
virtual property IList<String^>^ FileNames
|
|
{
|
|
IList<String^>^ get()
|
|
{
|
|
auto names = vector<CefString>();
|
|
_wrappedDragData->GetFileNames(names);
|
|
|
|
return StringUtils::ToClr(names);
|
|
}
|
|
}
|
|
|
|
virtual property String^ FragmentBaseUrl
|
|
{
|
|
String^ get()
|
|
{
|
|
return StringUtils::ToClr(_wrappedDragData->GetFragmentBaseURL());
|
|
}
|
|
void set(String^ fragmentBaseUrl)
|
|
{
|
|
_wrappedDragData->SetFragmentBaseURL(StringUtils::ToNative(fragmentBaseUrl));
|
|
}
|
|
}
|
|
|
|
virtual property String^ FragmentHtml
|
|
{
|
|
String^ get()
|
|
{
|
|
return StringUtils::ToClr(_wrappedDragData->GetFragmentHtml());
|
|
}
|
|
void set(String^ fragmentHtml)
|
|
{
|
|
_wrappedDragData->SetFragmentHtml(StringUtils::ToNative(fragmentHtml));
|
|
}
|
|
}
|
|
|
|
virtual property String^ FragmentText
|
|
{
|
|
String^ get()
|
|
{
|
|
return StringUtils::ToClr(_wrappedDragData->GetFragmentText());
|
|
}
|
|
void set(String^ fragmentText)
|
|
{
|
|
_wrappedDragData->SetFragmentText(StringUtils::ToNative(fragmentText));
|
|
}
|
|
}
|
|
|
|
virtual property String^ LinkMetaData
|
|
{
|
|
String^ get()
|
|
{
|
|
return StringUtils::ToClr(_wrappedDragData->GetLinkMetadata());
|
|
}
|
|
void set(String^ linkMetaData)
|
|
{
|
|
_wrappedDragData->SetLinkMetadata(StringUtils::ToNative(linkMetaData));
|
|
}
|
|
}
|
|
|
|
virtual property String^ LinkTitle
|
|
{
|
|
String^ get()
|
|
{
|
|
return StringUtils::ToClr(_wrappedDragData->GetLinkTitle());
|
|
}
|
|
void set(String^ linkTitle)
|
|
{
|
|
_wrappedDragData->SetLinkTitle(StringUtils::ToNative(linkTitle));
|
|
}
|
|
}
|
|
|
|
virtual property String^ LinkUrl
|
|
{
|
|
String^ get()
|
|
{
|
|
return StringUtils::ToClr(_wrappedDragData->GetLinkURL());
|
|
}
|
|
void set(String^ linkUrl)
|
|
{
|
|
_wrappedDragData->SetLinkURL(StringUtils::ToNative(linkUrl));
|
|
}
|
|
}
|
|
|
|
virtual void AddFile(String^ path, String^ displayName)
|
|
{
|
|
_wrappedDragData->AddFile(StringUtils::ToNative(path), StringUtils::ToNative(displayName));
|
|
}
|
|
|
|
virtual void ResetFileContents()
|
|
{
|
|
_wrappedDragData->ResetFileContents();
|
|
}
|
|
|
|
virtual Stream^ GetFileContents()
|
|
{
|
|
//_wrappedDragData->GetFileContents()
|
|
throw gcnew NotImplementedException("Need to implement a Wrapper around CefStreamWriter before this method can be implemented.");
|
|
}
|
|
};
|
|
}
|
|
}
|