Add wxFD_NO_FOLLOW style for wxFileDialog.

This style tells the dialog to return the paths of the link being selected
without dereferencing it.

Currently only implemented under wxMSW as the links are not dereferenced by
default in wxGTK anyhow. But we may want to change this and implement it there
too for consistency in the future.

Closes #15429.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76085 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-03-05 16:29:46 +00:00
parent 211b166182
commit 050fabe3b9
5 changed files with 14 additions and 1 deletions

View File

@ -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).

View File

@ -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,

View File

@ -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

View File

@ -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
);

View File

@ -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;
/*