Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cFileDialog.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_CFileDialog_H
7 #define _INC_CFileDialog_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
13 
14 #if defined(_WIN32) && ! defined(_MFC_VER)
15 #include <commdlg.h>
16 #include "GrayCore/include/cOSHandle.h" // HANDLE_NULL
19 
20 struct __POSITION {};
21 typedef __POSITION* POSITION;
22 
23 namespace GrayLib
24 {
25  class GRAYLIB_LINK CFileDialog
26  {
29 
30  public:
31  _FNF(OPENFILENAME) m_ofn;
32 
33  protected:
34  bool m_bOpenFileDialog;
35  cStringF m_strFilter;
36  FILECHAR_t m_szFileTitle[64];
37  FILECHAR_t m_szFileName[_MAX_PATH];
38 
39  public:
40  explicit CFileDialog(bool bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs
41  const FILECHAR_t* pszDefExt = nullptr,
42  const FILECHAR_t* pszFileName = nullptr,
43  DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, // OFN_ALLOWMULTISELECT
44  const FILECHAR_t* pszFilter = nullptr,
45  HWND hParentWnd = WINHANDLE_NULL,
46  size_t dwSize = 0);
47  virtual ~CFileDialog();
48 
49  cStringF GetPathName() const; // return full path and filename if just one file is returned.
50  // Enumerating multiple file selections
51  POSITION GetStartPosition() const;
52  cStringF GetNextPathName(POSITION& pos) const;
53 
54  static FILECHAR_t* GRAYCALL FileFilterConvert(FILECHAR_t* pOutput, const FILECHAR_t* pFilter);
55 
56  virtual INT_PTR DoModal();
57 
58  _FNF(OPENFILENAME)& GetOFN()
59  {
60  return m_ofn;
61  }
62  };
63 };
64 #endif // _MFC_VER
65 #endif // _INC_CFileDialog_H
#define _FNF(c)
_WIN32 name has a A or W for UTF8 or UNICODE
Definition: FileName.h:24
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define _MAX_PATH
Definition: SysTypes.h:423
#define WINHANDLE_NULL
HWND, HPEN, etc are NOT OS Handles. like HWND_DESKTOP. like HANDLEPTR_NULL. This is a WINAPI void* ha...
Definition: cOSHandle.h:23
Definition: cMesh.h:22
cStringT< FILECHAR_t > cStringF
A file name. checks USE_UNICODE_FN. related to cFilePath.
Definition: cFilePath.h:17
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22