Browse Source

Use more consistent naming for derived classes of Fl_Native_File_Chooser_Driver.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11628 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/1/head
Manolo Gouy 9 years ago
parent
commit
f8104524e8
  1. 8
      FL/Fl_Native_File_Chooser.H
  2. 2
      src/Fl_Native_File_Chooser.cxx
  3. 58
      src/Fl_Native_File_Chooser_GTK.cxx
  4. 68
      src/Fl_Native_File_Chooser_MAC.mm
  5. 78
      src/Fl_Native_File_Chooser_WIN32.cxx

8
FL/Fl_Native_File_Chooser.H

@ -28,12 +28,12 @@
this API has a do-nothing default implementation this API has a do-nothing default implementation
class Fl_Native_File_Chooser_FLTK_Driver <== this API implementation is the default FLTK file chooser class Fl_Native_File_Chooser_FLTK_Driver <== this API implementation is the default FLTK file chooser
class Fl_Native_File_Chooser_GTK_Driver <== this API implementation runs a GTK file chooser class Fl_GTK_Native_File_Chooser_Driver <== this API implementation runs a GTK file chooser
it is determined at run-time if the GTK dynamic libraries are available it is determined at run-time if the GTK dynamic libraries are available
class Fl_Native_File_Chooser_Darwin_Driver <== this API implementation runs a Mac OS X file chooser class Fl_Quartz_Native_File_Chooser_Driver <== this API implementation runs a Mac OS X file chooser
class Fl_Native_File_Chooser_WinAPI_Driver <== this API implementation runs a MSWindows file chooser class Fl_WinAPI_Native_File_Chooser_Driver <== this API implementation runs a MSWindows file chooser
Each platform must implement the constructor of the Fl_Native_File_Chooser class. Each platform must implement the constructor of the Fl_Native_File_Chooser class.
@ -47,7 +47,7 @@
No more code is required. The cross-platform Fl_Native_File_Chooser_FLTK.cxx file must be compiled in libfltk, No more code is required. The cross-platform Fl_Native_File_Chooser_FLTK.cxx file must be compiled in libfltk,
and the default FLTK file chooser will be used. and the default FLTK file chooser will be used.
This other implementation This other implementation:
Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) { Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
platform_fnfc = 0; platform_fnfc = 0;
} }

2
src/Fl_Native_File_Chooser.cxx

@ -20,7 +20,7 @@
#include <FL/Fl_Native_File_Chooser.H> #include <FL/Fl_Native_File_Chooser.H>
#ifdef FL_PORTING #ifdef FL_PORTING
# pragma message "Implement a native file chooser (see Fl_Native_File_Chooser_Driver), or use FLTK's chooser" # pragma message "Implement a native file chooser (see Fl_Native_File_Chooser_Driver), or use FLTK's chooser, or don't use any chooser"
Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) { Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
platform_fnfc = new Fl_Native_File_Chooser_FLTK_Driver(val); platform_fnfc = new Fl_Native_File_Chooser_FLTK_Driver(val);
} }

58
src/Fl_Native_File_Chooser_GTK.cxx

