From b1f8f3e2aa377e5ef15f47a36f159b8f48cc5cef Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 15 Apr 2016 14:49:46 +0000 Subject: Move platform-dependent implementations of Fl::clipboard_contains() to the Fl_System_Driver class git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11616 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_System_Driver.H | 2 ++ src/Fl.cxx | 5 +++++ src/Fl_cocoa.mm | 2 +- src/Fl_win32.cxx | 2 +- src/Fl_x.cxx | 2 +- src/drivers/Darwin/Fl_Darwin_System_Driver.H | 1 + src/drivers/WinAPI/Fl_WinAPI_System_Driver.H | 2 ++ src/drivers/X11/Fl_X11_System_Driver.H | 2 ++ 8 files changed, 15 insertions(+), 3 deletions(-) diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H index ca5145108..e8fbf239a 100644 --- a/FL/Fl_System_Driver.H +++ b/FL/Fl_System_Driver.H @@ -198,6 +198,8 @@ public: virtual void copy(const char *stuff, int len, int clipboard, const char *type) {} // implement to support paste-from-clipboard virtual void paste(Fl_Widget &receiver, int clipboard, const char *type) {} + // implement to support paste-from-clipboard + virtual int clipboard_contains(const char *type) {return 0;} }; #endif // FL_SYSTEM_DRIVER_H diff --git a/src/Fl.cxx b/src/Fl.cxx index 4fd93e474..9f0fadfe8 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1938,6 +1938,11 @@ void Fl::copy(const char *stuff, int len, int clipboard, const char *type) { Fl::system_driver()->copy(stuff, len, clipboard, type); } +int Fl::clipboard_contains(const char *type) +{ + return Fl::system_driver()->clipboard_contains(type); +} + // // End of "$Id$". // diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index edd7d8820..0dc20f6b2 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3510,7 +3510,7 @@ void Fl_Darwin_System_Driver::paste(Fl_Widget &receiver, int clipboard, const ch receiver.handle(FL_PASTE); } -int Fl::clipboard_contains(const char *type) { +int Fl_Darwin_System_Driver::clipboard_contains(const char *type) { NSString *found = nil; if (strcmp(type, Fl::clipboard_plain_text) == 0) { found = [[NSPasteboard generalPasteboard] availableTypeFromArray:[NSArray arrayWithObjects:UTF8_pasteboard_type, @"public.utf16-plain-text", @"com.apple.traditional-mac-plain-text", nil]]; diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 32e7b83e4..2be565f6b 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -822,7 +822,7 @@ void Fl_WinAPI_System_Driver::paste(Fl_Widget &receiver, int clipboard, const ch } } -int Fl::clipboard_contains(const char *type) +int Fl_WinAPI_System_Driver::clipboard_contains(const char *type) { int retval = 0; if (!OpenClipboard(NULL)) return 0; diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 8adc37999..b6672b269 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -828,7 +828,7 @@ void Fl_X11_System_Driver::paste(Fl_Widget &receiver, int clipboard, const char fl_xid(Fl::first_window()), fl_event_time); } -int Fl::clipboard_contains(const char *type) +int Fl_X11_System_Driver::clipboard_contains(const char *type) { XEvent event; Atom actual; int format; unsigned long count, remaining, i = 0; diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index 43aef846f..b7971453d 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -71,6 +71,7 @@ public: virtual const char *filename_name(const char *buf); virtual void copy(const char *stuff, int len, int clipboard, const char *type); virtual void paste(Fl_Widget &receiver, int clipboard, const char *type); + virtual int clipboard_contains(const char *type); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H index 2950efa14..0fe3d9b94 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H @@ -108,6 +108,8 @@ public: virtual void copy(const char *stuff, int len, int clipboard, const char *type); // this one is implemented in Fl_win32.cxx virtual void paste(Fl_Widget &receiver, int clipboard, const char *type); + // this one is implemented in Fl_win32.cxx + virtual int clipboard_contains(const char *type); }; #endif // FL_WINAPI_SYSTEM_DRIVER_H diff --git a/src/drivers/X11/Fl_X11_System_Driver.H b/src/drivers/X11/Fl_X11_System_Driver.H index c0a790917..920b1ad0a 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.H +++ b/src/drivers/X11/Fl_X11_System_Driver.H @@ -51,6 +51,8 @@ public: virtual void copy(const char *stuff, int len, int clipboard, const char *type); // this one is in Fl_x.cxx virtual void paste(Fl_Widget &receiver, int clipboard, const char *type); + // this one is in Fl_x.cxx + virtual int clipboard_contains(const char *type); }; #endif /* FL_X11_SYSTEM_DRIVER_H */ -- cgit v1.2.3