diff --git a/docs/changes.txt b/docs/changes.txt index 844c881935..eaa1f2a749 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -26,6 +26,7 @@ All: All (GUI): - XRC handler for wxAuiToolBar added (Kinaou Hervé, David Hart). +- Add wxFD_NO_FOLLOW style for wxFileDialog (Luca Bacci). - Add support for embedding bitmaps in generated SVG in wxSVGFileDC (iwbnwif). - Add support for sorting wxDataViewCtrl by multiple columns (Trigve). - Add wxHtmlWindow::SetDefaultHTMLCursor() (Jeff A. Marr). diff --git a/include/wx/filedlg.h b/include/wx/filedlg.h index 1df6ec620b..deed9d1e15 100644 --- a/include/wx/filedlg.h +++ b/include/wx/filedlg.h @@ -43,6 +43,7 @@ enum wxFD_OPEN = 0x0001, wxFD_SAVE = 0x0002, wxFD_OVERWRITE_PROMPT = 0x0004, + wxFD_NO_FOLLOW = 0x0008, wxFD_FILE_MUST_EXIST = 0x0010, wxFD_MULTIPLE = 0x0020, wxFD_CHANGE_DIR = 0x0080, diff --git a/interface/wx/filedlg.h b/interface/wx/filedlg.h index 92ac23c70c..9591dd52be 100644 --- a/interface/wx/filedlg.h +++ b/interface/wx/filedlg.h @@ -10,6 +10,7 @@ enum wxFD_OPEN = 0x0001, wxFD_SAVE = 0x0002, wxFD_OVERWRITE_PROMPT = 0x0004, + wxFD_NO_FOLLOW = 0x0008, wxFD_FILE_MUST_EXIST = 0x0010, wxFD_MULTIPLE = 0x0020, wxFD_CHANGE_DIR = 0x0080, @@ -119,6 +120,13 @@ const char wxFileSelectorDefaultWildcardStr[]; @style{wxFD_OVERWRITE_PROMPT} For save dialog only: prompt for a confirmation if a file will be overwritten. + @style{wxFD_NO_FOLLOW} + Directs the dialog to return the path and file name of the selected + shortcut file, not its target as it does by default. Currently this + flag is only implemented in wxMSW and the non-dereferenced link path + is always returned, even without this flag, under Unix and so using + it there doesn't do anything. This flag was added in wxWidgets + 3.1.0. @style{wxFD_FILE_MUST_EXIST} For open dialog only: the user may only select files that actually exist. Notice that under OS X the file dialog with @c wxFD_OPEN diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 331f61c59a..e73ad27d3c 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -1444,7 +1444,7 @@ void MyFrame::FileOpen2(wxCommandEvent& WXUNUSED(event) ) wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr ), - wxFD_OPEN|wxFD_CHANGE_DIR|wxFD_PREVIEW, + wxFD_OPEN|wxFD_CHANGE_DIR|wxFD_PREVIEW|wxFD_NO_FOLLOW, this ); diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 15db452bae..12d0414ee5 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -497,6 +497,9 @@ int wxFileDialog::ShowModal() long msw_flags = OFN_HIDEREADONLY; + if ( HasFdFlag(wxFD_NO_FOLLOW) ) + msw_flags |= OFN_NODEREFERENCELINKS; + if ( HasFdFlag(wxFD_FILE_MUST_EXIST) ) msw_flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; /*