diff options
| author | Manolo Gouy <Manolo> | 2016-09-09 15:56:33 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-09-09 15:56:33 +0000 |
| commit | c5960df5fb4d99098c4ecbc28cc2f90c7f02e9aa (patch) | |
| tree | 262d21c1cb4e6fba5dfb48424e61f20ef264bdf2 | |
| parent | 86e48ce2ca8269e2b94c57d4988c4fd9e4d2a202 (diff) | |
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
| -rw-r--r-- | FL/Fl_System_Driver.H | 2 | ||||
| -rw-r--r-- | FL/mac.H | 8 | ||||
| -rw-r--r-- | src/Fl.cxx | 11 | ||||
| -rw-r--r-- | src/Fl_System_Driver.cxx | 3 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 2 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 3 | ||||
| -rw-r--r-- | src/Fl_x.cxx | 3 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx | 2 |
9 files changed, 18 insertions, 17 deletions
diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H index 89d18a8a2..e9f0f38c6 100644 --- a/FL/Fl_System_Driver.H +++ b/FL/Fl_System_Driver.H @@ -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 @@ -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. * diff --git a/src/Fl.cxx b/src/Fl.cxx index b964614a0..fe6f44ed8 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -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$". // diff --git a/src/Fl_System_Driver.cxx b/src/Fl_System_Driver.cxx index 98a099bd8..1ef25302f 100644 --- a/src/Fl_System_Driver.cxx +++ b/src/Fl_System_Driver.cxx @@ -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$". // diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 9252ed780..136752c4b 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -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]; } diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 13ae5c459..bf1185f65 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -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 diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 2d0b7674e..a42385520 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -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 diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index 400184d05..a8cbe7d75 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -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 diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx index 32cd3b698..4043b7cb6 100644 --- a/src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx +++ b/src/drivers/PicoSDL/Fl_PicoSDL_System_Driver.cxx @@ -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$". // |
