Attempt to fix UTF8 encoding of WIN32 Native File Chooser BROWSE_DIRECTORY options
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9932 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
c9598ade18
commit
ed04fc6774
@ -51,19 +51,19 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class lets an FLTK application easily and consistently access
|
This class lets an FLTK application easily and consistently access
|
||||||
the operating system's native file chooser. Some operating systems
|
the operating system's native file chooser. Some operating systems
|
||||||
have very complex and specific file choosers that many users want
|
have very complex and specific file choosers that many users want
|
||||||
access to specifically, instead of FLTK's default file chooser(s).
|
access to specifically, instead of FLTK's default file chooser(s).
|
||||||
|
|
||||||
In cases where there is no native file browser, FLTK's own file browser
|
In cases where there is no native file browser, FLTK's own file browser
|
||||||
is used instead.
|
is used instead.
|
||||||
|
|
||||||
To use this widget, use the following include in your code:
|
To use this widget, use the following include in your code:
|
||||||
\code
|
\code
|
||||||
#include <FL/Fl_Native_File_Chooser.H>
|
#include <FL/Fl_Native_File_Chooser.H>
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
The following example shows how to pick a single file:
|
The following example shows how to pick a single file:
|
||||||
\code
|
\code
|
||||||
// Create and post the local native file chooser
|
// Create and post the local native file chooser
|
||||||
@ -82,25 +82,25 @@
|
|||||||
default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN
|
default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN
|
||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
The Fl_Native_File_Chooser widget transmits UTF-8 encoded filenames to its user. It is
|
The Fl_Native_File_Chooser widget transmits UTF-8 encoded filenames to its user. It is
|
||||||
recommended to open files that may have non-ASCII names with the fl_fopen() or
|
recommended to open files that may have non-ASCII names with the fl_fopen() or
|
||||||
fl_open() utility functions that handle these names in a cross-platform way
|
fl_open() utility functions that handle these names in a cross-platform way
|
||||||
(whereas the standard fopen()/open() functions fail on the MSWindows platform
|
(whereas the standard fopen()/open() functions fail on the MSWindows platform
|
||||||
to open files with a non-ASCII name).
|
to open files with a non-ASCII name).
|
||||||
|
|
||||||
<B>Platform Specific Caveats</B>
|
<B>Platform Specific Caveats</B>
|
||||||
|
|
||||||
- Under X windows, it's best if you call Fl_File_Icon::load_system_icons()
|
- Under X windows, it's best if you call Fl_File_Icon::load_system_icons()
|
||||||
at the start of main(), to enable the nicer looking file browser widgets.
|
at the start of main(), to enable the nicer looking file browser widgets.
|
||||||
Use the static public attributes of class Fl_File_Chooser to localize
|
Use the static public attributes of class Fl_File_Chooser to localize
|
||||||
the browser.
|
the browser.
|
||||||
- Some operating systems support certain OS specific options; see
|
- Some operating systems support certain OS specific options; see
|
||||||
Fl_Native_File_Chooser::options() for a list.
|
Fl_Native_File_Chooser::options() for a list.
|
||||||
|
|
||||||
\image html Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms."
|
\image html Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms."
|
||||||
\image latex Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms" width=14cm
|
\image latex Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms" width=14cm
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class FL_EXPORT Fl_Native_File_Chooser {
|
class FL_EXPORT Fl_Native_File_Chooser {
|
||||||
public:
|
public:
|
||||||
@ -121,11 +121,11 @@ public:
|
|||||||
};
|
};
|
||||||
/** Localizable message */
|
/** Localizable message */
|
||||||
static const char *file_exists_message;
|
static const char *file_exists_message;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Fl_Native_File_Chooser(int val=BROWSE_FILE);
|
Fl_Native_File_Chooser(int val=BROWSE_FILE);
|
||||||
~Fl_Native_File_Chooser();
|
~Fl_Native_File_Chooser();
|
||||||
|
|
||||||
// Public methods
|
// Public methods
|
||||||
void type(int);
|
void type(int);
|
||||||
int type() const;
|
int type() const;
|
||||||
@ -147,13 +147,13 @@ public:
|
|||||||
const char* preset_file() const;
|
const char* preset_file() const;
|
||||||
const char *errmsg() const;
|
const char *errmsg() const;
|
||||||
int show();
|
int show();
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
private:
|
private:
|
||||||
int _btype; // kind-of browser to show()
|
int _btype; // kind-of browser to show()
|
||||||
int _options; // general options
|
int _options; // general options
|
||||||
OPENFILENAMEW _ofn; // GetOpenFileName() & GetSaveFileName() struct
|
OPENFILENAMEW _ofn; // GetOpenFileName() & GetSaveFileName() struct
|
||||||
BROWSEINFO _binf; // SHBrowseForFolder() struct
|
BROWSEINFOW _binf; // SHBrowseForFolder() struct
|
||||||
char **_pathnames; // array of pathnames
|
char **_pathnames; // array of pathnames
|
||||||
int _tpathnames; // total pathnames
|
int _tpathnames; // total pathnames
|
||||||
char *_directory; // default pathname to use
|
char *_directory; // default pathname to use
|
||||||
@ -163,14 +163,14 @@ private:
|
|||||||
int _nfilters; // number of filters parse_filter counted
|
int _nfilters; // number of filters parse_filter counted
|
||||||
char *_preset_file; // the file to preselect
|
char *_preset_file; // the file to preselect
|
||||||
char *_errmsg; // error message
|
char *_errmsg; // error message
|
||||||
|
|
||||||
// Private methods
|
// Private methods
|
||||||
void errmsg(const char *msg);
|
void errmsg(const char *msg);
|
||||||
|
|
||||||
void clear_pathnames();
|
void clear_pathnames();
|
||||||
void set_single_pathname(const char *s);
|
void set_single_pathname(const char *s);
|
||||||
void add_pathname(const char *s);
|
void add_pathname(const char *s);
|
||||||
|
|
||||||
void FreePIDL(LPITEMIDLIST pidl);
|
void FreePIDL(LPITEMIDLIST pidl);
|
||||||
void ClearOFN();
|
void ClearOFN();
|
||||||
void ClearBINF();
|
void ClearBINF();
|
||||||
@ -179,7 +179,7 @@ private:
|
|||||||
int showfile();
|
int showfile();
|
||||||
static int CALLBACK Dir_CB(HWND win, UINT msg, LPARAM param, LPARAM data);
|
static int CALLBACK Dir_CB(HWND win, UINT msg, LPARAM param, LPARAM data);
|
||||||
int showdir();
|
int showdir();
|
||||||
|
|
||||||
void parse_filter(const char *);
|
void parse_filter(const char *);
|
||||||
void clear_filters();
|
void clear_filters();
|
||||||
void add_filter(const char *, const char *);
|
void add_filter(const char *, const char *);
|
||||||
@ -195,22 +195,22 @@ private:
|
|||||||
char *_directory; // default pathname to use
|
char *_directory; // default pathname to use
|
||||||
char *_title; // title for window
|
char *_title; // title for window
|
||||||
char *_preset_file; // the 'save as' filename
|
char *_preset_file; // the 'save as' filename
|
||||||
|
|
||||||
char *_filter; // user-side search filter, eg:
|
char *_filter; // user-side search filter, eg:
|
||||||
// C Files\t*.[ch]\nText Files\t*.txt"
|
// C Files\t*.[ch]\nText Files\t*.txt"
|
||||||
|
|
||||||
char *_filt_names; // filter names (tab delimited)
|
char *_filt_names; // filter names (tab delimited)
|
||||||
// eg. "C Files\tText Files"
|
// eg. "C Files\tText Files"
|
||||||
|
|
||||||
char *_filt_patt[MAXFILTERS];
|
char *_filt_patt[MAXFILTERS];
|
||||||
// array of filter patterns, eg:
|
// array of filter patterns, eg:
|
||||||
// _filt_patt[0]="*.{cxx,h}"
|
// _filt_patt[0]="*.{cxx,h}"
|
||||||
// _filt_patt[1]="*.txt"
|
// _filt_patt[1]="*.txt"
|
||||||
|
|
||||||
int _filt_total; // parse_filter() # of filters loaded
|
int _filt_total; // parse_filter() # of filters loaded
|
||||||
int _filt_value; // index of the selected filter
|
int _filt_value; // index of the selected filter
|
||||||
char *_errmsg; // error message
|
char *_errmsg; // error message
|
||||||
|
|
||||||
// Private methods
|
// Private methods
|
||||||
void errmsg(const char *msg);
|
void errmsg(const char *msg);
|
||||||
void clear_pathnames();
|
void clear_pathnames();
|
||||||
@ -236,7 +236,7 @@ private:
|
|||||||
char *_directory;
|
char *_directory;
|
||||||
char *_errmsg; // error message
|
char *_errmsg; // error message
|
||||||
Fl_File_Chooser *_file_chooser;
|
Fl_File_Chooser *_file_chooser;
|
||||||
|
|
||||||
// Private methods
|
// Private methods
|
||||||
void errmsg(const char *msg);
|
void errmsg(const char *msg);
|
||||||
int type_fl_file(int);
|
int type_fl_file(int);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user