Rewrite fl_open_callback() under the driver model.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11929 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2016-09-09 15:56:33 +00:00
parent 86e48ce2ca
commit c5960df5fb
9 changed files with 18 additions and 17 deletions

View File

@ -208,6 +208,8 @@ public:
virtual void add_fd(int fd, Fl_FD_Handler cb, void* = 0);
virtual void remove_fd(int, int when);
virtual void remove_fd(int);
// the default implementation of open_callback() may be enough
virtual void open_callback(void (*)(const char *));
};
#endif // FL_SYSTEM_DRIVER_H

View File

@ -110,14 +110,6 @@ extern CGContextRef fl_gc;
\sa \ref osissues_macos
@{ */
#ifdef FL_DOXYGEN
/** @brief Register a function called for each file dropped onto an application icon.
\e cb will be called with a single Unix-style file name and path.
If multiple files were dropped, \e cb will be called multiple times.
*/
extern void fl_open_callback(void (*cb)(const char *));
#endif
/**
* \brief Attaches a callback to the "About myprog" item of the system application menu.
*

View File

@ -1993,6 +1993,17 @@ FL_EXPORT Window fl_xid_(const Fl_Window *w) {
return temp ? temp->xid : 0;
}
/** Register a function called for each file dropped onto an application icon.
This function is effective only on the Mac OS X platform.
\e cb will be called with a single Unix-style file name and path.
If multiple files were dropped, \e cb will be called multiple times.
*/
void fl_open_callback(void (*cb)(const char *))
{
Fl::system_driver()->open_callback(cb);
}
//
// End of "$Id$".
//

View File

@ -435,6 +435,9 @@ FILE *Fl_System_Driver::fopen(const char* f, const char *mode) {
return ::fopen(f, mode);
}
void Fl_System_Driver::open_callback(void (*)(const char *)) {
}
//
// End of "$Id$".
//

View File

@ -1668,7 +1668,7 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
/*
* Install an open documents event handler...
*/
void fl_open_callback(void (*cb)(const char *)) {
void Fl_Darwin_System_Driver::open_callback(void (*cb)(const char *)) {
fl_open_display();
[(FLAppDelegate*)[NSApp delegate] open_cb:cb];
}

View File

@ -2422,9 +2422,6 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top
}
FL_EXPORT void fl_open_callback(void (*)(const char *)) {}
#ifdef USE_PRINT_BUTTON
// to test the Fl_Printer class creating a "Print front window" button in a separate window
// contains also preparePrintFront call above

View File

@ -2838,9 +2838,6 @@ void Fl_X11_Window_Driver::show() {
}
FL_EXPORT void fl_open_callback(void (*)(const char *)) {}
//#define USE_PRINT_BUTTON 1
#ifdef USE_PRINT_BUTTON

View File

@ -76,6 +76,7 @@ public:
virtual void add_fd(int fd, Fl_FD_Handler cb, void* = 0);
virtual void remove_fd(int, int when);
virtual void remove_fd(int);
virtual void open_callback(void (*)(const char *));
};
#endif // FL_DARWIN_SYSTEM_DRIVER_H

View File

@ -31,8 +31,6 @@ Fl_System_Driver *Fl_System_Driver::newSystemDriver()
return new Fl_System_Driver();
}
void fl_open_callback(void (*cb)(const char *)) {}
//
// End of "$Id$".
//