Merge branch 'dirdialog-multi-hidden'

Add wxDD_MULTIPLE and wxDD_SHOW_HIDDEN support to wxDirDialog.

See https://github.com/wxWidgets/wxWidgets/pull/1884

Closes #18736.
This commit is contained in:
Vadim Zeitlin
2020-07-11 13:52:12 +02:00
10 changed files with 383 additions and 201 deletions

View File

@@ -25,8 +25,22 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogNameStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxDirDialogDefaultFolderStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxDirSelectorPromptStr[];
/*
The flags below must coexist with the following flags in m_windowStyle
#define wxCAPTION 0x20000000
#define wxMAXIMIZE 0x00002000
#define wxCLOSE_BOX 0x00001000
#define wxSYSTEM_MENU 0x00000800
wxBORDER_NONE = 0x00200000
#define wxRESIZE_BORDER 0x00000040
#define wxDIALOG_NO_PARENT 0x00000020
*/
#define wxDD_CHANGE_DIR 0x0100
#define wxDD_DIR_MUST_EXIST 0x0200
#define wxDD_MULTIPLE 0x0400
#define wxDD_SHOW_HIDDEN 0x0001
// deprecated, on by default now, use wxDD_DIR_MUST_EXIST to disable it
#define wxDD_NEW_DIR_BUTTON 0
@@ -74,11 +88,22 @@ public:
virtual void SetPath(const wxString& path) { m_path = path; }
virtual wxString GetMessage() const { return m_message; }
virtual wxString GetPath() const { return m_path; }
virtual wxString GetPath() const
{
wxCHECK_MSG( !HasFlag(wxDD_MULTIPLE), wxString(),
"When using wxDD_MULTIPLE, must call GetPaths() instead" );
return m_path;
}
virtual void GetPaths(wxArrayString& paths) const
{
paths = m_paths;
}
protected:
wxString m_message;
wxString m_path;
wxArrayString m_paths;
};

View File

@@ -37,7 +37,6 @@ public:
public: // overrides from wxGenericDirDialog
wxString GetPath() const wxOVERRIDE;
void SetPath(const wxString& path) wxOVERRIDE;
@@ -55,8 +54,6 @@ protected:
private:
wxString m_selectedDirectory;
wxDECLARE_DYNAMIC_CLASS(wxDirDialog);
};

View File

@@ -30,7 +30,7 @@ private:
// The real implementations of ShowModal(), used for Windows versions
// before and since Vista.
int ShowSHBrowseForFolder(WXHWND owner);
int ShowIFileDialog(WXHWND owner);
int ShowIFileOpenDialog(WXHWND owner);
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog);
};

View File

@@ -47,6 +47,10 @@ public:
virtual int ShowModal() wxOVERRIDE;
// MacOS 10.11 has removed the titlebar from the dialog, so this is provided
// only for compatibility with older versions
virtual void SetTitle(const wxString& title) 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();
wxString m_title;
wxDECLARE_DYNAMIC_CLASS(wxDirDialog);
};