From 0cf3e587a2ec542ba1eb6e03a84c54edefae1881 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Mon, 17 Sep 2007 00:14:34 +0000
Subject: [PATCH] added new and improved wxFileCtrl implementation (patch
 1763164)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 Makefile.in                      |   63 ++
 build/bakefiles/files.bkl        |    6 +
 build/msw/makefile.bcc           |   56 ++
 build/msw/makefile.gcc           |   56 ++
 build/msw/makefile.vc            |   56 ++
 build/msw/makefile.wat           |   56 ++
 build/msw/wx_core.dsp            |   16 +
 configure                        |   69 +-
 configure.in                     |    8 +
 docs/changes.txt                 |    5 +-
 docs/latex/wx/classes.tex        |    2 +
 docs/latex/wx/filectrl.tex       |  222 +++++
 docs/latex/wx/fileevt.tex        |   77 ++
 docs/latex/wx/wxusedef.tex       |    1 +
 include/wx/chkconf.h             |   19 +
 include/wx/defs.h                |    3 +
 include/wx/filectrl.h            |  138 +++
 include/wx/filedlg.h             |   22 +-
 include/wx/generic/filectrlg.h   |  290 ++++++
 include/wx/generic/filedlgg.h    |  192 +---
 include/wx/gtk/filectrl.h        |  115 +++
 include/wx/gtk/filedlg.h         |    3 +
 include/wx/mac/carbon/combobox.h |    3 +
 include/wx/mac/setup0.h          |    1 +
 include/wx/motif/setup0.h        |    1 +
 include/wx/msw/setup0.h          |    1 +
 include/wx/msw/wince/setup.h     |    1 +
 include/wx/os2/setup0.h          |    1 +
 include/wx/palmos/setup0.h       |    1 +
 include/wx/setup_inc.h           |    1 +
 samples/minimal/minimal.cpp      |   24 +
 samples/widgets/Makefile.in      |    4 +
 samples/widgets/filectrl.cpp     |  338 +++++++
 samples/widgets/makefile.bcc     |    4 +
 samples/widgets/makefile.gcc     |    4 +
 samples/widgets/makefile.unx     |    4 +
 samples/widgets/makefile.vc      |    4 +
 samples/widgets/makefile.wat     |    4 +
 samples/widgets/widgets.bkl      |    1 +
 samples/widgets/widgets.dsp      |    4 +
 setup.h.in                       |    1 +
 src/common/filectrlcmn.cpp       |   93 ++
 src/generic/filectrlg.cpp        | 1456 ++++++++++++++++++++++++++++++
 src/generic/filedlgg.cpp         | 1339 ++-------------------------
 src/gtk/filectrl.cpp             |  432 +++++++++
 src/gtk/filedlg.cpp              |  121 +--
 src/gtk1/filedlg.cpp             |    2 +-
 47 files changed, 3745 insertions(+), 1575 deletions(-)
 create mode 100644 docs/latex/wx/filectrl.tex
 create mode 100644 docs/latex/wx/fileevt.tex
 create mode 100644 include/wx/filectrl.h
 create mode 100644 include/wx/generic/filectrlg.h
 create mode 100644 include/wx/gtk/filectrl.h
 create mode 100644 samples/widgets/filectrl.cpp
 create mode 100644 src/common/filectrlcmn.cpp
 create mode 100644 src/generic/filectrlg.cpp
 create mode 100644 src/gtk/filectrl.cpp

diff --git a/Makefile.in b/Makefile.in
index 07c136b26e..8e55e5fbd1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2338,6 +2338,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_GUI_HDR =  \
 	wx/gtk/clrpicker.h \
 	wx/gtk/dialog.h \
 	wx/gtk/dirdlg.h \
+	wx/gtk/filectrl.h \
 	wx/gtk/filedlg.h \
 	wx/gtk/fontpicker.h \
 	wx/gtk/filepicker.h \
@@ -3148,6 +3149,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS =  \
 	wx/generic/dcpsg.h \
 	wx/generic/dirctrlg.h \
 	wx/generic/dragimgg.h \
+	wx/generic/filectrlg.h \
 	wx/generic/filedlgg.h \
 	wx/generic/filepickerg.h \
 	wx/generic/fontdlgg.h \
@@ -3230,6 +3232,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS =  \
 	wx/effects.h \
 	wx/evtloop.h \
 	wx/fdrepdlg.h \
+	wx/filectrl.h \
 	wx/filepicker.h \
 	wx/fontpicker.h \
 	wx/fmappriv.h \
@@ -3817,6 +3820,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS =  \
 	monodll_dseldlg.o \
 	monodll_effects.o \
 	monodll_fddlgcmn.o \
+	monodll_filectrlcmn.o \
 	monodll_filepickercmn.o \
 	monodll_fontpickercmn.o \
 	monodll_fldlgcmn.o \
@@ -3886,6 +3890,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS =  \
 	monodll_dcpsg.o \
 	monodll_dirctrlg.o \
 	monodll_dragimgg.o \
+	monodll_filectrlg.o \
 	monodll_filepickerg.o \
 	monodll_fontpickerg.o \
 	monodll_listbkg.o \
@@ -3996,6 +4001,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS =  \
 	monodll_dseldlg.o \
 	monodll_effects.o \
 	monodll_fddlgcmn.o \
+	monodll_filectrlcmn.o \
 	monodll_filepickercmn.o \
 	monodll_fontpickercmn.o \
 	monodll_fldlgcmn.o \
@@ -4065,6 +4071,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS =  \
 	monodll_dcpsg.o \
 	monodll_dirctrlg.o \
 	monodll_dragimgg.o \
+	monodll_filectrlg.o \
 	monodll_filepickerg.o \
 	monodll_fontpickerg.o \
 	monodll_listbkg.o \
@@ -4183,6 +4190,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS =  \
 	monodll_dcscreen.o \
 	monodll_dnd.o \
 	monodll_evtloop.o \
+	monodll_filectrl.o \
 	monodll_font.o \
 	monodll_gsockgtk.o \
 	monodll_minifram.o \
@@ -5010,6 +5018,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_1 =  \
 	monodll_dcscreen.o \
 	monodll_dnd.o \
 	monodll_evtloop.o \
+	monodll_filectrl.o \
 	monodll_font.o \
 	monodll_gsockgtk.o \
 	monodll_minifram.o \
@@ -5666,6 +5675,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 =  \
 	monolib_dseldlg.o \
 	monolib_effects.o \
 	monolib_fddlgcmn.o \
+	monolib_filectrlcmn.o \
 	monolib_filepickercmn.o \
 	monolib_fontpickercmn.o \
 	monolib_fldlgcmn.o \
@@ -5735,6 +5745,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_1 =  \
 	monolib_dcpsg.o \
 	monolib_dirctrlg.o \
 	monolib_dragimgg.o \
+	monolib_filectrlg.o \
 	monolib_filepickerg.o \
 	monolib_fontpickerg.o \
 	monolib_listbkg.o \
@@ -5845,6 +5856,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 =  \
 	monolib_dseldlg.o \
 	monolib_effects.o \
 	monolib_fddlgcmn.o \
+	monolib_filectrlcmn.o \
 	monolib_filepickercmn.o \
 	monolib_fontpickercmn.o \
 	monolib_fldlgcmn.o \
@@ -5914,6 +5926,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 =  \
 	monolib_dcpsg.o \
 	monolib_dirctrlg.o \
 	monolib_dragimgg.o \
+	monolib_filectrlg.o \
 	monolib_filepickerg.o \
 	monolib_fontpickerg.o \
 	monolib_listbkg.o \
@@ -6032,6 +6045,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_2 =  \
 	monolib_dcscreen.o \
 	monolib_dnd.o \
 	monolib_evtloop.o \
+	monolib_filectrl.o \
 	monolib_font.o \
 	monolib_gsockgtk.o \
 	monolib_minifram.o \
@@ -6860,6 +6874,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_3 =  \
 	monolib_dcscreen.o \
 	monolib_dnd.o \
 	monolib_evtloop.o \
+	monolib_filectrl.o \
 	monolib_font.o \
 	monolib_gsockgtk.o \
 	monolib_minifram.o \
@@ -7799,6 +7814,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 =  \
 	coredll_dseldlg.o \
 	coredll_effects.o \
 	coredll_fddlgcmn.o \
+	coredll_filectrlcmn.o \
 	coredll_filepickercmn.o \
 	coredll_fontpickercmn.o \
 	coredll_fldlgcmn.o \
@@ -7868,6 +7884,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_2 =  \
 	coredll_dcpsg.o \
 	coredll_dirctrlg.o \
 	coredll_dragimgg.o \
+	coredll_filectrlg.o \
 	coredll_filepickerg.o \
 	coredll_fontpickerg.o \
 	coredll_listbkg.o \
@@ -7978,6 +7995,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 =  \
 	coredll_dseldlg.o \
 	coredll_effects.o \
 	coredll_fddlgcmn.o \
+	coredll_filectrlcmn.o \
 	coredll_filepickercmn.o \
 	coredll_fontpickercmn.o \
 	coredll_fldlgcmn.o \
@@ -8047,6 +8065,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 =  \
 	coredll_dcpsg.o \
 	coredll_dirctrlg.o \
 	coredll_dragimgg.o \
+	coredll_filectrlg.o \
 	coredll_filepickerg.o \
 	coredll_fontpickerg.o \
 	coredll_listbkg.o \
@@ -8165,6 +8184,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_4 =  \
 	coredll_dcscreen.o \
 	coredll_dnd.o \
 	coredll_evtloop.o \
+	coredll_filectrl.o \
 	coredll_font.o \
 	coredll_gsockgtk.o \
 	coredll_minifram.o \
@@ -8993,6 +9013,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_5 =  \
 	coredll_dcscreen.o \
 	coredll_dnd.o \
 	coredll_evtloop.o \
+	coredll_filectrl.o \
 	coredll_font.o \
 	coredll_gsockgtk.o \
 	coredll_minifram.o \
@@ -9250,6 +9271,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 =  \
 	corelib_dseldlg.o \
 	corelib_effects.o \
 	corelib_fddlgcmn.o \
+	corelib_filectrlcmn.o \
 	corelib_filepickercmn.o \
 	corelib_fontpickercmn.o \
 	corelib_fldlgcmn.o \
@@ -9319,6 +9341,7 @@ COND_USE_GUI_1_WXUNIV_0___CORE_SRC_OBJECTS_3 =  \
 	corelib_dcpsg.o \
 	corelib_dirctrlg.o \
 	corelib_dragimgg.o \
+	corelib_filectrlg.o \
 	corelib_filepickerg.o \
 	corelib_fontpickerg.o \
 	corelib_listbkg.o \
@@ -9429,6 +9452,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 =  \
 	corelib_dseldlg.o \
 	corelib_effects.o \
 	corelib_fddlgcmn.o \
+	corelib_filectrlcmn.o \
 	corelib_filepickercmn.o \
 	corelib_fontpickercmn.o \
 	corelib_fldlgcmn.o \
@@ -9498,6 +9522,7 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 =  \
 	corelib_dcpsg.o \
 	corelib_dirctrlg.o \
 	corelib_dragimgg.o \
+	corelib_filectrlg.o \
 	corelib_filepickerg.o \
 	corelib_fontpickerg.o \
 	corelib_listbkg.o \
@@ -9616,6 +9641,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_6 =  \
 	corelib_dcscreen.o \
 	corelib_dnd.o \
 	corelib_evtloop.o \
+	corelib_filectrl.o \
 	corelib_font.o \
 	corelib_gsockgtk.o \
 	corelib_minifram.o \
@@ -10444,6 +10470,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___LOWLEVEL_SRC_OBJECTS_7 =  \
 	corelib_dcscreen.o \
 	corelib_dnd.o \
 	corelib_evtloop.o \
+	corelib_filectrl.o \
 	corelib_font.o \
 	corelib_gsockgtk.o \
 	corelib_minifram.o \
@@ -15514,6 +15541,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monodll_dnd.o: $(srcdir)/src/os2/dnd.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@	$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/os2/dnd.cpp
 
+@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(MONODLL_ODEP)
+@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@	$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
+
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monodll_font.o: $(srcdir)/src/gtk/font.cpp $(MONODLL_ODEP)
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@	$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
 
@@ -17329,6 +17359,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@monodll_fddlgcmn.o: $(srcdir)/src/common/fddlgcmn.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/fddlgcmn.cpp
 
+@COND_USE_GUI_1@monodll_filectrlcmn.o: $(srcdir)/src/common/filectrlcmn.cpp $(MONODLL_ODEP)
+@COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/filectrlcmn.cpp
+
 @COND_USE_GUI_1@monodll_filepickercmn.o: $(srcdir)/src/common/filepickercmn.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/filepickercmn.cpp
 
@@ -17536,6 +17569,9 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@monodll_dragimgg.o: $(srcdir)/src/generic/dragimgg.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/dragimgg.cpp
 
