1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFileDialog
4 // Author: Robert Roebling
7 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_FILEDLGG_H_
13 #define _WX_FILEDLGG_H_
16 #pragma interface "filedlgg.h"
21 #include "wx/dialog.h"
22 #include "wx/checkbox.h"
23 #include "wx/listctrl.h"
24 #include "wx/textctrl.h"
25 #include "wx/choice.h"
26 #include "wx/checkbox.h"
27 #include "wx/stattext.h"
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
33 WXDLLEXPORT_DATA(extern const wxChar
*)wxFileSelectorPromptStr
;
34 WXDLLEXPORT_DATA(extern const wxChar
*)wxFileSelectorDefaultWildcardStr
;
36 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
46 //-----------------------------------------------------------------------------
48 class wxFileData
: public wxObject
59 wxString m_permissions
;
66 wxFileData( const wxString
&name
, const wxString
&fname
);
67 wxString
GetName() const;
68 wxString
GetFullName() const;
69 wxString
GetHint() const;
70 wxString
GetEntry( int num
);
75 void MakeItem( wxListItem
&item
);
76 void SetNewName( const wxString
&name
, const wxString
&fname
);
79 DECLARE_DYNAMIC_CLASS(wxFileData
);
82 //-----------------------------------------------------------------------------
84 //-----------------------------------------------------------------------------
86 class wxFileCtrl
: public wxListCtrl
95 wxFileCtrl( wxWindow
*win
,
97 const wxString
&dirName
,
99 const wxPoint
&pos
= wxDefaultPosition
,
100 const wxSize
&size
= wxDefaultSize
,
101 long style
= wxLC_LIST
,
102 const wxValidator
&validator
= wxDefaultValidator
,
103 const wxString
&name
= wxT("filelist") );
104 void ChangeToListMode();
105 void ChangeToReportMode();
106 void ChangeToIconMode();
107 void ShowHidden( bool show
= TRUE
);
108 long Add( wxFileData
*fd
, wxListItem
&item
);
110 virtual void StatusbarText( wxChar
*WXUNUSED(text
) ) {};
112 void GoToParentDir();
114 void GoToDir( const wxString
&dir
);
115 void SetWild( const wxString
&wild
);
116 void GetDir( wxString
&dir
);
117 void OnListDeleteItem( wxListEvent
&event
);
118 void OnListDeleteAllItems( wxListEvent
&event
);
119 void OnListEndLabelEdit( wxListEvent
&event
);
122 DECLARE_DYNAMIC_CLASS(wxFileCtrl
);
123 DECLARE_EVENT_TABLE()
126 //-------------------------------------------------------------------------
128 //-------------------------------------------------------------------------
130 class wxFileDialog
: public wxDialog
135 wxFileDialog(wxWindow
*parent
,
136 const wxString
& message
= wxFileSelectorPromptStr
,
137 const wxString
& defaultDir
= "",
138 const wxString
& defaultFile
= "",
139 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
141 const wxPoint
& pos
= wxDefaultPosition
);
144 void SetMessage(const wxString
& message
) { m_message
= message
; }
145 void SetPath(const wxString
& path
);
146 void SetDirectory(const wxString
& dir
) { m_dir
= dir
; }
147 void SetFilename(const wxString
& name
) { m_fileName
= name
; }
148 void SetWildcard(const wxString
& wildCard
) { m_wildCard
= wildCard
; }
149 void SetStyle(long style
) { m_dialogStyle
= style
; }
150 void SetFilterIndex(int filterIndex
) { m_filterIndex
= filterIndex
; }
152 wxString
GetMessage() const { return m_message
; }
153 wxString
GetPath() const { return m_path
; }
154 wxString
GetDirectory() const { return m_dir
; }
155 wxString
GetFilename() const { return m_fileName
; }
156 wxString
GetWildcard() const { return m_wildCard
; }
157 long GetStyle() const { return m_dialogStyle
; }
158 int GetFilterIndex() const { return m_filterIndex
; }
160 // for multiple file selection
161 void GetPaths(wxArrayString
& paths
) const;
162 void GetFilenames(wxArrayString
& files
) const;
164 void OnSelected( wxListEvent
&event
);
165 void OnActivated( wxListEvent
&event
);
166 void OnList( wxCommandEvent
&event
);
167 void OnReport( wxCommandEvent
&event
);
168 void OnUp( wxCommandEvent
&event
);
169 void OnHome( wxCommandEvent
&event
);
170 void OnListOk( wxCommandEvent
&event
);
171 void OnNew( wxCommandEvent
&event
);
172 void OnChoice( wxCommandEvent
&event
);
173 void OnTextEnter( wxCommandEvent
&event
);
174 void OnCheck( wxCommandEvent
&event
);
176 void HandleAction( const wxString
&fn
);
182 wxString m_path
; // Full path
186 wxString m_filterExtension
;
191 wxStaticText
*m_static
;
194 DECLARE_DYNAMIC_CLASS(wxFileDialog
)
195 DECLARE_EVENT_TABLE()
197 static long s_lastViewStyle
; // list or report?
198 static bool s_lastShowHidden
;
201 // File selector - backward compatibility
203 wxFileSelector(const wxChar
*message
= wxFileSelectorPromptStr
,
204 const wxChar
*default_path
= NULL
,
205 const wxChar
*default_filename
= NULL
,
206 const wxChar
*default_extension
= NULL
,
207 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
209 wxWindow
*parent
= NULL
,
210 int x
= -1, int y
= -1);
212 // An extended version of wxFileSelector
214 wxFileSelectorEx(const wxChar
*message
= wxFileSelectorPromptStr
,
215 const wxChar
*default_path
= NULL
,
216 const wxChar
*default_filename
= NULL
,
217 int *indexDefaultExtension
= NULL
,
218 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
220 wxWindow
*parent
= NULL
,
221 int x
= -1, int y
= -1);
223 // Ask for filename to load
225 wxLoadFileSelector(const wxChar
*what
,
226 const wxChar
*extension
,
227 const wxChar
*default_name
= (const wxChar
*)NULL
,
228 wxWindow
*parent
= (wxWindow
*) NULL
);
230 // Ask for filename to save
232 wxSaveFileSelector(const wxChar
*what
,
233 const wxChar
*extension
,
234 const wxChar
*default_name
= (const wxChar
*) NULL
,
235 wxWindow
*parent
= (wxWindow
*) NULL
);