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 int ShowModal() wxOVERRIDE;
|
||||||
|
|
||||||
|
virtual wxString GetPath() const wxOVERRIDE;
|
||||||
|
virtual void GetPaths(wxArrayString& paths) const wxOVERRIDE;
|
||||||
|
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
virtual void ShowWindowModal() wxOVERRIDE;
|
virtual void ShowWindowModal() wxOVERRIDE;
|
||||||
virtual void ModalFinishedCallback(void* panel, int returnCode) wxOVERRIDE;
|
virtual void ModalFinishedCallback(void* panel, int returnCode) wxOVERRIDE;
|
||||||
@@ -64,6 +68,8 @@ private:
|
|||||||
// Common part of all ctors.
|
// Common part of all ctors.
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
wxArrayString m_paths;
|
||||||
|
|
||||||
wxDECLARE_DYNAMIC_CLASS(wxDirDialog);
|
wxDECLARE_DYNAMIC_CLASS(wxDirDialog);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -48,6 +48,9 @@ void wxDirDialog::Create(wxWindow *parent, const wxString& message,
|
|||||||
{
|
{
|
||||||
m_parent = parent;
|
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 );
|
SetMessage( message );
|
||||||
SetWindowStyle(style);
|
SetWindowStyle(style);
|
||||||
SetPath(defaultPath);
|
SetPath(defaultPath);
|
||||||
@@ -73,6 +76,9 @@ WX_NSOpenPanel wxDirDialog::OSXCreatePanel() const
|
|||||||
if ( !HasFlag(wxDD_DIR_MUST_EXIST) )
|
if ( !HasFlag(wxDD_DIR_MUST_EXIST) )
|
||||||
[oPanel setCanCreateDirectories:YES];
|
[oPanel setCanCreateDirectories:YES];
|
||||||
|
|
||||||
|
if ( HasFlag(wxDD_MULTIPLE) )
|
||||||
|
[oPanel setAllowsMultipleSelection:YES];
|
||||||
|
|
||||||
if ( HasFlag(wxDD_SHOW_HIDDEN) )
|
if ( HasFlag(wxDD_SHOW_HIDDEN) )
|
||||||
[oPanel setShowsHiddenFiles:YES];
|
[oPanel setShowsHiddenFiles:YES];
|
||||||
|
|
||||||
@@ -142,8 +148,7 @@ void wxDirDialog::ModalFinishedCallback(void* panel, int returnCode)
|
|||||||
|
|
||||||
for ( NSURL* url in selectedURL )
|
for ( NSURL* url in selectedURL )
|
||||||
{
|
{
|
||||||
SetPath([url fileSystemRepresentation]);
|
m_paths.Add([url fileSystemRepresentation]);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = wxID_OK;
|
result = wxID_OK;
|
||||||
@@ -154,5 +159,16 @@ void wxDirDialog::ModalFinishedCallback(void* panel, int returnCode)
|
|||||||
SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED );
|
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
|
#endif // wxUSE_DIRDLG
|
||||||
|
Reference in New Issue
Block a user