+@COND_USE_GUI_1@monodll_filectrlg.o: $(srcdir)/src/generic/filectrlg.cpp $(MONODLL_ODEP)
+@COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/filectrlg.cpp
+
 @COND_USE_GUI_1@monodll_filepickerg.o: $(srcdir)/src/generic/filepickerg.cpp $(MONODLL_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/generic/filepickerg.cpp
 
@@ -19861,6 +19897,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@monolib_dnd.o: $(srcdir)/src/os2/dnd.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@	$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/os2/dnd.cpp
 
+@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(MONOLIB_ODEP)
+@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@	$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
+
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@monolib_font.o: $(srcdir)/src/gtk/font.cpp $(MONOLIB_ODEP)
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@	$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
 
@@ -21676,6 +21715,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@monolib_fddlgcmn.o: $(srcdir)/src/common/fddlgcmn.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/fddlgcmn.cpp
 
+@COND_USE_GUI_1@monolib_filectrlcmn.o: $(srcdir)/src/common/filectrlcmn.cpp $(MONOLIB_ODEP)
+@COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/filectrlcmn.cpp
+
 @COND_USE_GUI_1@monolib_filepickercmn.o: $(srcdir)/src/common/filepickercmn.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/filepickercmn.cpp
 
@@ -21883,6 +21925,9 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@monolib_dragimgg.o: $(srcdir)/src/generic/dragimgg.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/dragimgg.cpp
 
+@COND_USE_GUI_1@monolib_filectrlg.o: $(srcdir)/src/generic/filectrlg.cpp $(MONOLIB_ODEP)
+@COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/filectrlg.cpp
+
 @COND_USE_GUI_1@monolib_filepickerg.o: $(srcdir)/src/generic/filepickerg.cpp $(MONOLIB_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/generic/filepickerg.cpp
 
@@ -24748,6 +24793,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
 @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@coredll_dnd.o: $(srcdir)/src/os2/dnd.cpp $(COREDLL_ODEP)
 @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@	$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/os2/dnd.cpp
 
+@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(COREDLL_ODEP)
+@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@	$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
+
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@coredll_font.o: $(srcdir)/src/gtk/font.cpp $(COREDLL_ODEP)
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@	$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
 
@@ -26554,6 +26602,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
 @COND_USE_GUI_1@coredll_fddlgcmn.o: $(srcdir)/src/common/fddlgcmn.cpp $(COREDLL_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/fddlgcmn.cpp
 
+@COND_USE_GUI_1@coredll_filectrlcmn.o: $(srcdir)/src/common/filectrlcmn.cpp $(COREDLL_ODEP)
+@COND_USE_GUI_1@	$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/filectrlcmn.cpp
+
 @COND_USE_GUI_1@coredll_filepickercmn.o: $(srcdir)/src/common/filepickercmn.cpp $(COREDLL_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/filepickercmn.cpp
 
@@ -26761,6 +26812,9 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
 @COND_USE_GUI_1@coredll_dragimgg.o: $(srcdir)/src/generic/dragimgg.cpp $(COREDLL_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/dragimgg.cpp
 
+@COND_USE_GUI_1@coredll_filectrlg.o: $(srcdir)/src/generic/filectrlg.cpp $(COREDLL_ODEP)
+@COND_USE_GUI_1@	$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/filectrlg.cpp
+
 @COND_USE_GUI_1@coredll_filepickerg.o: $(srcdir)/src/generic/filepickerg.cpp $(COREDLL_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/generic/filepickerg.cpp
 
@@ -27700,6 +27754,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
 @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@corelib_dnd.o: $(srcdir)/src/os2/dnd.cpp $(CORELIB_ODEP)
 @COND_TOOLKIT_PM_USE_GUI_1_WXUNIV_0@	$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/os2/dnd.cpp
 
+@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_filectrl.o: $(srcdir)/src/gtk/filectrl.cpp $(CORELIB_ODEP)
+@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@	$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/filectrl.cpp
+
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@corelib_font.o: $(srcdir)/src/gtk/font.cpp $(CORELIB_ODEP)
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1@	$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/font.cpp
 
@@ -29506,6 +29563,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
 @COND_USE_GUI_1@corelib_fddlgcmn.o: $(srcdir)/src/common/fddlgcmn.cpp $(CORELIB_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/fddlgcmn.cpp
 
+@COND_USE_GUI_1@corelib_filectrlcmn.o: $(srcdir)/src/common/filectrlcmn.cpp $(CORELIB_ODEP)
+@COND_USE_GUI_1@	$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/filectrlcmn.cpp
+
 @COND_USE_GUI_1@corelib_filepickercmn.o: $(srcdir)/src/common/filepickercmn.cpp $(CORELIB_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/filepickercmn.cpp
 
@@ -29713,6 +29773,9 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
 @COND_USE_GUI_1@corelib_dragimgg.o: $(srcdir)/src/generic/dragimgg.cpp $(CORELIB_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/dragimgg.cpp
 
+@COND_USE_GUI_1@corelib_filectrlg.o: $(srcdir)/src/generic/filectrlg.cpp $(CORELIB_ODEP)
+@COND_USE_GUI_1@	$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/filectrlg.cpp
+
 @COND_USE_GUI_1@corelib_filepickerg.o: $(srcdir)/src/generic/filepickerg.cpp $(CORELIB_ODEP)
 @COND_USE_GUI_1@	$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/generic/filepickerg.cpp
 
diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl
index 10b428c15d..355a805409 100644
--- a/build/bakefiles/files.bkl
+++ b/build/bakefiles/files.bkl
@@ -646,6 +646,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     src/common/dseldlg.cpp
     src/common/effects.cpp
     src/common/fddlgcmn.cpp
+    src/common/filectrlcmn.cpp
     src/common/filepickercmn.cpp
     src/common/fontpickercmn.cpp
     src/common/fldlgcmn.cpp
@@ -715,6 +716,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     src/generic/dcpsg.cpp
     src/generic/dirctrlg.cpp
     src/generic/dragimgg.cpp
+    src/generic/filectrlg.cpp
     src/generic/filepickerg.cpp
     src/generic/fontpickerg.cpp
     src/generic/listbkg.cpp
@@ -779,6 +781,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/generic/dcpsg.h
     wx/generic/dirctrlg.h
     wx/generic/dragimgg.h
+    wx/generic/filectrlg.h
     wx/generic/filedlgg.h
     wx/generic/filepickerg.h
     wx/generic/fontdlgg.h
@@ -862,6 +865,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/effects.h
     wx/evtloop.h
     wx/fdrepdlg.h
+    wx/filectrl.h
     wx/filepicker.h
     wx/fontpicker.h
     wx/fmappriv.h
@@ -979,6 +983,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     src/gtk/dcscreen.cpp
     src/gtk/dnd.cpp
     src/gtk/evtloop.cpp
+    src/gtk/filectrl.cpp
     src/gtk/font.cpp
     src/gtk/gsockgtk.cpp
     src/gtk/minifram.cpp
@@ -1103,6 +1108,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/gtk/clrpicker.h
     wx/gtk/dialog.h
     wx/gtk/dirdlg.h
+    wx/gtk/filectrl.h
     wx/gtk/filedlg.h
     wx/gtk/fontpicker.h
     wx/gtk/filepicker.h
diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc
index 15b029851e..ebd88ed373 100644
--- a/build/msw/makefile.bcc
+++ b/build/msw/makefile.bcc
@@ -1555,6 +1555,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_helpwin.obj \
 	$(OBJS)\monodll_automtn.obj \
 	$(OBJS)\monodll_uuid.obj \
+	$(OBJS)\monodll_filectrlg.obj \
 	$(OBJS)\monodll_statusbr.obj \
 	$(OBJS)\monodll_prntdlgg.obj \
 	$(OBJS)\monodll_accel.obj \
@@ -1638,6 +1639,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_dseldlg.obj \
 	$(OBJS)\monodll_effects.obj \
 	$(OBJS)\monodll_fddlgcmn.obj \
+	$(OBJS)\monodll_filectrlcmn.obj \
 	$(OBJS)\monodll_filepickercmn.obj \
 	$(OBJS)\monodll_fontpickercmn.obj \
 	$(OBJS)\monodll_fldlgcmn.obj \
@@ -1783,6 +1785,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_colrdlgg.obj \
 	$(OBJS)\monodll_dirdlgg.obj \
 	$(OBJS)\monodll_fdrepdlg.obj \
+	$(OBJS)\monodll_filectrlg.obj \
 	$(OBJS)\monodll_filedlgg.obj \
 	$(OBJS)\monodll_fontdlgg.obj \
 	$(OBJS)\monodll_listctrl.obj \
@@ -1865,6 +1868,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_dseldlg.obj \
 	$(OBJS)\monodll_effects.obj \
 	$(OBJS)\monodll_fddlgcmn.obj \
+	$(OBJS)\monodll_filectrlcmn.obj \
 	$(OBJS)\monodll_filepickercmn.obj \
 	$(OBJS)\monodll_fontpickercmn.obj \
 	$(OBJS)\monodll_fldlgcmn.obj \
@@ -2187,6 +2191,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_helpwin.obj \
 	$(OBJS)\monolib_automtn.obj \
 	$(OBJS)\monolib_uuid.obj \
+	$(OBJS)\monolib_filectrlg.obj \
 	$(OBJS)\monolib_statusbr.obj \
 	$(OBJS)\monolib_prntdlgg.obj \
 	$(OBJS)\monolib_accel.obj \
@@ -2270,6 +2275,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_dseldlg.obj \
 	$(OBJS)\monolib_effects.obj \
 	$(OBJS)\monolib_fddlgcmn.obj \
+	$(OBJS)\monolib_filectrlcmn.obj \
 	$(OBJS)\monolib_filepickercmn.obj \
 	$(OBJS)\monolib_fontpickercmn.obj \
 	$(OBJS)\monolib_fldlgcmn.obj \
@@ -2415,6 +2421,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_colrdlgg.obj \
 	$(OBJS)\monolib_dirdlgg.obj \
 	$(OBJS)\monolib_fdrepdlg.obj \
+	$(OBJS)\monolib_filectrlg.obj \
 	$(OBJS)\monolib_filedlgg.obj \
 	$(OBJS)\monolib_fontdlgg.obj \
 	$(OBJS)\monolib_listctrl.obj \
@@ -2497,6 +2504,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_dseldlg.obj \
 	$(OBJS)\monolib_effects.obj \
 	$(OBJS)\monolib_fddlgcmn.obj \
+	$(OBJS)\monolib_filectrlcmn.obj \
 	$(OBJS)\monolib_filepickercmn.obj \
 	$(OBJS)\monolib_fontpickercmn.obj \
 	$(OBJS)\monolib_fldlgcmn.obj \
@@ -2731,6 +2739,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_helpwin.obj \
 	$(OBJS)\coredll_automtn.obj \
 	$(OBJS)\coredll_uuid.obj \
+	$(OBJS)\coredll_filectrlg.obj \
 	$(OBJS)\coredll_statusbr.obj \
 	$(OBJS)\coredll_prntdlgg.obj \
 	$(OBJS)\coredll_accel.obj \
@@ -2814,6 +2823,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_dseldlg.obj \
 	$(OBJS)\coredll_effects.obj \
 	$(OBJS)\coredll_fddlgcmn.obj \
+	$(OBJS)\coredll_filectrlcmn.obj \
 	$(OBJS)\coredll_filepickercmn.obj \
 	$(OBJS)\coredll_fontpickercmn.obj \
 	$(OBJS)\coredll_fldlgcmn.obj \
@@ -2959,6 +2969,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_colrdlgg.obj \
 	$(OBJS)\coredll_dirdlgg.obj \
 	$(OBJS)\coredll_fdrepdlg.obj \
+	$(OBJS)\coredll_filectrlg.obj \
 	$(OBJS)\coredll_filedlgg.obj \
 	$(OBJS)\coredll_fontdlgg.obj \
 	$(OBJS)\coredll_listctrl.obj \
@@ -3041,6 +3052,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_dseldlg.obj \
 	$(OBJS)\coredll_effects.obj \
 	$(OBJS)\coredll_fddlgcmn.obj \
+	$(OBJS)\coredll_filectrlcmn.obj \
 	$(OBJS)\coredll_filepickercmn.obj \
 	$(OBJS)\coredll_fontpickercmn.obj \
 	$(OBJS)\coredll_fldlgcmn.obj \
@@ -3186,6 +3198,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_helpwin.obj \
 	$(OBJS)\corelib_automtn.obj \
 	$(OBJS)\corelib_uuid.obj \
+	$(OBJS)\corelib_filectrlg.obj \
 	$(OBJS)\corelib_statusbr.obj \
 	$(OBJS)\corelib_prntdlgg.obj \
 	$(OBJS)\corelib_accel.obj \
@@ -3269,6 +3282,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_dseldlg.obj \
 	$(OBJS)\corelib_effects.obj \
 	$(OBJS)\corelib_fddlgcmn.obj \
+	$(OBJS)\corelib_filectrlcmn.obj \
 	$(OBJS)\corelib_filepickercmn.obj \
 	$(OBJS)\corelib_fontpickercmn.obj \
 	$(OBJS)\corelib_fldlgcmn.obj \
@@ -3414,6 +3428,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_colrdlgg.obj \
 	$(OBJS)\corelib_dirdlgg.obj \
 	$(OBJS)\corelib_fdrepdlg.obj \
+	$(OBJS)\corelib_filectrlg.obj \
 	$(OBJS)\corelib_filedlgg.obj \
 	$(OBJS)\corelib_fontdlgg.obj \
 	$(OBJS)\corelib_listctrl.obj \
@@ -3496,6 +3511,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_dseldlg.obj \
 	$(OBJS)\corelib_effects.obj \
 	$(OBJS)\corelib_fddlgcmn.obj \
+	$(OBJS)\corelib_filectrlcmn.obj \
 	$(OBJS)\corelib_filepickercmn.obj \
 	$(OBJS)\corelib_fontpickercmn.obj \
 	$(OBJS)\corelib_fldlgcmn.obj \
@@ -6244,6 +6260,11 @@ $(OBJS)\monodll_uuid.obj: ..\..\src\msw\ole\uuid.cpp
 	$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_filectrlg.obj: ..\..\src\generic\filectrlg.cpp
+	$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "0"
 $(OBJS)\monodll_statusbr.obj: ..\..\src\generic\statusbr.cpp
 	$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
@@ -6674,6 +6695,11 @@ $(OBJS)\monodll_fddlgcmn.obj: ..\..\src\common\fddlgcmn.cpp
 	$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
+	$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\monodll_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
 	$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
@@ -8318,6 +8344,11 @@ $(OBJS)\monolib_uuid.obj: ..\..\src\msw\ole\uuid.cpp
 	$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_filectrlg.obj: ..\..\src\generic\filectrlg.cpp
+	$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "0"
 $(OBJS)\monolib_statusbr.obj: ..\..\src\generic\statusbr.cpp
 	$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
@@ -8748,6 +8779,11 @@ $(OBJS)\monolib_fddlgcmn.obj: ..\..\src\common\fddlgcmn.cpp
 	$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
+	$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\monolib_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
 	$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
@@ -10440,6 +10476,11 @@ $(OBJS)\coredll_uuid.obj: ..\..\src\msw\ole\uuid.cpp
 	$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_filectrlg.obj: ..\..\src\generic\filectrlg.cpp
+	$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "0"
 $(OBJS)\coredll_statusbr.obj: ..\..\src\generic\statusbr.cpp
 	$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
@@ -10870,6 +10911,11 @@ $(OBJS)\coredll_fddlgcmn.obj: ..\..\src\common\fddlgcmn.cpp
 	$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
+	$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\coredll_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
 	$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $**
@@ -11728,6 +11774,11 @@ $(OBJS)\corelib_uuid.obj: ..\..\src\msw\ole\uuid.cpp
 	$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_filectrlg.obj: ..\..\src\generic\filectrlg.cpp
+	$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "0"
 $(OBJS)\corelib_statusbr.obj: ..\..\src\generic\statusbr.cpp
 	$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
@@ -12158,6 +12209,11 @@ $(OBJS)\corelib_fddlgcmn.obj: ..\..\src\common\fddlgcmn.cpp
 	$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
+	$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\corelib_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
 	$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $**
diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc
index b1eafbe6a9..2b2bf36abd 100644
--- a/build/msw/makefile.gcc
+++ b/build/msw/makefile.gcc
@@ -1573,6 +1573,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_helpwin.o \
 	$(OBJS)\monodll_automtn.o \
 	$(OBJS)\monodll_uuid.o \
+	$(OBJS)\monodll_filectrlg.o \
 	$(OBJS)\monodll_statusbr.o \
 	$(OBJS)\monodll_prntdlgg.o \
 	$(OBJS)\monodll_accel.o \
@@ -1656,6 +1657,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_dseldlg.o \
 	$(OBJS)\monodll_effects.o \
 	$(OBJS)\monodll_fddlgcmn.o \
+	$(OBJS)\monodll_filectrlcmn.o \
 	$(OBJS)\monodll_filepickercmn.o \
 	$(OBJS)\monodll_fontpickercmn.o \
 	$(OBJS)\monodll_fldlgcmn.o \
@@ -1803,6 +1805,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_colrdlgg.o \
 	$(OBJS)\monodll_dirdlgg.o \
 	$(OBJS)\monodll_fdrepdlg.o \
+	$(OBJS)\monodll_filectrlg.o \
 	$(OBJS)\monodll_filedlgg.o \
 	$(OBJS)\monodll_fontdlgg.o \
 	$(OBJS)\monodll_listctrl.o \
@@ -1885,6 +1888,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_dseldlg.o \
 	$(OBJS)\monodll_effects.o \
 	$(OBJS)\monodll_fddlgcmn.o \
+	$(OBJS)\monodll_filectrlcmn.o \
 	$(OBJS)\monodll_filepickercmn.o \
 	$(OBJS)\monodll_fontpickercmn.o \
 	$(OBJS)\monodll_fldlgcmn.o \
@@ -2211,6 +2215,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_helpwin.o \
 	$(OBJS)\monolib_automtn.o \
 	$(OBJS)\monolib_uuid.o \
+	$(OBJS)\monolib_filectrlg.o \
 	$(OBJS)\monolib_statusbr.o \
 	$(OBJS)\monolib_prntdlgg.o \
 	$(OBJS)\monolib_accel.o \
@@ -2294,6 +2299,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_dseldlg.o \
 	$(OBJS)\monolib_effects.o \
 	$(OBJS)\monolib_fddlgcmn.o \
+	$(OBJS)\monolib_filectrlcmn.o \
 	$(OBJS)\monolib_filepickercmn.o \
 	$(OBJS)\monolib_fontpickercmn.o \
 	$(OBJS)\monolib_fldlgcmn.o \
@@ -2441,6 +2447,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_colrdlgg.o \
 	$(OBJS)\monolib_dirdlgg.o \
 	$(OBJS)\monolib_fdrepdlg.o \
+	$(OBJS)\monolib_filectrlg.o \
 	$(OBJS)\monolib_filedlgg.o \
 	$(OBJS)\monolib_fontdlgg.o \
 	$(OBJS)\monolib_listctrl.o \
@@ -2523,6 +2530,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_dseldlg.o \
 	$(OBJS)\monolib_effects.o \
 	$(OBJS)\monolib_fddlgcmn.o \
+	$(OBJS)\monolib_filectrlcmn.o \
 	$(OBJS)\monolib_filepickercmn.o \
 	$(OBJS)\monolib_fontpickercmn.o \
 	$(OBJS)\monolib_fldlgcmn.o \
@@ -2771,6 +2779,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_helpwin.o \
 	$(OBJS)\coredll_automtn.o \
 	$(OBJS)\coredll_uuid.o \
+	$(OBJS)\coredll_filectrlg.o \
 	$(OBJS)\coredll_statusbr.o \
 	$(OBJS)\coredll_prntdlgg.o \
 	$(OBJS)\coredll_accel.o \
@@ -2854,6 +2863,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_dseldlg.o \
 	$(OBJS)\coredll_effects.o \
 	$(OBJS)\coredll_fddlgcmn.o \
+	$(OBJS)\coredll_filectrlcmn.o \
 	$(OBJS)\coredll_filepickercmn.o \
 	$(OBJS)\coredll_fontpickercmn.o \
 	$(OBJS)\coredll_fldlgcmn.o \
@@ -3001,6 +3011,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_colrdlgg.o \
 	$(OBJS)\coredll_dirdlgg.o \
 	$(OBJS)\coredll_fdrepdlg.o \
+	$(OBJS)\coredll_filectrlg.o \
 	$(OBJS)\coredll_filedlgg.o \
 	$(OBJS)\coredll_fontdlgg.o \
 	$(OBJS)\coredll_listctrl.o \
@@ -3083,6 +3094,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_dseldlg.o \
 	$(OBJS)\coredll_effects.o \
 	$(OBJS)\coredll_fddlgcmn.o \
+	$(OBJS)\coredll_filectrlcmn.o \
 	$(OBJS)\coredll_filepickercmn.o \
 	$(OBJS)\coredll_fontpickercmn.o \
 	$(OBJS)\coredll_fldlgcmn.o \
@@ -3234,6 +3246,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_helpwin.o \
 	$(OBJS)\corelib_automtn.o \
 	$(OBJS)\corelib_uuid.o \
+	$(OBJS)\corelib_filectrlg.o \
 	$(OBJS)\corelib_statusbr.o \
 	$(OBJS)\corelib_prntdlgg.o \
 	$(OBJS)\corelib_accel.o \
@@ -3317,6 +3330,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_dseldlg.o \
 	$(OBJS)\corelib_effects.o \
 	$(OBJS)\corelib_fddlgcmn.o \
+	$(OBJS)\corelib_filectrlcmn.o \
 	$(OBJS)\corelib_filepickercmn.o \
 	$(OBJS)\corelib_fontpickercmn.o \
 	$(OBJS)\corelib_fldlgcmn.o \
@@ -3464,6 +3478,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_colrdlgg.o \
 	$(OBJS)\corelib_dirdlgg.o \
 	$(OBJS)\corelib_fdrepdlg.o \
+	$(OBJS)\corelib_filectrlg.o \
 	$(OBJS)\corelib_filedlgg.o \
 	$(OBJS)\corelib_fontdlgg.o \
 	$(OBJS)\corelib_listctrl.o \
@@ -3546,6 +3561,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_dseldlg.o \
 	$(OBJS)\corelib_effects.o \
 	$(OBJS)\corelib_fddlgcmn.o \
+	$(OBJS)\corelib_filectrlcmn.o \
 	$(OBJS)\corelib_filepickercmn.o \
 	$(OBJS)\corelib_fontpickercmn.o \
 	$(OBJS)\corelib_fldlgcmn.o \
@@ -6413,6 +6429,11 @@ $(OBJS)\monodll_uuid.o: ../../src/msw/ole/uuid.cpp
 	$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\monodll_filectrlg.o: ../../src/generic/filectrlg.cpp
+	$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 ifeq ($(WXUNIV),0)
 $(OBJS)\monodll_statusbr.o: ../../src/generic/statusbr.cpp
@@ -6943,6 +6964,11 @@ $(OBJS)\monodll_fddlgcmn.o: ../../src/common/fddlgcmn.cpp
 	$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\monodll_filectrlcmn.o: ../../src/common/filectrlcmn.cpp
+	$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 $(OBJS)\monodll_filepickercmn.o: ../../src/common/filepickercmn.cpp
 	$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@@ -8587,6 +8613,11 @@ $(OBJS)\monolib_uuid.o: ../../src/msw/ole/uuid.cpp
 	$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\monolib_filectrlg.o: ../../src/generic/filectrlg.cpp
+	$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 ifeq ($(WXUNIV),0)
 $(OBJS)\monolib_statusbr.o: ../../src/generic/statusbr.cpp
@@ -9117,6 +9148,11 @@ $(OBJS)\monolib_fddlgcmn.o: ../../src/common/fddlgcmn.cpp
 	$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\monolib_filectrlcmn.o: ../../src/common/filectrlcmn.cpp
+	$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 $(OBJS)\monolib_filepickercmn.o: ../../src/common/filepickercmn.cpp
 	$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -10809,6 +10845,11 @@ $(OBJS)\coredll_uuid.o: ../../src/msw/ole/uuid.cpp
 	$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\coredll_filectrlg.o: ../../src/generic/filectrlg.cpp
+	$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 ifeq ($(WXUNIV),0)
 $(OBJS)\coredll_statusbr.o: ../../src/generic/statusbr.cpp
@@ -11339,6 +11380,11 @@ $(OBJS)\coredll_fddlgcmn.o: ../../src/common/fddlgcmn.cpp
 	$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\coredll_filectrlcmn.o: ../../src/common/filectrlcmn.cpp
+	$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 $(OBJS)\coredll_filepickercmn.o: ../../src/common/filepickercmn.cpp
 	$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -12197,6 +12243,11 @@ $(OBJS)\corelib_uuid.o: ../../src/msw/ole/uuid.cpp
 	$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\corelib_filectrlg.o: ../../src/generic/filectrlg.cpp
+	$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 ifeq ($(WXUNIV),0)
 $(OBJS)\corelib_statusbr.o: ../../src/generic/statusbr.cpp
@@ -12727,6 +12778,11 @@ $(OBJS)\corelib_fddlgcmn.o: ../../src/common/fddlgcmn.cpp
 	$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
 endif
 
+ifeq ($(USE_GUI),1)
+$(OBJS)\corelib_filectrlcmn.o: ../../src/common/filectrlcmn.cpp
+	$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
+endif
+
 ifeq ($(USE_GUI),1)
 $(OBJS)\corelib_filepickercmn.o: ../../src/common/filepickercmn.cpp
 	$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc
index 15a59fdc62..e4dc9cbbab 100644
--- a/build/msw/makefile.vc
+++ b/build/msw/makefile.vc
@@ -1743,6 +1743,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_helpwin.obj \
 	$(OBJS)\monodll_automtn.obj \
 	$(OBJS)\monodll_uuid.obj \
+	$(OBJS)\monodll_filectrlg.obj \
 	$(OBJS)\monodll_statusbr.obj \
 	$(OBJS)\monodll_prntdlgg.obj \
 	$(OBJS)\monodll_accel.obj \
@@ -1826,6 +1827,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_dseldlg.obj \
 	$(OBJS)\monodll_effects.obj \
 	$(OBJS)\monodll_fddlgcmn.obj \
+	$(OBJS)\monodll_filectrlcmn.obj \
 	$(OBJS)\monodll_filepickercmn.obj \
 	$(OBJS)\monodll_fontpickercmn.obj \
 	$(OBJS)\monodll_fldlgcmn.obj \
@@ -1971,6 +1973,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_colrdlgg.obj \
 	$(OBJS)\monodll_dirdlgg.obj \
 	$(OBJS)\monodll_fdrepdlg.obj \
+	$(OBJS)\monodll_filectrlg.obj \
 	$(OBJS)\monodll_filedlgg.obj \
 	$(OBJS)\monodll_fontdlgg.obj \
 	$(OBJS)\monodll_listctrl.obj \
@@ -2053,6 +2056,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  \
 	$(OBJS)\monodll_dseldlg.obj \
 	$(OBJS)\monodll_effects.obj \
 	$(OBJS)\monodll_fddlgcmn.obj \
+	$(OBJS)\monodll_filectrlcmn.obj \
 	$(OBJS)\monodll_filepickercmn.obj \
 	$(OBJS)\monodll_fontpickercmn.obj \
 	$(OBJS)\monodll_fldlgcmn.obj \
@@ -2381,6 +2385,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_helpwin.obj \
 	$(OBJS)\monolib_automtn.obj \
 	$(OBJS)\monolib_uuid.obj \
+	$(OBJS)\monolib_filectrlg.obj \
 	$(OBJS)\monolib_statusbr.obj \
 	$(OBJS)\monolib_prntdlgg.obj \
 	$(OBJS)\monolib_accel.obj \
@@ -2464,6 +2469,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_dseldlg.obj \
 	$(OBJS)\monolib_effects.obj \
 	$(OBJS)\monolib_fddlgcmn.obj \
+	$(OBJS)\monolib_filectrlcmn.obj \
 	$(OBJS)\monolib_filepickercmn.obj \
 	$(OBJS)\monolib_fontpickercmn.obj \
 	$(OBJS)\monolib_fldlgcmn.obj \
@@ -2609,6 +2615,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_colrdlgg.obj \
 	$(OBJS)\monolib_dirdlgg.obj \
 	$(OBJS)\monolib_fdrepdlg.obj \
+	$(OBJS)\monolib_filectrlg.obj \
 	$(OBJS)\monolib_filedlgg.obj \
 	$(OBJS)\monolib_fontdlgg.obj \
 	$(OBJS)\monolib_listctrl.obj \
@@ -2691,6 +2698,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  \
 	$(OBJS)\monolib_dseldlg.obj \
 	$(OBJS)\monolib_effects.obj \
 	$(OBJS)\monolib_fddlgcmn.obj \
+	$(OBJS)\monolib_filectrlcmn.obj \
 	$(OBJS)\monolib_filepickercmn.obj \
 	$(OBJS)\monolib_fontpickercmn.obj \
 	$(OBJS)\monolib_fldlgcmn.obj \
@@ -2955,6 +2963,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_helpwin.obj \
 	$(OBJS)\coredll_automtn.obj \
 	$(OBJS)\coredll_uuid.obj \
+	$(OBJS)\coredll_filectrlg.obj \
 	$(OBJS)\coredll_statusbr.obj \
 	$(OBJS)\coredll_prntdlgg.obj \
 	$(OBJS)\coredll_accel.obj \
@@ -3038,6 +3047,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_dseldlg.obj \
 	$(OBJS)\coredll_effects.obj \
 	$(OBJS)\coredll_fddlgcmn.obj \
+	$(OBJS)\coredll_filectrlcmn.obj \
 	$(OBJS)\coredll_filepickercmn.obj \
 	$(OBJS)\coredll_fontpickercmn.obj \
 	$(OBJS)\coredll_fldlgcmn.obj \
@@ -3183,6 +3193,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_colrdlgg.obj \
 	$(OBJS)\coredll_dirdlgg.obj \
 	$(OBJS)\coredll_fdrepdlg.obj \
+	$(OBJS)\coredll_filectrlg.obj \
 	$(OBJS)\coredll_filedlgg.obj \
 	$(OBJS)\coredll_fontdlgg.obj \
 	$(OBJS)\coredll_listctrl.obj \
@@ -3265,6 +3276,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  \
 	$(OBJS)\coredll_dseldlg.obj \
 	$(OBJS)\coredll_effects.obj \
 	$(OBJS)\coredll_fddlgcmn.obj \
+	$(OBJS)\coredll_filectrlcmn.obj \
 	$(OBJS)\coredll_filepickercmn.obj \
 	$(OBJS)\coredll_fontpickercmn.obj \
 	$(OBJS)\coredll_fldlgcmn.obj \
@@ -3416,6 +3428,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_helpwin.obj \
 	$(OBJS)\corelib_automtn.obj \
 	$(OBJS)\corelib_uuid.obj \
+	$(OBJS)\corelib_filectrlg.obj \
 	$(OBJS)\corelib_statusbr.obj \
 	$(OBJS)\corelib_prntdlgg.obj \
 	$(OBJS)\corelib_accel.obj \
@@ -3499,6 +3512,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_dseldlg.obj \
 	$(OBJS)\corelib_effects.obj \
 	$(OBJS)\corelib_fddlgcmn.obj \
+	$(OBJS)\corelib_filectrlcmn.obj \
 	$(OBJS)\corelib_filepickercmn.obj \
 	$(OBJS)\corelib_fontpickercmn.obj \
 	$(OBJS)\corelib_fldlgcmn.obj \
@@ -3644,6 +3658,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_colrdlgg.obj \
 	$(OBJS)\corelib_dirdlgg.obj \
 	$(OBJS)\corelib_fdrepdlg.obj \
+	$(OBJS)\corelib_filectrlg.obj \
 	$(OBJS)\corelib_filedlgg.obj \
 	$(OBJS)\corelib_fontdlgg.obj \
 	$(OBJS)\corelib_listctrl.obj \
@@ -3726,6 +3741,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  \
 	$(OBJS)\corelib_dseldlg.obj \
 	$(OBJS)\corelib_effects.obj \
 	$(OBJS)\corelib_fddlgcmn.obj \
+	$(OBJS)\corelib_filectrlcmn.obj \
 	$(OBJS)\corelib_filepickercmn.obj \
 	$(OBJS)\corelib_fontpickercmn.obj \
 	$(OBJS)\corelib_fldlgcmn.obj \
@@ -6606,6 +6622,11 @@ $(OBJS)\monodll_uuid.obj: ..\..\src\msw\ole\uuid.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_filectrlg.obj: ..\..\src\generic\filectrlg.cpp
+	$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "0"
 $(OBJS)\monodll_statusbr.obj: ..\..\src\generic\statusbr.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
@@ -7036,6 +7057,11 @@ $(OBJS)\monodll_fddlgcmn.obj: ..\..\src\common\fddlgcmn.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monodll_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
+	$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\monodll_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
@@ -8680,6 +8706,11 @@ $(OBJS)\monolib_uuid.obj: ..\..\src\msw\ole\uuid.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_filectrlg.obj: ..\..\src\generic\filectrlg.cpp
+	$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "0"
 $(OBJS)\monolib_statusbr.obj: ..\..\src\generic\statusbr.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
@@ -9110,6 +9141,11 @@ $(OBJS)\monolib_fddlgcmn.obj: ..\..\src\common\fddlgcmn.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\monolib_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
+	$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\monolib_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
@@ -10802,6 +10838,11 @@ $(OBJS)\coredll_uuid.obj: ..\..\src\msw\ole\uuid.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_filectrlg.obj: ..\..\src\generic\filectrlg.cpp
+	$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "0"
 $(OBJS)\coredll_statusbr.obj: ..\..\src\generic\statusbr.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
@@ -11232,6 +11273,11 @@ $(OBJS)\coredll_fddlgcmn.obj: ..\..\src\common\fddlgcmn.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\coredll_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
+	$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\coredll_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $**
@@ -12090,6 +12136,11 @@ $(OBJS)\corelib_uuid.obj: ..\..\src\msw\ole\uuid.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_filectrlg.obj: ..\..\src\generic\filectrlg.cpp
+	$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1" && "$(WXUNIV)" == "0"
 $(OBJS)\corelib_statusbr.obj: ..\..\src\generic\statusbr.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
@@ -12520,6 +12571,11 @@ $(OBJS)\corelib_fddlgcmn.obj: ..\..\src\common\fddlgcmn.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
 !endif
 
+!if "$(USE_GUI)" == "1"
+$(OBJS)\corelib_filectrlcmn.obj: ..\..\src\common\filectrlcmn.cpp
+	$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
+!endif
+
 !if "$(USE_GUI)" == "1"
 $(OBJS)\corelib_filepickercmn.obj: ..\..\src\common\filepickercmn.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $**
diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat
index 368e32542d..8884d3d8df 100644
--- a/build/msw/makefile.wat
+++ b/build/msw/makefile.wat
@@ -261,6 +261,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  &
 	$(OBJS)\monodll_helpwin.obj &
 	$(OBJS)\monodll_automtn.obj &
 	$(OBJS)\monodll_uuid.obj &
+	$(OBJS)\monodll_filectrlg.obj &
 	$(OBJS)\monodll_statusbr.obj &
 	$(OBJS)\monodll_prntdlgg.obj &
 	$(OBJS)\monodll_accel.obj &
@@ -344,6 +345,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  &
 	$(OBJS)\monodll_dseldlg.obj &
 	$(OBJS)\monodll_effects.obj &
 	$(OBJS)\monodll_fddlgcmn.obj &
+	$(OBJS)\monodll_filectrlcmn.obj &
 	$(OBJS)\monodll_filepickercmn.obj &
 	$(OBJS)\monodll_fontpickercmn.obj &
 	$(OBJS)\monodll_fldlgcmn.obj &
@@ -491,6 +493,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  &
 	$(OBJS)\monodll_colrdlgg.obj &
 	$(OBJS)\monodll_dirdlgg.obj &
 	$(OBJS)\monodll_fdrepdlg.obj &
+	$(OBJS)\monodll_filectrlg.obj &
 	$(OBJS)\monodll_filedlgg.obj &
 	$(OBJS)\monodll_fontdlgg.obj &
 	$(OBJS)\monodll_listctrl.obj &
@@ -573,6 +576,7 @@ ____CORE_SRC_FILENAMES_OBJECTS =  &
 	$(OBJS)\monodll_dseldlg.obj &
 	$(OBJS)\monodll_effects.obj &
 	$(OBJS)\monodll_fddlgcmn.obj &
+	$(OBJS)\monodll_filectrlcmn.obj &
 	$(OBJS)\monodll_filepickercmn.obj &
 	$(OBJS)\monodll_fontpickercmn.obj &
 	$(OBJS)\monodll_fldlgcmn.obj &
@@ -904,6 +908,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  &
 	$(OBJS)\monolib_helpwin.obj &
 	$(OBJS)\monolib_automtn.obj &
 	$(OBJS)\monolib_uuid.obj &
+	$(OBJS)\monolib_filectrlg.obj &
 	$(OBJS)\monolib_statusbr.obj &
 	$(OBJS)\monolib_prntdlgg.obj &
 	$(OBJS)\monolib_accel.obj &
@@ -987,6 +992,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  &
 	$(OBJS)\monolib_dseldlg.obj &
 	$(OBJS)\monolib_effects.obj &
 	$(OBJS)\monolib_fddlgcmn.obj &
+	$(OBJS)\monolib_filectrlcmn.obj &
 	$(OBJS)\monolib_filepickercmn.obj &
 	$(OBJS)\monolib_fontpickercmn.obj &
 	$(OBJS)\monolib_fldlgcmn.obj &
@@ -1134,6 +1140,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  &
 	$(OBJS)\monolib_colrdlgg.obj &
 	$(OBJS)\monolib_dirdlgg.obj &
 	$(OBJS)\monolib_fdrepdlg.obj &
+	$(OBJS)\monolib_filectrlg.obj &
 	$(OBJS)\monolib_filedlgg.obj &
 	$(OBJS)\monolib_fontdlgg.obj &
 	$(OBJS)\monolib_listctrl.obj &
@@ -1216,6 +1223,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS =  &
 	$(OBJS)\monolib_dseldlg.obj &
 	$(OBJS)\monolib_effects.obj &
 	$(OBJS)\monolib_fddlgcmn.obj &
+	$(OBJS)\monolib_filectrlcmn.obj &
 	$(OBJS)\monolib_filepickercmn.obj &
 	$(OBJS)\monolib_fontpickercmn.obj &
 	$(OBJS)\monolib_fldlgcmn.obj &
@@ -1475,6 +1483,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  &
 	$(OBJS)\coredll_helpwin.obj &
 	$(OBJS)\coredll_automtn.obj &
 	$(OBJS)\coredll_uuid.obj &
+	$(OBJS)\coredll_filectrlg.obj &
 	$(OBJS)\coredll_statusbr.obj &
 	$(OBJS)\coredll_prntdlgg.obj &
 	$(OBJS)\coredll_accel.obj &
@@ -1558,6 +1567,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  &
 	$(OBJS)\coredll_dseldlg.obj &
 	$(OBJS)\coredll_effects.obj &
 	$(OBJS)\coredll_fddlgcmn.obj &
+	$(OBJS)\coredll_filectrlcmn.obj &
 	$(OBJS)\coredll_filepickercmn.obj &
 	$(OBJS)\coredll_fontpickercmn.obj &
 	$(OBJS)\coredll_fldlgcmn.obj &
@@ -1705,6 +1715,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  &
 	$(OBJS)\coredll_colrdlgg.obj &
 	$(OBJS)\coredll_dirdlgg.obj &
 	$(OBJS)\coredll_fdrepdlg.obj &
+	$(OBJS)\coredll_filectrlg.obj &
 	$(OBJS)\coredll_filedlgg.obj &
 	$(OBJS)\coredll_fontdlgg.obj &
 	$(OBJS)\coredll_listctrl.obj &
@@ -1787,6 +1798,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS =  &
 	$(OBJS)\coredll_dseldlg.obj &
 	$(OBJS)\coredll_effects.obj &
 	$(OBJS)\coredll_fddlgcmn.obj &
+	$(OBJS)\coredll_filectrlcmn.obj &
 	$(OBJS)\coredll_filepickercmn.obj &
 	$(OBJS)\coredll_fontpickercmn.obj &
 	$(OBJS)\coredll_fldlgcmn.obj &
@@ -1940,6 +1952,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  &
 	$(OBJS)\corelib_helpwin.obj &
 	$(OBJS)\corelib_automtn.obj &
 	$(OBJS)\corelib_uuid.obj &
+	$(OBJS)\corelib_filectrlg.obj &
 	$(OBJS)\corelib_statusbr.obj &
 	$(OBJS)\corelib_prntdlgg.obj &
 	$(OBJS)\corelib_accel.obj &
@@ -2023,6 +2036,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  &
 	$(OBJS)\corelib_dseldlg.obj &
 	$(OBJS)\corelib_effects.obj &
 	$(OBJS)\corelib_fddlgcmn.obj &
+	$(OBJS)\corelib_filectrlcmn.obj &
 	$(OBJS)\corelib_filepickercmn.obj &
 	$(OBJS)\corelib_fontpickercmn.obj &
 	$(OBJS)\corelib_fldlgcmn.obj &
@@ -2170,6 +2184,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  &
 	$(OBJS)\corelib_colrdlgg.obj &
 	$(OBJS)\corelib_dirdlgg.obj &
 	$(OBJS)\corelib_fdrepdlg.obj &
+	$(OBJS)\corelib_filectrlg.obj &
 	$(OBJS)\corelib_filedlgg.obj &
 	$(OBJS)\corelib_fontdlgg.obj &
 	$(OBJS)\corelib_listctrl.obj &
@@ -2252,6 +2267,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS =  &
 	$(OBJS)\corelib_dseldlg.obj &
 	$(OBJS)\corelib_effects.obj &
 	$(OBJS)\corelib_fddlgcmn.obj &
+	$(OBJS)\corelib_filectrlcmn.obj &
 	$(OBJS)\corelib_filepickercmn.obj &
 	$(OBJS)\corelib_fontpickercmn.obj &
 	$(OBJS)\corelib_fldlgcmn.obj &
@@ -6675,6 +6691,11 @@ $(OBJS)\monodll_uuid.obj :  .AUTODEPEND ..\..\src\msw\ole\uuid.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\monodll_filectrlg.obj :  .AUTODEPEND ..\..\src\generic\filectrlg.cpp
+	$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 !ifeq WXUNIV 0
 $(OBJS)\monodll_statusbr.obj :  .AUTODEPEND ..\..\src\generic\statusbr.cpp
@@ -7205,6 +7226,11 @@ $(OBJS)\monodll_fddlgcmn.obj :  .AUTODEPEND ..\..\src\common\fddlgcmn.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\monodll_filectrlcmn.obj :  .AUTODEPEND ..\..\src\common\filectrlcmn.cpp
+	$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 $(OBJS)\monodll_filepickercmn.obj :  .AUTODEPEND ..\..\src\common\filepickercmn.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
@@ -8849,6 +8875,11 @@ $(OBJS)\monolib_uuid.obj :  .AUTODEPEND ..\..\src\msw\ole\uuid.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\monolib_filectrlg.obj :  .AUTODEPEND ..\..\src\generic\filectrlg.cpp
+	$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 !ifeq WXUNIV 0
 $(OBJS)\monolib_statusbr.obj :  .AUTODEPEND ..\..\src\generic\statusbr.cpp
@@ -9379,6 +9410,11 @@ $(OBJS)\monolib_fddlgcmn.obj :  .AUTODEPEND ..\..\src\common\fddlgcmn.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\monolib_filectrlcmn.obj :  .AUTODEPEND ..\..\src\common\filectrlcmn.cpp
+	$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 $(OBJS)\monolib_filepickercmn.obj :  .AUTODEPEND ..\..\src\common\filepickercmn.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
@@ -11071,6 +11107,11 @@ $(OBJS)\coredll_uuid.obj :  .AUTODEPEND ..\..\src\msw\ole\uuid.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\coredll_filectrlg.obj :  .AUTODEPEND ..\..\src\generic\filectrlg.cpp
+	$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 !ifeq WXUNIV 0
 $(OBJS)\coredll_statusbr.obj :  .AUTODEPEND ..\..\src\generic\statusbr.cpp
@@ -11601,6 +11642,11 @@ $(OBJS)\coredll_fddlgcmn.obj :  .AUTODEPEND ..\..\src\common\fddlgcmn.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\coredll_filectrlcmn.obj :  .AUTODEPEND ..\..\src\common\filectrlcmn.cpp
+	$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 $(OBJS)\coredll_filepickercmn.obj :  .AUTODEPEND ..\..\src\common\filepickercmn.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $<
@@ -12459,6 +12505,11 @@ $(OBJS)\corelib_uuid.obj :  .AUTODEPEND ..\..\src\msw\ole\uuid.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\corelib_filectrlg.obj :  .AUTODEPEND ..\..\src\generic\filectrlg.cpp
+	$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 !ifeq WXUNIV 0
 $(OBJS)\corelib_statusbr.obj :  .AUTODEPEND ..\..\src\generic\statusbr.cpp
@@ -12989,6 +13040,11 @@ $(OBJS)\corelib_fddlgcmn.obj :  .AUTODEPEND ..\..\src\common\fddlgcmn.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
 !endif
 
+!ifeq USE_GUI 1
+$(OBJS)\corelib_filectrlcmn.obj :  .AUTODEPEND ..\..\src\common\filectrlcmn.cpp
+	$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
+!endif
+
 !ifeq USE_GUI 1
 $(OBJS)\corelib_filepickercmn.obj :  .AUTODEPEND ..\..\src\common\filepickercmn.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $<
diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp
index bf0480a76d..4853084825 100644
--- a/build/msw/wx_core.dsp
+++ b/build/msw/wx_core.dsp
@@ -602,6 +602,10 @@ SOURCE=..\..\src\common\fddlgcmn.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\src\common\filectrlcmn.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\src\common\filepickercmn.cpp
 # End Source File
 # Begin Source File
@@ -4319,6 +4323,10 @@ SOURCE=..\..\src\generic\fdrepdlg.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\src\generic\filectrlg.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\src\generic\filedlgg.cpp
 
 !IF  "$(CFG)" == "core - Win32 DLL Universal Unicode Release"
@@ -8293,6 +8301,10 @@ SOURCE=..\..\include\wx\generic\fdrepdlg.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\include\wx\generic\filectrlg.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\include\wx\generic\filedlgg.h
 # End Source File
 # Begin Source File
@@ -8929,6 +8941,10 @@ SOURCE=..\..\include\wx\fdrepdlg.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\include\wx\filectrl.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\include\wx\filedlg.h
 # End Source File
 # Begin Source File
diff --git a/configure b/configure
index 8fd7a86747..ba33eb5b3b 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Id: configure.in 48647 2007-09-13 05:42:42Z PC .
+# From configure.in Id: configure.in 48648 2007-09-13 06:24:14Z PC .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for wxWidgets 2.9.0.
 #
@@ -1782,6 +1782,7 @@ Optional Features:
   --enable-detect_sm      use code to detect X11 session manager
   --enable-editablebox    use wxEditableListBox class
   --enable-filepicker     use wxFilePickerCtrl class
+  --enable-filectrl       use wxFileCtrl class
   --enable-fontpicker     use wxFontPickerCtrl class
   --enable-gauge          use wxGauge class
   --enable-grid           use wxGrid class
@@ -10911,6 +10912,7 @@ if test "$wxUSE_CONTROLS" = "yes"; then
   DEFAULT_wxUSE_DISPLAY=yes
   DEFAULT_wxUSE_DETECT_SM=yes
   DEFAULT_wxUSE_DIRPICKERCTRL=yes
+  DEFAULT_wxUSE_FILECTRL=yes
   DEFAULT_wxUSE_FILEPICKERCTRL=yes
   DEFAULT_wxUSE_FONTPICKERCTRL=yes
   DEFAULT_wxUSE_GAUGE=yes
@@ -10964,6 +10966,7 @@ elif test "$wxUSE_CONTROLS" = "no"; then
   DEFAULT_wxUSE_DISPLAY=no
   DEFAULT_wxUSE_DETECT_SM=no
   DEFAULT_wxUSE_DIRPICKERCTRL=no
+  DEFAULT_wxUSE_FILECTRL=no
   DEFAULT_wxUSE_FILEPICKERCTRL=no
   DEFAULT_wxUSE_FONTPICKERCTRL=no
   DEFAULT_wxUSE_GAUGE=no
@@ -12177,6 +12180,62 @@ fi
 echo "${ECHO_T}$result" >&6; }
 
 
+          enablestring=
+          defaultval=$wxUSE_ALL_FEATURES
+          if test -z "$defaultval"; then
+              if test x"$enablestring" = xdisable; then
+                  defaultval=yes
+              else
+                  defaultval=no
+              fi
+          fi
+
+          { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-filectrl" >&5
+echo $ECHO_N "checking for --${enablestring:-enable}-filectrl... $ECHO_C" >&6; }
+          # Check whether --enable-filectrl was given.
+if test "${enable_filectrl+set}" = set; then
+  enableval=$enable_filectrl;
+                          if test "$enableval" = yes; then
+                            wx_cv_use_filectrl='wxUSE_FILECTRL=yes'
+                          else
+                            wx_cv_use_filectrl='wxUSE_FILECTRL=no'
+                          fi
+                          cache=yes
+
+else
+
+                          LINE=`grep "^wxUSE_FILECTRL=" ${wx_arg_cache_file}`
+                          if test "x$LINE" != x ; then
+                              eval "DEFAULT_$LINE"
+                              cache=yes
+                          else
+                              cache=no
+                          fi
+
+                          wx_cv_use_filectrl='wxUSE_FILECTRL=${'DEFAULT_wxUSE_FILECTRL":-$defaultval}"
+
+fi
+
+
+          eval "$wx_cv_use_filectrl"
+          if test "x$cache" = xyes; then
+            echo "wxUSE_FILECTRL=$wxUSE_FILECTRL" >> ${wx_arg_cache_file}.tmp
+          fi
+
+          if test x"$enablestring" = xdisable; then
+            if test $wxUSE_FILECTRL = yes; then
+              result=no
+            else
+              result=yes
+            fi
+          else
+            result=$wxUSE_FILECTRL
+          fi
+
+          { echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
+
+
           enablestring=
           defaultval=$wxUSE_ALL_FEATURES
           if test -z "$defaultval"; then
@@ -47842,6 +47901,14 @@ _ACEOF
   USES_CONTROLS=1
 fi
 
+if test "$wxUSE_FILECTRL" = "yes"; then
+  cat >>confdefs.h <<\_ACEOF
+#define wxUSE_FILECTRL 1
+_ACEOF
+
+  USES_CONTROLS=1
+fi
+
 if test "$wxUSE_FILEPICKERCTRL" = "yes"; then
   cat >>confdefs.h <<\_ACEOF
 #define wxUSE_FILEPICKERCTRL 1
diff --git a/configure.in b/configure.in
index 443a1866e0..0c5fe7b99c 100644
--- a/configure.in
+++ b/configure.in
@@ -736,6 +736,7 @@ if test "$wxUSE_CONTROLS" = "yes"; then
   DEFAULT_wxUSE_DISPLAY=yes
   DEFAULT_wxUSE_DETECT_SM=yes
   DEFAULT_wxUSE_DIRPICKERCTRL=yes
+  DEFAULT_wxUSE_FILECTRL=yes
   DEFAULT_wxUSE_FILEPICKERCTRL=yes
   DEFAULT_wxUSE_FONTPICKERCTRL=yes
   DEFAULT_wxUSE_GAUGE=yes
@@ -789,6 +790,7 @@ elif test "$wxUSE_CONTROLS" = "no"; then
   DEFAULT_wxUSE_DISPLAY=no
   DEFAULT_wxUSE_DETECT_SM=no
   DEFAULT_wxUSE_DIRPICKERCTRL=no
+  DEFAULT_wxUSE_FILECTRL=no
   DEFAULT_wxUSE_FILEPICKERCTRL=no
   DEFAULT_wxUSE_FONTPICKERCTRL=no
   DEFAULT_wxUSE_GAUGE=no
@@ -846,6 +848,7 @@ WX_ARG_FEATURE(display,     [  --enable-display        use wxDisplay class], wxU
 WX_ARG_FEATURE(detect_sm,   [  --enable-detect_sm      use code to detect X11 session manager], wxUSE_DETECT_SM)
 WX_ARG_FEATURE(editablebox, [  --enable-editablebox    use wxEditableListBox class], wxUSE_EDITABLELISTBOX)
 WX_ARG_FEATURE(filepicker,  [  --enable-filepicker     use wxFilePickerCtrl class], wxUSE_FILEPICKERCTRL)
+WX_ARG_FEATURE(filectrl,    [  --enable-filectrl       use wxFileCtrl class], wxUSE_FILECTRL)
 WX_ARG_FEATURE(fontpicker,  [  --enable-fontpicker     use wxFontPickerCtrl class], wxUSE_FONTPICKERCTRL)
 WX_ARG_FEATURE(gauge,       [  --enable-gauge          use wxGauge class], wxUSE_GAUGE)
 WX_ARG_FEATURE(grid,        [  --enable-grid           use wxGrid class], wxUSE_GRID)
@@ -6491,6 +6494,11 @@ if test "$wxUSE_DIRPICKERCTRL" = "yes"; then
   USES_CONTROLS=1
 fi
 
+if test "$wxUSE_FILECTRL" = "yes"; then
+  AC_DEFINE(wxUSE_FILECTRL)
+  USES_CONTROLS=1
+fi
+
 if test "$wxUSE_FILEPICKERCTRL" = "yes"; then
   AC_DEFINE(wxUSE_FILEPICKERCTRL)
   USES_CONTROLS=1
diff --git a/docs/changes.txt b/docs/changes.txt
index 6ae566da88..ed1a6b0be7 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -168,8 +168,9 @@ All (GUI):
 - Added support for labels for toolbar controls (Vince Harron).
 - Added wxMessageDialog::SetMessage() and SetExtendedMessage().
 - Added XRCSIZERITEM() macro for obtaining sizers from XRC (Brian Vanderburg II)
-- Added wxEventBlocker class (Francesco Montorsi)..
-- Added wxFile/DirPickerCtrl::Get/SetFile/DirName() (Francesco Montorsi)..
+- New and improved wxFileCtrl (Diaa Sami and Marcin Wojdyr)
+- Added wxEventBlocker class (Francesco Montorsi).
+- Added wxFile/DirPickerCtrl::Get/SetFile/DirName() (Francesco Montorsi).
 - Added wxSizerFlags::Top() and Bottom().
 - Slovak translation added.
 - Fixed tab-related drawing and hit-testing bugs in wxRichTextCtrl.
diff --git a/docs/latex/wx/classes.tex b/docs/latex/wx/classes.tex
index 47b1ec89c8..72e6f7ad12 100644
--- a/docs/latex/wx/classes.tex
+++ b/docs/latex/wx/classes.tex
@@ -141,6 +141,8 @@
 \input ffilestr.tex
 \input file.tex
 \input fileconf.tex
+\input filectrl.tex
+\input fileevt.tex
 \input fildatob.tex
 \input filedlg.tex
 \input fildrptg.tex
diff --git a/docs/latex/wx/filectrl.tex b/docs/latex/wx/filectrl.tex
new file mode 100644
index 0000000000..e4ec94a647
--- /dev/null
+++ b/docs/latex/wx/filectrl.tex
@@ -0,0 +1,222 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Name:        filectrl.tex
+%% Purpose:     wxFilerCtrl documentation
+%% Author:      Diaa M. Sami
+%% Created:     2007-07-25
+%% RCS-ID:      $Id: $
+%% Copyright:   (c) 2007 Diaa M. Sami
+%% License:     wxWindows license
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{\class{wxFileCtrl}}\label{wxfilectrl}
+
+This control allows the user to select a file. two implemetations exist, one
+for Gtk and another generic one for anything other than Gtk.
+It is only available if \texttt{wxUSE\_FILECTRL} is set to $1$.
+
+\wxheading{Derived from}
+
+\helpref{wxWindow}{wxwindow}\\
+\helpref{wxEvtHandler}{wxevthandler}\\
+\helpref{wxObject}{wxobject}
+
+\wxheading{Include files}
+
+<wx/filectrl.h>
+
+\wxheading{Window styles}
+
+\twocolwidtha{5cm}%
+\begin{twocollist}\itemsep=0pt
+\twocolitem{\windowstyle{wxFC\_DEFAULT\_STYLE}}{The default style: wxFC\_OPEN}
+\twocolitem{\windowstyle{wxFC\_OPEN}}{Creates an file control suitable for opening files.
+Cannot be combined with wxFC\_SAVE.}
+\twocolitem{\windowstyle{wxFC\_SAVE}}{Creates an file control suitable for saving files. Cannot be combined with wxFC\_OPEN.}
+\twocolitem{\windowstyle{wxFC\_MULTIPLE}}{For open control only, Allows selecting multiple files. Cannot be combined with wxFC\_SAVE}
+\twocolitem{\windowstyle{wxFC\_NOSHOWHIDDEN}}{Hides the ``Show Hidden Files" checkbox (Generic only)}
+\end{twocollist}
+
+\wxheading{Event handling}
+
+To process a file control event, use these event handler macros to direct
+input to member functions that take a \helpref{wxFileCtrlEvent}{wxfilectrlevent}
+argument.
+
+\twocolwidtha{7cm}%
+\begin{twocollist}\itemsep=0pt
+\twocolitem{{\bf EVT\_FILECTRL\_FILEACTIVATED(id, func)}}{The user activated a file(by double-clicking or pressing Enter)}
+\twocolitem{{\bf EVT\_FILECTRL\_SELECTIONCHANGED(id, func)}}{The user changed the current selection(by selecting or deselecting a file)}
+\twocolitem{{\bf EVT\_FILECTRL\_FOLDERCHANGED(id, func)}}{The current folder of the file ctrl has been changed}
+\end{twocollist}
+
+\wxheading{See also}
+
+\helpref{wxGenericDirCtrl}{wxgenericdirctrl}
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
+\membersection{wxFileCtrl::wxFileCtrl}\label{wxfilectrlctor}
+
+\func{}{wxFileCtrl}{\void}
+
+Default constructor.
+
+\func{}{wxFileCtrl}{\param{wxWindow *}{parent},\rtfsp
+\param{wxWindowID}{ id},\rtfsp
+\param{const wxString\& }{defaultDirectory = wxEmptyString},\rtfsp
+\param{const wxString\& }{defaultFilename = wxEmptyString},\rtfsp
+\param{const wxPoint\& }{wildCard = wxFileSelectorDefaultWildcardStr},\rtfsp
+\param{long}{ style = wxFC\_DEFAULT\_STYLE},\rtfsp
+\param{const wxPoint\& }{pos = wxDefaultPosition},
+\param{const wxSize\& }{size = wxDefaultSize},
+\param{const wxString\& }{name = ``filectrl"}}
+
+\wxheading{Parameters}
+
+\docparam{parent}{Parent window, must not be non-\texttt{NULL}.}
+
+\docparam{id}{The identifier for the control.}
+
+\docparam{defaultDirectory}{The initial directory shown in the control. Must be
+a valid path to a directory or the empty string.
+In case it is the empty string, the current working directory is used.}
+
+\docparam{defaultFilename}{The default filename, or the empty string.}
+
+\docparam{wildcard}{A wildcard specifying which files can be selected,
+such as ``*.*" or ``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".}
+
+\docparam{style}{The window style, see {\tt wxFC\_*} flags.}
+
+\docparam{pos}{Initial position.}
+
+\docparam{size}{Initial size.}
+
+\docparam{name}{Control name.}
+
+\wxheading{Return value}
+
+\true if the control was successfully created or \false if creation failed.
+
+\membersection{wxFileCtrl::Create}\label{wxfilectrlcreate}
+
+\func{bool}{Create}{\param{wxWindow *}{parent},\rtfsp
+\param{wxWindowID}{ id},\rtfsp
+\param{const wxString\& }{defaultDirectory = wxEmptyString},\rtfsp
+\param{const wxString\& }{defaultFilename = wxEmptyString},\rtfsp
+\param{const wxPoint\& }{wildCard = wxFileSelectorDefaultWildcardStr},\rtfsp
+\param{long}{ style = wxFC\_DEFAULT\_STYLE},\rtfsp
+\param{const wxPoint\& }{pos = wxDefaultPosition},
+\param{const wxSize\& }{size = wxDefaultSize},
+\param{const wxString\& }{name = ``filectrl"}}
+
+Create function for two-step construction. See \helpref{wxFileCtrl::wxFileCtrl}{wxfilectrlctor} for details.
+
+\membersection{wxFileDialog::GetFilename}\label{wxfilectrlgetfilename}
+
+\constfunc{wxString}{GetFilename}{\void}
+
+Returns the currently selected filename.
+For the controls having the {\tt wxFC\_MULTIPLE} style, use \helpref{GetFilenames}{wxfilectrlgetfilenames}
+instead
+
+\membersection{wxFileCtrl::GetDirectory}\label{wxfilectrlgetdirectory}
+
+\constfunc{wxString}{GetDirectory}{\void}
+
+Returns the current directory of the file ctrl(the directory shown in the file ctrl).
+
+\membersection{wxFileCtrl::GetWildcard}\label{wxfilectrlgetwildcard}
+
+\constfunc{wxString}{GetWildcard}{\void}
+
+Returns the current wildcard.
+
+\membersection{wxFileCtrl::GetPath}\label{wxfilectrlgetpath}
+
+\constfunc{wxString}{GetPath}{\void}
+
+Returns the full path (directory and filename) of the currently selected file.
+For the controls having the {\tt wxFC\_MULTIPLE} style, use \helpref{GetPaths}{wxfilectrlgetpaths}
+instead
+
+\membersection{wxFileCtrl::GetPaths}\label{wxfilectrlgetpaths}
+
+\constfunc{void}{GetPaths}{\param{wxArrayString\& }{paths}}
+
+Fills the array {\it paths} with the full paths of the files chosen. This
+function should be used with the controls having the {\tt wxFC\_MULTIPLE} style,
+use \helpref{GetPath}{wxfilectrlgetpath} otherwise.
+
+\wxheading{Remarks}
+
+{\it paths} is emptied first.
+
+\membersection{wxFileCtrl::GetFilenames}\label{wxfilectrlgetfilenames}
+
+\constfunc{void}{GetFilenames}{\param{wxArrayString\& }{filenames}}
+
+Fills the array {\it filenames} with the filenames only of selected items. This
+function should only be used with the controls having the {\tt wxFC\_MULTIPLE} style,
+use \helpref{GetFilename}{wxfilectrlgetfilename} for the others.
+
+\wxheading{Remarks}
+
+{\it filenames} is emptied first.
+
+\membersection{wxFileCtrl::GetFilterIndex}\label{wxfilectrlgetfilterindex}
+
+\constfunc{int}{GetFilterIndex}{\void}
+
+Returns the zero-based index of the currently selected filter.
+
+\membersection{wxFileCtrl::ShowHidden}\label{wxfilectrlshowhidden}
+
+\func{void}{ShowHidden}{\param{const bool }{show}}
+
+Sets whether hidden files and folders are shown or not.
+
+\membersection{wxFileCtrl::SetWildcard}\label{wxfilectrlsetwildcard}
+
+\func{void}{SetWildcard}{\param{const wxString\& }{wildCard}}
+
+Sets the wildcard, which can contain multiple file types, for example:
+
+``BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
+
+\membersection{wxFileCtrl::SetFilterIndex}\label{wxfilectrlsetfilterindex}
+
+\func{void}{SetFilterIndex}{\param{int }{filterIndex}}
+
+Sets the current filter index, starting from zero.
+
+\membersection{wxFileCtrl::SetDirectory}\label{wxfilectrlsetdirectory}
+
+\func{bool}{SetDirectory}{\param{const wxString\& }{directory}}
+
+Sets(changes) the current directory displayed in the control.
+
+\wxheading{Return value}
+
+Returns \true on success, \false otherwise.
+
+\membersection{wxFileCtrl::SetFilename}\label{wxfilectrlsetfilename}
+
+\func{bool}{SetFilename}{\param{const wxString\& }{filename}}
+
+Selects a certain file.
+
+\wxheading{Return value}
+
+Returns \true on success, \false otherwise
+
+\membersection{wxFileCtrl::SetPath}\label{wxfilectrlsetpath}
+
+\func{bool}{SetPath}{\param{const wxString\& }{path}}
+
+Selects a certain file using its path (the combined directory and filename).
+Equivalent to \helpref{SetPath}{wxfilectrlsetpath} then \helpref{SetFilename}{wxfilectrlsetfilename}.
+
+\wxheading{Return value}
+
+Returns \true on success, \false otherwise.
diff --git a/docs/latex/wx/fileevt.tex b/docs/latex/wx/fileevt.tex
new file mode 100644
index 0000000000..cccb6db5a5
--- /dev/null
+++ b/docs/latex/wx/fileevt.tex
@@ -0,0 +1,77 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Name:        fileevt.tex
+%% Purpose:     wxFileCtrlEvent documentation
+%% Author:      Diaa M. Sami
+%% Created:     2007-07-25
+%% RCS-ID:      $Id: $
+%% Copyright:   (c) 2007 Diaa M. Sami
+%% License:     wxWindows license
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{\class{wxFileCtrlEvent}}\label{wxfilectrlevent}
+
+A file control event holds information about events associated with
+\helpref{wxFileCtrl}{wxfilectrl} objects.
+
+\wxheading{Derived from}
+
+\helpref{wxCommandEvent}{wxcommandevent}\\
+\helpref{wxEvent}{wxevent}\\
+\helpref{wxObject}{wxobject}
+
+\wxheading{Include files}
+
+<wx/filectrl.h>
+
+\wxheading{Event table macros}
+
+To process input from a file control, use these event handler macros to direct input to member
+functions that take a wxFileCtrlEvent argument.
+
+\twocolwidtha{7cm}
+\begin{twocollist}\itemsep=0pt
+\twocolitem{{\bf EVT\_FILECTRL\_FILEACTIVATED(id, func)}}{The user activated a file(by double-clicking or pressing Enter)}
+\twocolitem{{\bf EVT\_FILECTRL\_SELECTIONCHANGED(id, func)}}{The user changed the current selection(by selecting or deselecting a file)}
+\twocolitem{{\bf EVT\_FILECTRL\_FOLDERCHANGED(id, func)}}{The current folder of the file ctrl has been changed}
+\end{twocollist}%
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
+\membersection{wxFileCtrlEvent::wxFileCtrlEvent}\label{wxfilectrleventctor}
+
+\func{}{wxFileCtrlEvent}{\param{wxEventType }{type}, \param{wxObject }{evtObject}, \param{int }{id}}
+
+Constructor.
+
+\membersection{wxFileCtrlEvent::GetFiles}\label{wxfilectrleventgetfiles}
+
+\constfunc{wxArrayString}{GetFiles}{\void}
+
+Returns the files selected.
+In case of a {\bf EVT\_FILECTRL\_SELECTIONCHANGED}, this method returns the
+files selected after the event.
+
+\membersection{wxFileCtrlEvent::GetDirectory}\label{wxfilectrleventgetdirectory}
+
+\constfunc{wxString}{GetDirectory}{\void}
+
+Returns the current directory.
+In case of a {\bf EVT\_FILECTRL\_FOLDERCHANGED}, this method returns the new directory.
+
+\membersection{wxFileCtrlEvent::GetFile}\label{wxfilectrleventgetfile}
+
+\constfunc{wxString}{GetFile}{\void}
+
+Returns the file selected(assuming it is only one file).
+
+\membersection{wxFileCtrlEvent::SetFiles}\label{wxfilectrleventsetfiles}
+
+\func{}{wxFileCtrlEvent::SetFiles}{\param{const wxArrayString &}{files}}
+
+Sets the files changed by this event.
+
+\membersection{wxFileCtrlEvent::SetDirectory}\label{wxfilectrleventsetdirectory}
+
+\func{}{wxFileCtrlEvent::SetDirectory}{\param{const wxString &}{directory}}
+
+Sets the current directory of this event.
diff --git a/docs/latex/wx/wxusedef.tex b/docs/latex/wx/wxusedef.tex
index 8ab4119cc4..25e1994540 100644
--- a/docs/latex/wx/wxusedef.tex
+++ b/docs/latex/wx/wxusedef.tex
@@ -75,6 +75,7 @@ using \texttt{#if} and not \texttt{#ifdef}.
 \twocolitem{wxUSE\_FFILE}{Use \helpref{wxFFile}{wxffile} class.}
 \twocolitem{wxUSE\_FILE}{Use \helpref{wxFile}{wxfile} class.}
 \twocolitem{wxUSE\_FILECONFIG}{Use \helpref{wxFileConfig}{wxfileconfig} class.}
+\twocolitem{wxUSE\_FILECTRL}{Use \helpref{wxFileCtrl}{wxfilectrl} class.}
 \twocolitem{wxUSE\_FILEDLG}{Use \helpref{wxFileDialog}{wxfiledialog} class.}
 \twocolitem{wxUSE\_FILEPICKERCTRL}{Use \helpref{wxFilePickerCtrl}{wxfilepickerctrl} class.}
 \twocolitem{wxUSE\_FILESYSTEM}{Use \helpref{wxFileSystem}{wxfilesystem} and related classes.}
diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h
index a8749d7371..8afc686067 100644
--- a/include/wx/chkconf.h
+++ b/include/wx/chkconf.h
@@ -511,6 +511,14 @@
 #   endif
 #endif /* !defined(wxUSE_DOC_VIEW_ARCHITECTURE) */
 
+#ifndef wxUSE_FILECTRL
+#   ifdef wxABORT_ON_CONFIG_ERROR
+#       error "wxUSE_FILECTRL must be defined."
+#   else
+#       define wxUSE_FILECTRL 0
+#   endif
+#endif /* !defined(wxUSE_FILECTRL) */
+
 #ifndef wxUSE_FILEDLG
 #   ifdef wxABORT_ON_CONFIG_ERROR
 #       error "wxUSE_FILEDLG must be defined."
@@ -1417,6 +1425,17 @@
 #   endif
 #endif /* !wxMSW || wxUniv */
 
+/* generic file dialog depends on (generic) file control */
+#if wxUSE_FILEDLG && !wxUSE_FILECTRL && \
+        (defined(__WXUNIVERSAL__) || defined(__WXGTK__))
+#   ifdef wxABORT_ON_CONFIG_ERROR
+#       error "Generic wxFileDialog requires wxFileCtrl"
+#   else
+#       undef wxUSE_FILECTRL
+#       define wxUSE_FILECTRL 1
+#   endif
+#endif /* wxUSE_FILEDLG */
+
 /* common dependencies */
 #if wxUSE_CALENDARCTRL
 #   if !(wxUSE_SPINBTN && wxUSE_COMBOBOX)
diff --git a/include/wx/defs.h b/include/wx/defs.h
index 3ea852db01..8311be30bc 100644
--- a/include/wx/defs.h
+++ b/include/wx/defs.h
@@ -1875,6 +1875,9 @@ enum
 
     /*  IDs used by generic file dialog (13 consecutive starting from this value) */
     wxID_FILEDLGG = 5900,
+    
+    /*  IDs used by generic file ctrl (4 consecutive starting from this value) */
+    wxID_FILECTRL = 5950,
 
     wxID_HIGHEST = 5999
 };
diff --git a/include/wx/filectrl.h b/include/wx/filectrl.h
new file mode 100644
index 0000000000..b12a666d05
--- /dev/null
+++ b/include/wx/filectrl.h
@@ -0,0 +1,138 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/filectrl.h
+// Purpose:     Header for wxFileCtrlBase and other common functions used by
+//              platform-specific wxFileCtrl's
+// Author:      Diaa M. Sami
+// Modified by:
+// Created:     Jul-07-2007
+// RCS-ID:      $Id$
+// Copyright:   (c) Diaa M. Sami
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_FILECTRL_H_BASE_
+#define _WX_FILECTRL_H_BASE_
+
+#include "wx/defs.h"
+
+#if wxUSE_FILECTRL
+
+#include "wx/string.h"
+#include "wx/event.h"
+
+enum
+{
+    wxFC_OPEN              = 0x0001,
+    wxFC_SAVE              = 0x0002,
+    wxFC_MULTIPLE          = 0x0004,
+    wxFC_NOSHOWHIDDEN      = 0x0008,
+};
+
+#define wxFC_DEFAULT_STYLE wxFC_OPEN
+extern WXDLLEXPORT_DATA( const wxChar ) wxFileCtrlNameStr[];
+
+BEGIN_DECLARE_EVENT_TYPES()
+    DECLARE_EXPORTED_EVENT_TYPE( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_SELECTIONCHANGED, 1150 )
+    DECLARE_EXPORTED_EVENT_TYPE( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILEACTIVATED, 1151 )
+    DECLARE_EXPORTED_EVENT_TYPE( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FOLDERCHANGED, 1152 )
+END_DECLARE_EVENT_TYPES()
+
+class WXDLLIMPEXP_CORE wxFileCtrlBase
+{
+public:
+    virtual ~wxFileCtrlBase() {}
+
+    virtual void SetWildcard( const wxString& wildCard ) = 0;
+    virtual void SetFilterIndex( int filterindex ) = 0;
+    virtual bool SetDirectory( const wxString& dir ) = 0;
+
+    // Selects a certain file.
+    // In case the filename specified isn't found/couldn't be shown with
+    // currently selected filter, false is returned and nothing happens
+    virtual bool SetFilename( const wxString& name ) = 0;
+
+    // chdirs to a certain directory and selects a certain file.
+    // In case the filename specified isn't found/couldn't be shown with
+    // currently selected filter, false is returned and if directory exists
+    // it's chdir'ed to
+    virtual bool SetPath( const wxString& path ) = 0;
+
+    virtual wxString GetFilename() const = 0;
+    virtual wxString GetDirectory() const = 0;
+    virtual wxString GetWildcard() const = 0;
+    virtual wxString GetPath() const = 0;
+    virtual void GetPaths( wxArrayString& paths ) const = 0;
+    virtual void GetFilenames( wxArrayString& files ) const = 0;
+    virtual int GetFilterIndex() const = 0;
+
+    virtual bool HasMultipleFileSelection() const = 0;
+    virtual void ShowHidden(const bool show) = 0;
+};
+
+void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
+void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
+void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString );
+
+#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
+    #define wxFileCtrl wxGtkFileCtrl
+    #include "wx/gtk/filectrl.h"
+#else
+    #define wxFileCtrl wxGenericFileCtrl
+    #include "wx/generic/filectrlg.h"
+#endif
+
+// Some documentation
+// On wxEVT_FILECTRL_FOLDERCHANGED, only the value returned by GetDirectory is
+// valid and it represents the (new) current directory for the wxFileCtrl.
+// On wxEVT_FILECTRL_FILEACTIVATED, GetDirectory returns the current directory
+// for the wxFileCtrl and GetFiles returns the names of the file(s) activated.
+// On wxEVT_FILECTRL_SELECTIONCHANGED, GetDirectory returns the current directory
+// for the wxFileCtrl and GetFiles returns the names of the currently selected
+// file(s).
+// In wxGTK, after each wxEVT_FILECTRL_FOLDERCHANGED, wxEVT_FILECTRL_SELECTIONCHANGED
+// is fired automatically once or more with 0 files.
+class WXDLLIMPEXP_CORE wxFileCtrlEvent : public wxCommandEvent
+{
+public:
+    wxFileCtrlEvent() {}
+    wxFileCtrlEvent( wxEventType type, wxObject *evtObject, int id )
+            : wxCommandEvent( type, id )
+    {
+        SetEventObject( evtObject );
+    }
+
+    // no need for the copy constructor as the default one will be fine.
+    virtual wxEvent *Clone() const { return new wxFileCtrlEvent( *this ); }
+
+    void SetFiles( const wxArrayString &files ) { this->files = files; }
+    void SetDirectory( const wxString &directory ) { this->directory = directory; }
+
+    wxArrayString GetFiles() const { return files; }
+    wxString GetDirectory() const { return directory; }
+
+    wxString GetFile() const;
+
+protected:
+    wxString  directory;
+    wxArrayString files;
+
+    DECLARE_DYNAMIC_CLASS_NO_ASSIGN( wxFileCtrlEvent )
+};
+
+typedef void ( wxEvtHandler::*wxFileCtrlEventFunction )( wxFileCtrlEvent& );
+
+#define wxFileCtrlEventHandler(func) \
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFileCtrlEventFunction, &func)
+
+#define EVT_FILECTRL_FILEACTIVATED(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_FILECTRL_FILEACTIVATED, id, wxFileCtrlEventHandler(fn))
+
+#define EVT_FILECTRL_SELECTIONCHANGED(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_FILECTRL_SELECTIONCHANGED, id, wxFileCtrlEventHandler(fn))
+
+#define EVT_FILECTRL_FOLDERCHANGED(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_FILECTRL_FOLDERCHANGED, id, wxFileCtrlEventHandler(fn))
+
+#endif // wxUSE_FILECTRL
+
+#endif // _WX_FILECTRL_H_BASE_
diff --git a/include/wx/filedlg.h b/include/wx/filedlg.h
index 1469bee06c..b8384d3e83 100644
--- a/include/wx/filedlg.h
+++ b/include/wx/filedlg.h
@@ -186,25 +186,25 @@ wxSaveFileSelector(const wxString& what,
 
 
 #if defined (__WXUNIVERSAL__)
-#define wxHAS_GENERIC_FILEDIALOG
-#include "wx/generic/filedlgg.h"
+    #define wxHAS_GENERIC_FILEDIALOG
+    #include "wx/generic/filedlgg.h"
 #elif defined(__WXMSW__)
-#include "wx/msw/filedlg.h"
+    #include "wx/msw/filedlg.h"
 #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
+    #include "wx/gtk/filedlg.h"     // GTK+ > 2.4 has native version
 #elif defined(__WXGTK20__)
-#define wxHAS_GENERIC_FILEDIALOG
-#include "wx/generic/filedlgg.h"
+    #define wxHAS_GENERIC_FILEDIALOG
+    #include "wx/generic/filedlgg.h"
 #elif defined(__WXGTK__)
-#include "wx/gtk1/filedlg.h"
+    #include "wx/gtk1/filedlg.h"
 #elif defined(__WXMAC__)
-#include "wx/mac/filedlg.h"
+    #include "wx/mac/filedlg.h"
 #elif defined(__WXCOCOA__)
-#include "wx/cocoa/filedlg.h"
+    #include "wx/cocoa/filedlg.h"
 #elif defined(__WXPM__)
-#include "wx/os2/filedlg.h"
+    #include "wx/os2/filedlg.h"
 #endif
 
 #endif // wxUSE_FILEDLG
diff --git a/include/wx/generic/filectrlg.h b/include/wx/generic/filectrlg.h
new file mode 100644
index 0000000000..5195b464a5
--- /dev/null
+++ b/include/wx/generic/filectrlg.h
@@ -0,0 +1,290 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/generic/filectrlg.h
+// Purpose:     wxGenericFileCtrl Header
+// Author:      Diaa M. Sami
+// Modified by:
+// Created:     Jul-07-2007
+// RCS-ID:      $Id$
+// Copyright:   (c) Diaa M. Sami
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GENERIC_FILECTRL_H_
+#define _WX_GENERIC_FILECTRL_H_
+
+#if wxUSE_FILECTRL
+
+#include "wx/panel.h"
+#include "wx/listctrl.h"
+#include "wx/filectrl.h"
+
+class WXDLLIMPEXP_FWD_CORE wxCheckBox;
+class WXDLLIMPEXP_FWD_CORE wxChoice;
+class WXDLLIMPEXP_FWD_CORE wxStaticText;
+class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+
+extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[];
+
+//-----------------------------------------------------------------------------
+//  wxFileData - a class to hold the file info for the wxFileList
+//-----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxFileData
+{
+public:
+    enum fileType
+    {
+        is_file  = 0x0000,
+        is_dir   = 0x0001,
+        is_link  = 0x0002,
+        is_exe   = 0x0004,
+        is_drive = 0x0008
+    };
+
+    wxFileData() { Init(); }
+    // Full copy constructor
+    wxFileData( const wxFileData& fileData ) { Copy(fileData); }
+    // Create a filedata from this information
+    wxFileData( const wxString &filePath, const wxString &fileName,
+                fileType type, int image_id );
+
+    // make a full copy of the other wxFileData
+    void Copy( const wxFileData &other );
+
+    // (re)read the extra data about the file from the system
+    void ReadData();
+
+    // get the name of the file, dir, drive
+    wxString GetFileName() const { return m_fileName; }
+    // get the full path + name of the file, dir, path
+    wxString GetFilePath() const { return m_filePath; }
+    // Set the path + name and name of the item
+    void SetNewName( const wxString &filePath, const wxString &fileName );
+
+    // Get the size of the file in bytes
+    wxFileOffset GetSize() const { return m_size; }
+    // Get the type of file, either file extension or <DIR>, <LINK>, <DRIVE>
+    wxString GetFileType() const;
+    // get the last modification time
+    wxDateTime GetDateTime() const { return m_dateTime; }
+    // Get the time as a formatted string
+    wxString GetModificationTime() const;
+    // in UNIX get rwx for file, in MSW get attributes ARHS
+    wxString GetPermissions() const { return m_permissions; }
+    // Get the id of the image used in a wxImageList
+    int GetImageId() const { return m_image; }
+
+    bool IsFile() const  { return !IsDir() && !IsLink() && !IsDrive(); }
+    bool IsDir() const   { return (m_type & is_dir  ) != 0; }
+    bool IsLink() const  { return (m_type & is_link ) != 0; }
+    bool IsExe() const   { return (m_type & is_exe  ) != 0; }
+    bool IsDrive() const { return (m_type & is_drive) != 0; }
+
+    // Get/Set the type of file, file/dir/drive/link
+    int GetType() const { return m_type; }
+
+    // the wxFileList fields in report view
+    enum fileListFieldType
+    {
+        FileList_Name,
+        FileList_Size,
+        FileList_Type,
+        FileList_Time,
+#if defined(__UNIX__) || defined(__WIN32__)
+        FileList_Perm,
+#endif // defined(__UNIX__) || defined(__WIN32__)
+        FileList_Max
+    };
+
+    // Get the entry for report view of wxFileList
+    wxString GetEntry( fileListFieldType num ) const;
+
+    // Get a string representation of the file info
+    wxString GetHint() const;
+    // initialize a wxListItem attributes
+    void MakeItem( wxListItem &item );
+
+    // operators
+    wxFileData& operator = (const wxFileData& fd) { Copy(fd); return *this; }
+
+protected:
+    wxString m_fileName;
+    wxString   m_filePath;
+    wxFileOffset m_size;
+    wxDateTime m_dateTime;
+    wxString m_permissions;
+    int      m_type;
+    int      m_image;
+
+private:
+    void Init();
+};
+
+//-----------------------------------------------------------------------------
+//  wxFileList
+//-----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxFileList : public wxListCtrl
+{
+public:
+    wxFileList();
+    wxFileList( wxWindow *win,
+                wxWindowID id,
+                const wxString &wild,
+                bool showHidden,
+                const wxPoint &pos = wxDefaultPosition,
+                const wxSize &size = wxDefaultSize,
+                long style = wxLC_LIST,
+                const wxValidator &validator = wxDefaultValidator,
+                const wxString &name = wxT("filelist") );
+    virtual ~wxFileList();
+
+    virtual void ChangeToListMode();
+    virtual void ChangeToReportMode();
+    virtual void ChangeToSmallIconMode();
+    virtual void ShowHidden( bool show = true );
+    bool GetShowHidden() const { return m_showHidden; }
+
+    virtual long Add( wxFileData *fd, wxListItem &item );
+    virtual void UpdateItem(const wxListItem &item);
+    virtual void UpdateFiles();
+    virtual void MakeDir();
+    virtual void GoToParentDir();
+    virtual void GoToHomeDir();
+    virtual void GoToDir( const wxString &dir );
+    virtual void SetWild( const wxString &wild );
+    wxString GetWild() const { return m_wild; }
+    wxString GetDir() const { return m_dirName; }
+
+    void OnListDeleteItem( wxListEvent &event );
+    void OnListDeleteAllItems( wxListEvent &event );
+    void OnListEndLabelEdit( wxListEvent &event );
+    void OnListColClick( wxListEvent &event );
+
+    virtual void SortItems(wxFileData::fileListFieldType field, bool foward);
+    bool GetSortDirection() const { return m_sort_foward; }
+    wxFileData::fileListFieldType GetSortField() const { return m_sort_field; }
+
+protected:
+    void FreeItemData(wxListItem& item);
+    void FreeAllItemsData();
+
+    wxString      m_dirName;
+    bool          m_showHidden;
+    wxString      m_wild;
+
+    bool m_sort_foward;
+    wxFileData::fileListFieldType m_sort_field;
+
+private:
+    DECLARE_DYNAMIC_CLASS(wxFileList)
+    DECLARE_EVENT_TABLE()
+};
+
+class WXDLLIMPEXP_CORE wxGenericFileCtrl : public wxPanel,
+                                           public wxFileCtrlBase
+{
+public:
+    wxGenericFileCtrl()
+    {
+        m_ignoreChanges = false;
+    }
+
+    wxGenericFileCtrl ( wxWindow *parent,
+                        wxWindowID id,
+                        const wxString& defaultDirectory = wxEmptyString,
+                        const wxString& defaultFilename = wxEmptyString,
+                        const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+                        long style = wxFC_DEFAULT_STYLE,
+                        const wxPoint& pos = wxDefaultPosition,
+                        const wxSize& size = wxDefaultSize,
+                        const wxString& name = wxFileCtrlNameStr )
+    {
+        m_ignoreChanges = false;
+        Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name );
+    }
+
+    virtual ~wxGenericFileCtrl() {}
+
+    bool Create( wxWindow *parent,
+                 wxWindowID id,
+                 const wxString& defaultDirectory = wxEmptyString,
+                 const wxString& defaultFileName = wxEmptyString,
+                 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+                 long style = wxFC_DEFAULT_STYLE,
+                 const wxPoint& pos = wxDefaultPosition,
+                 const wxSize& size = wxDefaultSize,
+                 const wxString& name = wxFileCtrlNameStr );
+
+    virtual void SetWildcard( const wxString& wildCard );
+    virtual void SetFilterIndex( int filterindex );
+    virtual bool SetDirectory( const wxString& dir );
+
+    // Selects a certain file.
+    // In case the filename specified isn't found/couldn't be shown with currently selected filter, false is returned and nothing happens
+    virtual bool SetFilename( const wxString& name );
+
+    // chdirs to a certain directory and selects a certain file.
+    // In case the filename specified isn't found/couldn't be shown with currently selected filter, false is returned and if directory exists it's chdir'ed to
+    virtual bool SetPath( const wxString& path );
+
+    virtual wxString GetFilename() const;
+    virtual wxString GetDirectory() const;
+    virtual wxString GetWildcard() const { return this->m_wildCard; }
+    virtual wxString GetPath() const;
+    virtual void GetPaths( wxArrayString& paths ) const;
+    virtual void GetFilenames( wxArrayString& files ) const;
+    virtual int GetFilterIndex() const { return m_filterIndex; }
+
+    virtual bool HasMultipleFileSelection() const { return m_style & wxFC_MULTIPLE; }
+    virtual void ShowHidden(const bool show) { m_list->ShowHidden( show ); }
+
+    void GoToParentDir();
+    void GoToHomeDir();
+
+    wxFileList *GetFileList() { return m_list; }
+
+    void ChangeToReportMode() { m_list->ChangeToReportMode(); }
+    void ChangeToListMode() { m_list->ChangeToListMode(); }
+
+
+private:
+    void OnChoiceFilter( wxCommandEvent &event );
+    void OnCheck( wxCommandEvent &event );
+    void OnActivated( wxListEvent &event );
+    void OnTextEnter( wxCommandEvent &WXUNUSED( event ) );
+    void OnTextChange( wxCommandEvent &WXUNUSED( event ) );
+    void OnSelected( wxListEvent &event );
+    void HandleAction( const wxString &fn );
+
+    void DoSetFilterIndex( int filterindex );
+    void UpdateControls();
+    wxString DoGetFilename( const bool fullPath ) const;
+    void DoGetFilenames( wxArrayString& filenames, const bool fullPath ) const;
+    wxString GetProperFileListDir() const;
+
+    int m_style;
+
+    wxString       m_filterExtension;
+    wxChoice      *m_choice;
+    wxTextCtrl    *m_text;
+    wxFileList    *m_list;
+    wxCheckBox    *m_check;
+    wxStaticText  *m_static;
+
+    wxString      m_dir;
+    wxString      m_fileName;
+    wxString      m_wildCard; // wild card in one string as passed to the object previously.
+
+    int     m_filterIndex;
+    bool m_inSelected;
+    bool    m_ignoreChanges;
+    bool m_noSelChgEvent; // suppress selection changed events.
+
+    DECLARE_DYNAMIC_CLASS( wxGenericFileCtrl )
+    DECLARE_EVENT_TABLE()
+};
+
+#endif // wxUSE_FILECTRL
+
+#endif // _WX_GENERIC_FILECTRL_H_
diff --git a/include/wx/generic/filedlgg.h b/include/wx/generic/filedlgg.h
index 6681072941..661d7f88b7 100644
--- a/include/wx/generic/filedlgg.h
+++ b/include/wx/generic/filedlgg.h
@@ -16,21 +16,16 @@
 #include "wx/datetime.h"
 #include "wx/filefn.h"
 #include "wx/filedlg.h"
+#include "wx/generic/filectrlg.h"
 
 //-----------------------------------------------------------------------------
 // classes
 //-----------------------------------------------------------------------------
 
 class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
-class WXDLLIMPEXP_FWD_CORE wxCheckBox;
-class WXDLLIMPEXP_FWD_CORE wxChoice;
-class WXDLLIMPEXP_FWD_CORE wxFileData;
-class WXDLLIMPEXP_FWD_CORE wxFileCtrl;
+class WXDLLIMPEXP_FWD_CORE wxGenericFileCtrl;
 class WXDLLIMPEXP_FWD_CORE wxGenericFileDialog;
-class WXDLLIMPEXP_FWD_CORE wxListEvent;
-class WXDLLIMPEXP_FWD_CORE wxListItem;
-class WXDLLIMPEXP_FWD_CORE wxStaticText;
-class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
+class WXDLLIMPEXP_FWD_CORE wxFileCtrlEvent;
 
 //-------------------------------------------------------------------------
 // wxGenericFileDialog
@@ -80,20 +75,13 @@ public:
     virtual int ShowModal();
     virtual bool Show( bool show = true );
 
-    void OnSelected( wxListEvent &event );
-    void OnActivated( wxListEvent &event );
     void OnList( wxCommandEvent &event );
     void OnReport( wxCommandEvent &event );
     void OnUp( wxCommandEvent &event );
     void OnHome( wxCommandEvent &event );
-    void OnListOk( wxCommandEvent &event );
+    void OnOk( wxCommandEvent &event );
     void OnNew( wxCommandEvent &event );
-    void OnChoiceFilter( wxCommandEvent &event );
-    void OnTextEnter( wxCommandEvent &event );
-    void OnTextChange( wxCommandEvent &event );
-    void OnCheck( wxCommandEvent &event );
-
-    virtual void HandleAction( const wxString &fn );
+    void OnFileActivated( wxFileCtrlEvent &event);
 
     virtual void UpdateControls();
 
@@ -102,17 +90,11 @@ private:
     bool m_bypassGenericImpl;
 
 protected:
-    // use the filter with the given index
-    void DoSetFilterIndex(int filterindex);
 
-    wxString       m_filterExtension;
-    wxChoice      *m_choice;
-    wxTextCtrl    *m_text;
-    wxFileCtrl    *m_list;
-    wxCheckBox    *m_check;
-    wxStaticText  *m_static;
-    wxBitmapButton *m_upDirButton;
-    wxBitmapButton *m_newDirButton;
+    wxString               m_filterExtension;
+    wxGenericFileCtrl     *m_filectrl;
+    wxBitmapButton        *m_upDirButton;
+    wxBitmapButton        *m_newDirButton;
 
 private:
     void Init();
@@ -148,160 +130,4 @@ private:
 
 #endif // wxHAS_GENERIC_FILEDIALOG
 
-//-----------------------------------------------------------------------------
-//  wxFileData - a class to hold the file info for the wxFileCtrl
-//-----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxFileData
-{
-public:
-    enum fileType
-    {
-        is_file  = 0x0000,
-        is_dir   = 0x0001,
-        is_link  = 0x0002,
-        is_exe   = 0x0004,
-        is_drive = 0x0008
-    };
-
-    wxFileData() { Init(); }
-    // Full copy constructor
-    wxFileData( const wxFileData& fileData ) { Copy(fileData); }
-    // Create a filedata from this information
-    wxFileData( const wxString &filePath, const wxString &fileName,
-                fileType type, int image_id );
-
-    // make a full copy of the other wxFileData
-    void Copy( const wxFileData &other );
-
-    // (re)read the extra data about the file from the system
-    void ReadData();
-
-    // get the name of the file, dir, drive
-    wxString GetFileName() const { return m_fileName; }
-    // get the full path + name of the file, dir, path
-    wxString GetFilePath() const { return m_filePath; }
-    // Set the path + name and name of the item
-    void SetNewName( const wxString &filePath, const wxString &fileName );
-
-    // Get the size of the file in bytes
-    wxFileOffset GetSize() const { return m_size; }
-    // Get the type of file, either file extension or <DIR>, <LINK>, <DRIVE>
-    wxString GetFileType() const;
-    // get the last modification time
-    wxDateTime GetDateTime() const { return m_dateTime; }
-    // Get the time as a formatted string
-    wxString GetModificationTime() const;
-    // in UNIX get rwx for file, in MSW get attributes ARHS
-    wxString GetPermissions() const { return m_permissions; }
-    // Get the id of the image used in a wxImageList
-    int GetImageId() const { return m_image; }
-
-    bool IsFile() const  { return !IsDir() && !IsLink() && !IsDrive(); }
-    bool IsDir() const   { return (m_type & is_dir  ) != 0; }
-    bool IsLink() const  { return (m_type & is_link ) != 0; }
-    bool IsExe() const   { return (m_type & is_exe  ) != 0; }
-    bool IsDrive() const { return (m_type & is_drive) != 0; }
-
-    // Get/Set the type of file, file/dir/drive/link
-    int GetType() const { return m_type; }
-
-    // the wxFileCtrl fields in report view
-    enum fileListFieldType
-    {
-        FileList_Name,
-        FileList_Size,
-        FileList_Type,
-        FileList_Time,
-#if defined(__UNIX__) || defined(__WIN32__)
-        FileList_Perm,
-#endif // defined(__UNIX__) || defined(__WIN32__)
-        FileList_Max
-    };
-
-    // Get the entry for report view of wxFileCtrl
-    wxString GetEntry( fileListFieldType num ) const;
-
-    // Get a string representation of the file info
-    wxString GetHint() const;
-    // initialize a wxListItem attributes
-    void MakeItem( wxListItem &item );
-
-    // operators
-    wxFileData& operator = (const wxFileData& fd) { Copy(fd); return *this; }
-
-protected:
-    wxString m_fileName;
-    wxString   m_filePath;
-    wxFileOffset m_size;
-    wxDateTime m_dateTime;
-    wxString m_permissions;
-    int      m_type;
-    int      m_image;
-
-private:
-    void Init();
-};
-
-//-----------------------------------------------------------------------------
-//  wxFileCtrl
-//-----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxFileCtrl : public wxListCtrl
-{
-public:
-    wxFileCtrl();
-    wxFileCtrl( wxWindow *win,
-                wxWindowID id,
-                const wxString &wild,
-                bool showHidden,
-                const wxPoint &pos = wxDefaultPosition,
-                const wxSize &size = wxDefaultSize,
-                long style = wxLC_LIST,
-                const wxValidator &validator = wxDefaultValidator,
-                const wxString &name = wxT("filelist") );
-    virtual ~wxFileCtrl();
-
-    virtual void ChangeToListMode();
-    virtual void ChangeToReportMode();
-    virtual void ChangeToSmallIconMode();
-    virtual void ShowHidden( bool show = true );
-    bool GetShowHidden() const { return m_showHidden; }
-
-    virtual long Add( wxFileData *fd, wxListItem &item );
-    virtual void UpdateItem(const wxListItem &item);
-    virtual void UpdateFiles();
-    virtual void MakeDir();
-    virtual void GoToParentDir();
-    virtual void GoToHomeDir();
-    virtual void GoToDir( const wxString &dir );
-    virtual void SetWild( const wxString &wild );
-    wxString GetWild() const { return m_wild; }
-    wxString GetDir() const { return m_dirName; }
-
-    void OnListDeleteItem( wxListEvent &event );
-    void OnListDeleteAllItems( wxListEvent &event );
-    void OnListEndLabelEdit( wxListEvent &event );
-    void OnListColClick( wxListEvent &event );
-
-    virtual void SortItems(wxFileData::fileListFieldType field, bool foward);
-    bool GetSortDirection() const { return m_sort_foward; }
-    wxFileData::fileListFieldType GetSortField() const { return m_sort_field; }
-
-protected:
-    void FreeItemData(wxListItem& item);
-    void FreeAllItemsData();
-
-    wxString      m_dirName;
-    bool          m_showHidden;
-    wxString      m_wild;
-
-    bool m_sort_foward;
-    wxFileData::fileListFieldType m_sort_field;
-
-private:
-    DECLARE_DYNAMIC_CLASS(wxFileCtrl)
-    DECLARE_EVENT_TABLE()
-};
-
 #endif // _WX_FILEDLGG_H_
diff --git a/include/wx/gtk/filectrl.h b/include/wx/gtk/filectrl.h
new file mode 100644
index 0000000000..fee2f569d1
--- /dev/null
+++ b/include/wx/gtk/filectrl.h
@@ -0,0 +1,115 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/gtk/filectrl.h
+// Purpose:     wxGtkFileCtrl Header
+// Author:      Diaa M. Sami
+// Modified by:
+// Created:     Aug-10-2007
+// RCS-ID:      $Id$
+// Copyright:   (c) Diaa M. Sami
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef FILECTRL_H
+#define FILECTRL_H
+
+typedef struct _GtkFileChooser GtkFileChooser;
+
+// [GTK] current problems:
+// All methods(e.g. SetFilename(), SetPath(), etc) which change the state of
+// the control result in events fired, such events should be suppressed.
+// ------
+// Sometimes a selection event(with 0 files) is fired before
+// wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected!
+
+// A wx wrapper for any Gtk object implementing the interface GtkFileChooser
+
+class WXDLLIMPEXP_CORE wxGtkFileChooser
+{
+public:
+    wxGtkFileChooser() {}
+
+    void SetWidget(GtkFileChooser *w);
+
+    wxString GetPath() const;
+    void GetPaths( wxArrayString& paths ) const;
+    wxString GetDirectory() const;
+    wxString GetFilename() const;
+    void GetFilenames( wxArrayString& files ) const;
+    int GetFilterIndex() const;
+
+    bool SetPath( const wxString& path );
+    bool SetDirectory( const wxString& dir );
+    void SetWildcard( const wxString& wildCard );
+    void SetFilterIndex( int filterIndex );
+
+private:
+    GtkFileChooser *m_widget;
+};
+
+#if wxUSE_FILECTRL
+
+class WXDLLIMPEXP_CORE wxGtkFileCtrl: public wxControl,
+            public wxFileCtrlBase
+{
+public:
+    wxGtkFileCtrl () { Init(); }
+
+    wxGtkFileCtrl ( wxWindow *parent,
+                    wxWindowID id,
+                    const wxString& defaultDirectory = wxEmptyString,
+                    const wxString& defaultFilename = wxEmptyString,
+                    const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+                    long style = wxFC_DEFAULT_STYLE,
+                    const wxPoint& pos = wxDefaultPosition,
+                    const wxSize& size = wxDefaultSize,
+                    const wxString& name = wxFileCtrlNameStr )
+    {
+        Init();
+        Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name );
+    }
+
+    virtual ~wxGtkFileCtrl() {};
+
+    void Init();
+    bool Create( wxWindow *parent,
+                 wxWindowID id,
+                 const wxString& defaultDirectory = wxEmptyString,
+                 const wxString& defaultFileName = wxEmptyString,
+                 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+                 long style = wxFC_DEFAULT_STYLE,
+                 const wxPoint& pos = wxDefaultPosition,
+                 const wxSize& size = wxDefaultSize,
+                 const wxString& name = wxFileCtrlNameStr );
+
+    virtual void SetWildcard( const wxString& wildCard );
+    virtual void SetFilterIndex( int filterIndex );
+    virtual bool SetDirectory( const wxString& dir );
+    virtual bool SetFilename( const wxString& name );
+    virtual bool SetPath( const wxString& path );
+
+    virtual wxString GetFilename() const;
+    virtual wxString GetDirectory() const;
+    virtual wxString GetWildcard() const { return this->m_wildCard; }
+    virtual wxString GetPath() const;
+    virtual void GetPaths( wxArrayString& paths ) const;
+    virtual void GetFilenames( wxArrayString& files ) const;
+    virtual int GetFilterIndex() const { return m_fc.GetFilterIndex(); }
+
+    virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE ); }
+    virtual void ShowHidden(const bool show);
+
+    bool    m_checkNextSelEvent;
+    bool    m_ignoreNextFolderChangeEvent;
+
+protected:
+    GtkFileChooser     *m_fcWidget;
+    wxGtkFileChooser    m_fc;
+    wxString            m_wildCard;
+
+    DECLARE_DYNAMIC_CLASS( wxGtkFileCtrl )
+};
+
+#endif // wxUSE_FILECTRL
+
+#endif    // FILECTRL_H
+
diff --git a/include/wx/gtk/filedlg.h b/include/wx/gtk/filedlg.h
index ac1909fc8d..4c88ab1471 100644
--- a/include/wx/gtk/filedlg.h
+++ b/include/wx/gtk/filedlg.h
@@ -11,6 +11,7 @@
 #define __GTKFILEDLGH__
 
 #include "wx/generic/filedlgg.h"
+#include "wx/gtk/filectrl.h"    // for wxGtkFileChooser
 
 //-------------------------------------------------------------------------
 // wxFileDialog
@@ -64,6 +65,8 @@ private:
     DECLARE_DYNAMIC_CLASS(wxFileDialog)
     DECLARE_EVENT_TABLE()
     void OnFakeOk( wxCommandEvent &event );
+
+    wxGtkFileChooser    m_fc;
 };
 
 #endif // __GTKFILEDLGH__
diff --git a/include/wx/mac/carbon/combobox.h b/include/wx/mac/carbon/combobox.h
index 737f7b4423..e76bfb9046 100644
--- a/include/wx/mac/carbon/combobox.h
+++ b/include/wx/mac/carbon/combobox.h
@@ -146,6 +146,9 @@ protected:
     virtual void DoSetItemClientData(unsigned int n, void* clientData);
     virtual void * DoGetItemClientData(unsigned int n) const;
 
+    virtual wxClientDataType GetClientDataType() const;
+    virtual void SetClientDataType(wxClientDataType clientDataItemsType);
+
     // the subcontrols
     wxComboBoxText*     m_text;
     wxComboBoxChoice*   m_choice;
diff --git a/include/wx/mac/setup0.h b/include/wx/mac/setup0.h
index 883c991cc1..8f36bb660a 100644
--- a/include/wx/mac/setup0.h
+++ b/include/wx/mac/setup0.h
@@ -661,6 +661,7 @@
 #define wxUSE_DATEPICKCTRL  1   // wxDatePickerCtrl
 #define wxUSE_DIRPICKERCTRL 1   // wxDirPickerCtrl
 #define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox
+#define wxUSE_FILECTRL      1   // wxFileCtrl
 #define wxUSE_FILEPICKERCTRL 1  // wxFilePickerCtrl
 #define wxUSE_FONTPICKERCTRL 1  // wxFontPickerCtrl
 #define wxUSE_GAUGE         1   // wxGauge
diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h
index f870900989..29aaf9008d 100644
--- a/include/wx/motif/setup0.h
+++ b/include/wx/motif/setup0.h
@@ -660,6 +660,7 @@
 #define wxUSE_DATEPICKCTRL  1   // wxDatePickerCtrl
 #define wxUSE_DIRPICKERCTRL 1   // wxDirPickerCtrl
 #define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox
+#define wxUSE_FILECTRL      1   // wxFileCtrl
 #define wxUSE_FILEPICKERCTRL 1  // wxFilePickerCtrl
 #define wxUSE_FONTPICKERCTRL 1  // wxFontPickerCtrl
 #define wxUSE_GAUGE         1   // wxGauge
diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h
index 6e2a8de398..40f33fe035 100644
--- a/include/wx/msw/setup0.h
+++ b/include/wx/msw/setup0.h
@@ -660,6 +660,7 @@
 #define wxUSE_DATEPICKCTRL  1   // wxDatePickerCtrl
 #define wxUSE_DIRPICKERCTRL 1   // wxDirPickerCtrl
 #define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox
+#define wxUSE_FILECTRL      1   // wxFileCtrl
 #define wxUSE_FILEPICKERCTRL 1  // wxFilePickerCtrl
 #define wxUSE_FONTPICKERCTRL 1  // wxFontPickerCtrl
 #define wxUSE_GAUGE         1   // wxGauge
diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h
index b1b2599069..bae40aacc1 100644
--- a/include/wx/msw/wince/setup.h
+++ b/include/wx/msw/wince/setup.h
@@ -660,6 +660,7 @@
 #define wxUSE_DATEPICKCTRL  1   // wxDatePickerCtrl
 #define wxUSE_DIRPICKERCTRL 1   // wxDirPickerCtrl
 #define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox
+#define wxUSE_FILECTRL      1   // wxFileCtrl
 #define wxUSE_FILEPICKERCTRL 1  // wxFilePickerCtrl
 #define wxUSE_FONTPICKERCTRL 1  // wxFontPickerCtrl
 #define wxUSE_GAUGE         1   // wxGauge
diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h
index c191935c64..a81bb1229c 100644
--- a/include/wx/os2/setup0.h
+++ b/include/wx/os2/setup0.h
@@ -660,6 +660,7 @@
 #define wxUSE_DATEPICKCTRL  1   // wxDatePickerCtrl
 #define wxUSE_DIRPICKERCTRL 1   // wxDirPickerCtrl
 #define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox
+#define wxUSE_FILECTRL      1   // wxFileCtrl
 #define wxUSE_FILEPICKERCTRL 1  // wxFilePickerCtrl
 #define wxUSE_FONTPICKERCTRL 1  // wxFontPickerCtrl
 #define wxUSE_GAUGE         1   // wxGauge
diff --git a/include/wx/palmos/setup0.h b/include/wx/palmos/setup0.h
index 87bf32ac74..7ee9e83a77 100644
--- a/include/wx/palmos/setup0.h
+++ b/include/wx/palmos/setup0.h
@@ -660,6 +660,7 @@
 #define wxUSE_DATEPICKCTRL  1   // wxDatePickerCtrl
 #define wxUSE_DIRPICKERCTRL 1   // wxDirPickerCtrl
 #define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox
+#define wxUSE_FILECTRL      1   // wxFileCtrl
 #define wxUSE_FILEPICKERCTRL 1  // wxFilePickerCtrl
 #define wxUSE_FONTPICKERCTRL 1  // wxFontPickerCtrl
 #define wxUSE_GAUGE         1   // wxGauge
diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h
index 79e636098e..c3fc0d76e5 100644
--- a/include/wx/setup_inc.h
+++ b/include/wx/setup_inc.h
@@ -656,6 +656,7 @@
 #define wxUSE_DATEPICKCTRL  1   // wxDatePickerCtrl
 #define wxUSE_DIRPICKERCTRL 1   // wxDirPickerCtrl
 #define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox
+#define wxUSE_FILECTRL      1   // wxFileCtrl
 #define wxUSE_FILEPICKERCTRL 1  // wxFilePickerCtrl
 #define wxUSE_FONTPICKERCTRL 1  // wxFontPickerCtrl
 #define wxUSE_GAUGE         1   // wxGauge
diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp
index 09ed8305c2..9ca10c1580 100644
--- a/samples/minimal/minimal.cpp
+++ b/samples/minimal/minimal.cpp
@@ -172,6 +172,30 @@ MyFrame::MyFrame(const wxString& title)
     CreateStatusBar(2);
     SetStatusText(_T("Welcome to wxWidgets!"));
 #endif // wxUSE_STATUSBAR
+
+    wxTextCtrl* text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_DONTWRAP  );
+    text->SetValue( wxT("0 /////////////////////////////////////////////////////////////////////////////\n\
+1 // Name:        minimal.cpp\n\
+2 // Purpose:     Minimal wxWidgets sample\n\
+3 // Author:      Julian Smart\n\
+4 // Modified by:\n\
+5 // Created:     04/01/98\n\
+6 // RCS-ID:      $Id$\n\
+7 // Copyright:   (c) Julian Smart\n\
+8 // Licence:     wxWindows licence\n\
+9 /////////////////////////////////////////////////////////////////////////////\n\
+") );
+
+    text->WriteText( wxT("10 /////////////////////////////////////////////////////////////////////////////\n\
+11 // Name:        minimal.cpp\n\
+12 // Purpose:     Minimal wxWidgets sample\n\
+13 // Author:      Julian Smart\n\
+14 // Modified by:\n\
+15 // Created:     04/01/98\n\
+16 // RCS-ID:      $Id$\n\
+17 // Copyright:   (c) Julian Smart\n\
+18 // Licence:     wxWindows licence\n\
+19 /////////////////////////////////////////////////////////////////////////////") );
 }
 
 
diff --git a/samples/widgets/Makefile.in b/samples/widgets/Makefile.in
index 06a21cf635..cbe50684ee 100644
--- a/samples/widgets/Makefile.in
+++ b/samples/widgets/Makefile.in
@@ -61,6 +61,7 @@ WIDGETS_OBJECTS =  \
 	widgets_datepick.o \
 	widgets_dirctrl.o \
 	widgets_dirpicker.o \
+	widgets_filectrl.o \
 	widgets_filepicker.o \
 	widgets_fontpicker.o \
 	widgets_gauge.o \
@@ -246,6 +247,9 @@ widgets_dirctrl.o: $(srcdir)/dirctrl.cpp
 widgets_dirpicker.o: $(srcdir)/dirpicker.cpp
 	$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/dirpicker.cpp
 
+widgets_filectrl.o: $(srcdir)/filectrl.cpp
+	$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/filectrl.cpp
+
 widgets_filepicker.o: $(srcdir)/filepicker.cpp
 	$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/filepicker.cpp
 
diff --git a/samples/widgets/filectrl.cpp b/samples/widgets/filectrl.cpp
new file mode 100644
index 0000000000..4fd459b08c
--- /dev/null
+++ b/samples/widgets/filectrl.cpp
@@ -0,0 +1,338 @@
+/////////////////////////////////////////////////////////////////////////////
+// Program:     wxWidgets Widgets Sample
+// Name:        filectrl.cpp
+// Purpose:     Part of the widgets sample showing wxFileCtrl
+// Author:      Diaa M. Sami
+// Created:     28 Jul 2007
+// Id:          $Id$
+// Copyright:   (c) 2007 Diaa M. Sami
+// License:     wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#if wxUSE_FILECTRL
+
+// for all others, include the necessary headers
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#include "wx/filectrl.h"
+
+#include "wx/wupdlock.h"
+#include "wx/filename.h"
+
+#include "widgets.h"
+
+// TODO change this
+#include "icons/dirctrl.xpm"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// control ids
+enum
+{
+    FileCtrlPage_Reset = wxID_HIGHEST,
+    FileCtrlPage_SetDirectory,
+    FileCtrlPage_SetPath,
+    FileCtrlPage_SetFilename,
+    FileCtrlPage_Ctrl
+};
+
+enum
+{
+    FileCtrlMode_Open = 0,
+    FileCtrlMode_Save
+};
+
+// ----------------------------------------------------------------------------
+// CheckBoxWidgetsPage
+// ----------------------------------------------------------------------------
+
+class FileCtrlWidgetsPage : public WidgetsPage
+{
+public:
+    FileCtrlWidgetsPage( WidgetsBookCtrl *book, wxImageList *imaglist );
+    virtual ~FileCtrlWidgetsPage() {}
+
+    virtual wxControl *GetWidget() const { return /*m_fileCtrl*/NULL; }
+    virtual void RecreateWidget() { CreateFileCtrl(); }
+
+    // lazy creation of the content
+    virtual void CreateContent();
+
+protected:
+    // event handlers
+    void OnButtonSetDirectory( wxCommandEvent& event );
+    void OnButtonSetPath( wxCommandEvent& event );
+    void OnButtonSetFilename( wxCommandEvent& event );
+    void OnButtonReset( wxCommandEvent& event );
+    void OnCheckBox( wxCommandEvent& event );
+    void OnRadioBox( wxCommandEvent& event );
+    void OnFileCtrl( wxFileCtrlEvent& event );
+
+    // reset the control parameters
+    void Reset();
+
+    // (re)create the m_fileCtrl
+    void CreateFileCtrl();
+
+    // the controls
+    // ------------
+
+    // the control itself and the sizer it is in
+    wxFileCtrl *m_fileCtrl;
+
+    // the text entries for command parameters
+    wxTextCtrl *m_dir;
+    wxTextCtrl *m_path;
+    wxTextCtrl *m_filename;
+
+    // flags
+    wxCheckBox *m_chkMultiple,
+               *m_chkNoShowHidden;
+
+    wxRadioBox *m_radioFileCtrlMode;
+
+    // filters
+    wxCheckBox *m_fltr[3];
+
+private:
+    DECLARE_EVENT_TABLE()
+    DECLARE_WIDGETS_PAGE( FileCtrlWidgetsPage )
+};
+
+// ----------------------------------------------------------------------------
+// event tables
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE( FileCtrlWidgetsPage, WidgetsPage )
+    EVT_BUTTON( FileCtrlPage_Reset, FileCtrlWidgetsPage::OnButtonReset )
+    EVT_BUTTON( FileCtrlPage_SetDirectory, FileCtrlWidgetsPage::OnButtonSetDirectory )
+    EVT_BUTTON( FileCtrlPage_SetPath, FileCtrlWidgetsPage::OnButtonSetPath )
+    EVT_BUTTON( FileCtrlPage_SetFilename, FileCtrlWidgetsPage::OnButtonSetFilename )
+    EVT_CHECKBOX( wxID_ANY, FileCtrlWidgetsPage::OnCheckBox )
+    EVT_RADIOBOX( wxID_ANY, FileCtrlWidgetsPage::OnRadioBox )
+
+    EVT_FILECTRL_FOLDERCHANGED( wxID_ANY, FileCtrlWidgetsPage::OnFileCtrl )
+    EVT_FILECTRL_SELECTIONCHANGED( wxID_ANY, FileCtrlWidgetsPage::OnFileCtrl )
+    EVT_FILECTRL_FILEACTIVATED( wxID_ANY, FileCtrlWidgetsPage::OnFileCtrl )
+END_EVENT_TABLE()
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+#if defined(__WXGTK__)
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#else
+    #define FAMILY_CTRLS GENERIC_CTRLS
+#endif
+
+IMPLEMENT_WIDGETS_PAGE( FileCtrlWidgetsPage, wxT( "FileCtrl" ),
+                        FAMILY_CTRLS );
+
+FileCtrlWidgetsPage::FileCtrlWidgetsPage( WidgetsBookCtrl *book,
+        wxImageList *imaglist )
+        : WidgetsPage( book, imaglist, dirctrl_xpm )
+{
+}
+
+void FileCtrlWidgetsPage::CreateContent()
+{
+    wxSizer *sizerTop = new wxBoxSizer( wxHORIZONTAL );
+
+    // left pane
+    wxSizer *sizerLeft = new wxBoxSizer( wxVERTICAL );
+
+    static const wxString mode[] = { wxT( "open" ), wxT( "save" ) };
+    m_radioFileCtrlMode = new wxRadioBox( this, wxID_ANY, wxT( "wxFileCtrl mode" ),
+                                          wxDefaultPosition, wxDefaultSize,
+                                          WXSIZEOF( mode ), mode );
+
+    sizerLeft->Add( m_radioFileCtrlMode,
+                    0, wxALL | wxEXPAND , 5 );
+
+    sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetDirectory , wxT( "Set &directory" ), wxID_ANY, &m_dir ),
+                    0, wxALL | wxEXPAND , 5 );
+    sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetPath , wxT( "Set &path" ), wxID_ANY, &m_path ),
+                    0, wxALL | wxEXPAND , 5 );
+    sizerLeft->Add( CreateSizerWithTextAndButton( FileCtrlPage_SetFilename , wxT( "Set &filename" ), wxID_ANY, &m_filename ),
+                    0, wxALL | wxEXPAND , 5 );
+
+    wxSizer *sizerUseFlags =
+        new wxStaticBoxSizer( wxVERTICAL, this, _T( "&Flags" ) );
+
+    m_chkMultiple   = CreateCheckBoxAndAddToSizer( sizerUseFlags, _T( "wxFC_MULTIPLE" ) );
+    m_chkNoShowHidden   = CreateCheckBoxAndAddToSizer( sizerUseFlags, _T( "wxFC_NOSHOWHIDDEN" ) );
+    sizerLeft->Add( sizerUseFlags, wxSizerFlags().Expand().Border() );
+
+    wxSizer *sizerFilters =
+        new wxStaticBoxSizer( wxVERTICAL, this, _T( "&Filters" ) );
+    m_fltr[0] = CreateCheckBoxAndAddToSizer( sizerFilters, wxString::Format( wxT( "all files (%s)|%s" ),
+                wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr ) );
+    m_fltr[1] = CreateCheckBoxAndAddToSizer( sizerFilters, wxT( "C++ files (*.cpp; *.h)|*.cpp;*.h" ) );
+    m_fltr[2] = CreateCheckBoxAndAddToSizer( sizerFilters, wxT( "PNG images (*.png)|*.png" ) );
+    sizerLeft->Add( sizerFilters, wxSizerFlags().Expand().Border() );
+
+    wxButton *btn = new wxButton( this, FileCtrlPage_Reset, _T( "&Reset" ) );
+    sizerLeft->Add( btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15 );
+
+    // right pane
+    m_fileCtrl = new wxFileCtrl(
+                     this,
+                     FileCtrlPage_Ctrl,
+                     wxEmptyString,
+                     wxEmptyString,
+                     wxEmptyString,
+                     wxFC_OPEN,
+                     wxDefaultPosition,
+                     wxDefaultSize
+                 );
+
+    // the 3 panes panes compose the window
+    sizerTop->Add( sizerLeft, 0, ( wxALL & ~wxLEFT ), 10 );
+    sizerTop->Add( m_fileCtrl, 1, wxGROW | ( wxALL & ~wxRIGHT ), 10 );
+
+    // final initializations
+    Reset();
+
+    SetSizer( sizerTop );
+}
+
+void FileCtrlWidgetsPage::Reset()
+{
+    m_dir->SetValue( m_fileCtrl->GetDirectory() );
+    m_radioFileCtrlMode->SetSelection( ( wxFC_DEFAULT_STYLE & wxFC_OPEN ) ?
+                                       FileCtrlMode_Open : FileCtrlMode_Save );
+}
+
+void FileCtrlWidgetsPage::CreateFileCtrl()
+{
+    wxWindowUpdateLocker noUpdates( this );
+
+    const int style =
+        ( m_radioFileCtrlMode->GetSelection() == FileCtrlMode_Open ?
+          wxFC_OPEN : wxFC_SAVE ) |
+        ( m_chkMultiple->IsChecked() ? wxFC_MULTIPLE : 0 ) |
+        ( m_chkNoShowHidden->IsChecked() ? wxFC_NOSHOWHIDDEN : 0 );
+
+    wxFileCtrl *fileCtrl = new wxFileCtrl(
+                               this,
+                               FileCtrlPage_Ctrl,
+                               wxEmptyString,
+                               wxEmptyString,
+                               wxEmptyString,
+                               style,
+                               wxDefaultPosition,
+                               wxDefaultSize
+                           );
+
+    wxString wildcard;
+    for ( unsigned int i = 0; i < WXSIZEOF( m_fltr ); ++i )
+    {
+        if ( m_fltr[i]->IsChecked() )
+        {
+            if ( !wildcard.IsEmpty() )
+                wildcard += wxT( "|" );
+            wildcard += m_fltr[i]->GetLabel();
+        }
+    }
+    fileCtrl->SetWildcard( wildcard );
+
+    // update sizer's child window
+    GetSizer()->Replace( m_fileCtrl, fileCtrl, true );
+
+    // update our pointer
+    delete m_fileCtrl;
+    m_fileCtrl = fileCtrl;
+
+    // relayout the sizer
+    GetSizer()->Layout();
+}
+
+// ----------------------------------------------------------------------------
+// event handlers
+// ----------------------------------------------------------------------------
+
+void FileCtrlWidgetsPage::OnButtonSetDirectory( wxCommandEvent& WXUNUSED( event ) )
+{
+    m_fileCtrl->SetDirectory( m_dir->GetValue() );
+}
+
+void FileCtrlWidgetsPage::OnButtonSetPath( wxCommandEvent& WXUNUSED( event ) )
+{
+    m_fileCtrl->SetPath( m_path->GetValue() );
+}
+
+void FileCtrlWidgetsPage::OnButtonSetFilename( wxCommandEvent& WXUNUSED( event ) )
+{
+    m_fileCtrl->SetFilename( m_filename->GetValue() );
+}
+
+void FileCtrlWidgetsPage::OnButtonReset( wxCommandEvent& WXUNUSED( event ) )
+{
+    Reset();
+
+    CreateFileCtrl();
+}
+
+void FileCtrlWidgetsPage::OnCheckBox( wxCommandEvent& WXUNUSED( event ) )
+{
+    CreateFileCtrl();
+}
+
+void FileCtrlWidgetsPage::OnRadioBox( wxCommandEvent& WXUNUSED( event ) )
+{
+    CreateFileCtrl();
+}
+
+void FileCtrlWidgetsPage::OnFileCtrl( wxFileCtrlEvent& event )
+{
+    if ( event.GetEventType() == wxEVT_FILECTRL_FOLDERCHANGED )
+        wxLogMessage( _T( "Folder changed event, new folder: %s" ), event.GetDirectory() );
+    else if ( event.GetEventType() == wxEVT_FILECTRL_FILEACTIVATED )
+    {
+        wxLogMessage( _T( "File activated event: " ) );
+        wxString filesString;
+
+        const wxArrayString &files = event.GetFiles();
+        for ( unsigned int i = 0; i < files.Count(); i ++ )
+        {
+            filesString += files[i] + _T( " " );
+        }
+
+        wxLogMessage( filesString );
+    }
+    else if ( event.GetEventType() == wxEVT_FILECTRL_SELECTIONCHANGED )
+    {
+        wxLogMessage( _T( "Selection changed event: " ) );
+        wxString filesString;
+
+        const wxArrayString &files = event.GetFiles();
+        for ( unsigned int i = 0; i < files.Count(); i ++ )
+        {
+            filesString += files[i] + _T( " " );
+        }
+
+        wxLogMessage( filesString );
+    }
+}
+
+#endif // wxUSE_FILECTRL
diff --git a/samples/widgets/makefile.bcc b/samples/widgets/makefile.bcc
index 66a930a6ec..2e4f4b690b 100644
--- a/samples/widgets/makefile.bcc
+++ b/samples/widgets/makefile.bcc
@@ -44,6 +44,7 @@ WIDGETS_OBJECTS =  \
 	$(OBJS)\widgets_datepick.obj \
 	$(OBJS)\widgets_dirctrl.obj \
 	$(OBJS)\widgets_dirpicker.obj \
+	$(OBJS)\widgets_filectrl.obj \
 	$(OBJS)\widgets_filepicker.obj \
 	$(OBJS)\widgets_fontpicker.obj \
 	$(OBJS)\widgets_gauge.obj \
@@ -290,6 +291,9 @@ $(OBJS)\widgets_dirctrl.obj: .\dirctrl.cpp
 $(OBJS)\widgets_dirpicker.obj: .\dirpicker.cpp
 	$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) $**
 
+$(OBJS)\widgets_filectrl.obj: .\filectrl.cpp
+	$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) $**
+
 $(OBJS)\widgets_filepicker.obj: .\filepicker.cpp
 	$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) $**
 
