filedlg.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. #ifndef _WX_FILEDLG_H_
  11. #define _WX_FILEDLG_H_
  12. class WXDLLIMPEXP_FWD_CORE wxChoice;
  13. //-------------------------------------------------------------------------
  14. // wxFileDialog
  15. //-------------------------------------------------------------------------
  16. // set this system option to 1 in order to always show the filetypes popup in
  17. // file open dialogs if possible
  18. #define wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES wxT("osx.openfiledialog.always-show-types")
  19. class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase
  20. {
  21. DECLARE_DYNAMIC_CLASS(wxFileDialog)
  22. protected:
  23. wxArrayString m_fileNames;
  24. wxArrayString m_paths;
  25. public:
  26. wxFileDialog() { Init(); }
  27. wxFileDialog(wxWindow *parent,
  28. const wxString& message = wxFileSelectorPromptStr,
  29. const wxString& defaultDir = wxEmptyString,
  30. const wxString& defaultFile = wxEmptyString,
  31. const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
  32. long style = wxFD_DEFAULT_STYLE,
  33. const wxPoint& pos = wxDefaultPosition,
  34. const wxSize& sz = wxDefaultSize,
  35. const wxString& name = wxFileDialogNameStr)
  36. {
  37. Init();
  38. Create(parent,message,defaultDir,defaultFile,wildCard,style,pos,sz,name);
  39. }
  40. void Create(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. #if wxOSX_USE_COCOA
  50. ~wxFileDialog();
  51. #endif
  52. virtual void GetPaths(wxArrayString& paths) const { paths = m_paths; }
  53. virtual void GetFilenames(wxArrayString& files) const { files = m_fileNames ; }
  54. virtual int ShowModal();
  55. #if wxOSX_USE_COCOA
  56. virtual void ShowWindowModal();
  57. virtual void ModalFinishedCallback(void* panel, int resultCode);
  58. #endif
  59. virtual bool SupportsExtraControl() const;
  60. // implementation only
  61. #if wxOSX_USE_COCOA
  62. // returns true if the file can be shown as active
  63. bool CheckFile( const wxString& filename );
  64. #endif
  65. protected:
  66. // not supported for file dialog, RR
  67. virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
  68. int WXUNUSED(width), int WXUNUSED(height),
  69. int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
  70. void SetupExtraControls(WXWindow nativeWindow);
  71. #if wxOSX_USE_COCOA
  72. virtual wxWindow* CreateFilterPanel(wxWindow *extracontrol);
  73. void DoOnFilterSelected(int index);
  74. virtual void OnFilterSelected(wxCommandEvent &event);
  75. wxArrayString m_filterExtensions;
  76. wxArrayString m_filterNames;
  77. wxChoice* m_filterChoice;
  78. wxWindow* m_filterPanel;
  79. bool m_useFileTypeFilter;
  80. int m_firstFileTypeFilter;
  81. wxArrayString m_currentExtensions;
  82. WX_NSObject m_delegate;
  83. WX_NSObject m_sheetDelegate;
  84. #endif
  85. private:
  86. // Common part of all ctors.
  87. void Init();
  88. };
  89. #endif // _WX_FILEDLG_H_