]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/filedlg.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / osx / filedlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/filedlg.h
3 // Purpose: wxFileDialog class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_FILEDLG_H_
12 #define _WX_FILEDLG_H_
13
14 class WXDLLIMPEXP_FWD_CORE wxChoice;
15
16 //-------------------------------------------------------------------------
17 // wxFileDialog
18 //-------------------------------------------------------------------------
19
20 // set this system option to 1 in order to always show the filetypes popup in
21 // file open dialogs if possible
22
23 #define wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES wxT("osx.openfiledialog.always-show-types")
24
25 class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase
26 {
27 DECLARE_DYNAMIC_CLASS(wxFileDialog)
28 protected:
29 wxArrayString m_fileNames;
30 wxArrayString m_paths;
31
32 public:
33 wxFileDialog() { Init(); }
34 wxFileDialog(wxWindow *parent,
35 const wxString& message = wxFileSelectorPromptStr,
36 const wxString& defaultDir = wxEmptyString,
37 const wxString& defaultFile = wxEmptyString,
38 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
39 long style = wxFD_DEFAULT_STYLE,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& sz = wxDefaultSize,
42 const wxString& name = wxFileDialogNameStr)
43 {
44 Init();
45
46 Create(parent,message,defaultDir,defaultFile,wildCard,style,pos,sz,name);
47 }
48
49 void Create(wxWindow *parent,
50 const wxString& message = wxFileSelectorPromptStr,
51 const wxString& defaultDir = wxEmptyString,
52 const wxString& defaultFile = wxEmptyString,
53 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
54 long style = wxFD_DEFAULT_STYLE,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& sz = wxDefaultSize,
57 const wxString& name = wxFileDialogNameStr);
58
59 #if wxOSX_USE_COCOA
60 ~wxFileDialog();
61 #endif
62
63 virtual void GetPaths(wxArrayString& paths) const { paths = m_paths; }
64 virtual void GetFilenames(wxArrayString& files) const { files = m_fileNames ; }
65
66 virtual int ShowModal();
67
68 #if wxOSX_USE_COCOA
69 virtual void ShowWindowModal();
70 virtual void ModalFinishedCallback(void* panel, int resultCode);
71 #endif
72
73 virtual bool SupportsExtraControl() const;
74
75 // implementation only
76
77 #if wxOSX_USE_COCOA
78 // returns true if the file can be shown as active
79 bool CheckFile( const wxString& filename );
80 #endif
81
82 protected:
83 // not supported for file dialog, RR
84 virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
85 int WXUNUSED(width), int WXUNUSED(height),
86 int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
87
88 void SetupExtraControls(WXWindow nativeWindow);
89
90 #if wxOSX_USE_COCOA
91 virtual wxWindow* CreateFilterPanel(wxWindow *extracontrol);
92 void DoOnFilterSelected(int index);
93 virtual void OnFilterSelected(wxCommandEvent &event);
94
95 wxArrayString m_filterExtensions;
96 wxArrayString m_filterNames;
97 wxChoice* m_filterChoice;
98 wxWindow* m_filterPanel;
99 bool m_useFileTypeFilter;
100 int m_firstFileTypeFilter;
101 wxArrayString m_currentExtensions;
102 WX_NSObject m_delegate;
103 WX_NSObject m_sheetDelegate;
104 #endif
105
106 private:
107 // Common part of all ctors.
108 void Init();
109 };
110
111 #endif // _WX_FILEDLG_H_