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