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/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 WXDLLEXPORT 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 SetMessage(const wxString
& message
) { SetTitle(message
); }
64 virtual void SetPath(const wxString
& path
)
65 { m_filectrl
->SetPath(path
); }
66 virtual void SetFilterIndex(int filterIndex
)
67 { m_filectrl
->SetFilterIndex(filterIndex
); }
68 virtual void SetWildcard(const wxString
& wildCard
)
69 { m_filectrl
->SetWildcard(wildCard
); }
71 virtual wxString
GetPath() const
72 { return m_filectrl
->GetPath(); }
73 virtual void GetPaths(wxArrayString
& paths
) const
74 { m_filectrl
->GetPaths(paths
); }
75 virtual wxString
GetDirectory() const
76 { return m_filectrl
->GetDirectory(); }
77 virtual wxString
GetFilename() const
78 { return m_filectrl
->GetFilename(); }
79 virtual void GetFilenames(wxArrayString
& files
) const
80 { m_filectrl
->GetFilenames(files
); }
81 virtual wxString
GetWildcard() const
82 { return m_filectrl
->GetWildcard(); }
83 virtual int GetFilterIndex() const
84 { return m_filectrl
->GetFilterIndex(); }
85 virtual bool SupportsExtraControl() const { return true; }
87 // implementation only from now on
88 // -------------------------------
90 virtual int ShowModal();
91 virtual bool Show( bool show
= true );
93 void OnList( wxCommandEvent
&event
);
94 void OnReport( wxCommandEvent
&event
);
95 void OnUp( wxCommandEvent
&event
);
96 void OnHome( wxCommandEvent
&event
);
97 void OnOk( wxCommandEvent
&event
);
98 void OnNew( wxCommandEvent
&event
);
99 void OnFileActivated( wxFileCtrlEvent
&event
);
102 // if true, don't use this implementation at all
103 bool m_bypassGenericImpl
;
106 // update the state of m_upDirButton and m_newDirButton depending on the
107 // currently selected directory
108 void OnUpdateButtonsUI(wxUpdateUIEvent
& event
);
110 wxString m_filterExtension
;
111 wxGenericFileCtrl
*m_filectrl
;
112 wxBitmapButton
*m_upDirButton
;
113 wxBitmapButton
*m_newDirButton
;
117 wxBitmapButton
* AddBitmapButton( wxWindowID winId
, const wxArtID
& artId
,
118 const wxString
& tip
, wxSizer
*sizer
);
120 DECLARE_DYNAMIC_CLASS(wxGenericFileDialog
)
121 DECLARE_EVENT_TABLE()
123 // these variables are preserved between wxGenericFileDialog calls
124 static long ms_lastViewStyle
; // list or report?
125 static bool ms_lastShowHidden
; // did we show hidden files?
128 #ifdef wxHAS_GENERIC_FILEDIALOG
130 class WXDLLEXPORT wxFileDialog
: public wxGenericFileDialog
135 wxFileDialog(wxWindow
*parent
,
136 const wxString
& message
= wxFileSelectorPromptStr
,
137 const wxString
& defaultDir
= wxEmptyString
,
138 const wxString
& defaultFile
= wxEmptyString
,
139 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
141 const wxPoint
& pos
= wxDefaultPosition
)
142 :wxGenericFileDialog(parent
, message
, defaultDir
, defaultFile
, wildCard
, style
, pos
)
147 DECLARE_DYNAMIC_CLASS(wxFileDialog
)
150 #endif // wxHAS_GENERIC_FILEDIALOG
152 #endif // _WX_FILEDLGG_H_