diff --git a/samples/widgets/makefile.gcc b/samples/widgets/makefile.gcc
index 9401c9c275..c46f3837a8 100644
--- a/samples/widgets/makefile.gcc
+++ b/samples/widgets/makefile.gcc
@@ -37,6 +37,7 @@ WIDGETS_OBJECTS =  \
 	$(OBJS)\widgets_datepick.o \
 	$(OBJS)\widgets_dirctrl.o \
 	$(OBJS)\widgets_dirpicker.o \
+	$(OBJS)\widgets_filectrl.o \
 	$(OBJS)\widgets_filepicker.o \
 	$(OBJS)\widgets_fontpicker.o \
 	$(OBJS)\widgets_gauge.o \
@@ -283,6 +284,9 @@ $(OBJS)\widgets_dirctrl.o: ./dirctrl.cpp
 $(OBJS)\widgets_dirpicker.o: ./dirpicker.cpp
 	$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
 
+$(OBJS)\widgets_filectrl.o: ./filectrl.cpp
+	$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
+
 $(OBJS)\widgets_filepicker.o: ./filepicker.cpp
 	$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
 
diff --git a/samples/widgets/makefile.unx b/samples/widgets/makefile.unx
index 5a2096c8d0..b13ef34f26 100644
--- a/samples/widgets/makefile.unx
+++ b/samples/widgets/makefile.unx
@@ -66,6 +66,7 @@ WIDGETS_OBJECTS =  \
 	widgets_datepick.o \
 	widgets_dirctrl.o \
 	widgets_dirpicker.o \
