diff --git a/tests/Makefile.in b/tests/Makefile.in
index bf0ba869ec..0f692c4cce 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -132,6 +132,7 @@ TEST_GUI_OBJECTS = \
test_gui_textentrytest.o \
test_gui_treectrltest.o \
test_gui_propagation.o \
+ test_gui_evthandler.o \
test_gui_rawbmp.o \
test_gui_htmlwindow.o \
test_gui_guifuncs.o \
@@ -573,6 +574,9 @@ test_gui_treectrltest.o: $(srcdir)/controls/treectrltest.cpp $(TEST_GUI_ODEP)
test_gui_propagation.o: $(srcdir)/events/propagation.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/events/propagation.cpp
+test_gui_evthandler.o: $(srcdir)/events/evthandler.cpp $(TEST_GUI_ODEP)
+ $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/events/evthandler.cpp
+
test_gui_rawbmp.o: $(srcdir)/image/rawbmp.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/image/rawbmp.cpp
diff --git a/tests/events/evthandler.cpp b/tests/events/evthandler.cpp
new file mode 100644
index 0000000000..b6de473373
--- /dev/null
+++ b/tests/events/evthandler.cpp
@@ -0,0 +1,188 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name: tests/events/evthandler.cpp
+// Purpose: Test the new event types and wxEvtHandler-methods
+// Author: Peter Most
+// Created: 2009-01-24
+// RCS-ID: $Id$
+// Copyright: (c) 2009 Peter Most
+///////////////////////////////////////////////////////////////////////////////
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "testprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif // WX_PRECOMP
+
+#include "wx/event.h"
+
+
+// --------------------------------------------------------------------------
+// test class
+// --------------------------------------------------------------------------
+
+class EvtHandlerTestCase : public CppUnit::TestCase
+{
+public:
+ EvtHandlerTestCase() {}
+
+private:
+ CPPUNIT_TEST_SUITE( EvtHandlerTestCase );
+ CPPUNIT_TEST( TestConnectCompilation );
+ CPPUNIT_TEST( TestEventFunctorCompare );
+ CPPUNIT_TEST_SUITE_END();
+
+ void TestConnectCompilation();
+ void TestEventFunctorCompare();
+
+ DECLARE_NO_COPY_CLASS(EvtHandlerTestCase)
+};
+
+// register in the unnamed registry so that these tests are run by default
+CPPUNIT_TEST_SUITE_REGISTRATION( EvtHandlerTestCase );
+
+// also include in it's own registry so that these tests can be run alone
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( EvtHandlerTestCase, "EvtHandlerTestCase" );
+
+const wxEventType EVT_LEGACY = wxNewEventType();
+
+class MyEvent : public wxEvent
+{
+};
+
+wxDEFINE_EVENT( EVT_EVENT, MyEvent )
+
+// An arbitrary functor:
+
+class MyFunctor
+{
+ public:
+ void operator () ( MyEvent & )
+ { }
+
+ bool operator == ( const MyFunctor & ) const
+ { return ( true ); }
+};
+
+
+class MyHandler : public wxEvtHandler
+{
+ public:
+ void handleMethod( MyEvent & )
+ { }
+
+ static void handleFunction( MyEvent & )
+ { }
+
+ void handleEvent( wxEvent & )
+ { }
+
+};
+
+void EvtHandlerTestCase::TestConnectCompilation()
+{
+ // Test that connecting the 'legacy' events still compiles:
+
+ MyHandler handler;
+
+ handler.Connect( EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent, NULL, &handler );
+ handler.Connect( 0, EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent, NULL, &handler );
+ handler.Connect( 0, 0, EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent, NULL, &handler );
+
+ handler.Disconnect( EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent, NULL, &handler );
+ handler.Disconnect( 0, EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent, NULL, &handler );
+ handler.Disconnect( 0, 0, EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent, NULL, &handler );
+
+
+
+ handler.Connect( EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent );
+ handler.Connect( 0, EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent );
+ handler.Connect( 0, 0, EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent );
+
+ handler.Disconnect( EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent );
+ handler.Disconnect( 0, EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent );
+ handler.Disconnect( 0, 0, EVT_LEGACY, (wxObjectEventFunction)&MyHandler::handleEvent );
+
+ // Call (and therefore instantiate) all Connect() variants to detect template
+ // errors:
+
+#if !wxEVENTS_COMPATIBILITY_2_8
+
+ handler.Connect( EVT_EVENT, &MyHandler::handleFunction );
+ handler.Connect( 0, EVT_EVENT, &MyHandler::handleFunction );
+ handler.Connect( 0, 0, EVT_EVENT, &MyHandler::handleFunction );
+
+ handler.Disconnect( EVT_EVENT, &MyHandler::handleFunction );
+ handler.Disconnect( 0, EVT_EVENT, &MyHandler::handleFunction );
+ handler.Disconnect( 0, 0, EVT_EVENT, &MyHandler::handleFunction );
+
+
+
+ handler.Connect( EVT_EVENT, &MyHandler::handleMethod );
+ handler.Connect( 0, EVT_EVENT, &MyHandler::handleMethod );
+ handler.Connect( 0, 0, EVT_EVENT, &MyHandler::handleMethod );
+
+ handler.Disconnect( EVT_EVENT, &MyHandler::handleMethod );
+ handler.Disconnect( 0, EVT_EVENT, &MyHandler::handleMethod );
+ handler.Disconnect( 0, 0, EVT_EVENT, &MyHandler::handleMethod );
+
+
+
+ handler.Connect( EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+ handler.Connect( 0, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+ handler.Connect( 0, 0, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+
+ handler.Disconnect( EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+ handler.Disconnect( 0, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+ handler.Disconnect( 0, 0, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+
+
+
+ wxEvtHandler::Connect( &handler, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+ wxEvtHandler::Connect( &handler, 0, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+ wxEvtHandler::Connect( &handler, 0, 0, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+
+ wxEvtHandler::Disconnect( &handler, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+ wxEvtHandler::Disconnect( &handler, 0, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+ wxEvtHandler::Disconnect( &handler, 0, 0, EVT_EVENT, &MyHandler::handleMethod, NULL, &handler );
+
+
+
+ MyFunctor functor;
+
+ handler.Connect( EVT_EVENT, functor );
+ handler.Connect( 0, EVT_EVENT, functor );
+ handler.Connect( 0, 0, EVT_EVENT, functor );
+
+ handler.Disconnect( EVT_EVENT, functor );
+ handler.Disconnect( 0, EVT_EVENT, functor );
+ handler.Disconnect( 0, 0, EVT_EVENT, functor );
+#endif
+}
+
+void EvtHandlerTestCase::TestEventFunctorCompare()
+{
+//#if !wxEVENTS_COMPATIBILITY_2_8
+// MyHandler handler1;
+// wxEventFunctor *connectFunctor = wxNewEventFunctor( EVT_EVENT, &MyHandler::handleMethod, &handler1 );
+// wxEventFunctor *disconnectFunctor = wxNewEventFunctor( EVT_EVENT, &MyHandler::handleMethod, &handler1 );
+// wxEventFunctor *nullFunctor = wxNewEventFunctor( EVT_EVENT, &MyHandler::handleMethod );
+//
+// CPPUNIT_ASSERT( connectFunctor->Matches( *disconnectFunctor ));
+// CPPUNIT_ASSERT( disconnectFunctor->Matches( *connectFunctor ));
+//
+// CPPUNIT_ASSERT( connectFunctor->Matches( *nullFunctor ));
+// CPPUNIT_ASSERT( nullFunctor->Matches( *connectFunctor ));
+//
+// CPPUNIT_ASSERT( disconnectFunctor->Matches( *nullFunctor ));
+// CPPUNIT_ASSERT( nullFunctor->Matches( *disconnectFunctor ));
+//#endif
+}
+
+
diff --git a/tests/makefile.bcc b/tests/makefile.bcc
index 9271298a01..bf331edec9 100644
--- a/tests/makefile.bcc
+++ b/tests/makefile.bcc
@@ -117,6 +117,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_textentrytest.obj \
$(OBJS)\test_gui_treectrltest.obj \
$(OBJS)\test_gui_propagation.obj \
+ $(OBJS)\test_gui_evthandler.obj \
$(OBJS)\test_gui_rawbmp.obj \
$(OBJS)\test_gui_htmlwindow.obj \
$(OBJS)\test_gui_guifuncs.obj \
@@ -613,6 +614,9 @@ $(OBJS)\test_gui_treectrltest.obj: .\controls\treectrltest.cpp
$(OBJS)\test_gui_propagation.obj: .\events\propagation.cpp
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\events\propagation.cpp
+$(OBJS)\test_gui_evthandler.obj: .\events\evthandler.cpp
+ $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\events\evthandler.cpp
+
$(OBJS)\test_gui_rawbmp.obj: .\image\rawbmp.cpp
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\image\rawbmp.cpp
diff --git a/tests/makefile.gcc b/tests/makefile.gcc
index db755e8a1c..d7095870ef 100644
--- a/tests/makefile.gcc
+++ b/tests/makefile.gcc
@@ -110,6 +110,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_textentrytest.o \
$(OBJS)\test_gui_treectrltest.o \
$(OBJS)\test_gui_propagation.o \
+ $(OBJS)\test_gui_evthandler.o \
$(OBJS)\test_gui_rawbmp.o \
$(OBJS)\test_gui_htmlwindow.o \
$(OBJS)\test_gui_guifuncs.o \
@@ -593,6 +594,9 @@ $(OBJS)\test_gui_treectrltest.o: ./controls/treectrltest.cpp
$(OBJS)\test_gui_propagation.o: ./events/propagation.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\test_gui_evthandler.o: ./events/evthandler.cpp
+ $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\test_gui_rawbmp.o: ./image/rawbmp.cpp
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
diff --git a/tests/makefile.vc b/tests/makefile.vc
index ae369520e3..8d529d7ee1 100644
--- a/tests/makefile.vc
+++ b/tests/makefile.vc
@@ -113,6 +113,7 @@ TEST_GUI_OBJECTS = \
$(OBJS)\test_gui_textentrytest.obj \
$(OBJS)\test_gui_treectrltest.obj \
$(OBJS)\test_gui_propagation.obj \
+ $(OBJS)\test_gui_evthandler.obj \
$(OBJS)\test_gui_rawbmp.obj \
$(OBJS)\test_gui_htmlwindow.obj \
$(OBJS)\test_gui_guifuncs.obj \
@@ -698,6 +699,9 @@ $(OBJS)\test_gui_treectrltest.obj: .\controls\treectrltest.cpp
$(OBJS)\test_gui_propagation.obj: .\events\propagation.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\events\propagation.cpp
+$(OBJS)\test_gui_evthandler.obj: .\events\evthandler.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\events\evthandler.cpp
+
$(OBJS)\test_gui_rawbmp.obj: .\image\rawbmp.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\image\rawbmp.cpp
diff --git a/tests/makefile.wat b/tests/makefile.wat
index 195a2072d9..c5ca2d09ec 100644
--- a/tests/makefile.wat
+++ b/tests/makefile.wat
@@ -344,6 +344,7 @@ TEST_GUI_OBJECTS = &
$(OBJS)\test_gui_textentrytest.obj &
$(OBJS)\test_gui_treectrltest.obj &
$(OBJS)\test_gui_propagation.obj &
+ $(OBJS)\test_gui_evthandler.obj &
$(OBJS)\test_gui_rawbmp.obj &
$(OBJS)\test_gui_htmlwindow.obj &
$(OBJS)\test_gui_guifuncs.obj &
@@ -650,6 +651,9 @@ $(OBJS)\test_gui_treectrltest.obj : .AUTODEPEND .\controls\treectrltest.cpp
$(OBJS)\test_gui_propagation.obj : .AUTODEPEND .\events\propagation.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
+$(OBJS)\test_gui_evthandler.obj : .AUTODEPEND .\events\evthandler.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
+
$(OBJS)\test_gui_rawbmp.obj : .AUTODEPEND .\image\rawbmp.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
diff --git a/tests/test.bkl b/tests/test.bkl
index 56ef3ef897..6c3f46c55c 100644
--- a/tests/test.bkl
+++ b/tests/test.bkl
@@ -114,6 +114,7 @@
controls/textentrytest.cpp
controls/treectrltest.cpp
events/propagation.cpp
+ events/evthandler.cpp
image/rawbmp.cpp
html/htmlwindow.cpp
misc/guifuncs.cpp
diff --git a/tests/test_test_gui.dsp b/tests/test_test_gui.dsp
index 28eb179fe3..00e7d760d0 100644
--- a/tests/test_test_gui.dsp
+++ b/tests/test_test_gui.dsp
@@ -253,6 +253,10 @@ SOURCE=.\dummy.cpp
# End Source File
# Begin Source File
+SOURCE=.\events\evthandler.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\misc\garbage.cpp
# End Source File
# Begin Source File
diff --git a/tests/test_vc7_test_gui.vcproj b/tests/test_vc7_test_gui.vcproj
index ea1232cfab..6cb498beb8 100644
--- a/tests/test_vc7_test_gui.vcproj
+++ b/tests/test_vc7_test_gui.vcproj
@@ -609,6 +609,9 @@
UsePrecompiledHeader="1"/>
+
+
diff --git a/tests/test_vc8_test_gui.vcproj b/tests/test_vc8_test_gui.vcproj
index f5a15dd0f4..913db73e77 100644
--- a/tests/test_vc8_test_gui.vcproj
+++ b/tests/test_vc8_test_gui.vcproj
@@ -891,6 +891,10 @@
/>
+
+
diff --git a/tests/test_vc9_test_gui.vcproj b/tests/test_vc9_test_gui.vcproj
index 31c7de222e..3a677d5af8 100644
--- a/tests/test_vc9_test_gui.vcproj
+++ b/tests/test_vc9_test_gui.vcproj
@@ -863,6 +863,10 @@
/>
+
+