Implement multiple selection support in wxOSX
Add support for wxDD_MULTIPLE style to wxDirDialog in wxOSX too.
This commit is contained in:
committed by
Vadim Zeitlin
parent
5e1cf4cdf2
commit
61afcae0be
@@ -47,6 +47,10 @@ public:
|
||||
|
||||
virtual int ShowModal() wxOVERRIDE;
|
||||
|
||||
virtual wxString GetPath() const wxOVERRIDE;
|
||||
virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE;
|
||||
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
virtual void ShowWindowModal() wxOVERRIDE;
|
||||
virtual void ModalFinishedCallback(void* panel, int returnCode) wxOVERRIDE;
|
||||
@@ -64,6 +68,8 @@ private:
|
||||
// Common part of all ctors.
|
||||
void Init();
|
||||
|
||||
wxArrayString m_paths;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxDirDialog);
|
||||
};
|
||||
|
||||
|
@@ -48,6 +48,9 @@ void wxDirDialog::Create(wxWindow *parent, const wxString& message,
|
||||
{
|
||||
m_parent = parent;
|
||||
|
||||
wxASSERT_MSG( !( (style & wxDD_MULTIPLE) && (style & wxDD_CHANGE_DIR) ),
|
||||
"wxDD_CHANGE_DIR can't be used together with wxDD_MULTIPLE" );
|
||||
|
||||
SetMessage( message );
|
||||
SetWindowStyle(style);
|
||||
SetPath(defaultPath);
|
||||
@@ -73,6 +76,9 @@ WX_NSOpenPanel wxDirDialog::OSXCreatePanel() const
|
||||
if ( !HasFlag(wxDD_DIR_MUST_EXIST) )
|
||||
[oPanel setCanCreateDirectories:YES];
|
||||
|
||||
if ( HasFlag(wxDD_MULTIPLE) )
|
||||
[oPanel setAllowsMultipleSelection:YES];
|
||||
|
||||
if ( HasFlag(wxDD_SHOW_HIDDEN) )
|
||||
[oPanel setShowsHiddenFiles:YES];
|
||||
|
||||
@@ -142,8 +148,7 @@ void wxDirDialog::ModalFinishedCallback(void* panel, int returnCode)
|
||||
|
||||
for ( NSURL* url in selectedURL )
|
||||
{
|
||||
SetPath([url fileSystemRepresentation]);
|
||||
break;
|
||||
m_paths.Add([url fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
result = wxID_OK;
|
||||
@@ -154,5 +159,16 @@ void wxDirDialog::ModalFinishedCallback(void* panel, int returnCode)
|
||||
SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED );
|
||||
}
|
||||
|
||||
wxString wxDirDialog::GetPath() const
|
||||
{
|
||||
return m_paths.Last();
|
||||
}
|
||||
|
||||
void wxDirDialog::GetPaths(wxArrayString& paths) const
|
||||
{
|
||||
paths.Empty();
|
||||
paths = m_paths;
|
||||
}
|
||||
|
||||
|
||||
#endif // wxUSE_DIRDLG
|
||||
|
Reference in New Issue
Block a user