]>
Commit | Line | Data |
---|---|---|
8b17ba72 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: filedlgg.h | |
3 | // Purpose: wxFileDialog | |
4 | // Author: Robert Roebling | |
5 | // Modified by: | |
6 | // Created: 8/17/99 | |
7 | // Copyright: (c) Robert Roebling | |
8 | // RCS-ID: $Id$ | |
c8c0e54c | 9 | // Licence: wxWindows licence |
8b17ba72 RR |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_FILEDLGG_H_ | |
13 | #define _WX_FILEDLGG_H_ | |
14 | ||
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
8b17ba72 RR |
16 | #pragma interface "filedlgg.h" |
17 | #endif | |
18 | ||
8b17ba72 | 19 | #include "wx/dialog.h" |
8b17ba72 RR |
20 | |
21 | //----------------------------------------------------------------------------- | |
22 | // data | |
23 | //----------------------------------------------------------------------------- | |
24 | ||
25 | WXDLLEXPORT_DATA(extern const wxChar *)wxFileSelectorPromptStr; | |
26 | WXDLLEXPORT_DATA(extern const wxChar *)wxFileSelectorDefaultWildcardStr; | |
27 | ||
28 | //----------------------------------------------------------------------------- | |
29 | // classes | |
30 | //----------------------------------------------------------------------------- | |
31 | ||
04dbb646 VZ |
32 | class wxCheckBox; |
33 | class wxChoice; | |
8b17ba72 RR |
34 | class wxFileData; |
35 | class wxFileCtrl; | |
36 | class wxFileDialog; | |
04dbb646 VZ |
37 | class wxListEvent; |
38 | class wxStaticText; | |
39 | class wxTextCtrl; | |
8b17ba72 RR |
40 | |
41 | //------------------------------------------------------------------------- | |
42 | // File selector | |
43 | //------------------------------------------------------------------------- | |
44 | ||
45 | class wxFileDialog: public wxDialog | |
46 | { | |
47 | public: | |
48 | wxFileDialog() { } | |
49 | ||
50 | wxFileDialog(wxWindow *parent, | |
51 | const wxString& message = wxFileSelectorPromptStr, | |
9cedab37 VZ |
52 | const wxString& defaultDir = _T(""), |
53 | const wxString& defaultFile = _T(""), | |
8b17ba72 RR |
54 | const wxString& wildCard = wxFileSelectorDefaultWildcardStr, |
55 | long style = 0, | |
56 | const wxPoint& pos = wxDefaultPosition); | |
04dbb646 | 57 | virtual ~wxFileDialog(); |
8b17ba72 | 58 | |
9cedab37 | 59 | void SetMessage(const wxString& message) { SetTitle(message); } |
8b17ba72 RR |
60 | void SetPath(const wxString& path); |
61 | void SetDirectory(const wxString& dir) { m_dir = dir; } | |
62 | void SetFilename(const wxString& name) { m_fileName = name; } | |
63 | void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; } | |
64 | void SetStyle(long style) { m_dialogStyle = style; } | |
f6b66bc2 | 65 | void SetFilterIndex(int filterIndex); |
8b17ba72 RR |
66 | |
67 | wxString GetMessage() const { return m_message; } | |
68 | wxString GetPath() const { return m_path; } | |
69 | wxString GetDirectory() const { return m_dir; } | |
70 | wxString GetFilename() const { return m_fileName; } | |
71 | wxString GetWildcard() const { return m_wildCard; } | |
72 | long GetStyle() const { return m_dialogStyle; } | |
7941ba11 | 73 | int GetFilterIndex() const { return m_filterIndex; } |
c61f4f6d | 74 | |
7941ba11 RR |
75 | // for multiple file selection |
76 | void GetPaths(wxArrayString& paths) const; | |
77 | void GetFilenames(wxArrayString& files) const; | |
c8c0e54c | 78 | |
9cedab37 VZ |
79 | // implementation only from now on |
80 | // ------------------------------- | |
81 | ||
82 | virtual int ShowModal(); | |
83 | ||
8b17ba72 RR |
84 | void OnSelected( wxListEvent &event ); |
85 | void OnActivated( wxListEvent &event ); | |
86 | void OnList( wxCommandEvent &event ); | |
87 | void OnReport( wxCommandEvent &event ); | |
8b17ba72 RR |
88 | void OnUp( wxCommandEvent &event ); |
89 | void OnHome( wxCommandEvent &event ); | |
90 | void OnListOk( wxCommandEvent &event ); | |
0b855868 | 91 | void OnNew( wxCommandEvent &event ); |
2b5f62a0 | 92 | void OnChoiceFilter( wxCommandEvent &event ); |
cae5359f | 93 | void OnTextEnter( wxCommandEvent &event ); |
df413171 | 94 | void OnTextChange( wxCommandEvent &event ); |
bf9e3e73 | 95 | void OnCheck( wxCommandEvent &event ); |
c61f4f6d | 96 | |
e1811a01 | 97 | void HandleAction( const wxString &fn ); |
c8c0e54c VZ |
98 | |
99 | protected: | |
2b5f62a0 VZ |
100 | // use the filter with the given index |
101 | void DoSetFilterIndex(int filterindex); | |
102 | ||
9c884972 RR |
103 | wxString m_message; |
104 | long m_dialogStyle; | |
105 | wxString m_dir; | |
106 | wxString m_path; // Full path | |
107 | wxString m_fileName; | |
108 | wxString m_wildCard; | |
109 | int m_filterIndex; | |
cefc49fd | 110 | wxString m_filterExtension; |
9c884972 RR |
111 | wxChoice *m_choice; |
112 | wxTextCtrl *m_text; | |
113 | wxFileCtrl *m_list; | |
114 | wxCheckBox *m_check; | |
115 | wxStaticText *m_static; | |
c8c0e54c | 116 | |
8b17ba72 RR |
117 | private: |
118 | DECLARE_DYNAMIC_CLASS(wxFileDialog) | |
119 | DECLARE_EVENT_TABLE() | |
cefc49fd | 120 | |
9cedab37 VZ |
121 | // these variables are preserved between wxFileDialog calls |
122 | static long ms_lastViewStyle; // list or report? | |
123 | static bool ms_lastShowHidden; // did we show hidden files? | |
8b17ba72 RR |
124 | }; |
125 | ||
8b17ba72 RR |
126 | // File selector - backward compatibility |
127 | WXDLLEXPORT wxString | |
128 | wxFileSelector(const wxChar *message = wxFileSelectorPromptStr, | |
129 | const wxChar *default_path = NULL, | |
130 | const wxChar *default_filename = NULL, | |
131 | const wxChar *default_extension = NULL, | |
132 | const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, | |
133 | int flags = 0, | |
134 | wxWindow *parent = NULL, | |
135 | int x = -1, int y = -1); | |
136 | ||
137 | // An extended version of wxFileSelector | |
138 | WXDLLEXPORT wxString | |
139 | wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr, | |
140 | const wxChar *default_path = NULL, | |
141 | const wxChar *default_filename = NULL, | |
142 | int *indexDefaultExtension = NULL, | |
143 | const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, | |
144 | int flags = 0, | |
145 | wxWindow *parent = NULL, | |
146 | int x = -1, int y = -1); | |
147 | ||
148 | // Ask for filename to load | |
149 | WXDLLEXPORT wxString | |
150 | wxLoadFileSelector(const wxChar *what, | |
151 | const wxChar *extension, | |
152 | const wxChar *default_name = (const wxChar *)NULL, | |
153 | wxWindow *parent = (wxWindow *) NULL); | |
154 | ||
155 | // Ask for filename to save | |
156 | WXDLLEXPORT wxString | |
157 | wxSaveFileSelector(const wxChar *what, | |
158 | const wxChar *extension, | |
159 | const wxChar *default_name = (const wxChar *) NULL, | |
160 | wxWindow *parent = (wxWindow *) NULL); | |
161 | ||
162 | ||
163 | ||
164 | #endif | |
165 | // _WX_DIRDLGG_H_ | |
166 | ||
9cedab37 | 167 |