Expose drag image via CefDragData (issue #1715)

This commit is contained in:
Marshall Greenblatt
2017-05-11 14:22:21 -04:00
parent 8fe6294355
commit 1f2e2bdc84
9 changed files with 192 additions and 2 deletions

View File

@@ -11,6 +11,7 @@
//
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
#include "libcef_dll/cpptoc/image_cpptoc.h"
#include "libcef_dll/cpptoc/stream_writer_cpptoc.h"
#include "libcef_dll/transfer_util.h"
@@ -367,6 +368,50 @@ void CEF_CALLBACK drag_data_add_file(struct _cef_drag_data_t* self,
CefString(display_name));
}
struct _cef_image_t* CEF_CALLBACK drag_data_get_image(
struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefImage> _retval = CefDragDataCppToC::Get(self)->GetImage();
// Return type: refptr_same
return CefImageCppToC::Wrap(_retval);
}
cef_point_t CEF_CALLBACK drag_data_get_image_hotspot(
struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return CefPoint();
// Execute
cef_point_t _retval = CefDragDataCppToC::Get(self)->GetImageHotspot();
// Return type: simple
return _retval;
}
int CEF_CALLBACK drag_data_has_image(struct _cef_drag_data_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefDragDataCppToC::Get(self)->HasImage();
// Return type: bool
return _retval;
}
} // namespace
@@ -395,6 +440,9 @@ CefDragDataCppToC::CefDragDataCppToC() {
GetStruct()->set_fragment_base_url = drag_data_set_fragment_base_url;
GetStruct()->reset_file_contents = drag_data_reset_file_contents;
GetStruct()->add_file = drag_data_add_file;
GetStruct()->get_image = drag_data_get_image;
GetStruct()->get_image_hotspot = drag_data_get_image_hotspot;
GetStruct()->has_image = drag_data_has_image;
}
template<> CefRefPtr<CefDragData> CefCppToCRefCounted<CefDragDataCppToC,

View File

@@ -11,6 +11,7 @@
//
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
#include "libcef_dll/ctocpp/image_ctocpp.h"
#include "libcef_dll/ctocpp/stream_writer_ctocpp.h"
#include "libcef_dll/transfer_util.h"
@@ -372,6 +373,48 @@ void CefDragDataCToCpp::AddFile(const CefString& path,
display_name.GetStruct());
}
CefRefPtr<CefImage> CefDragDataCToCpp::GetImage() {
cef_drag_data_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_image))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_image_t* _retval = _struct->get_image(_struct);
// Return type: refptr_same
return CefImageCToCpp::Wrap(_retval);
}
CefPoint CefDragDataCToCpp::GetImageHotspot() {
cef_drag_data_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_image_hotspot))
return CefPoint();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_point_t _retval = _struct->get_image_hotspot(_struct);
// Return type: simple
return _retval;
}
bool CefDragDataCToCpp::HasImage() {
cef_drag_data_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, has_image))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->has_image(_struct);
// Return type: bool
return _retval?true:false;
}
// CONSTRUCTOR - Do not edit by hand.

View File

@@ -54,6 +54,9 @@ class CefDragDataCToCpp
void SetFragmentBaseURL(const CefString& base_url) OVERRIDE;
void ResetFileContents() OVERRIDE;
void AddFile(const CefString& path, const CefString& display_name) OVERRIDE;
CefRefPtr<CefImage> GetImage() OVERRIDE;
CefPoint GetImageHotspot() OVERRIDE;
bool HasImage() OVERRIDE;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_