+	widgets_filectrl.o \
 	widgets_filepicker.o \
 	widgets_fontpicker.o \
 	widgets_gauge.o \
@@ -151,6 +152,9 @@ widgets_dirctrl.o: ./dirctrl.cpp
 widgets_dirpicker.o: ./dirpicker.cpp
 	$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
 
+widgets_filectrl.o: ./filectrl.cpp
+	$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
+
 widgets_filepicker.o: ./filepicker.cpp
 	$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
 
diff --git a/samples/widgets/makefile.vc b/samples/widgets/makefile.vc
index bebfdcf199..fba66770ee 100644
--- a/samples/widgets/makefile.vc
+++ b/samples/widgets/makefile.vc
@@ -38,6 +38,7 @@ WIDGETS_OBJECTS =  \
 	$(OBJS)\widgets_datepick.obj \
 	$(OBJS)\widgets_dirctrl.obj \
 	$(OBJS)\widgets_dirpicker.obj \
+	$(OBJS)\widgets_filectrl.obj \
 	$(OBJS)\widgets_filepicker.obj \
 	$(OBJS)\widgets_fontpicker.obj \
 	$(OBJS)\widgets_gauge.obj \
@@ -366,6 +367,9 @@ $(OBJS)\widgets_dirctrl.obj: .\dirctrl.cpp
 $(OBJS)\widgets_dirpicker.obj: .\dirpicker.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) $**
 
