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
This commit is contained in:
Manolo Gouy 2016-04-15 14:49:46 +00:00
parent d683841f9f
commit b1f8f3e2aa
8 changed files with 15 additions and 3 deletions

View File

@ -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

View File

@ -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$".
//

View File

@ -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]];

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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 */