]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: filedlg.h | |
3 | // Purpose: wxFileDialog class | |
f0a56ab0 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
f0a56ab0 | 6 | // Created: 10/05/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
f0a56ab0 | 8 | // Copyright: (c) David Webster |
0e320a79 DW |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FILEDLG_H_ | |
13 | #define _WX_FILEDLG_H_ | |
14 | ||
0e320a79 DW |
15 | #include "wx/dialog.h" |
16 | ||
17 | /* | |
18 | * File selector | |
19 | */ | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const char*) wxFileSelectorPromptStr; | |
22 | WXDLLEXPORT_DATA(extern const char*) wxFileSelectorDefaultWildcardStr; | |
23 | ||
24 | class WXDLLEXPORT wxFileDialog: public wxDialog | |
25 | { | |
26 | DECLARE_DYNAMIC_CLASS(wxFileDialog) | |
0e320a79 DW |
27 | public: |
28 | wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr, | |
29 | const wxString& defaultDir = "", const wxString& defaultFile = "", const wxString& wildCard = wxFileSelectorDefaultWildcardStr, | |
30 | long style = 0, const wxPoint& pos = wxDefaultPosition); | |
31 | ||
32 | inline void SetMessage(const wxString& message) { m_message = message; } | |
33 | inline void SetPath(const wxString& path) { m_path = path; } | |
34 | inline void SetDirectory(const wxString& dir) { m_dir = dir; } | |
35 | inline void SetFilename(const wxString& name) { m_fileName = name; } | |
36 | inline void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; } | |
37 | inline void SetStyle(long style) { m_dialogStyle = style; } | |
38 | inline void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; } | |
39 | ||
40 | inline wxString GetMessage() const { return m_message; } | |
41 | inline wxString GetPath() const { return m_path; } | |
f6bcfd97 | 42 | inline void GetPaths(wxArrayString& a) { a.Empty(); a.Add(m_path); } |
0e320a79 DW |
43 | inline wxString GetDirectory() const { return m_dir; } |
44 | inline wxString GetFilename() const { return m_fileName; } | |
f6bcfd97 BP |
45 | inline void GetFilenames(wxArrayString& a) { a.Empty(); |
46 | a.Add( m_fileName); } | |
0e320a79 DW |
47 | inline wxString GetWildcard() const { return m_wildCard; } |
48 | inline long GetStyle() const { return m_dialogStyle; } | |
49 | inline int GetFilterIndex() const { return m_filterIndex ; } | |
50 | ||
51 | int ShowModal(); | |
f0a56ab0 DW |
52 | |
53 | protected: | |
54 | wxString m_message; | |
55 | long m_dialogStyle; | |
56 | wxWindow * m_parent; | |
57 | wxString m_dir; | |
58 | wxString m_path; // Full path | |
59 | wxString m_fileName; | |
60 | wxString m_wildCard; | |
61 | int m_filterIndex; | |
0e320a79 DW |
62 | }; |
63 | ||
64 | #define wxOPEN 0x0001 | |
65 | #define wxSAVE 0x0002 | |
66 | #define wxOVERWRITE_PROMPT 0x0004 | |
67 | #define wxHIDE_READONLY 0x0008 | |
68 | #define wxFILE_MUST_EXIST 0x0010 | |
69 | ||
70 | // File selector - backward compatibility | |
f0a56ab0 DW |
71 | WXDLLEXPORT wxString wxFileSelector( const char *message = wxFileSelectorPromptStr |
72 | ,const char *default_path = NULL | |
73 | ,const char *default_filename = NULL | |
74 | ,const char *default_extension = NULL | |
75 | ,const char *wildcard = wxFileSelectorDefaultWildcardStr | |
76 | ,int flags = 0 | |
77 | ,wxWindow *parent = NULL | |
78 | ,int x = -1 | |
79 | ,int y = -1 | |
80 | ); | |
0e320a79 DW |
81 | |
82 | // An extended version of wxFileSelector | |
f0a56ab0 DW |
83 | WXDLLEXPORT wxString wxFileSelectorEx( const char *message = wxFileSelectorPromptStr |
84 | ,const char *default_path = NULL | |
85 | ,const char *default_filename = NULL | |
86 | ,int *indexDefaultExtension = NULL | |
87 | ,const char *wildcard = wxFileSelectorDefaultWildcardStr | |
88 | ,int flags = 0 | |
89 | ,wxWindow *parent = NULL | |
90 | ,int x = -1 | |
91 | ,int y = -1 | |
92 | ); | |
0e320a79 DW |
93 | |
94 | // Generic file load dialog | |
f0a56ab0 DW |
95 | WXDLLEXPORT wxString wxLoadFileSelector( const char *what |
96 | ,const char *extension | |
97 | ,const char *default_name = NULL | |
98 | ,wxWindow *parent = NULL | |
99 | ); | |
0e320a79 DW |
100 | |
101 | // Generic file save dialog | |
f0a56ab0 DW |
102 | WXDLLEXPORT wxString wxSaveFileSelector( const char *what |
103 | ,const char *extension | |
104 | ,const char *default_name = NULL | |
105 | ,wxWindow *parent = NULL | |
106 | ); | |
0e320a79 DW |
107 | |
108 | #endif | |
109 | // _WX_FILEDLG_H_ |