+$(OBJS)\widgets_filectrl.obj: .\filectrl.cpp
+	$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) $**
+
 $(OBJS)\widgets_filepicker.obj: .\filepicker.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) $**
 
diff --git a/samples/widgets/makefile.wat b/samples/widgets/makefile.wat
index 189195cd06..c6df27e6ac 100644
--- a/samples/widgets/makefile.wat
+++ b/samples/widgets/makefile.wat
@@ -248,6 +248,7 @@ WIDGETS_OBJECTS =  &
 	$(OBJS)\widgets_datepick.obj &
 	$(OBJS)\widgets_dirctrl.obj &
 	$(OBJS)\widgets_dirpicker.obj &
+	$(OBJS)\widgets_filectrl.obj &
 	$(OBJS)\widgets_filepicker.obj &
 	$(OBJS)\widgets_fontpicker.obj &
 	$(OBJS)\widgets_gauge.obj &
@@ -321,6 +322,9 @@ $(OBJS)\widgets_dirctrl.obj :  .AUTODEPEND .\dirctrl.cpp
 $(OBJS)\widgets_dirpicker.obj :  .AUTODEPEND .\dirpicker.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(WIDGETS_CXXFLAGS) $<
 
+$(OBJS)\widgets_filectrl.obj :  .AUTODEPEND .\filectrl.cpp
+	$(CXX) -bt=nt -zq -fo=$^@ $(WIDGETS_CXXFLAGS) $<
+
 $(OBJS)\widgets_filepicker.obj :  .AUTODEPEND .\filepicker.cpp
 	$(CXX) -bt=nt -zq -fo=$^@ $(WIDGETS_CXXFLAGS) $<
 
diff --git a/samples/widgets/widgets.bkl b/samples/widgets/widgets.bkl
index 229fa20740..6f4b4607ba 100644
--- a/samples/widgets/widgets.bkl
+++ b/samples/widgets/widgets.bkl
@@ -15,6 +15,7 @@
             datepick.cpp
             dirctrl.cpp
             dirpicker.cpp
+            filectrl.cpp
             filepicker.cpp
             fontpicker.cpp
             gauge.cpp
diff --git a/samples/widgets/widgets.dsp b/samples/widgets/widgets.dsp
index 77a805177c..ae60210f66 100644
--- a/samples/widgets/widgets.dsp
+++ b/samples/widgets/widgets.dsp
@@ -504,6 +504,10 @@ SOURCE=.\dirpicker.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\filectrl.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\filepicker.cpp
 # End Source File
 # Begin Source File
diff --git a/setup.h.in b/setup.h.in
index 0c3f0998f7..8684cfd92d 100644
--- a/setup.h.in
+++ b/setup.h.in
@@ -332,6 +332,7 @@
 #define wxUSE_DATEPICKCTRL  0
 #define wxUSE_DIRPICKERCTRL 0
 #define wxUSE_EDITABLELISTBOX 0
+#define wxUSE_FILECTRL      0
 #define wxUSE_FILEPICKERCTRL 0
 #define wxUSE_FONTPICKERCTRL 0
 #define wxUSE_GAUGE         0
