]>
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 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "filedlgg.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | ||
21 | #include "wx/dialog.h" | |
22 | #include "wx/checkbox.h" | |
23 | #include "wx/listctrl.h" | |
8b17ba72 RR |
24 | #include "wx/textctrl.h" |
25 | #include "wx/choice.h" | |
9c884972 RR |
26 | #include "wx/checkbox.h" |
27 | #include "wx/stattext.h" | |
8b17ba72 RR |
28 | |
29 | //----------------------------------------------------------------------------- | |
30 | // data | |
31 | //----------------------------------------------------------------------------- | |
32 | ||
33 | WXDLLEXPORT_DATA(extern const wxChar *)wxFileSelectorPromptStr; | |
34 | WXDLLEXPORT_DATA(extern const wxChar *)wxFileSelectorDefaultWildcardStr; | |
35 | ||
36 | //----------------------------------------------------------------------------- | |
37 | // classes | |
38 | //----------------------------------------------------------------------------- | |
39 | ||
40 | class wxFileData; | |
41 | class wxFileCtrl; | |
42 | class wxFileDialog; | |
43 | ||
44 | //----------------------------------------------------------------------------- | |
45 | // wxFileData | |
46 | //----------------------------------------------------------------------------- | |
47 | ||
48 | class wxFileData : public wxObject | |
49 | { | |
50 | private: | |
51 | wxString m_name; | |
52 | wxString m_fileName; | |
53 | long m_size; | |
54 | int m_hour; | |
55 | int m_minute; | |
56 | int m_year; | |
57 | int m_month; | |
58 | int m_day; | |
59 | wxString m_permissions; | |
60 | bool m_isDir; | |
61 | bool m_isLink; | |
62 | bool m_isExe; | |
63 | ||
64 | public: | |
c8c0e54c | 65 | wxFileData() { } |
8b17ba72 RR |
66 | wxFileData( const wxString &name, const wxString &fname ); |
67 | wxString GetName() const; | |
68 | wxString GetFullName() const; | |
69 | wxString GetHint() const; | |
c8c0e54c | 70 | wxString GetEntry( int num ); |
8b17ba72 RR |
71 | bool IsDir(); |
72 | bool IsLink(); | |
73 | bool IsExe(); | |
74 | long GetSize(); | |
8b17ba72 | 75 | void MakeItem( wxListItem &item ); |
0b855868 | 76 | void SetNewName( const wxString &name, const wxString &fname ); |
c8c0e54c | 77 | |
8b17ba72 RR |
78 | private: |
79 | DECLARE_DYNAMIC_CLASS(wxFileData); | |
80 | }; | |
81 | ||
82 | //----------------------------------------------------------------------------- | |
83 | // wxFileCtrl | |
84 | //----------------------------------------------------------------------------- | |
85 | ||
86 | class wxFileCtrl : public wxListCtrl | |
87 | { | |
88 | private: | |
89 | wxString m_dirName; | |
90 | bool m_showHidden; | |
0b855868 | 91 | wxString m_wild; |
8b17ba72 RR |
92 | |
93 | public: | |
94 | wxFileCtrl(); | |
c8c0e54c VZ |
95 | wxFileCtrl( wxWindow *win, |
96 | wxWindowID id, | |
97 | const wxString &dirName, | |
98 | const wxString &wild, | |
99 | const wxPoint &pos = wxDefaultPosition, | |
100 | const wxSize &size = wxDefaultSize, | |
101 | long style = wxLC_LIST, | |
102 | const wxValidator &validator = wxDefaultValidator, | |
103 | const wxString &name = _T("filelist") ); | |
8b17ba72 RR |
104 | void ChangeToListMode(); |
105 | void ChangeToReportMode(); | |
106 | void ChangeToIconMode(); | |
107 | void ShowHidden( bool show = TRUE ); | |
0b855868 | 108 | long Add( wxFileData *fd, wxListItem &item ); |
8b17ba72 RR |
109 | void Update(); |
110 | virtual void StatusbarText( char *WXUNUSED(text) ) {}; | |
8b17ba72 RR |
111 | void MakeDir(); |
112 | void GoToParentDir(); | |
113 | void GoToHomeDir(); | |
114 | void GoToDir( const wxString &dir ); | |
0b855868 | 115 | void SetWild( const wxString &wild ); |
8b17ba72 RR |
116 | void GetDir( wxString &dir ); |
117 | void OnListDeleteItem( wxListEvent &event ); | |
8b17ba72 RR |
118 | void OnListEndLabelEdit( wxListEvent &event ); |
119 | ||
c8c0e54c | 120 | private: |
8b17ba72 RR |
121 | DECLARE_DYNAMIC_CLASS(wxFileCtrl); |
122 | DECLARE_EVENT_TABLE() | |
123 | }; | |
124 | ||
125 | //------------------------------------------------------------------------- | |
126 | // File selector | |
127 | //------------------------------------------------------------------------- | |
128 | ||
129 | class wxFileDialog: public wxDialog | |
130 | { | |
131 | public: | |
132 | wxFileDialog() { } | |
133 | ||
134 | wxFileDialog(wxWindow *parent, | |
135 | const wxString& message = wxFileSelectorPromptStr, | |
136 | const wxString& defaultDir = "", | |
137 | const wxString& defaultFile = "", | |
138 | const wxString& wildCard = wxFileSelectorDefaultWildcardStr, | |
139 | long style = 0, | |
140 | const wxPoint& pos = wxDefaultPosition); | |
cae5359f | 141 | ~wxFileDialog(); |
8b17ba72 RR |
142 | |
143 | void SetMessage(const wxString& message) { m_message = message; } | |
144 | void SetPath(const wxString& path); | |
145 | void SetDirectory(const wxString& dir) { m_dir = dir; } | |
146 | void SetFilename(const wxString& name) { m_fileName = name; } | |
147 | void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; } | |
148 | void SetStyle(long style) { m_dialogStyle = style; } | |
149 | void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; } | |
150 | ||
151 | wxString GetMessage() const { return m_message; } | |
152 | wxString GetPath() const { return m_path; } | |
153 | wxString GetDirectory() const { return m_dir; } | |
154 | wxString GetFilename() const { return m_fileName; } | |
155 | wxString GetWildcard() const { return m_wildCard; } | |
156 | long GetStyle() const { return m_dialogStyle; } | |
157 | int GetFilterIndex() const { return m_filterIndex ; } | |
c8c0e54c | 158 | |
8b17ba72 RR |
159 | void OnSelected( wxListEvent &event ); |
160 | void OnActivated( wxListEvent &event ); | |
161 | void OnList( wxCommandEvent &event ); | |
162 | void OnReport( wxCommandEvent &event ); | |
8b17ba72 RR |
163 | void OnUp( wxCommandEvent &event ); |
164 | void OnHome( wxCommandEvent &event ); | |
165 | void OnListOk( wxCommandEvent &event ); | |
0b855868 | 166 | void OnNew( wxCommandEvent &event ); |
cae5359f RR |
167 | void OnChoice( wxCommandEvent &event ); |
168 | void OnTextEnter( wxCommandEvent &event ); | |
c8c0e54c VZ |
169 | |
170 | protected: | |
9c884972 RR |
171 | wxString m_message; |
172 | long m_dialogStyle; | |
173 | wxString m_dir; | |
174 | wxString m_path; // Full path | |
175 | wxString m_fileName; | |
176 | wxString m_wildCard; | |
177 | int m_filterIndex; | |
178 | wxChoice *m_choice; | |
179 | wxTextCtrl *m_text; | |
180 | wxFileCtrl *m_list; | |
181 | wxCheckBox *m_check; | |
182 | wxStaticText *m_static; | |
c8c0e54c | 183 | |
8b17ba72 RR |
184 | private: |
185 | DECLARE_DYNAMIC_CLASS(wxFileDialog) | |
186 | DECLARE_EVENT_TABLE() | |
187 | }; | |
188 | ||
c8c0e54c VZ |
189 | enum |
190 | { | |
191 | wxOPEN = 1, | |
192 | wxSAVE = 2, | |
193 | wxOVERWRITE_PROMPT = 4, | |
194 | wxHIDE_READONLY = 8, | |
195 | wxFILE_MUST_EXIST = 16 | |
ec6e0a19 | 196 | }; |
8b17ba72 RR |
197 | |
198 | // File selector - backward compatibility | |
199 | WXDLLEXPORT wxString | |
200 | wxFileSelector(const wxChar *message = wxFileSelectorPromptStr, | |
201 | const wxChar *default_path = NULL, | |
202 | const wxChar *default_filename = NULL, | |
203 | const wxChar *default_extension = NULL, | |
204 | const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, | |
205 | int flags = 0, | |
206 | wxWindow *parent = NULL, | |
207 | int x = -1, int y = -1); | |
208 | ||
209 | // An extended version of wxFileSelector | |
210 | WXDLLEXPORT wxString | |
211 | wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr, | |
212 | const wxChar *default_path = NULL, | |
213 | const wxChar *default_filename = NULL, | |
214 | int *indexDefaultExtension = NULL, | |
215 | const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, | |
216 | int flags = 0, | |
217 | wxWindow *parent = NULL, | |
218 | int x = -1, int y = -1); | |
219 | ||
220 | // Ask for filename to load | |
221 | WXDLLEXPORT wxString | |
222 | wxLoadFileSelector(const wxChar *what, | |
223 | const wxChar *extension, | |
224 | const wxChar *default_name = (const wxChar *)NULL, | |
225 | wxWindow *parent = (wxWindow *) NULL); | |
226 | ||
227 | // Ask for filename to save | |
228 | WXDLLEXPORT wxString | |
229 | wxSaveFileSelector(const wxChar *what, | |
230 | const wxChar *extension, | |
231 | const wxChar *default_name = (const wxChar *) NULL, | |
232 | wxWindow *parent = (wxWindow *) NULL); | |
233 | ||
234 | ||
235 | ||
236 | #endif | |
237 | // _WX_DIRDLGG_H_ | |
238 |