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