Move the platform-dependent implementations of Fl::paste() to the Fl_System_Driver class.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11615 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
7508a033c5
commit
d683841f9f
@ -36,6 +36,7 @@
|
||||
class Fl_File_Icon;
|
||||
class Fl_File_Browser;
|
||||
class Fl_Pixmap;
|
||||
class Fl_Widget;
|
||||
|
||||
/**
|
||||
\brief A base class for platform-specific system operations.
|
||||
@ -193,8 +194,10 @@ public:
|
||||
static const char * const tree_close_xpm[]; // used by tree_closepixmap()
|
||||
// the default implementation of tree_connector_style() is in Fl_Tree_Prefs.cxx and can be enough
|
||||
virtual int tree_connector_style();
|
||||
//implement to support copy-to-clipboard
|
||||
// implement to support copy-to-clipboard
|
||||
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) {}
|
||||
};
|
||||
|
||||
#endif // FL_SYSTEM_DRIVER_H
|
||||
|
@ -1414,8 +1414,14 @@ void Fl::selection(Fl_Widget &owner, const char* text, int len) {
|
||||
\see Fl::paste(Fl_Widget &receiver, int clipboard, const char* type)
|
||||
*/
|
||||
void Fl::paste(Fl_Widget &receiver) {
|
||||
Fl::paste(receiver, 0);
|
||||
Fl::system_driver()->paste(receiver, 0, Fl::clipboard_plain_text);
|
||||
}
|
||||
|
||||
void Fl::paste(Fl_Widget &receiver, int clipboard, const char *type)
|
||||
{
|
||||
Fl::system_driver()->paste(receiver, clipboard, type);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
void Fl_Widget::redraw() {
|
||||
|
@ -3482,7 +3482,7 @@ static Fl_Image* get_image_from_clipboard(Fl_Widget *receiver)
|
||||
}
|
||||
|
||||
// Call this when a "paste" operation happens:
|
||||
void Fl::paste(Fl_Widget &receiver, int clipboard, const char *type) {
|
||||
void Fl_Darwin_System_Driver::paste(Fl_Widget &receiver, int clipboard, const char *type) {
|
||||
if (type[0] == 0) type = Fl::clipboard_plain_text;
|
||||
if (clipboard) {
|
||||
Fl::e_clipboard_type = "";
|
||||
|
@ -691,7 +691,7 @@ void Fl_WinAPI_System_Driver::copy(const char *stuff, int len, int clipboard, co
|
||||
}
|
||||
|
||||
// Call this when a "paste" operation happens:
|
||||
void Fl::paste(Fl_Widget &receiver, int clipboard, const char *type) {
|
||||
void Fl_WinAPI_System_Driver::paste(Fl_Widget &receiver, int clipboard, const char *type) {
|
||||
if (!clipboard || (fl_i_own_selection[clipboard] && strcmp(type, Fl::clipboard_plain_text) == 0)) {
|
||||
// We already have it, do it quickly without window server.
|
||||
// Notice that the text is clobbered if set_selection is
|
||||
|
@ -807,7 +807,7 @@ int fl_selection_buffer_length[2];
|
||||
char fl_i_own_selection[2] = {0,0};
|
||||
|
||||
// Call this when a "paste" operation happens:
|
||||
void Fl::paste(Fl_Widget &receiver, int clipboard, const char *type) {
|
||||
void Fl_X11_System_Driver::paste(Fl_Widget &receiver, int clipboard, const char *type) {
|
||||
if (fl_i_own_selection[clipboard]) {
|
||||
// We already have it, do it quickly without window server.
|
||||
// Notice that the text is clobbered if set_selection is
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
virtual int tree_connector_style();
|
||||
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);
|
||||
};
|
||||
|
||||
#endif // FL_DARWIN_SYSTEM_DRIVER_H
|
||||
|
@ -104,8 +104,10 @@ public:
|
||||
virtual int case_insensitive_filenames() {return 1;}
|
||||
// this one is implemented in Fl_win32.cxx
|
||||
virtual const char *filename_name(const char *buf);
|
||||
// this one is in Fl_win32.cxx
|
||||
// this one is implemented in Fl_win32.cxx
|
||||
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);
|
||||
};
|
||||
|
||||
#endif // FL_WINAPI_SYSTEM_DRIVER_H
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
virtual const char *filename_name(const char *buf);
|
||||
// this one is in Fl_x.cxx
|
||||
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);
|
||||
};
|
||||
|
||||
#endif /* FL_X11_SYSTEM_DRIVER_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user