1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved. 2 // 3 // Redistribution and use in source and binary forms, with or without 4 // modification, are permitted provided that the following conditions are 5 // met: 6 // 7 // * Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // * Redistributions in binary form must reproduce the above 10 // copyright notice, this list of conditions and the following disclaimer 11 // in the documentation and/or other materials provided with the 12 // distribution. 13 // * Neither the name of Google Inc. nor the name Chromium Embedded 14 // Framework nor the names of its contributors may be used to endorse 15 // or promote products derived from this software without specific prior 16 // written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // 30 // --------------------------------------------------------------------------- 31 // 32 // This file was generated by the CEF translator tool and should not edited 33 // by hand. See the translator.README.txt file in the tools directory for 34 // more information. 35 // 36 // $hash=b6e3236a062cd25ec26c3daeb1940d1e1bf0d96a$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/cef_base_capi.h" 44 #include "include/capi/cef_image_capi.h" 45 #include "include/capi/cef_stream_capi.h" 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 /// 52 // Structure used to represent drag data. The functions of this structure may be 53 // called on any thread. 54 /// 55 typedef struct _cef_drag_data_t { 56 /// 57 // Base structure. 58 /// 59 cef_base_ref_counted_t base; 60 61 /// 62 // Returns a copy of the current object. 63 /// 64 struct _cef_drag_data_t*(CEF_CALLBACK* clone)(struct _cef_drag_data_t* self); 65 66 /// 67 // Returns true (1) if this object is read-only. 68 /// 69 int(CEF_CALLBACK* is_read_only)(struct _cef_drag_data_t* self); 70 71 /// 72 // Returns true (1) if the drag data is a link. 73 /// 74 int(CEF_CALLBACK* is_link)(struct _cef_drag_data_t* self); 75 76 /// 77 // Returns true (1) if the drag data is a text or html fragment. 78 /// 79 int(CEF_CALLBACK* is_fragment)(struct _cef_drag_data_t* self); 80 81 /// 82 // Returns true (1) if the drag data is a file. 83 /// 84 int(CEF_CALLBACK* is_file)(struct _cef_drag_data_t* self); 85 86 /// 87 // Return the link URL that is being dragged. 88 /// 89 // The resulting string must be freed by calling cef_string_userfree_free(). 90 cef_string_userfree_t(CEF_CALLBACK* get_link_url)( 91 struct _cef_drag_data_t* self); 92 93 /// 94 // Return the title associated with the link being dragged. 95 /// 96 // The resulting string must be freed by calling cef_string_userfree_free(). 97 cef_string_userfree_t(CEF_CALLBACK* get_link_title)( 98 struct _cef_drag_data_t* self); 99 100 /// 101 // Return the metadata, if any, associated with the link being dragged. 102 /// 103 // The resulting string must be freed by calling cef_string_userfree_free(). 104 cef_string_userfree_t(CEF_CALLBACK* get_link_metadata)( 105 struct _cef_drag_data_t* self); 106 107 /// 108 // Return the plain text fragment that is being dragged. 109 /// 110 // The resulting string must be freed by calling cef_string_userfree_free(). 111 cef_string_userfree_t(CEF_CALLBACK* get_fragment_text)( 112 struct _cef_drag_data_t* self); 113 114 /// 115 // Return the text/html fragment that is being dragged. 116 /// 117 // The resulting string must be freed by calling cef_string_userfree_free(). 118 cef_string_userfree_t(CEF_CALLBACK* get_fragment_html)( 119 struct _cef_drag_data_t* self); 120 121 /// 122 // Return the base URL that the fragment came from. This value is used for 123 // resolving relative URLs and may be NULL. 124 /// 125 // The resulting string must be freed by calling cef_string_userfree_free(). 126 cef_string_userfree_t(CEF_CALLBACK* get_fragment_base_url)( 127 struct _cef_drag_data_t* self); 128 129 /// 130 // Return the name of the file being dragged out of the browser window. 131 /// 132 // The resulting string must be freed by calling cef_string_userfree_free(). 133 cef_string_userfree_t(CEF_CALLBACK* get_file_name)( 134 struct _cef_drag_data_t* self); 135 136 /// 137 // Write the contents of the file being dragged out of the web view into 138 // |writer|. Returns the number of bytes sent to |writer|. If |writer| is NULL 139 // this function will return the size of the file contents in bytes. Call 140 // get_file_name() to get a suggested name for the file. 141 /// 142 size_t(CEF_CALLBACK* get_file_contents)(struct _cef_drag_data_t* self, 143 struct _cef_stream_writer_t* writer); 144 145 /// 146 // Retrieve the list of file names that are being dragged into the browser 147 // window. 148 /// 149 int(CEF_CALLBACK* get_file_names)(struct _cef_drag_data_t* self, 150 cef_string_list_t names); 151 152 /// 153 // Set the link URL that is being dragged. 154 /// 155 void(CEF_CALLBACK* set_link_url)(struct _cef_drag_data_t* self, 156 const cef_string_t* url); 157 158 /// 159 // Set the title associated with the link being dragged. 160 /// 161 void(CEF_CALLBACK* set_link_title)(struct _cef_drag_data_t* self, 162 const cef_string_t* title); 163 164 /// 165 // Set the metadata associated with the link being dragged. 166 /// 167 void(CEF_CALLBACK* set_link_metadata)(struct _cef_drag_data_t* self, 168 const cef_string_t* data); 169 170 /// 171 // Set the plain text fragment that is being dragged. 172 /// 173 void(CEF_CALLBACK* set_fragment_text)(struct _cef_drag_data_t* self, 174 const cef_string_t* text); 175 176 /// 177 // Set the text/html fragment that is being dragged. 178 /// 179 void(CEF_CALLBACK* set_fragment_html)(struct _cef_drag_data_t* self, 180 const cef_string_t* html); 181 182 /// 183 // Set the base URL that the fragment came from. 184 /// 185 void(CEF_CALLBACK* set_fragment_base_url)(struct _cef_drag_data_t* self, 186 const cef_string_t* base_url); 187 188 /// 189 // Reset the file contents. You should do this before calling 190 // cef_browser_host_t::DragTargetDragEnter as the web view does not allow us 191 // to drag in this kind of data. 192 /// 193 void(CEF_CALLBACK* reset_file_contents)(struct _cef_drag_data_t* self); 194 195 /// 196 // Add a file that is being dragged into the webview. 197 /// 198 void(CEF_CALLBACK* add_file)(struct _cef_drag_data_t* self, 199 const cef_string_t* path, 200 const cef_string_t* display_name); 201 202 /// 203 // Get the image representation of drag data. May return NULL if no image 204 // representation is available. 205 /// 206 struct _cef_image_t*(CEF_CALLBACK* get_image)(struct _cef_drag_data_t* self); 207 208 /// 209 // Get the image hotspot (drag start location relative to image dimensions). 210 /// 211 cef_point_t(CEF_CALLBACK* get_image_hotspot)(struct _cef_drag_data_t* self); 212 213 /// 214 // Returns true (1) if an image representation of drag data is available. 215 /// 216 int(CEF_CALLBACK* has_image)(struct _cef_drag_data_t* self); 217 } cef_drag_data_t; 218 219 /// 220 // Create a new cef_drag_data_t object. 221 /// 222 CEF_EXPORT cef_drag_data_t* cef_drag_data_create(); 223 224 #ifdef __cplusplus 225 } 226 #endif 227 228 #endif // CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ 229