File/dir dialog styles and other changes (patch 1488371):
- check invalid combinations of styles in wxFileDialogBase::Create() - use wxFD_XXX naming convention for wxFileDialog styles - replaces wxDD_NEW_DIR_BUTTON with wxDD_DIR_MUST_EXIST - removes #ifdef __WXGTK24__ / #endif blocks from wxGTK code - removes wxFileDialogBase::Get/SetStyle and wxFileDialogBase::m_fileName - renames wxDirDialogGTK to wxDirDialog git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39402 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
55325d01e6
commit
ff3e84ffdc
@ -154,7 +154,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
|
|||||||
void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxFileDialog dialog(this, _T("Please choose an animated GIF"),
|
wxFileDialog dialog(this, _T("Please choose an animated GIF"),
|
||||||
wxEmptyString, wxEmptyString, wxT("*.gif"), wxOPEN);
|
wxEmptyString, wxEmptyString, wxT("*.gif"), wxFD_OPEN);
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
wxString filename(dialog.GetPath());
|
wxString filename(dialog.GetPath());
|
||||||
|
@ -508,7 +508,7 @@ bool Edit::LoadFile ()
|
|||||||
// get filname
|
// get filname
|
||||||
if (!m_filename) {
|
if (!m_filename) {
|
||||||
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
|
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
|
||||||
_T("Any file (*)|*"), wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
|
_T("Any file (*)|*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
|
||||||
if (dlg.ShowModal() != wxID_OK) return false;
|
if (dlg.ShowModal() != wxID_OK) return false;
|
||||||
m_filename = dlg.GetPath();
|
m_filename = dlg.GetPath();
|
||||||
}
|
}
|
||||||
@ -557,7 +557,7 @@ bool Edit::SaveFile ()
|
|||||||
// get filname
|
// get filname
|
||||||
if (!m_filename) {
|
if (!m_filename) {
|
||||||
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
|
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
|
||||||
wxSAVE | wxOVERWRITE_PROMPT);
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||||
if (dlg.ShowModal() != wxID_OK) return false;
|
if (dlg.ShowModal() != wxID_OK) return false;
|
||||||
m_filename = dlg.GetPath();
|
m_filename = dlg.GetPath();
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) {
|
|||||||
#if wxUSE_FILEDLG
|
#if wxUSE_FILEDLG
|
||||||
wxString fname;
|
wxString fname;
|
||||||
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
|
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
|
||||||
wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
|
||||||
if (dlg.ShowModal() != wxID_OK) return;
|
if (dlg.ShowModal() != wxID_OK) return;
|
||||||
fname = dlg.GetPath ();
|
fname = dlg.GetPath ();
|
||||||
FileOpen (fname);
|
FileOpen (fname);
|
||||||
@ -373,7 +373,7 @@ void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) {
|
|||||||
if (!m_edit) return;
|
if (!m_edit) return;
|
||||||
#if wxUSE_FILEDLG
|
#if wxUSE_FILEDLG
|
||||||
wxString filename = wxEmptyString;
|
wxString filename = wxEmptyString;
|
||||||
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
|
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
if (dlg.ShowModal() != wxID_OK) return;
|
if (dlg.ShowModal() != wxID_OK) return;
|
||||||
filename = dlg.GetPath();
|
filename = dlg.GetPath();
|
||||||
m_edit->SaveFile (filename);
|
m_edit->SaveFile (filename);
|
||||||
|
@ -350,7 +350,7 @@ void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
|
|||||||
|
|
||||||
wxFileDialog dialog(this, wxT("Save Picture as"), wxEmptyString, pChild->GetTitle(),
|
wxFileDialog dialog(this, wxT("Save Picture as"), wxEmptyString, pChild->GetTitle(),
|
||||||
wxT("SVG vector picture files (*.svg)|*.svg"),
|
wxT("SVG vector picture files (*.svg)|*.svg"),
|
||||||
wxSAVE|wxOVERWRITE_PROMPT);
|
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
|
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
|
@ -126,14 +126,14 @@ void wxMainFrame::OnRc2Wxr(wxCommandEvent& WXUNUSED(event))
|
|||||||
#if wxUSE_FILEDLG
|
#if wxUSE_FILEDLG
|
||||||
wxFileDialog filed(this);
|
wxFileDialog filed(this);
|
||||||
filed.SetWildcard(_T("*.rc"));
|
filed.SetWildcard(_T("*.rc"));
|
||||||
filed.SetStyle(wxOPEN);
|
filed.SetStyle(wxFD_OPEN);
|
||||||
|
|
||||||
if (filed.ShowModal()!=wxID_OK)
|
if (filed.ShowModal()!=wxID_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxFileDialog wxrfile(this,_T("Enter Desired WXR file name"));
|
wxFileDialog wxrfile(this,_T("Enter Desired WXR file name"));
|
||||||
wxrfile.SetWildcard(_T("*.wxr"));
|
wxrfile.SetWildcard(_T("*.wxr"));
|
||||||
wxrfile.SetStyle(wxOPEN);
|
wxrfile.SetStyle(wxFD_OPEN);
|
||||||
wxrfile.SetFilename(_T("resource.wxr"));
|
wxrfile.SetFilename(_T("resource.wxr"));
|
||||||
|
|
||||||
if (wxrfile.ShowModal()!=wxID_OK)
|
if (wxrfile.ShowModal()!=wxID_OK)
|
||||||
@ -155,7 +155,7 @@ void wxMainFrame::OnWXR2XML(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxFileDialog xmlfile(this,_T("Enter Desired XML file name"));
|
wxFileDialog xmlfile(this,_T("Enter Desired XML file name"));
|
||||||
xmlfile.SetWildcard(_T("*.xml"));
|
xmlfile.SetWildcard(_T("*.xml"));
|
||||||
xmlfile.SetStyle(wxOPEN);
|
xmlfile.SetStyle(wxFD_OPEN);
|
||||||
xmlfile.SetFilename(_T("resource.xml"));
|
xmlfile.SetFilename(_T("resource.xml"));
|
||||||
|
|
||||||
if (xmlfile.ShowModal()!=wxID_OK)
|
if (xmlfile.ShowModal()!=wxID_OK)
|
||||||
@ -176,7 +176,7 @@ void wxMainFrame::OnRC2XML(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
wxFileDialog xmlfile(this,_T("Enter Desired XML file name"));
|
wxFileDialog xmlfile(this,_T("Enter Desired XML file name"));
|
||||||
xmlfile.SetWildcard(_T("*.xml"));
|
xmlfile.SetWildcard(_T("*.xml"));
|
||||||
xmlfile.SetStyle(wxOPEN);
|
xmlfile.SetStyle(wxFD_OPEN);
|
||||||
xmlfile.SetFilename(_T("resource.xml"));
|
xmlfile.SetFilename(_T("resource.xml"));
|
||||||
|
|
||||||
if (xmlfile.ShowModal()!=wxID_OK)
|
if (xmlfile.ShowModal()!=wxID_OK)
|
||||||
|
@ -16,14 +16,13 @@ This class represents the directory chooser dialog.
|
|||||||
\wxheading{Window styles}
|
\wxheading{Window styles}
|
||||||
|
|
||||||
\begin{twocollist}\itemsep=0pt
|
\begin{twocollist}\itemsep=0pt
|
||||||
\twocolitem{\windowstyle{wxDD\_DEFAULT\_STYLE}}{Equivalent to a combination of wxDEFAULT\_DIALOG\_STYLE, wxDD\_NEW\_DIR\_BUTTON and wxRESIZE\_BORDER (the last one is not used under wxWinCE).}
|
\twocolitem{\windowstyle{wxDD\_DEFAULT\_STYLE}}{Equivalent to a combination of wxDEFAULT\_DIALOG\_STYLE and wxRESIZE\_BORDER (the last one is not used under wxWinCE).}
|
||||||
\twocolitem{\windowstyle{wxDD\_NEW\_DIR\_BUTTON}}{Add "Create new
|
\twocolitem{\windowstyle{wxDD\_DIR_MUST_EXIST}}{The dialog will allow the user to choose only an existing folder. When this style is not given, a "Create new directory" button is added to the dialog (on Windows) or some other way is provided to the user to type the name of a new folder.}
|
||||||
directory" button and allow directory names to be editable. On
|
|
||||||
Windows the new directory button is only available with recent
|
|
||||||
versions of the common dialogs.}
|
|
||||||
\twocolitem{\windowstyle{wxDD\_CHANGE\_DIR}}{Change the current working directory to the directory chosen by the user.}
|
\twocolitem{\windowstyle{wxDD\_CHANGE\_DIR}}{Change the current working directory to the directory chosen by the user.}
|
||||||
\end{twocollist}
|
\end{twocollist}
|
||||||
|
|
||||||
|
{\bf NB:} on Windows the new directory button is only available with recent versions of the common dialogs.
|
||||||
|
|
||||||
See also \helpref{Generic window styles}{windowstyles}.
|
See also \helpref{Generic window styles}{windowstyles}.
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
@ -13,6 +13,26 @@ This class represents the file chooser dialog.
|
|||||||
|
|
||||||
<wx/filedlg.h>
|
<wx/filedlg.h>
|
||||||
|
|
||||||
|
\wxheading{Window styles}
|
||||||
|
|
||||||
|
\begin{twocollist}\itemsep=0pt
|
||||||
|
\twocolitem{\windowstyle{wxFD\_DEFAULT\_STYLE}}{Equivalent to wxFD_OPEN.}
|
||||||
|
\twocolitem{\windowstyle{wxFD\_OPEN}}{This is an open dialog; usually this means that the default button's label of the dialog is "Open". Cannot be combined with wxFD\_SAVE.}
|
||||||
|
\twocolitem{\windowstyle{wxFD\_SAVE}}{This is a save dialog; usually this means that the default button's label of the dialog is "Save". Cannot be combined with wxFD\_OPEN.}
|
||||||
|
\twocolitem{{\windowstyle wxFD\_OVERWRITE\_PROMPT}}{For save dialog only: prompt for a confirmation if a file will be overwritten.}
|
||||||
|
\twocolitem{{\windowstyle wxFD\_FILE\_MUST\_EXIST}}{For open dialog only: the user may only select files that actually exist.}
|
||||||
|
\twocolitem{{\windowstyle wxFD_MULTIPLE}}{For open dialog only: allows selecting multiple files.}
|
||||||
|
\twocolitem{{\windowstyle wxFD_CHANGE\_DIR}}{Change the current working directory to the directory where the file(s) chosen by the user are.}
|
||||||
|
\end{twocollist}
|
||||||
|
|
||||||
|
{\bf NB:} Previous versions of wxWidgets used {\tt wxFD_CHANGE\_DIR} by default
|
||||||
|
under MS Windows which allowed the program to simply remember the last
|
||||||
|
directory where user selected the files to open/save. This (desired)
|
||||||
|
functionality must be implemented in the program itself now (manually remember
|
||||||
|
the last path used and pass it to the dialog the next time it is called) or
|
||||||
|
by using this flag.
|
||||||
|
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{wxFileDialog overview}{wxfiledialogoverview}, \helpref{wxFileSelector}{wxfileselector}
|
\helpref{wxFileDialog overview}{wxfiledialogoverview}, \helpref{wxFileSelector}{wxfileselector}
|
||||||
@ -25,9 +45,7 @@ functionality. The path and filename are distinct elements of a full file pathna
|
|||||||
If path is ``", the current directory will be used. If filename is ``",
|
If path is ``", the current directory will be used. If filename is ``",
|
||||||
no default filename will be supplied. The wildcard determines what files
|
no default filename will be supplied. The wildcard determines what files
|
||||||
are displayed in the file selector, and file extension supplies a type
|
are displayed in the file selector, and file extension supplies a type
|
||||||
extension for the required filename. Flags may be a combination of wxOPEN,
|
extension for the required filename.
|
||||||
wxSAVE, wxOVERWRITE\_PROMPT, wxHIDE\_READONLY, wxFILE\_MUST\_EXIST,
|
|
||||||
wxMULTIPLE, wxCHANGE\_DIR or 0.
|
|
||||||
|
|
||||||
Both the X and Windows versions implement a wildcard filter. Typing a
|
Both the X and Windows versions implement a wildcard filter. Typing a
|
||||||
filename containing wildcards (*, ?) in the filename text item, and
|
filename containing wildcards (*, ?) in the filename text item, and
|
||||||
@ -52,7 +70,7 @@ is displayed as ``*.bmp'', and both
|
|||||||
|
|
||||||
\func{}{wxFileDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{message = "Choose a file"},\rtfsp
|
\func{}{wxFileDialog}{\param{wxWindow* }{parent}, \param{const wxString\& }{message = "Choose a file"},\rtfsp
|
||||||
\param{const wxString\& }{defaultDir = ""}, \param{const wxString\& }{defaultFile = ``"},\rtfsp
|
\param{const wxString\& }{defaultDir = ""}, \param{const wxString\& }{defaultFile = ``"},\rtfsp
|
||||||
\param{const wxString\& }{wildcard = ``*.*"}, \param{long }{style = 0}, \param{const wxPoint\& }{pos = wxDefaultPosition}}
|
\param{const wxString\& }{wildcard = ``*.*"}, \param{long }{style = wxFD\_DEFAULT\_STYLE}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{sz = wxDefaultSize}, \param{const wxString\& }{name = "filedlg"}}
|
||||||
|
|
||||||
Constructor. Use \helpref{wxFileDialog::ShowModal}{wxfiledialogshowmodal} to show the dialog.
|
Constructor. Use \helpref{wxFileDialog::ShowModal}{wxfiledialogshowmodal} to show the dialog.
|
||||||
|
|
||||||
@ -71,28 +89,14 @@ Constructor. Use \helpref{wxFileDialog::ShowModal}{wxfiledialogshowmodal} to sho
|
|||||||
Note that the native Motif dialog has some limitations with respect to
|
Note that the native Motif dialog has some limitations with respect to
|
||||||
wildcards; see the Remarks section above.}
|
wildcards; see the Remarks section above.}
|
||||||
|
|
||||||
\docparam{style}{A dialog style. A bitlist of:
|
\docparam{style}{A dialog style. See wxFD_* styles for more info.}
|
||||||
|
|
||||||
\twocolwidtha{5cm}
|
|
||||||
\begin{twocollist}
|
|
||||||
\twocolitem{{\bf wxOPEN}}{This is an open dialog.}
|
|
||||||
\twocolitem{{\bf wxSAVE}}{This is a save dialog.}
|
|
||||||
\twocolitem{{\bf wxOVERWRITE\_PROMPT}}{For save dialog only: prompt for a confirmation if a file will be overwritten.}
|
|
||||||
\twocolitem{{\bf wxHIDE\_READONLY}}{Do not display the checkbox to toggle display of read-only files. Deprecated in 2.6; the checkbox is never shown.}
|
|
||||||
\twocolitem{{\bf wxFILE\_MUST\_EXIST}}{The user may only select files that actually exist.}
|
|
||||||
\twocolitem{{\bf wxMULTIPLE}}{For open dialog only: allows selecting multiple files.}
|
|
||||||
\twocolitem{{\bf wxCHANGE\_DIR}}{Change the current working directory to the directory where the file(s) chosen by the user are.}
|
|
||||||
\end{twocollist}%
|
|
||||||
}
|
|
||||||
|
|
||||||
\docparam{pos}{Dialog position. Not implemented.}
|
\docparam{pos}{Dialog position. Not implemented.}
|
||||||
|
|
||||||
{\bf NB:} Previous versions of wxWidgets used {\tt wxCHANGE\_DIR} by default
|
\docparam{size}{Dialog size. Not implemented.}
|
||||||
under MS Windows which allowed the program to simply remember the last
|
|
||||||
directory where user selected the files to open/save. This (desired)
|
\docparam{name}{Dialog name. Not implemented.}
|
||||||
functionality must be implemented in the program itself now (manually remember
|
|
||||||
the last path used and pass it to the dialog the next time it is called) or
|
|
||||||
by using this flag.
|
|
||||||
|
|
||||||
\membersection{wxFileDialog::\destruct{wxFileDialog}}\label{wxfiledialogdtor}
|
\membersection{wxFileDialog::\destruct{wxFileDialog}}\label{wxfiledialogdtor}
|
||||||
|
|
||||||
@ -153,12 +157,6 @@ Fills the array {\it paths} with the full paths of the files chosen. This
|
|||||||
function should only be used with the dialogs which have {\tt wxMULTIPLE} style,
|
function should only be used with the dialogs which have {\tt wxMULTIPLE} style,
|
||||||
use \helpref{GetPath}{wxfiledialoggetpath} for the others.
|
use \helpref{GetPath}{wxfiledialoggetpath} for the others.
|
||||||
|
|
||||||
\membersection{wxFileDialog::GetStyle}\label{wxfiledialoggetstyle}
|
|
||||||
|
|
||||||
\constfunc{long}{GetStyle}{\void}
|
|
||||||
|
|
||||||
Returns the dialog style.
|
|
||||||
|
|
||||||
\membersection{wxFileDialog::GetWildcard}\label{wxfiledialoggetwildcard}
|
\membersection{wxFileDialog::GetWildcard}\label{wxfiledialoggetwildcard}
|
||||||
|
|
||||||
\constfunc{wxString}{GetWildcard}{\void}
|
\constfunc{wxString}{GetWildcard}{\void}
|
||||||
@ -195,12 +193,6 @@ Sets the message that will be displayed on the dialog.
|
|||||||
|
|
||||||
Sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
|
Sets the path (the combined directory and filename that will be returned when the dialog is dismissed).
|
||||||
|
|
||||||
\membersection{wxFileDialog::SetStyle}\label{wxfiledialogsetstyle}
|
|
||||||
|
|
||||||
\func{void}{SetStyle}{\param{long }{style}}
|
|
||||||
|
|
||||||
Sets the dialog style. See \helpref{wxFileDialog::wxFileDialog}{wxfiledialogctor} for details.
|
|
||||||
|
|
||||||
\membersection{wxFileDialog::SetWildcard}\label{wxfiledialogsetwildcard}
|
\membersection{wxFileDialog::SetWildcard}\label{wxfiledialogsetwildcard}
|
||||||
|
|
||||||
\func{void}{SetWildcard}{\param{const wxString\& }{wildCard}}
|
\func{void}{SetWildcard}{\param{const wxString\& }{wildCard}}
|
||||||
|
@ -29,8 +29,10 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr);
|
||||||
~wxFileDialog();
|
~wxFileDialog();
|
||||||
|
|
||||||
virtual void SetPath(const wxString& path);
|
virtual void SetPath(const wxString& path);
|
||||||
|
@ -1706,13 +1706,6 @@ enum wxBorder
|
|||||||
#define wxPD_REMAINING_TIME 0x0040
|
#define wxPD_REMAINING_TIME 0x0040
|
||||||
#define wxPD_CAN_SKIP 0x0080
|
#define wxPD_CAN_SKIP 0x0080
|
||||||
|
|
||||||
/*
|
|
||||||
* wxDirDialog styles
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define wxDD_NEW_DIR_BUTTON 0x0080
|
|
||||||
#define wxDD_CHANGE_DIR 0x0100
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* extended dialog specifiers. these values are stored in a different
|
* extended dialog specifiers. these values are stored in a different
|
||||||
|
@ -24,13 +24,13 @@ extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[];
|
|||||||
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[];
|
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[];
|
||||||
extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[];
|
extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[];
|
||||||
|
|
||||||
|
#define wxDD_DIR_MUST_EXIST 0x0080
|
||||||
|
#define wxDD_CHANGE_DIR 0x0100
|
||||||
|
|
||||||
#ifdef __WXWINCE__
|
#ifdef __WXWINCE__
|
||||||
#define wxDD_DEFAULT_STYLE \
|
#define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE
|
||||||
(wxDEFAULT_DIALOG_STYLE | wxDD_NEW_DIR_BUTTON)
|
|
||||||
#else
|
#else
|
||||||
#define wxDD_DEFAULT_STYLE \
|
#define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
|
||||||
(wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDD_NEW_DIR_BUTTON)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -85,59 +85,34 @@ protected:
|
|||||||
|
|
||||||
// Universal and non-port related switches with need for generic implementation
|
// Universal and non-port related switches with need for generic implementation
|
||||||
#if defined(__WXUNIVERSAL__)
|
#if defined(__WXUNIVERSAL__)
|
||||||
|
|
||||||
#include "wx/generic/dirdlgg.h"
|
#include "wx/generic/dirdlgg.h"
|
||||||
#define wxDirDialog wxGenericDirDialog
|
#define wxDirDialog wxGenericDirDialog
|
||||||
|
|
||||||
#elif defined(__WXMSW__) && (defined(__SALFORDC__) || \
|
#elif defined(__WXMSW__) && (defined(__SALFORDC__) || \
|
||||||
!wxUSE_OLE || \
|
!wxUSE_OLE || \
|
||||||
(defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS))
|
(defined (__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS))
|
||||||
|
|
||||||
#include "wx/generic/dirdlgg.h"
|
#include "wx/generic/dirdlgg.h"
|
||||||
#define wxDirDialog wxGenericDirDialog
|
#define wxDirDialog wxGenericDirDialog
|
||||||
|
|
||||||
// MS PocketPC or MS Smartphone
|
|
||||||
#elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__)
|
#elif defined(__WXMSW__) && defined(__WXWINCE__) && !defined(__HANDHELDPC__)
|
||||||
|
#include "wx/generic/dirdlgg.h" // MS PocketPC or MS Smartphone
|
||||||
#include "wx/generic/dirdlgg.h"
|
|
||||||
#define wxDirDialog wxGenericDirDialog
|
#define wxDirDialog wxGenericDirDialog
|
||||||
|
|
||||||
// Native MSW
|
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
|
#include "wx/msw/dirdlg.h" // Native MSW
|
||||||
#include "wx/msw/dirdlg.h"
|
#elif defined(__WXGTK24__)
|
||||||
|
#include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
|
||||||
// Native GTK for gtk2.x and generic for gtk1.x
|
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
|
|
||||||
#if defined( __WXGTK20__ )
|
|
||||||
#include "wx/gtk/dirdlg.h"
|
|
||||||
#define wxDirDialog wxDirDialogGTK
|
|
||||||
#else
|
|
||||||
#include "wx/generic/dirdlgg.h"
|
#include "wx/generic/dirdlgg.h"
|
||||||
#define wxDirDialog wxGenericDirDialog
|
#define wxDirDialog wxGenericDirDialog
|
||||||
#endif
|
|
||||||
|
|
||||||
// Native Mac
|
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
|
#include "wx/mac/dirdlg.h" // Native Mac
|
||||||
#include "wx/mac/dirdlg.h"
|
|
||||||
|
|
||||||
// Native Cocoa
|
|
||||||
#elif defined(__WXCOCOA__)
|
#elif defined(__WXCOCOA__)
|
||||||
|
#include "wx/cocoa/dirdlg.h" // Native Cocoa
|
||||||
#include "wx/cocoa/dirdlg.h"
|
|
||||||
|
|
||||||
// Other ports use generic implementation
|
|
||||||
#elif defined(__WXMOTIF__) || \
|
#elif defined(__WXMOTIF__) || \
|
||||||
defined(__WXX11__) || \
|
defined(__WXX11__) || \
|
||||||
defined(__WXMGL__) || \
|
defined(__WXMGL__) || \
|
||||||
defined(__WXCOCOA__) || \
|
defined(__WXCOCOA__) || \
|
||||||
defined(__WXPM__)
|
defined(__WXPM__)
|
||||||
|
#include "wx/generic/dirdlgg.h" // Other ports use generic implementation
|
||||||
#include "wx/generic/dirdlgg.h"
|
|
||||||
#define wxDirDialog wxGenericDirDialog
|
#define wxDirDialog wxGenericDirDialog
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
// wxFileDialog data
|
// wxFileDialog data
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
wxOPEN = 0x0001,
|
wxOPEN = 0x0001,
|
||||||
@ -35,7 +36,21 @@ enum
|
|||||||
wxMULTIPLE = 0x0020,
|
wxMULTIPLE = 0x0020,
|
||||||
wxCHANGE_DIR = 0x0040
|
wxCHANGE_DIR = 0x0040
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
wxFD_OPEN = 0x0001,
|
||||||
|
wxFD_SAVE = 0x0002,
|
||||||
|
wxFD_OVERWRITE_PROMPT = 0x0004,
|
||||||
|
wxFD_FILE_MUST_EXIST = 0x0010,
|
||||||
|
wxFD_MULTIPLE = 0x0020,
|
||||||
|
wxFD_CHANGE_DIR = 0x0040
|
||||||
|
};
|
||||||
|
|
||||||
|
#define wxFD_DEFAULT_STYLE wxFD_OPEN
|
||||||
|
|
||||||
|
extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[];
|
||||||
extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[];
|
extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorPromptStr[];
|
||||||
extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[];
|
extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[];
|
||||||
|
|
||||||
@ -53,11 +68,13 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition) : wxDialog()
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
Create(parent, message, defaultDir, defaultFile, wildCard, style, pos);
|
Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
@ -65,15 +82,16 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr);
|
||||||
|
|
||||||
virtual void SetMessage(const wxString& message) { m_message = message; }
|
virtual void SetMessage(const wxString& message) { m_message = message; }
|
||||||
virtual void SetPath(const wxString& path) { m_path = path; }
|
virtual void SetPath(const wxString& path) { m_path = path; }
|
||||||
virtual void SetDirectory(const wxString& dir) { m_dir = dir; }
|
virtual void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||||
virtual void SetFilename(const wxString& name) { m_fileName = name; }
|
virtual void SetFilename(const wxString& name) { m_fileName = name; }
|
||||||
virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
virtual void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||||
virtual void SetStyle(long style) { m_dialogStyle = style; }
|
|
||||||
virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
virtual void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
||||||
|
|
||||||
virtual wxString GetMessage() const { return m_message; }
|
virtual wxString GetMessage() const { return m_message; }
|
||||||
@ -83,7 +101,6 @@ public:
|
|||||||
virtual wxString GetFilename() const { return m_fileName; }
|
virtual wxString GetFilename() const { return m_fileName; }
|
||||||
virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); }
|
virtual void GetFilenames(wxArrayString& files) const { files.Empty(); files.Add(m_fileName); }
|
||||||
virtual wxString GetWildcard() const { return m_wildCard; }
|
virtual wxString GetWildcard() const { return m_wildCard; }
|
||||||
virtual long GetStyle() const { return m_dialogStyle; }
|
|
||||||
virtual int GetFilterIndex() const { return m_filterIndex; }
|
virtual int GetFilterIndex() const { return m_filterIndex; }
|
||||||
|
|
||||||
// Utility functions
|
// Utility functions
|
||||||
@ -108,7 +125,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_message;
|
wxString m_message;
|
||||||
long m_dialogStyle;
|
|
||||||
wxString m_dir;
|
wxString m_dir;
|
||||||
wxString m_path; // Full path
|
wxString m_path; // Full path
|
||||||
wxString m_fileName;
|
wxString m_fileName;
|
||||||
@ -168,8 +184,10 @@ wxSaveFileSelector(const wxChar *what,
|
|||||||
#include "wx/msw/filedlg.h"
|
#include "wx/msw/filedlg.h"
|
||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
#include "wx/motif/filedlg.h"
|
#include "wx/motif/filedlg.h"
|
||||||
|
#elif defined(__WXGTK24__)
|
||||||
|
#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version
|
||||||
#elif defined(__WXGTK20__)
|
#elif defined(__WXGTK20__)
|
||||||
#include "wx/gtk/filedlg.h"
|
#include "wx/generic/filedlgg.h"
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
#include "wx/gtk1/filedlg.h"
|
#include "wx/gtk1/filedlg.h"
|
||||||
#elif defined(__WXX11__)
|
#elif defined(__WXX11__)
|
||||||
|
@ -25,11 +25,9 @@ extern WXDLLEXPORT_DATA(const wxChar) wxDirSelectorPromptStr[];
|
|||||||
|
|
||||||
#ifndef wxDD_DEFAULT_STYLE
|
#ifndef wxDD_DEFAULT_STYLE
|
||||||
#ifdef __WXWINCE__
|
#ifdef __WXWINCE__
|
||||||
#define wxDD_DEFAULT_STYLE \
|
#define wxDD_DEFAULT_STYLE wxDEFAULT_DIALOG_STYLE
|
||||||
(wxDEFAULT_DIALOG_STYLE | wxDD_NEW_DIR_BUTTON)
|
|
||||||
#else
|
#else
|
||||||
#define wxDD_DEFAULT_STYLE \
|
#define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
|
||||||
(wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDD_NEW_DIR_BUTTON)
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -50,8 +50,10 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr,
|
||||||
bool bypassGenericImpl = false );
|
bool bypassGenericImpl = false );
|
||||||
|
|
||||||
bool Create( wxWindow *parent,
|
bool Create( wxWindow *parent,
|
||||||
@ -59,8 +61,10 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr,
|
||||||
bool bypassGenericImpl = false );
|
bool bypassGenericImpl = false );
|
||||||
|
|
||||||
virtual ~wxGenericFileDialog();
|
virtual ~wxGenericFileDialog();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: dirdlg.h
|
// Name: dirdlg.h
|
||||||
// Purpose: wxDirDialogGTK
|
// Purpose: wxDirDialog
|
||||||
// Author: Francesco Montorsi
|
// Author: Francesco Montorsi
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 2006 Francesco Montorsi
|
// Copyright: (c) 2006 Francesco Montorsi
|
||||||
@ -13,15 +13,15 @@
|
|||||||
#include "wx/generic/dirdlgg.h"
|
#include "wx/generic/dirdlgg.h"
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// wxDirDialogGTK
|
// wxDirDialog
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxDirDialogGTK : public wxGenericDirDialog
|
class WXDLLIMPEXP_CORE wxDirDialog : public wxGenericDirDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDirDialogGTK() { }
|
wxDirDialog() { }
|
||||||
|
|
||||||
wxDirDialogGTK(wxWindow *parent,
|
wxDirDialog(wxWindow *parent,
|
||||||
const wxString& message = wxDirSelectorPromptStr,
|
const wxString& message = wxDirSelectorPromptStr,
|
||||||
const wxString& defaultPath = wxEmptyString,
|
const wxString& defaultPath = wxEmptyString,
|
||||||
long style = wxDD_DEFAULT_STYLE,
|
long style = wxDD_DEFAULT_STYLE,
|
||||||
@ -29,7 +29,7 @@ public:
|
|||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxString& name = wxDirDialogNameStr);
|
const wxString& name = wxDirDialogNameStr);
|
||||||
|
|
||||||
virtual ~wxDirDialogGTK() {}
|
virtual ~wxDirDialog() { }
|
||||||
|
|
||||||
|
|
||||||
public: // overrides from wxGenericDirDialog
|
public: // overrides from wxGenericDirDialog
|
||||||
@ -50,7 +50,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxDirDialogGTK)
|
DECLARE_DYNAMIC_CLASS(wxDirDialog)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
void OnFakeOk( wxCommandEvent &event );
|
void OnFakeOk( wxCommandEvent &event );
|
||||||
};
|
};
|
||||||
|
@ -26,8 +26,10 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr);
|
||||||
|
|
||||||
virtual ~wxFileDialog() {}
|
virtual ~wxFileDialog() {}
|
||||||
|
|
||||||
|
@ -26,8 +26,10 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr);
|
||||||
|
|
||||||
virtual ~wxFileDialog();
|
virtual ~wxFileDialog();
|
||||||
|
|
||||||
|
@ -31,8 +31,10 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr);
|
||||||
|
|
||||||
virtual int ShowModal();
|
virtual int ShowModal();
|
||||||
};
|
};
|
||||||
|
@ -24,8 +24,10 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr);
|
||||||
|
|
||||||
virtual void SetPath(const wxString& path);
|
virtual void SetPath(const wxString& path);
|
||||||
virtual void GetPaths(wxArrayString& paths) const;
|
virtual void GetPaths(wxArrayString& paths) const;
|
||||||
|
@ -25,8 +25,10 @@ public:
|
|||||||
,const wxString& rsDefaultDir = wxEmptyString
|
,const wxString& rsDefaultDir = wxEmptyString
|
||||||
,const wxString& rsDefaultFile = wxEmptyString
|
,const wxString& rsDefaultFile = wxEmptyString
|
||||||
,const wxString& rsWildCard = wxFileSelectorDefaultWildcardStr
|
,const wxString& rsWildCard = wxFileSelectorDefaultWildcardStr
|
||||||
,long lStyle = 0
|
,long lStyle = wxFD_DEFAULT_STYLE
|
||||||
,const wxPoint& rPos = wxDefaultPosition
|
,const wxPoint& rPos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual void GetPaths(wxArrayString& rasPath) const;
|
virtual void GetPaths(wxArrayString& rasPath) const;
|
||||||
|
@ -24,8 +24,10 @@ public:
|
|||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = wxFD_DEFAULT_STYLE,
|
||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& sz = wxDefaultSize,
|
||||||
|
const wxString& name = wxFileDialogNameStr);
|
||||||
|
|
||||||
virtual void SetPath(const wxString& path);
|
virtual void SetPath(const wxString& path);
|
||||||
virtual void GetPaths(wxArrayString& paths) const;
|
virtual void GetPaths(wxArrayString& paths) const;
|
||||||
|
@ -597,7 +597,7 @@ public:
|
|||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
GetValue(),
|
GetValue(),
|
||||||
wxT("All files (*.*)|*.*"),
|
wxT("All files (*.*)|*.*"),
|
||||||
wxOPEN);
|
wxFD_OPEN);
|
||||||
|
|
||||||
if ( dlg.ShowModal() == wxID_OK )
|
if ( dlg.ShowModal() == wxID_OK )
|
||||||
{
|
{
|
||||||
|
@ -1712,7 +1712,7 @@ bool CeditorDlg::Initialize()
|
|||||||
|
|
||||||
void CeditorDlg::OnSelectPict()
|
void CeditorDlg::OnSelectPict()
|
||||||
{
|
{
|
||||||
wxFileDialog dlg(this, wxT("Choose an image file less than 60K"), wxEmptyString, wxEmptyString, wxT("JPEG files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif|BMP files (*.bmp)|*.bmp|All Files (*.*)|*.*"), wxOPEN);
|
wxFileDialog dlg(this, wxT("Choose an image file less than 60K"), wxEmptyString, wxEmptyString, wxT("JPEG files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif|BMP files (*.bmp)|*.bmp|All Files (*.*)|*.*"), wxFD_OPEN);
|
||||||
|
|
||||||
if (dlg.ShowModal() == wxID_OK)
|
if (dlg.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
|
@ -729,7 +729,7 @@ void MyFrame::FileOpen2(wxCommandEvent& WXUNUSED(event) )
|
|||||||
wxFileSelectorDefaultWildcardStr,
|
wxFileSelectorDefaultWildcardStr,
|
||||||
wxFileSelectorDefaultWildcardStr
|
wxFileSelectorDefaultWildcardStr
|
||||||
),
|
),
|
||||||
wxCHANGE_DIR,
|
wxFD_OPEN|wxFD_CHANGE_DIR,
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -758,7 +758,7 @@ void MyFrame::FilesOpen(wxCommandEvent& WXUNUSED(event) )
|
|||||||
#endif
|
#endif
|
||||||
wxFileDialog dialog(this, _T("Testing open multiple file dialog"),
|
wxFileDialog dialog(this, _T("Testing open multiple file dialog"),
|
||||||
wxEmptyString, wxEmptyString, wildcards,
|
wxEmptyString, wxEmptyString, wildcards,
|
||||||
wxMULTIPLE);
|
wxFD_OPEN|wxFD_MULTIPLE);
|
||||||
|
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
@ -791,7 +791,7 @@ void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
|
|||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
_T("myletter.doc"),
|
_T("myletter.doc"),
|
||||||
_T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
|
_T("Text files (*.txt)|*.txt|Document files (*.doc)|*.doc"),
|
||||||
wxSAVE|wxOVERWRITE_PROMPT);
|
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
|
|
||||||
dialog.SetFilterIndex(1);
|
dialog.SetFilterIndex(1);
|
||||||
|
|
||||||
@ -905,12 +905,12 @@ void MyFrame::DoDirChoose(int style)
|
|||||||
|
|
||||||
void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
DoDirChoose(wxDD_DEFAULT_STYLE & ~wxDD_NEW_DIR_BUTTON);
|
DoDirChoose(wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::DirChooseNew(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::DirChooseNew(wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
DoDirChoose(wxDD_DEFAULT_STYLE | wxDD_NEW_DIR_BUTTON);
|
DoDirChoose(wxDD_DEFAULT_STYLE & ~wxDD_DIR_MUST_EXIST);
|
||||||
}
|
}
|
||||||
#endif // wxUSE_DIRDLG
|
#endif // wxUSE_DIRDLG
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ public:
|
|||||||
wxT("PCX files (*.pcx)|*.pcx|")
|
wxT("PCX files (*.pcx)|*.pcx|")
|
||||||
wxT("ICO files (*.ico)|*.ico|")
|
wxT("ICO files (*.ico)|*.ico|")
|
||||||
wxT("CUR files (*.cur)|*.cur"),
|
wxT("CUR files (*.cur)|*.cur"),
|
||||||
wxSAVE,
|
wxFD_SAVE,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
if ( savefilename.empty() )
|
if ( savefilename.empty() )
|
||||||
|
@ -220,7 +220,7 @@ void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
wxFileDialog dialog( this, _T("Open text"), wxEmptyString, wxEmptyString,
|
wxFileDialog dialog( this, _T("Open text"), wxEmptyString, wxEmptyString,
|
||||||
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
|
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
|
||||||
wxOPEN|wxFILE_MUST_EXIST );
|
wxFD_OPEN|wxFD_FILE_MUST_EXIST );
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
m_text->Clear();
|
m_text->Clear();
|
||||||
@ -275,7 +275,7 @@ void MyFrame::OnSaveAs( wxCommandEvent& WXUNUSED(event) )
|
|||||||
#if wxUSE_FILEDLG
|
#if wxUSE_FILEDLG
|
||||||
wxFileDialog dialog( this, _T("Open text"), wxEmptyString, wxEmptyString,
|
wxFileDialog dialog( this, _T("Open text"), wxEmptyString, wxEmptyString,
|
||||||
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
|
_T("Text file (*.txt)|*.txt|Any file (*)|*"),
|
||||||
wxSAVE|wxOVERWRITE_PROMPT );
|
wxFD_SAVE|wxFD_OVERWRITE_PROMPT );
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
m_filename = dialog.GetPath();
|
m_filename = dialog.GetPath();
|
||||||
|
@ -108,7 +108,7 @@ void MyFrame::OnMenuFileOpen( wxCommandEvent& WXUNUSED(event) )
|
|||||||
#else
|
#else
|
||||||
wxT("DXF Drawing (*.dxf)|*.dxf)|All files (*.*)|*.*"),
|
wxT("DXF Drawing (*.dxf)|*.dxf)|All files (*.*)|*.*"),
|
||||||
#endif
|
#endif
|
||||||
wxOPEN);
|
wxFD_OPEN);
|
||||||
if (!filename.IsEmpty())
|
if (!filename.IsEmpty())
|
||||||
{
|
{
|
||||||
m_canvas->LoadDXF(filename);
|
m_canvas->LoadDXF(filename);
|
||||||
|
@ -721,7 +721,7 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
|||||||
path,
|
path,
|
||||||
filename,
|
filename,
|
||||||
filter,
|
filter,
|
||||||
wxOPEN);
|
wxFD_OPEN);
|
||||||
|
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
@ -759,7 +759,7 @@ void MyFrame::OnSaveAs(wxCommandEvent& WXUNUSED(event))
|
|||||||
path,
|
path,
|
||||||
filename,
|
filename,
|
||||||
filter,
|
filter,
|
||||||
wxSAVE);
|
wxFD_SAVE);
|
||||||
|
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
|
@ -984,7 +984,7 @@ void MyFrame::OnSelectFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
#if wxUSE_FILEDLG
|
#if wxUSE_FILEDLG
|
||||||
wxFileDialog dlg(this, _T("Choose a sound file"),
|
wxFileDialog dlg(this, _T("Choose a sound file"),
|
||||||
wxEmptyString, wxEmptyString,
|
wxEmptyString, wxEmptyString,
|
||||||
_T("WAV files (*.wav)|*.wav"), wxOPEN|wxCHANGE_DIR);
|
_T("WAV files (*.wav)|*.wav"), wxFD_OPEN|wxFD_CHANGE_DIR);
|
||||||
if ( dlg.ShowModal() == wxID_OK )
|
if ( dlg.ShowModal() == wxID_OK )
|
||||||
{
|
{
|
||||||
m_soundFile = dlg.GetPath();
|
m_soundFile = dlg.GetPath();
|
||||||
|
@ -508,7 +508,7 @@ bool Edit::LoadFile ()
|
|||||||
// get filname
|
// get filname
|
||||||
if (!m_filename) {
|
if (!m_filename) {
|
||||||
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
|
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString,
|
||||||
_T("Any file (*)|*"), wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
|
_T("Any file (*)|*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
|
||||||
if (dlg.ShowModal() != wxID_OK) return false;
|
if (dlg.ShowModal() != wxID_OK) return false;
|
||||||
m_filename = dlg.GetPath();
|
m_filename = dlg.GetPath();
|
||||||
}
|
}
|
||||||
@ -557,7 +557,7 @@ bool Edit::SaveFile ()
|
|||||||
// get filname
|
// get filname
|
||||||
if (!m_filename) {
|
if (!m_filename) {
|
||||||
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
|
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
|
||||||
wxSAVE | wxOVERWRITE_PROMPT);
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||||
if (dlg.ShowModal() != wxID_OK) return false;
|
if (dlg.ShowModal() != wxID_OK) return false;
|
||||||
m_filename = dlg.GetPath();
|
m_filename = dlg.GetPath();
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ void AppFrame::OnFileOpen (wxCommandEvent &WXUNUSED(event)) {
|
|||||||
#if wxUSE_FILEDLG
|
#if wxUSE_FILEDLG
|
||||||
wxString fname;
|
wxString fname;
|
||||||
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
|
wxFileDialog dlg (this, _T("Open file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"),
|
||||||
wxOPEN | wxFILE_MUST_EXIST | wxCHANGE_DIR);
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR);
|
||||||
if (dlg.ShowModal() != wxID_OK) return;
|
if (dlg.ShowModal() != wxID_OK) return;
|
||||||
fname = dlg.GetPath ();
|
fname = dlg.GetPath ();
|
||||||
FileOpen (fname);
|
FileOpen (fname);
|
||||||
@ -373,7 +373,7 @@ void AppFrame::OnFileSaveAs (wxCommandEvent &WXUNUSED(event)) {
|
|||||||
if (!m_edit) return;
|
if (!m_edit) return;
|
||||||
#if wxUSE_FILEDLG
|
#if wxUSE_FILEDLG
|
||||||
wxString filename = wxEmptyString;
|
wxString filename = wxEmptyString;
|
||||||
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxSAVE|wxOVERWRITE_PROMPT);
|
wxFileDialog dlg (this, _T("Save file"), wxEmptyString, wxEmptyString, _T("Any file (*)|*"), wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
if (dlg.ShowModal() != wxID_OK) return;
|
if (dlg.ShowModal() != wxID_OK) return;
|
||||||
filename = dlg.GetPath();
|
filename = dlg.GetPath();
|
||||||
m_edit->SaveFile (filename);
|
m_edit->SaveFile (filename);
|
||||||
|
@ -350,7 +350,7 @@ void MyFrame::FileSavePicture (wxCommandEvent & WXUNUSED(event) )
|
|||||||
|
|
||||||
wxFileDialog dialog(this, wxT("Save Picture as"), wxEmptyString, pChild->GetTitle(),
|
wxFileDialog dialog(this, wxT("Save Picture as"), wxEmptyString, pChild->GetTitle(),
|
||||||
wxT("SVG vector picture files (*.svg)|*.svg"),
|
wxT("SVG vector picture files (*.svg)|*.svg"),
|
||||||
wxSAVE|wxOVERWRITE_PROMPT);
|
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
|
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
|
@ -76,6 +76,7 @@ extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[] =
|
|||||||
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[] = wxT("wxDirCtrl");
|
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogNameStr[] = wxT("wxDirCtrl");
|
||||||
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[] = wxT("/");
|
extern WXDLLEXPORT_DATA(const wxChar) wxDirDialogDefaultFolderStr[] = wxT("/");
|
||||||
|
|
||||||
|
extern WXDLLEXPORT_DATA(const wxChar) wxFileDialogNameStr[] = wxT("filedlg");
|
||||||
#if defined(__WXMSW__) || defined(__OS2__)
|
#if defined(__WXMSW__) || defined(__OS2__)
|
||||||
WXDLLEXPORT_DATA(const wxChar *) wxUserResourceStr = wxT("TEXT");
|
WXDLLEXPORT_DATA(const wxChar *) wxUserResourceStr = wxT("TEXT");
|
||||||
#endif
|
#endif
|
||||||
|
@ -305,7 +305,7 @@ bool wxDocument::SaveAs()
|
|||||||
wxFileNameFromPath(GetFilename()),
|
wxFileNameFromPath(GetFilename()),
|
||||||
docTemplate->GetDefaultExtension(),
|
docTemplate->GetDefaultExtension(),
|
||||||
filter,
|
filter,
|
||||||
wxSAVE | wxOVERWRITE_PROMPT,
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT,
|
||||||
GetDocumentWindow());
|
GetDocumentWindow());
|
||||||
|
|
||||||
if (tmp.empty())
|
if (tmp.empty())
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
const wxChar wxDirSelectorPromptStr[] = wxT("Select a directory");
|
|
||||||
|
|
||||||
wxString wxDirSelector(const wxString& message,
|
wxString wxDirSelector(const wxString& message,
|
||||||
const wxString& defaultPath,
|
const wxString& defaultPath,
|
||||||
long style,
|
long style,
|
||||||
|
@ -35,7 +35,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog)
|
|||||||
void wxFileDialogBase::Init()
|
void wxFileDialogBase::Init()
|
||||||
{
|
{
|
||||||
m_filterIndex =
|
m_filterIndex =
|
||||||
m_dialogStyle = 0;
|
m_windowStyle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileDialogBase::Create(wxWindow *parent,
|
bool wxFileDialogBase::Create(wxWindow *parent,
|
||||||
@ -44,7 +44,9 @@ bool wxFileDialogBase::Create(wxWindow *parent,
|
|||||||
const wxString& defaultFile,
|
const wxString& defaultFile,
|
||||||
const wxString& wildCard,
|
const wxString& wildCard,
|
||||||
long style,
|
long style,
|
||||||
const wxPoint& WXUNUSED(pos))
|
const wxPoint& WXUNUSED(pos),
|
||||||
|
const wxSize& WXUNUSED(sz),
|
||||||
|
const wxString& WXUNUSED(name))
|
||||||
{
|
{
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dir = defaultDir;
|
m_dir = defaultDir;
|
||||||
@ -52,9 +54,20 @@ bool wxFileDialogBase::Create(wxWindow *parent,
|
|||||||
m_wildCard = wildCard;
|
m_wildCard = wildCard;
|
||||||
|
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_dialogStyle = style;
|
m_windowStyle = style;
|
||||||
m_filterIndex = 0;
|
m_filterIndex = 0;
|
||||||
|
|
||||||
|
#ifdef __WXDEBUG__
|
||||||
|
// check the given styles
|
||||||
|
wxASSERT_MSG(HasFlag(wxFD_OPEN) || HasFlag(wxFD_SAVE), wxT("You must specify one of wxFD_OPEN and wxFD_SAVE styles"));
|
||||||
|
if (HasFlag(wxFD_SAVE))
|
||||||
|
wxASSERT_MSG( !HasFlag(wxFD_OPEN) && !HasFlag(wxFD_MULTIPLE) && !HasFlag(wxFD_FILE_MUST_EXIST),
|
||||||
|
wxT("wxFileDialog - wxFD_OPEN, wxFD_MULTIPLE or wxFD_FILE_MUST_EXIST used on a save dialog" ) );
|
||||||
|
if (HasFlag(wxFD_OPEN))
|
||||||
|
wxASSERT_MSG( !HasFlag(wxFD_SAVE) && !HasFlag(wxFD_OVERWRITE_PROMPT),
|
||||||
|
wxT("wxFileDialog - wxFD_SAVE or wxFD_OVERWRITE_PROMPT used on a open dialog" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( wildCard.empty() || wildCard == wxFileSelectorDefaultWildcardStr )
|
if ( wildCard.empty() || wildCard == wxFileSelectorDefaultWildcardStr )
|
||||||
{
|
{
|
||||||
m_wildCard = wxString::Format(_("All files (%s)|%s"),
|
m_wildCard = wxString::Format(_("All files (%s)|%s"),
|
||||||
@ -270,7 +283,7 @@ static wxString wxDefaultFileSelector(bool load,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return wxFileSelector(prompt, NULL, default_name, ext, wild,
|
return wxFileSelector(prompt, NULL, default_name, ext, wild,
|
||||||
load ? wxOPEN : wxSAVE, parent);
|
load ? wxFD_OPEN : wxFD_SAVE, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -109,7 +109,7 @@ bool wxGenericDirDialog::Create(wxWindow* parent,
|
|||||||
wxMenu *dirMenu = new wxMenu;
|
wxMenu *dirMenu = new wxMenu;
|
||||||
dirMenu->Append(ID_GO_HOME, _("Home"));
|
dirMenu->Append(ID_GO_HOME, _("Home"));
|
||||||
|
|
||||||
if (style & wxDD_NEW_DIR_BUTTON)
|
if (!HasFlag(wxDD_DIR_MUST_EXIST))
|
||||||
{
|
{
|
||||||
dirMenu->Append(ID_NEW, _("New directory"));
|
dirMenu->Append(ID_NEW, _("New directory"));
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ bool wxGenericDirDialog::Create(wxWindow* parent,
|
|||||||
|
|
||||||
// I'm not convinced we need a New button, and we tend to get annoying
|
// I'm not convinced we need a New button, and we tend to get annoying
|
||||||
// accidental-editing with label editing enabled.
|
// accidental-editing with label editing enabled.
|
||||||
if (style & wxDD_NEW_DIR_BUTTON)
|
if (!HasFlag(wxDD_DIR_MUST_EXIST))
|
||||||
{
|
{
|
||||||
wxBitmapButton* newButton =
|
wxBitmapButton* newButton =
|
||||||
new wxBitmapButton(this, ID_NEW,
|
new wxBitmapButton(this, ID_NEW,
|
||||||
@ -158,7 +158,7 @@ bool wxGenericDirDialog::Create(wxWindow* parent,
|
|||||||
long dirStyle = wxDIRCTRL_DIR_ONLY | wxDEFAULT_CONTROL_BORDER;
|
long dirStyle = wxDIRCTRL_DIR_ONLY | wxDEFAULT_CONTROL_BORDER;
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
if (style & wxDD_NEW_DIR_BUTTON)
|
if (!HasFlag(wxDD_DIR_MUST_EXIST))
|
||||||
{
|
{
|
||||||
// Only under Windows do we need the wxTR_EDIT_LABEL tree control style
|
// Only under Windows do we need the wxTR_EDIT_LABEL tree control style
|
||||||
// before we can call EditLabel (required for "New directory")
|
// before we can call EditLabel (required for "New directory")
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
#include "wx/artprov.h"
|
#include "wx/artprov.h"
|
||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
#include "wx/file.h" // for wxS_IXXX constants only
|
#include "wx/file.h" // for wxS_IXXX constants only
|
||||||
#include "wx/filedlg.h" // wxOPEN, wxSAVE...
|
#include "wx/filedlg.h" // wxFD_OPEN, wxFD_SAVE...
|
||||||
#include "wx/generic/filedlgg.h"
|
#include "wx/generic/filedlgg.h"
|
||||||
#include "wx/generic/dirctrlg.h" // for wxFileIconsTable
|
#include "wx/generic/dirctrlg.h" // for wxFileIconsTable
|
||||||
|
|
||||||
@ -974,10 +974,12 @@ wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
|
|||||||
const wxString& wildCard,
|
const wxString& wildCard,
|
||||||
long style,
|
long style,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
|
const wxSize& sz,
|
||||||
|
const wxString& name,
|
||||||
bool bypassGenericImpl ) : wxFileDialogBase()
|
bool bypassGenericImpl ) : wxFileDialogBase()
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
Create( parent, message, defaultDir, defaultFile, wildCard, style, pos, bypassGenericImpl );
|
Create( parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name, bypassGenericImpl );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGenericFileDialog::Create( wxWindow *parent,
|
bool wxGenericFileDialog::Create( wxWindow *parent,
|
||||||
@ -987,12 +989,14 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
|
|||||||
const wxString& wildCard,
|
const wxString& wildCard,
|
||||||
long style,
|
long style,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
|
const wxSize& sz,
|
||||||
|
const wxString& name,
|
||||||
bool bypassGenericImpl )
|
bool bypassGenericImpl )
|
||||||
{
|
{
|
||||||
m_bypassGenericImpl = bypassGenericImpl;
|
m_bypassGenericImpl = bypassGenericImpl;
|
||||||
|
|
||||||
if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFile,
|
if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFile,
|
||||||
wildCard, style, pos))
|
wildCard, style, pos, sz, name))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1000,8 +1004,8 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
|
|||||||
if (m_bypassGenericImpl)
|
if (m_bypassGenericImpl)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize,
|
if (!wxDialog::Create( parent, wxID_ANY, message, pos, sz,
|
||||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER, name
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -1017,11 +1021,6 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
|
|||||||
&ms_lastShowHidden);
|
&ms_lastShowHidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dialogStyle == 0)
|
|
||||||
m_dialogStyle = wxOPEN;
|
|
||||||
if ((m_dialogStyle & wxMULTIPLE ) && !(m_dialogStyle & wxOPEN))
|
|
||||||
m_dialogStyle |= wxOPEN;
|
|
||||||
|
|
||||||
if ((m_dir.empty()) || (m_dir == wxT(".")))
|
if ((m_dir.empty()) || (m_dir == wxT(".")))
|
||||||
{
|
{
|
||||||
m_dir = wxGetCwd();
|
m_dir = wxGetCwd();
|
||||||
@ -1102,7 +1101,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
|
|||||||
mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 );
|
mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 );
|
||||||
|
|
||||||
long style2 = ms_lastViewStyle;
|
long style2 = ms_lastViewStyle;
|
||||||
if ( !(m_dialogStyle & wxMULTIPLE) )
|
if ( !HasFlag(wxFD_MULTIPLE) )
|
||||||
style2 |= wxLC_SINGLE_SEL;
|
style2 |= wxLC_SINGLE_SEL;
|
||||||
|
|
||||||
#ifdef __WXWINCE__
|
#ifdef __WXWINCE__
|
||||||
@ -1404,7 +1403,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
|
|||||||
}
|
}
|
||||||
#endif // __UNIX__
|
#endif // __UNIX__
|
||||||
|
|
||||||
if (!(m_dialogStyle & wxSAVE))
|
if (!HasFlag(wxFD_SAVE))
|
||||||
{
|
{
|
||||||
if ((filename.Find(wxT('*')) != wxNOT_FOUND) ||
|
if ((filename.Find(wxT('*')) != wxNOT_FOUND) ||
|
||||||
(filename.Find(wxT('?')) != wxNOT_FOUND))
|
(filename.Find(wxT('?')) != wxNOT_FOUND))
|
||||||
@ -1449,14 +1448,13 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
|
|||||||
// VZ: the logic of testing for !wxFileExists() only for the open file
|
// VZ: the logic of testing for !wxFileExists() only for the open file
|
||||||
// dialog is not entirely clear to me, why don't we allow saving to a
|
// dialog is not entirely clear to me, why don't we allow saving to a
|
||||||
// file without extension as well?
|
// file without extension as well?
|
||||||
if ( !(m_dialogStyle & wxOPEN) || !wxFileExists(filename) )
|
if ( !HasFlag(wxFD_OPEN) || !wxFileExists(filename) )
|
||||||
{
|
{
|
||||||
filename = AppendExtension(filename, m_filterExtension);
|
filename = AppendExtension(filename, m_filterExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check that the file [doesn't] exist if necessary
|
// check that the file [doesn't] exist if necessary
|
||||||
if ( (m_dialogStyle & wxSAVE) &&
|
if ( HasFlag(wxFD_SAVE) && HasFlag(wxFD_OVERWRITE_PROMPT) &&
|
||||||
(m_dialogStyle & wxOVERWRITE_PROMPT) &&
|
|
||||||
wxFileExists( filename ) )
|
wxFileExists( filename ) )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
@ -1465,8 +1463,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
|
|||||||
if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES)
|
if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ( (m_dialogStyle & wxOPEN) &&
|
else if ( HasFlag(wxFD_OPEN) && HasFlag(wxFD_FILE_MUST_EXIST) &&
|
||||||
(m_dialogStyle & wxFILE_MUST_EXIST) &&
|
|
||||||
!wxFileExists(filename) )
|
!wxFileExists(filename) )
|
||||||
{
|
{
|
||||||
wxMessageBox(_("Please choose an existing file."), _("Error"),
|
wxMessageBox(_("Please choose an existing file."), _("Error"),
|
||||||
@ -1476,7 +1473,7 @@ void wxGenericFileDialog::HandleAction( const wxString &fn )
|
|||||||
SetPath( filename );
|
SetPath( filename );
|
||||||
|
|
||||||
// change to the directory where the user went if asked
|
// change to the directory where the user went if asked
|
||||||
if ( m_dialogStyle & wxCHANGE_DIR )
|
if ( HasFlag(wxFD_CHANGE_DIR) )
|
||||||
{
|
{
|
||||||
wxString cwd;
|
wxString cwd;
|
||||||
wxSplitPath(filename, &cwd, NULL, NULL);
|
wxSplitPath(filename, &cwd, NULL, NULL);
|
||||||
|
@ -295,7 +295,7 @@ void wxGenericPrintDialog::OnOK(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxFileName fname( m_printDialogData.GetPrintData().GetFilename() );
|
wxFileName fname( m_printDialogData.GetPrintData().GetFilename() );
|
||||||
|
|
||||||
wxFileDialog dialog( this, _("PostScript file"),
|
wxFileDialog dialog( this, _("PostScript file"),
|
||||||
fname.GetPath(), fname.GetFullName(), wxT("*.ps"), wxSAVE | wxOVERWRITE_PROMPT );
|
fname.GetPath(), fname.GetFullName(), wxT("*.ps"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
if (dialog.ShowModal() != wxID_OK) return;
|
if (dialog.ShowModal() != wxID_OK) return;
|
||||||
|
|
||||||
m_printDialogData.GetPrintData().SetFilename( dialog.GetPath() );
|
m_printDialogData.GetPrintData().SetFilename( dialog.GetPath() );
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/gtk/dirdlg.cpp
|
// Name: src/gtk/dirdlg.cpp
|
||||||
// Purpose: native implementation of wxDirDialogGTK
|
// Purpose: native implementation of wxDirDialog
|
||||||
// Author: Robert Roebling, Zbigniew Zagorski, Mart Raudsepp, Francesco Montorsi
|
// Author: Robert Roebling, Zbigniew Zagorski, Mart Raudsepp, Francesco Montorsi
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling, 2004 Zbigniew Zagorski, 2005 Mart Raudsepp
|
// Copyright: (c) 1998 Robert Roebling, 2004 Zbigniew Zagorski, 2005 Mart Raudsepp
|
||||||
@ -13,14 +13,14 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE: the GtkFileChooser interface can be used both for wxFileDialog and for wxDirDialogGTK.
|
NOTE: the GtkFileChooser interface can be used both for wxFileDialog and for wxDirDialog.
|
||||||
Thus following code is very similar (even if not identic) to src/gtk/filedlg.cpp
|
Thus following code is very similar (even if not identic) to src/gtk/filedlg.cpp
|
||||||
If you find a problem in this code, remember to check also that file !
|
If you find a problem in this code, remember to check also that file !
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_DIRDLG
|
#if wxUSE_DIRDLG && defined( __WXGTK24__ )
|
||||||
|
|
||||||
#include "wx/dirdlg.h"
|
#include "wx/dirdlg.h"
|
||||||
|
|
||||||
@ -29,8 +29,6 @@
|
|||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXGTK24__ // only for GTK+ > 2.4 there is GtkFileChooserDialog
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "wx/gtk/private.h"
|
#include "wx/gtk/private.h"
|
||||||
|
|
||||||
@ -48,7 +46,7 @@ extern void wxapp_install_idle_handler();
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
static void gtk_dirdialog_ok_callback(GtkWidget *widget, wxDirDialogGTK *dialog)
|
static void gtk_dirdialog_ok_callback(GtkWidget *widget, wxDirDialog *dialog)
|
||||||
{
|
{
|
||||||
gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
|
gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
|
||||||
|
|
||||||
@ -70,7 +68,7 @@ static void gtk_dirdialog_ok_callback(GtkWidget *widget, wxDirDialogGTK *dialog)
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
static void gtk_dirdialog_cancel_callback(GtkWidget *WXUNUSED(w),
|
static void gtk_dirdialog_cancel_callback(GtkWidget *WXUNUSED(w),
|
||||||
wxDirDialogGTK *dialog)
|
wxDirDialog *dialog)
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
||||||
event.SetEventObject(dialog);
|
event.SetEventObject(dialog);
|
||||||
@ -81,7 +79,7 @@ static void gtk_dirdialog_cancel_callback(GtkWidget *WXUNUSED(w),
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
static void gtk_dirdialog_response_callback(GtkWidget *w,
|
static void gtk_dirdialog_response_callback(GtkWidget *w,
|
||||||
gint response,
|
gint response,
|
||||||
wxDirDialogGTK *dialog)
|
wxDirDialog *dialog)
|
||||||
{
|
{
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
@ -92,24 +90,21 @@ static void gtk_dirdialog_response_callback(GtkWidget *w,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __WXGTK24__
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxDirDialogGTK
|
// wxDirDialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxDirDialogGTK,wxGenericDirDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxDirDialog,wxGenericDirDialog)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxDirDialogGTK,wxGenericDirDialog)
|
BEGIN_EVENT_TABLE(wxDirDialog,wxGenericDirDialog)
|
||||||
EVT_BUTTON(wxID_OK, wxDirDialogGTK::OnFakeOk)
|
EVT_BUTTON(wxID_OK, wxDirDialog::OnFakeOk)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
|
wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
|
||||||
const wxString& defaultPath, long style,
|
const wxString& defaultPath, long style,
|
||||||
const wxPoint& pos, const wxSize& sz,
|
const wxPoint& pos, const wxSize& sz,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
m_message = title;
|
m_message = title;
|
||||||
@ -119,7 +114,7 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
|
|||||||
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
|
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
|
||||||
wxDefaultValidator, wxT("dirdialog")))
|
wxDefaultValidator, wxT("dirdialog")))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxDirDialogGTK creation failed") );
|
wxFAIL_MSG( wxT("wxDirDialog creation failed") );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,8 +123,9 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
|
|||||||
if (parent)
|
if (parent)
|
||||||
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
|
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
|
||||||
|
|
||||||
|
if (HasFlag(wxDD_DIR_MUST_EXIST))
|
||||||
gtk_action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
gtk_action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
||||||
if (style & wxDD_NEW_DIR_BUTTON)
|
else
|
||||||
gtk_action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
|
gtk_action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
|
||||||
|
|
||||||
m_widget = gtk_file_chooser_dialog_new(
|
m_widget = gtk_file_chooser_dialog_new(
|
||||||
@ -169,37 +165,31 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
|
|||||||
wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
|
wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDirDialogGTK::OnFakeOk( wxCommandEvent &event )
|
void wxDirDialog::OnFakeOk( wxCommandEvent &event )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
wxDialog::OnOK( event );
|
wxDialog::OnOK( event );
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericDirDialog::OnOK( event );
|
wxGenericDirDialog::OnOK( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDirDialogGTK::ShowModal()
|
int wxDirDialog::ShowModal()
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxDialog::ShowModal();
|
return wxDialog::ShowModal();
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return wxGenericDirDialog::ShowModal();
|
return wxGenericDirDialog::ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDirDialogGTK::Show( bool show )
|
bool wxDirDialog::Show( bool show )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxDialog::Show( show );
|
return wxDialog::Show( show );
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return wxGenericDirDialog::Show( show );
|
return wxGenericDirDialog::Show( show );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDirDialogGTK::DoSetSize(int x, int y, int width, int height, int sizeFlags )
|
void wxDirDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
if (!m_wxwindow)
|
if (!m_wxwindow)
|
||||||
return;
|
return;
|
||||||
@ -207,9 +197,8 @@ void wxDirDialogGTK::DoSetSize(int x, int y, int width, int height, int sizeFlag
|
|||||||
wxGenericDirDialog::DoSetSize( x, y, width, height, sizeFlags );
|
wxGenericDirDialog::DoSetSize( x, y, width, height, sizeFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDirDialogGTK::SetPath(const wxString& dir)
|
void wxDirDialog::SetPath(const wxString& dir)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
if (wxDirExists(dir))
|
if (wxDirExists(dir))
|
||||||
@ -218,17 +207,14 @@ void wxDirDialogGTK::SetPath(const wxString& dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericDirDialog::SetPath( dir );
|
wxGenericDirDialog::SetPath( dir );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxDirDialogGTK::GetPath() const
|
wxString wxDirDialog::GetPath() const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxConvFileName->cMB2WX( gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(m_widget) ) );
|
return wxConvFileName->cMB2WX( gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(m_widget) ) );
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return wxGenericDirDialog::GetPath();
|
return wxGenericDirDialog::GetPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_FILEDLG
|
#if wxUSE_FILEDLG && defined(__WXGTK24__)
|
||||||
|
|
||||||
#include "wx/filedlg.h"
|
#include "wx/filedlg.h"
|
||||||
|
|
||||||
@ -19,8 +19,6 @@
|
|||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "wx/gtk/private.h"
|
#include "wx/gtk/private.h"
|
||||||
|
|
||||||
@ -43,14 +41,14 @@ extern void wxapp_install_idle_handler();
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
|
static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
|
||||||
{
|
{
|
||||||
int style = dialog->GetStyle();
|
int style = dialog->GetWindowStyle();
|
||||||
gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
|
gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
|
||||||
|
|
||||||
// gtk version numbers must be identical with the one in ctor (that calls set_do_overwrite_confirmation)
|
// gtk version numbers must be identical with the one in ctor (that calls set_do_overwrite_confirmation)
|
||||||
#if GTK_CHECK_VERSION(2,7,3)
|
#if GTK_CHECK_VERSION(2,7,3)
|
||||||
if(gtk_check_version(2,7,3) != NULL)
|
if(gtk_check_version(2,7,3) != NULL)
|
||||||
#endif
|
#endif
|
||||||
if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT))
|
if ((style & wxFD_SAVE) && (style & wxFD_OVERWRITE_PROMPT))
|
||||||
{
|
{
|
||||||
if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
|
if ( g_file_test(filename, G_FILE_TEST_EXISTS) )
|
||||||
{
|
{
|
||||||
@ -68,7 +66,7 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// change to the directory where the user went if asked
|
// change to the directory where the user went if asked
|
||||||
if (style & wxCHANGE_DIR)
|
if (style & wxFD_CHANGE_DIR)
|
||||||
{
|
{
|
||||||
// Use chdir to not care about filename encodings
|
// Use chdir to not care about filename encodings
|
||||||
gchar* folder = g_path_get_dirname(filename);
|
gchar* folder = g_path_get_dirname(filename);
|
||||||
@ -111,7 +109,6 @@ static void gtk_filedialog_response_callback(GtkWidget *w,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __WXGTK24__
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxFileDialog
|
// wxFileDialog
|
||||||
@ -127,14 +124,14 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
const wxString& defaultDir,
|
const wxString& defaultDir,
|
||||||
const wxString& defaultFileName,
|
const wxString& defaultFileName,
|
||||||
const wxString& wildCard,
|
const wxString& wildCard,
|
||||||
long style, const wxPoint& pos)
|
long style, const wxPoint& pos,
|
||||||
|
const wxSize& sz,
|
||||||
|
const wxString& name)
|
||||||
: wxGenericFileDialog(parent, message, defaultDir, defaultFileName,
|
: wxGenericFileDialog(parent, message, defaultDir, defaultFileName,
|
||||||
wildCard, style, pos, true )
|
wildCard, style, pos, sz, name, true )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !( (style & wxSAVE) && (style & wxMULTIPLE) ), wxT("wxFileDialog - wxMULTIPLE used on a save dialog" ) );
|
|
||||||
m_needParent = false;
|
m_needParent = false;
|
||||||
|
|
||||||
if (!PreCreation(parent, pos, wxDefaultSize) ||
|
if (!PreCreation(parent, pos, wxDefaultSize) ||
|
||||||
@ -151,7 +148,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
|
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
|
||||||
|
|
||||||
const gchar* ok_btn_stock;
|
const gchar* ok_btn_stock;
|
||||||
if ( style & wxSAVE )
|
if ( style & wxFD_SAVE )
|
||||||
{
|
{
|
||||||
gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
|
gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
|
||||||
ok_btn_stock = GTK_STOCK_SAVE;
|
ok_btn_stock = GTK_STOCK_SAVE;
|
||||||
@ -172,7 +169,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
|
|
||||||
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
|
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
|
||||||
|
|
||||||
if ( style & wxMULTIPLE )
|
if ( style & wxFD_MULTIPLE )
|
||||||
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(m_widget), true);
|
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(m_widget), true);
|
||||||
|
|
||||||
// gtk_widget_hide_on_delete is used here to avoid that Gtk automatically destroys
|
// gtk_widget_hide_on_delete is used here to avoid that Gtk automatically destroys
|
||||||
@ -195,7 +192,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
|
|
||||||
SetWildcard(wildCard);
|
SetWildcard(wildCard);
|
||||||
|
|
||||||
if ( style & wxSAVE )
|
if ( style & wxFD_SAVE )
|
||||||
{
|
{
|
||||||
if ( !defaultDir.empty() )
|
if ( !defaultDir.empty() )
|
||||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
|
||||||
@ -229,37 +226,30 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );
|
wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::OnFakeOk( wxCommandEvent &event )
|
void wxFileDialog::OnFakeOk( wxCommandEvent &event )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
wxDialog::OnOK( event );
|
wxDialog::OnOK( event );
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::OnListOk( event );
|
wxGenericFileDialog::OnListOk( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxFileDialog::ShowModal()
|
int wxFileDialog::ShowModal()
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxDialog::ShowModal();
|
return wxDialog::ShowModal();
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return wxGenericFileDialog::ShowModal();
|
return wxGenericFileDialog::ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileDialog::Show( bool show )
|
bool wxFileDialog::Show( bool show )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxDialog::Show( show );
|
return wxDialog::Show( show );
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return wxGenericFileDialog::Show( show );
|
return wxGenericFileDialog::Show( show );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,17 +263,14 @@ void wxFileDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags
|
|||||||
|
|
||||||
wxString wxFileDialog::GetPath() const
|
wxString wxFileDialog::GetPath() const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxConvFileName->cMB2WX(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
|
return wxConvFileName->cMB2WX(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return wxGenericFileDialog::GetPath();
|
return wxGenericFileDialog::GetPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
GetPaths(files);
|
GetPaths(files);
|
||||||
@ -294,13 +281,11 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::GetFilenames( files );
|
wxGenericFileDialog::GetFilenames( files );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::GetPaths(wxArrayString& paths) const
|
void wxFileDialog::GetPaths(wxArrayString& paths) const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
paths.Empty();
|
paths.Empty();
|
||||||
@ -322,26 +307,22 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const
|
|||||||
paths.Add(GetPath());
|
paths.Add(GetPath());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::GetPaths( paths );
|
wxGenericFileDialog::GetPaths( paths );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetMessage(const wxString& message)
|
void wxFileDialog::SetMessage(const wxString& message)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
m_message = message;
|
m_message = message;
|
||||||
SetTitle(message);
|
SetTitle(message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::SetMessage( message );
|
wxGenericFileDialog::SetMessage( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetPath(const wxString& path)
|
void wxFileDialog::SetPath(const wxString& path)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
if (path.empty()) return;
|
if (path.empty()) return;
|
||||||
@ -349,13 +330,11 @@ void wxFileDialog::SetPath(const wxString& path)
|
|||||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(path));
|
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(path));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::SetPath( path );
|
wxGenericFileDialog::SetPath( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetDirectory(const wxString& dir)
|
void wxFileDialog::SetDirectory(const wxString& dir)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
if (wxDirExists(dir))
|
if (wxDirExists(dir))
|
||||||
@ -364,50 +343,42 @@ void wxFileDialog::SetDirectory(const wxString& dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::SetDirectory( dir );
|
wxGenericFileDialog::SetDirectory( dir );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFileDialog::GetDirectory() const
|
wxString wxFileDialog::GetDirectory() const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxConvFileName->cMB2WX(
|
return wxConvFileName->cMB2WX(
|
||||||
gtk_file_chooser_get_current_folder( GTK_FILE_CHOOSER(m_widget) ) );
|
gtk_file_chooser_get_current_folder( GTK_FILE_CHOOSER(m_widget) ) );
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return wxGenericFileDialog::GetDirectory();
|
return wxGenericFileDialog::GetDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetFilename(const wxString& name)
|
void wxFileDialog::SetFilename(const wxString& name)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
if (GetStyle() & wxSAVE)
|
if (HasFlag(wxFD_SAVE))
|
||||||
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(name));
|
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(name));
|
||||||
else
|
else
|
||||||
SetPath(wxFileName(GetDirectory(), name).GetFullPath());
|
SetPath(wxFileName(GetDirectory(), name).GetFullPath());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::SetFilename( name );
|
wxGenericFileDialog::SetFilename( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFileDialog::GetFilename() const
|
wxString wxFileDialog::GetFilename() const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxFileName(
|
return wxFileName(
|
||||||
wxConvFileName->cMB2WX(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget))) ).GetFullName();
|
wxConvFileName->cMB2WX(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget))) ).GetFullName();
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return wxGenericFileDialog::GetFilename();
|
return wxGenericFileDialog::GetFilename();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetWildcard(const wxString& wildCard)
|
void wxFileDialog::SetWildcard(const wxString& wildCard)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
// parse filters
|
// parse filters
|
||||||
@ -455,13 +426,12 @@ void wxFileDialog::SetWildcard(const wxString& wildCard)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::SetWildcard( wildCard );
|
wxGenericFileDialog::SetWildcard( wildCard );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetFilterIndex(int filterIndex)
|
void wxFileDialog::SetFilterIndex(int filterIndex)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
gpointer filter;
|
gpointer filter;
|
||||||
@ -482,13 +452,11 @@ void wxFileDialog::SetFilterIndex(int filterIndex)
|
|||||||
g_slist_free(filters);
|
g_slist_free(filters);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
wxGenericFileDialog::SetFilterIndex( filterIndex );
|
wxGenericFileDialog::SetFilterIndex( filterIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxFileDialog::GetFilterIndex() const
|
int wxFileDialog::GetFilterIndex() const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
|
GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
|
||||||
@ -506,8 +474,7 @@ int wxFileDialog::GetFilterIndex() const
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return wxGenericFileDialog::GetFilterIndex();
|
return wxGenericFileDialog::GetFilterIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_FILEDLG
|
#endif // wxUSE_FILEDLG && __WXGTK24__
|
||||||
|
@ -29,11 +29,13 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
const wxString& defaultDir,
|
const wxString& defaultDir,
|
||||||
const wxString& defaultFileName,
|
const wxString& defaultFileName,
|
||||||
const wxString& wildCard,
|
const wxString& wildCard,
|
||||||
long style, const wxPoint& pos)
|
long style, const wxPoint& pos,
|
||||||
|
const wxSize& sz,
|
||||||
|
const wxString& name)
|
||||||
: wxGenericFileDialog(parent, message, defaultDir, defaultFileName,
|
: wxGenericFileDialog(parent, message, defaultDir, defaultFileName,
|
||||||
wildCard, style, pos, true )
|
wildCard, style, pos, sz, name, true )
|
||||||
{
|
{
|
||||||
wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );
|
wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileDialog::~wxFileDialog()
|
wxFileDialog::~wxFileDialog()
|
||||||
|
@ -1533,7 +1533,7 @@ void wxHtmlHelpWindow::OnToolbar(wxCommandEvent& event)
|
|||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
filemask,
|
filemask,
|
||||||
wxOPEN | wxFILE_MUST_EXIST,
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST,
|
||||||
this);
|
this);
|
||||||
if (!s.empty())
|
if (!s.empty())
|
||||||
{
|
{
|
||||||
|
@ -259,8 +259,8 @@ static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dat
|
|||||||
wxFileDialog::wxFileDialog(
|
wxFileDialog::wxFileDialog(
|
||||||
wxWindow *parent, const wxString& message,
|
wxWindow *parent, const wxString& message,
|
||||||
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
||||||
long style, const wxPoint& pos)
|
long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
|
||||||
: wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
: wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (HasFlag(wxFD_SAVE))
|
||||||
{
|
{
|
||||||
myData.saveMode = true;
|
myData.saveMode = true;
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ int wxFileDialog::ShowModal()
|
|||||||
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
|
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
|
||||||
|
|
||||||
#if TARGET_API_MAC_OSX
|
#if TARGET_API_MAC_OSX
|
||||||
if (!(m_dialogStyle & wxOVERWRITE_PROMPT))
|
if (!(m_windowStyle & wxOVERWRITE_PROMPT))
|
||||||
dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement;
|
dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ int wxFileDialog::ShowModal()
|
|||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (HasFlag(wxFD_SAVE))
|
||||||
thePath = wxMacFSRefToPath( &theFSRef, navReply.saveFileName );
|
thePath = wxMacFSRefToPath( &theFSRef, navReply.saveFileName );
|
||||||
else
|
else
|
||||||
thePath = wxMacFSRefToPath( &theFSRef );
|
thePath = wxMacFSRefToPath( &theFSRef );
|
||||||
|
@ -43,7 +43,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
m_windowStyle = style;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_path = defaultPath;
|
m_path = defaultPath;
|
||||||
}
|
}
|
||||||
|
@ -292,8 +292,8 @@ static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dat
|
|||||||
|
|
||||||
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||||
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
||||||
long style, const wxPoint& pos)
|
long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
|
||||||
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ int wxFileDialog::ShowModal()
|
|||||||
OpenUserDataRec myData;
|
OpenUserDataRec myData;
|
||||||
myData.defaultLocation = m_dir;
|
myData.defaultLocation = m_dir;
|
||||||
|
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (HasFlag(wxFD_SAVE))
|
||||||
{
|
{
|
||||||
dialogCreateOptions.optionFlags |= kNavNoTypePopup;
|
dialogCreateOptions.optionFlags |= kNavNoTypePopup;
|
||||||
dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
|
dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
|
||||||
@ -445,7 +445,7 @@ int wxFileDialog::ShowModal()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
CFURLRef fullURLRef;
|
CFURLRef fullURLRef;
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (HasFlag(wxFD_SAVE))
|
||||||
{
|
{
|
||||||
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
|
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
|
||||||
|
|
||||||
@ -562,7 +562,7 @@ int wxFileDialog::ShowModal()
|
|||||||
wxMacStringToPascal( myData.name[i] , (StringPtr)(*mNavOptions.popupExtension)[i].menuItemName ) ;
|
wxMacStringToPascal( myData.name[i] , (StringPtr)(*mNavOptions.popupExtension)[i].menuItemName ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( m_dialogStyle & wxSAVE )
|
if ( HasFlag(wxFD_SAVE) )
|
||||||
{
|
{
|
||||||
myData.saveMode = true ;
|
myData.saveMode = true ;
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ int wxFileDialog::ShowModal()
|
|||||||
myData.saveMode = false ;
|
myData.saveMode = false ;
|
||||||
|
|
||||||
mNavFilterUPP = NewNavObjectFilterUPP( CrossPlatformFilterCallback ) ;
|
mNavFilterUPP = NewNavObjectFilterUPP( CrossPlatformFilterCallback ) ;
|
||||||
if ( m_dialogStyle & wxMULTIPLE )
|
if ( m_windowStyle & wxMULTIPLE )
|
||||||
mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
|
mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ;
|
||||||
else
|
else
|
||||||
mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ;
|
mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ;
|
||||||
|
@ -117,8 +117,8 @@ static wxString ParseWildCard( const wxString& wild )
|
|||||||
|
|
||||||
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||||
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
||||||
long style, const wxPoint& pos)
|
long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
|
||||||
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
|
||||||
{
|
{
|
||||||
m_filterIndex = 1;
|
m_filterIndex = 1;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ int wxDirDialog::ShowModal()
|
|||||||
// is also the only way to have a resizable dialog
|
// is also the only way to have a resizable dialog
|
||||||
//
|
//
|
||||||
// "new" style is only available in the version 5.0+ of comctl32.dll
|
// "new" style is only available in the version 5.0+ of comctl32.dll
|
||||||
const bool needNewDir = HasFlag(wxDD_NEW_DIR_BUTTON);
|
const bool needNewDir = !HasFlag(wxDD_DIR_MUST_EXIST);
|
||||||
if ( (needNewDir || HasFlag(wxRESIZE_BORDER)) && (verComCtl32 >= 500) )
|
if ( (needNewDir || HasFlag(wxRESIZE_BORDER)) && (verComCtl32 >= 500) )
|
||||||
{
|
{
|
||||||
if (needNewDir)
|
if (needNewDir)
|
||||||
|
@ -129,13 +129,15 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
|
|||||||
const wxString& defaultFileName,
|
const wxString& defaultFileName,
|
||||||
const wxString& wildCard,
|
const wxString& wildCard,
|
||||||
long style,
|
long style,
|
||||||
const wxPoint& pos)
|
const wxPoint& pos,
|
||||||
|
const wxSize& sz,
|
||||||
|
const wxString& name)
|
||||||
: wxFileDialogBase(parent, message, defaultDir, defaultFileName,
|
: wxFileDialogBase(parent, message, defaultDir, defaultFileName,
|
||||||
wildCard, style, pos)
|
wildCard, style, pos, sz, name)
|
||||||
|
|
||||||
{
|
{
|
||||||
if ( ( m_dialogStyle & wxMULTIPLE ) && ( m_dialogStyle & wxSAVE ) )
|
if ( ( m_windowStyle & wxMULTIPLE ) && ( m_windowStyle & wxSAVE ) )
|
||||||
m_dialogStyle &= ~wxMULTIPLE;
|
m_windowStyle &= ~wxMULTIPLE;
|
||||||
|
|
||||||
m_bMovedWindow = false;
|
m_bMovedWindow = false;
|
||||||
|
|
||||||
@ -278,13 +280,13 @@ int wxFileDialog::ShowModal()
|
|||||||
|
|
||||||
#if WXWIN_COMPATIBILITY_2_4
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
long msw_flags = 0;
|
long msw_flags = 0;
|
||||||
if ( (m_dialogStyle & wxHIDE_READONLY) || (m_dialogStyle & wxSAVE) )
|
if ( (m_windowStyle & wxHIDE_READONLY) || (m_windowStyle & wxSAVE) )
|
||||||
msw_flags |= OFN_HIDEREADONLY;
|
msw_flags |= OFN_HIDEREADONLY;
|
||||||
#else
|
#else
|
||||||
long msw_flags = OFN_HIDEREADONLY;
|
long msw_flags = OFN_HIDEREADONLY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( m_dialogStyle & wxFILE_MUST_EXIST )
|
if ( m_windowStyle & wxFILE_MUST_EXIST )
|
||||||
msw_flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
|
msw_flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
|
||||||
/*
|
/*
|
||||||
If the window has been moved the programmer is probably
|
If the window has been moved the programmer is probably
|
||||||
@ -302,7 +304,7 @@ int wxFileDialog::ShowModal()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dialogStyle & wxMULTIPLE )
|
if (m_windowStyle & wxMULTIPLE )
|
||||||
{
|
{
|
||||||
// OFN_EXPLORER must always be specified with OFN_ALLOWMULTISELECT
|
// OFN_EXPLORER must always be specified with OFN_ALLOWMULTISELECT
|
||||||
msw_flags |= OFN_EXPLORER | OFN_ALLOWMULTISELECT;
|
msw_flags |= OFN_EXPLORER | OFN_ALLOWMULTISELECT;
|
||||||
@ -311,12 +313,12 @@ int wxFileDialog::ShowModal()
|
|||||||
// if wxCHANGE_DIR flag is not given we shouldn't change the CWD which the
|
// if wxCHANGE_DIR flag is not given we shouldn't change the CWD which the
|
||||||
// standard dialog does by default (notice that under NT it does it anyhow,
|
// standard dialog does by default (notice that under NT it does it anyhow,
|
||||||
// OFN_NOCHANGEDIR or not, see below)
|
// OFN_NOCHANGEDIR or not, see below)
|
||||||
if ( !(m_dialogStyle & wxCHANGE_DIR) )
|
if ( !(m_windowStyle & wxCHANGE_DIR) )
|
||||||
{
|
{
|
||||||
msw_flags |= OFN_NOCHANGEDIR;
|
msw_flags |= OFN_NOCHANGEDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_dialogStyle & wxOVERWRITE_PROMPT )
|
if ( m_windowStyle & wxOVERWRITE_PROMPT )
|
||||||
{
|
{
|
||||||
msw_flags |= OFN_OVERWRITEPROMPT;
|
msw_flags |= OFN_OVERWRITEPROMPT;
|
||||||
}
|
}
|
||||||
@ -413,7 +415,7 @@ int wxFileDialog::ShowModal()
|
|||||||
// user types "foo" and the default extension is ".bar" we should force it
|
// user types "foo" and the default extension is ".bar" we should force it
|
||||||
// to check for "foo.bar" existence and not "foo")
|
// to check for "foo.bar" existence and not "foo")
|
||||||
wxString defextBuffer; // we need it to be alive until GetSaveFileName()!
|
wxString defextBuffer; // we need it to be alive until GetSaveFileName()!
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (m_windowStyle & wxSAVE)
|
||||||
{
|
{
|
||||||
const wxChar* extension = filterBuffer;
|
const wxChar* extension = filterBuffer;
|
||||||
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
|
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
|
||||||
@ -436,7 +438,7 @@ int wxFileDialog::ShowModal()
|
|||||||
//== Execute FileDialog >>=================================================
|
//== Execute FileDialog >>=================================================
|
||||||
|
|
||||||
DWORD errCode;
|
DWORD errCode;
|
||||||
bool success = DoShowCommFileDialog(&of, m_dialogStyle, &errCode);
|
bool success = DoShowCommFileDialog(&of, m_windowStyle, &errCode);
|
||||||
|
|
||||||
#ifdef wxTRY_SMALLER_OPENFILENAME
|
#ifdef wxTRY_SMALLER_OPENFILENAME
|
||||||
// the system might be too old to support the new version file dialog
|
// the system might be too old to support the new version file dialog
|
||||||
@ -446,7 +448,7 @@ int wxFileDialog::ShowModal()
|
|||||||
{
|
{
|
||||||
of.lStructSize = wxOPENFILENAME_V4_SIZE;
|
of.lStructSize = wxOPENFILENAME_V4_SIZE;
|
||||||
|
|
||||||
success = DoShowCommFileDialog(&of, m_dialogStyle, &errCode);
|
success = DoShowCommFileDialog(&of, m_windowStyle, &errCode);
|
||||||
|
|
||||||
if ( success || !errCode )
|
if ( success || !errCode )
|
||||||
{
|
{
|
||||||
@ -470,7 +472,7 @@ int wxFileDialog::ShowModal()
|
|||||||
|
|
||||||
m_fileNames.Empty();
|
m_fileNames.Empty();
|
||||||
|
|
||||||
if ( ( m_dialogStyle & wxMULTIPLE ) &&
|
if ( ( m_windowStyle & wxMULTIPLE ) &&
|
||||||
#if defined(OFN_EXPLORER)
|
#if defined(OFN_EXPLORER)
|
||||||
( fileNameBuffer[of.nFileOffset-1] == wxT('\0') )
|
( fileNameBuffer[of.nFileOffset-1] == wxT('\0') )
|
||||||
#else
|
#else
|
||||||
|
@ -70,9 +70,9 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
|
|||||||
const wxPoint& WXUNUSED(pos))
|
const wxPoint& WXUNUSED(pos))
|
||||||
{
|
{
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
m_windowStyle = style;
|
||||||
if ( ( m_dialogStyle & wxMULTIPLE ) && ( m_dialogStyle & wxSAVE ) )
|
if ( ( m_windowStyle & wxMULTIPLE ) && ( m_windowStyle & wxSAVE ) )
|
||||||
m_dialogStyle &= ~wxMULTIPLE;
|
m_windowStyle &= ~wxMULTIPLE;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_path = wxEmptyString;
|
m_path = wxEmptyString;
|
||||||
m_fileName = defaultFileName;
|
m_fileName = defaultFileName;
|
||||||
|
@ -36,7 +36,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
|
|||||||
long style, const wxPoint& pos)
|
long style, const wxPoint& pos)
|
||||||
{
|
{
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
m_windowStyle = style;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_path = defaultPath;
|
m_path = defaultPath;
|
||||||
}
|
}
|
||||||
|
@ -71,13 +71,15 @@ wxFileDialog::wxFileDialog (
|
|||||||
, const wxString& rsDefaultFileName
|
, const wxString& rsDefaultFileName
|
||||||
, const wxString& rsWildCard
|
, const wxString& rsWildCard
|
||||||
, long lStyle
|
, long lStyle
|
||||||
, const wxPoint& rPos
|
, const wxPoint& rPos,
|
||||||
|
const wxSize& sz,
|
||||||
|
const wxString& name
|
||||||
)
|
)
|
||||||
:wxFileDialogBase(pParent, rsMessage, rsDefaultDir, rsDefaultFileName, rsWildCard, lStyle, rPos)
|
:wxFileDialogBase(pParent, rsMessage, rsDefaultDir, rsDefaultFileName, rsWildCard, lStyle, rPos, sz, name)
|
||||||
|
|
||||||
{
|
{
|
||||||
if ((m_dialogStyle & wxMULTIPLE) && (m_dialogStyle & wxSAVE))
|
if ((m_windowStyle & wxMULTIPLE) && (m_windowStyle & wxSAVE))
|
||||||
m_dialogStyle &= ~wxMULTIPLE;
|
m_windowStyle &= ~wxMULTIPLE;
|
||||||
|
|
||||||
m_filterIndex = 1;
|
m_filterIndex = 1;
|
||||||
} // end of wxFileDialog::wxFileDialog
|
} // end of wxFileDialog::wxFileDialog
|
||||||
@ -124,19 +126,19 @@ int wxFileDialog::ShowModal()
|
|||||||
*zFileNameBuffer = wxT('\0');
|
*zFileNameBuffer = wxT('\0');
|
||||||
*zTitleBuffer = wxT('\0');
|
*zTitleBuffer = wxT('\0');
|
||||||
|
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (m_windowStyle & wxSAVE)
|
||||||
lFlags = FDS_SAVEAS_DIALOG;
|
lFlags = FDS_SAVEAS_DIALOG;
|
||||||
else
|
else
|
||||||
lFlags = FDS_OPEN_DIALOG;
|
lFlags = FDS_OPEN_DIALOG;
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY_2_4
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
if (m_dialogStyle & wxHIDE_READONLY)
|
if (m_windowStyle & wxHIDE_READONLY)
|
||||||
lFlags |= FDS_SAVEAS_DIALOG;
|
lFlags |= FDS_SAVEAS_DIALOG;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (m_windowStyle & wxSAVE)
|
||||||
lFlags |= FDS_SAVEAS_DIALOG;
|
lFlags |= FDS_SAVEAS_DIALOG;
|
||||||
if (m_dialogStyle & wxMULTIPLE )
|
if (m_windowStyle & wxMULTIPLE )
|
||||||
lFlags |= FDS_OPEN_DIALOG | FDS_MULTIPLESEL;
|
lFlags |= FDS_OPEN_DIALOG | FDS_MULTIPLESEL;
|
||||||
|
|
||||||
vFileDlg.cbSize = sizeof(FILEDLG);
|
vFileDlg.cbSize = sizeof(FILEDLG);
|
||||||
@ -222,7 +224,7 @@ int wxFileDialog::ShowModal()
|
|||||||
if (hWnd && vFileDlg.lReturn == DID_OK)
|
if (hWnd && vFileDlg.lReturn == DID_OK)
|
||||||
{
|
{
|
||||||
m_fileNames.Empty();
|
m_fileNames.Empty();
|
||||||
if ((m_dialogStyle & wxMULTIPLE ) && vFileDlg.ulFQFCount > 1)
|
if ((m_windowStyle & wxMULTIPLE ) && vFileDlg.ulFQFCount > 1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (int)vFileDlg.ulFQFCount; i++)
|
for (int i = 0; i < (int)vFileDlg.ulFQFCount; i++)
|
||||||
{
|
{
|
||||||
@ -236,7 +238,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
::WinFreeFileDlgList(vFileDlg.papszFQFilename);
|
::WinFreeFileDlgList(vFileDlg.papszFQFilename);
|
||||||
}
|
}
|
||||||
else if (!(m_dialogStyle & wxSAVE))
|
else if (!(m_windowStyle & wxSAVE))
|
||||||
{
|
{
|
||||||
m_path = (wxChar*)vFileDlg.szFullFile;
|
m_path = (wxChar*)vFileDlg.szFullFile;
|
||||||
m_fileName = wxFileNameFromPath(wxString((const wxChar*)vFileDlg.szFullFile));
|
m_fileName = wxFileNameFromPath(wxString((const wxChar*)vFileDlg.szFullFile));
|
||||||
@ -301,8 +303,8 @@ int wxFileDialog::ShowModal()
|
|||||||
//
|
//
|
||||||
// === Simulating the wxOVERWRITE_PROMPT >>============================
|
// === Simulating the wxOVERWRITE_PROMPT >>============================
|
||||||
//
|
//
|
||||||
if ((m_dialogStyle & wxOVERWRITE_PROMPT) &&
|
if ((m_windowStyle & wxOVERWRITE_PROMPT) &&
|
||||||
(m_dialogStyle & wxSAVE) &&
|
(m_windowStyle & wxSAVE) &&
|
||||||
(wxFileExists(m_path.c_str())))
|
(wxFileExists(m_path.c_str())))
|
||||||
{
|
{
|
||||||
wxString sMessageText;
|
wxString sMessageText;
|
||||||
|
@ -75,8 +75,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
|
|||||||
const wxString& defaultFileName,
|
const wxString& defaultFileName,
|
||||||
const wxString& wildCard,
|
const wxString& wildCard,
|
||||||
long style,
|
long style,
|
||||||
const wxPoint& pos)
|
const wxPoint& pos,
|
||||||
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos)
|
const wxSize& sz,
|
||||||
|
const wxString& name)
|
||||||
|
:wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
|
||||||
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -913,7 +913,7 @@ void ctConfigToolView::OnSaveSetupFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxFileDialog dialog(wxTheApp->GetTopWindow(),
|
wxFileDialog dialog(wxTheApp->GetTopWindow(),
|
||||||
_("Save Setup File As"),
|
_("Save Setup File As"),
|
||||||
path, filename ,
|
path, filename ,
|
||||||
wildcard, wxSAVE|wxOVERWRITE_PROMPT);
|
wildcard, wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
|
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
@ -946,7 +946,7 @@ void ctConfigToolView::OnSaveConfigureCommand(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxFileDialog dialog(wxTheApp->GetTopWindow(),
|
wxFileDialog dialog(wxTheApp->GetTopWindow(),
|
||||||
_("Save Configure Command File As"),
|
_("Save Configure Command File As"),
|
||||||
path, filename ,
|
path, filename ,
|
||||||
wildcard, wxSAVE|wxOVERWRITE_PROMPT);
|
wildcard, wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
|
|
||||||
if (dialog.ShowModal() == wxID_OK)
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user