]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/generic/filedlgg.h | |
3 | // Purpose: wxGenericFileDialog | |
4 | // Author: Robert Roebling | |
5 | // Modified by: | |
6 | // Created: 8/17/99 | |
7 | // Copyright: (c) Robert Roebling | |
8 | // RCS-ID: $Id$ | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FILEDLGG_H_ | |
13 | #define _WX_FILEDLGG_H_ | |
14 | ||
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" | |
20 | ||
21 | //----------------------------------------------------------------------------- | |
22 | // classes | |
23 | //----------------------------------------------------------------------------- | |
24 | ||
25 | class WXDLLIMPEXP_FWD_CORE wxBitmapButton; | |
26 | class WXDLLIMPEXP_FWD_CORE wxGenericFileCtrl; | |
27 | class WXDLLIMPEXP_FWD_CORE wxGenericFileDialog; | |
28 | class WXDLLIMPEXP_FWD_CORE wxFileCtrlEvent; | |
29 | ||
30 | //------------------------------------------------------------------------- | |
31 | // wxGenericFileDialog | |
32 | //------------------------------------------------------------------------- | |
33 | ||
34 | class WXDLLEXPORT wxGenericFileDialog: public wxFileDialogBase | |
35 | { | |
36 | public: | |
37 | wxGenericFileDialog() : wxFileDialogBase() { Init(); } | |
38 | ||
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 ); | |
49 | ||
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 ); | |
60 | ||
61 | virtual ~wxGenericFileDialog(); | |
62 | ||
63 | virtual void SetMessage(const wxString& message) { SetTitle(message); } | |
64 | virtual void SetPath(const wxString& path); | |
65 | virtual void SetFilterIndex(int filterIndex); | |
66 | virtual void SetWildcard(const wxString& wildCard); | |
67 | ||
68 | // for multiple file selection | |
69 | virtual void GetPaths(wxArrayString& paths) const; | |
70 | virtual void GetFilenames(wxArrayString& files) const; | |
71 | ||
72 | // implementation only from now on | |
73 | // ------------------------------- | |
74 | ||
75 | virtual int ShowModal(); | |
76 | virtual bool Show( bool show = true ); | |
77 | ||
78 | void OnList( wxCommandEvent &event ); | |
79 | void OnReport( wxCommandEvent &event ); | |
80 | void OnUp( wxCommandEvent &event ); | |
81 | void OnHome( wxCommandEvent &event ); | |
82 | void OnOk( wxCommandEvent &event ); | |
83 | void OnNew( wxCommandEvent &event ); | |
84 | void OnFileActivated( wxFileCtrlEvent &event); | |
85 | ||
86 | virtual void UpdateControls(); | |
87 | ||
88 | private: | |
89 | // Don't use this implementation at all :-) | |
90 | bool m_bypassGenericImpl; | |
91 | ||
92 | protected: | |
93 | ||
94 | wxString m_filterExtension; | |
95 | wxGenericFileCtrl *m_filectrl; | |
96 | wxBitmapButton *m_upDirButton; | |
97 | wxBitmapButton *m_newDirButton; | |
98 | ||
99 | private: | |
100 | void Init(); | |
101 | DECLARE_DYNAMIC_CLASS(wxGenericFileDialog) | |
102 | DECLARE_EVENT_TABLE() | |
103 | ||
104 | // these variables are preserved between wxGenericFileDialog calls | |
105 | static long ms_lastViewStyle; // list or report? | |
106 | static bool ms_lastShowHidden; // did we show hidden files? | |
107 | }; | |
108 | ||
109 | #ifdef wxHAS_GENERIC_FILEDIALOG | |
110 | ||
111 | class WXDLLEXPORT wxFileDialog: public wxGenericFileDialog | |
112 | { | |
113 | public: | |
114 | wxFileDialog() {} | |
115 | ||
116 | wxFileDialog(wxWindow *parent, | |
117 | const wxString& message = wxFileSelectorPromptStr, | |
118 | const wxString& defaultDir = wxEmptyString, | |
119 | const wxString& defaultFile = wxEmptyString, | |
120 | const wxString& wildCard = wxFileSelectorDefaultWildcardStr, | |
121 | long style = 0, | |
122 | const wxPoint& pos = wxDefaultPosition) | |
123 | :wxGenericFileDialog(parent, message, defaultDir, defaultFile, wildCard, style, pos) | |
124 | { | |
125 | } | |
126 | ||
127 | private: | |
128 | DECLARE_DYNAMIC_CLASS(wxFileDialog) | |
129 | }; | |
130 | ||
131 | #endif // wxHAS_GENERIC_FILEDIALOG | |
132 | ||
133 | #endif // _WX_FILEDLGG_H_ |