diff --git a/FL/Fl.H b/FL/Fl.H index 7cb286e90..a8f1db765 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -876,35 +876,37 @@ int main() { #endif /** Pastes the data from the selection buffer (\p source is 0) or the clipboard - (\p source is 1) into \p receiver. If \p source is 1, - the optional \p type argument indicates what type of data is requested from the clipboard. + (\p source is 1) into \p receiver. + + The selection buffer (\p source is 0) is used for middle-mouse pastes and for + drag-and-drop selections. The clipboard (\p source is 1) is used for + copy/cut/paste operations. + + If \p source is 1, the optional \p type argument indicates what type of data is requested from the clipboard. At present, Fl::clipboard_plain_text (requesting text data) and Fl::clipboard_image (requesting image data) are possible. Set things up so the handle function of the \p receiver widget will be called with an FL_PASTE event some time in the future if the clipboard does contain data of the requested type. While processing the FL_PASTE event: \li if \p type is Fl::clipboard_plain_text, the text string from the specified \p source is in Fl::event_text() - with UTF-8 encoding, and the number of bytes in Fl::event_length(); + with UTF-8 encoding, and the number of bytes in Fl::event_length(). + If Fl::paste() gets called during the drop step of a files-drag-and-drop operation, + Fl::event_text() contains a list of filenames (see \ref events_dnd). \li if \p type is Fl::clipboard_image, the pointer returned by Fl::event_clipboard() can be safely cast to type Fl_Image * to obtain a pointer to the pasted image. Furthermore, starting with FLTK 1.3.4, the image is - of type Fl_RGB_Image across all platforms. If the handle function of \p receiver returns 1, - \p receiver gets the ownership of the image which should be deleted after use. Conversely, - if it returns 0, the image cannot be used by the application. - + of type Fl_RGB_Image across all platforms. + If \p receiver accepts the clipboard image, receiver.handle() should return 1 and the + application should take ownership of this image (that is, delete it after use). + Conversely, if receiver.handle() returns 0, the application must not use the image. + The receiver should be prepared to be called \e directly by this, or for it to happen \e later, or possibly not at all. This allows the window system to take as long as necessary to retrieve the paste buffer (or even to screw up completely) without complex and error-prone synchronization code in FLTK. - - - - The selection buffer (\p source is 0) is used for middle-mouse pastes and for - drag-and-drop selections. The clipboard (\p source is 1) is used for - copy/cut/paste operations. - + \par Platform details for image data: - \li Unix/Linux platform: Image data in PNG or BMP formats are recognized. Requires linking with the fltk_images library. + \li Unix/Linux platform: Clipboard images in PNG or BMP formats are recognized. Requires linking with the fltk_images library. \li MSWindows platform: Both bitmap and vectorial (Enhanced metafile) data from clipboard can be pasted as image data. \li Mac OS X platform: Both bitmap (TIFF) and vectorial (PDF) data from clipboard