]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/filedlgg.h
Implement attributes support in generic wxDataViewIconTextRenderer.
[wxWidgets.git] / include / wx / generic / filedlgg.h
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/artprov.h"
19 #include "wx/filedlg.h"
20 #include "wx/generic/filectrlg.h"
21
22 //-----------------------------------------------------------------------------
23 // classes
24 //-----------------------------------------------------------------------------
25
26 class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
27 class WXDLLIMPEXP_FWD_CORE wxGenericFileCtrl;
28 class WXDLLIMPEXP_FWD_CORE wxGenericFileDialog;
29 class WXDLLIMPEXP_FWD_CORE wxFileCtrlEvent;
30
31 //-------------------------------------------------------------------------
32 // wxGenericFileDialog
33 //-------------------------------------------------------------------------
34
35 class WXDLLIMPEXP_CORE wxGenericFileDialog: public wxFileDialogBase
36 {
37 public:
38 wxGenericFileDialog() : wxFileDialogBase() { Init(); }
39
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 );
50
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 );
61
62 virtual ~wxGenericFileDialog();
63
64 virtual void SetMessage(const wxString& message) { SetTitle(message); }
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
75 { m_filectrl->GetPaths(paths); }
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
81 { m_filectrl->GetFilenames(files); }
82 virtual wxString GetWildcard() const
83 { return m_filectrl->GetWildcard(); }
84 virtual int GetFilterIndex() const
85 { return m_filectrl->GetFilterIndex(); }
86 virtual bool SupportsExtraControl() const { return true; }
87
88 // implementation only from now on
89 // -------------------------------
90
91 virtual int ShowModal();
92 virtual bool Show( bool show = true );
93
94 void OnList( wxCommandEvent &event );
95 void OnReport( wxCommandEvent &event );
96 void OnUp( wxCommandEvent &event );
97 void OnHome( wxCommandEvent &event );
98 void OnOk( wxCommandEvent &event );
99 void OnNew( wxCommandEvent &event );
100 void OnFileActivated( wxFileCtrlEvent &event);
101
102 private:
103 // if true, don't use this implementation at all
104 bool m_bypassGenericImpl;
105
106 protected:
107 // update the state of m_upDirButton and m_newDirButton depending on the
108 // currently selected directory
109 void OnUpdateButtonsUI(wxUpdateUIEvent& event);
110
111 wxString m_filterExtension;
112 wxGenericFileCtrl *m_filectrl;
113 wxBitmapButton *m_upDirButton;
114 wxBitmapButton *m_newDirButton;
115
116 private:
117 void Init();
118 wxBitmapButton* AddBitmapButton( wxWindowID winId, const wxArtID& artId,
119 const wxString& tip, wxSizer *sizer );
120
121 DECLARE_DYNAMIC_CLASS(wxGenericFileDialog)
122 DECLARE_EVENT_TABLE()
123
124 // these variables are preserved between wxGenericFileDialog calls
125 static long ms_lastViewStyle; // list or report?
126 static bool ms_lastShowHidden; // did we show hidden files?
127 };
128
129 #ifdef wxHAS_GENERIC_FILEDIALOG
130
131 class WXDLLIMPEXP_CORE wxFileDialog: public wxGenericFileDialog
132 {
133 public:
134 wxFileDialog() {}
135
136 wxFileDialog(wxWindow *parent,
137 const wxString& message = wxFileSelectorPromptStr,
138 const wxString& defaultDir = wxEmptyString,
139 const wxString& defaultFile = wxEmptyString,
140 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
141 long style = 0,
142 const wxPoint& pos = wxDefaultPosition,
143 const wxSize& size = wxDefaultSize)
144 :wxGenericFileDialog(parent, message,
145 defaultDir, defaultFile, wildCard,
146 style,
147 pos, size)
148 {
149 }
150
151 private:
152 DECLARE_DYNAMIC_CLASS(wxFileDialog)
153 };
154
155 #endif // wxHAS_GENERIC_FILEDIALOG
156
157 #endif // _WX_FILEDLGG_H_