diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index 464cb9d250..afc0820553 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -136,6 +136,7 @@ dndcmn.cpp Common dobjcmn.cpp Common docmdi.cpp Common docview.cpp Common +dseldlg.cpp Common dynarray.cpp Common Base dynlib.cpp Common Base effects.cpp Common diff --git a/docs/changes.txt b/docs/changes.txt index c61b5e79fd..c488a416f6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -43,6 +43,7 @@ All (GUI): - polygon support in wxRegion (Klaas Holwerda) - wxStreamToTextRedirector to allow easily redirect cout to wxTextCtrl added - fixed bug with using wxExecute() to capture huge amounts of output +- wxDirSelector() added (Paul A. Thiessen) wxHTML: diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex index dc9310d0bf..07fe1ee4bd 100644 --- a/docs/latex/wx/function.tex +++ b/docs/latex/wx/function.tex @@ -597,6 +597,32 @@ is remembered between the 2 program runs.} +\membersection{::wxDirSelector}\label{wxdirselector} + +\func{wxString}{wxDirSelector}{\param{const wxString\& }{message = wxDirSelectorPromptStr},\\ + \param{const wxString\& }{default\_path = ""},\\ + \param{long }{style = 0}, \param{const wxPoint\& }{pos = wxDefaultPosition},\\ + \param{wxWindow *}{parent = NULL}} + +Pops up a directory selector dialog. The arguments have the same meaning as +those of wxDirDialog::wxDirDialog(). The message is displayed at the top, +and the default_path, if specified, is set as the initial selection. + +The application must check for an empty return value (if the user pressed +Cancel). For example: + +\begin{verbatim} +const wxString& dir = wxDirSelector("Choose a folder"); +if ( !dir.empty() ) +{ + ... +} +\end{verbatim} + +\wxheading{Include files} + + + \membersection{::wxFileSelector}\label{wxfileselector} \func{wxString}{wxFileSelector}{\param{const wxString\& }{message}, \param{const wxString\& }{default\_path = ""},\\ diff --git a/include/wx/dirdlg.h b/include/wx/dirdlg.h index f33ab1754f..63a01f1714 100644 --- a/include/wx/dirdlg.h +++ b/include/wx/dirdlg.h @@ -12,23 +12,36 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogDefaultFolderStr; WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; #if defined(__WXMSW__) -#if defined(__WIN16__) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) || defined(__SALFORDC__) -#include "wx/generic/dirdlgg.h" -#else -#include "wx/msw/dirdlg.h" -#endif + #if defined(__WIN16__) || (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) || defined(__SALFORDC__) + #include "wx/generic/dirdlgg.h" + #else + #include "wx/msw/dirdlg.h" + #endif #elif defined(__WXMOTIF__) -#include "wx/generic/dirdlgg.h" + #include "wx/generic/dirdlgg.h" #elif defined(__WXGTK__) -#include "wx/generic/dirdlgg.h" + #include "wx/generic/dirdlgg.h" #elif defined(__WXMAC__) -#include "wx/mac/dirdlg.h" + #include "wx/mac/dirdlg.h" #elif defined(__WXPM__) -#include "wx/os2/dirdlg.h" + #include "wx/os2/dirdlg.h" #elif defined(__WXSTUBS__) -#include "wx/stubs/dirdlg.h" + #include "wx/stubs/dirdlg.h" #endif +// ---------------------------------------------------------------------------- +// common ::wxDirSelector() function +// ---------------------------------------------------------------------------- + +WXDLLEXPORT_DATA(extern const wxChar*) wxDirSelectorPromptStr; + +WXDLLEXPORT wxString +wxDirSelector(const wxString& message = wxDirSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = 0, + const wxPoint& pos = wxDefaultPosition, + wxWindow *parent = NULL); + #endif // wxUSE_DIRDLG #endif diff --git a/include/wx/generic/dirdlgg.h b/include/wx/generic/dirdlgg.h index 53135f57bb..3922c472b6 100644 --- a/include/wx/generic/dirdlgg.h +++ b/include/wx/generic/dirdlgg.h @@ -60,9 +60,12 @@ #if wxUSE_DIRDLG #include "wx/dialog.h" -#include "wx/checkbox.h" #include "wx/treectrl.h" +class WXDLLEXPORT wxButton; +class WXDLLEXPORT wxCheckBox; +class WXDLLEXPORT wxTextCtrl; + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/common/dseldlg.cpp b/src/common/dseldlg.cpp new file mode 100644 index 0000000000..bd12182171 --- /dev/null +++ b/src/common/dseldlg.cpp @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/common/dseldlg.cpp +// Purpose: implementation of ::wxDirSelector() +// Author: Paul Thiessen +// Modified by: +// Created: 20.02.01 +// RCS-ID: $Id$ +// Copyright: (c) 2001 wxWindows team +// License: wxWindows license +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#ifdef __GNUG__ + #pragma implementation "dseldlg.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif //WX_PRECOMP + +#include "wx/dirdlg.h" + +#if wxUSE_DIRDLG + +// ============================================================================ +// implementation +// ============================================================================ + +const wxChar *wxDirSelectorPromptStr = wxT("Select a directory"); + +wxString wxDirSelector(const wxString& message, + const wxString& defaultPath, + long style, + const wxPoint& pos, + wxWindow *parent) +{ + wxString path; + + wxDirDialog dirDialog(parent, message, defaultPath, style, pos); + if ( dirDialog.ShowModal() == wxID_OK ) + { + path = dirDialog.GetPath(); + } + + return path; +} + +#endif // wxUSE_DIRDLG + diff --git a/src/files.lst b/src/files.lst index 968217e870..c41b27395f 100644 --- a/src/files.lst +++ b/src/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BASE.T! ALL_SOURCES = \ common/init.cpp \ diff --git a/src/gtk/files.lst b/src/gtk/files.lst index ebca4ad004..3ad06f26a9 100644 --- a/src/gtk/files.lst +++ b/src/gtk/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T! ALL_SOURCES = \ generic/accel.cpp \ @@ -72,6 +72,7 @@ ALL_SOURCES = \ common/dobjcmn.cpp \ common/docmdi.cpp \ common/docview.cpp \ + common/dseldlg.cpp \ common/dynarray.cpp \ common/dynlib.cpp \ common/effects.cpp \ @@ -636,6 +637,7 @@ COMMONOBJS = \ dobjcmn.o \ docmdi.o \ docview.o \ + dseldlg.o \ dynarray.o \ dynlib.o \ effects.o \ diff --git a/src/gtk1/files.lst b/src/gtk1/files.lst index ebca4ad004..3ad06f26a9 100644 --- a/src/gtk1/files.lst +++ b/src/gtk1/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T! ALL_SOURCES = \ generic/accel.cpp \ @@ -72,6 +72,7 @@ ALL_SOURCES = \ common/dobjcmn.cpp \ common/docmdi.cpp \ common/docview.cpp \ + common/dseldlg.cpp \ common/dynarray.cpp \ common/dynlib.cpp \ common/effects.cpp \ @@ -636,6 +637,7 @@ COMMONOBJS = \ dobjcmn.o \ docmdi.o \ docview.o \ + dseldlg.o \ dynarray.o \ dynlib.o \ effects.o \ diff --git a/src/mac/carbon/files.lst b/src/mac/carbon/files.lst index 23cd4b9bca..590d244d2e 100644 --- a/src/mac/carbon/files.lst +++ b/src/mac/carbon/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MAC.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -67,6 +67,7 @@ ALL_SOURCES = \ common/dobjcmn.cpp \ common/docmdi.cpp \ common/docview.cpp \ + common/dseldlg.cpp \ common/dynarray.cpp \ common/dynlib.cpp \ common/effects.cpp \ @@ -660,6 +661,7 @@ COMMONOBJS = \ dobjcmn.o \ docmdi.o \ docview.o \ + dseldlg.o \ dynarray.o \ dynlib.o \ effects.o \ diff --git a/src/mac/files.lst b/src/mac/files.lst index 23cd4b9bca..590d244d2e 100644 --- a/src/mac/files.lst +++ b/src/mac/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MAC.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -67,6 +67,7 @@ ALL_SOURCES = \ common/dobjcmn.cpp \ common/docmdi.cpp \ common/docview.cpp \ + common/dseldlg.cpp \ common/dynarray.cpp \ common/dynlib.cpp \ common/effects.cpp \ @@ -660,6 +661,7 @@ COMMONOBJS = \ dobjcmn.o \ docmdi.o \ docview.o \ + dseldlg.o \ dynarray.o \ dynlib.o \ effects.o \ diff --git a/src/mgl/files.lst b/src/mgl/files.lst index 0bdf71c030..ead3c38c5b 100644 --- a/src/mgl/files.lst +++ b/src/mgl/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T! ALL_SOURCES = \ generic/accel.cpp \ @@ -70,6 +70,7 @@ ALL_SOURCES = \ common/dobjcmn.cpp \ common/docmdi.cpp \ common/docview.cpp \ + common/dseldlg.cpp \ common/dynarray.cpp \ common/dynlib.cpp \ common/effects.cpp \ @@ -597,6 +598,7 @@ COMMONOBJS = \ dobjcmn.o \ docmdi.o \ docview.o \ + dseldlg.o \ dynarray.o \ dynlib.o \ effects.o \ diff --git a/src/motif/files.lst b/src/motif/files.lst index 0609a5a8c3..f00457bdce 100644 --- a/src/motif/files.lst +++ b/src/motif/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MOTIF.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -71,6 +71,7 @@ ALL_SOURCES = \ common/dobjcmn.cpp \ common/docmdi.cpp \ common/docview.cpp \ + common/dseldlg.cpp \ common/dynarray.cpp \ common/dynlib.cpp \ common/effects.cpp \ @@ -623,6 +624,7 @@ COMMONOBJS = \ dobjcmn.o \ docmdi.o \ docview.o \ + dseldlg.o \ dynarray.o \ dynlib.o \ effects.o \ diff --git a/src/msw/files.lst b/src/msw/files.lst index 7b07500a67..b42f82a45f 100644 --- a/src/msw/files.lst +++ b/src/msw/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MSW.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -54,6 +54,7 @@ ALL_SOURCES = \ common/dobjcmn.cpp \ common/docmdi.cpp \ common/docview.cpp \ + common/dseldlg.cpp \ common/dynarray.cpp \ common/dynlib.cpp \ common/effects.cpp \ @@ -692,6 +693,7 @@ COMMONOBJS = \ dobjcmn.o \ docmdi.o \ docview.o \ + dseldlg.o \ dynarray.o \ dynlib.o \ effects.o \ diff --git a/src/msw/makefile.b32 b/src/msw/makefile.b32 index 3faecf8e16..ff91da829b 100644 --- a/src/msw/makefile.b32 +++ b/src/msw/makefile.b32 @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T! # @@ -138,6 +138,7 @@ COMMONOBJS = \ $(MSWDIR)\dobjcmn.obj \ $(MSWDIR)\docmdi.obj \ $(MSWDIR)\docview.obj \ + $(MSWDIR)\dseldlg.obj \ $(MSWDIR)\dynarray.obj \ $(MSWDIR)\dynlib.obj \ $(MSWDIR)\effects.obj \ @@ -680,6 +681,8 @@ $(MSWDIR)\docmdi.obj: $(COMMDIR)\docmdi.$(SRCSUFF) $(MSWDIR)\docview.obj: $(COMMDIR)\docview.$(SRCSUFF) +$(MSWDIR)\dseldlg.obj: $(COMMDIR)\dseldlg.$(SRCSUFF) + $(MSWDIR)\dynarray.obj: $(COMMDIR)\dynarray.$(SRCSUFF) $(MSWDIR)\dynlib.obj: $(COMMDIR)\dynlib.$(SRCSUFF) diff --git a/src/msw/makefile.bcc b/src/msw/makefile.bcc index 84ed832bb8..56021e50a1 100644 --- a/src/msw/makefile.bcc +++ b/src/msw/makefile.bcc @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T! # @@ -125,6 +125,7 @@ COMMONOBJS = \ $(MSWDIR)\dobjcmn.obj \ $(MSWDIR)\docmdi.obj \ $(MSWDIR)\docview.obj \ + $(MSWDIR)\dseldlg.obj \ $(MSWDIR)\dynarray.obj \ $(MSWDIR)\dynlib.obj \ $(MSWDIR)\effects.obj \ @@ -542,6 +543,8 @@ $(MSWDIR)\docmdi.obj: $(COMMDIR)\docmdi.$(SRCSUFF) $(MSWDIR)\docview.obj: $(COMMDIR)\docview.$(SRCSUFF) +$(MSWDIR)\dseldlg.obj: $(COMMDIR)\dseldlg.$(SRCSUFF) + $(MSWDIR)\dynarray.obj: $(COMMDIR)\dynarray.$(SRCSUFF) $(MSWDIR)\dynlib.obj: $(COMMDIR)\dynlib.$(SRCSUFF) diff --git a/src/msw/makefile.dos b/src/msw/makefile.dos index e718b540b9..ae31308a69 100644 --- a/src/msw/makefile.dos +++ b/src/msw/makefile.dos @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T! # @@ -109,6 +109,7 @@ COMMONOBJS1 = \ $(COMMDIR)\dobjcmn.obj \ $(COMMDIR)\docmdi.obj \ $(COMMDIR)\docview.obj \ + $(COMMDIR)\dseldlg.obj \ $(COMMDIR)\dynarray.obj \ $(COMMDIR)\dynlib.obj \ $(COMMDIR)\effects.obj \ @@ -882,6 +883,11 @@ $(COMMDIR)/docview.obj: $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) << +$(COMMDIR)/dseldlg.obj: $*.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) +<< + $(COMMDIR)/dynarray.obj: $*.$(SRCSUFF) cl @<< $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index 129f2056d1..f9c2d922f3 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T! # @@ -125,6 +125,7 @@ COMMONOBJS = \ $(COMMDIR)/dobjcmn.$(OBJSUFF) \ $(COMMDIR)/docmdi.$(OBJSUFF) \ $(COMMDIR)/docview.$(OBJSUFF) \ + $(COMMDIR)/dseldlg.$(OBJSUFF) \ $(COMMDIR)/dynarray.$(OBJSUFF) \ $(COMMDIR)/dynlib.$(OBJSUFF) \ $(COMMDIR)/effects.$(OBJSUFF) \ diff --git a/src/msw/makefile.sc b/src/msw/makefile.sc index 725c96c633..9038c52738 100644 --- a/src/msw/makefile.sc +++ b/src/msw/makefile.sc @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T! # Symantec C++ makefile for the msw objects @@ -81,6 +81,7 @@ COMMONOBJS = \ $(COMMDIR)\dobjcmn.obj \ $(COMMDIR)\docmdi.obj \ $(COMMDIR)\docview.obj \ + $(COMMDIR)\dseldlg.obj \ $(COMMDIR)\dynarray.obj \ $(COMMDIR)\dynlib.obj \ $(COMMDIR)\effects.obj \ diff --git a/src/msw/makefile.vc b/src/msw/makefile.vc index 1175e5f50b..e349b11083 100644 --- a/src/msw/makefile.vc +++ b/src/msw/makefile.vc @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T! # File: makefile.vc @@ -160,6 +160,7 @@ COMMONOBJS = \ $(COMMDIR)\$D\dobjcmn.obj \ $(COMMDIR)\$D\docmdi.obj \ $(COMMDIR)\$D\docview.obj \ + $(COMMDIR)\$D\dseldlg.obj \ $(COMMDIR)\$D\dynarray.obj \ $(COMMDIR)\$D\dynlib.obj \ $(COMMDIR)\$D\effects.obj \ diff --git a/src/msw/makefile.wat b/src/msw/makefile.wat index 29b689be02..6647c21b65 100644 --- a/src/msw/makefile.wat +++ b/src/msw/makefile.wat @@ -1,6 +1,6 @@ #!/binb/wmake.exe -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T! # @@ -120,6 +120,7 @@ COMMONOBJS = & dobjcmn.obj & docmdi.obj & docview.obj & + dseldlg.obj & dynarray.obj & dynlib.obj & effects.obj & @@ -782,6 +783,9 @@ docmdi.obj: $(COMMDIR)\docmdi.cpp docview.obj: $(COMMDIR)\docview.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< +dseldlg.obj: $(COMMDIR)\dseldlg.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + dynarray.obj: $(COMMDIR)\dynarray.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< diff --git a/src/univ/files.lst b/src/univ/files.lst index 132759931b..681561724b 100644 --- a/src/univ/files.lst +++ b/src/univ/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 12:46, 2001/10/30 +# This file was automatically generated by tmake at 17:52, 2001/10/30 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNIV.T! UNIVOBJS = \ bmpbuttn.o \ diff --git a/src/wxUniv.dsp b/src/wxUniv.dsp index 2cca47007e..7cf3594720 100644 --- a/src/wxUniv.dsp +++ b/src/wxUniv.dsp @@ -181,6 +181,10 @@ SOURCE=.\common\docview.cpp # End Source File # Begin Source File +SOURCE=.\common\dseldlg.cpp +# End Source File +# Begin Source File + SOURCE=.\common\dynarray.cpp # End Source File # Begin Source File diff --git a/src/wxWindows.dsp b/src/wxWindows.dsp index d16ae8ca56..42cfc3a36b 100644 --- a/src/wxWindows.dsp +++ b/src/wxWindows.dsp @@ -344,6 +344,10 @@ SOURCE=.\common\docview.cpp # End Source File # Begin Source File +SOURCE=.\common\dseldlg.cpp +# End Source File +# Begin Source File + SOURCE=.\common\dynarray.cpp # End Source File # Begin Source File