]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: filedlg.h | |
3 | // Purpose: wxFileDialog class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/05/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FILEDLG_H_ | |
13 | #define _WX_FILEDLG_H_ | |
14 | ||
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) | |
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; } | |
42 | inline wxString GetDirectory() const { return m_dir; } | |
43 | inline wxString GetFilename() const { return m_fileName; } | |
44 | inline wxString GetWildcard() const { return m_wildCard; } | |
45 | inline long GetStyle() const { return m_dialogStyle; } | |
46 | inline int GetFilterIndex() const { return m_filterIndex ; } | |
47 | ||
48 | int ShowModal(); | |
49 | ||
50 | protected: | |
51 | wxString m_message; | |
52 | long m_dialogStyle; | |
53 | wxWindow * m_parent; | |
54 | wxString m_dir; | |
55 | wxString m_path; // Full path | |
56 | wxString m_fileName; | |
57 | wxString m_wildCard; | |
58 | int m_filterIndex; | |
59 | }; | |
60 | ||
61 | #define wxOPEN 0x0001 | |
62 | #define wxSAVE 0x0002 | |
63 | #define wxOVERWRITE_PROMPT 0x0004 | |
64 | #define wxHIDE_READONLY 0x0008 | |
65 | #define wxFILE_MUST_EXIST 0x0010 | |
66 | ||
67 | // File selector - backward compatibility | |
68 | WXDLLEXPORT wxString wxFileSelector( const char *message = wxFileSelectorPromptStr | |
69 | ,const char *default_path = NULL | |
70 | ,const char *default_filename = NULL | |
71 | ,const char *default_extension = NULL | |
72 | ,const char *wildcard = wxFileSelectorDefaultWildcardStr | |
73 | ,int flags = 0 | |
74 | ,wxWindow *parent = NULL | |
75 | ,int x = -1 | |
76 | ,int y = -1 | |
77 | ); | |
78 | ||
79 | // An extended version of wxFileSelector | |
80 | WXDLLEXPORT wxString wxFileSelectorEx( const char *message = wxFileSelectorPromptStr | |
81 | ,const char *default_path = NULL | |
82 | ,const char *default_filename = NULL | |
83 | ,int *indexDefaultExtension = NULL | |
84 | ,const char *wildcard = wxFileSelectorDefaultWildcardStr | |
85 | ,int flags = 0 | |
86 | ,wxWindow *parent = NULL | |
87 | ,int x = -1 | |
88 | ,int y = -1 | |
89 | ); | |
90 | ||
91 | // Generic file load dialog | |
92 | WXDLLEXPORT wxString wxLoadFileSelector( const char *what | |
93 | ,const char *extension | |
94 | ,const char *default_name = NULL | |
95 | ,wxWindow *parent = NULL | |
96 | ); | |
97 | ||
98 | // Generic file save dialog | |
99 | WXDLLEXPORT wxString wxSaveFileSelector( const char *what | |
100 | ,const char *extension | |
101 | ,const char *default_name = NULL | |
102 | ,wxWindow *parent = NULL | |
103 | ); | |
104 | ||
105 | #endif | |
106 | // _WX_FILEDLG_H_ |