Skip to content

Commit

Permalink
The Fl_Native_File_Chooser class contains, under WIN32, two system-de…
Browse files Browse the repository at this point in the history
…fined structures

(OPENFILENAMEW and BROWSEINFOW). This forces any application program that uses
Fl_Native_File_Chooser to include file windows.h.
This is corrected by using in the Fl_Native_File_Chooser class pointers to the 2 structures.
The changes are protected by #if FLTK_ABI_VERSION >= 10304 for ABI compatibility.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10437 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Nov 6, 2014
1 parent bd1446a commit f2bb3ea
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 89 deletions.
25 changes: 16 additions & 9 deletions FL/Fl_Native_File_Chooser.H
Expand Up @@ -26,11 +26,16 @@
// Use Windows' chooser
#ifdef WIN32
// #define _WIN32_WINNT 0x0501 // needed for OPENFILENAME's 'FlagsEx'
# include <stdio.h>
# include <stdlib.h> // malloc
#if defined(FL_LIBRARY) || FLTK_ABI_VERSION < 10304
# include <windows.h>
# include <commdlg.h> // OPENFILENAME, GetOpenFileName()
# include <shlobj.h> // BROWSEINFO, SHBrowseForFolder()
# include <commdlg.h> // OPENFILENAMEW, GetOpenFileName()
# include <shlobj.h> // BROWSEINFOW, SHBrowseForFolder()
typedef OPENFILENAMEW fl_OPENFILENAMEW;
typedef BROWSEINFOW fl_BROWSEINFOW;
#else
typedef void fl_OPENFILENAMEW;
typedef void fl_BROWSEINFOW;
#endif
#endif

// Use Apple's chooser
Expand All @@ -41,7 +46,6 @@
// All else falls back to FLTK's own chooser
#if ! defined(__APPLE__) && !defined(WIN32)
# include <FL/Fl_File_Chooser.H>
# include <unistd.h> // _POSIX_NAME_MAX
#else
# include <FL/filename.H> // FL_EXPORT
#endif
Expand Down Expand Up @@ -154,8 +158,13 @@ public:
private:
int _btype; // kind-of browser to show()
int _options; // general options
OPENFILENAMEW _ofn; // GetOpenFileName() & GetSaveFileName() struct
BROWSEINFOW _binf; // SHBrowseForFolder() struct
#if FLTK_ABI_VERSION >= 10304
fl_OPENFILENAMEW *_ofn_ptr; // GetOpenFileName() & GetSaveFileName() struct
fl_BROWSEINFOW *_binf_ptr; // SHBrowseForFolder() struct
#else
fl_OPENFILENAMEW _ofn;
fl_BROWSEINFOW _binf;
#endif
char **_pathnames; // array of pathnames
int _tpathnames; // total pathnames
char *_directory; // default pathname to use
Expand All @@ -173,13 +182,11 @@ private:
void set_single_pathname(const char *s);
void add_pathname(const char *s);

void FreePIDL(LPITEMIDLIST pidl);
void ClearOFN();
void ClearBINF();
void Win2Unix(char *s);
void Unix2Win(char *s);
int showfile();
static int CALLBACK Dir_CB(HWND win, UINT msg, LPARAM param, LPARAM data);
int showdir();

void parse_filter(const char *);
Expand Down

0 comments on commit f2bb3ea

Please sign in to comment.