1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/filedlgg.h
3 // Purpose: wxGenericFileDialog
4 // Author: Robert Roebling
7 // Copyright: (c) Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_FILEDLGG_H_
12 #define _WX_FILEDLGG_H_
14 #include "wx/listctrl.h"
15 #include "wx/datetime.h"
16 #include "wx/filefn.h"
17 #include "wx/artprov.h"
18 #include "wx/filedlg.h"
19 #include "wx/generic/filectrlg.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 class WXDLLIMPEXP_FWD_CORE wxBitmapButton
;
26 class WXDLLIMPEXP_FWD_CORE wxGenericFileCtrl
;
27 class WXDLLIMPEXP_FWD_CORE wxGenericFileDialog
;
28 class WXDLLIMPEXP_FWD_CORE wxFileCtrlEvent
;
30 //-------------------------------------------------------------------------
31 // wxGenericFileDialog
32 //-------------------------------------------------------------------------
34 class WXDLLIMPEXP_CORE wxGenericFileDialog
: public wxFileDialogBase
37 wxGenericFileDialog() : wxFileDialogBase() { Init(); }
39 wxGenericFileDialog(wxWindow
*parent
,
40 const wxString
& message
= wxFileSelectorPromptStr
,
41 const wxString
& defaultDir
= wxEmptyString
,
42 const wxString
& defaultFile
= wxEmptyString
,
43 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
44 long style
= wxFD_DEFAULT_STYLE
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& sz
= wxDefaultSize
,
47 const wxString
& name
= wxFileDialogNameStr
,
48 bool bypassGenericImpl
= false );
50 bool Create( wxWindow
*parent
,
51 const wxString
& message
= wxFileSelectorPromptStr
,
52 const wxString
& defaultDir
= wxEmptyString
,
53 const wxString
& defaultFile
= wxEmptyString
,
54 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
55 long style
= wxFD_DEFAULT_STYLE
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& sz
= wxDefaultSize
,
58 const wxString
& name
= wxFileDialogNameStr
,
59 bool bypassGenericImpl
= false );
61 virtual ~wxGenericFileDialog();
63 virtual void SetDirectory(const wxString
& dir
)
64 { m_filectrl
->SetDirectory(dir
); }
65 virtual void SetFilename(const wxString
& name
)
66 { m_filectrl
->SetFilename(name
); }
67 virtual void SetMessage(const wxString
& message
) { SetTitle(message
); }
68 virtual void SetPath(const wxString
& path
)
69 { m_filectrl
->SetPath(path
); }
70 virtual void SetFilterIndex(int filterIndex
)
71 { m_filectrl
->SetFilterIndex(filterIndex
); }
72 virtual void SetWildcard(const wxString
& wildCard
)
73 { m_filectrl
->SetWildcard(wildCard
); }
75 virtual wxString
GetPath() const
76 { return m_filectrl
->GetPath(); }
77 virtual void GetPaths(wxArrayString
& paths
) const
78 { m_filectrl
->GetPaths(paths
); }
79 virtual wxString
GetDirectory() const
80 { return m_filectrl
->GetDirectory(); }
81 virtual wxString
GetFilename() const
82 { return m_filectrl
->GetFilename(); }
83 virtual void GetFilenames(wxArrayString
& files
) const
84 { m_filectrl
->GetFilenames(files
); }
85 virtual wxString
GetWildcard() const
86 { return m_filectrl
->GetWildcard(); }
87 virtual int GetFilterIndex() const
88 { return m_filectrl
->GetFilterIndex(); }
89 virtual bool SupportsExtraControl() const { return true; }
91 // implementation only from now on
92 // -------------------------------
94 virtual int ShowModal();
95 virtual bool Show( bool show
= true );
97 void OnList( wxCommandEvent
&event
);
98 void OnReport( wxCommandEvent
&event
);
99 void OnUp( wxCommandEvent
&event
);
100 void OnHome( wxCommandEvent
&event
);
101 void OnOk( wxCommandEvent
&event
);
102 void OnNew( wxCommandEvent
&event
);
103 void OnFileActivated( wxFileCtrlEvent
&event
);
106 // if true, don't use this implementation at all
107 bool m_bypassGenericImpl
;
110 // update the state of m_upDirButton and m_newDirButton depending on the
111 // currently selected directory
112 void OnUpdateButtonsUI(wxUpdateUIEvent
& event
);
114 wxString m_filterExtension
;
115 wxGenericFileCtrl
*m_filectrl
;
116 wxBitmapButton
*m_upDirButton
;
117 wxBitmapButton
*m_newDirButton
;
121 wxBitmapButton
* AddBitmapButton( wxWindowID winId
, const wxArtID
& artId
,
122 const wxString
& tip
, wxSizer
*sizer
);
124 DECLARE_DYNAMIC_CLASS(wxGenericFileDialog
)
125 DECLARE_EVENT_TABLE()
127 // these variables are preserved between wxGenericFileDialog calls
128 static long ms_lastViewStyle
; // list or report?
129 static bool ms_lastShowHidden
; // did we show hidden files?
132 #ifdef wxHAS_GENERIC_FILEDIALOG
134 class WXDLLIMPEXP_CORE wxFileDialog
: public wxGenericFileDialog
139 wxFileDialog(wxWindow
*parent
,
140 const wxString
& message
= wxFileSelectorPromptStr
,
141 const wxString
& defaultDir
= wxEmptyString
,
142 const wxString
& defaultFile
= wxEmptyString
,
143 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
145 const wxPoint
& pos
= wxDefaultPosition
,
146 const wxSize
& size
= wxDefaultSize
)
147 :wxGenericFileDialog(parent
, message
,
148 defaultDir
, defaultFile
, wildCard
,
155 DECLARE_DYNAMIC_CLASS(wxFileDialog
)
158 #endif // wxHAS_GENERIC_FILEDIALOG
160 #endif // _WX_FILEDLGG_H_