diff --git a/src/common/filectrlcmn.cpp b/src/common/filectrlcmn.cpp
new file mode 100644
index 0000000000..d6b4adb044
--- /dev/null
+++ b/src/common/filectrlcmn.cpp
@@ -0,0 +1,93 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/common/filectrlcmn.cpp
+// Purpose:     Implementation for wxFileCtrlBase and other common functions used by
+//              platform-specific wxFileCtrl's
+// Author:      Diaa M. Sami
+// Created:     2007-07-07
+// RCS-ID:      $Id$
+// Copyright:   (c) Diaa M. Sami
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#if wxUSE_FILECTRL
+
+#include "wx/filectrl.h"
+
+#ifndef WX_PRECOMP
+#    include "wx/debug.h"
+#endif
+
+const wxChar wxFileCtrlNameStr[] = wxT( "wxfilectrl" );
+
+DEFINE_EVENT_TYPE( wxEVT_FILECTRL_SELECTIONCHANGED );
+DEFINE_EVENT_TYPE( wxEVT_FILECTRL_FILEACTIVATED );
+DEFINE_EVENT_TYPE( wxEVT_FILECTRL_FOLDERCHANGED );
+
+IMPLEMENT_DYNAMIC_CLASS( wxFileCtrlEvent, wxCommandEvent )
+
+// some helper functions
+
+void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd )
+{
+    wxFileCtrlEvent event( wxEVT_FILECTRL_FOLDERCHANGED, wnd, wnd->GetId() );
+
+    event.SetDirectory( fileCtrl->GetDirectory() );
+
+    wnd->GetEventHandler()->ProcessEvent( event );
+}
+
+void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd)
+{
+    wxFileCtrlEvent event( wxEVT_FILECTRL_SELECTIONCHANGED, wnd, wnd->GetId() );
+    event.SetDirectory( fileCtrl->GetDirectory() );
+
+    wxArrayString filenames;
+    fileCtrl->GetFilenames( filenames );
+    event.SetFiles( filenames );
+
+    wnd->GetEventHandler()->ProcessEvent( event );
+}
+
+void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename )
+{
+    wxFileCtrlEvent event( wxEVT_FILECTRL_FILEACTIVATED, wnd, wnd->GetId() );
+    event.SetDirectory( fileCtrl->GetDirectory() );
+
+    wxArrayString filenames;
+
+    if ( filename.empty() )
+    {
+        fileCtrl->GetFilenames( filenames );
+    }
+    else
+    {
+        filenames.Add( filename );
+    }
+
+    event.SetFiles( filenames );
+
+    wnd->GetEventHandler()->ProcessEvent( event );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// wxFileCtrlEvent implementation
+///////////////////////////////////////////////////////////////////////////////
+
+wxString wxFileCtrlEvent::GetFile() const
+{
+    wxASSERT_MSG( !wxDynamicCast( GetEventObject(), wxFileCtrl )->HasMultipleFileSelection(),
+                  wxT( "Please use GetFiles() to get all files instead of this function" ) );
+
+    if ( files.Count() == 0 )
+        return wxEmptyString;
+    else
+        return files[0];
+}
+
+#endif // wxUSE_FILECTRL
diff --git a/src/generic/filectrlg.cpp b/src/generic/filectrlg.cpp
new file mode 100644
index 0000000000..967221b7ee
--- /dev/null
+++ b/src/generic/filectrlg.cpp
@@ -0,0 +1,1456 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/generic/filectrlg.cpp
+// Purpose:     wxGenericFileCtrl Implementation
+// Author:      Diaa M. Sami
+// Created:     2007-07-07
+// RCS-ID:      $Id$
+// Copyright:   (c) Diaa M. Sami
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#if wxUSE_FILECTRL
+
+#include "wx/generic/filectrlg.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/settings.h"
+    #include "wx/sizer.h"
+    #include "wx/stattext.h"
+    #include "wx/checkbox.h"
+    #include "wx/msgdlg.h"
+    #include "wx/log.h"
+    #include "wx/filedlg.h"
+#endif
+
+#include "wx/filename.h"
+#include "wx/clntdata.h"
+#include "wx/file.h"        // for wxS_IXXX constants only
+#include "wx/generic/dirctrlg.h" // for wxFileIconsTable
+#include "wx/dir.h"
+#include "wx/tokenzr.h"
+
+#ifdef __WXMSW__
+    #include "wx/msw/wrapwin.h"
+#endif
+
+#if defined(__WXWINCE__)
+#define IsTopMostDir(dir) (dir == wxT("\\") || dir == wxT("/"))
+#elif (defined(__DOS__) || defined(__WINDOWS__) || defined (__OS2__))
+#define IsTopMostDir(dir)   (dir.empty())
+#else
+#define IsTopMostDir(dir)   (dir == wxT("/"))
+#endif
+
+
+// ----------------------------------------------------------------------------
+// private functions
+// ----------------------------------------------------------------------------
+
+static
+int wxCALLBACK wxFileDataNameCompare( long data1, long data2, long sortOrder)
+{
+     wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
+     wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
+
+     if (fd1->GetFileName() == wxT(".."))
+         return -sortOrder;
+     if (fd2->GetFileName() == wxT(".."))
+         return sortOrder;
+     if (fd1->IsDir() && !fd2->IsDir())
+         return -sortOrder;
+     if (fd2->IsDir() && !fd1->IsDir())
+         return sortOrder;
+
+     return sortOrder*wxStrcmp( fd1->GetFileName(), fd2->GetFileName() );
+}
+
+static
+int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, long sortOrder)
+{
+     wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
+     wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
+
+     if (fd1->GetFileName() == wxT(".."))
+         return -sortOrder;
+     if (fd2->GetFileName() == wxT(".."))
+         return sortOrder;
+     if (fd1->IsDir() && !fd2->IsDir())
+         return -sortOrder;
+     if (fd2->IsDir() && !fd1->IsDir())
+         return sortOrder;
+     if (fd1->IsLink() && !fd2->IsLink())
+         return -sortOrder;
+     if (fd2->IsLink() && !fd1->IsLink())
+         return sortOrder;
+
+     return fd1->GetSize() > fd2->GetSize() ? sortOrder : -sortOrder;
+}
+
+static
+int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, long sortOrder)
+{
+     wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
+     wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
+
+     if (fd1->GetFileName() == wxT(".."))
+         return -sortOrder;
+     if (fd2->GetFileName() == wxT(".."))
+         return sortOrder;
+     if (fd1->IsDir() && !fd2->IsDir())
+         return -sortOrder;
+     if (fd2->IsDir() && !fd1->IsDir())
+         return sortOrder;
+     if (fd1->IsLink() && !fd2->IsLink())
+         return -sortOrder;
+     if (fd2->IsLink() && !fd1->IsLink())
+         return sortOrder;
+
+     return sortOrder*wxStrcmp( fd1->GetFileType(), fd2->GetFileType() );
+}
+
+static
+int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, long sortOrder)
+{
+     wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
+     wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
+
+     if (fd1->GetFileName() == wxT(".."))
+         return -sortOrder;
+     if (fd2->GetFileName() == wxT(".."))
+         return sortOrder;
+     if (fd1->IsDir() && !fd2->IsDir())
+         return -sortOrder;
+     if (fd2->IsDir() && !fd1->IsDir())
+         return sortOrder;
+
+     return fd1->GetDateTime().IsLaterThan(fd2->GetDateTime()) ? sortOrder : -sortOrder;
+}
+
+// defined in src/generic/dirctrlg.cpp
+extern size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids);
+
+//-----------------------------------------------------------------------------
+//  wxFileData
+//-----------------------------------------------------------------------------
+
+wxFileData::wxFileData( const wxString &filePath, const wxString &fileName, fileType type, int image_id )
+{
+    Init();
+    m_fileName = fileName;
+    m_filePath = filePath;
+    m_type = type;
+    m_image = image_id;
+
+    ReadData();
+}
+
+void wxFileData::Init()
+{
+    m_size = 0;
+    m_type = wxFileData::is_file;
+    m_image = wxFileIconsTable::file;
+}
+
+void wxFileData::Copy( const wxFileData& fileData )
+{
+    m_fileName = fileData.GetFileName();
+    m_filePath = fileData.GetFilePath();
+    m_size = fileData.GetSize();
+    m_dateTime = fileData.GetDateTime();
+    m_permissions = fileData.GetPermissions();
+    m_type = fileData.GetType();
+    m_image = fileData.GetImageId();
+}
+
+void wxFileData::ReadData()
+{
+    if (IsDrive())
+    {
+        m_size = 0;
+        return;
+    }
+
+#if defined(__DOS__) || (defined(__WINDOWS__) && !defined(__WXWINCE__)) || defined(__OS2__)
+    // c:\.. is a drive don't stat it
+    if ((m_fileName == wxT("..")) && (m_filePath.length() <= 5))
+    {
+        m_type = is_drive;
+        m_size = 0;
+        return;
+    }
+#endif // __DOS__ || __WINDOWS__
+
+#ifdef __WXWINCE__
+
+    // WinCE
+
+    DWORD fileAttribs = GetFileAttributes(m_filePath.fn_str());
+    m_type |= (fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0 ? is_dir : 0;
+
+    wxString p, f, ext;
+    wxSplitPath(m_filePath, & p, & f, & ext);
+    if (wxStricmp(ext, wxT("exe")) == 0)
+        m_type |= is_exe;
+
+    // Find out size
+    m_size = 0;
+    HANDLE fileHandle = CreateFile(m_filePath.fn_str(),
+            GENERIC_READ,
+            FILE_SHARE_READ,
+            NULL,
+            OPEN_EXISTING,
+            FILE_ATTRIBUTE_NORMAL,
+            NULL);
+
+    if (fileHandle != INVALID_HANDLE_VALUE)
+    {
+        m_size = GetFileSize(fileHandle, 0);
+        CloseHandle(fileHandle);
+    }
+
+    m_dateTime = wxFileModificationTime(m_filePath);
+
+#else
+
+    // OTHER PLATFORMS
+
+    wxStructStat buff;
+
+#if defined(__UNIX__) && (!defined( __OS2__ ) && !defined(__VMS))
+    lstat( m_filePath.fn_str(), &buff );
+    m_type |= S_ISLNK( buff.st_mode ) != 0 ? is_link : 0;
+#else // no lstat()
+    // only translate to file charset if we don't go by our
+    // wxStat implementation
+#ifndef wxNEED_WX_UNISTD_H
+    wxStat( m_filePath.fn_str() , &buff );
+#else
+    wxStat( m_filePath, &buff );
+#endif
+#endif
+
+    m_type |= (buff.st_mode & S_IFDIR) != 0 ? is_dir : 0;
+    m_type |= (buff.st_mode & wxS_IXUSR) != 0 ? is_exe : 0;
+
+    m_size = buff.st_size;
+
+    m_dateTime = buff.st_mtime;
+#endif
+    // __WXWINCE__
+
+#if defined(__UNIX__)
+    m_permissions.Printf(_T("%c%c%c%c%c%c%c%c%c"),
+                         buff.st_mode & wxS_IRUSR ? _T('r') : _T('-'),
+                         buff.st_mode & wxS_IWUSR ? _T('w') : _T('-'),
+                         buff.st_mode & wxS_IXUSR ? _T('x') : _T('-'),
+                         buff.st_mode & wxS_IRGRP ? _T('r') : _T('-'),
+                         buff.st_mode & wxS_IWGRP ? _T('w') : _T('-'),
+                         buff.st_mode & wxS_IXGRP ? _T('x') : _T('-'),
+                         buff.st_mode & wxS_IROTH ? _T('r') : _T('-'),
+                         buff.st_mode & wxS_IWOTH ? _T('w') : _T('-'),
+                         buff.st_mode & wxS_IXOTH ? _T('x') : _T('-'));
+#elif defined(__WIN32__)
+    DWORD attribs = ::GetFileAttributes(m_filePath.c_str());
+    if (attribs != (DWORD)-1)
+    {
+        m_permissions.Printf(_T("%c%c%c%c"),
+                             attribs & FILE_ATTRIBUTE_ARCHIVE  ? _T('A') : _T(' '),
+                             attribs & FILE_ATTRIBUTE_READONLY ? _T('R') : _T(' '),
+                             attribs & FILE_ATTRIBUTE_HIDDEN   ? _T('H') : _T(' '),
+                             attribs & FILE_ATTRIBUTE_SYSTEM   ? _T('S') : _T(' '));
+    }
+#endif
+
+    // try to get a better icon
+    if (m_image == wxFileIconsTable::file)
+    {
+        if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
+        {
+            m_image = wxTheFileIconsTable->GetIconID( m_fileName.AfterLast(wxT('.')));
+        } else if (IsExe())
+        {
+            m_image = wxFileIconsTable::executable;
+        }
+    }
+}
+
+wxString wxFileData::GetFileType() const
+{
+    if (IsDir())
+        return _("<DIR>");
+    else if (IsLink())
+        return _("<LINK>");
+    else if (IsDrive())
+        return _("<DRIVE>");
+    else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
+        return m_fileName.AfterLast(wxT('.'));
+
+    return wxEmptyString;
+}
+
+wxString wxFileData::GetModificationTime() const
+{
+    // want time as 01:02 so they line up nicely, no %r in WIN32
+    return m_dateTime.FormatDate() + wxT(" ") + m_dateTime.Format(wxT("%I:%M:%S %p"));
+}
+
+wxString wxFileData::GetHint() const
+{
+    wxString s = m_filePath;
+    s += wxT("  ");
+
+    if (IsDir())
+        s += _("<DIR>");
+    else if (IsLink())
+        s += _("<LINK>");
+    else if (IsDrive())
+        s += _("<DRIVE>");
+    else // plain file
+        s += wxString::Format(wxPLURAL("%ld byte", "%ld bytes", m_size),
+                              wxLongLong(m_size).ToString().c_str());
+
+    s += wxT(' ');
+
+    if ( !IsDrive() )
+    {
+        s << GetModificationTime()
+          << wxT("  ")
+          << m_permissions;
+    }
+
+    return s;
+}
+
+wxString wxFileData::GetEntry( fileListFieldType num ) const
+{
+    wxString s;
+    switch ( num )
+    {
+        case FileList_Name:
+            s = m_fileName;
+            break;
+
+        case FileList_Size:
+            if (!IsDir() && !IsLink() && !IsDrive())
+                s = wxLongLong(m_size).ToString();
+            break;
+
+        case FileList_Type:
+            s = GetFileType();
+            break;
+
+        case FileList_Time:
+            if (!IsDrive())
+                s = GetModificationTime();
+            break;
+
+#if defined(__UNIX__) || defined(__WIN32__)
+        case FileList_Perm:
+            s = m_permissions;
+            break;
+#endif // defined(__UNIX__) || defined(__WIN32__)
+
+        default:
+            wxFAIL_MSG( _T("unexpected field in wxFileData::GetEntry()") );
+    }
+
+    return s;
+}
+
+void wxFileData::SetNewName( const wxString &filePath, const wxString &fileName )
+{
+    m_fileName = fileName;
+    m_filePath = filePath;
+}
+
+void wxFileData::MakeItem( wxListItem &item )
+{
+    item.m_text = m_fileName;
+    item.ClearAttributes();
+    if (IsExe())
+        item.SetTextColour(*wxRED);
+    if (IsDir())
+        item.SetTextColour(*wxBLUE);
+
+    item.m_image = m_image;
+
+    if (IsLink())
+    {
+        wxColour dg = wxTheColourDatabase->Find( _T("MEDIUM GREY") );
+        if ( dg.Ok() )
+            item.SetTextColour(dg);
+    }
+    item.m_data = wxPtrToUInt(this);
+}
+
+//-----------------------------------------------------------------------------
+//  wxFileList
+//-----------------------------------------------------------------------------
+
+static bool ignoreChanges = false;
+
+IMPLEMENT_DYNAMIC_CLASS(wxFileList,wxListCtrl)
+
+BEGIN_EVENT_TABLE(wxFileList,wxListCtrl)
+    EVT_LIST_DELETE_ITEM(wxID_ANY, wxFileList::OnListDeleteItem)
+    EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileList::OnListDeleteAllItems)
+    EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileList::OnListEndLabelEdit)
+    EVT_LIST_COL_CLICK(wxID_ANY, wxFileList::OnListColClick)
+END_EVENT_TABLE()
+
+
+wxFileList::wxFileList()
+{
+    m_showHidden = false;
+    m_sort_foward = 1;
+    m_sort_field = wxFileData::FileList_Name;
+}
+
+wxFileList::wxFileList(wxWindow *win,
+                       wxWindowID id,
+                       const wxString& wild,
+                       bool showHidden,
+                       const wxPoint& pos,
+                       const wxSize& size,
+                       long style,
+                       const wxValidator &validator,
+                       const wxString &name)
+          : wxListCtrl(win, id, pos, size, style, validator, name),
+            m_wild(wild)
+{
+    wxImageList *imageList = wxTheFileIconsTable->GetSmallImageList();
+
+    SetImageList( imageList, wxIMAGE_LIST_SMALL );
+
+    m_showHidden = showHidden;
+
+    m_sort_foward = 1;
+    m_sort_field = wxFileData::FileList_Name;
+
+    m_dirName = wxT("*");
+
+    if (style & wxLC_REPORT)
+        ChangeToReportMode();
+}
+
+void wxFileList::ChangeToListMode()
+{
+    ClearAll();
+    SetSingleStyle( wxLC_LIST );
+    UpdateFiles();
+}
+
+void wxFileList::ChangeToReportMode()
+{
+    ClearAll();
+    SetSingleStyle( wxLC_REPORT );
+
+    // do this since WIN32 does mm/dd/yy UNIX does mm/dd/yyyy
+    // don't hardcode since mm/dd is dd/mm elsewhere
+    int w, h;
+    wxDateTime dt(22, wxDateTime::Dec, 2002, 22, 22, 22);
+    wxString txt = dt.FormatDate() + wxT("22") + dt.Format(wxT("%I:%M:%S %p"));
+    GetTextExtent(txt, &w, &h);
+
+    InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, w );
+    InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, w/2 );
+    InsertColumn( 2, _("Type"), wxLIST_FORMAT_LEFT, w/2 );
+    InsertColumn( 3, _("Modified"), wxLIST_FORMAT_LEFT, w );
+#if defined(__UNIX__)
+    GetTextExtent(wxT("Permissions 2"), &w, &h);
+    InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, w );
+#elif defined(__WIN32__)
+    GetTextExtent(wxT("Attributes 2"), &w, &h);
+    InsertColumn( 4, _("Attributes"), wxLIST_FORMAT_LEFT, w );
+#endif
+
+    UpdateFiles();
+}
+
+void wxFileList::ChangeToSmallIconMode()
+{
+    ClearAll();
+    SetSingleStyle( wxLC_SMALL_ICON );
+    UpdateFiles();
+}
+
+void wxFileList::ShowHidden( bool show )
+{
+    m_showHidden = show;
+    UpdateFiles();
+}
+
+long wxFileList::Add( wxFileData *fd, wxListItem &item )
+{
+    long ret = -1;
+    item.m_mask = wxLIST_MASK_TEXT + wxLIST_MASK_DATA + wxLIST_MASK_IMAGE;
+    fd->MakeItem( item );
+    long my_style = GetWindowStyleFlag();
+    if (my_style & wxLC_REPORT)
+    {
+        ret = InsertItem( item );
+        for (int i = 1; i < wxFileData::FileList_Max; i++)
+            SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) );
+    }
+    else if ((my_style & wxLC_LIST) || (my_style & wxLC_SMALL_ICON))
+    {
+        ret = InsertItem( item );
+    }
+    return ret;
+}
+
+void wxFileList::UpdateItem(const wxListItem &item)
+{
+    wxFileData *fd = (wxFileData*)GetItemData(item);
+    wxCHECK_RET(fd, wxT("invalid filedata"));
+
+    fd->ReadData();
+
+    SetItemText(item, fd->GetFileName());
+    SetItemImage(item, fd->GetImageId());
+
+    if (GetWindowStyleFlag() & wxLC_REPORT)
+    {
+        for (int i = 1; i < wxFileData::FileList_Max; i++)
+            SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) );
+    }
+}
+
+void wxFileList::UpdateFiles()
+{
+    // don't do anything before ShowModal() call which sets m_dirName
+    if ( m_dirName == wxT("*") )
+        return;
+
+    wxBusyCursor bcur; // this may take a while...
+
+    DeleteAllItems();
+
+    wxListItem item;
+    item.m_itemId = 0;
+    item.m_col = 0;
+
+#if (defined(__WINDOWS__) || defined(__DOS__) || defined(__WXMAC__) || defined(__OS2__)) && !defined(__WXWINCE__)
+    if ( IsTopMostDir(m_dirName) )
+    {
+        wxArrayString names, paths;
+        wxArrayInt icons;
+        size_t n, count = wxGetAvailableDrives(paths, names, icons);
+
+        for (n=0; n<count; n++)
+        {
+            wxFileData *fd = new wxFileData(paths[n], names[n], wxFileData::is_drive, icons[n]);
+            if (Add(fd, item) != -1)
+                item.m_itemId++;
+            else
+                delete fd;
+        }
+    }
+    else
+#endif // defined(__DOS__) || defined(__WINDOWS__)
+    {
+        // Real directory...
+        if ( !IsTopMostDir(m_dirName) && !m_dirName.empty() )
+        {
+            wxString p(wxPathOnly(m_dirName));
+#if (defined(__UNIX__) || defined(__WXWINCE__)) && !defined(__OS2__)
+            if (p.empty()) p = wxT("/");
+#endif // __UNIX__
+            wxFileData *fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder);
+            if (Add(fd, item) != -1)
+                item.m_itemId++;
+            else
+                delete fd;
+        }
+
+        wxString dirname(m_dirName);
+#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
+        if (dirname.length() == 2 && dirname[1u] == wxT(':'))
+            dirname << wxT('\\');
+#endif // defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
+
+        if (dirname.empty())
+            dirname = wxFILE_SEP_PATH;
+
+        wxLogNull logNull;
+        wxDir dir(dirname);
+
+        if ( dir.IsOpened() )
+        {
+            wxString dirPrefix(dirname);
+            if (dirPrefix.Last() != wxFILE_SEP_PATH)
+                dirPrefix += wxFILE_SEP_PATH;
+
+            int hiddenFlag = m_showHidden ? wxDIR_HIDDEN : 0;
+
+            bool cont;
+            wxString f;
+
+            // Get the directories first (not matched against wildcards):
+            cont = dir.GetFirst(&f, wxEmptyString, wxDIR_DIRS | hiddenFlag);
+            while (cont)
+            {
+                wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_dir, wxFileIconsTable::folder);
+                if (Add(fd, item) != -1)
+                    item.m_itemId++;
+                else
+                    delete fd;
+
+                cont = dir.GetNext(&f);
+            }
+
+            // Tokenize the wildcard string, so we can handle more than 1
+            // search pattern in a wildcard.
+            wxStringTokenizer tokenWild(m_wild, wxT(";"));
+            while ( tokenWild.HasMoreTokens() )
+            {
+                cont = dir.GetFirst(&f, tokenWild.GetNextToken(),
+                                        wxDIR_FILES | hiddenFlag);
+                while (cont)
+                {
+                    wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_file, wxFileIconsTable::file);
+                    if (Add(fd, item) != -1)
+                        item.m_itemId++;
+                    else
+                        delete fd;
+
+                    cont = dir.GetNext(&f);
+                }
+            }
+        }
+    }
+
+    SortItems(m_sort_field, m_sort_foward);
+}
+
+void wxFileList::SetWild( const wxString &wild )
+{
+    if (wild.Find(wxT('|')) != wxNOT_FOUND)
+        return;
+
+    m_wild = wild;
+    UpdateFiles();
+}
+
+void wxFileList::MakeDir()
+{
+    wxString new_name( _("NewName") );
+    wxString path( m_dirName );
+    path += wxFILE_SEP_PATH;
+    path += new_name;
+    if (wxFileExists(path))
+    {
+        // try NewName0, NewName1 etc.
+        int i = 0;
+        do {
+            new_name = _("NewName");
+            wxString num;
+            num.Printf( wxT("%d"), i );
+            new_name += num;
+
+            path = m_dirName;
+            path += wxFILE_SEP_PATH;
+            path += new_name;
+            i++;
+        } while (wxFileExists(path));
+    }
+
+    wxLogNull log;
+    if (!wxMkdir(path))
+    {
+        wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
+        dialog.ShowModal();
+        return;
+    }
+
+    wxFileData *fd = new wxFileData( path, new_name, wxFileData::is_dir, wxFileIconsTable::folder );
+    wxListItem item;
+    item.m_itemId = 0;
+    item.m_col = 0;
+    long id = Add( fd, item );
+
+    if (id != -1)
+    {
+        SortItems(m_sort_field, m_sort_foward);
+        id = FindItem( 0, wxPtrToUInt(fd) );
+        EnsureVisible( id );
+        EditLabel( id );
+    }
+    else
+        delete fd;
+}
+
+void wxFileList::GoToParentDir()
+{
+    if (!IsTopMostDir(m_dirName))
+    {
+        size_t len = m_dirName.length();
+        if (wxEndsWithPathSeparator(m_dirName))
+            m_dirName.Remove( len-1, 1 );
+        wxString fname( wxFileNameFromPath(m_dirName) );
+        m_dirName = wxPathOnly( m_dirName );
+#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
+        if (!m_dirName.empty())
+        {
+            if (m_dirName.Last() == wxT('.'))
+                m_dirName = wxEmptyString;
+        }
+#elif defined(__UNIX__)
+        if (m_dirName.empty())
+            m_dirName = wxT("/");
+#endif
+        UpdateFiles();
+        long id = FindItem( 0, fname );
+        if (id != wxNOT_FOUND)
+        {
+            ignoreChanges = true;
+            SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
+            EnsureVisible( id );
+            ignoreChanges = false;
+        }
+    }
+}
+
+void wxFileList::GoToHomeDir()
+{
+    wxString s = wxGetUserHome( wxString() );
+    GoToDir(s);
+}
+
+void wxFileList::GoToDir( const wxString &dir )
+{
+    if (!wxDirExists(dir)) return;
+
+    m_dirName = dir;
+    UpdateFiles();
+
+    ignoreChanges = true;
+    SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
+    ignoreChanges = false;
+
+    EnsureVisible( 0 );
+}
+
+void wxFileList::FreeItemData(wxListItem& item)
+{
+    if ( item.m_data )
+    {
+        wxFileData *fd = (wxFileData*)item.m_data;
+        delete fd;
+
+        item.m_data = 0;
+    }
+}
+
+void wxFileList::OnListDeleteItem( wxListEvent &event )
+{
+    FreeItemData(event.m_item);
+}
+
+void wxFileList::OnListDeleteAllItems( wxListEvent & WXUNUSED(event) )
+{
+    FreeAllItemsData();
+}
+
+void wxFileList::FreeAllItemsData()
+{
+    wxListItem item;
+    item.m_mask = wxLIST_MASK_DATA;
+
+    item.m_itemId = GetNextItem( -1, wxLIST_NEXT_ALL );
+    while ( item.m_itemId != -1 )
+    {
+        GetItem( item );
+        FreeItemData(item);
+        item.m_itemId = GetNextItem( item.m_itemId, wxLIST_NEXT_ALL );
+    }
+}
+
+void wxFileList::OnListEndLabelEdit( wxListEvent &event )
+{
+    wxFileData *fd = (wxFileData*)event.m_item.m_data;
+    wxASSERT( fd );
+
+    if ((event.GetLabel().empty()) ||
+        (event.GetLabel() == wxT(".")) ||
+        (event.GetLabel() == wxT("..")) ||
+        (event.GetLabel().First( wxFILE_SEP_PATH ) != wxNOT_FOUND))
+    {
+        wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR );
+        dialog.ShowModal();
+        event.Veto();
+        return;
+    }
+
+    wxString new_name( wxPathOnly( fd->GetFilePath() ) );
+    new_name += wxFILE_SEP_PATH;
+    new_name += event.GetLabel();
+
+    wxLogNull log;
+
+    if (wxFileExists(new_name))
+    {
+        wxMessageDialog dialog(this, _("File name exists already."), _("Error"), wxOK | wxICON_ERROR );
+        dialog.ShowModal();
+        event.Veto();
+    }
+
+    if (wxRenameFile(fd->GetFilePath(),new_name))
+    {
+        fd->SetNewName( new_name, event.GetLabel() );
+
+        ignoreChanges = true;
+        SetItemState( event.GetItem(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
+        ignoreChanges = false;
+
+        UpdateItem( event.GetItem() );
+        EnsureVisible( event.GetItem() );
+    }
+    else
+    {
+        wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
+        dialog.ShowModal();
+        event.Veto();
+    }
+}
+
+void wxFileList::OnListColClick( wxListEvent &event )
+{
+    int col = event.GetColumn();
+
+    switch (col)
+    {
+        case wxFileData::FileList_Name :
+        case wxFileData::FileList_Size :
+        case wxFileData::FileList_Type :
+        case wxFileData::FileList_Time : break;
+        default : return;
+    }
+
+    if ((wxFileData::fileListFieldType)col == m_sort_field)
+        m_sort_foward = !m_sort_foward;
+    else
+        m_sort_field = (wxFileData::fileListFieldType)col;
+
+    SortItems(m_sort_field, m_sort_foward);
+}
+
+void wxFileList::SortItems(wxFileData::fileListFieldType field, bool forward)
+{
+    m_sort_field = field;
+    m_sort_foward = forward;
+    const long sort_dir = forward ? 1 : -1;
+
+    switch (m_sort_field)
+    {
+        case wxFileData::FileList_Size :
+            wxListCtrl::SortItems(wxFileDataSizeCompare, sort_dir);
+            break;
+
+        case wxFileData::FileList_Type :
+            wxListCtrl::SortItems(wxFileDataTypeCompare, sort_dir);
+            break;
+
+        case wxFileData::FileList_Time :
+            wxListCtrl::SortItems(wxFileDataTimeCompare, sort_dir);
+            break;
+
+        case wxFileData::FileList_Name :
+        default :
+            wxListCtrl::SortItems(wxFileDataNameCompare, sort_dir);
+            break;
+    }
+}
+
+wxFileList::~wxFileList()
+{
+    // Normally the data are freed via an EVT_LIST_DELETE_ALL_ITEMS event and
+    // wxFileList::OnListDeleteAllItems. But if the event is generated after
+    // the destruction of the wxFileList we need to free any data here:
+    FreeAllItemsData();
+}
+
+#define  ID_CHOICE        (wxID_FILECTRL + 1)
+#define  ID_TEXT          (wxID_FILECTRL + 2)
+#define  ID_FILELIST_CTRL (wxID_FILECTRL + 3)
+#define  ID_CHECK         (wxID_FILECTRL + 4)
+
+///////////////////////////////////////////////////////////////////////////////
+// wxGenericFileCtrl implementation
+///////////////////////////////////////////////////////////////////////////////
+
+IMPLEMENT_DYNAMIC_CLASS( wxGenericFileCtrl, wxPanel )
+
+BEGIN_EVENT_TABLE( wxGenericFileCtrl, wxPanel )
+    EVT_LIST_ITEM_SELECTED( ID_FILELIST_CTRL, wxGenericFileCtrl::OnSelected )
+    EVT_LIST_ITEM_ACTIVATED( ID_FILELIST_CTRL, wxGenericFileCtrl::OnActivated )
+    EVT_CHOICE( ID_CHOICE, wxGenericFileCtrl::OnChoiceFilter )
+    EVT_TEXT_ENTER( ID_TEXT, wxGenericFileCtrl::OnTextEnter )
+    EVT_TEXT( ID_TEXT, wxGenericFileCtrl::OnTextChange )
+    EVT_CHECKBOX( ID_CHECK, wxGenericFileCtrl::OnCheck )
+END_EVENT_TABLE()
+
+bool wxGenericFileCtrl::Create( wxWindow *parent,
+                                wxWindowID id,
+                                const wxString& defaultDirectory,
+                                const wxString& defaultFileName,
+                                const wxString& wildCard,
+                                long style,
+                                const wxPoint& pos,
+                                const wxSize& size,
+                                const wxString& name )
+{
+    this->m_style = style;
+    m_inSelected = false;
+    m_noSelChgEvent = false;
+
+    // check that the styles are not contradictory
+    wxASSERT_MSG( !( ( m_style & wxFC_SAVE ) && ( m_style & wxFC_OPEN ) ),
+                  wxT( "can't specify both wxFC_SAVE and wxFC_OPEN at once" ) );
+
+    wxASSERT_MSG( !( ( m_style & wxFC_SAVE ) && ( m_style & wxFC_MULTIPLE ) ),
+                  wxT( "wxFC_MULTIPLE can't be used with wxFC_SAVE" ) );
+
+    wxPanel::Create( parent, id, pos, size, wxTAB_TRAVERSAL, name );
+
+    m_dir = defaultDirectory;
+
+    m_ignoreChanges = true;
+
+    if ( ( m_dir.empty() ) || ( m_dir == wxT( "." ) ) )
+    {
+        m_dir = wxGetCwd();
+        if ( m_dir.empty() )
+            m_dir = wxFILE_SEP_PATH;
+    }
+
+    const size_t len = m_dir.length();
+    if ( ( len > 1 ) && ( wxEndsWithPathSeparator( m_dir ) ) )
+        m_dir.Remove( len - 1, 1 );
+
+    m_filterExtension = wxEmptyString;
+
+    // layout
+
+    const bool is_pda = ( wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA );
+
+    wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
+
+    wxBoxSizer *staticsizer = new wxBoxSizer( wxHORIZONTAL );
+    if ( is_pda )
+        staticsizer->Add( new wxStaticText( this, wxID_ANY, _( "Current directory:" ) ), 0, wxRIGHT, 10 );
+    m_static = new wxStaticText( this, wxID_ANY, m_dir );
+    staticsizer->Add( m_static, 1 );
+    mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 10 );
+
+    long style2 = wxLC_LIST;
+    if ( !( m_style & wxFC_MULTIPLE ) )
+        style2 |= wxLC_SINGLE_SEL;
+
+#ifdef __WXWINCE__
+    style2 |= wxSIMPLE_BORDER;
+#else
+    style2 |= wxSUNKEN_BORDER;
+#endif
+
+    m_list = new wxFileList( this, ID_FILELIST_CTRL,
+                             wxEmptyString, false,
+                             wxDefaultPosition, wxSize( 400, 140 ),
+                             style2 );
+
+    m_text = new wxTextCtrl( this, ID_TEXT, wxEmptyString,
+                             wxDefaultPosition, wxDefaultSize,
+                             wxTE_PROCESS_ENTER );
+    m_choice = new wxChoice( this, ID_CHOICE );
+
+    if ( is_pda )
+    {
+        // PDAs have a different screen layout
+        mainsizer->Add( m_list, wxSizerFlags( 1 ).Expand().HorzBorder() );
+
+        wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
+        textsizer->Add( m_text, wxSizerFlags( 1 ).Centre().Border() );
+        mainsizer->Add( textsizer, wxSizerFlags().Expand() );
+
+        m_check = NULL;
+        textsizer->Add( m_choice, wxSizerFlags( 1 ).Centre().Border() );
+    }
+    else // !is_pda
+    {
+        mainsizer->Add( m_list, wxSizerFlags( 1 ).Expand().DoubleHorzBorder() );
+
+        wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL );
+        textsizer->Add( m_text, wxSizerFlags( 1 ).Centre().
+                        DoubleBorder( wxLEFT | wxRIGHT | wxTOP ) );
+        mainsizer->Add( textsizer, wxSizerFlags().Expand() );
+
+        wxSizerFlags flagsCentre;
+        flagsCentre.Centre().DoubleBorder();
+
+        wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
+        choicesizer->Add( m_choice, wxSizerFlags( flagsCentre ).Proportion( 1 ) );
+
+        if ( !( m_style & wxFC_NOSHOWHIDDEN ) )
+            {
+            m_check = new wxCheckBox( this, ID_CHECK, _( "Show &hidden files" ) );
+            choicesizer->Add( m_check, flagsCentre );
+            }
+
+        mainsizer->Add( choicesizer, wxSizerFlags().Expand() );
+    }
+
+    SetWildcard( wildCard );
+
+    SetAutoLayout( true );
+    SetSizer( mainsizer );
+
+    if ( !is_pda )
+    {
+        mainsizer->Fit( this );
+    }
+
+    m_list->GoToDir( m_dir );
+    UpdateControls();
+    m_text->SetValue( m_fileName );
+
+    m_ignoreChanges = false;
+
+    // must be after m_ignoreChanges = false
+    SetFilename( defaultFileName );
+
+    return true;
+}
+
+wxString wxGenericFileCtrl::GetPath() const
+{
+    return DoGetFilename( true );
+}
+
+wxString wxGenericFileCtrl::GetFilename() const
+{
+    return DoGetFilename( false );
+}
+
+wxString wxGenericFileCtrl::DoGetFilename( const bool fullPath ) const
+{
+    wxASSERT_MSG( ( m_style & wxFC_MULTIPLE ) == 0,
+                  wxT( "With controls that has wxFC_MULTIPLE style " )
+                  wxT( "use GetFilenames/GetPaths to get all filenames/paths selected" ) );
+
+    const wxString value = m_text->GetValue();
+
+    if ( !value.empty() )
+        return value;
+    return fullPath ? ( GetProperFileListDir() + value ) : value;
+}
+
+void wxGenericFileCtrl::DoGetFilenames( wxArrayString& filenames, const bool fullPath ) const
+{
+    filenames.Empty();
+
+    const wxString dir = GetProperFileListDir();
+    const wxString value = m_text->GetValue();
+
+    if ( !value.empty() )
+    {
+        if ( fullPath )
+            filenames.Add( dir + value );
+        else
+            filenames.Add( value );
+        return;
+    }
+
+    if ( m_list->GetSelectedItemCount() == 0 )
+    {
+        return;
+    }
+
+    filenames.Alloc( m_list->GetSelectedItemCount() );
+
+    wxListItem item;
+    item.m_mask = wxLIST_MASK_TEXT;
+
+    item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+    while ( item.m_itemId != -1 )
+    {
+        m_list->GetItem( item );
+
+        if ( fullPath )
+            filenames.Add( dir + item.m_text );
+        else
+            filenames.Add( item.m_text );
+
+        item.m_itemId = m_list->GetNextItem( item.m_itemId,
+                                             wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+    }
+}
+
+bool wxGenericFileCtrl::SetDirectory( const wxString& dir )
+{
+    m_ignoreChanges = true;
+    m_list->GoToDir( dir );
+    UpdateControls();
+    m_ignoreChanges = false;
+
+    return wxFileName( dir ).SameAs( m_list->GetDir() );
+}
+
+wxString wxGenericFileCtrl::GetDirectory() const
+{
+    return m_list->GetDir();
+}
+
+bool wxGenericFileCtrl::SetFilename( const wxString& name )
+{
+    const long item = m_list->FindItem( -1, name );
+
+    if ( item == -1 ) // file not found either because it doesn't exist or the
+        // current filter doesn't show it.
+        return false;
+
+    m_noSelChgEvent = true;
+
+    // Deselect selected items
+    {
+        const int numSelectedItems = m_list->GetSelectedItemCount();
+
+        if ( numSelectedItems > 0 )
+        {
+            long itemIndex = -1;
+
+            for ( ;; )
+            {
+                itemIndex = m_list->GetNextItem( itemIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+                if ( itemIndex == -1 )
+                    break;
+
+                m_list->SetItemState( itemIndex, 0, wxLIST_STATE_SELECTED );
+            }
+        }
+    }
+
+    m_list->SetItemState( item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
+    m_list->EnsureVisible( item );
+
+    m_noSelChgEvent = false;
+
+    return true;
+}
+
+void wxGenericFileCtrl::DoSetFilterIndex( int filterindex )
+{
+    const wxString& str = (wx_static_cast(wxStringClientData *,
+                            m_choice->GetClientObject( filterindex )))
+                            ->GetData();
+    m_list->SetWild( str );
+    m_filterIndex = filterindex;
+    if ( str.Left( 2 ) == wxT( "*." ) )
+    {
+        m_filterExtension = str.Mid( 1 );
+        if ( m_filterExtension == _T( ".*" ) )
+            m_filterExtension.clear();
+    }
+    else
+    {
+        m_filterExtension.clear();
+    }
+}
+
+void wxGenericFileCtrl::SetWildcard( const wxString& wildCard )
+{
+    if ( wildCard.empty() || wildCard == wxFileSelectorDefaultWildcardStr )
+    {
+        m_wildCard = wxString::Format( _( "All files (%s)|%s" ),
+                                       wxFileSelectorDefaultWildcardStr,
+                                       wxFileSelectorDefaultWildcardStr );
+    }
+    else
+        m_wildCard = wildCard;
+
+    wxArrayString wildDescriptions, wildFilters;
+    const size_t count = wxParseCommonDialogsFilter( m_wildCard,
+                         wildDescriptions,
+                         wildFilters );
+    wxCHECK_RET( count, wxT( "wxFileDialog: bad wildcard string" ) );
+
+    m_choice->Clear();
+
+    for ( size_t n = 0; n < count; n++ )
+    {
+        m_choice->Append(wildDescriptions[n], new wxStringClientData(wildFilters[n]));
+    }
+
+    SetFilterIndex( 0 );
+}
+
+void wxGenericFileCtrl::SetFilterIndex( int filterindex )
+{
+    m_choice->SetSelection( filterindex );
+
+    DoSetFilterIndex( filterindex );
+}
+
+void wxGenericFileCtrl::OnChoiceFilter( wxCommandEvent &event )
+{
+    DoSetFilterIndex( ( int )event.GetInt() );
+}
+
+void wxGenericFileCtrl::OnCheck( wxCommandEvent &event )
+{
+    m_list->ShowHidden( event.GetInt() != 0 );
+}
+
+void wxGenericFileCtrl::OnActivated( wxListEvent &event )
+{
+    HandleAction( event.m_item.m_text );
+}
+
+void wxGenericFileCtrl::OnTextEnter( wxCommandEvent &WXUNUSED( event ) )
+{
+    HandleAction( m_text->GetValue() );
+}
+
+void wxGenericFileCtrl::OnTextChange( wxCommandEvent &WXUNUSED( event ) )
+{
+    if ( !m_ignoreChanges )
+    {
+        // Clear selections.  Otherwise when the user types in a value they may
+        // not get the file whose name they typed.
+        if ( m_list->GetSelectedItemCount() > 0 )
+        {
+            long item = m_list->GetNextItem( -1, wxLIST_NEXT_ALL,
+                                             wxLIST_STATE_SELECTED );
+            while ( item != -1 )
+            {
+                m_list->SetItemState( item, 0, wxLIST_STATE_SELECTED );
+                item = m_list->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+            }
+        }
+    }
+}
+
+void wxGenericFileCtrl::OnSelected( wxListEvent &event )
+{
+    if ( m_ignoreChanges )
+        return;
+
+    if ( m_inSelected )
+        return;
+
+    m_inSelected = true;
+    const wxString filename( event.m_item.m_text );
+
+#ifdef __WXWINCE__
+    // No double-click on most WinCE devices, so do action immediately.
+    HandleAction( filename );
+#else
+    if ( filename == wxT( ".." ) )
+    {
+        m_inSelected = false;
+        return;
+    }
+
+    wxString dir = m_list->GetDir();
+    if ( !IsTopMostDir( dir ) )
+        dir += wxFILE_SEP_PATH;
+    dir += filename;
+    if ( wxDirExists( dir ) )
+    {
+        m_inSelected = false;
+
+        return;
+    }
+    
+
+    m_ignoreChanges = true;
+    m_text->SetValue( filename );
+
+    if ( m_list->GetSelectedItemCount() > 1 )
+    {
+        m_text->Clear();
+    }
+
+    if ( !m_noSelChgEvent )
+        GenerateSelectionChangedEvent( this, this );
+
+    m_ignoreChanges = false;
+#endif
+    m_inSelected = false;
+}
+
+void wxGenericFileCtrl::HandleAction( const wxString &fn )
+{
+    if ( m_ignoreChanges )
+        return;
+
+    wxString filename( fn );
+    if ( filename.empty() )
+    {
+        return;
+    }
+    if ( filename == wxT( "." ) ) return;
+
+    wxString dir = m_list->GetDir();
+
+    // "some/place/" means they want to chdir not try to load "place"
+    const bool want_dir = filename.Last() == wxFILE_SEP_PATH;
+    if ( want_dir )
+        filename = filename.RemoveLast();
+
+    if ( filename == wxT( ".." ) )
+    {
+        m_ignoreChanges = true;
+        m_list->GoToParentDir();
+
+        GenerateFolderChangedEvent( this, this );
+
+        UpdateControls();
+        m_ignoreChanges = false;
+        return;
+    }
+
+#ifdef __UNIX__
+    if ( filename == wxT( "~" ) )
+    {
+        m_ignoreChanges = true;
+        m_list->GoToHomeDir();
+
+        GenerateFolderChangedEvent( this, this );
+
+        UpdateControls();
+        m_ignoreChanges = false;
+        return;
+    }
+
+    if ( filename.BeforeFirst( wxT( '/' ) ) == wxT( "~" ) )
+    {
+        filename = wxString( wxGetUserHome() ) + filename.Remove( 0, 1 );
+    }
+#endif // __UNIX__
+
+    if ( !( m_style & wxFC_SAVE ) )
+    {
+        if ( ( filename.Find( wxT( '*' ) ) != wxNOT_FOUND ) ||
+                ( filename.Find( wxT( '?' ) ) != wxNOT_FOUND ) )
+        {
+            if ( filename.Find( wxFILE_SEP_PATH ) != wxNOT_FOUND )
+            {
+                wxMessageBox( _( "Illegal file specification." ),
+                              _( "Error" ), wxOK | wxICON_ERROR, this );
+                return;
+            }
+            m_list->SetWild( filename );
+            return;
+        }
+    }
+
+    if ( !IsTopMostDir( dir ) )
+        dir += wxFILE_SEP_PATH;
+    if ( !wxIsAbsolutePath( filename ) )
+    {
+        dir += filename;
+        filename = dir;
+    }
+
+    if ( wxDirExists( filename ) )
+    {
+        m_ignoreChanges = true;
+        m_list->GoToDir( filename );
+        UpdateControls();
+
+        GenerateFolderChangedEvent( this, this );
+
+        m_ignoreChanges = false;
+        return;
+    }
+
+    // they really wanted a dir, but it doesn't exist
+    if ( want_dir )
+    {
+        wxMessageBox( _( "Directory doesn't exist." ), _( "Error" ),
+                      wxOK | wxICON_ERROR, this );
+        return;
+    }
+
+    // append the default extension to the filename if it doesn't have any
+    //
+    // 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
+    //     file without extension as well?
+    if ( !( m_style & wxFC_OPEN ) || !wxFileExists( filename ) )
+    {
+        filename = wxFileDialogBase::AppendExtension( filename, m_filterExtension );
+        GenerateFileActivatedEvent( this, this, wxFileName( filename ).GetFullName() );
+        return;
+    }
+
+    GenerateFileActivatedEvent( this, this );
+}
+
+bool wxGenericFileCtrl::SetPath( const wxString& path )
+{
+    if ( !wxFileName::FileExists( ( path ) ) )
+        return false;
+
+    wxString ext;
+    wxSplitPath( path, &m_dir, &m_fileName, &ext );
+    if ( !ext.empty() )
+    {
+        m_fileName += wxT( "." );
+        m_fileName += ext;
+    }
+
+    SetDirectory( m_dir );
+    SetFilename( m_fileName );
+
+    return true;
+}
+
+void wxGenericFileCtrl::GetPaths( wxArrayString& paths ) const
+{
+    DoGetFilenames( paths, true );
+}
+
+void wxGenericFileCtrl::GetFilenames( wxArrayString& files ) const
+{
+    DoGetFilenames( files, false );
+}
+
+void wxGenericFileCtrl::UpdateControls()
+{
+    const wxString dir = m_list->GetDir();
+    m_static->SetLabel( dir );
+}
+
+void wxGenericFileCtrl::GoToParentDir()
+{
+    m_list->GoToParentDir();
+    UpdateControls();
+}
+
+void wxGenericFileCtrl::GoToHomeDir()
+{
+    m_list->GoToHomeDir();
+    UpdateControls();
+}
+
+wxString wxGenericFileCtrl::GetProperFileListDir() const
+{
+    wxString dir = m_list->GetDir();
+#ifdef __UNIX__
+    if ( dir != wxT( "/" ) )
+#elif defined(__WXWINCE__)
+    if ( dir != wxT( "/" ) && dir != wxT( "\\" ) )
+#endif
+        dir += wxFILE_SEP_PATH;
+
+    return dir;
+}
+
+#endif // wxUSE_FILECTRL
diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp
index 2729d5db5d..d09c7eec53 100644
--- a/src/generic/filedlgg.cpp
+++ b/src/generic/filedlgg.cpp
@@ -16,7 +16,7 @@
     #pragma hdrstop
 #endif
 
-#if wxUSE_FILEDLG
+#if wxUSE_FILEDLG && (defined(__WXUNIVERSAL__) || defined(__WXGTK__))
 
 // NOTE : it probably also supports MAC, untested
 #if !defined(__UNIX__) && !defined(__DOS__) && !defined(__WIN32__) && !defined(__OS2__)
@@ -42,15 +42,13 @@
 #endif
 
 #include "wx/longlong.h"
-#include "wx/tokenzr.h"
 #include "wx/config.h"
 #include "wx/imaglist.h"
-#include "wx/dir.h"
 #include "wx/artprov.h"
 #include "wx/filefn.h"
-#include "wx/file.h"        // for wxS_IXXX constants only
+#include "wx/filectrl.h"
 #include "wx/generic/filedlgg.h"
-#include "wx/generic/dirctrlg.h" // for wxFileIconsTable
+#include "wx/debug.h"
 
 #if wxUSE_TOOLTIPS
     #include "wx/tooltip.h"
@@ -85,90 +83,6 @@
 #include <unistd.h>
 #endif
 
-// ----------------------------------------------------------------------------
-// private functions
-// ----------------------------------------------------------------------------
-
-static
-int wxCALLBACK wxFileDataNameCompare( long data1, long data2, long sortOrder)
-{
-     wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
-     wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
-
-     if (fd1->GetFileName() == wxT(".."))
-         return -sortOrder;
-     if (fd2->GetFileName() == wxT(".."))
-         return sortOrder;
-     if (fd1->IsDir() && !fd2->IsDir())
-         return -sortOrder;
-     if (fd2->IsDir() && !fd1->IsDir())
-         return sortOrder;
-
-     return sortOrder*wxStrcmp( fd1->GetFileName(), fd2->GetFileName() );
-}
-
-static
-int wxCALLBACK wxFileDataSizeCompare(long data1, long data2, long sortOrder)
-{
-     wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
-     wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
-
-     if (fd1->GetFileName() == wxT(".."))
-         return -sortOrder;
-     if (fd2->GetFileName() == wxT(".."))
-         return sortOrder;
-     if (fd1->IsDir() && !fd2->IsDir())
-         return -sortOrder;
-     if (fd2->IsDir() && !fd1->IsDir())
-         return sortOrder;
-     if (fd1->IsLink() && !fd2->IsLink())
-         return -sortOrder;
-     if (fd2->IsLink() && !fd1->IsLink())
-         return sortOrder;
-
-     return fd1->GetSize() > fd2->GetSize() ? sortOrder : -sortOrder;
-}
-
-static
-int wxCALLBACK wxFileDataTypeCompare(long data1, long data2, long sortOrder)
-{
-     wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
-     wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
-
-     if (fd1->GetFileName() == wxT(".."))
-         return -sortOrder;
-     if (fd2->GetFileName() == wxT(".."))
-         return sortOrder;
-     if (fd1->IsDir() && !fd2->IsDir())
-         return -sortOrder;
-     if (fd2->IsDir() && !fd1->IsDir())
-         return sortOrder;
-     if (fd1->IsLink() && !fd2->IsLink())
-         return -sortOrder;
-     if (fd2->IsLink() && !fd1->IsLink())
-         return sortOrder;
-
-     return sortOrder*wxStrcmp( fd1->GetFileType(), fd2->GetFileType() );
-}
-
-static
-int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, long sortOrder)
-{
-     wxFileData *fd1 = (wxFileData *)wxUIntToPtr(data1);
-     wxFileData *fd2 = (wxFileData *)wxUIntToPtr(data2);
-
-     if (fd1->GetFileName() == wxT(".."))
-         return -sortOrder;
-     if (fd2->GetFileName() == wxT(".."))
-         return sortOrder;
-     if (fd1->IsDir() && !fd2->IsDir())
-         return -sortOrder;
-     if (fd2->IsDir() && !fd1->IsDir())
-         return sortOrder;
-
-     return fd1->GetDateTime().IsLaterThan(fd2->GetDateTime()) ? sortOrder : -sortOrder;
-}
-
 #if defined(__WXWINCE__)
 #define IsTopMostDir(dir) (dir == wxT("\\") || dir == wxT("/"))
 #elif (defined(__DOS__) || defined(__WINDOWS__) || defined (__OS2__))
@@ -177,779 +91,27 @@ int wxCALLBACK wxFileDataTimeCompare(long data1, long data2, long sortOrder)
 #define IsTopMostDir(dir)   (dir == wxT("/"))
 #endif
 
-// defined in src/generic/dirctrlg.cpp
-extern size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids);
-
-//-----------------------------------------------------------------------------
-//  wxFileData
-//-----------------------------------------------------------------------------
-
-wxFileData::wxFileData( const wxString &filePath, const wxString &fileName, fileType type, int image_id )
-{
-    Init();
-    m_fileName = fileName;
-    m_filePath = filePath;
-    m_type = type;
-    m_image = image_id;
-
-    ReadData();
-}
-
-void wxFileData::Init()
-{
-    m_size = 0;
-    m_type = wxFileData::is_file;
-    m_image = wxFileIconsTable::file;
-}
-
-void wxFileData::Copy( const wxFileData& fileData )
-{
-    m_fileName = fileData.GetFileName();
-    m_filePath = fileData.GetFilePath();
-    m_size = fileData.GetSize();
-    m_dateTime = fileData.GetDateTime();
-    m_permissions = fileData.GetPermissions();
-    m_type = fileData.GetType();
-    m_image = fileData.GetImageId();
-}
-
-void wxFileData::ReadData()
-{
-    if (IsDrive())
-    {
-        m_size = 0;
-        return;
-    }
-
-#if defined(__DOS__) || (defined(__WINDOWS__) && !defined(__WXWINCE__)) || defined(__OS2__)
-    // c:\.. is a drive don't stat it
-    if ((m_fileName == wxT("..")) && (m_filePath.length() <= 5))
-    {
-        m_type = is_drive;
-        m_size = 0;
-        return;
-    }
-#endif // __DOS__ || __WINDOWS__
-
-#ifdef __WXWINCE__
-
-    // WinCE
-
-    DWORD fileAttribs = GetFileAttributes(m_filePath.fn_str());
-    m_type |= (fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0 ? is_dir : 0;
-
-    wxString p, f, ext;
-    wxSplitPath(m_filePath, & p, & f, & ext);
-    if (wxStricmp(ext, wxT("exe")) == 0)
-        m_type |= is_exe;
-
-    // Find out size
-    m_size = 0;
-    HANDLE fileHandle = CreateFile(m_filePath.fn_str(),
-            GENERIC_READ,
-            FILE_SHARE_READ,
-            NULL,
-            OPEN_EXISTING,
-            FILE_ATTRIBUTE_NORMAL,
-            NULL);
-
-    if (fileHandle != INVALID_HANDLE_VALUE)
-    {
-        m_size = GetFileSize(fileHandle, 0);
-        CloseHandle(fileHandle);
-    }
-
-    m_dateTime = wxFileModificationTime(m_filePath);
-
-#else
-
-    // OTHER PLATFORMS
-
-    wxStructStat buff;
-
-#if defined(__UNIX__) && (!defined( __OS2__ ) && !defined(__VMS))
-    lstat( m_filePath.fn_str(), &buff );
-    m_type |= S_ISLNK( buff.st_mode ) != 0 ? is_link : 0;
-#else // no lstat()
-    // only translate to file charset if we don't go by our
-    // wxStat implementation
-#ifndef wxNEED_WX_UNISTD_H
-    wxStat( m_filePath.fn_str() , &buff );
-#else
-    wxStat( m_filePath, &buff );
-#endif
-#endif
-
-    m_type |= (buff.st_mode & S_IFDIR) != 0 ? is_dir : 0;
-    m_type |= (buff.st_mode & wxS_IXUSR) != 0 ? is_exe : 0;
-
-    m_size = buff.st_size;
-
-    m_dateTime = buff.st_mtime;
-#endif
-    // __WXWINCE__
-
-#if defined(__UNIX__)
-    m_permissions.Printf(_T("%c%c%c%c%c%c%c%c%c"),
-                         buff.st_mode & wxS_IRUSR ? _T('r') : _T('-'),
-                         buff.st_mode & wxS_IWUSR ? _T('w') : _T('-'),
-                         buff.st_mode & wxS_IXUSR ? _T('x') : _T('-'),
-                         buff.st_mode & wxS_IRGRP ? _T('r') : _T('-'),
-                         buff.st_mode & wxS_IWGRP ? _T('w') : _T('-'),
-                         buff.st_mode & wxS_IXGRP ? _T('x') : _T('-'),
-                         buff.st_mode & wxS_IROTH ? _T('r') : _T('-'),
-                         buff.st_mode & wxS_IWOTH ? _T('w') : _T('-'),
-                         buff.st_mode & wxS_IXOTH ? _T('x') : _T('-'));
-#elif defined(__WIN32__)
-    DWORD attribs = ::GetFileAttributes(m_filePath.c_str());
-    if (attribs != (DWORD)-1)
-    {
-        m_permissions.Printf(_T("%c%c%c%c"),
-                             attribs & FILE_ATTRIBUTE_ARCHIVE  ? _T('A') : _T(' '),
-                             attribs & FILE_ATTRIBUTE_READONLY ? _T('R') : _T(' '),
-                             attribs & FILE_ATTRIBUTE_HIDDEN   ? _T('H') : _T(' '),
-                             attribs & FILE_ATTRIBUTE_SYSTEM   ? _T('S') : _T(' '));
-    }
-#endif
-
-    // try to get a better icon
-    if (m_image == wxFileIconsTable::file)
-    {
-        if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
-        {
-            m_image = wxTheFileIconsTable->GetIconID( m_fileName.AfterLast(wxT('.')));
-        } else if (IsExe())
-        {
-            m_image = wxFileIconsTable::executable;
-        }
-    }
-}
-
-wxString wxFileData::GetFileType() const
-{
-    if (IsDir())
-        return _("<DIR>");
-    else if (IsLink())
-        return _("<LINK>");
-    else if (IsDrive())
-        return _("<DRIVE>");
-    else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
-        return m_fileName.AfterLast(wxT('.'));
-
-    return wxEmptyString;
-}
-
-wxString wxFileData::GetModificationTime() const
-{
-    // want time as 01:02 so they line up nicely, no %r in WIN32
-    return m_dateTime.FormatDate() + wxT(" ") + m_dateTime.Format(wxT("%I:%M:%S %p"));
-}
-
-wxString wxFileData::GetHint() const
-{
-    wxString s = m_filePath;
-    s += wxT("  ");
-
-    if (IsDir())
-        s += _("<DIR>");
-    else if (IsLink())
-        s += _("<LINK>");
-    else if (IsDrive())
-        s += _("<DRIVE>");
-    else // plain file
-        s += wxString::Format(wxPLURAL("%ld byte", "%ld bytes", m_size),
-                              wxLongLong(m_size).ToString().c_str());
-
-    s += wxT(' ');
-
-    if ( !IsDrive() )
-    {
-        s << GetModificationTime()
-          << wxT("  ")
-          << m_permissions;
-    }
-
-    return s;
-}
-
-wxString wxFileData::GetEntry( fileListFieldType num ) const
-{
-    wxString s;
-    switch ( num )
-    {
-        case FileList_Name:
-            s = m_fileName;
-            break;
-
-        case FileList_Size:
-            if (!IsDir() && !IsLink() && !IsDrive())
-                s = wxLongLong(m_size).ToString();
-            break;
-
-        case FileList_Type:
-            s = GetFileType();
-            break;
-
-        case FileList_Time:
-            if (!IsDrive())
-                s = GetModificationTime();
-            break;
-
-#if defined(__UNIX__) || defined(__WIN32__)
-        case FileList_Perm:
-            s = m_permissions;
-            break;
-#endif // defined(__UNIX__) || defined(__WIN32__)
-
-        default:
-            wxFAIL_MSG( _T("unexpected field in wxFileData::GetEntry()") );
-    }
-
-    return s;
-}
-
-void wxFileData::SetNewName( const wxString &filePath, const wxString &fileName )
-{
-    m_fileName = fileName;
-    m_filePath = filePath;
-}
-
-void wxFileData::MakeItem( wxListItem &item )
-{
-    item.m_text = m_fileName;
-    item.ClearAttributes();
-    if (IsExe())
-        item.SetTextColour(*wxRED);
-    if (IsDir())
-        item.SetTextColour(*wxBLUE);
-
-    item.m_image = m_image;
-
-    if (IsLink())
-    {
-        wxColour dg = wxTheColourDatabase->Find( _T("MEDIUM GREY") );
-        if ( dg.Ok() )
-            item.SetTextColour(dg);
-    }
-    item.m_data = wxPtrToUInt(this);
-}
-
-//-----------------------------------------------------------------------------
-//  wxFileCtrl
-//-----------------------------------------------------------------------------
-
-static bool ignoreChanges = false;
-
-IMPLEMENT_DYNAMIC_CLASS(wxFileCtrl,wxListCtrl)
-
-BEGIN_EVENT_TABLE(wxFileCtrl,wxListCtrl)
-    EVT_LIST_DELETE_ITEM(wxID_ANY, wxFileCtrl::OnListDeleteItem)
-    EVT_LIST_DELETE_ALL_ITEMS(wxID_ANY, wxFileCtrl::OnListDeleteAllItems)
-    EVT_LIST_END_LABEL_EDIT(wxID_ANY, wxFileCtrl::OnListEndLabelEdit)
-    EVT_LIST_COL_CLICK(wxID_ANY, wxFileCtrl::OnListColClick)
-END_EVENT_TABLE()
-
-
-wxFileCtrl::wxFileCtrl()
-{
-    m_showHidden = false;
-    m_sort_foward = 1;
-    m_sort_field = wxFileData::FileList_Name;
-}
-
-wxFileCtrl::wxFileCtrl(wxWindow *win,
-                       wxWindowID id,
-                       const wxString& wild,
-                       bool showHidden,
-                       const wxPoint& pos,
-                       const wxSize& size,
-                       long style,
-                       const wxValidator &validator,
-                       const wxString &name)
-          : wxListCtrl(win, id, pos, size, style, validator, name),
-            m_wild(wild)
-{
-    wxImageList *imageList = wxTheFileIconsTable->GetSmallImageList();
-
-    SetImageList( imageList, wxIMAGE_LIST_SMALL );
-
-    m_showHidden = showHidden;
-
-    m_sort_foward = 1;
-    m_sort_field = wxFileData::FileList_Name;
-
-    m_dirName = wxT("*");
-
-    if (style & wxLC_REPORT)
-        ChangeToReportMode();
-}
-
-void wxFileCtrl::ChangeToListMode()
-{
-    ClearAll();
-    SetSingleStyle( wxLC_LIST );
-    UpdateFiles();
-}
-
-void wxFileCtrl::ChangeToReportMode()
-{
-    ClearAll();
-    SetSingleStyle( wxLC_REPORT );
-
-    // do this since WIN32 does mm/dd/yy UNIX does mm/dd/yyyy
-    // don't hardcode since mm/dd is dd/mm elsewhere
-    int w, h;
-    wxDateTime dt(22, wxDateTime::Dec, 2002, 22, 22, 22);
-    wxString txt = dt.FormatDate() + wxT("22") + dt.Format(wxT("%I:%M:%S %p"));
-    GetTextExtent(txt, &w, &h);
-
-    InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, w );
-    InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, w/2 );
-    InsertColumn( 2, _("Type"), wxLIST_FORMAT_LEFT, w/2 );
-    InsertColumn( 3, _("Modified"), wxLIST_FORMAT_LEFT, w );
-#if defined(__UNIX__)
-    GetTextExtent(wxT("Permissions 2"), &w, &h);
-    InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, w );
-#elif defined(__WIN32__)
-    GetTextExtent(wxT("Attributes 2"), &w, &h);
-    InsertColumn( 4, _("Attributes"), wxLIST_FORMAT_LEFT, w );
-#endif
-
-    UpdateFiles();
-}
-
-void wxFileCtrl::ChangeToSmallIconMode()
-{
-    ClearAll();
-    SetSingleStyle( wxLC_SMALL_ICON );
-    UpdateFiles();
-}
-
-void wxFileCtrl::ShowHidden( bool show )
-{
-    m_showHidden = show;
-    UpdateFiles();
-}
-
-long wxFileCtrl::Add( wxFileData *fd, wxListItem &item )
-{
-    long ret = -1;
-    item.m_mask = wxLIST_MASK_TEXT + wxLIST_MASK_DATA + wxLIST_MASK_IMAGE;
-    fd->MakeItem( item );
-    long my_style = GetWindowStyleFlag();
-    if (my_style & wxLC_REPORT)
-    {
-        ret = InsertItem( item );
-        for (int i = 1; i < wxFileData::FileList_Max; i++)
-            SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) );
-    }
-    else if ((my_style & wxLC_LIST) || (my_style & wxLC_SMALL_ICON))
-    {
-        ret = InsertItem( item );
-    }
-    return ret;
-}
-
-void wxFileCtrl::UpdateItem(const wxListItem &item)
-{
-    wxFileData *fd = (wxFileData*)GetItemData(item);
-    wxCHECK_RET(fd, wxT("invalid filedata"));
-
-    fd->ReadData();
-
-    SetItemText(item, fd->GetFileName());
-    SetItemImage(item, fd->GetImageId());
-
-    if (GetWindowStyleFlag() & wxLC_REPORT)
-    {
-        for (int i = 1; i < wxFileData::FileList_Max; i++)
-            SetItem( item.m_itemId, i, fd->GetEntry((wxFileData::fileListFieldType)i) );
-    }
-}
-
-void wxFileCtrl::UpdateFiles()
-{
-    // don't do anything before ShowModal() call which sets m_dirName
-    if ( m_dirName == wxT("*") )
-        return;
-
-    wxBusyCursor bcur; // this may take a while...
-
-    DeleteAllItems();
-
-    wxListItem item;
-    item.m_itemId = 0;
-    item.m_col = 0;
-
-#if (defined(__WINDOWS__) || defined(__DOS__) || defined(__WXMAC__) || defined(__OS2__)) && !defined(__WXWINCE__)
-    if ( IsTopMostDir(m_dirName) )
-    {
-        wxArrayString names, paths;
-        wxArrayInt icons;
-        size_t n, count = wxGetAvailableDrives(paths, names, icons);
-
-        for (n=0; n<count; n++)
-        {
-            wxFileData *fd = new wxFileData(paths[n], names[n], wxFileData::is_drive, icons[n]);
-            if (Add(fd, item) != -1)
-                item.m_itemId++;
-            else
-                delete fd;
-        }
-    }
-    else
-#endif // defined(__DOS__) || defined(__WINDOWS__)
-    {
-        // Real directory...
-        if ( !IsTopMostDir(m_dirName) && !m_dirName.empty() )
-        {
-            wxString p(wxPathOnly(m_dirName));
-#if (defined(__UNIX__) || defined(__WXWINCE__)) && !defined(__OS2__)
-            if (p.empty()) p = wxT("/");
-#endif // __UNIX__
-            wxFileData *fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder);
-            if (Add(fd, item) != -1)
-                item.m_itemId++;
-            else
-                delete fd;
-        }
-
-        wxString dirname(m_dirName);
-#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
-        if (dirname.length() == 2 && dirname[1u] == wxT(':'))
-            dirname << wxT('\\');
-#endif // defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
-
-        if (dirname.empty())
-            dirname = wxFILE_SEP_PATH;
-
-        wxLogNull logNull;
-        wxDir dir(dirname);
-
-        if ( dir.IsOpened() )
-        {
-            wxString dirPrefix(dirname);
-            if (dirPrefix.Last() != wxFILE_SEP_PATH)
-                dirPrefix += wxFILE_SEP_PATH;
-
-            int hiddenFlag = m_showHidden ? wxDIR_HIDDEN : 0;
-
-            bool cont;
-            wxString f;
-
-            // Get the directories first (not matched against wildcards):
-            cont = dir.GetFirst(&f, wxEmptyString, wxDIR_DIRS | hiddenFlag);
-            while (cont)
-            {
-                wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_dir, wxFileIconsTable::folder);
-                if (Add(fd, item) != -1)
-                    item.m_itemId++;
-                else
-                    delete fd;
-
-                cont = dir.GetNext(&f);
-            }
-
-            // Tokenize the wildcard string, so we can handle more than 1
-            // search pattern in a wildcard.
-            wxStringTokenizer tokenWild(m_wild, wxT(";"));
-            while ( tokenWild.HasMoreTokens() )
-            {
-                cont = dir.GetFirst(&f, tokenWild.GetNextToken(),
-                                        wxDIR_FILES | hiddenFlag);
-                while (cont)
-                {
-                    wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_file, wxFileIconsTable::file);
-                    if (Add(fd, item) != -1)
-                        item.m_itemId++;
-                    else
-                        delete fd;
-
-                    cont = dir.GetNext(&f);
-                }
-            }
-        }
-    }
-
-    SortItems(m_sort_field, m_sort_foward);
-}
-
-void wxFileCtrl::SetWild( const wxString &wild )
-{
-    if (wild.Find(wxT('|')) != wxNOT_FOUND)
-        return;
-
-    m_wild = wild;
-    UpdateFiles();
-}
-
-void wxFileCtrl::MakeDir()
-{
-    wxString new_name( _("NewName") );
-    wxString path( m_dirName );
-    path += wxFILE_SEP_PATH;
-    path += new_name;
-    if (wxFileExists(path))
-    {
-        // try NewName0, NewName1 etc.
-        int i = 0;
-        do {
-            new_name = _("NewName");
-            wxString num;
-            num.Printf( wxT("%d"), i );
-            new_name += num;
-
-            path = m_dirName;
-            path += wxFILE_SEP_PATH;
-            path += new_name;
-            i++;
-        } while (wxFileExists(path));
-    }
-
-    wxLogNull log;
-    if (!wxMkdir(path))
-    {
-        wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
-        dialog.ShowModal();
-        return;
-    }
-
-    wxFileData *fd = new wxFileData( path, new_name, wxFileData::is_dir, wxFileIconsTable::folder );
-    wxListItem item;
-    item.m_itemId = 0;
-    item.m_col = 0;
-    long id = Add( fd, item );
-
-    if (id != -1)
-    {
-        SortItems(m_sort_field, m_sort_foward);
-        id = FindItem( 0, wxPtrToUInt(fd) );
-        EnsureVisible( id );
-        EditLabel( id );
-    }
-    else
-        delete fd;
-}
-
-void wxFileCtrl::GoToParentDir()
-{
-    if (!IsTopMostDir(m_dirName))
-    {
-        size_t len = m_dirName.length();
-        if (wxEndsWithPathSeparator(m_dirName))
-            m_dirName.Remove( len-1, 1 );
-        wxString fname( wxFileNameFromPath(m_dirName) );
-        m_dirName = wxPathOnly( m_dirName );
-#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
-        if (!m_dirName.empty())
-        {
-            if (m_dirName.Last() == wxT('.'))
-                m_dirName = wxEmptyString;
-        }
-#elif defined(__UNIX__)
-        if (m_dirName.empty())
-            m_dirName = wxT("/");
-#endif
-        UpdateFiles();
-        long id = FindItem( 0, fname );
-        if (id != wxNOT_FOUND)
-        {
-            ignoreChanges = true;
-            SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
-            EnsureVisible( id );
-            ignoreChanges = false;
-        }
-    }
-}
-
-void wxFileCtrl::GoToHomeDir()
-{
-    wxString s = wxGetUserHome( wxString() );
-    GoToDir(s);
-}
-
-void wxFileCtrl::GoToDir( const wxString &dir )
-{
-    if (!wxDirExists(dir)) return;
-
-    m_dirName = dir;
-    UpdateFiles();
-
-    ignoreChanges = true;
-    SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
-    ignoreChanges = false;
-
-    EnsureVisible( 0 );
-}
-
-void wxFileCtrl::FreeItemData(wxListItem& item)
-{
-    if ( item.m_data )
-    {
-        wxFileData *fd = (wxFileData*)item.m_data;
-        delete fd;
-
-        item.m_data = 0;
-    }
-}
-
-void wxFileCtrl::OnListDeleteItem( wxListEvent &event )
-{
-    FreeItemData(event.m_item);
-}
-
-void wxFileCtrl::OnListDeleteAllItems( wxListEvent & WXUNUSED(event) )
-{
-    FreeAllItemsData();
-}
-
-void wxFileCtrl::FreeAllItemsData()
-{
-    wxListItem item;
-    item.m_mask = wxLIST_MASK_DATA;
-
-    item.m_itemId = GetNextItem( -1, wxLIST_NEXT_ALL );
-    while ( item.m_itemId != -1 )
-    {
-        GetItem( item );
-        FreeItemData(item);
-        item.m_itemId = GetNextItem( item.m_itemId, wxLIST_NEXT_ALL );
-    }
-}
-
-void wxFileCtrl::OnListEndLabelEdit( wxListEvent &event )
-{
-    wxFileData *fd = (wxFileData*)event.m_item.m_data;
-    wxASSERT( fd );
-
-    if ((event.GetLabel().empty()) ||
-        (event.GetLabel() == wxT(".")) ||
-        (event.GetLabel() == wxT("..")) ||
-        (event.GetLabel().First( wxFILE_SEP_PATH ) != wxNOT_FOUND))
-    {
-        wxMessageDialog dialog(this, _("Illegal directory name."), _("Error"), wxOK | wxICON_ERROR );
-        dialog.ShowModal();
-        event.Veto();
-        return;
-    }
-
-    wxString new_name( wxPathOnly( fd->GetFilePath() ) );
-    new_name += wxFILE_SEP_PATH;
-    new_name += event.GetLabel();
-
-    wxLogNull log;
-
-    if (wxFileExists(new_name))
-    {
-        wxMessageDialog dialog(this, _("File name exists already."), _("Error"), wxOK | wxICON_ERROR );
-        dialog.ShowModal();
-        event.Veto();
-    }
-
-    if (wxRenameFile(fd->GetFilePath(),new_name))
-    {
-        fd->SetNewName( new_name, event.GetLabel() );
-
-        ignoreChanges = true;
-        SetItemState( event.GetItem(), wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
-        ignoreChanges = false;
-
-        UpdateItem( event.GetItem() );
-        EnsureVisible( event.GetItem() );
-    }
-    else
-    {
-        wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR );
-        dialog.ShowModal();
-        event.Veto();
-    }
-}
-
-void wxFileCtrl::OnListColClick( wxListEvent &event )
-{
-    int col = event.GetColumn();
-
-    switch (col)
-    {
-        case wxFileData::FileList_Name :
-        case wxFileData::FileList_Size :
-        case wxFileData::FileList_Type :
-        case wxFileData::FileList_Time : break;
-        default : return;
-    }
-
-    if ((wxFileData::fileListFieldType)col == m_sort_field)
-        m_sort_foward = !m_sort_foward;
-    else
-        m_sort_field = (wxFileData::fileListFieldType)col;
-
-    SortItems(m_sort_field, m_sort_foward);
-}
-
-void wxFileCtrl::SortItems(wxFileData::fileListFieldType field, bool forward)
-{
-    m_sort_field = field;
-    m_sort_foward = forward;
-    const long sort_dir = forward ? 1 : -1;
-
-    switch (m_sort_field)
-    {
-        case wxFileData::FileList_Size :
-            wxListCtrl::SortItems(wxFileDataSizeCompare, sort_dir);
-            break;
-
-        case wxFileData::FileList_Type :
-            wxListCtrl::SortItems(wxFileDataTypeCompare, sort_dir);
-            break;
-
-        case wxFileData::FileList_Time :
-            wxListCtrl::SortItems(wxFileDataTimeCompare, sort_dir);
-            break;
-
-        case wxFileData::FileList_Name :
-        default :
-            wxListCtrl::SortItems(wxFileDataNameCompare, sort_dir);
-            break;
-    }
-}
-
-wxFileCtrl::~wxFileCtrl()
-{
-    // Normally the data are freed via an EVT_LIST_DELETE_ALL_ITEMS event and
-    // wxFileCtrl::OnListDeleteAllItems. But if the event is generated after
-    // the destruction of the wxFileCtrl we need to free any data here:
-    FreeAllItemsData();
-}
-
 //-----------------------------------------------------------------------------
 // wxGenericFileDialog
 //-----------------------------------------------------------------------------
 
 #define  ID_LIST_MODE     (wxID_FILEDLGG    )
 #define  ID_REPORT_MODE   (wxID_FILEDLGG + 1)
