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"
27 //-----------------------------------------------------------------------------
29 //-----------------------------------------------------------------------------
31 WXDLLEXPORT_DATA(extern const wxChar
*)wxFileSelectorPromptStr
;
32 WXDLLEXPORT_DATA(extern const wxChar
*)wxFileSelectorDefaultWildcardStr
;
34 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
46 class wxFileData
: public wxObject
57 wxString m_permissions
;
64 wxFileData( const wxString
&name
, const wxString
&fname
);
65 wxString
GetName() const;
66 wxString
GetFullName() const;
67 wxString
GetHint() const;
68 wxString
GetEntry( const int num
);
73 void MakeItem( wxListItem
&item
);
74 void SetNewName( const wxString
&name
, const wxString
&fname
);
77 DECLARE_DYNAMIC_CLASS(wxFileData
);
80 //-----------------------------------------------------------------------------
82 //-----------------------------------------------------------------------------
84 class wxFileCtrl
: public wxListCtrl
93 wxFileCtrl( wxWindow
*win
, const wxWindowID id
,
94 const wxString
&dirName
, const wxString
&wild
,
95 const wxPoint
&pos
= wxDefaultPosition
, const wxSize
&size
= wxDefaultSize
,
96 const long style
= wxLC_LIST
, const wxValidator
&validator
= wxDefaultValidator
,
97 const wxString
&name
= _T("filelist") );
98 void ChangeToListMode();
99 void ChangeToReportMode();
100 void ChangeToIconMode();
101 void ShowHidden( bool show
= TRUE
);
102 long Add( wxFileData
*fd
, wxListItem
&item
);
104 virtual void StatusbarText( char *WXUNUSED(text
) ) {};
106 void GoToParentDir();
108 void GoToDir( const wxString
&dir
);
109 void SetWild( const wxString
&wild
);
110 void GetDir( wxString
&dir
);
111 void OnListDeleteItem( wxListEvent
&event
);
112 void OnListEndLabelEdit( wxListEvent
&event
);
115 DECLARE_DYNAMIC_CLASS(wxFileCtrl
);
116 DECLARE_EVENT_TABLE()
119 //-------------------------------------------------------------------------
121 //-------------------------------------------------------------------------
123 class wxFileDialog
: public wxDialog
128 wxFileDialog(wxWindow
*parent
,
129 const wxString
& message
= wxFileSelectorPromptStr
,
130 const wxString
& defaultDir
= "",
131 const wxString
& defaultFile
= "",
132 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
134 const wxPoint
& pos
= wxDefaultPosition
);
137 void SetMessage(const wxString
& message
) { m_message
= message
; }
138 void SetPath(const wxString
& path
);
139 void SetDirectory(const wxString
& dir
) { m_dir
= dir
; }
140 void SetFilename(const wxString
& name
) { m_fileName
= name
; }
141 void SetWildcard(const wxString
& wildCard
) { m_wildCard
= wildCard
; }
142 void SetStyle(long style
) { m_dialogStyle
= style
; }
143 void SetFilterIndex(int filterIndex
) { m_filterIndex
= filterIndex
; }
145 wxString
GetMessage() const { return m_message
; }
146 wxString
GetPath() const { return m_path
; }
147 wxString
GetDirectory() const { return m_dir
; }
148 wxString
GetFilename() const { return m_fileName
; }
149 wxString
GetWildcard() const { return m_wildCard
; }
150 long GetStyle() const { return m_dialogStyle
; }
151 int GetFilterIndex() const { return m_filterIndex
; }
153 void OnSelected( wxListEvent
&event
);
154 void OnActivated( wxListEvent
&event
);
155 void OnList( wxCommandEvent
&event
);
156 void OnReport( wxCommandEvent
&event
);
157 void OnUp( wxCommandEvent
&event
);
158 void OnHome( wxCommandEvent
&event
);
159 void OnListOk( wxCommandEvent
&event
);
160 void OnNew( wxCommandEvent
&event
);
161 void OnChoice( wxCommandEvent
&event
);
162 void OnTextEnter( wxCommandEvent
&event
);
168 wxString m_path
; // Full path
177 DECLARE_DYNAMIC_CLASS(wxFileDialog
)
178 DECLARE_EVENT_TABLE()
183 #define wxOVERWRITE_PROMPT 4
184 #define wxHIDE_READONLY 8
185 #define wxFILE_MUST_EXIST 16
187 // File selector - backward compatibility
189 wxFileSelector(const wxChar
*message
= wxFileSelectorPromptStr
,
190 const wxChar
*default_path
= NULL
,
191 const wxChar
*default_filename
= NULL
,
192 const wxChar
*default_extension
= NULL
,
193 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
195 wxWindow
*parent
= NULL
,
196 int x
= -1, int y
= -1);
198 // An extended version of wxFileSelector
200 wxFileSelectorEx(const wxChar
*message
= wxFileSelectorPromptStr
,
201 const wxChar
*default_path
= NULL
,
202 const wxChar
*default_filename
= NULL
,
203 int *indexDefaultExtension
= NULL
,
204 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
206 wxWindow
*parent
= NULL
,
207 int x
= -1, int y
= -1);
209 // Ask for filename to load
211 wxLoadFileSelector(const wxChar
*what
,
212 const wxChar
*extension
,
213 const wxChar
*default_name
= (const wxChar
*)NULL
,
214 wxWindow
*parent
= (wxWindow
*) NULL
);
216 // Ask for filename to save
218 wxSaveFileSelector(const wxChar
*what
,
219 const wxChar
*extension
,
220 const wxChar
*default_name
= (const wxChar
*) NULL
,
221 wxWindow
*parent
= (wxWindow
*) NULL
);