Rewrite Fl_File_Input.cxx under the driver model.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11575 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2016-04-10 18:36:47 +00:00
parent c3f1877fd1
commit 99b3c6813a
4 changed files with 14 additions and 8 deletions

View File

@ -30,6 +30,7 @@
#include <FL/Fl_Preferences.H>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
class Fl_File_Icon;
class Fl_File_Browser;
@ -147,6 +148,8 @@ public:
virtual void *dlopen(const char *filename) {return NULL;}
// the default implementation is most probably enough
virtual void png_extra_rgba_processing(unsigned char *array, int w, int h) {}
// the default implementation is most probably enough
virtual const char *next_dir_sep(const char *start) { return strchr(start, '/');}
};
#endif // FL_SYSTEM_DRIVER_H

View File

@ -18,6 +18,7 @@
//
#include <FL/Fl.H>
#include <FL/Fl_System_Driver.H>
#include <FL/Fl_File_Input.H>
#include <FL/Fl_Window.H>
#include <FL/fl_draw.H>
@ -112,10 +113,7 @@ void Fl_File_Input::update_buttons() {
start && i < (int)(sizeof(buttons_) / sizeof(buttons_[0]) - 1);
start = end, i ++) {
// printf(" start = \"%s\"\n", start);
if ((end = strchr(start, '/')) == NULL)
#if defined(WIN32) || defined(__EMX__)
if ((end = strchr(start, '\\')) == NULL)
#endif // WIN32 || __EMX__
if ((end = Fl::system_driver()->next_dir_sep(start)) == NULL)
break;
end ++;
@ -261,10 +259,7 @@ Fl_File_Input::handle_button(int event) // I - Event
for (start = newvalue, end = start; start && i >= 0; start = end, i --) {
// printf(" start = \"%s\"\n", start);
if ((end = strchr(start, '/')) == NULL)
#if defined(WIN32) || defined(__EMX__)
if ((end = strchr(start, '\\')) == NULL)
#endif // WIN32 || __EMX__
if ((end = (char*)Fl::system_driver()->next_dir_sep(start)) == NULL)
break;
end ++;

View File

@ -84,6 +84,7 @@ public:
const char *application);
virtual void *dlopen(const char *filename);
virtual void png_extra_rgba_processing(unsigned char *array, int w, int h);
virtual const char *next_dir_sep(const char *start);
};
#endif // FL_WINAPI_SYSTEM_DRIVER_H

View File

@ -877,6 +877,13 @@ void Fl_WinAPI_System_Driver::png_extra_rgba_processing(unsigned char *ptr, int
}
}
const char *Fl_WinAPI_System_Driver::next_dir_sep(const char *start)
{
const char *p = strchr(start, '/');
if (!p) p = strchr(start, '\\');
return p;
}
//
// End of "$Id$".
//