-#define  ID_UP_DIR        (wxID_FILEDLGG + 5)
-#define  ID_PARENT_DIR    (wxID_FILEDLGG + 6)
-#define  ID_NEW_DIR       (wxID_FILEDLGG + 7)
-#define  ID_CHOICE        (wxID_FILEDLGG + 8)
-#define  ID_TEXT          (wxID_FILEDLGG + 9)
-#define  ID_LIST_CTRL     (wxID_FILEDLGG + 10)
-#define  ID_CHECK         (wxID_FILEDLGG + 12)
+#define  ID_UP_DIR        (wxID_FILEDLGG + 2)
+#define  ID_PARENT_DIR    (wxID_FILEDLGG + 3)
+#define  ID_NEW_DIR       (wxID_FILEDLGG + 4)
+#define  ID_FILE_CTRL     (wxID_FILEDLGG + 5)
 
 IMPLEMENT_DYNAMIC_CLASS(wxGenericFileDialog, wxFileDialogBase)
 
 BEGIN_EVENT_TABLE(wxGenericFileDialog,wxDialog)
-        EVT_BUTTON(ID_LIST_MODE, wxGenericFileDialog::OnList)
-        EVT_BUTTON(ID_REPORT_MODE, wxGenericFileDialog::OnReport)
-        EVT_BUTTON(ID_UP_DIR, wxGenericFileDialog::OnUp)
-        EVT_BUTTON(ID_PARENT_DIR, wxGenericFileDialog::OnHome)
-        EVT_BUTTON(ID_NEW_DIR, wxGenericFileDialog::OnNew)
-        EVT_BUTTON(wxID_OK, wxGenericFileDialog::OnListOk)
-        EVT_LIST_ITEM_SELECTED(ID_LIST_CTRL, wxGenericFileDialog::OnSelected)
-        EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxGenericFileDialog::OnActivated)
-        EVT_CHOICE(ID_CHOICE,wxGenericFileDialog::OnChoiceFilter)
-        EVT_TEXT_ENTER(ID_TEXT,wxGenericFileDialog::OnTextEnter)
-        EVT_TEXT(ID_TEXT,wxGenericFileDialog::OnTextChange)
-        EVT_CHECKBOX(ID_CHECK,wxGenericFileDialog::OnCheck)
+    EVT_BUTTON(ID_LIST_MODE, wxGenericFileDialog::OnList)
+    EVT_BUTTON(ID_REPORT_MODE, wxGenericFileDialog::OnReport)
+    EVT_BUTTON(ID_UP_DIR, wxGenericFileDialog::OnUp)
+    EVT_BUTTON(ID_PARENT_DIR, wxGenericFileDialog::OnHome)
+    EVT_BUTTON(ID_NEW_DIR, wxGenericFileDialog::OnNew)
+    EVT_BUTTON(wxID_OK, wxGenericFileDialog::OnOk)
+    EVT_FILECTRL_FILEACTIVATED(ID_FILE_CTRL, wxGenericFileDialog::OnFileActivated)
 END_EVENT_TABLE()
 
 long wxGenericFileDialog::ms_lastViewStyle = wxLC_LIST;
@@ -959,11 +121,7 @@ void wxGenericFileDialog::Init()
 {
     m_bypassGenericImpl = false;
 
-    m_choice = NULL;
-    m_text   = NULL;
-    m_list   = NULL;
-    m_check  = NULL;
-    m_static = NULL;
+    m_filectrl   = NULL;
     m_upDirButton  = NULL;
     m_newDirButton = NULL;
 }
@@ -1014,8 +172,6 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
         return false;
     }
 
-    ignoreChanges = true;
-
 #if wxUSE_CONFIG
     if (wxConfig::Get(false))
     {
@@ -1033,7 +189,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
             m_dir = wxFILE_SEP_PATH;
     }
 
-    size_t len = m_dir.length();
+    const size_t len = m_dir.length();
     if ((len > 1) && (wxEndsWithPathSeparator(m_dir)))
         m_dir.Remove( len-1, 1 );
 
@@ -1044,7 +200,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
 
     // layout
 
-    bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
+    const bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
 
     wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
 
@@ -1098,44 +254,32 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
     else
         mainsizer->Add( buttonsizer, 0, wxALL | wxEXPAND, 5 );
 
-    wxBoxSizer *staticsizer = new wxBoxSizer( wxHORIZONTAL );
-    if (is_pda)
-        staticsizer->Add( new wxStaticText( this, wxID_ANY, _("Current directory:") ), 0, wxRIGHT, 10 );
-    m_static = new wxStaticText( this, wxID_ANY, m_dir );
-    staticsizer->Add( m_static, 1 );
-    mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 );
+    long style2 = 0;
+    if ( HasFdFlag(wxFD_MULTIPLE) )
+        style2 |= wxFC_MULTIPLE;
 
-    long style2 = ms_lastViewStyle;
-    if ( !HasFdFlag(wxFD_MULTIPLE) )
-        style2 |= wxLC_SINGLE_SEL;
+    m_filectrl = new wxGenericFileCtrl( this, ID_FILE_CTRL,
+                                        m_dir, defaultFile,
+                                        wildCard,
+                                        style2,
+                                        wxDefaultPosition, wxSize(540,200)
+                                        );
 
-#ifdef __WXWINCE__
-    style2 |= wxSIMPLE_BORDER;
-#else
-    style2 |= wxSUNKEN_BORDER;
-#endif
+    m_filectrl->ShowHidden( ms_lastShowHidden );
 
-    m_list = new wxFileCtrl( this, ID_LIST_CTRL,
-                             wxEmptyString, ms_lastShowHidden,
-                             wxDefaultPosition, wxSize(540,200),
-                             style2);
-
-    m_text = new wxTextCtrl(this, ID_TEXT, m_fileName,
-                            wxDefaultPosition, wxDefaultSize,
-                            wxTE_PROCESS_ENTER);
-    m_choice = new wxChoice(this, ID_CHOICE);
+    if (ms_lastViewStyle == wxLC_LIST)
+    {
+        m_filectrl->ChangeToListMode();
+    }
+    else if (ms_lastViewStyle == wxLC_REPORT)
+    {
+        m_filectrl->ChangeToReportMode();
+    }
 
     if (is_pda)
     {
         // PDAs have a different screen layout
-        mainsizer->Add(m_list, wxSizerFlags(1).Expand().HorzBorder());
-
-        wxBoxSizer *textsizer = new wxBoxSizer(wxHORIZONTAL);
-        textsizer->Add(m_text, wxSizerFlags(1).Centre().Border());
-        mainsizer->Add(textsizer, wxSizerFlags().Expand());
-
-        m_check = NULL;
-        textsizer->Add(m_choice, wxSizerFlags(1).Centre().Border());
+        mainsizer->Add(m_filectrl, wxSizerFlags(1).Expand().HorzBorder());
 
         wxSizer *bsizer = CreateButtonSizer(wxOK | wxCANCEL);
         if ( bsizer )
@@ -1143,30 +287,13 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
     }
     else // !is_pda
     {
-        mainsizer->Add(m_list, wxSizerFlags(1).Expand().DoubleHorzBorder());
-
-        wxBoxSizer *textsizer = new wxBoxSizer(wxHORIZONTAL);
-        textsizer->Add(m_text, wxSizerFlags(1).Centre().
-                                        DoubleBorder(wxLEFT | wxRIGHT | wxTOP));
-        textsizer->Add(new wxButton(this, wxID_OK), wxSizerFlags().Centre().
-                                        DoubleBorder(wxLEFT | wxRIGHT | wxTOP));
-        mainsizer->Add(textsizer, wxSizerFlags().Expand());
-
-        wxSizerFlags flagsCentre;
-        flagsCentre.Centre().DoubleBorder();
+        mainsizer->Add(m_filectrl, wxSizerFlags(1).Expand().DoubleHorzBorder());
 
-        wxBoxSizer *choicesizer = new wxBoxSizer(wxHORIZONTAL);
-        choicesizer->Add(m_choice, wxSizerFlags(flagsCentre).Proportion(1));
-
-        m_check = new wxCheckBox(this, ID_CHECK, _("Show &hidden files"));
-        m_check->SetValue(ms_lastShowHidden);
-
-        choicesizer->Add(m_check, flagsCentre);
-        choicesizer->Add(new wxButton(this, wxID_CANCEL), flagsCentre);
-        mainsizer->Add(choicesizer, wxSizerFlags().Expand());
-    }
-
-    SetWildcard(wildCard);
+        wxBoxSizer *okcancelsizer = new wxBoxSizer( wxHORIZONTAL );
+        okcancelsizer->Add(new wxButton(this, wxID_OK), wxSizerFlags().DoubleBorder().Centre());
+        okcancelsizer->Add(new wxButton(this, wxID_CANCEL), wxSizerFlags().DoubleBorder().Centre());
+        mainsizer->Add(okcancelsizer, wxSizerFlags().Center());
+        }
 
     SetAutoLayout( true );
     SetSizer( mainsizer );
@@ -1179,17 +306,11 @@ bool wxGenericFileDialog::Create( wxWindow *parent,
         Centre( wxBOTH );
     }
 
-    m_text->SetFocus();
-
-    ignoreChanges = false;
-
     return true;
 }
 
 wxGenericFileDialog::~wxGenericFileDialog()
 {
-    ignoreChanges = true;
-
     if (!m_bypassGenericImpl)
     {
 #if wxUSE_CONFIG
@@ -1201,24 +322,13 @@ wxGenericFileDialog::~wxGenericFileDialog()
                                    ms_lastShowHidden);
         }
 #endif
-
-        const int count = m_choice->GetCount();
-        for ( int i = 0; i < count; i++ )
-        {
-            delete (wxString *)m_choice->GetClientData(i);
-        }
     }
 }
 
 int wxGenericFileDialog::ShowModal()
 {
-    ignoreChanges = true;
-
-    m_list->GoToDir(m_dir);
+    m_filectrl->SetDirectory(m_dir);
     UpdateControls();
-    m_text->SetValue(m_fileName);
-
-    ignoreChanges = false;
 
     return wxDialog::ShowModal();
 }
@@ -1229,323 +339,77 @@ bool wxGenericFileDialog::Show( bool show )
 #ifndef __WIN32__
     if (show)
     {
-        m_list->GoToDir(m_dir);
+        m_filectrl->SetDirectory(m_dir);
         UpdateControls();
-        m_text->SetValue(m_fileName);
     }
 #endif
 
     return wxDialog::Show( show );
 }
 
