From e78d4a23c27aa9b5e826d56c76c80d46d67812c1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 May 2002 12:38:51 +0000 Subject: [PATCH] wxDirDialog now has the same ctor under all platforms and also uses the correct default title string git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dirdlg.h | 38 +++++++++++++++++++++++++++++++++--- include/wx/generic/dirdlgg.h | 21 ++++++-------------- include/wx/mac/dirdlg.h | 33 ++++++++++++++++--------------- include/wx/msw/dirdlg.h | 10 ++++------ src/generic/dirdlgg.cpp | 4 ++-- src/mac/carbon/dirdlg.cpp | 10 +++++++--- src/mac/dirdlg.cpp | 10 +++++++--- src/msw/dirdlg.cpp | 4 +++- 8 files changed, 81 insertions(+), 49 deletions(-) diff --git a/include/wx/dirdlg.h b/include/wx/dirdlg.h index bb9a22f36d..32fd5710ec 100644 --- a/include/wx/dirdlg.h +++ b/include/wx/dirdlg.h @@ -9,8 +9,38 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogNameStr; WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogDefaultFolderStr; +WXDLLEXPORT_DATA(extern const wxChar*) wxDirSelectorPromptStr; WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; +#define wxDD_DEFAULT_STYLE \ + (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDD_NEW_DIR_BUTTON) + +/* + The interface (TODO: make the other classes really derive from it!) is + something like this: + +class WXDLLEXPORT wxDirDialogBase : public wxDialog +{ +public: + wxDirDialogBase(wxWindow *parent, + const wxString& title = wxFileSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = _T("dirdialog")); + + void SetMessage(const wxString& message); + void SetPath(const wxString& path); + void SetStyle(long style); + + wxString GetMessage() const; + wxString GetPath() const; + long GetStyle() const; +}; + +*/ + #if defined(__WXMSW__) #if defined(__WIN16__) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) || defined(__SALFORDC__) || !wxUSE_OLE #include "wx/generic/dirdlgg.h" @@ -32,16 +62,18 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; #include "wx/generic/dirdlgg.h" #endif +#if !defined(__WXMSW__) && !defined(__WXMAC__) + #define wxDirDialog wxGenericDirDialog +#endif + // ---------------------------------------------------------------------------- // common ::wxDirSelector() function // ---------------------------------------------------------------------------- -WXDLLEXPORT_DATA(extern const wxChar*) wxDirSelectorPromptStr; - WXDLLEXPORT wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr, const wxString& defaultPath = wxEmptyString, - long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDD_NEW_DIR_BUTTON, + long style = wxDD_DEFAULT_STYLE, const wxPoint& pos = wxDefaultPosition, wxWindow *parent = NULL); diff --git a/include/wx/generic/dirdlgg.h b/include/wx/generic/dirdlgg.h index 4996965dd3..675f37d1e6 100644 --- a/include/wx/generic/dirdlgg.h +++ b/include/wx/generic/dirdlgg.h @@ -19,11 +19,6 @@ #pragma interface "dirdlgg.h" #endif -#include "wx/defs.h" - -#if wxUSE_DIRDLG - -#include "wx/dialog.h" class WXDLLEXPORT wxGenericDirCtrl; class WXDLLEXPORT wxTextCtrl; class WXDLLEXPORT wxTreeEvent; @@ -35,13 +30,15 @@ class WXDLLEXPORT wxTreeEvent; class WXDLLEXPORT wxGenericDirDialog: public wxDialog { public: - wxGenericDirDialog(): wxDialog() {} - wxGenericDirDialog(wxWindow* parent, const wxString& title, + wxGenericDirDialog() : wxDialog() { } + + wxGenericDirDialog(wxWindow* parent, + const wxString& title = wxDirSelectorPromptStr, const wxString& defaultPath = wxEmptyString, - long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDD_NEW_DIR_BUTTON, + long style = wxDD_DEFAULT_STYLE, const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxSize(450, 550), - const wxString& name = _T("dialog")); + const wxString& name = wxDirDialogNameStr); //// Accessors inline void SetMessage(const wxString& message) { m_message = message; } @@ -76,10 +73,4 @@ protected: DECLARE_EVENT_TABLE() }; -#if !defined(__WXMSW__) && !defined(__WXMAC__) - #define wxDirDialog wxGenericDirDialog -#endif - -#endif // wxUSE_DIRDLG - #endif // _WX_DIRDLGG_H_ diff --git a/include/wx/mac/dirdlg.h b/include/wx/mac/dirdlg.h index 44f96238e2..fe343b9165 100644 --- a/include/wx/mac/dirdlg.h +++ b/include/wx/mac/dirdlg.h @@ -16,33 +16,34 @@ #pragma interface "dirdlg.h" #endif -#include "wx/dialog.h" - -WXDLLEXPORT_DATA(extern const char*) wxFileSelectorPromptStr; - -class WXDLLEXPORT wxDirDialog: public wxDialog +class WXDLLEXPORT wxDirDialog : public wxDialog { -DECLARE_DYNAMIC_CLASS(wxDirDialog) public: - wxDirDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr, - const wxString& defaultPath = "", - long style = 0, const wxPoint& pos = wxDefaultPosition); + wxDirDialog(wxWindow *parent, + const wxString& message = wxDirSelectorPromptStr, + const wxString& defaultPath = _T(""), + long style = 0, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxDirDialogNameStr); - inline void SetMessage(const wxString& message) { m_message = message; } - inline void SetPath(const wxString& path) { m_path = path; } - inline void SetStyle(long style) { m_dialogStyle = style; } + void SetMessage(const wxString& message) { m_message = message; } + void SetPath(const wxString& path) { m_path = path; } + void SetStyle(long style) { m_dialogStyle = style; } - inline wxString GetMessage() const { return m_message; } - inline wxString GetPath() const { return m_path; } - inline long GetStyle() const { return m_dialogStyle; } + wxString GetMessage() const { return m_message; } + wxString GetPath() const { return m_path; } + long GetStyle() const { return m_dialogStyle; } - int ShowModal(); + virtual int ShowModal(); protected: wxString m_message; long m_dialogStyle; wxWindow * m_parent; wxString m_path; + + DECLARE_DYNAMIC_CLASS(wxDirDialog) }; #endif diff --git a/include/wx/msw/dirdlg.h b/include/wx/msw/dirdlg.h index dc81929bcb..ac2f48971d 100644 --- a/include/wx/msw/dirdlg.h +++ b/include/wx/msw/dirdlg.h @@ -16,18 +16,16 @@ #pragma interface "dirdlg.h" #endif -#include "wx/dialog.h" - -WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorPromptStr; - class WXDLLEXPORT wxDirDialog : public wxDialog { public: wxDirDialog(wxWindow *parent, - const wxString& message = wxFileSelectorPromptStr, + const wxString& message = wxDirSelectorPromptStr, const wxString& defaultPath = wxEmptyString, long style = 0, - const wxPoint& pos = wxDefaultPosition); + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxDirDialogNameStr); void SetMessage(const wxString& message) { m_message = message; } void SetPath(const wxString& path); diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index d74c7aadc0..6f7157d886 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -36,8 +36,8 @@ #endif #include "wx/statline.h" -#include "wx/generic/dirctrlg.h" -#include "wx/generic/dirdlgg.h" +#include "wx/dirctrl.h" +#include "wx/dirdlg.h" #include "wx/artprov.h" #include "wx/bmpbuttn.h" diff --git a/src/mac/carbon/dirdlg.cpp b/src/mac/carbon/dirdlg.cpp index 079663908a..d38dc40a49 100644 --- a/src/mac/carbon/dirdlg.cpp +++ b/src/mac/carbon/dirdlg.cpp @@ -32,9 +32,13 @@ IMPLEMENT_CLASS(wxDirDialog, wxDialog) #endif -wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, - const wxString& defaultPath, - long style, const wxPoint& pos) +wxDirDialog::wxDirDialog(wxWindow *parent, + const wxString& message, + const wxString& defaultPath, + long style, + const wxPoint& WXUNUSED(pos), + const wxSize& WXUNUSED(size), + const wxString& WXUNUSED(name)) { wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ; m_message = message; diff --git a/src/mac/dirdlg.cpp b/src/mac/dirdlg.cpp index 079663908a..d38dc40a49 100644 --- a/src/mac/dirdlg.cpp +++ b/src/mac/dirdlg.cpp @@ -32,9 +32,13 @@ IMPLEMENT_CLASS(wxDirDialog, wxDialog) #endif -wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, - const wxString& defaultPath, - long style, const wxPoint& pos) +wxDirDialog::wxDirDialog(wxWindow *parent, + const wxString& message, + const wxString& defaultPath, + long style, + const wxPoint& WXUNUSED(pos), + const wxSize& WXUNUSED(size), + const wxString& WXUNUSED(name)) { wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ; m_message = message; diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index 7e4d420847..63194ca403 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -81,7 +81,9 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, const wxString& defaultPath, long WXUNUSED(style), - const wxPoint& WXUNUSED(pos)) + const wxPoint& WXUNUSED(pos), + const wxSize& WXUNUSED(size), + const wxString& WXUNUSED(name)) { m_message = message; m_parent = parent; -- 2.45.2