From fd775aae7b8eace70d8fc41a23623505ad568355 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Mon, 8 Apr 2002 11:15:16 +0000
Subject: [PATCH] Added wxDIRCTRL_EDITABLE style so we can choose whether items
 are editable or not

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/dirctrl.tex     |  1 +
 include/wx/generic/dirctrlg.h |  4 +++-
 src/generic/dirctrlg.cpp      | 11 ++++-------
 src/generic/dirdlgg.cpp       |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/docs/latex/wx/dirctrl.tex b/docs/latex/wx/dirctrl.tex
index 7fab574d24..42d6726c83 100644
--- a/docs/latex/wx/dirctrl.tex
+++ b/docs/latex/wx/dirctrl.tex
@@ -24,6 +24,7 @@ hierarchy, and optionally, a \helpref{wxChoice}{wxchoice} window containing a li
 \twocolitem{\indexit{wxDIRCTRL\_3D\_INTERNAL}}{Use 3D borders for internal controls.}
 \twocolitem{\indexit{wxDIRCTRL\_SELECT\_FIRST}}{When setting the default path, select the first file in the directory.}
 \twocolitem{\indexit{wxDIRCTRL\_SHOW\_FILTERS}}{Show the drop-down filter list.}
+\twocolitem{\indexit{wxDIRCTRL\_EDITABLE}}{Allow the folder and file items to be editable.}
 \end{twocollist}
 
 See also \helpref{Generic window styles}{windowstyles}.
diff --git a/include/wx/generic/dirctrlg.h b/include/wx/generic/dirctrlg.h
index 4be293df3e..0689956072 100644
--- a/include/wx/generic/dirctrlg.h
+++ b/include/wx/generic/dirctrlg.h
@@ -45,7 +45,9 @@ enum
     // Show the filter list
     wxDIRCTRL_SHOW_FILTERS   = 0x0040,
     // Use 3D borders on internal controls
-    wxDIRCTRL_3D_INTERNAL    = 0x0080
+    wxDIRCTRL_3D_INTERNAL    = 0x0080,
+    // Editable labels
+    wxDIRCTRL_EDITABLE       = 0x0100
 };
 
 //-----------------------------------------------------------------------------
diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp
index 6084a44bd2..70385cff71 100644
--- a/src/generic/dirctrlg.cpp
+++ b/src/generic/dirctrlg.cpp
@@ -503,13 +503,10 @@ bool wxGenericDirCtrl::Create(wxWindow *parent,
     Init();
 
     long treeStyle = wxTR_HAS_BUTTONS;
-#ifdef __WXMSW__
-    // VS: Do **NOT** remove this style, ever. MSW native wxTreeCtrl::EditLabel doesn't 
-    //     work without this style and we need it to be able to create new directories.
-    //     Generic wxTreeCtrl can do it even w/o wxTR_EDIT_LABELS, so we only add it
-    //     in case of wxMSW (as it is arguably better to not have the style enabled)
-    treeStyle |= wxTR_EDIT_LABELS;
-#endif
+
+    if (style & wxDIRCTRL_EDITABLE)
+        treeStyle |= wxTR_EDIT_LABELS;
+
 #ifndef __WXMSW__
     // FIXME, doesn't work for some reason
     treeStyle |= wxTR_HIDE_ROOT;
diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp
index da8b9a8759..94349e3c35 100644
--- a/src/generic/dirdlgg.cpp
+++ b/src/generic/dirdlgg.cpp
@@ -111,7 +111,7 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title,
     m_dirCtrl = new wxGenericDirCtrl(this, ID_DIRCTRL,
                                      m_path, wxPoint(5, 5),
                                      wxSize(300, 200), 
-                                     wxDIRCTRL_DIR_ONLY|wxSUNKEN_BORDER);
+                                     wxDIRCTRL_DIR_ONLY|wxDIRCTRL_EDITABLE|wxSUNKEN_BORDER);
 
     topsizer->Add( m_dirCtrl, 1, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, 10 );
 
-- 
2.47.2

