]>
Commit | Line | Data |
---|---|---|
8b17ba72 | 1 | ///////////////////////////////////////////////////////////////////////////// |
d022d364 | 2 | // Name: wx/generic/filedlgg.h |
23254b13 | 3 | // Purpose: wxGenericFileDialog |
8b17ba72 RR |
4 | // Author: Robert Roebling |
5 | // Modified by: | |
6 | // Created: 8/17/99 | |
7 | // Copyright: (c) Robert Roebling | |
8 | // RCS-ID: $Id$ | |
65571936 | 9 | // Licence: wxWindows licence |
8b17ba72 RR |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_FILEDLGG_H_ | |
13 | #define _WX_FILEDLGG_H_ | |
14 | ||
23254b13 | 15 | #include "wx/listctrl.h" |
06cc1fb9 | 16 | #include "wx/datetime.h" |
8226a054 | 17 | #include "wx/filefn.h" |
dbf2bd15 | 18 | #include "wx/artprov.h" |
d022d364 | 19 | #include "wx/filedlg.h" |
0cf3e587 | 20 | #include "wx/generic/filectrlg.h" |
8b17ba72 RR |
21 | |
22 | //----------------------------------------------------------------------------- | |
23 | // classes | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
b5dbe15d | 26 | class WXDLLIMPEXP_FWD_CORE wxBitmapButton; |
0cf3e587 | 27 | class WXDLLIMPEXP_FWD_CORE wxGenericFileCtrl; |
b5dbe15d | 28 | class WXDLLIMPEXP_FWD_CORE wxGenericFileDialog; |
0cf3e587 | 29 | class WXDLLIMPEXP_FWD_CORE wxFileCtrlEvent; |
8b17ba72 RR |
30 | |
31 | //------------------------------------------------------------------------- | |
b600ed13 | 32 | // wxGenericFileDialog |
8b17ba72 RR |
33 | //------------------------------------------------------------------------- |
34 | ||
f74172ab | 35 | class WXDLLEXPORT wxGenericFileDialog: public wxFileDialogBase |
8b17ba72 RR |
36 | { |
37 | public: | |
fe6cf128 | 38 | wxGenericFileDialog() : wxFileDialogBase() { Init(); } |
8b17ba72 | 39 | |
23254b13 | 40 | wxGenericFileDialog(wxWindow *parent, |
fe6cf128 | 41 | const wxString& message = wxFileSelectorPromptStr, |
f74172ab VZ |
42 | const wxString& defaultDir = wxEmptyString, |
43 | const wxString& defaultFile = wxEmptyString, | |
fe6cf128 | 44 | const wxString& wildCard = wxFileSelectorDefaultWildcardStr, |
ff3e84ff | 45 | long style = wxFD_DEFAULT_STYLE, |
fe6cf128 | 46 | const wxPoint& pos = wxDefaultPosition, |
ff3e84ff VZ |
47 | const wxSize& sz = wxDefaultSize, |
48 | const wxString& name = wxFileDialogNameStr, | |
fe6cf128 VZ |
49 | bool bypassGenericImpl = false ); |
50 | ||
4e1901b7 RR |
51 | bool Create( wxWindow *parent, |
52 | const wxString& message = wxFileSelectorPromptStr, | |
fe6cf128 VZ |
53 | const wxString& defaultDir = wxEmptyString, |
54 | const wxString& defaultFile = wxEmptyString, | |
4e1901b7 | 55 | const wxString& wildCard = wxFileSelectorDefaultWildcardStr, |
ff3e84ff | 56 | long style = wxFD_DEFAULT_STYLE, |
fe6cf128 | 57 | const wxPoint& pos = wxDefaultPosition, |
ff3e84ff VZ |
58 | const wxSize& sz = wxDefaultSize, |
59 | const wxString& name = wxFileDialogNameStr, | |
fe6cf128 VZ |
60 | bool bypassGenericImpl = false ); |
61 | ||
23254b13 | 62 | virtual ~wxGenericFileDialog(); |
8b17ba72 | 63 | |
f74172ab | 64 | virtual void SetMessage(const wxString& message) { SetTitle(message); } |
398eebb1 VZ |
65 | virtual void SetPath(const wxString& path) |
66 | { m_filectrl->SetPath(path); } | |
67 | virtual void SetFilterIndex(int filterIndex) | |
68 | { m_filectrl->SetFilterIndex(filterIndex); } | |
69 | virtual void SetWildcard(const wxString& wildCard) | |
70 | { m_filectrl->SetWildcard(wildCard); } | |
71 | ||
72 | virtual wxString GetPath() const | |
73 | { return m_filectrl->GetPath(); } | |
74 | virtual void GetPaths(wxArrayString& paths) const | |
41a031cf | 75 | { m_filectrl->GetPaths(paths); } |
398eebb1 VZ |
76 | virtual wxString GetDirectory() const |
77 | { return m_filectrl->GetDirectory(); } | |
78 | virtual wxString GetFilename() const | |
79 | { return m_filectrl->GetFilename(); } | |
80 | virtual void GetFilenames(wxArrayString& files) const | |
41a031cf | 81 | { m_filectrl->GetFilenames(files); } |
398eebb1 VZ |
82 | virtual wxString GetWildcard() const |
83 | { return m_filectrl->GetWildcard(); } | |
84 | virtual int GetFilterIndex() const | |
85 | { return m_filectrl->GetFilterIndex(); } | |
8ce68f7f | 86 | virtual bool SupportsExtraControl() const { return true; } |
c8c0e54c | 87 | |
9cedab37 VZ |
88 | // implementation only from now on |
89 | // ------------------------------- | |
90 | ||
91 | virtual int ShowModal(); | |
16dce3b3 | 92 | virtual bool Show( bool show = true ); |
9cedab37 | 93 | |
8b17ba72 RR |
94 | void OnList( wxCommandEvent &event ); |
95 | void OnReport( wxCommandEvent &event ); | |
8b17ba72 RR |
96 | void OnUp( wxCommandEvent &event ); |
97 | void OnHome( wxCommandEvent &event ); | |
0cf3e587 | 98 | void OnOk( wxCommandEvent &event ); |
0b855868 | 99 | void OnNew( wxCommandEvent &event ); |
0cf3e587 | 100 | void OnFileActivated( wxFileCtrlEvent &event); |
06cc1fb9 | 101 | |
4e1901b7 | 102 | private: |
e5dd66e9 | 103 | // if true, don't use this implementation at all |
4e1901b7 | 104 | bool m_bypassGenericImpl; |
c8c0e54c VZ |
105 | |
106 | protected: | |
e5dd66e9 VZ |
107 | // update the state of m_upDirButton and m_newDirButton depending on the |
108 | // currently selected directory | |
109 | void OnUpdateButtonsUI(wxUpdateUIEvent& event); | |
2b5f62a0 | 110 | |
0cf3e587 VZ |
111 | wxString m_filterExtension; |
112 | wxGenericFileCtrl *m_filectrl; | |
113 | wxBitmapButton *m_upDirButton; | |
114 | wxBitmapButton *m_newDirButton; | |
c8c0e54c | 115 | |
8b17ba72 | 116 | private: |
fe6cf128 | 117 | void Init(); |
8ce68f7f VZ |
118 | wxBitmapButton* AddBitmapButton( wxWindowID winId, const wxArtID& artId, |
119 | const wxString& tip, wxSizer *sizer ); | |
e5dd66e9 | 120 | |
23254b13 | 121 | DECLARE_DYNAMIC_CLASS(wxGenericFileDialog) |
8b17ba72 | 122 | DECLARE_EVENT_TABLE() |
cefc49fd | 123 | |
23254b13 | 124 | // these variables are preserved between wxGenericFileDialog calls |
9cedab37 VZ |
125 | static long ms_lastViewStyle; // list or report? |
126 | static bool ms_lastShowHidden; // did we show hidden files? | |
8b17ba72 RR |
127 | }; |
128 | ||
b2f0b934 | 129 | #ifdef wxHAS_GENERIC_FILEDIALOG |
23254b13 JS |
130 | |
131 | class WXDLLEXPORT wxFileDialog: public wxGenericFileDialog | |
132 | { | |
23254b13 | 133 | public: |
6463b9f5 | 134 | wxFileDialog() {} |
23254b13 JS |
135 | |
136 | wxFileDialog(wxWindow *parent, | |
137 | const wxString& message = wxFileSelectorPromptStr, | |
ca65c044 WS |
138 | const wxString& defaultDir = wxEmptyString, |
139 | const wxString& defaultFile = wxEmptyString, | |
23254b13 JS |
140 | const wxString& wildCard = wxFileSelectorDefaultWildcardStr, |
141 | long style = 0, | |
6463b9f5 JS |
142 | const wxPoint& pos = wxDefaultPosition) |
143 | :wxGenericFileDialog(parent, message, defaultDir, defaultFile, wildCard, style, pos) | |
144 | { | |
145 | } | |
6b99f53e | 146 | |
4e1901b7 RR |
147 | private: |
148 | DECLARE_DYNAMIC_CLASS(wxFileDialog) | |
23254b13 JS |
149 | }; |
150 | ||
b2f0b934 | 151 | #endif // wxHAS_GENERIC_FILEDIALOG |
8b17ba72 | 152 | |
b600ed13 | 153 | #endif // _WX_FILEDLGG_H_ |