wxFileDialog cleanup, extracted common code to fldlgcmn.cpp (patch 754187)
[wxWidgets.git] / include / wx / filedlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: filedlg.h
3 // Purpose: wxFileDialog base header
4 // Author: Robert Roebling
5 // Modified by:
6 // Created: 8/17/99
7 // Copyright: (c) Robert Roebling
8 // RCS-ID:
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FILEDLG_H_BASE_
13 #define _WX_FILEDLG_H_BASE_
14
15 #if wxUSE_FILEDLG
16
17 #if defined(__GNUG__) && !defined(__APPLE__)
18 #pragma interface "filedlg.h"
19 #endif
20
21 //----------------------------------------------------------------------------
22 // wxFileDialog data and generic functions
23 //----------------------------------------------------------------------------
24
25 enum
26 {
27 wxOPEN = 0x0001,
28 wxSAVE = 0x0002,
29 wxOVERWRITE_PROMPT = 0x0004,
30 wxHIDE_READONLY = 0x0008,
31 wxFILE_MUST_EXIST = 0x0010,
32 wxMULTIPLE = 0x0020,
33 wxCHANGE_DIR = 0x0040
34 };
35
36 WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorPromptStr;
37 WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorDefaultWildcardStr;
38
39 // Parses the filterStr, returning the number of filters.
40 // Returns 0 if none or if there's a problem, they arrays will contain an equal
41 // number of items found before the error.
42 // filterStr is in the form:
43 // "All files (*.*)|*.*|Image Files (*.jpeg *.png)|*.jpg;*.png"
44 extern int wxParseFileFilter(const wxString& filterStr,
45 wxArrayString& descriptions,
46 wxArrayString& filters);
47
48 //----------------------------------------------------------------------------
49 // wxFileDialog convenience functions
50 //----------------------------------------------------------------------------
51
52 // File selector - backward compatibility
53 WXDLLEXPORT wxString
54 wxFileSelector(const wxChar *message = wxFileSelectorPromptStr,
55 const wxChar *default_path = NULL,
56 const wxChar *default_filename = NULL,
57 const wxChar *default_extension = NULL,
58 const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
59 int flags = 0,
60 wxWindow *parent = NULL,
61 int x = -1, int y = -1);
62
63 // An extended version of wxFileSelector
64 WXDLLEXPORT wxString
65 wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr,
66 const wxChar *default_path = NULL,
67 const wxChar *default_filename = NULL,
68 int *indexDefaultExtension = NULL,
69 const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
70 int flags = 0,
71 wxWindow *parent = NULL,
72 int x = -1, int y = -1);
73
74 // Ask for filename to load
75 WXDLLEXPORT wxString
76 wxLoadFileSelector(const wxChar *what,
77 const wxChar *extension,
78 const wxChar *default_name = (const wxChar *)NULL,
79 wxWindow *parent = (wxWindow *) NULL);
80
81 // Ask for filename to save
82 WXDLLEXPORT wxString
83 wxSaveFileSelector(const wxChar *what,
84 const wxChar *extension,
85 const wxChar *default_name = (const wxChar *) NULL,
86 wxWindow *parent = (wxWindow *) NULL);
87
88
89 #if defined (__WXUNIVERSAL__)
90 #include "wx/generic/filedlgg.h"
91 #elif defined(__WXMSW__)
92 #include "wx/msw/filedlg.h"
93 #elif defined(__WXMOTIF__)
94 #include "wx/motif/filedlg.h"
95 #elif defined(__WXGTK__)
96 #include "wx/generic/filedlgg.h"
97 #elif defined(__WXX11__)
98 #include "wx/generic/filedlgg.h"
99 #elif defined(__WXMGL__)
100 #include "wx/generic/filedlgg.h"
101 #elif defined(__WXMAC__)
102 #include "wx/mac/filedlg.h"
103 #elif defined(__WXCOCOA__)
104 #include "wx/generic/filedlgg.h"
105 #elif defined(__WXPM__)
106 #include "wx/os2/filedlg.h"
107 #endif
108
109 #endif // wxUSE_FILEDLG
110
111 #endif // _WX_FILEDLG_H_BASE_