support for file-type popup, compatible for 10.4+, solves #12429
[wxWidgets.git] / include / wx / osx / filedlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: filedlg.h
3 // Purpose: wxFileDialog class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FILEDLG_H_
13 #define _WX_FILEDLG_H_
14
15 //-------------------------------------------------------------------------
16 // wxFileDialog
17 //-------------------------------------------------------------------------
18
19 // set this system option to 1 in order to always show the filetypes popup in
20 // file open dialogs if possible
21
22 #define wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES wxT("osx.filedlg.always-show-types")
23
24 class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase
25 {
26 DECLARE_DYNAMIC_CLASS(wxFileDialog)
27 protected:
28 wxArrayString m_fileNames;
29 wxArrayString m_paths;
30
31 public:
32 wxFileDialog(wxWindow *parent,
33 const wxString& message = wxFileSelectorPromptStr,
34 const wxString& defaultDir = wxEmptyString,
35 const wxString& defaultFile = wxEmptyString,
36 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
37 long style = wxFD_DEFAULT_STYLE,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& sz = wxDefaultSize,
40 const wxString& name = wxFileDialogNameStr);
41
42 virtual void GetPaths(wxArrayString& paths) const { paths = m_paths; }
43 virtual void GetFilenames(wxArrayString& files) const { files = m_fileNames ; }
44
45 virtual int ShowModal();
46
47 #if wxOSX_USE_COCOA
48 virtual void ShowWindowModal();
49 virtual void ModalFinishedCallback(void* panel, int resultCode);
50 #endif
51
52 virtual bool SupportsExtraControl() const;
53
54 // implementation only
55
56 #if wxOSX_USE_COCOA
57 // returns true if the file can be shown as active
58 bool CheckFile( const wxString& filename );
59 #endif
60
61 protected:
62 // not supported for file dialog, RR
63 virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
64 int WXUNUSED(width), int WXUNUSED(height),
65 int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
66
67 void SetupExtraControls(WXWindow nativeWindow);
68
69 #if wxOSX_USE_COCOA
70 virtual wxWindow* CreateFilterPanel(wxWindow *extracontrol);
71 virtual void OnFilterSelected(wxCommandEvent &event);
72
73 wxArrayString m_filterExtensions;
74 wxArrayString m_filterNames;
75 wxChoice* m_filterChoice;
76 wxWindow* m_filterPanel;
77 bool m_useFileTypeFilter;
78 int m_firstFileTypeFilter;
79 wxArrayString m_currentExtensions;
80 WX_NSObject m_delegate;
81 #endif
82 };
83
84 #endif // _WX_FILEDLG_H_