@ -96,16 +96,16 @@ typedef void (*GClosureNotify)(gpointer data, GClosure *closure);
/* --------------------- End of Type definitions from GLIB and GTK --------------------- */ /* --------------------- End of Type definitions from GLIB and GTK --------------------- */
class FL_EXPORT Fl_Native_File_Chooser_GTK_Driver : public Fl_Native_File_Chooser_FLTK_Driver { class FL_EXPORT Fl_GTK_Native_File_Chooser_Driver : public Fl_Native_File_Chooser_FLTK_Driver {
friend class Fl_Native_File_Chooser; friend class Fl_Native_File_Chooser;
private: private:
static int have_looked_for_GTK_libs; static int have_looked_for_GTK_libs;
typedef struct _GtkWidget GtkWidget; typedef struct _GtkWidget GtkWidget;
typedef struct _GtkFileFilterInfo GtkFileFilterInfo; typedef struct _GtkFileFilterInfo GtkFileFilterInfo;
struct pair { struct pair {
Fl_Native_File_Chooser_GTK_Driver* running; // the running Fl_GTK_File_Chooser Fl_GTK_Native_File_Chooser_Driver* running; // the running Fl_GTK_File_Chooser
const char *filter; // a filter string of the chooser const char *filter; // a filter string of the chooser
pair(Fl_Native_File_Chooser_GTK_Driver* c, const char *f) { pair(Fl_GTK_Native_File_Chooser_Driver* c, const char *f) {
running = c; running = c;
filter = strdup(f); filter = strdup(f);
}; };
@ -121,8 +121,8 @@ private:
const char *previous_filter; const char *previous_filter;
int fl_gtk_chooser_wrapper(); // method that wraps the GTK widget int fl_gtk_chooser_wrapper(); // method that wraps the GTK widget
Fl_Native_File_Chooser_GTK_Driver(int val); Fl_GTK_Native_File_Chooser_Driver(int val);
virtual ~Fl_Native_File_Chooser_GTK_Driver(); virtual ~Fl_GTK_Native_File_Chooser_Driver();
static int did_find_GTK_libs; static int did_find_GTK_libs;
static void probe_for_GTK_libs(void); static void probe_for_GTK_libs(void);
virtual void type(int); virtual void type(int);
@ -134,12 +134,12 @@ private:
virtual int show(); virtual int show();
void changed_output_type(const char *filter); void changed_output_type(const char *filter);
static int custom_gtk_filter_function(const GtkFileFilterInfo*, Fl_Native_File_Chooser_GTK_Driver::pair*); static int custom_gtk_filter_function(const GtkFileFilterInfo*, Fl_GTK_Native_File_Chooser_Driver::pair*);
static void free_pair(pair *p); static void free_pair(pair *p);
}; };
int Fl_Native_File_Chooser_GTK_Driver::did_find_GTK_libs = 0; int Fl_GTK_Native_File_Chooser_Driver::did_find_GTK_libs = 0;
/* These are the GTK/GLib methods we want to load, but not call by name...! */ /* These are the GTK/GLib methods we want to load, but not call by name...! */
@ -291,26 +291,26 @@ typedef void (*XX_gtk_toggle_button_set_active)(GtkToggleButton *, gboolean);
static XX_gtk_toggle_button_set_active fl_gtk_toggle_button_set_active = NULL; static XX_gtk_toggle_button_set_active fl_gtk_toggle_button_set_active = NULL;
int Fl_Native_File_Chooser_GTK_Driver::have_looked_for_GTK_libs = 0; int Fl_GTK_Native_File_Chooser_Driver::have_looked_for_GTK_libs = 0;
Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) { Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
if (Fl_Native_File_Chooser_GTK_Driver::have_looked_for_GTK_libs == 0) { if (Fl_GTK_Native_File_Chooser_Driver::have_looked_for_GTK_libs == 0) {
// First Time here, try to find the GTK libs if they are installed // First Time here, try to find the GTK libs if they are installed
#if HAVE_DLSYM && HAVE_DLFCN_H #if HAVE_DLSYM && HAVE_DLFCN_H
if (Fl::option(Fl::OPTION_FNFC_USES_GTK)) { if (Fl::option(Fl::OPTION_FNFC_USES_GTK)) {
Fl_Native_File_Chooser_GTK_Driver::probe_for_GTK_libs(); Fl_GTK_Native_File_Chooser_Driver::probe_for_GTK_libs();
} }
#endif #endif
Fl_Native_File_Chooser_GTK_Driver::have_looked_for_GTK_libs = -1; Fl_GTK_Native_File_Chooser_Driver::have_looked_for_GTK_libs = -1;
} }
// if we found all the GTK functions we need, we will use the GtkFileChooserDialog // if we found all the GTK functions we need, we will use the GtkFileChooserDialog
if (Fl_Native_File_Chooser_GTK_Driver::did_find_GTK_libs) platform_fnfc = new Fl_Native_File_Chooser_GTK_Driver(val); if (Fl_GTK_Native_File_Chooser_Driver::did_find_GTK_libs) platform_fnfc = new Fl_GTK_Native_File_Chooser_Driver(val);
else platform_fnfc = new Fl_Native_File_Chooser_FLTK_Driver(val); else platform_fnfc = new Fl_Native_File_Chooser_FLTK_Driver(val);
} }
Fl_Native_File_Chooser_GTK_Driver::Fl_Native_File_Chooser_GTK_Driver(int val) : Fl_Native_File_Chooser_FLTK_Driver(-1) Fl_GTK_Native_File_Chooser_Driver::Fl_GTK_Native_File_Chooser_Driver(int val) : Fl_Native_File_Chooser_FLTK_Driver(-1)
{ {
gtkw_ptr = NULL; // used to hold a GtkWidget* gtkw_ptr = NULL; // used to hold a GtkWidget*
gtkw_slist = NULL; // will hold the returned file names in a multi-selection... gtkw_slist = NULL; // will hold the returned file names in a multi-selection...
@ -321,7 +321,7 @@ Fl_Native_File_Chooser_GTK_Driver::Fl_Native_File_Chooser_GTK_Driver(int val) :
previous_filter = NULL; previous_filter = NULL;
} }
Fl_Native_File_Chooser_GTK_Driver::~Fl_Native_File_Chooser_GTK_Driver() Fl_GTK_Native_File_Chooser_Driver::~Fl_GTK_Native_File_Chooser_Driver()
{ {
// Should free up resources taken for... // Should free up resources taken for...
if(gtkw_ptr) { if(gtkw_ptr) {
@ -345,15 +345,15 @@ Fl_Native_File_Chooser_GTK_Driver::~Fl_Native_File_Chooser_GTK_Driver()
gtkw_title = strfree(gtkw_title); gtkw_title = strfree(gtkw_title);
} }
void Fl_Native_File_Chooser_GTK_Driver::type(int val) { void Fl_GTK_Native_File_Chooser_Driver::type(int val) {
_btype = val; _btype = val;
} }
int Fl_Native_File_Chooser_GTK_Driver::count() const { int Fl_GTK_Native_File_Chooser_Driver::count() const {
return gtkw_count; return gtkw_count;
} }
const char *Fl_Native_File_Chooser_GTK_Driver::filename() const const char *Fl_GTK_Native_File_Chooser_Driver::filename() const
{ {
if(gtkw_ptr) { if(gtkw_ptr) {
if(fl_gtk_file_chooser_get_select_multiple((GtkFileChooser *)gtkw_ptr) == FALSE) { if(fl_gtk_file_chooser_get_select_multiple((GtkFileChooser *)gtkw_ptr) == FALSE) {
@ -368,7 +368,7 @@ const char *Fl_Native_File_Chooser_GTK_Driver::filename() const
return(""); return("");
} }
const char *Fl_Native_File_Chooser_GTK_Driver::filename(int i) const const char *Fl_GTK_Native_File_Chooser_Driver::filename(int i) const
{ {
if(fl_gtk_file_chooser_get_select_multiple((GtkFileChooser *)gtkw_ptr) == FALSE) { if(fl_gtk_file_chooser_get_select_multiple((GtkFileChooser *)gtkw_ptr) == FALSE) {
return gtkw_filename; return gtkw_filename;
@ -383,19 +383,19 @@ const char *Fl_Native_File_Chooser_GTK_Driver::filename(int i) const
return(""); return("");
} }
void Fl_Native_File_Chooser_GTK_Driver::title(const char *val) void Fl_GTK_Native_File_Chooser_Driver::title(const char *val)
{ {
strfree(gtkw_title); strfree(gtkw_title);
gtkw_title = strnew(val); gtkw_title = strnew(val);
} }
const char* Fl_Native_File_Chooser_GTK_Driver::title() const const char* Fl_GTK_Native_File_Chooser_Driver::title() const
{ {
return gtkw_title; return gtkw_title;
} }
/* changes the extension of the outfile in the chooser according to newly selected filter */ /* changes the extension of the outfile in the chooser according to newly selected filter */
void Fl_Native_File_Chooser_GTK_Driver::changed_output_type(const char *filter) void Fl_GTK_Native_File_Chooser_Driver::changed_output_type(const char *filter)
{ {
if ( !(options()&Fl_Native_File_Chooser::USE_FILTER_EXT) ) return; if ( !(options()&Fl_Native_File_Chooser::USE_FILTER_EXT) ) return;
if (strchr(filter, '(') || strchr(filter, '{') || strchr(filter+1, '*') || strncmp(filter, "*.", 2)) return; if (strchr(filter, '(') || strchr(filter, '{') || strchr(filter+1, '*') || strncmp(filter, "*.", 2)) return;
@ -413,7 +413,7 @@ void Fl_Native_File_Chooser_GTK_Driver::changed_output_type(const char *filter)
/* Filters files before display in chooser. /* Filters files before display in chooser.
Also used to detect when the filter just changed */ Also used to detect when the filter just changed */
gboolean Fl_Native_File_Chooser_GTK_Driver::custom_gtk_filter_function(const GtkFileFilterInfo *info, Fl_Native_File_Chooser_GTK_Driver::pair* p) gboolean Fl_GTK_Native_File_Chooser_Driver::custom_gtk_filter_function(const GtkFileFilterInfo *info, Fl_GTK_Native_File_Chooser_Driver::pair* p)
{ {
if (p->running->previous_filter != p->filter) { if (p->running->previous_filter != p->filter) {
p->running->changed_output_type(p->filter); p->running->changed_output_type(p->filter);
@ -422,7 +422,7 @@ gboolean Fl_Native_File_Chooser_GTK_Driver::custom_gtk_filter_function(const Gtk
return (gboolean)fl_filename_match(fl_filename_name(info->filename), p->filter); return (gboolean)fl_filename_match(fl_filename_name(info->filename), p->filter);
} }
void Fl_Native_File_Chooser_GTK_Driver::free_pair(Fl_Native_File_Chooser_GTK_Driver::pair *p) void Fl_GTK_Native_File_Chooser_Driver::free_pair(Fl_GTK_Native_File_Chooser_Driver::pair *p)
{ {
delete p; delete p;
} }
@ -433,7 +433,7 @@ static void hidden_files_cb(GtkToggleButton *togglebutton, gpointer user_data)
fl_gtk_file_chooser_set_show_hidden((GtkFileChooser*)user_data, state); fl_gtk_file_chooser_set_show_hidden((GtkFileChooser*)user_data, state);
} }
int Fl_Native_File_Chooser_GTK_Driver::show() int Fl_GTK_Native_File_Chooser_Driver::show()
{ {
// The point here is that after running a GTK dialog, the calling program's current locale is modified. // The point here is that after running a GTK dialog, the calling program's current locale is modified.
// To avoid that, we memorize the calling program's current locale, and the locale as modified // To avoid that, we memorize the calling program's current locale, and the locale as modified
@ -489,7 +489,7 @@ static void run_response_handler(GtkDialog *dialog, gint response_id, gpointer d
} }
int Fl_Native_File_Chooser_GTK_Driver::fl_gtk_chooser_wrapper() int Fl_GTK_Native_File_Chooser_Driver::fl_gtk_chooser_wrapper()
{ {
int result = 1; int result = 1;
static int have_gtk_init = 0; static int have_gtk_init = 0;
@ -586,9 +586,9 @@ int Fl_Native_File_Chooser_GTK_Driver::fl_gtk_chooser_wrapper()
char *q = strchr(p, ')'); *q = 0; char *q = strchr(p, ')'); *q = 0;
fl_gtk_file_filter_add_custom(filter_tab[count], fl_gtk_file_filter_add_custom(filter_tab[count],
GTK_FILE_FILTER_FILENAME, GTK_FILE_FILTER_FILENAME,
(GtkFileFilterFunc)Fl_Native_File_Chooser_GTK_Driver::custom_gtk_filter_function, (GtkFileFilterFunc)Fl_GTK_Native_File_Chooser_Driver::custom_gtk_filter_function,
new Fl_Native_File_Chooser_GTK_Driver::pair(this, p), new Fl_GTK_Native_File_Chooser_Driver::pair(this, p),
(GDestroyNotify)Fl_Native_File_Chooser_GTK_Driver::free_pair); (GDestroyNotify)Fl_GTK_Native_File_Chooser_Driver::free_pair);
fl_gtk_file_chooser_add_filter((GtkFileChooser *)gtkw_ptr, filter_tab[count]); fl_gtk_file_chooser_add_filter((GtkFileChooser *)gtkw_ptr, filter_tab[count]);
p = strtok(NULL, "\t"); p = strtok(NULL, "\t");
count++; count++;
@ -714,7 +714,7 @@ static void* fl_dlopen(const char *filename1, const char *filename2)
* will allow us to create a GtkFileChooserDialog() on the fly, * will allow us to create a GtkFileChooserDialog() on the fly,
* without linking to the GTK libs at compile time. * without linking to the GTK libs at compile time.
*/ */
void Fl_Native_File_Chooser_GTK_Driver::probe_for_GTK_libs(void) { void Fl_GTK_Native_File_Chooser_Driver::probe_for_GTK_libs(void) {
#if HAVE_DLSYM && HAVE_DLFCN_H #if HAVE_DLSYM && HAVE_DLFCN_H
void *ptr_glib = NULL; void *ptr_glib = NULL;
void *ptr_gtk = NULL; void *ptr_gtk = NULL;

68
src/Fl_Native_File_Chooser_MAC.mm

@ -30,7 +30,7 @@
#include <FL/filename.H> #include <FL/filename.H>
#define MAXFILTERS 80 #define MAXFILTERS 80
class Fl_Native_File_Chooser_Darwin_Driver : public Fl_Native_File_Chooser_Driver { class Fl_Quartz_Native_File_Chooser_Driver : public Fl_Native_File_Chooser_Driver {
private: private:
int _btype; // kind-of browser to show() int _btype; // kind-of browser to show()
int _options; // general options int _options; // general options
@ -66,8 +66,8 @@ private:
int post(); int post();
int runmodal(); int runmodal();
public: public:
Fl_Native_File_Chooser_Darwin_Driver(int val); Fl_Quartz_Native_File_Chooser_Driver(int val);
~Fl_Native_File_Chooser_Darwin_Driver(); ~Fl_Quartz_Native_File_Chooser_Driver();
virtual void type(int t); virtual void type(int t);
virtual int type() const ; virtual int type() const ;
virtual void options(int o); virtual void options(int o);
@ -91,11 +91,11 @@ public:
}; };
Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) { Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
platform_fnfc = new Fl_Native_File_Chooser_Darwin_Driver(val); platform_fnfc = new Fl_Quartz_Native_File_Chooser_Driver(val);
} }
// FREE PATHNAMES ARRAY, IF IT HAS ANY CONTENTS // FREE PATHNAMES ARRAY, IF IT HAS ANY CONTENTS
void Fl_Native_File_Chooser_Darwin_Driver::clear_pathnames() { void Fl_Quartz_Native_File_Chooser_Driver::clear_pathnames() {
if ( _pathnames ) { if ( _pathnames ) {
while ( --_tpathnames >= 0 ) { while ( --_tpathnames >= 0 ) {
_pathnames[_tpathnames] = strfree(_pathnames[_tpathnames]); _pathnames[_tpathnames] = strfree(_pathnames[_tpathnames]);
@ -107,7 +107,7 @@ void Fl_Native_File_Chooser_Darwin_Driver::clear_pathnames() {
} }
// SET A SINGLE PATHNAME // SET A SINGLE PATHNAME
void Fl_Native_File_Chooser_Darwin_Driver::set_single_pathname(const char *s) { void Fl_Quartz_Native_File_Chooser_Driver::set_single_pathname(const char *s) {
clear_pathnames(); clear_pathnames();
_pathnames = new char*[1]; _pathnames = new char*[1];
_pathnames[0] = strnew(s); _pathnames[0] = strnew(s);
@ -115,7 +115,7 @@ void Fl_Native_File_Chooser_Darwin_Driver::set_single_pathname(const char *s) {
} }
// CONSTRUCTOR // CONSTRUCTOR
Fl_Native_File_Chooser_Darwin_Driver::Fl_Native_File_Chooser_Darwin_Driver(int val) : Fl_Quartz_Native_File_Chooser_Driver::Fl_Quartz_Native_File_Chooser_Driver(int val) :
Fl_Native_File_Chooser_Driver(val) { Fl_Native_File_Chooser_Driver(val) {
_btype = val; _btype = val;
_panel = NULL; _panel = NULL;
@ -134,7 +134,7 @@ Fl_Native_File_Chooser_Darwin_Driver::Fl_Native_File_Chooser_Darwin_Driver(int v
} }
// DESTRUCTOR // DESTRUCTOR
Fl_Native_File_Chooser_Darwin_Driver::~Fl_Native_File_Chooser_Darwin_Driver() { Fl_Quartz_Native_File_Chooser_Driver::~Fl_Quartz_Native_File_Chooser_Driver() {
// _opts // nothing to manage // _opts // nothing to manage
// _options // nothing to manage // _options // nothing to manage
// _keepstate // nothing to manage // _keepstate // nothing to manage
@ -153,17 +153,17 @@ Fl_Native_File_Chooser_Darwin_Driver::~Fl_Native_File_Chooser_Darwin_Driver() {
} }
// GET TYPE OF BROWSER // GET TYPE OF BROWSER
int Fl_Native_File_Chooser_Darwin_Driver::type() const { int Fl_Quartz_Native_File_Chooser_Driver::type() const {
return(_btype); return(_btype);
} }
// SET OPTIONS // SET OPTIONS
void Fl_Native_File_Chooser_Darwin_Driver::options(int val) { void Fl_Quartz_Native_File_Chooser_Driver::options(int val) {
_options = val; _options = val;
} }
// GET OPTIONS // GET OPTIONS
int Fl_Native_File_Chooser_Darwin_Driver::options() const { int Fl_Quartz_Native_File_Chooser_Driver::options() const {
return(_options); return(_options);
} }
@ -173,7 +173,7 @@ int Fl_Native_File_Chooser_Darwin_Driver::options() const {
// 1 - user cancelled // 1 - user cancelled
// -1 - failed; errmsg() has reason // -1 - failed; errmsg() has reason
// //
int Fl_Native_File_Chooser_Darwin_Driver::show() { int Fl_Quartz_Native_File_Chooser_Driver::show() {
// Make sure fltk interface updates before posting our dialog // Make sure fltk interface updates before posting our dialog
Fl::flush(); Fl::flush();
@ -187,37 +187,37 @@ int Fl_Native_File_Chooser_Darwin_Driver::show() {
// SET ERROR MESSAGE // SET ERROR MESSAGE
// Internal use only. // Internal use only.
// //
void Fl_Native_File_Chooser_Darwin_Driver::errmsg(const char *msg) { void Fl_Quartz_Native_File_Chooser_Driver::errmsg(const char *msg) {
_errmsg = strfree(_errmsg); _errmsg = strfree(_errmsg);
_errmsg = strnew(msg); _errmsg = strnew(msg);
} }
// RETURN ERROR MESSAGE // RETURN ERROR MESSAGE
const char *Fl_Native_File_Chooser_Darwin_Driver::errmsg() const { const char *Fl_Quartz_Native_File_Chooser_Driver::errmsg() const {
return(_errmsg ? _errmsg : "No error"); return(_errmsg ? _errmsg : "No error");
} }
// GET FILENAME // GET FILENAME
const char* Fl_Native_File_Chooser_Darwin_Driver::filename() const { const char* Fl_Quartz_Native_File_Chooser_Driver::filename() const {
if ( _pathnames && _tpathnames > 0 ) return(_pathnames[0]); if ( _pathnames && _tpathnames > 0 ) return(_pathnames[0]);
return(""); return("");
} }
// GET FILENAME FROM LIST OF FILENAMES // GET FILENAME FROM LIST OF FILENAMES
const char* Fl_Native_File_Chooser_Darwin_Driver::filename(int i) const { const char* Fl_Quartz_Native_File_Chooser_Driver::filename(int i) const {
if ( _pathnames && i < _tpathnames ) return(_pathnames[i]); if ( _pathnames && i < _tpathnames ) return(_pathnames[i]);
return(""); return("");
} }
// GET TOTAL FILENAMES CHOSEN // GET TOTAL FILENAMES CHOSEN
int Fl_Native_File_Chooser_Darwin_Driver::count() const { int Fl_Quartz_Native_File_Chooser_Driver::count() const {
return(_tpathnames); return(_tpathnames);
} }
// PRESET PATHNAME // PRESET PATHNAME
// Value can be NULL for none. // Value can be NULL for none.
// //
void Fl_Native_File_Chooser_Darwin_Driver::directory(const char *val) { void Fl_Quartz_Native_File_Chooser_Driver::directory(const char *val) {
_directory = strfree(_directory); _directory = strfree(_directory);
_directory = strnew(val); _directory = strnew(val);
} }
@ -225,14 +225,14 @@ void Fl_Native_File_Chooser_Darwin_Driver::directory(const char *val) {
// GET PRESET PATHNAME // GET PRESET PATHNAME
// Returned value can be NULL if none set. // Returned value can be NULL if none set.
// //
const char* Fl_Native_File_Chooser_Darwin_Driver::directory() const { const char* Fl_Quartz_Native_File_Chooser_Driver::directory() const {
return(_directory); return(_directory);
} }
// SET TITLE // SET TITLE
// Value can be NULL if no title desired. // Value can be NULL if no title desired.
// //
void Fl_Native_File_Chooser_Darwin_Driver::title(const char *val) { void Fl_Quartz_Native_File_Chooser_Driver::title(const char *val) {
_title = strfree(_title); _title = strfree(_title);
_title = strnew(val); _title = strnew(val);
} }
@ -240,14 +240,14 @@ void Fl_Native_File_Chooser_Darwin_Driver::title(const char *val) {
// GET TITLE // GET TITLE
// Returned value can be NULL if none set. // Returned value can be NULL if none set.
// //
const char *Fl_Native_File_Chooser_Darwin_Driver::title() const { const char *Fl_Quartz_Native_File_Chooser_Driver::title() const {
return(_title); return(_title);
} }
// SET FILTER // SET FILTER
// Can be NULL if no filter needed // Can be NULL if no filter needed
// //
void Fl_Native_File_Chooser_Darwin_Driver::filter(const char *val) { void Fl_Quartz_Native_File_Chooser_Driver::filter(const char *val) {
_filter = strfree(_filter); _filter = strfree(_filter);
_filter = strnew(val); _filter = strnew(val);
@ -264,14 +264,14 @@ void Fl_Native_File_Chooser_Darwin_Driver::filter(const char *val) {
// GET FILTER // GET FILTER
// Returned value can be NULL if none set. // Returned value can be NULL if none set.
// //
const char *Fl_Native_File_Chooser_Darwin_Driver::filter() const { const char *Fl_Quartz_Native_File_Chooser_Driver::filter() const {
return(_filter); return(_filter);
} }
// CLEAR ALL FILTERS // CLEAR ALL FILTERS
// Internal use only. // Internal use only.
// //
void Fl_Native_File_Chooser_Darwin_Driver::clear_filters() { void Fl_Quartz_Native_File_Chooser_Driver::clear_filters() {
_filt_names = strfree(_filt_names); _filt_names = strfree(_filt_names);
for (int i=0; i<_filt_total; i++) { for (int i=0; i<_filt_total; i++) {
_filt_patt[i] = strfree(_filt_patt[i]); _filt_patt[i] = strfree(_filt_patt[i]);
@ -299,7 +299,7 @@ void Fl_Native_File_Chooser_Darwin_Driver::clear_filters() {
// \_____/ \_______/ // \_____/ \_______/
// Name Wildcard // Name Wildcard
// //
void Fl_Native_File_Chooser_Darwin_Driver::parse_filter(const char *in) { void Fl_Quartz_Native_File_Chooser_Driver::parse_filter(const char *in) {
clear_filters(); clear_filters();
if ( ! in ) return; if ( ! in ) return;
int has_name = strchr(in, '\t') ? 1 : 0; int has_name = strchr(in, '\t') ? 1 : 0;
@ -375,7 +375,7 @@ void Fl_Native_File_Chooser_Darwin_Driver::parse_filter(const char *in) {
// SET PRESET FILE // SET PRESET FILE
// Value can be NULL for none. // Value can be NULL for none.
// //
void Fl_Native_File_Chooser_Darwin_Driver::preset_file(const char* val) { void Fl_Quartz_Native_File_Chooser_Driver::preset_file(const char* val) {
_preset_file = strfree(_preset_file); _preset_file = strfree(_preset_file);
_preset_file = strnew(val); _preset_file = strnew(val);
} }
@ -383,26 +383,26 @@ void Fl_Native_File_Chooser_Darwin_Driver::preset_file(const char* val) {
// PRESET FILE // PRESET FILE
// Returned value can be NULL if none set. // Returned value can be NULL if none set.
// //
const char* Fl_Native_File_Chooser_Darwin_Driver::preset_file() const { const char* Fl_Quartz_Native_File_Chooser_Driver::preset_file() const {
return(_preset_file); return(_preset_file);
} }
void Fl_Native_File_Chooser_Darwin_Driver::filter_value(int val) { void Fl_Quartz_Native_File_Chooser_Driver::filter_value(int val) {
_filt_value = val; _filt_value = val;
} }
int Fl_Native_File_Chooser_Darwin_Driver::filter_value() const { int Fl_Quartz_Native_File_Chooser_Driver::filter_value() const {
return(_filt_value); return(_filt_value);
} }
int Fl_Native_File_Chooser_Darwin_Driver::filters() const { int Fl_Quartz_Native_File_Chooser_Driver::filters() const {
return(_filt_total); return(_filt_total);
} }
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#define UNLIKELYPREFIX "___fl_very_unlikely_prefix_" #define UNLIKELYPREFIX "___fl_very_unlikely_prefix_"
int Fl_Native_File_Chooser_Darwin_Driver::get_saveas_basename(void) { int Fl_Quartz_Native_File_Chooser_Driver::get_saveas_basename(void) {
char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] ); char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] );
if ( !(_options & Fl_Native_File_Chooser::SAVEAS_CONFIRM) ) { if ( !(_options & Fl_Native_File_Chooser::SAVEAS_CONFIRM) ) {
const char *d = [[[[(NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String]; const char *d = [[[[(NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String];
@ -418,7 +418,7 @@ int Fl_Native_File_Chooser_Darwin_Driver::get_saveas_basename(void) {
} }
// SET THE TYPE OF BROWSER // SET THE TYPE OF BROWSER
void Fl_Native_File_Chooser_Darwin_Driver::type(int val) { void Fl_Quartz_Native_File_Chooser_Driver::type(int val) {
_btype = val; _btype = val;
} }
@ -587,7 +587,7 @@ static NSPopUpButton *createPopupAccessory(NSSavePanel *panel, const char *filte
return popup; return popup;
} }
int Fl_Native_File_Chooser_Darwin_Driver::runmodal() int Fl_Quartz_Native_File_Chooser_Driver::runmodal()
{ {
NSString *dir = nil; NSString *dir = nil;
NSString *fname = nil; NSString *fname = nil;
@ -623,7 +623,7 @@ int Fl_Native_File_Chooser_Darwin_Driver::runmodal()
// 1 - user cancelled // 1 - user cancelled
// -1 - failed; errmsg() has reason // -1 - failed; errmsg() has reason
// //
int Fl_Native_File_Chooser_Darwin_Driver::post() { int Fl_Quartz_Native_File_Chooser_Driver::post() {
// INITIALIZE BROWSER // INITIALIZE BROWSER
if ( _filt_total == 0 ) { // Make sure they match if ( _filt_total == 0 ) { // Make sure they match
_filt_value = 0; // TBD: move to someplace more logical? _filt_value = 0; // TBD: move to someplace more logical?

78
src/Fl_Native_File_Chooser_WIN32.cxx

@ -38,7 +38,7 @@
#include <FL/x.H> // for fl_open_display #include <FL/x.H> // for fl_open_display
class Fl_Native_File_Chooser_WinAPI_Driver : public Fl_Native_File_Chooser_Driver { class Fl_WinAPI_Native_File_Chooser_Driver : public Fl_Native_File_Chooser_Driver {
private: private:
int _btype; // kind-of browser to show() int _btype; // kind-of browser to show()
int _options; // general options int _options; // general options
@ -72,8 +72,8 @@ private:
void clear_filters(); void clear_filters();
void add_filter(const char *, const char *); void add_filter(const char *, const char *);
public: public:
Fl_Native_File_Chooser_WinAPI_Driver(int val); Fl_WinAPI_Native_File_Chooser_Driver(int val);
~Fl_Native_File_Chooser_WinAPI_Driver(); ~Fl_WinAPI_Native_File_Chooser_Driver();
virtual void type(int t); virtual void type(int t);
virtual int type() const ; virtual int type() const ;
virtual void options(int o); virtual void options(int o);
@ -98,7 +98,7 @@ public:
Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) { Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
platform_fnfc = new Fl_Native_File_Chooser_WinAPI_Driver(val); platform_fnfc = new Fl_WinAPI_Native_File_Chooser_Driver(val);
} }
@ -193,7 +193,7 @@ static void dnullcat(char*&wp, const char *string, int n = -1 ) {
} }
// CTOR // CTOR
Fl_Native_File_Chooser_WinAPI_Driver::Fl_Native_File_Chooser_WinAPI_Driver(int val) : Fl_WinAPI_Native_File_Chooser_Driver::Fl_WinAPI_Native_File_Chooser_Driver(int val) :
Fl_Native_File_Chooser_Driver(val) { Fl_Native_File_Chooser_Driver(val) {
_btype = val; _btype = val;
_options = Fl_Native_File_Chooser::NO_OPTIONS; _options = Fl_Native_File_Chooser::NO_OPTIONS;
@ -215,7 +215,7 @@ Fl_Native_File_Chooser_WinAPI_Driver::Fl_Native_File_Chooser_WinAPI_Driver(int v
} }
// DTOR // DTOR
Fl_Native_File_Chooser_WinAPI_Driver::~Fl_Native_File_Chooser_WinAPI_Driver() { Fl_WinAPI_Native_File_Chooser_Driver::~Fl_WinAPI_Native_File_Chooser_Driver() {
//_pathnames // managed by clear_pathnames() //_pathnames // managed by clear_pathnames()
//_tpathnames // managed by clear_pathnames() //_tpathnames // managed by clear_pathnames()
_directory = strfree(_directory); _directory = strfree(_directory);
@ -234,33 +234,33 @@ Fl_Native_File_Chooser_WinAPI_Driver::~Fl_Native_File_Chooser_WinAPI_Driver() {
} }
// SET TYPE OF BROWSER // SET TYPE OF BROWSER
void Fl_Native_File_Chooser_WinAPI_Driver::type(int val) { void Fl_WinAPI_Native_File_Chooser_Driver::type(int val) {
_btype = val; _btype = val;
} }
// GET TYPE OF BROWSER // GET TYPE OF BROWSER
int Fl_Native_File_Chooser_WinAPI_Driver::type() const { int Fl_WinAPI_Native_File_Chooser_Driver::type() const {
return( _btype ); return( _btype );
} }
// SET OPTIONS // SET OPTIONS
void Fl_Native_File_Chooser_WinAPI_Driver::options(int val) { void Fl_WinAPI_Native_File_Chooser_Driver::options(int val) {
_options = val; _options = val;
} }
// GET OPTIONS // GET OPTIONS
int Fl_Native_File_Chooser_WinAPI_Driver::options() const { int Fl_WinAPI_Native_File_Chooser_Driver::options() const {
return(_options); return(_options);
} }
// PRIVATE: SET ERROR MESSAGE // PRIVATE: SET ERROR MESSAGE
void Fl_Native_File_Chooser_WinAPI_Driver::errmsg(const char *val) { void Fl_WinAPI_Native_File_Chooser_Driver::errmsg(const char *val) {
_errmsg = strfree(_errmsg); _errmsg = strfree(_errmsg);
_errmsg = strnew(val); _errmsg = strnew(val);
} }
// FREE PATHNAMES ARRAY, IF IT HAS ANY CONTENTS // FREE PATHNAMES ARRAY, IF IT HAS ANY CONTENTS
void Fl_Native_File_Chooser_WinAPI_Driver::clear_pathnames() { void Fl_WinAPI_Native_File_Chooser_Driver::clear_pathnames() {
if ( _pathnames ) { if ( _pathnames ) {
while ( --_tpathnames >= 0 ) { while ( --_tpathnames >= 0 ) {
_pathnames[_tpathnames] = strfree(_pathnames[_tpathnames]); _pathnames[_tpathnames] = strfree(_pathnames[_tpathnames]);
@ -272,7 +272,7 @@ void Fl_Native_File_Chooser_WinAPI_Driver::clear_pathnames() {
} }
// SET A SINGLE PATHNAME // SET A SINGLE PATHNAME
void Fl_Native_File_Chooser_WinAPI_Driver::set_single_pathname(const char *s) { void Fl_WinAPI_Native_File_Chooser_Driver::set_single_pathname(const char *s) {
clear_pathnames(); clear_pathnames();
_pathnames = new char*[1]; _pathnames = new char*[1];
_pathnames[0] = strnew(s); _pathnames[0] = strnew(s);
@ -280,7 +280,7 @@ void Fl_Native_File_Chooser_WinAPI_Driver::set_single_pathname(const char *s) {
} }
// ADD PATHNAME TO EXISTING ARRAY // ADD PATHNAME TO EXISTING ARRAY
void Fl_Native_File_Chooser_WinAPI_Driver::add_pathname(const char *s) { void Fl_WinAPI_Native_File_Chooser_Driver::add_pathname(const char *s) {
if ( ! _pathnames ) { if ( ! _pathnames ) {
// Create first element in array // Create first element in array
++_tpathnames; ++_tpathnames;
@ -308,7 +308,7 @@ static void FreePIDL(LPITEMIDLIST pidl) {
} }
// CLEAR MICROSOFT OFN (OPEN FILE NAME) CLASS // CLEAR MICROSOFT OFN (OPEN FILE NAME) CLASS
void Fl_Native_File_Chooser_WinAPI_Driver::ClearOFN() { void Fl_WinAPI_Native_File_Chooser_Driver::ClearOFN() {
// Free any previously allocated lpstrFile before zeroing out _ofn_ptr // Free any previously allocated lpstrFile before zeroing out _ofn_ptr
if ( _ofn_ptr->lpstrFile ) { if ( _ofn_ptr->lpstrFile ) {
delete[] _ofn_ptr->lpstrFile; delete[] _ofn_ptr->lpstrFile;
@ -326,7 +326,7 @@ void Fl_Native_File_Chooser_WinAPI_Driver::ClearOFN() {
} }
// CLEAR MICROSOFT BINF (BROWSER INFO) CLASS // CLEAR MICROSOFT BINF (BROWSER INFO) CLASS
void Fl_Native_File_Chooser_WinAPI_Driver::ClearBINF() { void Fl_WinAPI_Native_File_Chooser_Driver::ClearBINF() {
if ( _binf_ptr->pidlRoot ) { if ( _binf_ptr->pidlRoot ) {
FreePIDL((ITEMIDLIST*)_binf_ptr->pidlRoot); FreePIDL((ITEMIDLIST*)_binf_ptr->pidlRoot);
_binf_ptr->pidlRoot = NULL; _binf_ptr->pidlRoot = NULL;
@ -335,19 +335,19 @@ void Fl_Native_File_Chooser_WinAPI_Driver::ClearBINF() {
} }
// CONVERT WINDOWS BACKSLASHES TO UNIX FRONTSLASHES // CONVERT WINDOWS BACKSLASHES TO UNIX FRONTSLASHES
void Fl_Native_File_Chooser_WinAPI_Driver::Win2Unix(char *s) { void Fl_WinAPI_Native_File_Chooser_Driver::Win2Unix(char *s) {
for ( ; *s; s++ ) for ( ; *s; s++ )
if ( *s == '\\' ) *s = '/'; if ( *s == '\\' ) *s = '/';
} }
// CONVERT UNIX FRONTSLASHES TO WINDOWS BACKSLASHES // CONVERT UNIX FRONTSLASHES TO WINDOWS BACKSLASHES
void Fl_Native_File_Chooser_WinAPI_Driver::Unix2Win(char *s) { void Fl_WinAPI_Native_File_Chooser_Driver::Unix2Win(char *s) {
for ( ; *s; s++ ) for ( ; *s; s++ )
if ( *s == '/' ) *s = '\\'; if ( *s == '/' ) *s = '\\';
} }
// SHOW FILE BROWSER // SHOW FILE BROWSER
int Fl_Native_File_Chooser_WinAPI_Driver::showfile() { int Fl_WinAPI_Native_File_Chooser_Driver::showfile() {
ClearOFN(); ClearOFN();
clear_pathnames(); clear_pathnames();
size_t fsize = FNFC_MAX_PATH; size_t fsize = FNFC_MAX_PATH;
@ -538,7 +538,7 @@ static int CALLBACK Dir_CB(HWND win, UINT msg, LPARAM param, LPARAM data) {
} }
// SHOW DIRECTORY BROWSER // SHOW DIRECTORY BROWSER
int Fl_Native_File_Chooser_WinAPI_Driver::showdir() { int Fl_WinAPI_Native_File_Chooser_Driver::showdir() {
// initialize OLE only once // initialize OLE only once
fl_open_display(); // init needed by BIF_USENEWUI fl_open_display(); // init needed by BIF_USENEWUI
ClearBINF(); ClearBINF();
@ -627,7 +627,7 @@ int Fl_Native_File_Chooser_WinAPI_Driver::showdir() {
// 1 - user cancelled // 1 - user cancelled
// -1 - failed; errmsg() has reason // -1 - failed; errmsg() has reason
// //
int Fl_Native_File_Chooser_WinAPI_Driver::show() { int Fl_WinAPI_Native_File_Chooser_Driver::show() {
int retval; int retval;
if ( _btype == Fl_Native_File_Chooser::BROWSE_DIRECTORY || if ( _btype == Fl_Native_File_Chooser::BROWSE_DIRECTORY ||
_btype == Fl_Native_File_Chooser::BROWSE_MULTI_DIRECTORY || _btype == Fl_Native_File_Chooser::BROWSE_MULTI_DIRECTORY ||
@ -646,31 +646,31 @@ int Fl_Native_File_Chooser_WinAPI_Driver::show() {
} }
// RETURN ERROR MESSAGE // RETURN ERROR MESSAGE
const char *Fl_Native_File_Chooser_WinAPI_Driver::errmsg() const { const char *Fl_WinAPI_Native_File_Chooser_Driver::errmsg() const {
return(_errmsg ? _errmsg : "No error"); return(_errmsg ? _errmsg : "No error");
} }
// GET FILENAME // GET FILENAME
const char* Fl_Native_File_Chooser_WinAPI_Driver::filename() const { const char* Fl_WinAPI_Native_File_Chooser_Driver::filename() const {
if ( _pathnames && _tpathnames > 0 ) return(_pathnames[0]); if ( _pathnames && _tpathnames > 0 ) return(_pathnames[0]);
return(""); return("");
} }
// GET FILENAME FROM LIST OF FILENAMES // GET FILENAME FROM LIST OF FILENAMES
const char* Fl_Native_File_Chooser_WinAPI_Driver::filename(int i) const { const char* Fl_WinAPI_Native_File_Chooser_Driver::filename(int i) const {
if ( _pathnames && i < _tpathnames ) return(_pathnames[i]); if ( _pathnames && i < _tpathnames ) return(_pathnames[i]);
return(""); return("");
} }
// GET TOTAL FILENAMES CHOSEN // GET TOTAL FILENAMES CHOSEN
int Fl_Native_File_Chooser_WinAPI_Driver::count() const { int Fl_WinAPI_Native_File_Chooser_Driver::count() const {
return(_tpathnames); return(_tpathnames);
} }
// PRESET PATHNAME // PRESET PATHNAME
// Can be NULL if no preset is desired. // Can be NULL if no preset is desired.
// //
void Fl_Native_File_Chooser_WinAPI_Driver::directory(const char *val) { void Fl_WinAPI_Native_File_Chooser_Driver::directory(const char *val) {
_directory = strfree(_directory); _directory = strfree(_directory);
_directory = strnew(val); _directory = strnew(val);
} }
@ -678,14 +678,14 @@ void Fl_Native_File_Chooser_WinAPI_Driver::directory(const char *val) {
// GET PRESET PATHNAME // GET PRESET PATHNAME
// Can return NULL if none set. // Can return NULL if none set.
// //
const char *Fl_Native_File_Chooser_WinAPI_Driver::directory() const { const char *Fl_WinAPI_Native_File_Chooser_Driver::directory() const {
return(_directory); return(_directory);
} }
// SET TITLE // SET TITLE
// Can be NULL if no title desired. // Can be NULL if no title desired.
// //
void Fl_Native_File_Chooser_WinAPI_Driver::title(const char *val) { void Fl_WinAPI_Native_File_Chooser_Driver::title(const char *val) {
_title = strfree(_title); _title = strfree(_title);
_title = strnew(val); _title = strnew(val);
} }
@ -693,14 +693,14 @@ void Fl_Native_File_Chooser_WinAPI_Driver::title(const char *val) {
// GET TITLE // GET TITLE
// Can return NULL if none set. // Can return NULL if none set.
// //
const char *Fl_Native_File_Chooser_WinAPI_Driver::title() const { const char *Fl_WinAPI_Native_File_Chooser_Driver::title() const {
return(_title); return(_title);
} }
// SET FILTER // SET FILTER
// Can be NULL if no filter needed // Can be NULL if no filter needed
// //
void Fl_Native_File_Chooser_WinAPI_Driver::filter(const char *val) { void Fl_WinAPI_Native_File_Chooser_Driver::filter(const char *val) {
_filter = strfree(_filter); _filter = strfree(_filter);
clear_filters(); clear_filters();
if ( val ) { if ( val ) {
@ -717,18 +717,18 @@ void Fl_Native_File_Chooser_WinAPI_Driver::filter(const char *val) {
// GET FILTER // GET FILTER
// Can return NULL if none set. // Can return NULL if none set.
// //
const char *Fl_Native_File_Chooser_WinAPI_Driver::filter() const { const char *Fl_WinAPI_Native_File_Chooser_Driver::filter() const {
return(_filter); return(_filter);
} }
// CLEAR FILTERS // CLEAR FILTERS
void Fl_Native_File_Chooser_WinAPI_Driver::clear_filters() { void Fl_WinAPI_Native_File_Chooser_Driver::clear_filters() {
_nfilters = 0; _nfilters = 0;
_parsedfilt = strfree(_parsedfilt); _parsedfilt = strfree(_parsedfilt);
} }
// ADD A FILTER // ADD A FILTER
void Fl_Native_File_Chooser_WinAPI_Driver::add_filter(const char *name_in, // name of filter (optional: can be null) void Fl_WinAPI_Native_File_Chooser_Driver::add_filter(const char *name_in, // name of filter (optional: can be null)
const char *winfilter) { // windows style filter (eg. "*.cxx;*.h") const char *winfilter) { // windows style filter (eg. "*.cxx;*.h")
// No name? Make one.. // No name? Make one..
char name[1024]; char name[1024];
@ -818,7 +818,7 @@ static int count_filters(const char *filter) {
// \_____/ \_______/ // \_____/ \_______/
// Name Wildcard // Name Wildcard
// //
void Fl_Native_File_Chooser_WinAPI_Driver::parse_filter(const char *in) { void Fl_WinAPI_Native_File_Chooser_Driver::parse_filter(const char *in) {
clear_filters(); clear_filters();
if ( ! in ) return; if ( ! in ) return;
@ -965,27 +965,27 @@ void Fl_Native_File_Chooser_WinAPI_Driver::parse_filter(const char *in) {
} }
// SET 'CURRENTLY SELECTED FILTER' // SET 'CURRENTLY SELECTED FILTER'
void Fl_Native_File_Chooser_WinAPI_Driver::filter_value(int i) { void Fl_WinAPI_Native_File_Chooser_Driver::filter_value(int i) {
_ofn_ptr->nFilterIndex = i + 1; _ofn_ptr->nFilterIndex = i + 1;
} }
// RETURN VALUE OF 'CURRENTLY SELECTED FILTER' // RETURN VALUE OF 'CURRENTLY SELECTED FILTER'
int Fl_Native_File_Chooser_WinAPI_Driver::filter_value() const { int Fl_WinAPI_Native_File_Chooser_Driver::filter_value() const {
return(_ofn_ptr->nFilterIndex ? _ofn_ptr->nFilterIndex-1 : _nfilters+1); return(_ofn_ptr->nFilterIndex ? _ofn_ptr->nFilterIndex-1 : _nfilters+1);
} }
// PRESET FILENAME FOR 'SAVE AS' CHOOSER // PRESET FILENAME FOR 'SAVE AS' CHOOSER
void Fl_Native_File_Chooser_WinAPI_Driver::preset_file(const char* val) { void Fl_WinAPI_Native_File_Chooser_Driver::preset_file(const char* val) {
_preset_file = strfree(_preset_file); _preset_file = strfree(_preset_file);
_preset_file = strnew(val); _preset_file = strnew(val);
} }
// GET PRESET FILENAME FOR 'SAVE AS' CHOOSER // GET PRESET FILENAME FOR 'SAVE AS' CHOOSER
const char* Fl_Native_File_Chooser_WinAPI_Driver::preset_file() const { const char* Fl_WinAPI_Native_File_Chooser_Driver::preset_file() const {
return(_preset_file); return(_preset_file);
} }
int Fl_Native_File_Chooser_WinAPI_Driver::filters() const { int Fl_WinAPI_Native_File_Chooser_Driver::filters() const {
return(_nfilters); return(_nfilters);
} }

Loading…
Cancel
Save