-void wxGenericFileDialog::DoSetFilterIndex(int filterindex)
-{
-    wxString *str = (wxString*) m_choice->GetClientData( filterindex );
-    m_list->SetWild( *str );
-    m_filterIndex = filterindex;
-    if ( str->Left(2) == wxT("*.") )
-    {
-        m_filterExtension = str->Mid(1);
-        if (m_filterExtension == _T(".*"))
-            m_filterExtension.clear();
-    }
-    else
-    {
-        m_filterExtension.clear();
-    }
-}
-
 void wxGenericFileDialog::SetWildcard(const wxString& wildCard)
 {
-    wxFileDialogBase::SetWildcard(wildCard);
-
-    wxArrayString wildDescriptions, wildFilters;
-    const size_t count = wxParseCommonDialogsFilter(m_wildCard,
-                                                    wildDescriptions,
-                                                    wildFilters);
-    wxCHECK_RET( count, wxT("wxFileDialog: bad wildcard string") );
-
-    const size_t countOld = m_choice->GetCount();
-    size_t n;
-    for ( n = 0; n < countOld; n++ )
-    {
-        delete (wxString *)m_choice->GetClientData(n);
-    }
-
-    for ( n = 0; n < count; n++ )
-    {
-        m_choice->Append( wildDescriptions[n], new wxString( wildFilters[n] ) );
-    }
-
-    SetFilterIndex( 0 );
+    m_filectrl->SetWildcard(wildCard);
 }
 
 void wxGenericFileDialog::SetFilterIndex( int filterindex )
 {
-    m_choice->SetSelection( filterindex );
-
-    DoSetFilterIndex(filterindex);
-}
-
-void wxGenericFileDialog::OnChoiceFilter( wxCommandEvent &event )
-{
-    DoSetFilterIndex((int)event.GetInt());
-}
-
-void wxGenericFileDialog::OnCheck( wxCommandEvent &event )
-{
-    m_list->ShowHidden( (ms_lastShowHidden = event.GetInt() != 0) );
-}
-
-void wxGenericFileDialog::OnActivated( wxListEvent &event )
-{
-    HandleAction( event.m_item.m_text );
-}
-
-void wxGenericFileDialog::OnTextEnter( wxCommandEvent &WXUNUSED(event) )
-{
-    HandleAction( m_text->GetValue() );
+    m_filectrl->SetFilterIndex(filterindex);
 }
 
-void wxGenericFileDialog::OnTextChange( wxCommandEvent &WXUNUSED(event) )
+void wxGenericFileDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
 {
-    if (!ignoreChanges)
-    {
-        // Clear selections.  Otherwise when the user types in a value they may
-        // not get the file whose name they typed.
-        if (m_list->GetSelectedItemCount() > 0)
-        {
-            long item = m_list->GetNextItem(-1, wxLIST_NEXT_ALL,
-                wxLIST_STATE_SELECTED);
-            while ( item != -1 )
-            {
-                m_list->SetItemState(item,0, wxLIST_STATE_SELECTED);
-                item = m_list->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
-            }
-        }
-    }
-}
-
-void wxGenericFileDialog::OnSelected( wxListEvent &event )
-{
-    static bool inSelected = false;
-
-    if (inSelected)
-        return;
-
-    inSelected = true;
-    wxString filename( event.m_item.m_text );
-
-#ifdef __WXWINCE__
-    // No double-click on most WinCE devices, so do action immediately.
-    HandleAction( filename );
-#else
-    if (filename == wxT(".."))
-    {
-        inSelected = false;
-        return;
-    }
-
-    wxString dir = m_list->GetDir();
-    if (!IsTopMostDir(dir))
-        dir += wxFILE_SEP_PATH;
-    dir += filename;
-    if (wxDirExists(dir))
-    {
-        inSelected = false;
-        return;
-    }
-
-    ignoreChanges = true;
-    m_text->SetValue( filename );
-    ignoreChanges = false;
-#endif
-    inSelected = false;
-}
-
-void wxGenericFileDialog::HandleAction( const wxString &fn )
-{
-    if (ignoreChanges)
-        return;
-
-    wxString filename( fn );
-    if (filename.empty())
-    {
-#ifdef __WXWINCE__
-        EndModal(wxID_CANCEL);
-#endif
-        return;
-    }
-    if (filename == wxT(".")) return;
-
-    wxString dir = m_list->GetDir();
-
-    // "some/place/" means they want to chdir not try to load "place"
-    bool want_dir = filename.Last() == wxFILE_SEP_PATH;
-    if (want_dir)
-        filename = filename.RemoveLast();
-
-    if (filename == wxT(".."))
-    {
-        ignoreChanges = true;
-        m_list->GoToParentDir();
-        m_list->SetFocus();
-        UpdateControls();
-        ignoreChanges = false;
-        return;
-    }
+    wxArrayString selectedFiles;
+    m_filectrl->GetFilenames(selectedFiles);
 
-#ifdef __UNIX__
-    if (filename == wxT("~"))
-    {
-        ignoreChanges = true;
-        m_list->GoToHomeDir();
-        m_list->SetFocus();
-        UpdateControls();
-        ignoreChanges = false;
+    if (selectedFiles.Count() == 0)
         return;
-    }
 
-    if (filename.BeforeFirst(wxT('/')) == wxT("~"))
+    if (selectedFiles.Count() == 1)
     {
-        filename = wxString(wxGetUserHome()) + filename.Remove(0, 1);
-    }
-#endif // __UNIX__
-
-    if (!HasFdFlag(wxFD_SAVE))
-    {
-        if ((filename.Find(wxT('*')) != wxNOT_FOUND) ||
-            (filename.Find(wxT('?')) != wxNOT_FOUND))
-        {
-            if (filename.Find(wxFILE_SEP_PATH) != wxNOT_FOUND)
-            {
-                wxMessageBox(_("Illegal file specification."), _("Error"), wxOK | wxICON_ERROR );
-                return;
-            }
-            m_list->SetWild( filename );
-            return;
-        }
-    }
-
-    if (!IsTopMostDir(dir))
-        dir += wxFILE_SEP_PATH;
-    if (!wxIsAbsolutePath(filename))
-    {
-        dir += filename;
-        filename = dir;
-    }
-
-    if (wxDirExists(filename))
-    {
-        ignoreChanges = true;
-        m_list->GoToDir( filename );
-        UpdateControls();
-        ignoreChanges = false;
-        return;
-    }
-
-    // they really wanted a dir, but it doesn't exist
-    if (want_dir)
-    {
-        wxMessageBox(_("Directory doesn't exist."), _("Error"),
-                     wxOK | wxICON_ERROR );
-        return;
-    }
-
-    // append the default extension to the filename if it doesn't have any
-    //
-    // 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
-    //     file without extension as well?
-    if ( !HasFdFlag(wxFD_OPEN) || !wxFileExists(filename) )
-    {
-        filename = AppendExtension(filename, m_filterExtension);
-    }
-
-    // check that the file [doesn't] exist if necessary
-    if ( HasFdFlag(wxFD_SAVE) && HasFdFlag(wxFD_OVERWRITE_PROMPT) &&
-                wxFileExists( filename ) )
-    {
-        wxString msg;
-        msg.Printf( _("File '%s' already exists, do you really want to overwrite it?"), filename.c_str() );
-
-        if (wxMessageBox(msg, _("Confirm"), wxYES_NO) != wxYES)
-            return;
-    }
-    else if ( HasFdFlag(wxFD_OPEN) && HasFdFlag(wxFD_FILE_MUST_EXIST) &&
-                    !wxFileExists(filename) )
-    {
-        wxMessageBox(_("Please choose an existing file."), _("Error"),
-                     wxOK | wxICON_ERROR );
-                     
-        return;
-    }
-
-    SetPath( filename );
-
-    // change to the directory where the user went if asked
-    if ( HasFdFlag(wxFD_CHANGE_DIR) )
-    {
-        wxString cwd;
-        wxSplitPath(filename, &cwd, NULL, NULL);
-
-        if ( cwd != wxGetCwd() )
-        {
-            wxSetWorkingDirectory(cwd);
-        }
+        SetPath( selectedFiles[0] );
     }
 
     EndModal(wxID_OK);
 }
 
-void wxGenericFileDialog::OnListOk( wxCommandEvent &WXUNUSED(event) )
-{
-    HandleAction( m_text->GetValue() );
-}
-
 void wxGenericFileDialog::OnList( wxCommandEvent &WXUNUSED(event) )
 {
-    ignoreChanges = true;
-    m_list->ChangeToListMode();
+    m_filectrl->ChangeToListMode();
     ms_lastViewStyle = wxLC_LIST;
-    m_list->SetFocus();
-    ignoreChanges = false;
+    m_filectrl->GetFileList()->SetFocus();
 }
 
 void wxGenericFileDialog::OnReport( wxCommandEvent &WXUNUSED(event) )
 {
-    ignoreChanges = true;
-    m_list->ChangeToReportMode();
+    m_filectrl->ChangeToReportMode();
     ms_lastViewStyle = wxLC_REPORT;
-    m_list->SetFocus();
-    ignoreChanges = false;
+    m_filectrl->GetFileList()->SetFocus();
 }
 
 void wxGenericFileDialog::OnUp( wxCommandEvent &WXUNUSED(event) )
 {
-    ignoreChanges = true;
-    m_list->GoToParentDir();
-    m_list->SetFocus();
+    m_filectrl->GoToParentDir();
+    m_filectrl->GetFileList()->SetFocus();
     UpdateControls();
-    ignoreChanges = false;
 }
 
 void wxGenericFileDialog::OnHome( wxCommandEvent &WXUNUSED(event) )
 {
-    ignoreChanges = true;
-    m_list->GoToHomeDir();
-    m_list->SetFocus();
+    m_filectrl->GoToHomeDir();
+    m_filectrl->SetFocus();
     UpdateControls();
-    ignoreChanges = false;
 }
 
 void wxGenericFileDialog::OnNew( wxCommandEvent &WXUNUSED(event) )
 {
-    ignoreChanges = true;
-
-    m_list->MakeDir();
+    m_filectrl->GetFileList()->MakeDir();
+}
 
-    ignoreChanges = false;
+void wxGenericFileDialog::OnFileActivated( wxFileCtrlEvent &WXUNUSED(event) )
+{
+    wxCommandEvent dummy;
+    OnOk( dummy );
 }
 
 void wxGenericFileDialog::SetPath( const wxString& path )
@@ -1553,85 +417,22 @@ void wxGenericFileDialog::SetPath( const wxString& path )
     // not only set the full path but also update filename and dir
     m_path = path;
 
-#ifdef __WXWINCE__
-    if (m_path.empty())
-        m_path = wxFILE_SEP_PATH;
-#endif
-
-    if ( !path.empty() )
-    {
-        wxString ext;
-        wxSplitPath(path, &m_dir, &m_fileName, &ext);
-        if (!ext.empty())
-        {
-            m_fileName += wxT(".");
-            m_fileName += ext;
-        }
-    }
+    m_filectrl->SetPath(path);
 }
 
 void wxGenericFileDialog::GetPaths( wxArrayString& paths ) const
 {
-    paths.Empty();
-    if (m_list->GetSelectedItemCount() == 0)
-    {
-        paths.Add( GetPath() );
-        return;
-    }
-
-    paths.Alloc( m_list->GetSelectedItemCount() );
-
-    wxString dir = m_list->GetDir();
-#ifdef __UNIX__
-    if (dir != wxT("/"))
-#endif
-#ifdef __WXWINCE__
-    if (dir != wxT("/") && dir != wxT("\\"))
-#endif
-        dir += wxFILE_SEP_PATH;
-
-    wxListItem item;
-    item.m_mask = wxLIST_MASK_TEXT;
-
-    item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
-    while ( item.m_itemId != -1 )
-    {
-        m_list->GetItem( item );
-        paths.Add( dir + item.m_text );
-        item.m_itemId = m_list->GetNextItem( item.m_itemId,
-            wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
-    }
+    m_filectrl->GetPaths(paths);
 }
 
 void wxGenericFileDialog::GetFilenames(wxArrayString& files) const
 {
-    files.Empty();
-    if (m_list->GetSelectedItemCount() == 0)
-    {
-        files.Add( GetFilename() );
-        return;
-    }
-    files.Alloc( m_list->GetSelectedItemCount() );
-
-    wxListItem item;
-    item.m_mask = wxLIST_MASK_TEXT;
-
-    item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
-    while ( item.m_itemId != -1 )
-    {
-        m_list->GetItem( item );
-        files.Add( item.m_text );
-        item.m_itemId = m_list->GetNextItem( item.m_itemId,
-            wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
-    }
+    m_filectrl->GetFilenames(files);
 }
 
 void wxGenericFileDialog::UpdateControls()
 {
-    wxString dir = m_list->GetDir();
-    m_static->SetLabel(dir);
-
-    bool enable = !IsTopMostDir(dir);
+    const bool enable = !IsTopMostDir(m_filectrl->GetDirectory());
     m_upDirButton->Enable(enable);
 
 #if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
diff --git a/src/gtk/filectrl.cpp b/src/gtk/filectrl.cpp
new file mode 100644
index 0000000000..fa3d8dc8c7
--- /dev/null
+++ b/src/gtk/filectrl.cpp
@@ -0,0 +1,432 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        src/gtk/filectrl.cpp
+// Purpose:     wxGtkFileCtrl Implementation
+// Author:      Diaa M. Sami
+// Created:     2007-08-10
+// RCS-ID:      $Id$
+// Copyright:   (c) Diaa M. Sami
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#include "wx/filectrl.h"
+
+#ifndef WX_PRECOMP
+#    include "wx/sizer.h"
+#    include "wx/debug.h"
+#endif
+
+#include "wx/gtk/private.h"
+#include "wx/filedlg.h"
+#include "wx/filename.h"
+#include "wx/tokenzr.h"
+
+//-----------------------------------------------------------------------------
+// wxGtkFileChooser implementation
+//-----------------------------------------------------------------------------
+
+void wxGtkFileChooser::SetWidget(GtkFileChooser *w)
+{
+    // check arguments
+    wxASSERT( w );
+    wxASSERT( GTK_FILE_CHOOSER( w ) );
+
+    this->m_widget = w;
+}
+
+wxString wxGtkFileChooser::GetPath() const
+{
+    wxGtkString str( gtk_file_chooser_get_filename( m_widget ) );
+
+    if ( str.c_str() == NULL )
+        return wxEmptyString;
+
+    return wxConvFileName->cMB2WX( str );
+}
+
+void wxGtkFileChooser::GetFilenames( wxArrayString& files ) const
+{
+    GetPaths( files );
+    for ( size_t n = 0; n < files.GetCount(); ++n )
+    {
+        const wxFileName file( files[n] );
+        files[n] = file.GetFullName();
+    }
+}
+
+void wxGtkFileChooser::GetPaths( wxArrayString& paths ) const
+{
+    paths.Empty();
+    if ( gtk_file_chooser_get_select_multiple( m_widget ) )
+    {
+        GSList *gpathsi = gtk_file_chooser_get_filenames( m_widget );
+        GSList *gpaths = gpathsi;
+        while ( gpathsi )
+        {
+            wxString file( wxConvFileName->cMB2WX( ( gchar* ) gpathsi->data ) );
+            paths.Add( file );
+            g_free( gpathsi->data );
+            gpathsi = gpathsi->next;
+        }
+
+        g_slist_free( gpaths );
+    }
+    else
+        paths.Add( GetPath() );
+}
+
+bool wxGtkFileChooser::SetPath( const wxString& path )
+{
+    if ( path.empty() ) return true;
+
+    return gtk_file_chooser_set_filename( m_widget,
+                                          wxConvFileName->cWX2MB( path.c_str() ) );
+}
+
+bool wxGtkFileChooser::SetDirectory( const wxString& dir )
+{
+    const gboolean b =
+        gtk_file_chooser_set_current_folder( m_widget,
+                                             wxConvFileName->cWX2MB( dir.c_str() ) );
+    return b == TRUE;
+}
+
+wxString wxGtkFileChooser::GetDirectory() const
+{
+    const wxGtkString str( gtk_file_chooser_get_current_folder( m_widget ) );
+    return wxString( str, *wxConvFileName );
+}
+
+wxString wxGtkFileChooser::GetFilename() const
+{
+    return wxFileName( GetPath() ).GetFullName();
+}
+
+void wxGtkFileChooser::SetWildcard( const wxString& wildCard )
+{
+    // parse filters
+    wxArrayString wildDescriptions, wildFilters;
+
+    if ( !wxParseCommonDialogsFilter( wildCard, wildDescriptions, wildFilters ) )
+    {
+        wxFAIL_MSG( wxT( "wxGtkFileChooser::SetWildcard - bad wildcard string" ) );
+    }
+    else
+    {
+        // Parsing went fine. Set m_wildCard to be returned by wxGtkFileChooserBase::GetWildcard
+        GtkFileChooser* chooser = m_widget;
+
+        // empty current filter list:
+        GSList* ifilters = gtk_file_chooser_list_filters( chooser );
+        GSList* filters = ifilters;
+
+        while ( ifilters )
+        {
+            gtk_file_chooser_remove_filter( chooser, GTK_FILE_FILTER( ifilters->data ) );
+            ifilters = ifilters->next;
+        }
+        g_slist_free( filters );
+
+        if (!wildCard.empty())
+        {
+            // add parsed to GtkChooser
+            for ( size_t n = 0; n < wildFilters.GetCount(); ++n )
+            {
+                GtkFileFilter* filter = gtk_file_filter_new();
+
+                gtk_file_filter_set_name( filter, wxGTK_CONV_SYS( wildDescriptions[n] ) );
+
+                wxStringTokenizer exttok( wildFilters[n], wxT( ";" ) );
+                while ( exttok.HasMoreTokens() )
+                {
+                    wxString token = exttok.GetNextToken();
+                    gtk_file_filter_add_pattern( filter, wxGTK_CONV_SYS( token ) );
+                }
+
+                gtk_file_chooser_add_filter( chooser, filter );
+            }
+
+            // Reset the filter index
+            SetFilterIndex( 0 );
+        }
+    }
+}
+
+void wxGtkFileChooser::SetFilterIndex( int filterIndex )
+{
+    gpointer filter;
+    GtkFileChooser *chooser = m_widget;
+    GSList *filters = gtk_file_chooser_list_filters( chooser );
+
+    filter = g_slist_nth_data( filters, filterIndex );
+
+    if ( filter != NULL )
+    {
+        gtk_file_chooser_set_filter( chooser, GTK_FILE_FILTER( filter ) );
+    }
+    else
+    {
+        wxFAIL_MSG( wxT( "wxGtkFileChooser::SetFilterIndex - bad filter index" ) );
+    }
+
+    g_slist_free( filters );
+}
+
+int wxGtkFileChooser::GetFilterIndex() const
+{
+    GtkFileChooser *chooser = m_widget;
+    GtkFileFilter *filter = gtk_file_chooser_get_filter( chooser );
+    GSList *filters = gtk_file_chooser_list_filters( chooser );
+    const gint index = g_slist_index( filters, filter );
+    g_slist_free( filters );
+
+    if ( index == -1 )
+    {
+        wxFAIL_MSG( wxT( "wxGtkFileChooser::GetFilterIndex - bad filter index returned by gtk+" ) );
+        return 0;
+    }
+    else
+        return index;
+};
+
+//-----------------------------------------------------------------------------
+// end wxGtkFileChooser Implementation
+//-----------------------------------------------------------------------------
+
+#if wxUSE_FILECTRL
+
+// gtk signal handlers
+
+extern "C"
+{
+    static void
+    gtkfilechooserwidget_file_activated_callback( GtkWidget *WXUNUSED( widget ), wxGtkFileCtrl *fileCtrl )
+    {
+        GenerateFileActivatedEvent( fileCtrl, fileCtrl );
+    }
+}
+
+extern "C"
+{
+    static void
+    gtkfilechooserwidget_selection_changed_callback( GtkWidget *WXUNUSED( widget ), wxGtkFileCtrl *fileCtrl )
+    {
+        // check next selection event and ignore it if it has 0 files
+        // because such events are redundantly generated by gtk.
+        if ( fileCtrl->m_checkNextSelEvent )
+        {
+            wxArrayString filenames;
+            fileCtrl->GetFilenames( filenames );
+
+            if ( filenames.Count() != 0 )
+                fileCtrl->m_checkNextSelEvent = false;
+        }
+
+        if ( !fileCtrl->m_checkNextSelEvent )
+            GenerateSelectionChangedEvent( fileCtrl, fileCtrl );
+    }
+}
+
+extern "C"
+{
+    static void
+    gtkfilechooserwidget_folder_changed_callback( GtkWidget *WXUNUSED( widget ), wxGtkFileCtrl *fileCtrl )
+    {
+        if ( fileCtrl->m_ignoreNextFolderChangeEvent )
+        {
+            fileCtrl->m_ignoreNextFolderChangeEvent = false;
+        }
+        else
+        {
+            GenerateFolderChangedEvent( fileCtrl, fileCtrl );
+        }
+
+        fileCtrl->m_checkNextSelEvent = true;
+    }
+}
+
+// wxGtkFileCtrl implementation
+
+IMPLEMENT_DYNAMIC_CLASS( wxGtkFileCtrl, wxControl )
+
+void wxGtkFileCtrl::Init()
+{
+    m_hasFocus = false;
+    m_checkNextSelEvent = false;
+
+    // ignore the first folder change event which is fired upon startup.
+    m_ignoreNextFolderChangeEvent = true;
+}
+
+bool wxGtkFileCtrl::Create( wxWindow *parent,
+                            wxWindowID id,
+                            const wxString& defaultDirectory,
+                            const wxString& defaultFileName,
+                            const wxString& wildCard,
+                            long style,
+                            const wxPoint& pos,
+                            const wxSize& size,
+                            const wxString& name )
+{
+    if ( !PreCreation( parent, pos, size ) ||
+            !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ) )
+    {
+        wxFAIL_MSG( wxT( "wxGtkFileCtrl creation failed" ) );
+        return false;
+    }
+
+    GtkFileChooserAction gtkAction;
+
+    if ( style & wxFC_SAVE )
+    {
+        gtkAction = GTK_FILE_CHOOSER_ACTION_SAVE;
+    }
+    else if ( style & wxFC_OPEN )
+    {
+        gtkAction = GTK_FILE_CHOOSER_ACTION_OPEN;
+    }
+
+    m_widget =  gtk_alignment_new ( 0, 0, 1, 1 );
+    m_fcWidget = GTK_FILE_CHOOSER( gtk_file_chooser_widget_new( GTK_FILE_CHOOSER_ACTION_OPEN ) );
+    gtk_widget_show ( GTK_WIDGET( m_fcWidget ) );
+    gtk_container_add ( GTK_CONTAINER ( m_widget ), GTK_WIDGET( m_fcWidget ) );
+
+    m_focusWidget = GTK_WIDGET( m_fcWidget );
+
+    g_signal_connect ( m_fcWidget, "file-activated",
+                       G_CALLBACK ( gtkfilechooserwidget_file_activated_callback ),
+                       this );
+
+    g_signal_connect ( m_fcWidget, "current-folder-changed",
+                       G_CALLBACK ( gtkfilechooserwidget_folder_changed_callback ),
+                       this );
+
+    g_signal_connect ( m_fcWidget, "selection-changed",
+                       G_CALLBACK ( gtkfilechooserwidget_selection_changed_callback ),
+                       this );
+
+    m_fc.SetWidget( m_fcWidget );
+
+    if ( style & wxFC_MULTIPLE )
+        gtk_file_chooser_set_select_multiple( m_fcWidget, true );
+
+    SetWildcard( wildCard );
+
+    // if defaultDir is specified it should contain the directory and
+    // defaultFileName should contain the default name of the file, however if
+    // directory is not given, defaultFileName contains both
+    wxFileName fn;
+    if ( defaultDirectory.empty() )
+        fn.Assign( defaultFileName );
+    else if ( !defaultFileName.empty() )
+        fn.Assign( defaultDirectory, defaultFileName );
+    else
+        fn.AssignDir( defaultDirectory );
+
+    // set the initial file name and/or directory
+    const wxString dir = fn.GetPath();
+    if ( !dir.empty() )
+    {
+        gtk_file_chooser_set_current_folder( m_fcWidget,
+                                             dir.fn_str() );
+    }
+
+    const wxString fname = fn.GetFullName();
+    if ( style & wxFC_SAVE )
+    {
+        if ( !fname.empty() )
+        {
+            gtk_file_chooser_set_current_name( m_fcWidget,
+                                               fname.fn_str() );
+        }
+    }
+    else // wxFC_OPEN
+    {
+        if ( !fname.empty() )
+        {
+            gtk_file_chooser_set_filename( m_fcWidget,
+                                           fn.GetFullPath().fn_str() );
+        }
+    }
+
+    m_parent->DoAddChild( this );
+
+    PostCreation( size );
+
+    return TRUE;
+}
+
+bool wxGtkFileCtrl::SetPath( const wxString& path )
+{
+    return m_fc.SetPath( path );
+}
+
+bool wxGtkFileCtrl::SetDirectory( const wxString& dir )
+{
+    return m_fc.SetDirectory( dir );
+}
+
+bool wxGtkFileCtrl::SetFilename( const wxString& name )
+{
+    if ( !gtk_check_version( 2, 4, 0 ) )
+    {
+        if ( HasFlag( wxFC_SAVE ) )
+        {
+            gtk_file_chooser_set_current_name( m_fcWidget, wxGTK_CONV( name ) );
+            return true;
+        }
+        else
+            return SetPath( wxFileName( GetDirectory(), name ).GetFullPath() );
+    }
+
+    return false;
+}
+
+void wxGtkFileCtrl::SetWildcard( const wxString& wildCard )
+{
+    m_wildCard = wildCard;
+
+    m_fc.SetWildcard( wildCard );
+}
+
+void wxGtkFileCtrl::SetFilterIndex( int filterIndex )
+{
+    m_fc.SetFilterIndex( filterIndex );
+}
+
+wxString wxGtkFileCtrl::GetPath() const
+{
+    return m_fc.GetPath();
+}
+
+void wxGtkFileCtrl::GetPaths( wxArrayString& paths ) const
+{
+    m_fc.GetPaths( paths );
+}
+
+wxString wxGtkFileCtrl::GetDirectory() const
+{
+    return m_fc.GetDirectory();
+}
+
+wxString wxGtkFileCtrl::GetFilename() const
+{
+    return m_fc.GetFilename();
+}
+
+void wxGtkFileCtrl::GetFilenames( wxArrayString& files ) const
+{
+    m_fc.GetFilenames( files );
+}
+
+void wxGtkFileCtrl::ShowHidden(const bool show)
+{
+    gtk_file_chooser_set_show_hidden( m_fcWidget, ( show == true ) ? TRUE : FALSE );
+}
+
+#endif // wxUSE_FILECTRL
diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp
index 12439a5e07..ce722561ac 100644
--- a/src/gtk/filedlg.cpp
+++ b/src/gtk/filedlg.cpp
@@ -198,6 +198,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
                    ok_btn_stock, GTK_RESPONSE_ACCEPT,
                    NULL);
 
+    m_fc.SetWidget( GTK_FILE_CHOOSER(m_widget) );
+
     gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
 
     if ( style & wxFD_MULTIPLE )
@@ -287,7 +289,7 @@ void wxFileDialog::OnFakeOk( wxCommandEvent &event )
     if (!gtk_check_version(2,4,0))
         EndDialog(wxID_OK);
     else
-        wxGenericFileDialog::OnListOk( event );
+        wxGenericFileDialog::OnOk( event );
 }
 
 int wxFileDialog::ShowModal()
@@ -318,8 +320,7 @@ wxString wxFileDialog::GetPath() const
 {
     if (!gtk_check_version(2,4,0))
     {
-        wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
-        return wxString(str, *wxConvFileName);
+        return m_fc.GetPath();
     }
 
     return wxGenericFileDialog::GetPath();
@@ -329,12 +330,7 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
 {
     if (!gtk_check_version(2,4,0))
     {
-        GetPaths(files);
-        for (size_t n = 0; n < files.GetCount(); ++n )
-        {
-            wxFileName file(files[n]);
-            files[n] = file.GetFullName();
-        }
+        m_fc.GetFilenames( files );
     }
     else
         wxGenericFileDialog::GetFilenames( files );
@@ -344,23 +340,7 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const
 {
     if (!gtk_check_version(2,4,0))
     {
-        paths.Empty();
-        if (gtk_file_chooser_get_select_multiple(GTK_FILE_CHOOSER(m_widget)))
-        {
-            GSList *gpathsi = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(m_widget));
-            GSList *gpaths = gpathsi;
-            while (gpathsi)
-            {
-                wxString file((gchar*) gpathsi->data, *wxConvFileName);
-                paths.Add(file);
-                g_free(gpathsi->data);
-                gpathsi = gpathsi->next;
-            }
-
-            g_slist_free(gpaths);
-        }
-        else
-            paths.Add(GetPath());
+        m_fc.GetPaths( paths );
     }
     else
         wxGenericFileDialog::GetPaths( paths );
@@ -381,9 +361,7 @@ void wxFileDialog::SetPath(const wxString& path)
 {
     if (!gtk_check_version(2,4,0))
     {
-        if (path.empty()) return;
-
-        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget), path.fn_str());
+        m_fc.SetPath( path );
     }
     else
         wxGenericFileDialog::SetPath( path );
@@ -393,10 +371,7 @@ void wxFileDialog::SetDirectory(const wxString& dir)
 {
     if (!gtk_check_version(2,4,0))
     {
-        if (wxDirExists(dir))
-        {
-            gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), dir.fn_str());
-        }
+        m_fc.SetDirectory( dir );
     }
     else
         wxGenericFileDialog::SetDirectory( dir );
@@ -406,8 +381,7 @@ wxString wxFileDialog::GetDirectory() const
 {
     if (!gtk_check_version(2,4,0))
     {
-        wxGtkString str(gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(m_widget)));
-        return wxString(str, *wxConvFileName);
+        m_fc.GetDirectory();
     }
 
     return wxGenericFileDialog::GetDirectory();
@@ -429,7 +403,7 @@ void wxFileDialog::SetFilename(const wxString& name)
 wxString wxFileDialog::GetFilename() const
 {
     if (!gtk_check_version(2,4,0))
-        return wxFileName(GetPath()).GetFullName();
+        return m_fc.GetFilename();
     else
         return wxGenericFileDialog::GetFilename();
 }
@@ -438,49 +412,7 @@ void wxFileDialog::SetWildcard(const wxString& wildCard)
 {
     if (!gtk_check_version(2,4,0))
     {
-        // parse filters
-        wxArrayString wildDescriptions, wildFilters;
-        if (!wxParseCommonDialogsFilter(wildCard, wildDescriptions, wildFilters))
-        {
-            wxFAIL_MSG( wxT("wxFileDialog::SetWildCard - bad wildcard string") );
-        }
-        else
-        {
-            // Parsing went fine. Set m_wildCard to be returned by wxFileDialogBase::GetWildcard
-            m_wildCard = wildCard;
-
-            GtkFileChooser* chooser = GTK_FILE_CHOOSER(m_widget);
-
-            // empty current filter list:
-            GSList* ifilters = gtk_file_chooser_list_filters(chooser);
-            GSList* filters = ifilters;
-
-            while (ifilters)
-            {
-                gtk_file_chooser_remove_filter(chooser,GTK_FILE_FILTER(ifilters->data));
-                ifilters = ifilters->next;
-            }
-            g_slist_free(filters);
-
-            // add parsed to GtkChooser
-            for (size_t n = 0; n < wildFilters.GetCount(); ++n)
-            {
-                GtkFileFilter* filter = gtk_file_filter_new();
-                gtk_file_filter_set_name(filter, wxGTK_CONV(wildDescriptions[n]));
-
-                wxStringTokenizer exttok(wildFilters[n], wxT(";"));
-                while (exttok.HasMoreTokens())
-                {
-                    wxString token = exttok.GetNextToken();
-                    gtk_file_filter_add_pattern(filter, wxGTK_CONV(token));
-                }
-
-                gtk_file_chooser_add_filter(chooser, filter);
-            }
-
-            // Reset the filter index
-            SetFilterIndex(0);
-        }
+        m_fc.SetWildcard( wildCard );
     }
     else
         wxGenericFileDialog::SetWildcard( wildCard );
@@ -491,22 +423,7 @@ void wxFileDialog::SetFilterIndex(int filterIndex)
 
     if (!gtk_check_version(2,4,0))
     {
-        gpointer filter;
-        GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
-        GSList *filters = gtk_file_chooser_list_filters(chooser);
-
-        filter = g_slist_nth_data(filters, filterIndex);
-
-        if (filter != NULL)
-        {
-            gtk_file_chooser_set_filter(chooser, GTK_FILE_FILTER(filter));
-        }
-        else
-        {
-            wxFAIL_MSG( wxT("wxFileDialog::SetFilterIndex - bad filter index") );
-        }
-
-        g_slist_free(filters);
+       m_fc.SetFilterIndex( filterIndex);
     }
     else
         wxGenericFileDialog::SetFilterIndex( filterIndex );
@@ -516,19 +433,7 @@ int wxFileDialog::GetFilterIndex() const
 {
     if (!gtk_check_version(2,4,0))
     {
-        GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
-        GtkFileFilter *filter = gtk_file_chooser_get_filter(chooser);
-        GSList *filters = gtk_file_chooser_list_filters(chooser);
-        gint index = g_slist_index(filters, filter);
-        g_slist_free(filters);
-
-        if (index == -1)
-        {
-            wxFAIL_MSG( wxT("wxFileDialog::GetFilterIndex - bad filter index returned by gtk+") );
-            return 0;
-        }
-        else
-            return index;
+        return m_fc.GetFilterIndex();
     }
     else
                 return wxGenericFileDialog::GetFilterIndex();
diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp
index 06b502e07a..3827fd1b3d 100644
--- a/src/gtk1/filedlg.cpp
+++ b/src/gtk1/filedlg.cpp
@@ -44,7 +44,7 @@ wxFileDialog::~wxFileDialog()
 
 void wxFileDialog::OnFakeOk( wxCommandEvent &event )
 {
-    wxGenericFileDialog::OnListOk( event );
+    wxGenericFileDialog::OnOk( event );
 }
 
 int wxFileDialog::ShowModal()
-- 
2.50.0

