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/button.h"
25 #include "wx/validate.h"
26 #include "wx/textctrl.h"
27 #include "wx/choice.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( const int num
);
75 bool NewNameIsLegal( const wxString
&s
);
76 bool Rename( const wxString
&s
);
77 void MakeItem( wxListItem
&item
);
80 DECLARE_DYNAMIC_CLASS(wxFileData
);
83 //-----------------------------------------------------------------------------
85 //-----------------------------------------------------------------------------
87 class wxFileCtrl
: public wxListCtrl
95 wxFileCtrl( wxWindow
*win
, const wxWindowID id
, const wxString
&dirName
,
96 const wxPoint
&pos
= wxDefaultPosition
, const wxSize
&size
= wxDefaultSize
,
97 const long style
= wxLC_LIST
, const wxValidator
&validator
= wxDefaultValidator
,
98 const wxString
&name
= _T("filelist") );
99 void ChangeToListMode();
100 void ChangeToReportMode();
101 void ChangeToIconMode();
102 void ShowHidden( bool show
= TRUE
);
104 virtual void StatusbarText( char *WXUNUSED(text
) ) {};
105 int FillList( wxStringList
&list
);
107 void CopyFiles( char *dest
);
108 void MoveFiles( char *dest
);
111 void GoToParentDir();
113 void GoToDir( const wxString
&dir
);
114 void GetDir( wxString
&dir
);
115 void OnListDeleteItem( wxListEvent
&event
);
116 void OnListKeyDown( wxListEvent
&event
);
117 void OnListEndLabelEdit( wxListEvent
&event
);
120 DECLARE_DYNAMIC_CLASS(wxFileCtrl
);
121 DECLARE_EVENT_TABLE()
124 //-------------------------------------------------------------------------
126 //-------------------------------------------------------------------------
128 class wxFileDialog
: public wxDialog
133 wxFileDialog(wxWindow
*parent
,
134 const wxString
& message
= wxFileSelectorPromptStr
,
135 const wxString
& defaultDir
= "",
136 const wxString
& defaultFile
= "",
137 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
139 const wxPoint
& pos
= wxDefaultPosition
);
141 void SetMessage(const wxString
& message
) { m_message
= message
; }
142 void SetPath(const wxString
& path
);
143 void SetDirectory(const wxString
& dir
) { m_dir
= dir
; }
144 void SetFilename(const wxString
& name
) { m_fileName
= name
; }
145 void SetWildcard(const wxString
& wildCard
) { m_wildCard
= wildCard
; }
146 void SetStyle(long style
) { m_dialogStyle
= style
; }
147 void SetFilterIndex(int filterIndex
) { m_filterIndex
= filterIndex
; }
149 wxString
GetMessage() const { return m_message
; }
150 wxString
GetPath() const { return m_path
; }
151 wxString
GetDirectory() const { return m_dir
; }
152 wxString
GetFilename() const { return m_fileName
; }
153 wxString
GetWildcard() const { return m_wildCard
; }
154 long GetStyle() const { return m_dialogStyle
; }
155 int GetFilterIndex() const { return m_filterIndex
; }
157 void OnSelected( wxListEvent
&event
);
158 void OnActivated( wxListEvent
&event
);
159 void OnList( wxCommandEvent
&event
);
160 void OnReport( wxCommandEvent
&event
);
161 void OnIcon( wxCommandEvent
&event
);
162 void OnUp( wxCommandEvent
&event
);
163 void OnHome( wxCommandEvent
&event
);
164 void OnListOk( wxCommandEvent
&event
);
170 wxString m_path
; // Full path
179 DECLARE_DYNAMIC_CLASS(wxFileDialog
)
180 DECLARE_EVENT_TABLE()
185 #define wxOVERWRITE_PROMPT 4
186 #define wxHIDE_READONLY 8
187 #define wxFILE_MUST_EXIST 16
189 // File selector - backward compatibility
191 wxFileSelector(const wxChar
*message
= wxFileSelectorPromptStr
,
192 const wxChar
*default_path
= NULL
,
193 const wxChar
*default_filename
= NULL
,
194 const wxChar
*default_extension
= NULL
,
195 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
197 wxWindow
*parent
= NULL
,
198 int x
= -1, int y
= -1);
200 // An extended version of wxFileSelector
202 wxFileSelectorEx(const wxChar
*message
= wxFileSelectorPromptStr
,
203 const wxChar
*default_path
= NULL
,
204 const wxChar
*default_filename
= NULL
,
205 int *indexDefaultExtension
= NULL
,
206 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
208 wxWindow
*parent
= NULL
,
209 int x
= -1, int y
= -1);
211 // Ask for filename to load
213 wxLoadFileSelector(const wxChar
*what
,
214 const wxChar
*extension
,
215 const wxChar
*default_name
= (const wxChar
*)NULL
,
216 wxWindow
*parent
= (wxWindow
*) NULL
);
218 // Ask for filename to save
220 wxSaveFileSelector(const wxChar
*what
,
221 const wxChar
*extension
,
222 const wxChar
*default_name
= (const wxChar
*) NULL
,
223 wxWindow
*parent
= (wxWindow
*) NULL
);