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( const 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
, const wxWindowID id
,
96 const wxString
&dirName
, const wxString
&wild
,
97 const wxPoint
&pos
= wxDefaultPosition
, const wxSize
&size
= wxDefaultSize
,
98 const long style
= wxLC_LIST
, const wxValidator
&validator
= wxDefaultValidator
,
99 const wxString
&name
= _T("filelist") );
100 void ChangeToListMode();
101 void ChangeToReportMode();
102 void ChangeToIconMode();
103 void ShowHidden( bool show
= TRUE
);
104 long Add( wxFileData
*fd
, wxListItem
&item
);
106 virtual void StatusbarText( char *WXUNUSED(text
) ) {};
108 void GoToParentDir();
110 void GoToDir( const wxString
&dir
);
111 void SetWild( const wxString
&wild
);
112 void GetDir( wxString
&dir
);
113 void OnListDeleteItem( wxListEvent
&event
);
114 void OnListEndLabelEdit( wxListEvent
&event
);
117 DECLARE_DYNAMIC_CLASS(wxFileCtrl
);
118 DECLARE_EVENT_TABLE()
121 //-------------------------------------------------------------------------
123 //-------------------------------------------------------------------------
125 class wxFileDialog
: public wxDialog
130 wxFileDialog(wxWindow
*parent
,
131 const wxString
& message
= wxFileSelectorPromptStr
,
132 const wxString
& defaultDir
= "",
133 const wxString
& defaultFile
= "",
134 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
136 const wxPoint
& pos
= wxDefaultPosition
);
139 void SetMessage(const wxString
& message
) { m_message
= message
; }
140 void SetPath(const wxString
& path
);
141 void SetDirectory(const wxString
& dir
) { m_dir
= dir
; }
142 void SetFilename(const wxString
& name
) { m_fileName
= name
; }
143 void SetWildcard(const wxString
& wildCard
) { m_wildCard
= wildCard
; }
144 void SetStyle(long style
) { m_dialogStyle
= style
; }
145 void SetFilterIndex(int filterIndex
) { m_filterIndex
= filterIndex
; }
147 wxString
GetMessage() const { return m_message
; }
148 wxString
GetPath() const { return m_path
; }
149 wxString
GetDirectory() const { return m_dir
; }
150 wxString
GetFilename() const { return m_fileName
; }
151 wxString
GetWildcard() const { return m_wildCard
; }
152 long GetStyle() const { return m_dialogStyle
; }
153 int GetFilterIndex() const { return m_filterIndex
; }
155 void OnSelected( wxListEvent
&event
);
156 void OnActivated( wxListEvent
&event
);
157 void OnList( wxCommandEvent
&event
);
158 void OnReport( wxCommandEvent
&event
);
159 void OnUp( wxCommandEvent
&event
);
160 void OnHome( wxCommandEvent
&event
);
161 void OnListOk( wxCommandEvent
&event
);
162 void OnNew( wxCommandEvent
&event
);
163 void OnChoice( wxCommandEvent
&event
);
164 void OnTextEnter( wxCommandEvent
&event
);
170 wxString m_path
; // Full path
178 wxStaticText
*m_static
;
181 DECLARE_DYNAMIC_CLASS(wxFileDialog
)
182 DECLARE_EVENT_TABLE()
187 #define wxOVERWRITE_PROMPT 4
188 #define wxHIDE_READONLY 8
189 #define wxFILE_MUST_EXIST 16
191 // File selector - backward compatibility
193 wxFileSelector(const wxChar
*message
= wxFileSelectorPromptStr
,
194 const wxChar
*default_path
= NULL
,
195 const wxChar
*default_filename
= NULL
,
196 const wxChar
*default_extension
= NULL
,
197 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
199 wxWindow
*parent
= NULL
,
200 int x
= -1, int y
= -1);
202 // An extended version of wxFileSelector
204 wxFileSelectorEx(const wxChar
*message
= wxFileSelectorPromptStr
,
205 const wxChar
*default_path
= NULL
,
206 const wxChar
*default_filename
= NULL
,
207 int *indexDefaultExtension
= NULL
,
208 const wxChar
*wildcard
= wxFileSelectorDefaultWildcardStr
,
210 wxWindow
*parent
= NULL
,
211 int x
= -1, int y
= -1);
213 // Ask for filename to load
215 wxLoadFileSelector(const wxChar
*what
,
216 const wxChar
*extension
,
217 const wxChar
*default_name
= (const wxChar
*)NULL
,
218 wxWindow
*parent
= (wxWindow
*) NULL
);
220 // Ask for filename to save
222 wxSaveFileSelector(const wxChar
*what
,
223 const wxChar
*extension
,
224 const wxChar
*default_name
= (const wxChar
*) NULL
,
225 wxWindow
*parent
= (wxWindow
*) NULL
);