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