1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 00:03:52 +02:00

Define wxDirDialogWrapper, with localized default prompt and name

This commit is contained in:
Paul Licameli
2017-10-12 15:23:52 -04:00
parent 729fd3767c
commit cf4b9eb5c8
4 changed files with 40 additions and 3 deletions

View File

@@ -531,7 +531,7 @@ void ScreenFrame::OnDirChoose(wxCommandEvent & WXUNUSED(event))
{
wxString current = mDirectoryTextBox->GetValue();
wxDirDialog dlog(this,
wxDirDialogWrapper dlog(this,
_("Choose a location to save screenshot images"),
current);

View File

@@ -480,7 +480,7 @@ void ExportMultiple::OnCreate(wxCommandEvent& WXUNUSED(event))
void ExportMultiple::OnChoose(wxCommandEvent& WXUNUSED(event))
{
wxDirDialog dlog(this,
wxDirDialogWrapper dlog(this,
_("Choose a location to save the exported files"),
mDir->GetValue());
dlog.ShowModal();

View File

@@ -135,7 +135,7 @@ void DirectoriesPrefs::OnChooseTempDir(wxCommandEvent & e)
if( !AudacityApp::IsTempDirectoryNameOK( oldTempDir ) )
oldTempDir = wxGetApp().defaultTempDir;
wxDirDialog dlog(this,
wxDirDialogWrapper dlog(this,
_("Choose a location to place the temporary directory"),
oldTempDir );
int retval = dlog.ShowModal();

View File

@@ -100,4 +100,41 @@ public:
}
};
#include <wx/dirdlg.h>
class wxDirDialogWrapper : public wxTabTraversalWrapper<wxDirDialog>
{
public:
wxDirDialogWrapper() {}
// Constructor with no modal flag - the new convention.
wxDirDialogWrapper(
wxWindow *parent,
const wxString& message = _("Select a directory"),
const wxString& defaultPath = wxT(""),
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
// Important: default window name localizes!
const wxString& name = _("Directory Dialog"))
: wxTabTraversalWrapper<wxDirDialog>
{ parent, message, defaultPath, style, pos, size, name }
{}
void Create(
wxWindow *parent,
const wxString& message = _("Select a directory"),
const wxString& defaultPath = wxT(""),
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
// Important: default window name localizes!
const wxString& name = _("Directory Dialog"))
{
return wxTabTraversalWrapper<wxDirDialog>::Create(
parent, message, defaultPath, style, pos, size, name
);
}
};
#endif