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
);
136 void SetMessage(const wxString
& message
) { m_message
= message
; }
137 void SetPath(const wxString
& path
);
138 void SetDirectory(const wxString
& dir
) { m_dir
= dir
; }
139 void SetFilename(const wxString
& name
) { m_fileName
= name
; }
140 void SetWildcard(const wxString
& wildCard
) { m_wildCard
= wildCard
; }
141 void SetStyle(long style
) { m_dialogStyle
= style
; }
142 void SetFilterIndex(int filterIndex
) { m_filterIndex
= filterIndex
; }
144 wxString
GetMessage() const { return m_message
; }
145 wxString
GetPath() const { return m_path
; }
146 wxString
GetDirectory() const { return m_dir
; }
147 wxString
GetFilename() const { return m_fileName
; }
148 wxString
GetWildcard() const { return m_wildCard
; }
149 long GetStyle() const { return m_dialogStyle
; }
150 int GetFilterIndex() const { return m_filterIndex
; }
152 void OnSelected( wxListEvent
&event
);
153 void OnActivated( wxListEvent
&event
);
154 void OnList( wxCommandEvent
&event
);
155 void OnReport( wxCommandEvent
&event
);
156 void OnUp( wxCommandEvent
&event
);
157 void OnHome( wxCommandEvent
&event
);
158 void OnListOk( wxCommandEvent
&event
);
159 void OnNew( wxCommandEvent
&event
);
165 wxString m_path
; // Full path
174 DECLARE_DYNAMIC_CLASS(wxFileDialog
)
175 DECLARE_EVENT_TABLE()
180 #define wxOVERWRITE_PROMPT 4
181 #define wxHIDE_READONLY 8
182 #define wxFILE_MUST_EXIST 16
184 // File selector - backward compatibility
186 wxFileSelector(const wxChar
*message
= wxFileSelectorPromptStr
,
187 const wxChar
*default_path
= NULL
,
188 const wxChar
*default_filename
= NULL
,
189 const wxChar
*default_extension
= NULL
,
190 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
192 wxWindow
*parent
= NULL
,
193 int x
= -1, int y
= -1);
195 // An extended version of wxFileSelector
197 wxFileSelectorEx(const wxChar
*message
= wxFileSelectorPromptStr
,
198 const wxChar
*default_path
= NULL
,
199 const wxChar
*default_filename
= NULL
,
200 int *indexDefaultExtension
= NULL
,
201 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
203 wxWindow
*parent
= NULL
,
204 int x
= -1, int y
= -1);
206 // Ask for filename to load
208 wxLoadFileSelector(const wxChar
*what
,
209 const wxChar
*extension
,
210 const wxChar
*default_name
= (const wxChar
*)NULL
,
211 wxWindow
*parent
= (wxWindow
*) NULL
);
213 // Ask for filename to save
215 wxSaveFileSelector(const wxChar
*what
,
216 const wxChar
*extension
,
217 const wxChar
*default_name
= (const wxChar
*) NULL
,
218 wxWindow
*parent
= (wxWindow
*) NULL
);