\twocolwidtha{5cm}
\begin{twocollist}
-\twocolitem{\indexit{wxDD\_NEW\_DIR\_BUTTON}}{Add "Create new directory" button and allow
-directory names to be editable. Available only on platforms that use the generic
-dialog chooser: GTK+, Motif, X11, MGL. For other platforms, use the wxGenericDirDialog
-implementation explicitly if you wish to use this style.}
+\twocolitem{\indexit{wxDD\_NEW\_DIR\_BUTTON}}{Add "Create new
+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.}
\end{twocollist}
See also \helpref{Generic window styles}{windowstyles}.
wxDirDialog::wxDirDialog(wxWindow *parent,
const wxString& message,
const wxString& defaultPath,
- long WXUNUSED(style),
+ long style,
const wxPoint& WXUNUSED(pos),
const wxSize& WXUNUSED(size),
const wxString& WXUNUSED(name))
{
m_message = message;
m_parent = parent;
-
+
+ SetStyle(style);
SetPath(defaultPath);
}
}
}
+#ifndef BIF_NEWDIALOGSTYLE
+#define BIF_NEWDIALOGSTYLE 0x0040
+#endif
+
int wxDirDialog::ShowModal()
{
wxWindow *parent = GetParent();
bi.lpfn = BrowseCallbackProc;
bi.lParam = (LPARAM)m_path.c_str(); // param for the callback
+ if ((GetStyle() & wxDD_NEW_DIR_BUTTON) &&
+ (wxApp::GetComCtl32Version() >= 500))
+ {
+ bi.ulFlags |= BIF_NEWDIALOGSTYLE;
+ }
+
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
if ( bi.pidlRoot )